Settings Table
==============
Company Logo
Company Name
Company Address
Company Details
Login Background
Image Path [Where employee picture will be stored]


<%--    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>--%>


Value='<%#(((GridViewRow) Container).FindControl("tp_lblShiftId") as Label).Text %>'
Text='<%#(((GridViewRow) Container).FindControl("tp_lblShiftCode") as Label).Text %>'

================================================================================================================
            //object[] paramvalues= new object [] { iUserID.ToString() };
            //dtLoc = dal.fnGetDataTable(sProcName, paramvalues);
================================================================================================================
//The below line has to be passed from the form
//List<object> parameters = new List<object>() { "123", "234", 99 };
================================================================================================================
//Converting Datatable to JSON String


//System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
//List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
//Dictionary<string, object> row;
//foreach (DataRow dr in dt.Rows)
//{
//row = new Dictionary<string, object>();
//foreach (DataColumn col in dt.Columns)
//{
//row.Add(col.ColumnName, dr[col]);
//}
//rows.Add(row);
//}
//return serializer.Serialize(rows);
================================================================================================================
var data = {"name":"John Doe"}
$.ajax({
    datatype : "json",
    contentType: "application/json; charset=utf-8",
    data : JSON.stringify(data),
    success : function(result) {
        alert(result.success); // result is an object which is created from the returned JSON
    },
});

================================================================================================================

//xmlDoc = $.parseXML(data.d);
//alert(xmlDoc);
//$xml = $(xmlDoc);
//alert($xml.find('LocName').text());
////$.each($.parseXML(data.d), function (xmlobj) {
//    alert($(xmlobj).find('LocName').val());
//})

================================================================================================================

$(data.d).find('Location').each(function () {
var txtLocName = '#<%=txtName.ClientID%>';
$(txtLocName).val($(this).find('LocName').text());
$(txtLocCode).attr('disabled', 'disabled');
});
================================================================================================================

 ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "function",      "try{function();}catch(err){}", True)
 Master Page
 //ScriptManager.RegisterStartupScript(FindControl("upData"), this.GetType(), "Alert", "alert('" + Message + "')", true);
//ScriptManager.RegisterStartupScript(FindControl("ddlSLoc"), this.GetType(), "jQuery Function", "$('#" + gvDepartment.ClientID + "').dataTable();", true);

//string strScript = "$('#" + gvDepartment.ClientID + "').dataTable();";
//ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "jQuery function", strScript, true);


================================================================================================================
     /// <summary> 
    /// Inserting data in the database by passing stored procedure name.
    /// </summary> 
    /// <param name="storedProcName">Passing Stored Procedure Name</param>
    /// <param name="parameterValues">Passing object array as parameter values</param>
    /// <returns>Returns Int [ 0 - Failed / 1 - Succeed]</returns>
    //public string InsertProcData(string storedProcName, out string outParameter, params object[] inParameters)
    //public string InsertProcData(string storedProcName, string p1, string p2, byte p3, string p4, out string outParameter)
    //public string InsertProcData(string storedProcName, params SqlParameter[] paramvalues)
    public string InsertProcData(string storedProcName, object[] paramvalues)
    {
        string outParameter = "";
        Database db = DatabaseFactory.CreateDatabase();
        using (DbConnection SQLConn = db.CreateConnection())
        {
            SQLConn.Open();
            DbTransaction sqlTransaction = SQLConn.BeginTransaction();
            try
            {
                DbCommand sqlCmd = db.GetStoredProcCommand(storedProcName, paramvalues);
                //db.AddInParameter(sqlCmd, "@Loccode", DbType.String, p1);
                //db.AddInParameter(sqlCmd, "@Location", DbType.String, p2);
                //db.AddInParameter(sqlCmd, "@NewRecord", DbType.Byte, p3);
                //db.AddInParameter(sqlCmd, "@UserID", DbType.String, p4);
                //db.AddOutParameter(sqlCmd, "@MESSAGE", DbType.String, 100);

                db.ExecuteNonQuery(sqlCmd, sqlTransaction);
                outParameter = sqlCmd.Parameters["@MESSAGE"].Value.ToString();
                // Commit the transaction.
                sqlTransaction.Commit();
            }
            catch
            {
                // Roll back the transaction. 
                sqlTransaction.Rollback();
            }
            finally
            {
                SQLConn.Close();
            }
            return outParameter;
        }
    }
================================================================================================================
//List<string> inParameters = new List<string>() {sLocCode, sLocName, "1", "Admin"};
//List<object> inParameters = new List<object>() { sLocCode, sLocName, "1", "Admin" };
//DbParameter[] inParameters = new DbParameter[5];
            
//var parameters = new[] 
//{
//    new SqlParameter(){ ParameterName="@LocCode", DbType=DbType.String, Direction=ParameterDirection.Input, Value=sLocCode },
//    new SqlParameter(){ ParameterName="@Location", DbType=DbType.String, Direction=ParameterDirection.Input,  Value=sLocName},
//    new SqlParameter(){ ParameterName="@NewRecord", DbType=DbType.Byte, Direction=ParameterDirection.Input, Value=1},
//    new SqlParameter(){ ParameterName="@UserID", DbType=DbType.String, Direction=ParameterDirection.Input, Value="Admin"},
//    new SqlParameter(){ ParameterName="@Message", Value=DBNull.Value, Direction=ParameterDirection.Output},
//};

//sMsg = dal.InsertProcData(sProcName, out outParameters, inParameters);
//sMsg = dal.InsertProcData(sProcName,sLocCode,sLocName,1,"Admin", out outParameters);

================================================================================================================

Label l = Master.FindControl("label1") as Label;
TextBox TB= Master.FindControl("ContentPlaceHolder1").FindControl("textbox1") as TextBox;		

================================================================================================================

//Below Code add the dynamic control on the page without the master page
Button MyButton = new Button();
MyButton.ID = "btn";
MyButton.Text = "DynButton";
//myform - is the id of Form Tag in the aspx file
myform.Controls.Add(MyButton);
================================================================================================================

    //public void GridviewDelete(GridView gvData)
    public void DyanmicControl()
    {
        //CssStyleCollection myStyle=null;
        Panel pnlPopup = new Panel();
        pnlPopup.ID = "popup";
        pnlPopup.CssClass = "modalBackground";
        StringBuilder sb = new StringBuilder();
        sb.Append("<table border='.5' style='border-style: groove;width:100%'>");
        sb.Append("<tr>");
        sb.Append("<td style='width:50px;color: #FFFFFF' bgcolor='#333333'>col1: ID </td>");
        sb.Append("<td style='width:50px;color: #FFFFFF' bgcolor='#333333'>col 2 :Name</td>");  
        sb.Append("</tr>");
        sb.Append("<tr>");
        sb.Append("<td style='width:50px;color: #FFFFFF' bgcolor='#333333'>col1: ID </td>");
        sb.Append("<td style='width:50px;color: #FFFFFF' bgcolor='#333333'>col 2 :Name</td>");
        sb.Append("</tr>");
        sb.Append("<tr>");
        sb.Append("<td style='width:50px;>col1: ID </td>");
        sb.Append("<td style='width:50px>col 2 :Name</td>");         
        sb.Append("</tr>") ;
        sb.Append("<tr>");
        sb.Append("<td style='width:50px;>col1: ID </td>");
        sb.Append("<td style='width:50px>col 2 :Name</td>"); 
        sb.Append("</tr>") ;
        sb.Append("</table>") ;

        pnlPopup.ToolTip = sb.ToString();
        pnlPopup.Visible = true;
        

        //AjaxControlToolkit.ModalPopupExtender modalPop =  new AjaxControlToolkit.ModalPopupExtender();
        //modalPop.ID = "mpopUp";
        //modalPop.PopupControlID = "ModalPanel";
        //modalPop.TargetControlID = "Button2";
        //modalPop.DropShadow = true;
        //modalPop.CancelControlID = "btnCancel";
        //pnlPopup.Controls.Add(modalPop);
        //pnlPopup.Controls.Add(btnNew);
   }

================================================================================================================
   <%# DataBinder.Eval(Container.DataItem, "ID") %>

   <%# ((GridViewRow) Container).RowIndex %>
================================================================================================================
////Login successful lets put him to requested page
//string returnUrl = Request.QueryString["ReturnUrl"] as string;
//if (returnUrl != null)
//{
//    Response.Redirect(returnUrl);
//}
//else
//{
//    //no return URL specified so lets kick him to home page
//    Response.Redirect("frmLocation.aspx");
//}
================================================================================================================
<asp:TreeView ID="tvAll" runat="server" Font-Size="XX-Small"
                    ImageSet="Arrows" BorderStyle="None" NodeWrap="True" SkipLinkText="">
                    <%-- <ParentNodeStyle Font-Bold="False" />
                    <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
                    <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
                        VerticalPadding="0px" />
                    <Nodes>
                        <asp:TreeNode ShowCheckBox="True" Text="Masters" Value="Masters" 
                            Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Department" Value="Department" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Designation" Value="Designation" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Shift" Value="Shift" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Holiday" Value="Holiday" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Rotation" Value="Rotation" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Parameters" Value="Parameters"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Location" Value="Location"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Company" Value="Company"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Category" Value="Category"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Grade" Value="Grade"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="TeamMember" Value="TeamMember"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Leave" Value="Leave"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LeaveFlow" Value="LeaveFlow"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LeaveGroup" Value="LeaveGroup"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Employee" Value="Employee"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="OTReason" Value="OTReason"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LeaveReason" Value="LeaveReason"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="CorrectionReason" Value="CorrectionApplicationReason"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="YearlyLeave" Value="YearlyLeave"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="OptionalHoliday" Value="OptionalHoliday"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="BalanceUpdate" Value="BalanceUpdate"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LocationwiseWOUpload"
                                Value="LocationwiseWOUpload"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LocationwiseTimeManagement"
                                Value="LocationwiseTimeManagement"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="LateEarlyDeduction"
                                Value="LateEarlyDeduction"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="ImportEmployeeData"
                                Value="ImportEmployeeData"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="Rules" Value="Rules"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Prefix Suffix Rules" Value="Prefix Suffix Rules"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode Text="LeaveRules" Value="LeaveRules" ShowCheckBox="True"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode ShowCheckBox="True" Text="Leave/OD Management" Value="Leave/OD Management"
                            SelectAction="SelectExpand" PopulateOnDemand="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Leave/OD Application" Value="Leave/OD Application"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Leave PullBack" Value="Leave PullBack" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Pending For Approval" Value="Pending For Approval"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Pending For Approval LongLeave" Value="Pending For Approval LongLeave"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Admin Encash Approver" Value="Admin Encash Approver"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Admin Leave Deletion" Value="Admin Leave Deletion"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Rejected Leave Deletion" Value="Rejected Leave Deletion"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Leave Encashment" Value="Leave Encashment"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Approval Summary" Value="Approval Summary"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode Text="Attendence Regularization" Value="Attendence Regularization"
                            ShowCheckBox="True" SelectAction="SelectExpand" Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Regularization Application" Value="Regularization Application"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Regularization Approval" Value="Regularization Approval"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="HODCorrSanction" Value="HODCorrSanction"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Shift Updation" Value="Shift Updation" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Time Sanction" Value="Time Sanction" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Shift Upload" Value="Shift Upload" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Update Reporting" Value="Update Reporting"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="UpdateDeptCategory" Value="UpdateDeptCategory"
                                SelectAction="Expand"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode Text="Attendance Report" Value="Attendance Report" ShowCheckBox="True"
                            SelectAction="SelectExpand" Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Data Process" Value="Data Process" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Attendance Sheet" Value="Attendance Sheet"
                                SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="HolidayList" Value="HolidayList" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="OptionalHolidayList"
                                Value="OptionalHoliday"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode Text="MIS Reports" Value="MIS Reports" ShowCheckBox="True" SelectAction="SelectExpand"
                            Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="MIS Reports" Value="MIS Reports" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="MIS ReportInExcel" Value="MIS ReportInExcel"
                                SelectAction="Expand"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode Text="Monthly Process" Value="Monthly Process" ShowCheckBox="True"
                            SelectAction="Expand" Checked="false">
                            <%--<asp:TreeNode ShowCheckBox="True" Text="HalfdayLevDed" Value="HalfdayLevDed"></asp:TreeNode>
                            <asp:TreeNode Text="MonthlyAttendence" Value="MonthlyAttendence" ShowCheckBox="True"></asp:TreeNode>
                            <asp:TreeNode SelectAction="Expand" ShowCheckBox="True" Text="MonthlyLeaveCredit"
                                Value="MonthlyLeaveCredit"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode ShowCheckBox="True" Text="UserManagement" Value="UserManagement" SelectAction="SelectExpand"
                            Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Create User" Value="Create User" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="GroupUserCreation" Value="GroupUserCreation"
                                SelectAction="Expand"></asp:TreeNode>
                        </asp:TreeNode>
                        <asp:TreeNode ShowCheckBox="True" Text="Product Sale" Value="Product Sale" SelectAction="SelectExpand"
                            Expanded="True" Checked="false">
                            <asp:TreeNode ShowCheckBox="True" Text="Customer" Value="Customer" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="ProductUpload" Value="ProductUpload" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="Requisition Application" Value="Requisition Application" SelectAction="Expand"></asp:TreeNode>
                            <asp:TreeNode ShowCheckBox="True" Text="ConsolidationReport" Value="ConsolidationReport" SelectAction="Expand"></asp:TreeNode>
                        </asp:TreeNode>
                    </Nodes>
                    <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
                        NodeSpacing="0px" VerticalPadding="0px" />
                    --%>
                </asp:TreeView>
================================================================================================================
//Adding an item on the first index after databinding the drop down list				
ddlloc.Items.Insert(0, new ListItem("Select","NA"));

================================================================================================================
    ///// <summary> 
    ///// This procedure get the department details. 
    ///// </summary> 
    ///// <param name="sLocCode">Pass the Location and Department Code</param> 
    ///// <returns>Retruns XML String</returns> 
    //[WebMethod]
    //public static string GetDeptDetails(string sLocCode, string sDeptcode)
    //{
    //    string sRet = "";
    //    DataTable dt = (DataTable)HttpContext.Current.Session["Department"];
    //    if (dt.Rows.Count > 0)
    //    {
    //        dt.DefaultView.RowFilter = "DeptCode='" + sDeptcode + "'";
    //        if (dt.DefaultView.Count > 0)
    //        {
    //            sRet = dt.DefaultView[0]["LocName"].ToString();
    //            HttpContext.Current.Session["TranType"] = 1;
    //            return sRet;
    //        }
    //        else
    //            return sRet;
    //    }
    //    else
    //        return sRet;
    //}

================================================================================================================

	    ///// <summary> 
    //protected void txtCode_TextChanged(object sender, EventArgs e)
    //{
    //    if (!string.IsNullOrEmpty(txtCode.Text) && (ddlloc.SelectedIndex > 0))
    //    {
    //        int iLocID = Int32.Parse(ddlloc.SelectedValue.ToString());
    //        string sDeptCode = txtCode.Text;
    //        DataTable dt = (DataTable)Session["Department"];
    //        if (dt.Rows.Count > 0)
    //        {
    //            dt.DefaultView.RowFilter = "LocID=" + iLocID + " AND DeptCode='" + sDeptCode + "'";
    //            if (dt.DefaultView.Count > 0)
    //            {
    //                txtName.Text = dt.DefaultView[0]["Department"].ToString();
    //                txteid.Text = dt.DefaultView[0]["EmailId"].ToString();
    //                Session["TranType"] = 1;
    //            }
    //        }
    //    }
    //    else
    //    {
    //        txtName.Text = null;
    //        txteid.Text = null;
    //        Session["TranType"] = 0;
    //    }
    //}

================================================================================================================
	
    //public void GetDeptDetails()
    //{
    //    if (!string.IsNullOrEmpty(txtCode.Text) && (ddlloc.SelectedIndex > 0))
    //    {
    //        int iLocID = Int32.Parse(ddlloc.SelectedValue.ToString());
    //        string sDeptCode = txtCode.Text;
    //        DataTable dt = (DataTable)Session["Department"];
    //        if (dt.Rows.Count > 0)
    //        {
    //            dt.DefaultView.RowFilter = "LocID=" + iLocID + " AND DeptCode='" + sDeptCode + "'";
    //            if (dt.DefaultView.Count > 0)
    //            {
    //                txtName.Text = dt.DefaultView[0]["Department"].ToString();
    //                txteid.Text = dt.DefaultView[0]["EmailId"].ToString();
    //                Session["TranType"] = 1;
    //            }
    //        }
    //    }
    //    else
    //    {
    //        txtName.Text = null;
    //        txteid.Text = null;
    //        Session["TranType"] = 0;
    //    }    
    //}
================================================================================================================

	            <div class="box box-primary">
                <div class="box-body table-responsive no-padding">
                    <asp:UpdatePanel ID="upGridData" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                        <ContentTemplate>
                            <asp:GridView ID="gvLocation" runat="server" AutoGenerateColumns="False" OnRowCommand="gvLocation_RowCommand" CssClass="table table-hover table-bordered">
                                <Columns>
                                    <asp:BoundField HeaderText="LocID" DataField="Locid" Visible="false" />
                                    <asp:BoundField HeaderText="Location Code" SortExpression="LocCode" DataField="LocCode" />
                                    <asp:BoundField HeaderText="Location Name" SortExpression="LocName" DataField="LocName" />
                                    <asp:TemplateField HeaderText="Operation">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbSelect" runat="server" CausesValidation="False"
                                                CommandName="Select" CssClass="fa fa-pencil-square-o" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' ToolTip="Select"></asp:LinkButton>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False"
                                                    CommandName="Delete" CssClass="fa fa-trash-o" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "LocID") %>' ToolTip="Delete"></asp:LinkButton>
                                            <ajaxToolkit:ModalPopupExtender ID="mpe_lbDelete" runat="server" Enabled="True"
                                                TargetControlID="lbDelete" PopupControlID="pnlPopup" OkControlID="btnYes" BackgroundCssClass="modalBackground">
                                            </ajaxToolkit:ModalPopupExtender>
                                            <ajaxToolkit:ConfirmButtonExtender ID="cbe_lbDelete" runat="server"
                                                ConfirmText="" Enabled="True" TargetControlID="lbDelete"
                                                DisplayModalPopupID="mpe_lbDelete">
                                            </ajaxToolkit:ConfirmButtonExtender>
                                            <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
                                                <div class="header">Confirmation</div>
                                                <div class="body">Do you want to delete this record ?</div>
                                                <div class="footer">
                                                    <asp:Button ID="btnYes" runat="server" CssClass="yes" Text="Yes" />
                                                    <asp:Button ID="btnNo" runat="server" CssClass="no" Text="No" />
                                                </div>
                                            </asp:Panel>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" CssClass="HeaderStyle" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
            </div>

================================================================================================================

	//protected void ddlSLoc_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    string sFilterExp = null;
    //    if (ddlSLoc.SelectedIndex > 0)
    //    {
    //        sFilterExp = "LocId=" + ddlSLoc.SelectedValue;
    //        dal.fnGetFilterData(gvDepartment, Session["Department"] as DataTable, sFilterExp);
    //        //upGridData.Update();
    //    }
    //    else
    //    {
    //        gvDepartment.DataSource = Session["Department"] as DataTable;
    //        gvDepartment.DataBind();
    //        //upGridData.Update();
    //    }
    //}

================================================================================================================

	<%--        $(document).ready(function(){
        
            var allchk = '#<%=chkAll.ClientID%>';

            //$("[id=" + CheckAll + "]").bind("click", function () {
            //    alert('hi');
            //    //if ($(CheckAll).is(':checked')) {
            //    //    alert('');
            //    //};
            //})

            //$(CheckAll).bind("click", function () {
            //    alert('hi');
            //})

            $(allchk).bind("click", function () {
                alert('hi');
            });

        })--%>


		        $(function () {

            var tvMenus = '#<%=tvMenus.ClientID%>';

            $("[id="+tvMenus+"] input[type=checkbox]").bind("click", function () {
                var table = $(this).closest("table");
                if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
                    //Is Parent CheckBox
                    var childDiv = table.next();
                    var isChecked = $(this).is(":checked");
                    $("input[type=checkbox]", childDiv).each(function () {
                        if (isChecked) {
                            $(this).attr("checked", "checked");
                        } else {
                            $(this).removeAttr("checked");
                        }
                    });
                } else {
                    //Is Child CheckBox
                    var parentDIV = $(this).closest("DIV");
                    if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
                        $("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
                    } else {
                        $("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
                    }
                }
            });
        })

