Pages

29 Apr 2014

Host Your Website In Local Network Using Windows IIS 7.5 OR 7

Step - By - Step IIS Configuration For Run Website In Local Network

1-Run the IIS Manager - in the Start Menu type "IIS"


2-Right-Click on 'Sites' and click 'Add Web Site'
Note: You may need to 'Expand' the explorer branch to allow you to see 'Sites'



3-Enter a 'Site Name', this can be anything (E.g. MyNewSite), 'Physical Path' (E.g. C:\MY_SITE)  and click OK



Router/Windows Firewall exception
4-In the Start Menu, type "firewall" and click 'Windows Firewall with Advanced Settings'



5-Click 'Inbound Rules' then 'New Rule' to start the 'New Rule Wizard. Click 'Port' then 'Next'


6-Click 'TCP' and enter port '80' then click 'Next'


7-Click 'Allow the connection' then click 'Next'


8-Click the rules that apply, then 'Next'


9-Lastly, name the new rule & click 'Finish'


10-You will see that the new rule has now been created and you can close Windows firewall


Enjoy : - Your Website Work In Local Network.

12 Feb 2014

jQuery hide table rows after third with asp.net, HTML, Jquery

<table>
    <tr id="duplicate">
        <td style="text-align:center;">1</td>
    </tr>
    <tr id="duplicate">
        <td style="text-align:center;">2</td>
    </tr>
    <tr id="duplicate">
        <td style="text-align:center;">3</td>
    </tr>
    <tr id="duplicate">
        <td style="text-align:center;">4</td>
    </tr>
    <tr id="duplicate">
        <td style="text-align:center;">5</td>
    </tr>

jquery:

$(document).ready(function() {
    $('#duplicate'):nth-child(n+3).hide();
    alert('123');
});

9 Feb 2014

Using jQuery to see if a drop down menu select has changed

EXAMPLE2

$("#dropdownID").live('change', function() {
    if ($(this).val() == 'selectionKey'){
        DoSomething();
    } else {
        DoSomethingElse();
    }
});


EXAMPLE2

if ($('#SEJob_ShipmentType').live('change', function() {
        alert($('#SEJob_ShipmentType option:selected').text());
        if ($('#SEJob_ShipmentType option:selected').text() == 'FCL') {
            $('#SEJob_PickUpDate').enabled = false;
        }
    }))

6 Feb 2014

Date fromat change using string format in asp.net

  int strlen;
            string dd, mm, yy, From, To;
            strlen = FromDate.Text.Length;
            dd = FromDate.Text.Substring(0, strlen - 8);
            mm = FromDate.Text.Substring(3, strlen - 8);
            yy = FromDate.Text.Substring(6, strlen - 6);
            From = yy + mm + dd;
            dd = ToDate.Text.Substring(0, strlen - 8);
            mm = ToDate.Text.Substring(3, strlen - 8);
            yy = ToDate.Text.Substring(6, strlen - 6);
            To = yy + mm + dd;

Theme apply in asp.net using CSS With Jquery

var StyleFile = "theme1" + document.cookie.charAt(6) + ".css";
document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '">');

Count Days in between from date and to date in asp.net with jquery in asp.net

$(document).ready(function() {

    var FistDate, SecondDate;
    if ($('#ctl00_ContentPlaceHolder1_ToDate').blur(function() {

        FistDate = $('#ctl00_ContentPlaceHolder1_FromDate').val();
        SecondDate = $('#ctl00_ContentPlaceHolder1_ToDate').val();
        compareDate(FistDate, SecondDate);
        var FistDate = new Date($("#ctl00_ContentPlaceHolder1_FromDate").val().split("/").reverse().join(","));
        var SecondDate = new Date($("#ctl00_ContentPlaceHolder1_ToDate").val().split("/").reverse().join(","));
        var days = (SecondDate - FistDate) / 86400000;
        //alert(FistDate + '  ' + SecondDate);
        $("#ctl00_ContentPlaceHolder1_TotalLeave").val(days + 1);
        //DayCalculate(FistDate, SecondDate);
    }));

    function compareDate(dateTo, dateFrom) {
        var str2 = dateTo;
        var str4 = dateFrom;
        var ONE_DAY = 1000 * 60 * 60 * 24;
        var dt2 = parseInt(str2.substring(0, 2), 10);
        var mon2 = parseInt(str2.substring(3, 5), 10);
        var yr2 = parseInt(str2.substring(6, 10), 10);
        var dt4 = parseInt(str4.substring(0, 2), 10);
        var mon4 = parseInt(str4.substring(3, 5), 10);
        var yr4 = parseInt(str4.substring(6, 10), 10);
        var date2 = new Date(yr2, mon2 - 1, dt2);
        var date4 = new Date(yr4, mon4 - 1, dt4);
        var date2_ms = date2.getTime();
        var date4_ms = date4.getTime();
        var difference_ms = Math.abs(date2_ms - date4_ms)
        var y = Math.round(difference_ms / ONE_DAY)
        if (date2 > date4) {
            $("#ctl00_ContentPlaceHolder1_FromDate").val('');
            $("#ctl00_ContentPlaceHolder1_ToDate").val('');
            alert("From Date Is Less Than To Date");
            $("#ctl00_ContentPlaceHolder1_TotalLeave").val('');
        }
    }

  

})
 

16 Jan 2014

SQL SERVER – Query to Find First and Last Day of Current Month

----Today
SELECT GETDATE() 'Today'
----Yesterday
SELECT DATEADD(d,-1,GETDATE()) 'Yesterday'
----First Day of Current Week
SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0) 'First Day of Current Week'
----Last Day of Current Week
SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),6) 'Last Day of Current Week'
----First Day of Last Week
SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),0) 'First Day of Last Week'
----Last Day of Last Week
SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),6) 'Last Day of Last Week'
----First Day of Current Month
SELECT DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0) 'First Day of Current Month'
----Last Day of Current Month
SELECT DATEADD(ms,- 3,DATEADD(mm,0,DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,0))) 'Last Day of Current Month'
----First Day of Last Month
SELECT DATEADD(mm,-1,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) 'First Day of Last Month'
----Last Day of Last Month
SELECT DATEADD(ms,-3,DATEADD(mm,0,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0))) 'Last Day of Last Month'
----First Day of Current Year
SELECT DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0) 'First Day of Current Year'
----Last Day of Current Year
SELECT DATEADD(ms,-3,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,GETDATE())+1,0))) 'Last Day of Current Year'
----First Day of Last Year
SELECT DATEADD(yy,-1,DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0)) 'First Day of Last Year'
----Last Day of Last Year
SELECT DATEADD(ms,-3,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0))) 'Last Day of Last Year'

ResultSet:

Today
———————–
2008-08-29 21:54:58.967

Yesterday
———————–
2008-08-28 21:54:58.967

First Day of Current Week
————————-
2008-08-25 00:00:00.000

Last Day of Current Week
————————
2008-08-31 00:00:00.000

First Day of Last Week
———————–
2008-08-18 00:00:00.000

Last Day of Last Week
———————–
2008-08-24 00:00:00.000

First Day of Current Month
————————–
2008-08-01 00:00:00.000

Last Day of Current Month
————————-
2008-08-31 23:59:59.997

First Day of Last Month
———————–
2008-07-01 00:00:00.000

Last Day of Last Month
———————–
2008-07-31 23:59:59.997

First Day of Current Year
————————-
2008-01-01 00:00:00.000

Last Day of Current Year
————————
2008-12-31 23:59:59.997

First Day of Last Year
———————–
2007-01-01 00:00:00.000

Last Day of Last Year
———————–
2007-12-31 23:59:59.997