================================================================================================================

		    //protected void lbSearch_Click(object sender, EventArgs e)
    //{
    //    string sFilterExp=null;
    //    try
    //    {
    //        if (ddlSLoc.SelectedIndex>0)
    //        {
    //            sFilterExp = "LocId="+ ddlSLoc.SelectedValue;
    //        }
    //        if (!string.IsNullOrEmpty(txtDeptName.Text))
    //        {
    //            if (sFilterExp != null)
    //                sFilterExp += " AND (DeptCode Like '" + txtDeptName.Text + "%' OR  Department Like '"+ txtDeptName.Text + "%')";
    //            else
    //                sFilterExp = " DeptCode Like '" + txtDeptName.Text + "%' OR  Department Like '" + txtDeptName.Text + "%'";
    //        }

    //        if (sFilterExp!=null)
    //        {
    //            dal.fnGetFilterData(gvDepartment, Session["Department"] as DataTable, sFilterExp);
    //            upGridData.Update();
    //        }
    //        else
    //        {
    //            //GetDepartments(Convert.ToInt32(Session["UserID"].ToString()));
    //            DataTable dtData = Session["Department"] as DataTable;
    //            gvDepartment.DataSource = dtData;
    //            gvDepartment.DataBind();
    //            upGridData.Update();
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        Console.Write(ex.ToString());
    //        throw;
    //    }
    //}

================================================================================================================
	
    //protected void lbClear_Click(object sender, EventArgs e)
    //{
    //    ddlSLoc.SelectedIndex = 0;
    //    txtDeptName.Text = null;
    //    //GetDepartments(Convert.ToInt32(Session["UserID"].ToString()));
    //    DataTable dtData = Session["Department"] as DataTable;
    //    gvDepartment.DataSource = dtData;
    //    gvDepartment.DataBind();
    //    //upGridData.Update();
    //}

================================================================================================================

	protected void gvDepartment_RowCreated(object sender, GridViewRowEventArgs e)
    {
        //if (e.Row.RowIndex == 0)
        //{
        //    e.Row.RowType = DataControlRowType.Header;
        //}
    }

================================================================================================================

	<style type="text/css">
        .HeaderStyle {
        text-align:center;
    }
    </style>

================================================================================================================

	protected void gvLocation_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvLocation.PageIndex = e.NewPageIndex;
        DataTable dtData = Session["Location"] as DataTable;
        gvLocation.DataSource = dtData;
        gvLocation.DataBind();
    }

================================================================================================================

	protected void lbClear_Click(object sender, EventArgs e)
    {
        txtSLocCode.Text = "";
        //gvLocation.DataSource = (DataTable)Session["Location"]; ;
        //gvLocation.DataBind();
        //upGridData.Update();
        GetLocations();
    }

================================================================================================================

	protected void lbSearch_Click(object sender, EventArgs e)
    {
        string sFilterExp = null;
        try
        {
            if (!string.IsNullOrEmpty(txtSLocCode.Text))
            {
                sFilterExp = " LocCode Like '" + txtSLocCode.Text + "%' OR  LocName Like '" + txtSLocCode.Text + "%'";
            }

            if (sFilterExp != null)
            {
                dal.fnGetFilterData(gvLocation , Session["Location"] as DataTable , sFilterExp);
            }
            else
            {
                //gvLocation.DataSource = (DataTable)Session["Location"]; ;
                //gvLocation.DataBind();
                GetLocations();
            }
        }
        catch (Exception ex)
        {
            Console.Write(ex.ToString());
            throw;
        }
    }

================================================================================================================

	//protected void gvDepartment_PageIndexChanging(object sender, GridViewPageEventArgs e)
    //{
    //    gvDepartment.PageIndex = e.NewPageIndex;
    //    DataTable dtData = Session["Department"] as DataTable;
    //    gvDepartment.DataSource = dtData;
    //    gvDepartment.DataBind();
    //}
================================================================================================================

	<%--        $(function () {

            var tvMenus = '#<%=tvMenus.ClientID%>';

            $("[id=" + tvMenus + "] input[type=checkbox]").bind("click", function () {
                var table = $(this).closest("table");
                if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
                    //Is Parent CheckBox
                    var childDiv = table.next();
                    var isChecked = $(this).is(":checked");
                    $("input[type=checkbox]", childDiv).each(function () {
                        if (isChecked) {
                            $(this).attr("checked", "checked");
                        } else {
                            $(this).removeAttr("checked");
                        }
                    });
                } else {
                    //Is Child CheckBox
                    var parentDIV = $(this).closest("DIV");
                    if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
                        $("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
                    } else {
                        $("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
                    }
                }
            });
        })--%>




		            //$("[id=" + tvMenus + "] input[type=checkbox]").bind("click", function () {
            //    var table = $(this).closest("table");
            //    if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
            //        //Is Parent CheckBox
            //        var childDiv = table.next();
            //        var isChecked = $(this).is(":checked");
            //        $("input[type=checkbox]", childDiv).each(function () {
            //            if (isChecked) {
            //                $(this).attr("checked", "checked");
            //            } else {
            //                $(this).removeAttr("checked");
            //            }
            //        });
            //    } else {
            //        //Is Child CheckBox
            //        var parentDIV = $(this).closest("DIV");
            //        if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
            //            $("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
            //        } else {
            //            $("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
            //        }
            //    }
            //});

================================================================================================================

			            var tvMenus = '#<%=tvMenus.ClientID%>';
            var table = $(tvMenus).closest("table");
            $("input[type='checkbox']").on('ifChanged', function () {
                alert(table.next()[0].tagName);
                //if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
                //    var childDiv = table.next();                    //Is Parent CheckBox
                //    var isChecked = $(this).prop('checked');
                //    $("input[type='checkbox']", childDiv).each(function () {
                //        if (isChecked) {
                //            $(this).iCheck('check');
                //        } else {
                //            $(this).iCheck('uncheck');
                //        }
                //    });
                //} else {
                //    //Is Child CheckBox
                //    var parentDIV = $(this).closest("DIV");
                //    if ($("input[type='checkbox']", parentDIV).length == $("input[type='checkbox']:checked", parentDIV).length) {
                //        $("input[type='checkbox']", parentDIV.prev()).iCheck('check');
                //    } else {
                //        $("input[type='checkbox']", parentDIV.prev()).iCheck('uncheck');
                //    }
                //}

            });

================================================================================================================
			
        //for (int iCtr = 0; iCtr < tv.CheckedNodes.Count; iCtr++)
        ////for (int iCtr = 0; iCtr < tv.Nodes.Count; iCtr++)
        //{
        //    parentnode = tv.Nodes[iCtr];
        //    if (parentnode.Selected)
        //    {
        //        sRetValue += parentnode.Value + ",";
        //    }
        //    for (int ip = 0; ip < parentnode.ChildNodes.Count; ip++)
        //    {
        //        if (parentnode.ChildNodes[ip].Selected)
        //        {
        //            sRetValue += parentnode.ChildNodes[ip].Value + ",";
        //        }
        //        //send every child to the function for further traversal
        //        sChildRetValue += GetChildNodes(parentnode.ChildNodes[ip]); 
        //    }
        //}
        //if (sChildRetValue != null)
        //{
        //    sRetValue += sChildRetValue;
        //}

================================================================================================================
    /// <summary> 
    /// This procedure return the selected child nodes value as an comma seprated format value from treeview control. Part of GetSelectedItems Procedure. Called on btnSave Click Event.
    /// </summary> 
    /// <param name="node">Treeview TreeNode</param>
    /// <returns>Returns string value</returns>
    private string GetChildNodes(TreeNode node)
    {
        string sRetValue = null;
        for (int ic = 0; ic < node.ChildNodes.Count; ic++)
        {
            if (node.ChildNodes[ic].Selected)
            {
                sRetValue += node.ChildNodes[ic].Value + ",";
            }
            GetChildNodes(node.ChildNodes[ic]);
        }
        return sRetValue;   
    }


	//ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "jQuery function", "GetSelectedNodes()", true);


	<%--        //Get Selected Node Values
        function GetSelectedNodes() {
            var tvMenus = '#<%=tvMenus.ClientID%>';
            var NodVal = '';
            $(tvMenus).find("input[type='checkbox']").each(function () {
                //if ($(this).prop('checked'))
                //{
                //    NodVal = $(this).val();
                //    alert(NodVal)
                //}
                $("input[type='checkbox']").on('ifChecked', function (event) {
                    alert(event.type + ' callback');
                });

            });
        }--%>


		public class CryptorEngine
{

    /// <summary>
    /// Encrypt a string using dual encryption method. Return a encrypted cipher Text
    /// </summary>
    /// <param name="toEncrypt">string to be encrypted</param>
    /// <param name="useHashing">use hashing? send to for extra secirity</param>
    /// <returns></returns>
    public static string Encrypt(string toEncrypt, bool useHashing)
    {
        byte[] keyArray;
        byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);

        System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
        // Get the key from config file
        string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
        //System.Windows.Forms.MessageBox.Show(key);
        if (useHashing)
        {
            MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
            keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
            hashmd5.Clear();
        }
        else
            keyArray = UTF8Encoding.UTF8.GetBytes(key);

        TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
        tdes.Key = keyArray;
        tdes.Mode = CipherMode.ECB;
        tdes.Padding = PaddingMode.PKCS7;

        ICryptoTransform cTransform = tdes.CreateEncryptor();
        byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
        tdes.Clear();
        return Convert.ToBase64String(resultArray, 0, resultArray.Length);
    }

    /// <summary>
    /// DeCrypt a string using dual encryption method. Return a DeCrypted clear string
    /// </summary>
    /// <param name="cipherString">encrypted string</param>
    /// <param name="useHashing">Did you use hashing to encrypt this data? pass true is yes</param>
    /// <returns></returns>
    public static string Decrypt(string cipherString, bool useHashing)
    {
        byte[] keyArray;
        byte[] toEncryptArray = Convert.FromBase64String(cipherString);

        System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
        //Get your key from config file to open the lock!
        string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));

        if (useHashing)
        {
            MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
            keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
            hashmd5.Clear();
        }
        else
            keyArray = UTF8Encoding.UTF8.GetBytes(key);

        TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
        tdes.Key = keyArray;
        tdes.Mode = CipherMode.ECB;
        tdes.Padding = PaddingMode.PKCS7;

        ICryptoTransform cTransform = tdes.CreateDecryptor();
        byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);

        tdes.Clear();
        return UTF8Encoding.UTF8.GetString(resultArray);
    }

}


            //if (dtFilterData.DefaultView.Count > 0)
            //{
            //    gvData.DataSource = dtFilterData.DefaultView;
            //    gvData.DataBind();
            //}
            //else
            //{
            //    SetGridViewEmptyTemplate(dtFilterData.DefaultView.ToTable(), gvData);
            //}

    //if (gvCategory.Rows[0].Cells[0].Text != "No Data Founds")
    //{
    //    dal.SetGridViewHeaderRowFooterRow(gvCategory);
    //    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "jQuery function", "EmptyDataTable()", true);
    //    upGridData.Update();
    //}

	    //public DataTable fnGetFilterData1(GridView gvData, DataTable dtFilterData, string sFilterExp)
    //{
    //    DataTable dtResult=new DataTable();
    //    try
    //    {
    //        dtFilterData.DefaultView.RowFilter = sFilterExp;
    //        gvData.DataSource = dtFilterData.DefaultView;
    //        gvData.DataBind();
    //        dtResult = dtFilterData.DefaultView.ToTable();
    //        return dtResult;
    //    }
    //    catch (Exception ex)
    //    {
    //        Console.Write(ex.ToString());
    //        throw;
    //    }
    //}

================================================================================================================

	//var string = "1, 2, 4, 6, 7, 8, 10"
	//$.each(string.split(','), function () {
	//  alert(this);
	//})

================================================================================================================

	<%--            var gv = '#<%=gvUserDeatils.ClientID%>';
            $(gv + ' tbody tr td:last-child a[id*=lbSelect]').click(function () {
                var iRowIndex = $(this).closest("tr").prevAll("tr").length;

                var tvMenus = '#<%=tvMenus.ClientID%>';
                $(tvMenus).find('input[type=checkbox]').each(function () {
                    alert($(this).prop("checked"));
                });

            })--%>

================================================================================================================

    ///// <summary> 
    ///// This procedure add a log entry of error in the Error Log Table
    ///// </summary> 
    ///// <param name="ErrorNumber">Error Number</param>
    ///// <param name="ErrorDescription">Error Description</param>
    ///// <param name="SOEID">Session User ID</param>
    ///// <param name="Module">Pass the Module Name</param>
    ///// <param name="Page">Page Name</param>
    ///// <param name="MethodName">Method Name [Function or Procedure Name]</param>
    //public void SaveErrorLog(string ErrorNumber, string ErrorDescription, string UserID, string Module, string Page, string MethodName)
    //{
    //    Database db = DatabaseFactory.CreateDatabase();
    //    DbCommand dbCmd;
    //    dbCmd = db.GetStoredProcCommand("InsertErrorLog");
    //    db.AddInParameter(dbCmd, "@ErrorNo", DbType.String, ErrorNumber);
    //    db.AddInParameter(dbCmd, "@ErrorMessage", DbType.String, ErrorDescription);
    //    db.AddInParameter(dbCmd, "@FunctionName", DbType.String, MethodName);
    //    db.AddInParameter(dbCmd, "@ClassName", DbType.String, Module);
    //    db.AddInParameter(dbCmd, "@Page", DbType.String, Page);
    //    db.AddInParameter(dbCmd, "@SessionId", DbType.String, UserID);
    //    db.ExecuteNonQuery(dbCmd);
    //}

===================================================================================================================

//$(tvMenus).find("input[type='checkbox']").each(function () {
//    alert($(this).prop('checked'));
//});

===================================================================================================================

    //protected void ddlLoc_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    DataTable dtResult = new DataTable();
    //    string sFilterExp = null;
    //    if (ddlLoc.SelectedIndex > 0)
    //    {
    //        sFilterExp = "LocId=" + Convert.ToInt32(ddlLoc.SelectedValue.ToString()) + " AND LeaveCode Not In('HL','WO')";
    //        dal.fnGetFilterData(ddlMainCode, Session["Department"] as DataTable, sFilterExp,"LeaveCode","LeaveId",true);
    //    }
    //     else
    //    {
    //        ddlMainCode.DataSource = null;
    //    }
    //}

===================================================================================================================
	    
    //protected void rbtdaynight_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    if (rbtdaynight.SelectedIndex == 0)
    //    {
    //        chkotnight.Visible = true;
    //        lblotnight.Visible = true;
    //    }
    //    else
    //    {
    //        chkotnight.Visible = false;
    //        lblotnight.Visible = false;
    //    }
    //}

===================================================================================================================

	    protected void rbShift_CheckedChanged(object sender, EventArgs e)
    {
        if (rbDayShift.Checked==false && rbNightShift.Checked)
        {
            chkotnight.Visible = true;
            lblotnight.Visible = true;
        }
        else
        {
            chkotnight.Checked = false;
            chkotnight.Visible = false;
            lblotnight.Visible = false;
        }
    }
	
<asp:RadioButton ID="rbDayShift" runat="server" Text="Day Shift"  GroupName="ShiftType" OnCheckedChanged="rbShift_CheckedChanged" />
<asp:RadioButton ID="rbNightShift" runat="server" Text="Night Shift"  GroupName="ShiftType"  OnCheckedChanged="rbShift_CheckedChanged"/>

<asp:RegularExpressionValidator ID="rev_txtMaxAcc" ControlToValidate="txtMaxAcc" 
runat="server" ValidationExpression="((\d+)(\.\d{1}))$" ErrorMessage="Please enter valid decimal number with 1 decimal place.">
</asp:RegularExpressionValidator>

===================================================================================================================

    ///// <summary> 
    ///// Adding the Day Night Option
    ///// </summary> 
    //private void ShiftType()
    //{
    //    Dictionary<string, string> list = new Dictionary<string, string>();
    //    list.Add("day", "Day Shift");
    //    list.Add("night", "Night Shift");
    //    rbtdaynight.DataSource = list;
    //    rbtdaynight.DataTextField = "Value";
    //    rbtdaynight.DataValueField = "Key";
    //    rbtdaynight.DataBind();
    //}

===================================================================================================================

                            //if ($(this).find('CF').text() == 'true')
                            //    $(cf).attr('checked', 'checked');
                            //else
                            //    $(cf).removeAttr('checked');

                            //if ($(this).find('Encash').text() == 'true')
                            //    $(encash).attr('checked', 'checked');
                            //else
                            //    $(encash).removeAttr('checked');
                            
                            //if ($(this).find('OverwriteWO').text() == 'true')
                            //    $(overwo).attr('checked', 'checked');
                            //else
                            //    $(overwo).removeAttr('checked');

                            //if ($(this).find('OverwriteHL').text() == 'true')
                            //    $(overhl).attr('checked', 'checked');
                            //else
                            //    $(overhl).removeAttr('checked');

                            //$(maxacc).val($(this).find('MaxAcc').text());

                            //if ($(this).find('CreditYearly').text() == 'true')
                            //    $(credityearly).attr('checked', 'checked');
                            //else
                            //    $(credityearly).removeAttr('checked');

                            //if ($(this).find('CreditMonthly').text() == 'true')
                            //    $(creditmonthly).attr('checked', 'checked');
                            //else
                            //    $(creditmonthly).removeAttr('checked');

                            //if ($(this).find('CreditType').text() == 'FIX')
                            //{
                            //    $(creditfix).attr('checked', 'checked');
                            //    $(crleave).removeAttr('checked');
                            //}

                            //if ($(this).find('CreditType').text() == 'VARIABLE')
                            //{
                            //    $(creditfix).removeAttr('checked');
                            //    $(crleave).attr('checked', 'checked');
                            //}

                            //if ($(credityearly).is(":checked") && $(creditmonthly).is(":not(:checked)"))
                            //{
                            //    if ($(creditfix).is(":checked") && $(crleave).is(":not(:checked)"))
                            //    {
                            //        $(pnlfix).css('visibility', 'visible');
                            //        $(pnlmonthly).css('visibility', 'hidden');
                            //        $(pnlcreditleave).css('visibility', 'hidden');
                            //        $(annquota).val($(this).find('AnnQuota').text());
                            //    }

                            //    if ($(creditfix).is(":not(:checked)") && $(crleave).is(":checked"))
                            //    {
                            //        $(pnlfix).css('visibility', 'hidden');
                            //        $(pnlmonthly).css('visibility', 'hidden');
                            //        $(pnlcreditleave).css('visibility', 'visible');
                            //    }
                            //}

                            //if ($(credityearly).is(":not(:checked)") && $(creditmonthly).is(":checked"))
                            //{
                            //    if ($(creditfix).is(":checked") && $(crleave).is(":not(:checked)"))
                            //    {
                            //        $(pnlfix).css('visibility', 'hidden');
                            //        $(pnlmonthly).css('visibility', 'visible');
                            //        $(pnlcreditleave).css('visibility', 'hidden');
                            //    }

                            //    if ($(creditfix).is(":not(:checked)") && $(crleave).is(":checked")) {
                            //        $(pnlfix).css('visibility', 'hidden');
                            //        $(pnlmonthly).css('visibility', 'hidden');
                            //        $(pnlcreditleave).css('visibility', 'visible');
                            //    }
                            //}

===================================================================================================================


		function SetUserMenuRights(menu_array)
        {
            alert(menu_array);
            var tvMenus = '#<%=tvMenus.ClientID%>';
            //$.each(menu_array.split(','), function () {
            //    var arrayval = this;
            //    alert(arrayval);
            //    //$(tvMenus).find("input[type='checkbox']").each(function () {
            //    //    if ($("[title|='"+arrayval+"']"))
            //    //    {
            //    //        $(this).iCheck('check');
            //    //        return false;
            //    //    }
            //    //});
            //});
        }

===================================================================================================================

	////Select or Unselect all Treeview Node
    //$(cb).change(function() {
    //    var checkval = $(this).prop('checked');
    //    $(tvMenus).find("input[type='checkbox']").each(function () {
    //        if (checkval)
    //            $(this).attr('checked', 'checked');
    //        else
    //            $(this).removeAttr('checked');
    //    });
    //});

===================================================================================================================

    /// <summary> 
    /// Inserting New Leave Group and Updating existing Leaved Group
    /// </summary> 
    /// <returns>Return String [Message from the database]</returns> 
    public string IULeaveGroup(byte iTranType)
    {
        string sRetValue;
        int iLevGrpId, iLeaveId;
        string sAttendFormula, sCreditType="";
        bool bCF, bEncash, bOverwriteWO, bOverwriteHL, bCreditYearly, bCreditMonthly;
        float fAnnQuota, fMaxAcc, fAttendDays, fLeaveCredit;

        iLevGrpId = Convert.ToInt32(ddlMainCode.SelectedValue.ToString());
        iLeaveId = Convert.ToInt32(ddlLeaveCode.SelectedValue.ToString());

        bCF = cbCF.Checked;
        bEncash = cbEncash.Checked;
        bOverwriteWO = cbOverwriteWO.Checked;
        bOverwriteHL = cbOverwriteHL.Checked;
        bCreditYearly = rbCreditYearly.Checked;
        bCreditMonthly = rbCreditMonthly.Checked;

        if (txtMaxAcc.Text == "" || txtMaxAcc.Text == null)
            fMaxAcc = 0;
        else
            fMaxAcc = float.Parse(txtMaxAcc.Text);

        if (txtAnnualQuota.Text == "" || txtAnnualQuota.Text == null)
            fAnnQuota = 0;
        else
            fAnnQuota = float.Parse(txtAnnualQuota.Text);

        if (txtAttendDays.Text == "" || txtAttendDays.Text == null)
            fAttendDays = 0;
        else
            fAttendDays = float.Parse(txtAttendDays.Text);

        if (txtLeaveCredit.Text == "" || txtLeaveCredit.Text == null)
            fLeaveCredit = 0;
        else
            fLeaveCredit = float.Parse(txtLeaveCredit.Text);

        if (rbCrFixDays.Checked && rbCrLeaveAtt.Checked == false)
            sCreditType = "FIX";

        if (rbCrFixDays.Checked==false && rbCrLeaveAtt.Checked)
            sCreditType = "VARIABLE";

        if (txtAttFormula.Text == "" || txtAttFormula.Text == null)
            sAttendFormula = "";
        else
            sAttendFormula = txtAttFormula.Text;


        object[] parameters, parameters1, parameters2;
        object[] LogData = new object[] { Session["UserName"], "Masters", "LeaveGroup.aspx", "IULeaveGroup" };
        string LoginID = Session["UserID"].ToString();
        try
        {
            if (iTranType == 0)
                parameters = new object[] { iLevGrpId, iLeaveId, bCF, fAnnQuota, fMaxAcc, bEncash, sCreditType, fAttendDays, fLeaveCredit,sAttendFormula, bOverwriteWO, bOverwriteHL, bCreditYearly, bCreditMonthly, true, LoginID, null };
            else
                parameters = new object[] { iLevGrpId, iLeaveId, bCF, fAnnQuota, fMaxAcc, bEncash, sCreditType, fAttendDays, fLeaveCredit, sAttendFormula, bOverwriteWO, bOverwriteHL, bCreditYearly, bCreditMonthly, false, LoginID, null };

            string sProcName = "IULeaveGroup";
            sRetValue = dal.IUDProcData(sProcName, parameters, LogData);

            if (sRetValue.Contains("successfully"))
            {

                sProcName = "DeleteLeaveGroupMonthly";
                object[] LogData1 = new object[] { Session["UserName"], "Masters", "LeaveGroup.aspx", "IULeaveGroup/DeleteLeaveGroupMonthly" };
                parameters1 = new object[] { iLevGrpId, iLeaveId };
                dal.IUDProcData1(sProcName, parameters1, LogData1);

                if (bCreditMonthly == true && rbCrFixDays.Checked)
                {
                    DataTable dtLeaveGroupMonthly = Session["dtLeaveGroupMonthly"] as DataTable;
                    if (gvMonthlyLeave.Rows.Count>0)
                    {
                        sProcName = "IULeaveGroupMonthly";
                        object[] LogData2 = new object[] { Session["UserName"], "Masters", "LeaveGroup.aspx", "IULeaveGroup/IULeaveGroupMonthly" };
                        foreach (DataRow dtRow in dtLeaveGroupMonthly.Rows)
                        {
                            parameters2 = new object[] { iLevGrpId, iLeaveId, dtRow["Month"], dtRow["LeaveQuota"], LoginID };
                            dal.IUDProcData1(sProcName, parameters2, LogData2);
                        }
                    }
                }
            }
            lblMsg.Text = sRetValue.ToString();

        }
        catch (Exception)
        {
            throw;
        }
        return sRetValue;
    }

===================================================================================================================

    ///// <summary> 
    ///// Inserting data in the database by passing sql query.
    ///// </summary> 
    ///// <param name="sQuery">SQL Query</param>
    ///// <returns>Returns Int [ 0 - Failed / 1 - Succeed]</returns>
    //public int InsertSQLData(string sQuery)
    //{
    //    Database db = DatabaseFactory.CreateDatabase();
    //    int iRetValue = 0;
    //    using (DbConnection SQLConn = db.CreateConnection())
    //    {
    //        SQLConn.Open();
    //        DbTransaction transaction = SQLConn.BeginTransaction();
    //        try
    //        {
    //            iRetValue = db.ExecuteNonQuery(transaction, CommandType.Text, sQuery);
    //            // Commit the transaction.
    //            transaction.Commit();
    //        }
    //        catch
    //        {
    //            // Roll back the transaction. 
    //            transaction.Rollback();
    //            //string sErrorQuery = "Exec InsertErrorLog '" + ErrorNo + "','" + ErrorDesc + "','" + EmpID + "','" + ModuleName + "','" + PageName + "','" + ModuleName + "'";
    //            //db.ExecuteNonQuery(CommandType.Text, sErrorQuery);
    //        }
    //        SQLConn.Close();
    //        return iRetValue;
    //    }

    //}

===================================================================================================================

	//public void GetFilterData(int iLocId)
    //{ 
    //    DataSet dsData = Session["MasterData"] as DataSet;
    //    string sFilterExp = "LocId="+ iLocId;
    //    dal.fnGetFilterData(ddlCompany, dsData.Tables["Company"], sFilterExp, "CompName", "CompID", true);
    //    dal.fnGetFilterData(ddlDepartment , dsData.Tables["Department"], sFilterExp, "DeptName", "DeptID", true);
    //    dal.fnGetFilterData(ddlCategory, dsData.Tables["Category"], sFilterExp, "CatName", "CatID", true);

    //    ddlDesignation.DataSource = dsMaster.Tables["Designation"];
    //    ddlDesignation.DataTextField = "Designation";
    //    ddlDesignation.DataValueField = "DesgCode";
    //    ddlDesignation.Items.Insert(0, new ListItem("Select", "NA"));

    //    rblShiftType.SelectedIndex = 1;
    //    dal.fnGetFilterData(ddlLevGrpMain, dsData.Tables["LeaveGroupMain"], sFilterExp, "LevGrpName", "LevGrpId", true);
    //    dal.fnGetFilterData(ddlShift, dsData.Tables["Shift"], sFilterExp, "ShiftCode", "ShiftId", true);
    //    dal.fnGetFilterData(ddlGrade, dsData.Tables["Grade"], sFilterExp, "GradeName", "GradeID", true);

    //}

===================================================================================================================

    var jqXHR = GetCategoryCodes(iholidayid);
    jqXHR.success(function (category) {
        var sResult = category.d;
        var str = sResult.split('|');
        $(hf).val(str[0]);
        $(appcatgcodes).val(str[1]);
    });

===================================================================================================================
	
<div class="row">
    <div class="col-md-8">
        <div class="row">
            <div class="col-md-4">
                <asp:Label runat="server" ID="lblAppCatg" Text="Applicable to Category"></asp:Label>
            </div>
            <div class="col-md-8">
                <div class="input-group">
                    <asp:TextBox ID="txtAppCatg" runat="server" CssClass="form-control" ReadOnly="true"></asp:TextBox>
                    <div class="input-group-addon">
                    <asp:LinkButton ID="btnClearAppCat" runat="server" ToolTip="Clear Value" CssClass="fa fa-refresh" CausesValidation="false" OnClick="btnClearAppCat_Click" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <asp:DropDownList ID="ddlCategory" runat="server" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">
        </asp:DropDownList>
    </div>
</div>

===================================================================================================================

//var jqXHR = GetCategoryCodes(iholidayid);
//jqXHR.success(function (hcategory) {
//    if (hcategory.d != "")
//    {
//        var obj = hcategory.d;
//        $(obj).find('HolidayCategory').each(function () {
//            $(holicat + ' input:checkbox').each(function () {
//                if ($(obj).find('CatID').text()==`
                                            
//            })
//        });
//    }
//});

//jqXHR.failure(function (response) {
//    alert("Category Error Found");
//});

===================================================================================================================

//fnBindCheckBoxList(iholidayid);

===================================================================================================================

//string sResult = "";
//Database db = DatabaseFactory.CreateDatabase();
//DbCommand dbCmd;
//DataSet dsTemp = new DataSet();
//string SQLString = "Select CatID From HolidayCategory Where HolidayId= " + iHoliId + " Order by CatId ";
//dbCmd = db.GetSqlStringCommand(SQLString);
//dsTemp = db.ExecuteDataSet(dbCmd);
//dsTemp.Tables[0].TableName = "HolidayCategory";
//if (dsTemp.Tables[0].Rows.Count > 0)
//{
//    sResult = dsTemp.GetXml();
//}
//return sResult;

===================================================================================================================

var obj  = "68,69";
var result= obj.split(',');
$.each(result, function (key, value) {
	$('#cphBody_cblAppCatg').find(':checkbox').each(function () {
	  if($(this).val()==value)
	  {
		$('#cphBody_cblAppCatg').find(':checkbox').prop('checked','checked');
		break;
	  }
	});
});

var obj  = "68,69";
var result= obj.split(',');
$.each(result, function (key, value) {
	$('#cphBody_cblAppCatg').find(':checkbox').each(function () {
	  if($(this).val()==value)
	  {
		$(this).prop("checked");
		return;
	  }
	});
});



var obj  = "68,69";
$.each(obj, function (key, value) {
	$('#cphBody_cblAppCatg').find(':checkbox').each(function () {
          alert(value);
	  if($(this).val()==value)
	  {
            //$('#cphBody_cblAppCatg').find(':checkbox').prop('checked','checked');
            alert($(this).val());
	  }
	});
});


$(holicat + ' > tbody > tr > td :checkbox').each(function () {
	var cbl = holicat + ' > tbody > tr > td :checkbox';
	alert($(cbl).val());
	if ($(cbl).val() == value) {
		$(cbl).prop('checked', 'checked');
		return;
	}
});

================================================================================================

    public string DeleteHoliday(int iHolidayId, int iUID)
    {
        string sRetValue;
        object[] paramvalues, paramvalues1;
        paramvalues = new object[] { iHolidayId, iUID, null };
        paramvalues1 = new object[] { iHolidayId, iUID};

        Database db = DatabaseFactory.CreateDatabase();
        using (DbConnection SQLConn = db.CreateConnection())
        {
            SQLConn.Open();
            DbTransaction sqlTransaction = SQLConn.BeginTransaction();
            try
            {
                object[] LogData = new object[] { Session["UserName"], "Masters", "Holiday.aspx", "DeleteHoliday" };
                string sProcName = "DeleteHoliday";
                sRetValue = dal.IUDProcData(db, sqlTransaction, sProcName, paramvalues, LogData);
                if (sRetValue.Contains("successfully"))
                {
                    sProcName = "DeleteHolidayCategory";
                    object[] LogData1 = new object[] { Session["UserName"], "Masters", "Holiday.aspx", "DeleteHoliday/DeleteHolidayCategory" };
                    dal.IUDProcData1(db, sqlTransaction, sProcName, paramvalues1, LogData1);
                }

                sqlTransaction.Commit();

            }
            catch (Exception ex)
            {
                sqlTransaction.Rollback();
                sRetValue = "Error Occurred";
                ErrorNo = ex.GetHashCode().ToString();
                ErrorDesc = ex.Message.ToString();
                EmpID = Session["UserName"].ToString();
                ModuleName = "Masters";
                PageName = "Holiday.aspx";
                MethodName = "DeleteHoliday";
                dal.InsertErrorLog(ErrorNo, ErrorDesc, EmpID, ModuleName, PageName,MethodName);
            }
            finally
            {
                SQLConn.Close();
            } 

            return sRetValue;
        }

================================================================================================

		    /// <summary> 
    /// This procedure get all the employee [Called  SQL Stored Proc - GetEmployees]
    /// </summary> 
    private void GetEmployees(int iUserID)
    {
        string sProcName = "GetEmployees";
        object[] paramvalues = new object[] { iUserID.ToString() };
        dtEmployee = dal.fnGetDataTable(sProcName, paramvalues);
        Session["Employee"] = null;
        if (dtComp.Rows.Count > 0)
        {
            gvGroup.DataSource = dtEmployee;
            gvGroup.DataBind();
            gvGroup.Visible = true;
            upMIS.Update();
            Session["Employee"] = dtComp;
        }
        else
        {
            gvGroup.Visible = false;
        }
    }

=======================================================================================================================

    /// <summary> 
    /// This procedure get all the company [Called  SQL Stored Proc - GetAllCompanies]
    /// </summary> 
    private void GetCompanies(int iUserID)
    {
        string sProcName = "GetCompany";
        object[] paramvalues = new object[] { iUserID.ToString() };
        dtComp = dal.fnGetDataTable(sProcName, paramvalues);
        Session["Company"] = null;
        if (dtComp.Rows.Count > 0)
        {
            gvCompany.DataSource = dtComp;
            gvCompany.DataBind();
            gvCompany.Visible = true;
            upMIS.Update();

            Session["Company"] = dtComp;
        }
        else
        {
            gvCompany.Visible = false;
        }
    }

=======================================================================================================================

//string csvEnums = string.Join(",", Enum.GetNames(typeof()));
//var companylist = cblLoc.Items.Cast<ListItem>().Where(x => x.Selected);


//result.Add(String.Join(Environment.NewLine, dvFilter.ToTable().AsEnumerable()
//                       .Select(r => r.Field<string>("EmpCode"))
//                       .ToList()));

=======================================================================================================================

//        string SQLString = @"Select YearLeaveId, YL.EmpId, E.EmpCode, [Year] AS LeaveYear,
//                                YL.LeaveId, L.LeaveCode, AnnQuota, CarryForward, Opening, Consumption,
//                                Encash, Closing
//                                From YearLeave YL Inner Join Employee E ON E.EmpId=YL.EmpId
//                                Inner Join Leave L on L.LeaveId=YL.LeaveId
//                                Where YL.[Year]='"+sYear+"' AND YL.EMPID=0";

=======================================================================================================================
            <%-- Tab 2 --%>
            <div class="tab-pane" id="tab_2">
                <section class="content">
                    <%-- Default Box --%>
                    <div class="box box-solid box-primaryemp">
                        <div class="box-header">
                            <h3 class="box-title">Edit Yearly Leave</h3>
                        </div>
                        <br />
                        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:TextBox runat="server" ID="txtEmpCode2" PlaceHolder="Enter Employee Code to Search" ></asp:TextBox>&nbsp;&nbsp;
                                <asp:LinkButton ID="lbShow2" runat="server" ToolTip="Display" CssClass="fa fa-file-text-o" />&nbsp;&nbsp;&nbsp;&nbsp;
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <br />
                        <div class="box box-primary">
                            <div class="box-body table-responsive pad">
                                <asp:UpdatePanel runat="server" ID="upYearLeaveEdit" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="gvEditYearLeave" CssClass="table" runat="server" AutoGenerateColumns="False" DataKeyNames="LeaveId" OnRowCommand="gvEditYearLeave_RowCommand" >
                                            <Columns>
                                                <asp:TemplateField HeaderText="Yearly Leave ID" Visible="False">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblYearLevId" runat="server" Text='<%# Bind("YearLeaveId") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Year">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblYear" runat="server" Text='<%# Bind("LeaveYear") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Year">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblYear" runat="server" Text='<%# Bind("LeaveYear") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="Leave ID" Visible="False">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblLeaveId" runat="server" Text='<%# Bind("LeaveId") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Leave Code" SortExpression="LeaveCode">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblLeaveCode" runat="server" Text='<%# Bind("LeaveCode") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Credit">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblCredit" runat="server" Text='<%# Bind("AnnQuota") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtCredit" runat="server" Text='<%# Bind("AnnQuota") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="CF">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblCF" runat="server" Text='<%# Bind("CarryForward") %>' ></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtCF" runat="server" Text='<%# Bind("CarryForward") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="OpBal">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblOpBal" runat="server" Text='<%# Bind("Opening") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtOpBal" runat="server" Text='<%# Bind("Opening") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Cons">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblCons" runat="server" Text='<%# Bind("Consumption") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtCons" runat="server" Text='<%# Bind("Consumption") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Encash" SortExpression="Encash">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblEncash" runat="server" Text='<%# Bind("Encash") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtEncash" runat="server" Text='<%# Bind("Encash") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="ClBal" SortExpression="ClBal">
                                                    <ItemTemplate>
                                                        <asp:Label ID="tp_lblClBal" runat="server" Text='<%# Bind("Closing") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="tp_txtClBal" runat="server" Text='<%# Bind("Closing") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Operation">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                                                            CommandName="EditRow" CssClass="fa fa-plus-square" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "LeaveId") %>' ToolTip="Edit Row"></asp:LinkButton>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="False"
                                                            CommandName="UpdateRow" CssClass="fa fa-save" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "LeaveId") %>' ToolTip="Update"></asp:LinkButton>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <asp:LinkButton ID="lbCancel" runat="server" CausesValidation="False"
                                                            CommandName="CancelUpdate" CssClass="fa fa-times-circle" ToolTip="Cancel"></asp:LinkButton>
                                                    </EditItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                        </div>
                    </div>
                </section>
            </div>

=======================================================================================================================

	//[WebMethod]
    //public static List<string> GetAutoCompleteData(string sCode)
    //{
    //    List<string> result = new List<string>();
    //    DataTable dtFilter = HttpContext.Current.Session["EmpListNotInYearLeave"] as DataTable;
    //    DataView dvFilter = new DataView(dtFilter);
    //    dvFilter.RowFilter = "EmpName Like '%" + sCode + "%'";
    //    if (dvFilter.Count > 0)
    //    {
    //        foreach (DataRowView dtv in dvFilter)
    //        {
    //            DataRow dtRow = dtv.Row;
    //            result.Add(dtRow["EmpName"].ToString());
    //        }
    //    }
    //    return result;
    //}

=======================================================================================================================

    /// <summary>
    /// This procedure will bind a blank data sheet to the gridview in the Add Data Mode Tab
    /// </summary> 
//    private void SetEmptyGridView(string sYear)
//    {
//        DataTable dtTemp;
//        string SQLString = @"Select Null AS YearLeaveId, Null AS EmpId, Null AS EmpCode, Null AS LeaveYear,
//                            Null AS LeaveId, L.LeaveCode, Null AS AnnQuota, Null AS CarryForward, 
//                            Null AS Opening, Null AS Consumption, Null AS Encash, Null AS Closing
//                            From Leave L Where L.Balance=1";

//        dtTemp = dal.fnGetDataTable(SQLString);
//        gvYLDetails.DataSource = dtTemp;
//        gvYLDetails.DataBind();
//        Session["BlankGridView"] = dtTemp;

//    }
    //Session["BlankGridView"] = null;
    //SetEmptyGridView(DateTime.Now.Year.ToString());

=======================================================================================================================

var credit = "#<%=gvYearLeave.ClientID%> tr input[id*='txtCredit']";
NumberwithDecimal(credit);
var cf = "#<%=gvYearLeave.ClientID%> tr input[id*='txtCF']";
NumberwithDecimal(cf);
var opbal = "#<%=gvYearLeave.ClientID%> tr input[id*='txtOpBal']";
NumberwithDecimal(opbal);
var cons = "#<%=gvYearLeave.ClientID%> tr input[id*='txtCons']";
NumberwithDecimal(cons);
var encash = "#<%=gvYearLeave.ClientID%> tr input[id*='txtEncash']";
NumberwithDecimal(encash);

=======================================================================================================================

$(function () {
    $(".gvv").prepend( $("<thead></thead>").append( $(this).find("tr:first") ) ).dataTable();
});

OnPreRender="gvEmployee_PreRender" 

oTable = $(gv).dataTable();
.prepend($("<thead></thead>").append($(this).find("tr:first")))

//$(gv).dataTable({
//    "sScrollY": "200px",
//    "bScrollCollapse": false,
//    "bPaginate": true,
//    "bRetrieve": true,
//    "aoColumnDefs": [{ "bSortable": false, "aTargets": [5] }]
//});


//    //oTable.fnDraw();

//    //    .$('tbody tr[title]').tooltip({
//    //    "delay": 0,
//    //    "track": true,
//    //    "fade": 250
//    //});

=======================================================================================================================
    protected void gvYLDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //if (Session["TranType"].ToString().Equals("0"))
            //{
            //    e.Row.FindControl("lbInsert").Visible = true;
            //    e.Row.FindControl("lbEdit").Visible = false;
            //}
            //if (Session["TranType"].ToString().Equals("1"))
            //{
            //    e.Row.FindControl("lbInsert").Visible = false;
            //    e.Row.FindControl("lbEdit").Visible = true;
            //}
        }
    }


=======================================================================================================================

//if (float.Parse(txtOpBal.Text) == 0)
//{
//    ((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal")).Text = fOpBal.ToString();
//}
//else
//{
//    fOpBal = Convert.ToInt32(((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal")).Text);
//}

=======================================================================================================================

//if (fOpBal > 0)
//{
//    //Consumption
//    fCons = float.Parse(((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCons")).Text);
//    //Encash
//    fEncash = float.Parse(((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtEncash")).Text);

//    fClBal = (fOpBal - (fCons + fEncash));

//    ((Label)gvYLDetails.Rows[rowindex].FindControl("tp_lblClBal")).Text = fClBal.ToString();
//}

=======================================================================================================================


    /// <summary>
    /// Sample 5 - open Sample 1 and add 2 new rows and a Piechart
    /// </summary>
    //public static string MyFirstReport(DirectoryInfo outputDir)
    public void TabularReport(DirectoryInfo outputDir, DataTable dtReport, string sReportTitle)
    {

        FileInfo templateFile = new FileInfo(this.Server.MapPath("~/Reports/tpMain.xlsx"));
        using (ExcelPackage package = new ExcelPackage(templateFile))
        {

            ExcelWorksheet worksheet = package.Workbook.Worksheets[1];

            package.Workbook.Properties.Author = "Smart Infocom Pvt. Ltd";
            package.Workbook.Properties.Title = sReportTitle;

            worksheet.Cells["A7"].Value = "Report : " + sReportTitle;
            //worksheet.Cells["A7"].Style.Font.Bold = true;

            worksheet.Cells["A8"].Value = "Printed on : " + DateTime.Now.ToShortDateString();
            worksheet.Cells[7, 1, 8, 1].Style.Font.Bold = true;
            worksheet.Cells[7, 1, 8, 1].Style.Font.Size = 11;

            //string sRange = worksheet.Cells["A10"].LoadFromDataTable(dtReport, true);

            //ExcelRange rng = worksheet.Cells[rowIndex, colIndex];
            ExcelRangeBase exlRange = worksheet.Cells["A10"].LoadFromDataTable(dtReport, true,OfficeOpenXml.Table.TableStyles.Light19);

            //Setting top,left,right,bottom border of header cells
            exlRange.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Double);
            exlRange.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            exlRange.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            exlRange.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            exlRange.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

            ((ExcelRange)worksheet.Cells[10, 1, 10, 6]).Style.Font.Bold = true;
            ((ExcelRange)worksheet.Cells[10, 4, dtReport.Rows.Count+10, 6]).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;

            //Example how to Format Column 1 as numeric 
            using (ExcelRange col = worksheet.Cells[11, 5, dtReport.Rows.Count + 10, 6])
            {
                col.Style.Numberformat.Format = "dd-MMM-yyyy";
            }

            string footercelladd =  "A" + (dtReport.Rows.Count+12);
            worksheet.Cells[footercelladd].Value = "Toral Records : " + dtReport.Rows.Count;
            worksheet.Cells[footercelladd].Style.Font.Bold = true;
            worksheet.Cells[footercelladd].Style.Font.Size = 12;

            //Write it back to the client
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment;  filename=EmpDetails.xlsx");
            Response.BinaryWrite(package.GetAsByteArray());

            //worksheet.Cells["A5"].Value = "12010";
            //worksheet.Cells["B5"].Value = "Drill";
            //worksheet.Cells["C5"].Value = 20;
            //worksheet.Cells["D5"].Value = 8;

            //worksheet.Cells["A6"].Value = "12011";
            //worksheet.Cells["B6"].Value = "Crowbar";
            //worksheet.Cells["C6"].Value = 7;
            //worksheet.Cells["D6"].Value = 23.48;

            //worksheet.Cells["E2:E6"].FormulaR1C1 = "RC[-2]*RC[-1]";

            //var name = worksheet.Names.Add("SubTotalName", worksheet.Cells["C7:E7"]);
            //name.Style.Font.Italic = true;
            //name.Formula = "SUBTOTAL(9,C2:C6)";

            ////Format the new rows
            //worksheet.Cells["C5:C6"].Style.Numberformat.Format = "#,##0";
            //worksheet.Cells["D5:E6"].Style.Numberformat.Format = "#,##0.00";

            //var chart = (worksheet.Drawings.AddChart("PieChart", eChartType.Pie3D) as ExcelPieChart);

            //chart.Title.Text = "Total";
            ////From row 1 colum 5 with five pixels offset
            //chart.SetPosition(0, 0, 5, 5);
            //chart.SetSize(600, 300);

            //ExcelAddress valueAddress = new ExcelAddress(2, 5, 6, 5);
            //var ser = (chart.Series.Add(valueAddress.Address, "B2:B6") as ExcelPieChartSerie);
            //chart.DataLabel.ShowCategory = true;
            //chart.DataLabel.ShowPercent = true;

            //chart.Legend.Border.LineStyle = eLineStyle.Solid;
            //chart.Legend.Border.Fill.Style = eFillStyle.SolidFill;
            //chart.Legend.Border.Fill.Color = Color.DarkBlue;

            ////Switch the PageLayoutView back to normal
            //worksheet.View.PageLayoutView = false;
            // save our new workbook and we are done!
            //package.Save();
        }

        //return newFile.FullName;

    }

=======================================================================================

    public void ExportXLReport(DataTable dtReport, string sReportTitle)
    {
        FileInfo templateFile = new FileInfo(HttpContext.Current.Server.MapPath("~/Reports/tpMain.xlsx"));
        using (ExcelPackage xlpkg = new ExcelPackage(templateFile))
        {

            ExcelWorksheet worksheet = xlpkg.Workbook.Worksheets[1];

            xlpkg.Workbook.Properties.Author = "Smart Infocom Pvt. Ltd";
            xlpkg.Workbook.Properties.Title = sReportTitle;

            worksheet.Cells["A7"].Value = "Report : " + sReportTitle;

            worksheet.Cells["A8"].Value = "Printed on : " + DateTime.Now.ToShortDateString();
            worksheet.Cells[7, 1, 8, 1].Style.Font.Bold = true;
            worksheet.Cells[7, 1, 8, 1].Style.Font.Size = 11;

            foreach (DataRow dtRow in dtReport.Rows)
            { 
                
            }

            //ExcelRangeBase exlRange = worksheet.Cells["A10"].LoadFromDataTable(dtReport, true, OfficeOpenXml.Table.TableStyles.Light19);

            ////Setting top,left,right,bottom border of header cells
            //exlRange.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            //exlRange.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            //exlRange.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            //exlRange.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

            ////Setting the header font style to be bold
            //int iTotalCols = dtReport.Columns.Count;
            //((ExcelRange)worksheet.Cells[10, 1, 10, iTotalCols]).Style.Font.Bold = true;

            //foreach (DataColumn dc in dtReport.Columns)
            //{
            //    if ((dc.DataType == typeof(System.Decimal) ||
            //        dc.DataType == typeof(System.Int32) ||
            //        dc.DataType == typeof(System.Double)))
            //    {
            //        //Example how to Format Column 1 as numberic
            //        ((ExcelRange)worksheet.Cells[10, 4, dtReport.Rows.Count + 10, 6]).Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            //        using (ExcelRange col = worksheet.Cells[11, 5, dtReport.Rows.Count + 10, 6])
            //        {
            //            col.Style.Numberformat.Format = "###0.00";
            //        }
            //    }
            //    else if (dc.DataType == typeof(System.DateTime))
            //    {
            //        //Example how to Format Column 1 as Datetime
            //        ((ExcelRange)worksheet.Cells[10, 4, dtReport.Rows.Count + 10, 6]).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            //        using (ExcelRange col = worksheet.Cells[11, 5, dtReport.Rows.Count + 10, 6])
            //        {
            //            col.Style.Numberformat.Format = "dd-MMM-yyyy";
            //        }
            //    }
            //}

            //string footercelladd = "A" + (dtReport.Rows.Count + 12);
            //worksheet.Cells[footercelladd].Value = "Toral Records : " + dtReport.Rows.Count;
            //worksheet.Cells[footercelladd].Style.Font.Bold = true;
            //worksheet.Cells[footercelladd].Style.Font.Size = 12;

//            //Write it back to the client
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;  filename=" + sReportTitle + ".xlsx");
            HttpContext.Current.Response.BinaryWrite(xlpkg.GetAsByteArray());

        }
    }

=======================================================================================================================

Select L.Location, C.Company, D.Department, ROW_NUMBER() OVER (PARTITION BY D.Department ORDER BY E.EmpCode) 
AS RowNumber, E.EmpCode AS Code, E.Name, E.FatherName AS [Father Name], E.Sex as Gender, E.JoinDate AS [Join Date], 
E.BirthDate AS DOB From Employee E Inner Join Location L ON E.Locid=L.LocId
Inner Join Department D ON D.deptid=E.Deptid
Inner Join Company C ON C.CompId = E.Compid
Order By EmpCode

=======================================================================================================================

    //var table=worksheet.Tables.Add(new ExcelAddressBase(iRow, iRow, iRow,dtResult.Columns.Count),sTableName);
    //iRow = exportdetail(dtReport,  worksheet, iRow, sLoc, sComp, sGroupCol, sGroupVal);

    //public int exportdetail(DataTable dtTemp, ExcelWorksheet xlws, int iRowIndex,string sloc,string scompany, string sgroup, string sgroupval)
    //{
    //    DataView dv = new DataView(dtTemp);
    //    dv.RowFilter = "Location='" + sloc + "' AND Company='" + scompany + "' AND " + sgroup + "='" + sgroupval + "'";
    //    if (dv.Count > 0)
    //    {
    //        DataTable dtResult  = new DataTable();
    //        dtResult = dv.ToTable();
    //        xlws.Cells["B" + iRowIndex].LoadFromDataTable(dtResult, true, OfficeOpenXml.Table.TableStyles.Light19);
    //        iRowIndex += dv.Count;
    //    }
    //    return iRowIndex;
    //}

=======================================================================================================================

	//dtCompany = dal.fnGetFilterData(Session["Company"] as DataTable, sFilterExp);
	//if (dtCompany.Rows.Count > 0)
	//{
	//    gvCompany.DataSource = dtCompany;
	//    gvCompany.DataBind();
	//    rbDaily.Checked = true;
	//    ddlDaily.Enabled = true;
	//    pnlFromdate.Visible = true;
	//}
	//upMIS.Update();

=======================================================================================================================

	    function selectallcompany()
        {
            //Start Company Grid View Code
            var chkallcomp = '#<%=gvCompany.ClientID%>' + '_tp_chkAllCompany';
            $(chkallcomp).change(function () {
                var bVal = $(this).prop('checked');
                $('#<%=gvCompany.ClientID%> input[id*=tp_chkCompany]').prop('checked', bVal);
            })
        }

        function checkuncheckcompany()
        {
            var chkallcomp = '#<%=gvCompany.ClientID%>' + '_tp_chkAllCompany';
            $('#<%=gvCompany.ClientID%> input[id*=tp_chkCompany]').change(function () {
                //Get number of checkboxes in list either checked or not checked
                var totalCheckboxes = $("#<%=gvCompany.ClientID%> input[id*=tp_chkCompany]").size();
                //Get number of checked checkboxes in list
                var checkedCheckboxes = $("#<%=gvCompany.ClientID%> input[id*=tp_chkCompany]:checkbox:checked").size();
                //Check / Uncheck top checkbox if all the checked boxes in list are checked
                if (totalCheckboxes == checkedCheckboxes)
                { $(chkallcomp).prop('checked', true); }
                else
                { $(chkallcomp).prop('checked', false); }
            });
            //End Company Grid View Code
        }

        function selectallgroup()
        {
            //Start Group Grid View Code
            var chkallgroup = '#<%=gvGroup.ClientID%>' + '_tp_chkAllGroup';
            $(chkallgroup).click(function () {
                var bVal = $(this).prop('checked');
                $('#<%=gvGroup.ClientID%> input[id*=tp_chkGroup]').prop('checked', bVal);
            })
        }

        function checkuncheckgroup()
        {
            var chkallgroup = '#<%=gvGroup.ClientID%>' + '_tp_chkAllGroup';
            $('#<%=gvGroup.ClientID%> input[id*=tp_chkGroup]').change(function () {
                //Get number of checkboxes in list either checked or not checked
                var totalCheckboxes = $("#<%=gvGroup.ClientID%> input[id*=tp_chkGroup]").size();
                //Get number of checked checkboxes in list
                var checkedCheckboxes = $("#<%=gvGroup.ClientID%> input[id*=tp_chkGroup]:checkbox:checked").size();
                //Check / Uncheck top checkbox if all the checked boxes in list are checked
                if (totalCheckboxes == checkedCheckboxes)
                { $(chkallgroup).prop('checked', true); }
                else
                { $(chkallgroup).prop('checked', false); }

            });
            //End Group Grid View Code
        }

        function selectallorder()
        {
            //Start Order Grid View Code
            var chkallorder = '#<%=gvOrder.ClientID%>' + '_tp_chkAllOrder';
            $(chkallorder).click(function () {
                var bVal = $(this).prop('checked');
                $('#<%=gvOrder.ClientID%> input[id*=tp_chkOrder]').prop('checked', bVal);
            })
        }

        function checkuncheckorder()
        {
            var chkallorder = '#<%=gvOrder.ClientID%>' + '_tp_chkAllOrder';
            $('#<%=gvOrder.ClientID%> input[id*=tp_chkOrder]').change(function () {
                //Get number of checkboxes in list either checked or not checked
                var totalCheckboxes = $("#<%=gvOrder.ClientID%> input[id*=tp_chkOrder]").size();
                //Get number of checked checkboxes in list
                var checkedCheckboxes = $("#<%=gvOrder.ClientID%> input[id*=tp_chkOrder]:checkbox:checked").size();
                //Check / Uncheck top checkbox if all the checked boxes in list are checked
                if (totalCheckboxes == checkedCheckboxes)
                { $(chkallorder).prop('checked', true); }
                else
                { $(chkallorder).prop('checked', false); }

            });
            //End Order Grid View Code
        }

=======================================================================================================================

		//        DataTable dtTemp;
        //        string sOrderBy = "Order By EmpCode";
        //        string SQLString = @"Select L.Location, C.Company, D.Department, ROW_NUMBER() OVER (PARTITION BY L.Location, 
        //                            C.Company, D.Department ORDER BY E.EmpCode) AS SrNo, E.EmpCode AS Code, E.Name, 
        //                            E.FatherName AS [Father Name],
        //                            CASE E.Sex When 'F' Then 'Female' When 'M' Then 'Male'End AS Gender,
        //                            CONVERT(varchar(10),E.JoinDate,103) AS [JoinDate], 
        //                            CONVERT(varchar(10),E.BirthDate,103) AS DOB From 
        //                            Employee E Inner Join Location L ON E.Locid=L.LocId
        //                            Inner Join Department D ON D.deptid=E.Deptid
        //                            Inner Join Company C ON C.CompId = E.Compid " + sOrderBy;

        //        dtTemp = dal.fnGetDataTable(SQLString);
        //        if (dtTemp.Rows.Count > 0)
        //        {
        //            string[] HeaderCols = {"Location","Company","Department"};
        //            dal.ExportXLReport(dtTemp, "Daily Report","Department","Grade",HeaderCols);
        //        }

=======================================================================================================================

<%--        function selectallocation()
        {
            var bVal = document.getElementById('<%=cbAllLoc.ClientID %>').checked;
            alert(bVal);
            $('#<%=cblLoc.ClientID %> :input[type=checkbox]').each(function () { //loop through each checkbox
                this.checked = bVal;  //select all checkboxes with class "checkbox1"
            });
        }--%>

=======================================================================================================================

string filePath = "~/App_Data/emptyExcelFile.xlsx";
 FileInfo fi = new FileInfo(Server.MapPath(filePath));
 using (ExcelPackage xlPackage = new ExcelPackage(fi))
 {
     for (int i = 1; i <= 3; i++)
     {
        ExcelWorksheet worksheet;
        worksheet = xlPackage.Workbook.Worksheets.Add("Day"+i, sheetName);
     }

     Response.Clear();
     Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
     Response.AddHeader("content-disposition", "attachment;  filename=" + "myExcelFile.xlsx");
     Response.BinaryWrite(xlPackage.GetAsByteArray());
     Response.Flush();
     Response.End();
  }

=======================================================================================================================

                            //worksheet.Cells[iRow, iCol + 1].Value = dtCol.ColumnName;
                            ////if (dtCol.ColumnName.Equals("SrNo"))
                            ////    worksheet.Cells[iRow, 1, iRow +dv.Count, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                            //iCol++;

=======================================================================================================================

//worksheet.Cells[sAddress].LoadFromDataTable(dtResult, true, OfficeOpenXml.Table.TableStyles.Dark2);

=======================================================================================================================

////Columns - Writting Reports Headers
//foreach (DataColumn dtCol in dtResult.Columns)
//{
//    if (Array.IndexOf(headerColumns, dtCol.ColumnName.ToLower().ToString()) < 0)
//    {
//        if (Array.IndexOf(DisplayColumns, dtCol.ColumnName.ToLower().ToString()) >= 0)
//        {
//            worksheet.Cells[iRow, iCol + 1].Value = dtCol.ColumnName;
//            worksheet.Cells[iRow, iCol + 1].Style.Font.Bold = true;
//            if (dtCol.ColumnName.ToString().Equals("SrNo"))
//            {
//                worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
//            }
//            iCol++;
//        }
//    }
//}

//sGroupVal = dtHead.Rows[iRo][sGroupCol].ToString();
//worksheet.Cells["A" + iRow].Value = sGroupCol + " : " + dtHead.Rows[iRo][sGroupCol].ToString();
//worksheet.Cells["A" + iRow].Style.Font.Bold = true;


//if (Array.IndexOf(headerColumns, dtCol.ColumnName.ToString()) < 0)
//{
//    if (Array.IndexOf(DisplayColumns, dtCol.ColumnName.ToString()) >= 0)
//    {
//        if (dtCol.ColumnName.Equals("SrNo"))
//        {
//            worksheet.Cells[iRow, iCol].Value = iRowIndex;
//            worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
//        }
//        else
//        {
//            worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
//        }
//        iCol++;
//    }
//}


//Applying the Style to the report
//var tbl = worksheet.Tables.Add(worksheet.Cells[iFirstRow, 1, iLastRow, iTotalColumns], null);
//tbl.TableStyle = OfficeOpenXml.Table.TableStyles.Light1;

//Daily Report
//case 12: //Employee Wise Summary ????
//    //DAILY_SUMMARY_EXCEL_REPORT
//    displaycol = "SrNo,Strength,Present, WorkHrs";
//    printcol = "Sr.No,Strength,Present,WorkHrs";
//    break;
//case 13: //Dept Wise Summary ????
//    displaycol = "SrNo,Department,Strength,Present,Absent";
//    printcol = "Sr.No,Department,Strength,Present,Absent";
//    break;

=======================================================================================================================

    public void ExportXLSMRYReport(DataTable dtReport, string sFromDate, string sToDate, string sReportTitle, string sGroupCol, string sSubGroupCol, bool bPrintTotal, string[] DisplayColumns, string[] PrintColumns)
    {
        using (ExcelPackage package = new ExcelPackage())
        {
            ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(sReportTitle);

            package.Workbook.Properties.Company = "Smart Infocom Pvt. Ltd";
            package.Workbook.Properties.Author = "SmartInfo IT Team";
            package.Workbook.Properties.Subject = "Report : " + sReportTitle;
            package.Workbook.Properties.Title = sReportTitle;


            if (string.IsNullOrEmpty(sToDate))
            {
                worksheet.Cells["A1"].Value = "Report : " + sReportTitle + " Report as of " + sFromDate;
            }
            else
            {
                worksheet.Cells["A1"].Value = "Report : " + sReportTitle + " Report From : " + sFromDate + " : To : " + sToDate;
            }
            worksheet.Cells["A2"].Value = "Printed on : " + DateTime.Now.ToShortDateString();
            worksheet.Cells[1, 1, 2, 1].Style.Font.Bold = true;
            worksheet.Cells[1, 1, 2, 1].Style.Font.Size = 11;
            worksheet.Cells[1, 1, 2, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;

            int iRow = 4;

            DataTable dtDetails = null;
            if (sGroupCol.Equals("Shift"))
            {
                sGroupCol = "ShiftCode";
            }
            if (sSubGroupCol.Equals("Shift"))
            {
                sSubGroupCol = "ShiftCode";
            }

            dtDetails = dtReport.DefaultView.ToTable(true, "Location", "Company", sGroupCol, sSubGroupCol);

            dtDetails.Columns.Add("SrNo", typeof(int));
            dtDetails.Columns.Add("Present", typeof(float));
            dtDetails.Columns.Add("Absent", typeof(float));
            dtDetails.Columns.Add("Leave", typeof(float));
            dtDetails.Columns.Add("Total", typeof(float));

            int iRo;
            string sLoc, sPreLoc, sComp, sPreComp;
            for (iRo = 0; iRo <= dtDetails.Rows.Count - 1; iRo++)
            {
                sLoc = dtDetails.Rows[iRo]["Location"].ToString();
                sComp = dtDetails.Rows[iRo]["Company"].ToString();

                string sGroupVal = dtDetails.Rows[iRo][sGroupCol].ToString();
                string sSubGroupVal = dtDetails.Rows[iRo][sSubGroupCol].ToString();

                string sFilterExp;
                float fPresent=0;
                float fAbsent=0;
                float fLeave=0;
                float fTotal=0;
                
                //Present 
                sFilterExp = "Location='" + sLoc + "' AND Company='" + sComp + "' AND " + sGroupCol + "='" + sGroupVal + "' AND " + sSubGroupCol + "='" + sSubGroupVal + "'";
                string sPresentExp = sFilterExp + " AND STATUS='P' AND ISNULL(LEAVE,'')='' AND ISNULL(HALFDAY,'')=''";
                dtReport.DefaultView.RowFilter = sPresentExp;
                if (dtReport.DefaultView.Count > 0)
                {
                    fPresent = dtReport.DefaultView.Count;
                }

                //Present  + Half Day
                float fPrHalfDay=0;
                sPresentExp = "";
                sPresentExp = sFilterExp + " AND ISNULL(HALFDAY,'')='HF'";
                dtReport.DefaultView.RowFilter = sPresentExp;
                if (dtReport.DefaultView.Count > 0)
                {
                    fPrHalfDay = (dtReport.DefaultView.Count / 2);
                }

                //Absent
                string sAbsentExp = sFilterExp + " AND STATUS='A' AND ISNULL(LEAVE,'')='' AND ISNULL(HALFDAY,'')=''";
                dtReport.DefaultView.RowFilter = sAbsentExp;
                if (dtReport.DefaultView.Count > 0)
                {
                    fAbsent = dtReport.DefaultView.Count;
                }

                //Absent + Half Day
                float fAbHalfDay = 0;
                sAbsentExp = "";
                sAbsentExp = sFilterExp + " AND ISNULL(HALFDAY,'')='HF'";
                dtReport.DefaultView.RowFilter = sPresentExp;
                if (dtReport.DefaultView.Count > 0)
                {
                    fAbHalfDay = (dtReport.DefaultView.Count / 2);
                }

                //Leave
                string sLeaveExp = sFilterExp + " AND ISNULL(LEAVE,'')<>'' AND ISNULL(LEAVE,'')<>'WO' AND ISNULL(LEAVE,'')<>'HL'";
                dtReport.DefaultView.RowFilter = sLeaveExp;
                if (dtReport.DefaultView.Count > 0)
                {
                    fLeave = dtReport.DefaultView.Count;
                }

                dtDetails.Rows[iRo]["SrNo"] = iRo+1 ;
                dtDetails.Rows[iRo]["Present"] = fPresent + fPrHalfDay;
                dtDetails.Rows[iRo]["Absent"] = fAbsent;
                dtDetails.Rows[iRo]["Leave"] = fLeave;
                fTotal = fPresent + fAbsent + fLeave;
                dtDetails.Rows[iRo]["Total"] = fTotal;

            }

            if (dtDetails.Rows.Count > 0)
            {
                for (iRo = 0; iRo <= dtDetails.Rows.Count - 1; iRo++)
                {
                    if (iRo == 0)
                    {
                        sLoc = dtDetails.Rows[iRo]["Location"].ToString();
                        worksheet.Cells["A" + iRow].Value = "Location : " + sLoc;
                        worksheet.Cells["A" + iRow].Style.Font.Bold = true;

                        iRow += 1;
                        sComp = dtDetails.Rows[iRo]["Company"].ToString();
                        worksheet.Cells["A" + iRow].Value = "Company : " + sComp;
                        worksheet.Cells["A" + iRow].Style.Font.Bold = true;
                    }
                    else
                    {
                        sPreLoc = dtDetails.Rows[iRo - 1]["Location"].ToString();
                        sLoc = dtDetails.Rows[iRo]["Location"].ToString();
                        if (!sLoc.Equals(sPreLoc))
                        {
                            iRow += 2;
                            worksheet.Cells["A" + iRow].Value = "Location : " + sLoc;
                            worksheet.Cells["A" + iRow].Style.Font.Bold = true;
                        }

                        sPreComp = dtDetails.Rows[iRo - 1]["Company"].ToString();
                        sComp = dtDetails.Rows[iRo]["Company"].ToString();
                        if (!sComp.Equals(sPreComp))
                        {
                            iRow += 1;
                            worksheet.Cells["A" + iRow].Value = "Company : " + sComp;
                            worksheet.Cells["A" + iRow].Style.Font.Bold = true;
                        }
                    }

                    DataView dvData = new DataView(dtDetails);
                    dvData.RowFilter = "Location='" + sLoc + "' AND Company='" + sComp + "'";
                    if (dvData.Count > 0)
                    {
                        DataTable dtResult = dvData.ToTable(true, "SrNo", sGroupCol, sSubGroupCol, "Present", "Absent", "Leave", "Total");

                        int iFirstRow, iLastRow, iTotalColumns;
                        iTotalColumns = 0;

                        iRow += 1;
                        int iCol = 0;

                        iFirstRow = iRow;

                        foreach (string val in PrintColumns)
                        {
                            worksheet.Cells[iRow, iCol + 1].Value = val;
                            worksheet.Cells[iRow, iCol + 1].Style.Font.Bold = true;
                            if (val.ToString().Equals("Sr.No"))
                            {
                                worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                            }
                            iCol++;
                        }

                        iTotalColumns = iCol;

                        //Rows - Writting Data
                        int iTotalRec = 0;
                        iRow += 1;
                        int iRowIndex = 1;
                        foreach (DataRow dtRow in dtResult.Rows)
                        {
                            iCol = 1;
                            foreach (DataColumn dtCol in dtResult.Columns)
                            {
                                if (dtCol.ColumnName.Equals("SrNo"))
                                {
                                    worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
                                    worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                                }
                                else
                                {
                                    worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
                                }
                                iCol++;
                            }
                            iRow++;
                            iRowIndex++;
                            iTotalRec++;
                        }
                        if (bPrintTotal)
                        {
                            worksheet.Cells["A" + iRow].Value = "Total Records : " + iTotalRec;
                        }

                        iLastRow = iRow - 1;

                        worksheet.Cells[iFirstRow, 1, iLastRow, iTotalColumns].Style.Border.Left.Style = ExcelBorderStyle.Thin;
                        worksheet.Cells[iFirstRow, 1, iLastRow, iTotalColumns].Style.Border.Right.Style = ExcelBorderStyle.Thin;
                        worksheet.Cells[iFirstRow, 1, iLastRow, iTotalColumns].Style.Border.Top.Style = ExcelBorderStyle.Thin;
                        worksheet.Cells[iFirstRow, 1, iLastRow, iTotalColumns].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;

                    }
                }

                iRow++;
            }



            iRow += 2;
            worksheet.Cells["A" + iRow].Value = "Total Records : " + dtReport.Rows.Count;

            //checkout how to autofit first column
            worksheet.Cells["A1"].AutoFitColumns(9);
            worksheet.Cells.AutoFitColumns();

            //Write it back to the client
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;  filename=" + sReportTitle + ".xlsx");
            HttpContext.Current.Response.BinaryWrite(package.GetAsByteArray());
            HttpContext.Current.Response.End();
        }
    }


=======================================================================================================================

	            //int sSelIndex = Convert.ToInt32(ddlGroup.SelectedValue.ToString());
            //string sGroupIds = "";
            //if (sSelIndex == 1)
            //{
            //    var GROUPSEL = from GridViewRow gvRow in gvGroup.Rows
            //                    where (((CheckBox)(gvRow.FindControl("tp_chkGroup"))).Checked)
            //                    select ((Label)(gvRow.FindControl("EmpId"))).Text;
            //    sGroupIds = String.Join(",", GROUPSEL);
            //}

            //if (sSelIndex == 2)
            //{
            //    //var GROUPSEL = from GridViewRow gvRow in gvGroup.Rows
            //    //                where (((CheckBox)(gvRow.FindControl("tp_chkGroup"))).Checked)
            //    //                select ((Label)(gvRow.FindControl("DeptId"))).Text;

            //    //sGroupIds = String.Join(",", GROUPSEL);

            //}

            //if (sSelIndex == 3)
            //{
            //    var GROUPSEL = from GridViewRow gvRow in gvGroup.Rows
            //                   where (((CheckBox)(gvRow.FindControl("tp_chkGroup"))).Checked)
            //                   select ((Label)(gvRow.FindControl("CatId"))).Text;
            //    sGroupIds = String.Join(",", GROUPSEL);
            //}

            //if (sSelIndex == 4)
            //{
            //    var GROUPSEL = from GridViewRow gvRow in gvGroup.Rows
            //                   where (((CheckBox)(gvRow.FindControl("tp_chkGroup"))).Checked)
            //                   select ((Label)(gvRow.FindControl("ShiftId"))).Text;
            //    sGroupIds = String.Join(",", GROUPSEL);
            //}

            //if (sSelIndex == 5)
            //{
            //    var GROUPSEL = from GridViewRow gvRow in gvGroup.Rows
            //                   where (((CheckBox)(gvRow.FindControl("tp_chkGroup"))).Checked)
            //                   select ((Label)(gvRow.FindControl("GradeId"))).Text;
            //    sGroupIds = String.Join(",", GROUPSEL);
            //}

=======================================================================================================================

            int sSelIndex = Convert.ToInt32(ddlOrder.SelectedValue.ToString());
            string sOrderIds = "";
            switch (sSelIndex)
            {
                case 1: //Employee
                    {
                        var SUBGROUPSEL = from GridViewRow gvRow in gvOrder.Rows
                                          where (((CheckBox)(gvRow.FindControl("tp_chkOrder"))).Checked)
                                          select ((Label)(gvRow.FindControl("EmpId"))).Text;
                        sOrderIds = String.Join(",", SUBGROUPSEL);
                    }
                    break;
                case 2: //Department
                    {
                        var SUBGROUPSEL = from GridViewRow gvRow in gvOrder.Rows
                                          where (((CheckBox)(gvRow.FindControl("tp_chkOrder"))).Checked)
                                          select ((Label)(gvRow.FindControl("DeptId"))).Text;
                        sOrderIds = String.Join(",", SUBGROUPSEL);
                    }
                    break;
                case 3: //Category
                    {
                        var SUBGROUPSEL = from GridViewRow gvRow in gvOrder.Rows
                                          where (((CheckBox)(gvRow.FindControl("tp_chkOrder"))).Checked)
                                          select ((Label)(gvRow.FindControl("CatId"))).Text;
                        sOrderIds = String.Join(",", SUBGROUPSEL);
                    }
                    break;
                case 4: //Shift
                    {
                        var SUBGROUPSEL = from GridViewRow gvRow in gvOrder.Rows
                                          where (((CheckBox)(gvRow.FindControl("tp_chkOrder"))).Checked)
                                          select ((Label)(gvRow.FindControl("ShiftId"))).Text;
                        sOrderIds = String.Join(",", SUBGROUPSEL);
                    }
                    break;
                case 5: //Grade
                    {
                        var SUBGROUPSEL = from GridViewRow gvRow in gvOrder.Rows
                                          where (((CheckBox)(gvRow.FindControl("tp_chkOrder"))).Checked)
                                          select ((Label)(gvRow.FindControl("GradeId"))).Text;
                        sOrderIds = String.Join(",", SUBGROUPSEL);
                    }
                    break;
            }

=======================================================================================================================

Login Page aspx code.

			<%--    <link href="Res/css/LoginStyleSheet.css" rel="stylesheet" />
    
    <style type="text/css">
        .row {
            padding: 80px 0px;
        }

            .row + .row {
                margin-top: 10px;
                margin-bottom: 10px;
            }
        .elemstyle {
            font-size:small;
            font-weight:normal;
            color:red;
        }

    </style>--%>

=======================================================================================================================
Login Page aspx page

	<%--    <div class="block">
        <div class="container">
            <div class="row">
                <div class="span6">
                    <h1>
                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Smart Logo1.jpg" Width="455px" />
                    </h1>
                    <hr />
                    <p>
                        &nbsp;Details About the Company
                    </p>
                </div>
                <div class="offset1 span5">
                    <div class="clear-form">
                        <form id="form1" runat="server">
                            <div class="form-heading">
                                <h3>Sign In</h3>
                            </div>
                            <div class="form-body">
                                <asp:TextBox ID="txtUserId" CssClass="input-block-level" placeholder="UserId" runat="server" Width="250" />
                                <asp:RequiredFieldValidator ID="rfv_txtUserId" runat="server" SetFocusOnError="true" ForeColor="Red" Text="*"
                                ErrorMessage="User ID cannot be blank" ControlToValidate="txtUserId" Font-Bold="true" Font-Size="Larger">
                                </asp:RequiredFieldValidator>         
                                <asp:TextBox ID="txtPassword" CssClass="input-block-level" placeholder="Password" runat="server" TextMode="Password"  Width="250"  />
                                <asp:RequiredFieldValidator ID="rfv_txtPassword" runat="server" ForeColor="Red" SetFocusOnError="true" Text="*"
                                 ErrorMessage="Password cannot be blank" ControlToValidate="txtPassword" Font-Bold="true" Font-Size="Larger">
                                 </asp:RequiredFieldValidator>         
                                <div class="body-split">
                                    <div class="left-col">
                                        <%--<label class="checkbox">
                                            <input type="checkbox" value="remember-me" />
                                            Remember me
                                        </label>--%>
                                    </div>
                                    <div class="right-col">
                                        <%--<button class="btn btn-blue pull-right" type="submit">Login</button>--%>
                                        <asp:Button ID="btnLogin" runat="server" Text="Login" CssClass="btn btn-blue pull-left" OnClick="btnLogin_Click" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-footer">
                                <hr />
                                <p class="center">
                                    <%--<a href="#">Forgot your password?</a>--%>
                                    <asp:ValidationSummary ID="vs" runat="server" ShowSummary="true" DisplayMode="BulletList"
                                        HeaderText="Following error occurs:" ShowMessageBox="false" ForeColor="red" Font-Bold="true" CssClass="center" />
                                    <asp:Label ID="lblOutput" runat="server" Font-Bold="true" Font-Size="Large" />
                                </p>
                            </div>
                        </form>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>--%>

====================================================================================================================================================================================================================================================================================================

//SqlCommand cmd = new SqlCommand("Exec MONTHLY_EXCEL_REPORT '01 jan 2015','31 jan 2015','(''INTIME'',''OUTTIME'',''LATE'',''EARLY'',''OT'',''SHIFT'',''LEAVE'',''WORKHRS'')','(M.CompId>=2 AND M.CompId<=10)','(M.EmpId>=511 AND M.EmpId<=612)','(M.EmpId<>'''')',' ORDER BY LOCCODE, COMPCODE',1");
//SqlCommand cmd = new SqlCommand("Exec MONTHLY_EXCEL_REPORT '" + sfrom + "','" + sTo + "','" + sOption + "','" + COMPSEL + "','" + GROUPSEL + "','" + SUBGROUPSEL + "','" + SORTSEL + "'," + iUserId);
//con.Open();
//cmd.Connection = con;
//SqlDataReader dr = cmd.ExecuteReader();
//dtResult.Load(dr);


==============================================================================================================
//sourcesanspro.css
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 300;
  src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGD_j0nMiB9fPhg_k1wdK2h0.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 300;
  src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGDRVvBvQIc1z78c__uoBcyI.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 300;
  src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGHPU7CIF47hG64WdfUow7GU.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNOAHFN6BivSraYkjhveRHY.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlC2Q8seG17bfDXYR_jUsrzg.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlDKRFmJUU_JfdI4amS9F_UY.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 600;
  src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGClYwVOhDRq2vbpGRTZ7bbs.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 600;
  src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGFKFh1TDTPrUZWzVp6FtpG8.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 600;
  src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGG_w2dyNTaOK_2O4fIAsE0k.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 700;
  src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGDovqjS_dXPZszO_XltPdNg.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 700;
  src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGFxe-GPfKKFmiXaJ_Q0GFr8.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 700;
  src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGKBBe7f1mpvECReg0afxak4.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 300;
  src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6E78GtRp3lhchupCJNw8t58.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 300;
  src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6Lpx497t94oDua8KfAL9f-E.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 300;
  src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6LPFJZrPh7ECxlTm72wtibs.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 400;
  src: local('Source Sans Pro Italic'), local('SourceSansPro-It'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/M2Jd71oPJhLKp0zdtTvoM7YHq4FgHI02B8rPccK0FJQ.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 400;
  src: local('Source Sans Pro Italic'), local('SourceSansPro-It'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/M2Jd71oPJhLKp0zdtTvoM40tgx99jmYGv_xzYuwd1rU.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 400;
  src: local('Source Sans Pro Italic'), local('SourceSansPro-It'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/M2Jd71oPJhLKp0zdtTvoM410dY3WGVYHeu0rU52MF7U.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* vietnamese */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 600;
  src: local('Source Sans Pro Semibold Italic'), local('SourceSansPro-SemiboldIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6CzM2XYAq8cDhaXsrN8WXcA.woff2) format('woff2');
  unicode-range: U+0102-0103, U+1EA0-1EF1, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 600;
  src: local('Source Sans Pro Semibold Italic'), local('SourceSansPro-SemiboldIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6OXKTZYPNtG1yMB_YJSqlic.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Sans Pro';
  font-style: italic;
  font-weight: 600;
  src: local('Source Sans Pro Semibold Italic'), local('SourceSansPro-SemiboldIt'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6Nw2Q6LARXXmvzc82wi7Ez8.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

==============================================================================================================

//kaushanscript.css
/* latin-ext */
@font-face {
  font-family: 'Kaushan Script';
  font-style: normal;
  font-weight: 400;
  src: local('Kaushan Script'), local('KaushanScript-Regular'), url(http://fonts.gstatic.com/s/kaushanscript/v4/qx1LSqts-NtiKcLw4N03IO87R-l0-Xx_7cYc0ZX1ifE.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Kaushan Script';
  font-style: normal;
  font-weight: 400;
  src: local('Kaushan Script'), local('KaushanScript-Regular'), url(http://fonts.gstatic.com/s/kaushanscript/v4/qx1LSqts-NtiKcLw4N03IOCxcENHzeph3q_bnZkaszo.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

==============================================================================================================
var datesMin = [];
var dates = $("#datepicker1, #datepicker2, #datepicker3, #datepicker4, #datepicker5, #datepicker6, #datepicker7").datepicker({
    minDate: "+0",
    defaultDate: "+1w",
    dateFormat: 'mm/dd/yy',
    numberOfMonths: 1,
    onSelect: function(date) {               
        datesMin.push( new Date( $(this).val() ) );         
    },
    beforeShow: function() {        
        $(this).datepicker("option", "minDate", maxi());
     }   
});

function sortDates(a, b){
    return a.getTime() - b.getTime();
}   

function maxi(){ 
    var sorted = datesMin.sort(sortDates);    
    var minDate;
if(datesMin.length > 0){
    minDate = sorted[sorted.length-1];    
} else {
    minDate = 0;    
}
    return minDate;
} 
    
==============================================================================================================

//var date = $(confdate, dol, tpupto, bondper, ppdoi).datepicker({
//    dateFormat: "dd M yy",
//    defaultDate: "+1w",
//    showbuttonpanel: true,
//    changemonth: true,
//    changeyear: true,
//    beforeShow: function () {
//        $(confdate, dol, tpupto, bondper, ppdoi).datepicker("option", "minDate", $(doj).val());
//    }
//});

==============================================================================================================

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
  document.write(unescape("%3Cscript src='Scripts/jquery.1.9.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
==============================================================================================================

$(document).bind("contextmenu",function(e){
	e.preventDefault();
});

==============================================================================================================
public void ExportToExcel(System.Data.DataTable dt)
{

	if (dt.Rows.Count > 0)
	{
		string filename = "StockValue.xls";
		System.IO.StringWriter tw = new System.IO.StringWriter();
		System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
		DataGrid dgGrid = new DataGrid();
		dgGrid.DataSource = dt;
		dgGrid.DataBind();
		Response.ContentType = "application/vnd.ms-excel";
		Response.Charset = "";
		Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
		Response.Write("<style> td {mso-number-format:" + "\\@" + "; text-align:center;} </style>");
		dgGrid.RenderControl(hw);
		Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
		this.EnableViewState = false;
		Response.Write(tw.ToString());
		Response.End();
	}

}
==============================================================================================================

        //DataSet dsImportData = new DataSet("ImportData");
        //dsImportData.Tables.Clear();
        //dsImportData.Tables.Add(dtEmployee.Copy());
        //dsImportData.Tables[0].TableName = "EmployeeData";
        //dsImportData.Tables.Add(dtSheetData.Copy());
        //dsImportData.Tables[1].TableName = "SheetData";
        //DataRelation dtRelEmpCode = new DataRelation("FKEmpCode", dsImportData.Tables["EmployeeData"].Columns["EmpCode"], dsImportData.Tables["SheetData"].Columns["EmpCode"]);
        //dsImportData.Relations.Add(dtRelEmpCode);

==============================================================================================================

            //Label lblSID = (Label)e.Row.FindControl("tp_lblSID_01");
            //Label lblSCode = (Label)e.Row.FindControl("tp_lblShift_01");
            //if (string.IsNullOrEmpty(lblSID.Text) && (lblSCode.Text.ToUpper()!="WO"))
            //{
            //    e.Row.Cells[4].ForeColor = Color.Red;
            //    e.Row.Cells[4].Font.Bold = true;
            //}

==============================================================================================================
            //string sCol1, sCol2;
            //int iCellIndex = 2;
            //for (int iCol = 1; iCol <= 31; iCol++)
            //{

            //    if (iCol < 10)
            //    {
            //        sCol1 = "tp_lblSID_0" + iCol;
            //        sCol2 = "tp_lblShift_0" + iCol;
            //    }
            //    else
            //    {
            //        sCol1 = "tp_lblSID_" + iCol;
            //        sCol2 = "tp_lblShift_" + iCol;
            //    }
            //    iCellIndex += 2;
            //    HighlightCell(sCol1, sCol2, iCellIndex, e);
            //}
==============================================================================================================

    private void HighlightCell(string sId, string sCode, int iCellIndex,GridViewRowEventArgs e) 
    {
        Label lblSID = (Label)e.Row.FindControl(sId);
        Label lblSCode = (Label)e.Row.FindControl(sCode);
        if (string.IsNullOrEmpty(lblSID.Text) && (lblSCode.Text.ToUpper() != "WO"))
        {
            e.Row.Cells[iCellIndex].ForeColor = Color.Red;
            e.Row.Cells[iCellIndex].Font.Bold = true;
        }
    
    }
==============================================================================================================

	            //HighlightCell("tp_lblSID_01", "tp_lblShift_01", 4, e);    
            //HighlightCell("tp_lblSID_02", "tp_lblShift_02", 6, e);
            //HighlightCell("tp_lblSID_03", "tp_lblShift_03", 8, e);
            //HighlightCell("tp_lblSID_04", "tp_lblShift_04", 10, e);
            //HighlightCell("tp_lblSID_05", "tp_lblShift_05", 12, e);
            //HighlightCell("tp_lblSID_06", "tp_lblShift_06", 14, e);
            //HighlightCell("tp_lblSID_07", "tp_lblShift_07", 16, e);
            //HighlightCell("tp_lblSID_08", "tp_lblShift_08", 18, e);
            //HighlightCell("tp_lblSID_09", "tp_lblShift_09", 20, e);
            //HighlightCell("tp_lblSID_10", "tp_lblShift_10", 22, e);
            //HighlightCell("tp_lblSID_11", "tp_lblShift_11", 24, e);
            //HighlightCell("tp_lblSID_12", "tp_lblShift_12", 26, e);
            //HighlightCell("tp_lblSID_13", "tp_lblShift_13", 28, e);
            //HighlightCell("tp_lblSID_14", "tp_lblShift_14", 30, e);
            //HighlightCell("tp_lblSID_15", "tp_lblShift_15", 32, e);
            //HighlightCell("tp_lblSID_16", "tp_lblShift_16", 34, e);
            //HighlightCell("tp_lblSID_17", "tp_lblShift_17", 36, e);
            //HighlightCell("tp_lblSID_18", "tp_lblShift_18", 38, e);
            //HighlightCell("tp_lblSID_19", "tp_lblShift_19", 40, e);
            //HighlightCell("tp_lblSID_20", "tp_lblShift_20", 42, e);
            //HighlightCell("tp_lblSID_21", "tp_lblShift_21", 44, e);
            //HighlightCell("tp_lblSID_22", "tp_lblShift_22", 46, e);
            //HighlightCell("tp_lblSID_23", "tp_lblShift_23", 48, e);
            //HighlightCell("tp_lblSID_24", "tp_lblShift_24", 50, e);
            //HighlightCell("tp_lblSID_25", "tp_lblShift_25", 52, e);
            //HighlightCell("tp_lblSID_26", "tp_lblShift_26", 54, e);
            //HighlightCell("tp_lblSID_27", "tp_lblShift_27", 56, e);
            //HighlightCell("tp_lblSID_28", "tp_lblShift_28", 58, e);
            //HighlightCell("tp_lblSID_29", "tp_lblShift_29", 60, e);
            //HighlightCell("tp_lblSID_30", "tp_lblShift_30", 62, e);
            //HighlightCell("tp_lblSID_31", "tp_lblShift_31", 64, e);

==============================================================================================================

        ////Location ID
        //dtSheetData.AsEnumerable().Join(dtEmployee.AsEnumerable(), _SheetData => _SheetData["EmpCode"],
        //_EmpData => _EmpData["EmpCode"], (_SheetData, _EmpData) => new { _SheetData, _EmpData }).ToList().ForEach(o => o._SheetData.SetField("LocId", o._EmpData["LocId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtEmployee.AsEnumerable(), _SheetData => _SheetData["EmpCode"],
        //_EmpData => _EmpData["EmpCode"], (_SheetData, _EmpData) => new { _SheetData, _EmpData }).ToList().ForEach(o => o._SheetData.SetField("EmpId", o._EmpData["EmpId"].ToString()));


        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["01"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_01", o._ShiftData["ShiftId"].ToString()));


        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["02"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_02", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["03"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_03", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["04"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_04", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["05"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_05", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["06"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_06", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["07"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_07", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["08"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_08", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["09"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_09", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["10"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_10", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["11"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_11", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["12"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_12", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["13"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_13", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["14"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_14", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["15"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_15", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["16"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_16", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["17"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_17", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["18"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_18", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["19"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_19", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["20"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_20", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["21"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_21", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["22"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_22", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["23"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_23", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["24"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_24", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["25"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_25", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["26"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_26", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["27"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_27", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["28"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_28", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["29"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_29", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["30"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_30", o._ShiftData["ShiftId"].ToString()));

        ////Joining the two table and updating the two datatable. 
        //dtSheetData.AsEnumerable().Join(dtShift.AsEnumerable(), _SheetData => _SheetData["31"],
        //_ShiftData => _ShiftData["ShiftCode"], (_SheetData, _ShiftData) => new { _SheetData, _ShiftData }).ToList().ForEach(o => o._SheetData.SetField("SID_31", o._ShiftData["ShiftId"].ToString()));

==============================================================================================================
////Adding the Data Columns
//dtSheetData.Columns.Add("LocId", typeof(int));
//dtSheetData.Columns["LocId"].SetOrdinal(0);
//dtSheetData.Columns.Add("EmpId", typeof(int));
//dtSheetData.Columns["EmpId"].SetOrdinal(1);
//string sColName;

//for (int iCol = 1; iCol <= 31; iCol++)
//{
//    if (iCol < 10)
//        sColName = "SID_0" + iCol;
//    else
//        sColName = "SID_" + iCol;

//    dtSheetData.Columns.Add(sColName, typeof(int));
//}
==============================================================================================================
       
		//function refreshpanel(pnlid)
        //{
        //    $(pnlid).find('input:text').each(
        //        function () {
        //            $(this).val('');
        //        }
        //    );
        //}

==============================================================================================================

        function resetvalues(CtlId)
        {
            var selval = $(CtlId).val();

            if (selval == "NA") {

                $(pnlinput).find('input:text').attr("disabled", true);
                refreshpanel(pnlinput);

                $(pnlinout).hide();
                refreshpanel(pnlinout);

                $(pnlot).hide();
                refreshpanel(pnlot);

                $(pnllunch).hide();
                refreshpanel(pnllunch);

                $(pnlshift).hide();
                refreshpanel(pnlshift);

            }

            if (selval == 1) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnlinout).show();
                $('#intime').show();
                refreshpanel(pnlinout);

                $('#outtime').hide();
                $(pnlot).hide();
                $(pnllunch).hide();
                $(pnlshift).hide();
            }


            if (selval == 2) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnlinout).show();
                $('#outtime').show();

                $('#intime').hide();
                $(pnlot).hide();
                $(pnllunch).hide();
                $(pnlshift).hide();
            }

            if (selval == 3) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnlinout).show();
                $('#intime').show();
                $('#outtime').show();
                refreshpanel(pnlinout);

                $(pnlot).hide();
                $(pnllunch).hide();
                $(pnlshift).hide();
            }

            if (selval == 4) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnlot).show();
                refreshpanel(pnlot);

                $(pnlinout).hide();
                $(pnllunch).hide();
                $(pnlshift).hide();

            }

            if (selval == 5) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnllunch).show();
                refreshpanel(pnllunch);

                $(pnlinout).hide();
                $(pnlot).hide();
                $(pnlshift).hide();
            }

            if (selval == 6) {
                $(pnlinput).find('input:text').removeAttr("disabled");
                $(pnlshift).show();
                refreshpanel(pnlshift);
                $(pnlinout).hide();
                $(pnlot).hide();
                $(pnllunch).hide();
            }

            $("#<%=gvShift.ClientID%> tr:has(td)").remove();

        }

==============================================================================================================

function RadioCheck(rb) {
	var gv = document.getElementById("<%=gvShift.ClientID%>");
    var rbs = gv.getElementsByTagName("input");

    var row = rb.parentNode.parentNode;
    for (var i = 0; i < rbs.length; i++) {
        if (rbs[i].type == "radio") {
            if (rbs[i].checked && rbs[i] != rb) {
                rbs[i].checked = false;
                break;
            }
        }
    }
}

==============================================================================================================

    //protected void tp_rbSelect_CheckedChanged(object sender, EventArgs e)
    //{

    //    RadioButton rb = (RadioButton)sender;
    //    //get the row that contains this button
    //    GridViewRow gvrow = (GridViewRow)rb.NamingContainer;

    //    txtShiftCode.Text = ((Label)gvrow.FindControl("tp_lblShiftCode")).Text;
    //    hfShiftId.Value = ((Label)gvrow.FindControl("tp_lblShiftId")).Text;

    //    //GridViewRow row = gvData.selectedrow;
    //    //= gvrow.RowIndex;
    //    //txtshift.text = row.cells[3].text;
    //    //hfshiftid.value = row.cells[1].text;
    //    //txtshift.text = row.findcontrol("tp_lblshiftid") as label).text;
    //}

==============================================================================================================

hOLIDAY FORM

    //protected void cbAll_CheckedChanged(object sender, EventArgs e)
    //{
    //    //SetAllCategory(cbAll.Checked,false);
    //}


	    ////Selected and Unselected all the categories - When user click on Select All Categories Check Box
    //public void SetAllCategory(bool bCheck,bool bClearForm)
    //{
    //    for (int iItem = 0; iItem < cblAppCatg.Items.Count; iItem++)
    //    {
    //        cblAppCatg.Items[iItem].Selected = bCheck;
    //    }
    //    if (bClearForm==false)
    //        txtHolidayDay.Text = dal.GetWeekDayName(Convert.ToDateTime(txtHolidayDate.Text));
    //}

==============================================================================================================
Master Upload form

////Removing the Blank Rows
//for (int iRow = dtSheetData.Rows.Count - 1; iRow >= 0; iRow--)
//{
//    if (string.IsNullOrEmpty(dtSheetData.Rows[iRow]["EmpCode"].ToString()))
//    {
//        dtSheetData.Rows.RemoveAt(iRow);
//    }
//}

//int userid = Convert.ToInt32(Session["UserId"].ToString());

form load declaration

//string[] fieldArray = { 
//                        "EmpCode-10", "Name-100", "FatherName-50", "Sex-10", "JoinDate-DT", "BirthDate-DT", "Address1-100",
//                        "Address2-100", "City-50", "State-50", "PinCode-15", "TelNo-20", "Mobile-20", "BloodGroup-5", "LocationCode-10",
//                        "Location-50","CompanyCode-10", "Company-100","DeptCode-10", "Department-100", "CategoryCode-10", "Category-30",
//                        "DesigCode-10","Designation-100","Grade-10","GradeCode-50","LeaveGroupCode-10", "LeaveGroup-50", "LeaveCode-2","ShiftType-1", "ShiftCode-2",
//                        "RotationCode-10", "AutoShiftRange-100", "WeekOff1-3","WeekOff2-3","HFWeekOff-3","LateFlag-1", "EarlyFlag-1",
//                        "OvertimeFlag-1", "CompOffFlag-1","AdjustOT-1","SinglePunch-1","ReportingTo-10", "Email","CardNo-10","HOD-10"
//                      };

==============================================================================================================

Year Leave Calculation
    public void CalculateYearLeave(object sender, System.EventArgs e) 
    {
        //Get the button that raised the event
        TextBox txt = (TextBox)sender;
        //Get the row that contains this button
        GridViewRow gvr = (GridViewRow)txt.NamingContainer;
        //Get rowindex
        int rowindex = gvr.RowIndex;

        float fAnnQuota, fCF, fOpBal, fCons, fEncash, fClBal;
        fAnnQuota = fCF = fOpBal = fCons = fEncash = fClBal = 0;

        //Credit[Annual Quota]
        TextBox txtCredit = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCredit");
        if (!string.IsNullOrEmpty(txtCredit.Text.Trim())) { fAnnQuota = float.Parse(txtCredit.Text); }

        //Carry forward
        TextBox txtCF = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCF");
        if (!string.IsNullOrEmpty(txtCF.Text.Trim())) { fCF = float.Parse(txtCF.Text); }
        
        if (Session["TranType"] .ToString().Equals("0"))
        {
            if (txt.ID == "tp_txtCredit" || txt.ID == "tp_txtCF")
            {
                if (!(string.IsNullOrEmpty(txtCF.Text.Trim()) || string.IsNullOrEmpty(txtCredit.Text.Trim())))
                {
                    fOpBal = fAnnQuota + fCF;
                    ((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal")).Text = fOpBal.ToString();
                }
            }

            if (txt.ID == "tp_txtOpBal" || txt.ID == "tp_txtCons" || txt.ID == "tp_txtEncash")
            {
                TextBox txtOpBal = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal");
                if (!string.IsNullOrEmpty(txtOpBal.Text.Trim()))
                {
                    fOpBal = float.Parse(txtOpBal.Text);
                }
                
                if (fOpBal > 0)
                {
                    TextBox txtCons = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCons");
                    if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                    {
                        fCons = float.Parse(txtCons.Text);
                    }
                    TextBox txtEncash = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtEncash");
                    if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                    {    fEncash = float.Parse(txtEncash.Text);   }
                    fClBal = (fOpBal - (fCons + fEncash));
                    ((Label)gvYLDetails.Rows[rowindex].FindControl("tp_lblClBal")).Text = fClBal.ToString();
                }
            }
        }

        if (Session["TranType"].ToString().Equals("1"))
        {
            DataTable dtYearLeave = Session["EmpYearLeave"] as DataTable;
            if (txt.ID == "tp_txtCredit" || txt.ID == "tp_txtCF")
            {
                Session["OpBal"] = dtYearLeave.Rows[rowindex]["Opening"].ToString();
                fOpBal = float.Parse(Session["OpBal"].ToString());
                if ((fAnnQuota + fCF) != fOpBal)
                {
                    dal.ClientFuncCallBack(upYearLeaveDtl, this.GetType(), "Alert", "alert('Changing the value may have affected the opening balance and closing balance')", true);
                }

                fOpBal = fAnnQuota + fCF;
                ((TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal")).Text = fOpBal.ToString();

                TextBox txtCons = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCons");
                if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                {
                    fCons = float.Parse(txtCons.Text);
                }
                TextBox txtEncash = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtEncash");
                if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                {
                    fEncash = float.Parse(txtEncash.Text);
                }
                fClBal = (fOpBal - (fCons + fEncash));
                ((Label)gvYLDetails.Rows[rowindex].FindControl("tp_lblClBal")).Text = fClBal.ToString();
            }

            if (txt.ID == "tp_txtOpBal" || txt.ID == "tp_txtCons" || txt.ID == "tp_txtEncash")
            {
                TextBox txtOpBal = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtOpBal");
                fOpBal = float.Parse(txtOpBal.Text);
                if (fOpBal > 0)
                {
                    TextBox txtCons = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtCons");
                    if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                    {
                        fCons = float.Parse(txtCons.Text);
                    }
                    TextBox txtEncash = (TextBox)gvYLDetails.Rows[rowindex].FindControl("tp_txtEncash");
                    if (!string.IsNullOrEmpty(txtCons.Text.Trim()))
                    {
                        fEncash = float.Parse(txtEncash.Text);
                    }
                    fClBal = (fOpBal - (fCons + fEncash));
                    ((Label)gvYLDetails.Rows[rowindex].FindControl("tp_lblClBal")).Text = fClBal.ToString();
                }
            }
        }

    }

==============================================================================================================

        var g_CurrentTextBox;
        Sys.Application.add_load(applicationLoadHandler);
        function applicationLoadHandler() {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
        }

        function endRequestHandler() {
            $get(g_CurrentTextBox).focus();
            $get(g_CurrentTextBox).select();
        }

        function onTextFocus() {
            g_CurrentTextBox = event.srcElement.id;
        }

    protected void gvYLDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((TextBox)e.Row.FindControl("tp_txtCredit")).Attributes.Add("onfocus", "onTextFocus();");
            ((TextBox)e.Row.FindControl("tp_txtCF")).Attributes.Add("onfocus", "onTextFocus();");
            ((TextBox)e.Row.FindControl("tp_txtOpBal")).Attributes.Add("onfocus", "onTextFocus();");
            ((TextBox)e.Row.FindControl("tp_txtCons")).Attributes.Add("onfocus", "onTextFocus();");
            ((TextBox)e.Row.FindControl("tp_txtEncash")).Attributes.Add("onfocus", "onTextFocus();");
        }
    }

==============================================================================================================


	<%--        function RadioCheck(rb) {

            var gv = document.getElementById("<%=gvYearLeave.ClientID%>");
            var rbs = gv.getElementsByTagName("input");

            var row = rb.parentNode.parentNode;
            for (var i = 0; i < rbs.length; i++) {
                if (rbs[i].type == "radio") {
                    if (rbs[i].checked && rbs[i] != rb) {
                        rbs[i].checked = false;
                        break;
                    }
                }
            }
        }--%>



		    protected Control GetControlThatCausedPostBack(Page page)
    {
        Control control = null;

        string ctrlname = page.Request.Params.Get("__EVENTTARGET");
        if (ctrlname != null && ctrlname != string.Empty)
        {
            control = page.FindControl(ctrlname);
        }
        else
        {
            foreach (string ctl in page.Request.Form)
            {
                Control c = page.FindControl(ctl);
                if (c is System.Web.UI.WebControls.Button || c is System.Web.UI.WebControls.ImageButton)
                {
                    control = c;
                    break;
                }
            }
        }

        return control;

    }  


//Code return on page load (if statement page.isPostBack)
            //WebControl wcICausedPostBack = (WebControl)GetControlThatCausedPostBack(sender as Page);
            //int indx = wcICausedPostBack.TabIndex + 1;
            //var ctrl = from control in wcICausedPostBack.Parent.Controls.OfType<WebControl>()
            //           where control.TabIndex > indx
            //           select control;
            //ctrl.DefaultIfEmpty(wcICausedPostBack).First().Focus();
            


	int GetColumnIndexByName(GridViewRow row, string sColumnName)
    {
        int iColumnIndex = 0;
        foreach (DataControlFieldCell cell in row.Cells)
        {
            iColumnIndex++;
        }
        return iColumnIndex;
    }

==============================================================================================================

//private void GenerateLogFile(StringBuilder sb)
    //{
    //    string sFilPath = Server.MapPath("~/UploadedFiles");
    //    string sFileName = "MISImportData_" + DateTime.Now.ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("hhmm") + ".txt";
    //    FileStream fs = null;
    //    string sFile = sFilPath + "/" + sFileName;
    //    if (!File.Exists(sFile))
    //    {
    //        fs = File.Create(sFile);
    //        TextWriter tw = new StreamWriter(sFile);
    //        tw.WriteLine(sb);
    //        tw.Close();

    //    }
//}

============================================================================================================== 

//case "Employee":
//    string sSubGroup = null;
//    if (!ddlOrder.SelectedValue.Equals("NA"))
//    {
//        sSubGroup = ddlOrder.SelectedItem.ToString();
//        if (sSubGroup != "Employee")
//            SORTSEL += ", EmpCode";
//    }
//    else
//    {
//        SORTSEL += ", EmpCode";
//    }
//    break;


//string sGroup = null;
//if (!ddlGroup.SelectedValue.Equals("NA"))
//{
//    sGroup = ddlGroup.SelectedItem.ToString();
//    if (sGroup != "Employee")
//        SORTSEL += ", EmpCode";
//}
//else

//{
//    SORTSEL += ", EmpCode";
//}
//break;

===================================================================================================

User Management
---------------

    <asp:TreeView ID="tvMenus" runat="server" ShowCheckBoxes="All" ShowLines="True" EnableViewState="true" OnTreeNodeCheckChanged="tvMenus_TreeNodeCheckChanged"  onclick="javascript:postBackByObject()">
    </asp:TreeView>
			
		//function postBackByObject()
		//{
		//    var o = window.event.srcElement;
		//    if (o.tagName == "INPUT" && o.type == "checkbox")
		//    {
		//        __doPostBack("","");
		//    } 
		//}

    protected void tvMenus_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
    {
        
        if (tvMenus.CheckedNodes.Count > 0)
        {
            if (e != null && e.Node != null)
            {
                if (e.Node.ChildNodes.Count>0)
                {
                    CheckTreeNodeRecursive(e.Node, e.Node.Checked);
                    upRights.Update();
                }
            }
        }
    }

	private void CheckTreeNodeRecursive(TreeNode parent, bool fCheck)
    {
        foreach (TreeNode child in parent.ChildNodes)
        {
            if (child.Checked != fCheck)
            {
                child.Checked = fCheck;
            }

            if (child.ChildNodes.Count > 0)
            {
                CheckTreeNodeRecursive(child, fCheck);
            }
        }
    }

	
<%--            $('#<%=rblUserType.ClientID%> input[type="checkbox"]').bind('click', function () {
    var usertype = $('#<%=rblUserType.ClientID%> input').val();
    alert(usertype);
    if (usertype == "EMP")
    {
        // Caching all the checkboxes into a variable
        var checkboxes = $('#<%=rblUserType.ClientID%> input[type="checkbox"]');
        // If one item is checked.. Uncheck all and
        // check current item..
        if ($(this).is(':checked')) {
            checkboxes.attr('checked', false);
            $(this).attr('checked', 'checked');
        }
    }
});--%>

===================================================================================================

        function SearchText(CtlId) {
            $(CtlId).autocomplete({
                minLength: 1,
                source: function (request, response) {
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: '<%= Page.ResolveUrl("WeekOffInterChange.aspx/GetAutoCompleteData")%>',
                        data: "{'sCode':'" + $(CtlId).val() + "'}",
                        dataType: "json",
                        success: function (data) {
                            response(data.d);
                        },
                        error: function (result) {
                            alert("Error");
                        }
                    });
                }
            });
        }

        
        function IsSelectionExist(txtEmp) {
            $("#UpdateProgress1").show();
            __doPostBack("txtEmp", "TextChanged");
        }

====================================================================================================

//var selectedIDs = from GridViewRow gvRow in gvYearLeave.Rows
//                  where ((CheckBox)gvRow.FindControl("tp_rbSelect")).Checked
//                  select (gvRow.RowIndex);

////convert  checkedIDs  to list
//string sEmpIds = String.Join(",", selectedIDs);
//iRowIndex = Convert.ToInt32(sEmpIds);

//Session["SelectedRowIndex"] = iRowIndex;

====================================================================================================
//int iRowIndex=0;
//var selectedIDs = from GridViewRow gvRow in gvYearLeave.Rows
//                 where ((CheckBox)gvRow.FindControl("tp_rbSelect")).Checked
//                 select (gvRow.RowIndex);

////convert  checkedIDs  to list
//string sEmpIds = String.Join(",", selectedIDs);
//iRowIndex = Convert.ToInt32(sEmpIds);

//Session["SelectedRowIndex"] = iRowIndex;
====================================================================================================
    //public bool IsSelected()
    //{
    //    bool bSelected = false;

    //    //int totalCount = gvYearLeave.Rows.Cast<GridViewRow>()
    //    //        .Count(r => ((RadioButton)r.FindControl("tp_rbSelect")).Checked);
    //    //if (totalCount > 0)
    //    //{
    //    //    bSelected = true;
    //    //    return bSelected;
    //    //}

    //    return bSelected;
    //}

====================================================================================================

    //protected void tp_rbSelect_CheckedChanged(object sender, EventArgs e)
    //{
    //    RadioButton rb = (RadioButton)sender;
    //    //get the row that contains this button
    //    GridViewRow gvr = (GridViewRow)rb.NamingContainer;
    //    mpe_btnDelete.Enabled = true;
    //    upMainPage.Update();
    //    Session["SelectedRowIndex"] = gvr.RowIndex;
    //}

====================================================================================================
<%--<asp:RadioButton runat="server" ID="tp_rbSelect" GroupName="rbYearLeave"  CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' onClick="javascript:check(this.id);if(this.value!=''){IsSelectionExist(this.value)};" AutoPostBack="false" OnCheckedChanged="tp_rbSelect_CheckedChanged" />--%>
<%--<asp:RadioButton runat="server" ID="tp_rbSelect" GroupName="rbYearLeave" onClick="javascript:check(this.id);"  />--%>
====================================================================================================
    //public void ExportGridview_Excel(string sFileName, GridView gvData, string sReportTitle)
    //{
    //    HttpContext.Current.Response.Clear();
    //    HttpContext.Current.Response.Buffer = true;
    //    HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + sFileName + ".xls");
    //    HttpContext.Current.Response.Charset = "";
    //    HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";

    //    gvData.Caption = sReportTitle;

    //    using (StringWriter sw = new StringWriter())
    //    {
    //        HtmlTextWriter hw = new HtmlTextWriter(sw);
    //        gvData.RenderControl(hw);

    //        HttpContext.Current.Response.Output.Write(sw.ToString());
    //        HttpContext.Current.Response.Flush();
    //        HttpContext.Current.Response.End();
    //    }

    //}

====================================================================================================

        //string SqlString2;
        //DataTable dtEmpPresent = new DataTable();
        //if (Session["UserType"].ToString() == "HOD")
        //{
        //    SqlString2 = "select COUNT( * )  as [Count] from employee where HODId =" + Session["EmpId"].ToString() + " and isnull(LeftDate,'')=''";
        //}
        //else
        //{
        //    SqlString2 = "select COUNT( * )  as [Count] from employee where ReptTo =" + Session["EmpId"].ToString() + " and isnull(LeftDate,'')=''";
        //}
        //try
        //{
        //    dtEmpPresent = dal.fnGetDataTable(SqlString2);
        //    lblInfo2.Text = dtEmpPresent.Rows[0]["Count"].ToString();
        //    //dtEmpPLeaves.Rows[0]["Count"].ToString();
        //    lblDesc2.Text = "Total Employees";
        //    lbtLink2.Text = "View Time Card";
        //}
        //catch
        //{
        //    dtEmpPresent = null;
        //    return;
        //}
====================================================================================================
    ///// <summary>
    ///// This function export the Yearly and Monthly Leave Card  data into the excel sheet.
    ///// </summary>
    ///// <param name="dtReport">Datatable object which contains the data to be exported</param>
    ///// <param name="sFromDate">From Date</param>
    ///// <param name="sToDate">To Date</param>
    ///// <param name="dtReport">Datatable object which contains the data to be exported</param>
    ///// <param name="sGroupCol">This parameter will print the report title in the exported excel report</param>
    ///// <param name="sSubGroupCol">This parameter will print the report title in the exported excel report</param>
    ///// <param name="DisplayColumns">All the fields in this array need to display in the report</param>
    ///// <param name="PrintColumns">All the fields in this array need to Print in the report with customized names.</param>
    //public void Export_YearlyMonthlyLeaveCard_Report(DataTable dtReport, string sFromDate, string sToDate, string sReportTitle, string sGroupCol, string sSubGroupCol, string[] DisplayColumns, string[] PrintColumns)
    //{
    //    using (ExcelPackage package = new ExcelPackage())
    //    {
    //        ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(sReportTitle);
    //        int iReportIndex = 0;
    //        worksheet.DefaultColWidth = 3;

    //        worksheet.Cells.Style.Font.Size = 8; //Default font size for whole sheet
    //        worksheet.Cells.Style.Font.Name = "Verdana";

    //        package.Workbook.Properties.Company = "Pidilite";
    //        package.Workbook.Properties.Author = "Pidilite";
    //        package.Workbook.Properties.Subject = "Report : " + sReportTitle;
    //        package.Workbook.Properties.Title = sReportTitle;

    //        worksheet.Cells["A1"].Value = "Monthly " + sReportTitle + " Report from : " + sFromDate + " : To : " + sToDate;
    //        worksheet.Cells[1, 1, 2, 1].Style.Font.Bold = true;
    //        worksheet.Cells[1, 1, 2, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;

    //        int iRow = 3;
    //        int iCol = 0;
    //        foreach (string val in PrintColumns)
    //        {
    //            worksheet.Cells[iRow, iCol + 1].Value = val;
    //            worksheet.Cells[iRow, iCol + 1].Style.Font.Bold = true;
    //            if (val.ToString().Equals("Sr.No"))
    //            {
    //                worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
    //            }
    //            iCol++;
    //        }

    //        DataTable dtHead = null;
    //        int iFilterIndex = 0;
    //        if (sGroupCol.Equals("Shift"))
    //        {
    //            sGroupCol = "ShiftCode";
    //        }
    //        if (sSubGroupCol.Equals("Shift"))
    //        {
    //            sSubGroupCol = "ShiftCode";
    //        }

    //        if (sGroupCol.Equals("Employee") && sSubGroupCol.Equals("Employee"))
    //        {
    //            dtHead = dtReport.DefaultView.ToTable(true, "Location", "Company");
    //            iFilterIndex = 1;
    //        }

    //        if (!sGroupCol.Equals("Employee") && sSubGroupCol.Equals("Employee"))
    //        {
    //            dtHead = dtReport.DefaultView.ToTable(true, "Location", "Company", sGroupCol);
    //            iFilterIndex = 2;
    //        }

    //        if (sGroupCol.Equals("Employee") && !sSubGroupCol.Equals("Employee"))
    //        {
    //            dtHead = dtReport.DefaultView.ToTable(true, "Location", "Company", sSubGroupCol);
    //            iFilterIndex = 3;
    //        }

    //        if (!sGroupCol.Equals("Employee") && !sSubGroupCol.Equals("Employee"))
    //        {
    //            dtHead = dtReport.DefaultView.ToTable(true, "Location", "Company", sGroupCol, sSubGroupCol);
    //            iFilterIndex = 4;
    //        }

    //        iRow += 1;
    //        int iRo;
    //        string sLoc, sComp, sPreLoc, sPreComp, sPreGroup;
    //        string sGroupVal = null, sSubGroupVal = null;
    //        int iTotalRecords = 0;
    //        for (iRo = 0; iRo <= dtHead.Rows.Count - 1; iRo++)
    //        {
    //            if (iRo == 0)
    //            {
    //                sLoc = dtHead.Rows[iRo]["Location"].ToString();
    //                worksheet.Cells["A" + iRow].Value = "Location : " + sLoc;
    //                worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Red);

    //                iRow += 1;
    //                sComp = dtHead.Rows[iRo]["Company"].ToString();
    //                worksheet.Cells["A" + iRow].Value = "Company : " + sComp;
    //                worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Green);

    //                if (iFilterIndex != 1)
    //                {
    //                    if (!sGroupCol.Equals("Employee"))
    //                    {
    //                        iRow += 1;
    //                        sGroupVal = dtHead.Rows[iRo][sGroupCol].ToString();
    //                        worksheet.Cells["A" + iRow].Value = sGroupCol + " : " + dtHead.Rows[iRo][sGroupCol].ToString();
    //                        worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                        worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Blue);
    //                    }
    //                }
    //            }
    //            else
    //            {
    //                sPreLoc = dtHead.Rows[iRo - 1]["Location"].ToString();
    //                sLoc = dtHead.Rows[iRo]["Location"].ToString();
    //                if (!sLoc.Equals(sPreLoc))
    //                {
    //                    iRow += 2;
    //                    worksheet.Cells["A" + iRow].Value = "Location : " + sLoc;
    //                    worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                    worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Red);
    //                }

    //                bool bNewComp = false;
    //                sPreComp = dtHead.Rows[iRo - 1]["Company"].ToString();
    //                sComp = dtHead.Rows[iRo]["Company"].ToString();
    //                if (!sComp.Equals(sPreComp))
    //                {
    //                    iRow += 1;
    //                    worksheet.Cells["A" + iRow].Value = "Company : " + sComp;
    //                    worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                    worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Green);
    //                    bNewComp = true;
    //                }

    //                if (iFilterIndex != 1)
    //                {
    //                    if (bNewComp)
    //                    {
    //                        if (!sGroupCol.Equals("Employee"))
    //                        {
    //                            iRow += 1;
    //                            sGroupVal = dtHead.Rows[iRo][sGroupCol].ToString();
    //                            worksheet.Cells["A" + iRow].Value = sGroupCol + " : " + dtHead.Rows[iRo][sGroupCol].ToString();
    //                            worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                            worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Blue);
    //                        }
    //                    }
    //                    else
    //                    {
    //                        if (!sGroupCol.Equals("Employee"))
    //                        {
    //                            sPreGroup = dtHead.Rows[iRo - 1][sGroupCol].ToString();
    //                            sGroupVal = dtHead.Rows[iRo][sGroupCol].ToString();
    //                            if (!sGroupVal.Equals(sPreGroup))
    //                            {
    //                                iRow += 1;
    //                                worksheet.Cells["A" + iRow].Value = sGroupCol + " : " + dtHead.Rows[iRo][sGroupCol].ToString();
    //                                worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                                worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Blue);
    //                            }
    //                        }
    //                    }
    //                }
    //            }

    //            iRow += 1;
    //            DataView dv = new DataView(dtReport);
    //            switch (iFilterIndex)
    //            {
    //                case 1:
    //                    //Employee condition will be applied here
    //                    dv.RowFilter = "Location='" + sLoc.Replace("'", "''") + "' AND Company='" + sComp.Replace("'", "''") + "'";
    //                    break;

    //                case 2:
    //                    dv.RowFilter = "Location='" + sLoc.Replace("'", "''") + "' AND Company='" + sComp.Replace("'", "''") + "' AND " + sGroupCol + "='" + sGroupVal.Replace("'", "''") + "'";
    //                    break;
    //                case 3:
    //                    if (!sSubGroupCol.Equals("Employee"))
    //                    {
    //                        sSubGroupVal = dtHead.Rows[iRo][sSubGroupCol].ToString();
    //                        worksheet.Cells["A" + iRow].Value = sSubGroupCol + " : " + dtHead.Rows[iRo][sSubGroupCol].ToString();
    //                        worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                        worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Maroon);
    //                        dv.RowFilter = "Location='" + sLoc.Replace("'", "''") + "' AND Company='" + sComp.Replace("'", "''") + "' AND " + sSubGroupCol + "='" + sSubGroupVal.Replace("'", "''") + "'";
    //                    }
    //                    break;
    //                case 4:
    //                    sSubGroupVal = dtHead.Rows[iRo][sSubGroupCol].ToString();
    //                    worksheet.Cells["A" + iRow].Value = sSubGroupCol + " : " + dtHead.Rows[iRo][sSubGroupCol].ToString();
    //                    worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //                    worksheet.Cells["A" + iRow].Style.Font.Color.SetColor(Color.Maroon);
    //                    dv.RowFilter = "Location='" + sLoc.Replace("'", "''") + "' AND Company='" + sComp.Replace("'", "''") + "' AND " + sGroupCol + "='" + sGroupVal.Replace("'", "''") + "' AND " + sSubGroupCol + "='" + sSubGroupVal.Replace("'", "''") + "'";
    //                    break;
    //            }

    //            if (dv.Count > 0)
    //            {

    //                DataTable dtResult = new DataTable();
    //                dv.Sort = "EmpCode";
    //                dtResult = dv.ToTable(false, DisplayColumns);

    //                //Rows - Writting Data
    //                if (iReportIndex == 1 || iReportIndex == 2 || iReportIndex == 4)
    //                {
    //                    string sEmpCode = "";
    //                    int iStartColIndex = 3;
    //                    int iEndColIndex = dtResult.Columns["PRESENT"].Ordinal;
    //                    int iSrNo = 1;
    //                    foreach (DataRow dtRow in dtResult.Rows)
    //                    {
    //                        if (!sEmpCode.Equals(dtRow["EmpCode"].ToString()))
    //                        {
    //                            iRow += 1;
    //                            iCol = 1;
    //                            foreach (DataColumn dtCol in dtResult.Columns)
    //                            {
    //                                if (dtCol.ColumnName == "SrNo")
    //                                {
    //                                    worksheet.Cells[iRow, iCol].Value = iSrNo;
    //                                    worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
    //                                    iSrNo++;
    //                                    iTotalRecords++;
    //                                    iCol++;
    //                                }
    //                                else
    //                                {
    //                                    worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
    //                                    iCol++;
    //                                }
    //                            }
    //                        }
    //                        else
    //                        {
    //                            iCol = 4;
    //                            iRow += 1;
    //                            foreach (DataColumn dtCol in dtResult.Columns)
    //                            {
    //                                if (dtCol.Ordinal >= iStartColIndex && dtCol.Ordinal < iEndColIndex)
    //                                {
    //                                    worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
    //                                    iCol++;
    //                                }
    //                            }
    //                        }
    //                        sEmpCode = dtRow["EmpCode"].ToString();
    //                    }
    //                }
    //                else
    //                {
    //                    int iSrNo = 1;
    //                    foreach (DataRow dtRow in dtResult.Rows)
    //                    {
    //                        iRow += 1;
    //                        iCol = 1;
    //                        foreach (DataColumn dtCol in dtResult.Columns)
    //                        {
    //                            if (dtCol.ColumnName == "SrNo")
    //                            {
    //                                worksheet.Cells[iRow, iCol].Value = iSrNo;
    //                                worksheet.Cells[iRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
    //                                iSrNo++;
    //                                iTotalRecords++;
    //                                iCol++;
    //                            }
    //                            else
    //                            {
    //                                worksheet.Cells[iRow, iCol].Value = dtRow[dtCol].ToString();
    //                                iCol++;
    //                            }
    //                        }
    //                    }
    //                }
    //            }
    //        }

    //        iRow += 2;
    //        worksheet.Cells["A" + iRow].Value = "Total Records : " + iTotalRecords;
    //        worksheet.Cells["A" + iRow].Style.Font.Bold = true;
    //        worksheet.Cells["A" + iRow].Style.Font.Size = 12;
    //        worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();

    //        worksheet.Column(1).Width = 10;

    //        worksheet.View.FreezePanes(4, 1);

    //        //Write it back to the client
    //        HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    //        HttpContext.Current.Response.AddHeader("content-disposition", "attachment;  filename=" + sReportTitle + ".xlsx");
    //        HttpContext.Current.Response.BinaryWrite(package.GetAsByteArray());
    //        HttpContext.Current.Response.End();

    //    }
    //}

====================================================================================================


//    DataRow dtRow = dtODEntryDetails.NewRow();
//    dtRow["ODNo"] = iSrNo;
//    dtRow["StartTime"] = StartTime;
//    dtRow["EndTime"] = EndTime;
//    dtRow["Party_Place"] = Party;
//    dtRow["ContactPerson"] = Person;
//    dtRow["RecType"] = "New";
//    dtODEntryDetails.Rows.Add(dtRow);

//    dtODEntryDetails.DefaultView.Sort = "ODNo";
//    Session["dtODEntryDetails"] = dtODEntryDetails.DefaultView.ToTable();
//    gvODDetails.DataSource = dtODEntryDetails.DefaultView;
//    gvODDetails.DataBind();

//    cleardetails();

//if (dtODEntryDetails.Rows.Count > 0)
//{
//    bool bFound = false;
//    iSrNo = Convert.ToInt32(dtODEntryDetails.Compute("max(ODNo)", string.Empty)) + 1;
//    for (int iItem = 0; iItem < dtODEntryDetails.Rows.Count; iItem++)
//    {
//        if (dtODEntryDetails.Rows[iItem]["ODNo"].ToString() == iSrNo.ToString())
//            bFound = true;
//    }
//    if (bFound == false)
//    {
//        DataRow dtRow = dtODEntryDetails.NewRow();
//        dtRow["ODNo"] = iSrNo;
//        dtRow["StartTime"] = StartTime;
//        dtRow["EndTime"] = EndTime;
//        dtRow["Party_Place"] = Party;
//        dtRow["ContactPerson"] = Person;
//        dtRow["RecType"] = "New";
//        dtODEntryDetails.Rows.Add(dtRow);

//        dtODEntryDetails.DefaultView.Sort = "ODNo";
//        Session["dtODEntryDetails"] = dtODEntryDetails.DefaultView.ToTable();
//        gvODDetails.DataSource = dtODEntryDetails.DefaultView;
//        gvODDetails.DataBind();

//        cleardetails();

//    }
//    else
//    {
//        lblMsg.Text = "Meeting already added for the given time.";
//        upODApp.Update();
//    }
//}
//else
//{
//    DataRow dtRow = dtODEntryDetails.NewRow();
//    dtRow["ODNo"] = iSrNo;
//    dtRow["StartTime"] = StartTime;
//    dtRow["EndTime"] = EndTime;
//    dtRow["Party_Place"] = Party;
//    dtRow["ContactPerson"] = Person;
//    dtRow["RecType"] = "New";
//    dtODEntryDetails.Rows.Add(dtRow);

//    dtODEntryDetails.DefaultView.Sort = "ODNo";
//    Session["dtODEntryDetails"] = dtODEntryDetails.DefaultView.ToTable();
//    gvODDetails.DataSource = dtODEntryDetails.DefaultView;
//    gvODDetails.DataBind();

//    cleardetails();

//}

====================================================================================================
        //if (e.CommandName == "Select")
        //{
        //    Label lblFromDate = (Label)row.FindControl("tp_lblFromDate");
        //    Label lblToDate = (Label)row.FindControl("tp_lblToDate");
        //    Label lblReason = (Label)row.FindControl("tp_lblReason");

        //    if (sODType.ToString()=="TOUR")
        //    {
        //        txtFromDate.Text = Convert.ToDateTime(lblFromDate.Text).ToString("dd-MMM-yyyy");
        //        txtToDate.Text = Convert.ToDateTime(lblToDate.Text).ToString("dd-MMM-yyyy");
        //        txtReason.Text = lblReason.Text;
        //    }

        //    if (sODType.ToString() == "TIME")
        //    {
        //        txtTFromDate.Text = Convert.ToDateTime(lblFromDate.Text).ToString("dd-MMM-yyyy");
        //        txtReason.Text = lblReason.Text;
        //        dtODEntryDetails = Session["dtODEntryDetails"] as DataTable;
        //        string SQLString = "SELECT 'Old' AS RecType,ISNULL(ODNo,0) AS ODNo,StartTime,EndTime,Place_First AS Party_Place, Contact_First AS ContactPerson FROM ODENTRY_TIME WHERE ODENTRY=" + Convert.ToInt32(ODEntryId.Text) + " Order By EntryID";
        //        dtODEntryDetails = dal.fnGetDataTable(SQLString);
        //        if (dtODEntryDetails.Rows.Count > 0)
        //        {
        //            int iCheckFirst = Convert.ToInt32(dtODEntryDetails.Rows[0]["ODNo"].ToString());
        //            if (iCheckFirst == 0)
        //            {
        //                for (int iRow = 0; iRow < dtODEntryDetails.Rows.Count; iRow++)
        //                {
        //                    dtODEntryDetails.Rows[iRow]["OdNo"] = iRow + 1;
        //                }
        //            }
        //            Session["dtODEntryDetails"] = dtODEntryDetails;
        //            gvODDetails.DataSource = dtODEntryDetails;
        //            gvODDetails.DataBind();
        //            upGridData.Update();
        //            upODApp.Update();
        //            Session["Status"] = ((Label)row.FindControl("tp_lblReason")).Text;
        //        }
        //    }
        //}

====================================================================================================
//StreamReader reader;
//if (sODType.ToUpper() == "DATE")
//{
//    reader = new StreamReader(Server.MapPath("Masters/ODTourApproval.html"));
//}
//else
//{
//    if (sOdEntry.Length == 1)
//        reader = new StreamReader(Server.MapPath("Masters/ODLocalApproval.html"));
//    else
//        reader = new StreamReader(Server.MapPath("Masters/ODLocalApproval1.html"));
//}

//string readFile = reader.ReadToEnd();
//string StrContent = "";
//StrContent = readFile;

////Here replace the name with [MyName]
//if (RecommendPrefix == "NA")
//    RecommendPrefix = "";

//StrContent = StrContent.Replace("@PREFIX", RecommendPrefix);
//StrContent = StrContent.Replace("@MGRNAME", RecommendName);
//StrContent = StrContent.Replace("@EMPCODE", EmpCode);
//StrContent = StrContent.Replace("@EMPNAME", EmpName);
//StrContent = StrContent.Replace("@LEAVECODE", LeaveCode);
//StrContent = StrContent.Replace("@FROMDATE", FromDate);
//StrContent = StrContent.Replace("@TODATE", ToDate);
//StrContent = StrContent.Replace("@DAYS", Days);
//StrContent = StrContent.Replace("@REASON", Reason);

//if (sODType.ToUpper() == "TIME")
//{
//    int iRowIndex = 1;
//    foreach (DataRow dtRow in dtODEntryParam.Rows)
//    {
//        if (sOdEntry.Length == 1)
//        {
//            StrContent = StrContent.Replace("@MEETING", Meeting[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@STARTTIME", StartTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@ENDTIME", EndTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@MEETING_PLACE", Party_Place[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@MEETING_PERSON", ContactPerson[iRowIndex - 1]);
//        }
//        else
//        {
//            StrContent = StrContent.Replace(("@MEETING" + iRowIndex), Meeting[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@STARTTIME" + iRowIndex), StartTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@ENDTIME" + iRowIndex), EndTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@MEETING_PLACE" + iRowIndex), Party_Place[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@MEETING_PERSON" + iRowIndex), ContactPerson[iRowIndex - 1]);
//        }
//        iRowIndex++;
//    }
//}

//string link, MailSubject;
//if (sODType.ToUpper() == "DATE")
//{
//    link = "You can view Out Station Tour Approval in LAMS</a>";
//    MailSubject = "Tour OD Application Request";
//}
//else
//{
//    link = "You can view Local OD Approval in LAMS</a>";
//    MailSubject = "Local OD Application Request";
//}

//StrContent = StrContent.Replace("@urlLink", link);

//string BodyMessage = StrContent;

//if (!string.IsNullOrEmpty(RecommendMail))
//    dal.AutoEMail(RecommendMail, MailSubject, BodyMessage);

====================================================================================================
//StreamReader reader;
//if (sODType.ToUpper() == "DATE")
//{
//    reader = new StreamReader(Server.MapPath("Masters/ODTourApproval.html"));
//}
//else
//{
//    if (sOdEntry.Length == 1)
//        reader = new StreamReader(Server.MapPath("Masters/ODLocalApproval.html"));
//    else
//        reader = new StreamReader(Server.MapPath("Masters/ODLocalApproval1.html"));
//}

//string readFile = reader.ReadToEnd();
//string StrContent = "";
//StrContent = readFile;

////Here replace the name with [MyName]
//if (HODPrefix == "NA")
//    HODPrefix = "";

//StrContent = StrContent.Replace("@PREFIX", HODPrefix);
//StrContent = StrContent.Replace("@MGRNAME", HODName);
//StrContent = StrContent.Replace("@EMPCODE", EmpCode);
//StrContent = StrContent.Replace("@EMPNAME", EmpName);
//StrContent = StrContent.Replace("@LEAVECODE", LeaveCode);
//StrContent = StrContent.Replace("@FROMDATE", FromDate);
//StrContent = StrContent.Replace("@TODATE", ToDate);
//StrContent = StrContent.Replace("@DAYS", Days);
//StrContent = StrContent.Replace("@REASON", Reason);

//if (sODType.ToUpper() == "TIME")
//{
//    int iRowIndex = 1;
//    foreach (DataRow dtRow in dtODEntryParam.Rows)
//    {
//        if (sOdEntry.Length == 1)
//        {
//            StrContent = StrContent.Replace("@MEETING", Meeting[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@STARTTIME", StartTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@ENDTIME", EndTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@MEETING_PLACE", Party_Place[iRowIndex - 1]);
//            StrContent = StrContent.Replace("@MEETING_PERSON", ContactPerson[iRowIndex - 1]);
//        }
//        else
//        {
//            StrContent = StrContent.Replace(("@MEETING" + iRowIndex), Meeting[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@STARTTIME" + iRowIndex), StartTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@ENDTIME" + iRowIndex), EndTime[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@MEETING_PLACE" + iRowIndex), Party_Place[iRowIndex - 1]);
//            StrContent = StrContent.Replace(("@MEETING_PERSON" + iRowIndex), ContactPerson[iRowIndex - 1]);
//        }
//        iRowIndex++;
//    }
//}

//string link, MailSubject;
//if (sODType.ToUpper() == "DATE")
//{
//    link = "You can view Out Station Tour Approval in LAMS</a>";
//    MailSubject = "Tour OD Application Request";
//}
//else
//{
//    link = "You can view Local OD Approval in LAMS</a>";
//    MailSubject = "Local OD Application Request";
//}

//StrContent = StrContent.Replace("@urlLink", link);

//string BodyMessage = StrContent;

//if (!string.IsNullOrEmpty(HODMail))
//    dal.AutoEMail(HODMail, MailSubject, BodyMessage);

====================================================================================================
//                                        DataTable dtODEntryParam;
//                                        //String SqlString3 = "SELECT L.LEAVECODE,LE.FromDate ,LE.ToDate,LE.[Days] ,LE.[Status]  FROM LEAVEENTRY LE inner join employee  E on E.Empid =LE.EmpId inner join Leave L on LE.LeaveId=L.Leaveid    WHERE LE.LeaveEntryId =" + LeaveEntryId + " ";
//                                        if (sODType == "DATE")
//                                            SQLString = "SELECT '" + lblODType.Text + "' AS LEAVECODE, CONVERT(CHAR(12),O.Fromdate,106) AS FromDate, CONVERT(CHAR(12),O.ToDate,106) AS ToDate, O.[Days], O.[Status], O.ODReason FROM ODEntry O INNER JOIN employee E ON E.Empid=O.EmpId WHERE O.ODEntry=" + ODEntryId + " ";
//                                        else
//                                            SQLString = @"SELECT  '" + lblODType.Text + @"' AS LEAVECODE,
//                                        CONVERT(CHAR(12),O.Fromdate,106) AS FromDate,
//                                        CONVERT(CHAR(12),O.ToDate,106) AS ToDate, O.[Days], T.[Status],
//                                        T.StartTime, T.EndTime, T.Contact_First AS ContactPerson, 
//                                        T.Place_First AS Party_Place, O.ODReason, T.ODNo AS Meeting
//                                        FROM ODEntry O INNER JOIN ODEntry_Time T ON O.ODEntry=T.ODEntry
//                                        INNER JOIN employee E ON E.Empid=O.EmpId 
//                                        WHERE O.ODEntry='" + ODEntryId + "' AND T.EntryID='" + TimeEntryId + "'";

//                                        dtODEntryParam = dal.fnGetDataTable(SqlString3);

//string LeaveCode, FromDate, ToDate, Days, Reason, Status, StartTime, EndTime, ContactPerson, Party_Place, Meeting;
//StartTime = EndTime = ContactPerson = Party_Place = Meeting = "";

//LeaveCode = dtODEntryParam.Rows[0]["LeaveCode"].ToString();
//FromDate = dtODEntryParam.Rows[0]["FromDate"].ToString();
//ToDate = dtODEntryParam.Rows[0]["ToDate"].ToString();
//Days = dtODEntryParam.Rows[0]["Days"].ToString();
//Status = dtODEntryParam.Rows[0]["Status"].ToString();
//Reason = dtODEntryParam.Rows[0]["ODReason"].ToString();

//if (sODType.ToUpper() == "TIME")
//{
//    Meeting = dtODEntryParam.Rows[0]["Meeting"].ToString();
//    StartTime = dtODEntryParam.Rows[0]["StartTime"].ToString();
//    EndTime = dtODEntryParam.Rows[0]["EndTime"].ToString();
//    ContactPerson = dtODEntryParam.Rows[0]["ContactPerson"].ToString();
//    Party_Place = dtODEntryParam.Rows[0]["Party_Place"].ToString();
//}

//if (Status.ToUpper() == "S")
//    Status = "Approved";

//DataTable dtEmp;
//String Sqlstring4 = "Select Prefix, Name,EMail from employee where Empid  =" + OD_EmpId + "";
//dtEmp = dal.fnGetDataTable(Sqlstring4);
//string EmpPrefix = dtEmp.Rows[0]["Prefix"].ToString();
//string EmpName = dtEmp.Rows[0]["Name"].ToString();
//string EmpMail = dtEmp.Rows[0]["Email"].ToString();

//StreamReader reader;
//if (sODType.ToUpper() == "DATE")
//    reader = new StreamReader(Server.MapPath("Masters/EmpTourSanctionMail.html"));
//else
//    reader = new StreamReader(Server.MapPath("Masters/EmpODSanctionMail.html"));

//string readFile = reader.ReadToEnd();
//string StrContent = "";
//StrContent = readFile;

////Here replace the name with [MyName]
//if (EmpPrefix == "NA")
//    EmpPrefix = "";
//StrContent = StrContent.Replace("@PREFIX", EmpPrefix);
//StrContent = StrContent.Replace("@EMPCODE", EmpCode);
//StrContent = StrContent.Replace("@EMPNAME", EmpName);
//StrContent = StrContent.Replace("@LEAVECODE", LeaveCode);
//StrContent = StrContent.Replace("@FROMDATE", FromDate);
//StrContent = StrContent.Replace("@TODATE", ToDate);
//StrContent = StrContent.Replace("@DAYS", Days);
//StrContent = StrContent.Replace("@STATUS", Status);
//StrContent = StrContent.Replace("@REASON", Reason);

//if (sODType.ToUpper() == "TIME")
//{
//    StrContent = StrContent.Replace("@MEETING", Meeting);
//    StrContent = StrContent.Replace("@STARTTIME", StartTime);
//    StrContent = StrContent.Replace("@ENDTIME", EndTime);
//    StrContent = StrContent.Replace("@MEETING_PLACE", Party_Place);
//    StrContent = StrContent.Replace("@MEETING_PERSON", ContactPerson);
//}

//string BodyMessage = StrContent;
//string sSubject;
//if (sODType.ToUpper() == "TIME")
//    sSubject = "OD Application Approved";
//else
//    sSubject = "Out Station Tour Application Approved";

//if (!string.IsNullOrEmpty(EmpMail))
//    dal.AutoEMail(EmpMail, sSubject, BodyMessage);

====================================================================================================
====================================================================================================

