using System;
using System.Collections;
using System.Data;
using System.Globalization;
using System.IO;
using System.Resources;
using System.Threading;
using System.Web.UI;
using System.Web.UI.WebControls;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                              Started Date  : 12-Aug-2007
* Module          : Employee Master                                        Last Modified : 27-Aug-2007
* Programmer      : Arun Vinoth.T
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          : \\Windev\EIT\Projects\Inprogress\SCREEN1206\code\TimecheckAVBackup
****************************************************************************************************************************/
public partial class Masters_TA_UI_Master_EmployeeView : Base.BasePage
{
    # region "variable declaration"
    ResourceManager rm;
    CultureInfo ci;
    EmployeeEventData objEmployee = new EmployeeEventData();
    PayrollConfigurationEventData objPayrollData = new PayrollConfigurationEventData();
    Cls_CheckUser objCheckUser = new Cls_CheckUser();
    DataSet ds_Checkuser = new DataSet();
    cls_Common objClassCommon = new cls_Common();
    Table tbLeaveType = new Table();
    DataSet dsLoadLeavetypes = new DataSet();
    AttandanceCodeEventData objAttCode = new AttandanceCodeEventData();
    int payrollConfig = 0, intEmpid, EmployeeID = 0;
    string gstrDateFormat, strGender = "", strMstatus = "", gstrUserGroupName = string.Empty;
    bool blOTeligible, blOutdoorEmployee, blPF, blCOffeligible, blActiveness, blHostelWorker, blESI, blExRep;
    DropDownList ddPFESI = new DropDownList();
    DropDownList ddTaxPOlicy = new DropDownList();
    DropDownList ddlContractor = new DropDownList();
    DropDownList ddCA = new DropDownList();
    #endregion
    #region PageLoad
    protected override void Page_Load(object sender, EventArgs e)
    {
        Session["ModeToDisplay"] = "1";
        base.Page_Load(sender, e);
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        EmployeeID = Convert.ToInt32(Session["EmpAutoID"]);
        intEmpid = Convert.ToInt32(Request.QueryString["Emp_Id"]);
        gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
        int otApprovalExists = 0;
        int leaveSanctionExists = 0;
        int manualEntryExists = 0;
        if (!Page.IsPostBack)
        {
            btn_Official_blur.Focus();
            btn_Official_blur.Style.Add("outline", "none");
            btn_Delete.Attributes.Add("onclick", "return confirm('" + rm.GetString("Alert_ConfirmDelete", ci) + "')");
            btn_Delete1.Attributes.Add("onclick", "return confirm('" + rm.GetString("Alert_ConfirmDelete", ci) + "')");
            btn_Delete2.Attributes.Add("onclick", "return confirm('" + rm.GetString("Alert_ConfirmDelete", ci) + "')");
            btn_Delete3.Attributes.Add("onclick", "return confirm('" + rm.GetString("Alert_ConfirmDelete", ci) + "')");
            LoadStrings(ci);
            BindCustomizableFieldName();
            loadcss();
            UserRights();

            GetPFESIPolicy();
            fillConveyanceAllowvance();
            fillTaxPolicy();
            fillContractor();
            objClassCommon.menu("EmployeeMaster", "18");
            GetEmpDetailsbyID(intEmpid);
            Page.RegisterStartupScript("divshow", "<script>div_show();</script>");
            Page.RegisterStartupScript("upload", "<script>ajaxfunctionView(" + intEmpid + ");</script>");
            Page.RegisterStartupScript("spouse", "<script>ajaxfunctionView_spouse(" + intEmpid + ");</script>");
            Page.RegisterStartupScript("Employee_LeavePolicy", "<script>ajaxLeavePolicyView(" + intEmpid + ",'" + rm.GetString("Alert_NoDetailsfoundinEmpLeavePolicyView", ci) + "','" + rm.GetString("Alert_Errorinretrivingdetails", ci) + "');</script>");
            btn_RestoreP.OnClientClick = "return confirm('" + rm.GetString("Alert_Areyousuretorestore", ci) + "')";
            btn_PermanentDelete.OnClientClick = btn_PermanentDeleteLP.OnClientClick = btn_PermanentDeleteOf.OnClientClick = btn_PermanentDeleteP.OnClientClick = "return confirm('" + rm.GetString("Alert_AreyouwantDeleteRecordPermanently", ci) + "')";
            btn_Restore.OnClientClick = btn_RestoreLP.OnClientClick = btn_RestoreOf.OnClientClick = "return confirm('" + rm.GetString("Alert_Areyousuretorestore", ci) + "')";
            int mapCount = objEmployee.CountEmployee(intEmpid);
            if (mapCount > 0)
            {
                btn_RestoreP.Enabled = false;
                btn_RestoreOf.Enabled = false;
                btn_RestoreLP.Enabled = false;
                btn_Restore.Enabled = false;
                btn_PermanentDeleteP.Enabled = false;
                btn_PermanentDeleteOf.Enabled = false;
                btn_PermanentDeleteLP.Enabled = false;
                btn_PermanentDelete.Enabled = false;
                btn_Delete.Enabled = false;
                btn_Delete1.Enabled = false;
                btn_Delete2.Enabled = false;
                btn_Delete3.Enabled = false;
            }
            gstrUserGroupName = Convert.ToString(Session["UserGroupName"]);
            if (gstrUserGroupName != "SuperAdmin")
            {
                btn_RestoreP.Visible = false;
                btn_RestoreOf.Visible = false;
                btn_RestoreLP.Visible = false;
                btn_Restore.Visible = false;
                btn_PermanentDeleteP.Visible = false;
                btn_PermanentDeleteOf.Visible = false;
                btn_PermanentDeleteLP.Visible = false;
                btn_PermanentDelete.Visible = false;
            }
            if (Session["Demo"] != null && Convert.ToString(Session["Demo"]) != "Express" && Convert.ToString(Session["Demo"]) != "Standard")
                LoadLeaveTypes();
            otApprovalExists = objClassCommon.CheckPageExistsInLicense(97);
            leaveSanctionExists = objClassCommon.CheckPageExistsInLicense(248);
            manualEntryExists = objClassCommon.CheckPageExistsInLicense(98);
            if (otApprovalExists == 0 && leaveSanctionExists == 0 && manualEntryExists == 0)
                trStatus.Style.Add("display", "none");
            /*Added New parameter(Max Days/Month)for Angler. For this we are checking whether the payroll configuration page is exists or not*/
            payrollConfig = objClassCommon.CheckPageExistsInLicense(185);
            /*Below parameter is used for Angler*/
            if (payrollConfig == 0)
            {
                divlblEntrance.Style.Add("display", "none");
                divddlEntrance.Style.Add("display", "none");
            }

        }
    }

    private void fillTaxPolicy()
    {
        DataSet ds_taxPolicy = new DataSet();
        Hashtable htaxpolicy = new Hashtable();
        htaxpolicy.Add("@tag", "SL");
        ds_taxPolicy = objPayrollData.InsertTaxPolicy(htaxpolicy);
        if (ds_taxPolicy != null)
        {
            if (ds_taxPolicy.Tables[0].Rows.Count > 0)
            {
                ddTaxPOlicy.DataSource = ds_taxPolicy;
                ddTaxPOlicy.DataValueField = "TaxPolicy_Id";
                ddTaxPOlicy.DataTextField = "TaxPolicyName";
                ddTaxPOlicy.DataBind();
            }
            ds_taxPolicy.Dispose();
        }
    }
    #region load Contractor Details
    private void fillContractor()
    {
        DataSet dsContractor = new DataSet();
        dsContractor = objEmployee.LoadInContractor();
        if (dsContractor != null && dsContractor.Tables.Count > 0 && dsContractor.Tables[0].Rows.Count > 0)
        {
            ddlContractor.DataSource = dsContractor;
            ddlContractor.DataTextField = "ContractorName";
            ddlContractor.DataValueField = "ID";
            ddlContractor.DataBind();
        }
        ddlContractor.Items.Insert(0, new ListItem("-Select-", "0"));
        dsContractor.Dispose();
    }
    #endregion
    private void fillConveyanceAllowvance()
    {
        DataSet ds_CA = new DataSet();
        if (ViewState["CA_Policy"] != null)
        {
            ds_CA = (DataSet)ViewState["CA_Policy"];
        }
        else
        {
            Hashtable h_CA = new Hashtable();
            h_CA.Add("@tag", "S");

            ds_CA = objPayrollData.InsertandupdateConveyancePolicyDetails(h_CA);
            ViewState["CA_Policy"] = ds_CA;
        }

        if (ds_CA != null)
        {
            if (ds_CA.Tables[0].Rows.Count > 0)
            {
                ddCA.DataSource = ds_CA;
                ddCA.DataTextField = "ConPolicyName";
                ddCA.DataValueField = "C_Id";
                ddCA.DataBind();
            }
            ds_CA.Dispose();
        }
        foreach (ListItem item in ddCA.Items)
        {
            item.Attributes.Add("title", item.Text);
        }
    }

    private void GetPFESIPolicy()
    {
        DataSet ds_PFESI = new DataSet();
        if (ViewState["PF_ESI_Policy"] != null)
        {
            ds_PFESI = (DataSet)ViewState["PF_ESI_Policy"];
        }
        else
        {
            Hashtable h_PFESI = new Hashtable();
            h_PFESI.Add("@tag", "S");

            ds_PFESI = objPayrollData.InsertPFESIPolicyDetails(h_PFESI);
            ViewState["PF_ESI_Policy"] = ds_PFESI;
        }

        if (ds_PFESI != null)
        {
            if (ds_PFESI.Tables[0].Rows.Count > 0)
            {
                ddPFESI.DataSource = ds_PFESI;
                ddPFESI.DataTextField = "PFESI_PolicyName";
                ddPFESI.DataValueField = "PFESI_Id";
                ddPFESI.DataBind();
            }
            ds_PFESI.Dispose();
        }
        foreach (ListItem item in ddPFESI.Items)
        {
            item.Attributes.Add("title", item.Text);
        }
    }
    #endregion
    #region"User Defined Function"
    /// <summary>
    /// Get Customizable field name form attendance code screen
    /// Based on the creation there, the label name will be displayed here for display.
    /// </summary>
    private void BindCustomizableFieldName()
    {
        DataSet ds = new DataSet();
        ds = objAttCode.SelectAllAttandance(0, "All", Convert.ToString(Session["UserGroupName"]), "", 0);
        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                ds.Tables[0].DefaultView.RowFilter = "AttandanceValue in('Customizable Field1','Customizable Field2','Customizable Field3','Customizable Field4','Customizable Field5','Customizable Field6')";
                DataTable dt = ds.Tables[0].DefaultView.ToTable();
                if (dt.Rows.Count > 0)
                {
                    string customFields = "";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        customFields = Convert.ToString(dt.Rows[i]["AttandanceValue"]);
                        switch (customFields)
                        {
                            case "Customizable Field1":
                                lblCustomField1.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                            case "Customizable Field2":
                                lblCustomField2.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                            case "Customizable Field3":
                                lblCustomField3.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                            case "Customizable Field4":
                                lblCustomField4.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                            case "Customizable Field5":
                                lblCustomField5.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                            case "Customizable Field6":
                                lblCustomField6.Text = Convert.ToString(dt.Rows[i]["AttandanceCode"]);
                                break;
                        }
                    }
                }
            }
        }
        else
        {
            //lblCustomField1.Text = rm.GetString("Employee_CustomField1", ci);
            //lblCustomField2.Text = rm.GetString("Employee_CustomField2", ci);
            //lblCustomField3.Text = rm.GetString("Employee_CustomField3", ci);
            //lblCustomField4.Text = rm.GetString("Employee_CustomField4", ci);
            //lblCustomField5.Text = rm.GetString("Employee_CustomField5", ci);
        }
    }
    /// <summary>
    /// LoadLeaveType Functions for loading leave types 
    /// </summary>
    private void LoadLeaveTypes()
    {
        try
        {
            string LeaveTypeHeader = rm.GetString("lbl_leavetype", ci);
            string PreviouYearHeader = rm.GetString("Master_Employee_PreviousYearBalance", ci);
            string LeaveTakenHeader = rm.GetString("Master_Employee_NoOffLeaveTaken", ci);
            string LeaveTakenToolTip = rm.GetString("Master_Employee_NoOffLeaveTaken_ToolTip", ci);
            int YearSettingsId = 0;
            if (Session["YearSettingsId"] != null)
                YearSettingsId = Convert.ToInt32(Session["YearSettingsId"]);
            dsLoadLeavetypes = objEmployee.FillLeaveTypesforEmployee(intEmpid, YearSettingsId);
            ViewState["LeaveTypes"] = dsLoadLeavetypes.Tables[0];
            string strLeaveType = string.Empty;
            int i = 1;
            if (dsLoadLeavetypes.Tables[0].Rows.Count > 0)
            {
                if (Convert.ToInt32(dsLoadLeavetypes.Tables[0].Rows[0]["Emp_LeaveType_Id"]) > 0)
                {
                    tbLeaveType.CssClass = "table das-table1 TableWidth";
                    TableHeaderRow trleaveType = new TableHeaderRow();
                    trleaveType.CssClass = "row";
                    TableHeaderCell tcLeaveTypeName = new TableHeaderCell();
                    tcLeaveTypeName.CssClass = "col-md-4 empheader";
                    //tcLeaveTypeName.HorizontalAlign = HorizontalAlign.Left;
                    tcLeaveTypeName.Wrap = true;
                    tcLeaveTypeName.Text = LeaveTypeHeader;
                    trleaveType.Cells.Add(tcLeaveTypeName);
                    TableHeaderCell tcPreviousYearBalance = new TableHeaderCell();
                    tcPreviousYearBalance.HorizontalAlign = HorizontalAlign.Center;
                    tcPreviousYearBalance.CssClass = "col-md-4 empheader";
                    tcPreviousYearBalance.Wrap = true;
                    tcPreviousYearBalance.Text = PreviouYearHeader;
                    trleaveType.Cells.Add(tcPreviousYearBalance);
                    TableHeaderCell tcNoOfLeaveAvailed = new TableHeaderCell();
                    tcNoOfLeaveAvailed.CssClass = "col-md-4 empheader";
                    tcNoOfLeaveAvailed.HorizontalAlign = HorizontalAlign.Center;
                    tcNoOfLeaveAvailed.Wrap = true;
                    tcNoOfLeaveAvailed.Text = LeaveTakenHeader;
                    trleaveType.Cells.Add(tcNoOfLeaveAvailed);
                    tbLeaveType.Rows.Add(trleaveType);
                    if (Session["Demo"] != null && Convert.ToString(Session["Demo"]) != "Express")
                    {
                        phLeaveTypes.Controls.Add(tbLeaveType);
                    }
                    foreach (DataRow dr in dsLoadLeavetypes.Tables[0].Rows)
                    {
                        TableRow tr = new TableRow();
                        tr.CssClass = "row form-group";
                        TableCell tc_LeaveType = new TableCell();
                        tc_LeaveType.CssClass = "col-md-4";
                        //tc_LeaveType.HorizontalAlign = HorizontalAlign.Left;
                        Label lblLeaveType = new Label();
                        lblLeaveType.ID = Convert.ToString(dr["Emp_LeaveType_Id"]);
                        lblLeaveType.Text = Convert.ToString(dr["LeaveType"]);
                        lblLeaveType.CssClass = "form-control";
                        tc_LeaveType.Controls.Add(lblLeaveType);
                        tr.Cells.Add(tc_LeaveType);
                        TableCell tc_PreviousYearBalance = new TableCell();
                        tc_PreviousYearBalance.CssClass = "col-md-4";
                        tc_PreviousYearBalance.HorizontalAlign = HorizontalAlign.Center;
                        Label txtPreviousYearBalance = new Label();
                        txtPreviousYearBalance.ID = "txtPreviousYearBalance" + Convert.ToInt32(dr["Emp_LeaveType_Id"]);
                        txtPreviousYearBalance.Text = Convert.ToString(dr["PreviousYearBalance"]);
                        txtPreviousYearBalance.Attributes.Add("onkeypress", "return number_dot(event,this);");
                        txtPreviousYearBalance.CssClass = "form-control";
                        tc_PreviousYearBalance.Controls.Add(txtPreviousYearBalance);
                        tr.Cells.Add(tc_PreviousYearBalance);
                        TableCell tc_NoOffLeaveAvailed = new TableCell();
                        tc_NoOffLeaveAvailed.CssClass = "col-md-12";
                        tc_NoOffLeaveAvailed.HorizontalAlign = HorizontalAlign.Center;
                        Label txtNoOffLeaveAvailed = new Label();
                        txtNoOffLeaveAvailed.ID = "txtNoOffLeaveAvailed" + Convert.ToInt32(dr["Emp_LeaveType_Id"]);
                        txtNoOffLeaveAvailed.Text = Convert.ToString(dr["NoOffLeaveAvailed"]);
                        txtNoOffLeaveAvailed.Attributes.Add("onkeypress", "return number_dot(event,this);");
                        txtNoOffLeaveAvailed.CssClass = "form-control";
                        txtNoOffLeaveAvailed.ToolTip = LeaveTakenToolTip;
                        tc_NoOffLeaveAvailed.Controls.Add(txtNoOffLeaveAvailed);
                        tr.Cells.Add(tc_NoOffLeaveAvailed);
                        tbLeaveType.Rows.Add(tr);
                        i = i + 1;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Message(ex.Message);
        }
    }
    private void GetEmpDetailsbyID(int Empid)
    {
        DataSet ds_Empdetails = new DataSet();
        ds_Empdetails = objEmployee.Select_EmployeeDetailsbyId(Empid);
        if (ds_Empdetails != null && ds_Empdetails.Tables[0].Rows.Count > 0)
        {
            divPenalty.Style.Add("display", "none");
            if (Convert.ToString(Session["packageID"]) != "")
            {
                if (Convert.ToString(Session["packageID"]) == "157")
                {
                    divPenalty.Style.Add("display", "");
                    if (ds_Empdetails.Tables[0].Rows[0]["penalty"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["penalty"]) != "")
                    {
                        if (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["penalty"]) == true)
                            lblPenaltyCatvalue.Text = "Disruptive";
                        else
                            lblPenaltyCatvalue.Text = "Non-Disruptive";
                    }
                }
                if (Convert.ToInt32(Session["packageID"]) < 157)  //vaigai
                    DivMobileSMS.Style.Add("display", "none");
            }
            if (ds_Empdetails.Tables[0].Rows[0]["MobileClockInOUt"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["MobileClockInOUt"]) != "")
            {
                if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["MobileClockInOUt"]) == 1)
                    txtMobileClockYesNo.Text = rm.GetString("rbtnMobileClockYes", ci);
                else if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["MobileClockInOUt"]) == 0)
                    txtMobileClockYesNo.Text = rm.GetString("rbtnMobileClockNo", ci);
            }
            if (ds_Empdetails.Tables[0].Rows[0]["SMSEnabled"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["SMSEnabled"]) != "")
            {
                if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["SMSEnabled"]) == 1)
                    txtSMSEnableDisbale.Text = rm.GetString("rbtnMobileClockYes", ci);
                else if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["SMSEnabled"]) == 0)
                    txtSMSEnableDisbale.Text = rm.GetString("rbtnMobileClockNo", ci);
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Employee_FirstName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_FirstName"]) != "")
                lbl_EmpFirstName.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_FirstName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Employee_MiddleName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_MiddleName"]) != "")
                lbl_EmpMiddleName.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_MiddleName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Employee_LastName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_LastName"]) != "")
                lbl_EmpLastName.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_LastName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Father_name"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Father_name"]) != "")
                lbl_FatherName.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Father_name"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Mother_name"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Mother_name"]) != "")
                lbl_Mothername.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Mother_name"]);
            DateTime date1 = new DateTime();
            DateTime date2 = new DateTime();
            DateTime date3 = new DateTime();
            DateTime date4 = new DateTime();
            DateTime date5 = new DateTime();
            DateTime date6 = new DateTime();
            if (ds_Empdetails.Tables[0].Rows[0]["DateofBirth"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["DateofBirth"]) != "")
            {
                date1 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["DateofBirth"]);
                lbl_dob.Text = date1.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["DateofBirth_Record"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["DateofBirth_Record"]) != "")
            {
                date2 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["DateofBirth_Record"]);
                lbl_dobRecord.Text = date2.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Blood_Group"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Blood_Group"]) != "")
                lbl_BloodGroup.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Blood_Group"]);
            if (ds_Empdetails.Tables[0].Rows[0]["EmailId"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["EmailId"]) != "")
                lbl_EmailID.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["EmailId"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Contact_Address"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Contact_Address"]) != "")
                lbl_CAddress.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Contact_Address"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Permanent_Address"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Permanent_Address"]) != "")
                lbl_PAddress.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Permanent_Address"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Phone_Number"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Phone_Number"]) != "")
                lbl_PhoneNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Phone_Number"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Mobile_Number"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Mobile_Number"]) != "")
                lbl_MobileNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Mobile_Number"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Gender"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Gender"]) != "")
                lbl_Gender.Text = (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Gender"]) == "Male") ? rm.GetString("rbtn_EmployeeMaster_Male", ci) : rm.GetString("rbtn_EmployeeMaster_Female", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["Marital_status"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Marital_status"]) != "")
                lbl_MStatus.Text = (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Marital_status"]) == "Single") ? rm.GetString("rbtn_EmployeeMaster_Single", ci) : rm.GetString("rbtn_EmployeeMaster_Married", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["Nationality"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Nationality"]) != "")
                lbl_Nationality.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Nationality"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Religion"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Religion"]) != "")
                lbl_Religion.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Religion"]);
            if (ds_Empdetails.Tables[0].Rows[0]["District"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["District"]) != "")
                lbl_District.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["District"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CountryName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CountryName"]) != "")
                lbl_Country.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CountryName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["StateName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["StateName"]) != "")
                lbl_State.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["StateName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["City"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["City"]) != "")
                lbl_NativePlace.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["City"]);
            if (ds_Empdetails.Tables[0].Rows[0]["LevelName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["LevelName"]) != "")
                lbl_OrgLevel.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["LevelName"]);
            int intLevelId = 0;
            if (ds_Empdetails.Tables[0].Rows[0]["LevelID"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["LevelID"]) != "")
                intLevelId = Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["LevelID"]);
            if (ds_Empdetails.Tables[0].Rows[0]["IsFlexible"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["IsFlexible"]) != "")
            {
                if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["IsFlexible"]) == 0)
                    lblFlexibleTimingsData.Text = "No";
                else if (Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["IsFlexible"]) == 1)
                    lblFlexibleTimingsData.Text = "Yes";
            }
            int companyId = 0;
            org_levelsEventData getOrg = new org_levelsEventData();
            getOrg.GetOrgParentLevels_FromID(intLevelId);
            DataSet ds_getOrg = new DataSet();
            ds_getOrg = getOrg.GetOrgParentLevels();
            if (ds_getOrg != null)
                if (ds_getOrg.Tables[0].Rows.Count > 0)
                    companyId = Convert.ToInt32(ds_getOrg.Tables[0].Rows[0]["LevelID"]);
            int intFlexibleCount = 0;
            intFlexibleCount = objEmployee.SelectFlexibleEmployeeDetails(companyId);
            divFlexibleTimings.Visible = intFlexibleCount > 0 ? true : false;
            if (ds_Empdetails.Tables[0].Rows[0]["Photo"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Photo"]) != "")
            {
                try
                {
                    DirectoryInfo dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "Masters");
                    FileInfo[] files = dir.GetFiles("*.bmp");
                    foreach (FileInfo file in files)
                    {
                        string str = AppDomain.CurrentDomain.BaseDirectory + "Masters\\";
                        File.Delete(str + Convert.ToString(file));
                    }
                    Random rnd = new Random();
                    string strPath = "Employee_Photo_" + intEmpid + ".bmp";
                    byte[] storedImage = (byte[])(ds_Empdetails.Tables[0].Rows[0]["Photo"]);
                    MemoryStream stream = new MemoryStream(storedImage);
                    System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
                    img.Save(Server.MapPath(strPath));
                    img.Dispose();
                    img_Photo.ImageUrl = strPath + "?rnd=" + rnd.NextDouble();
                    li_nophoto.Visible = true;
                }
                catch (Exception ex)
                {
                    Message(ex.ToString());
                }
            }
            else
            {
                img_Photo.Visible = false;
                li_nophoto.Visible = false;
                lbl_Nophoto.Text = rm.GetString("Label_PhotoNotavailable", ci);
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Personal_mailid"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Personal_mailid"]) != "")
                lbl_PEmailID.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Personal_mailid"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Passport_No"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Passport_No"]) != "")
                lbl_PassportNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Passport_No"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Passport_expirydate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Passport_expirydate"]) != "")
            {
                date3 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["Passport_expirydate"]);
                lbl_PExpiry.Text = date3.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Visa_No"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Visa_No"]) != "")
                lbl_VisaNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Visa_No"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Visa_expirydate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Visa_expirydate"]) != "")
            {
                date4 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["Visa_expirydate"]);
                lbl_VExpiry.Text = date4.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Vehicle_Type"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Vehicle_Type"]) != "")
            {
                if (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Vehicle_Type"]) == "-Select-")
                    lbl_VehicleType.Text = "";
                else
                {
                    lbl_VehicleType.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Vehicle_Type"]);
                    if (lbl_VehicleType.Text == "Two Wheeler")
                        lbl_VehicleType.Text = rm.GetString("VehicleType_TwoWheeler", ci);
                    else if (lbl_VehicleType.Text == "Four Wheeler")
                        lbl_VehicleType.Text = rm.GetString("VehicleType_FourWheeler", ci);
                }
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Vehicle_No"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Vehicle_No"]) != "")
                lbl_VehicleNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Vehicle_No"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Anniversary_Date"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Anniversary_Date"]) != "")
            {
                date5 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["Anniversary_Date"]);
                lbl_AnnivDate.Text = date5.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Entrance_Name"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Entrance_Name"]) != "")
                lbl_EntranceName_Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Entrance_Name"]);
            string sno = "0";
            if (ds_Empdetails.Tables[0].Rows[0]["Spouse_No"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Spouse_No"]) != "")
                sno = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Spouse_No"]);
            if (sno == "0")
                lbl_SpouseNo.Text = "";
            else
                lbl_SpouseNo.Text = sno;
            string cno = "0";
            if (ds_Empdetails.Tables[0].Rows[0]["Children_No"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Children_No"]) != "")
                cno = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Children_No"]);
            if (cno == "0")
                lbl_Children.Text = "";
            else
                lbl_Children.Text = cno;
            if (ds_Empdetails.Tables[0].Rows[0]["Employee_Code_Id"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_Code_Id"]) != "")
                lbl_EmpCodeID.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_Code_Id"]);
            if (ds_Empdetails.Tables[0].Rows[0]["groupName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["groupName"]) != "")
                lbl_UserGroup.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["groupName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["TitleName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["TitleName"]) != "")
                lbl_Designation.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["TitleName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["EDesigEffectDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["EDesigEffectDate"]) != "")
            {
                DateTime dateDesig = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["EDesigEffectDate"]);
                lblDesigEffectiveDateData.Text = dateDesig.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["DateOfJoining"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["DateOfJoining"]) != "")
            {
                date6 = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["DateOfJoining"]);
                lbl_doj.Text = date6.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Reporting"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Reporting"]) != "")
                lbl_ReportingTo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Reporting"]);
            if (ds_Empdetails.Tables[0].Rows[0]["SancAuth"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["SancAuth"]) != "")
                lbl_LeavSancAuthority.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["SancAuth"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Bus"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Bus"]) != "")
                lbl_BusNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Bus"]);
            string prev = "0.00";
            if (ds_Empdetails.Tables[0].Rows[0]["Prev_Experience"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Prev_Experience"]) != "")
                prev = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Prev_Experience"]);
            if (prev == "0.00")
                lbl_PrevExp.Text = "";
            else
                lbl_PrevExp.Text = prev;
            if (ds_Empdetails.Tables[0].Rows[0]["CategoryName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CategoryName"]) != string.Empty)
                lblEmpCategoryData.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CategoryName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CategoryEffDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CategoryEffDate"]) != "")
            {
                DateTime dtCatEffDate = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["CategoryEffDate"]);
                lblEmpCategoryEffDateData.Text = dtCatEffDate.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["TypeName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["TypeName"]) != string.Empty)
                lblEmpTypeData.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["TypeName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["TypeEffDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["TypeEffDate"]) != "")
            {
                DateTime dtTypeEffDate = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["TypeEffDate"]);
                lblEmpTypeEffDateData.Text = dtTypeEffDate.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            string sal = "0";
            if (ds_Empdetails.Tables[0].Rows[0]["Basic_Salary"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Basic_Salary"]) != "")
                sal = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Basic_Salary"]);
            if (sal == "0")
                lbl_BasicSalary.Text = "";
            else
                lbl_BasicSalary.Text = sal;
            if (ds_Empdetails.Tables[0].Rows[0]["EPayEffectDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["EPayEffectDate"]) != string.Empty)
            {
                DateTime dateBPay = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["EPayEffectDate"]);
                lblBasicSalEffectiveDateData.Text = dateBPay.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["UserName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["UserName"]) != string.Empty)
                lbl_Username.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["UserName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Qual_JoiningTime"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Qual_JoiningTime"]) != string.Empty)
                lbl_QualJoin.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Qual_JoiningTime"]);
            if (ds_Empdetails.Tables[0].Rows[0]["Qual_Employment"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Qual_Employment"]) != string.Empty)
                lbl_QualEmployment.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Qual_Employment"]);
            if (ds_Empdetails.Tables[0].Rows[0]["OutDoorJob"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["OutDoorJob"]) != string.Empty)
                lbl_OutdoorEmp.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["OutDoorJob"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["OT_Eligible"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["OT_Eligible"]) != string.Empty)
                lbl_OTEligible.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["OT_Eligible"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["CompOff_Eligible"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CompOff_Eligible"]) != string.Empty)
                lbl_COffEligible.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["CompOff_Eligible"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["ESI_Eligible"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["ESI_Eligible"]) != string.Empty)
                lbl_ESIeligible.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["ESI_Eligible"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["PF_Eligible"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["PF_Eligible"]) != string.Empty)
                lbl_PFeligibleData.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["PF_Eligible"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["Report_Exclude"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Report_Exclude"]) != string.Empty)
                lbl_ExclReport.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["Report_Exclude"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["Employee_Status"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Employee_Status"]) != string.Empty)
            {
                blActiveness = Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["Employee_Status"]);
                lbl_EmpStatus.Text = (blActiveness == true) ? rm.GetString("rbtn_EmployeeMaster_Active", ci) : rm.GetString("rbtn_EmployeeMaster_InActive", ci);
                if (blActiveness == false)
                {
                    if (ds_Empdetails.Tables[0].Rows[0]["InActiveDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["InActiveDate"]) != string.Empty)
                    {
                        lbl_EmpInActiveDate.Visible = true;
                        lbl_EmpInActiveDate.Text = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["InActiveDate"]).ToString(Convert.ToString(gstrDateFormat)); ;
                    }
                }
            }
            if (ds_Empdetails.Tables[0].Rows[0]["Hostel"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Hostel"]) != string.Empty)
                lblHostelWorkerData.Text = (Convert.ToBoolean(ds_Empdetails.Tables[0].Rows[0]["Hostel"]) == true) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
            if (ds_Empdetails.Tables[0].Rows[0]["SwipeCardNo"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["SwipeCardNo"]) != string.Empty)
                lbl_SwipecardNo.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["SwipeCardNo"]);
            if (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Isdeleted"]) != "")
            {
                if (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Isdeleted"]) == "True")
                {
                    EnableDeleteControls(false);

                }
                else if (Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Isdeleted"]) == "False")
                {
                    EnableRestoreControls(false);
                }
            }

            if (ds_Empdetails.Tables[0].Rows[0]["ContractorName"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["ContractorName"]) != "")
                txtContractor.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["ContractorName"]);
            if (ds_Empdetails.Tables[0].Rows[0]["ContractorEffDate"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["ContractorEffDate"]) != "")
            {
                DateTime dtContractEffDate = Convert.ToDateTime(ds_Empdetails.Tables[0].Rows[0]["ContractorEffDate"]);
                txtContractorEffective.Text = dtContractEffDate.ToString(Convert.ToString(Session["MDateFormat"]));
            }
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField1"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField1"]) != string.Empty)
                lblCustomField1Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField1"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField2"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField2"]) != string.Empty)
                lblCustomField2Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField2"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField3"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField3"]) != string.Empty)
                lblCustomField3Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField3"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField4"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField4"]) != string.Empty)
                lblCustomField4Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField4"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField5"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField5"]) != string.Empty)
                lblCustomField5Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField5"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField5"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField5"]) != string.Empty)
                lblCustomField5Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField5"]);
            if (ds_Empdetails.Tables[0].Rows[0]["CustomField6"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField6"]) != string.Empty)
                lblCustomField6Value.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CustomField6"]);

            Int32 taxpolicyId = 0;
            if (ds_Empdetails.Tables[0].Rows[0]["Tax_Policy"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Tax_Policy"]) != string.Empty)
            {
                taxpolicyId = Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["Tax_Policy"]);
                if(taxpolicyId!=0)
                {
                    DataSet dsTaxPolicy = new DataSet();
                    Hashtable htable = new Hashtable();
                    htable.Add("@tag", "P");
                    htable.Add("@TaxPolicyID", taxpolicyId);
                    dsTaxPolicy = objPayrollData.InsertTaxPolicy(htable);
                    lbl_TxtTaxPolicy.Text = Convert.ToString(dsTaxPolicy.Tables[0].Rows[0]["TaxPolicyName"]);

                }
                else
                {
                    lbl_TxtTaxPolicy.Visible = false;
                    lbl_TaxPolicy.Visible = false;
                }

                
            }

            if (ds_Empdetails.Tables[0].Rows[0]["PF_Policy"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["PF_Policy"]) != string.Empty)
            {
                Int32 pfesi = 0;
                pfesi = Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["PF_Policy"]);

                if(pfesi!=0)
                {
                    DataSet dsPFESI = new DataSet();
                    Hashtable htable = new Hashtable();
                    htable.Add("@tag", "S");
                    htable.Add("@PFPolicyid", pfesi);
                    dsPFESI = objPayrollData.InsertPFESIPolicyDetails(htable);

                    lbl_TxtPFESI.Text = Convert.ToString(dsPFESI.Tables[0].Rows[0]["PFESI_PolicyName"]);
                }
                else
                {
                    lbl_TxtPFESI.Visible = false;
                    lbl_PFESI.Visible = false;
                }


            }


            if (ds_Empdetails.Tables[0].Rows[0]["CA"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CA"]) != string.Empty)
            {

                Int32 CA = 0;
                CA = Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["CA"]);

                if (CA != 0)
                {
                    DataSet dsPFESI = new DataSet();
                    Hashtable htable = new Hashtable();
                    htable.Add("@tag", "S");
                    htable.Add("@CAPolicyid", CA);
                    dsPFESI = objPayrollData.InsertandupdateConveyancePolicyDetails(htable);

                    lbl_TxtCA.Text = Convert.ToString(dsPFESI.Tables[0].Rows[0]["conPolicyName"]);
                }
                else
                {
                    lbl_TxtCA.Visible = false;
                    lbl_CA.Visible = false;
                }
            }
            int HraID = 0;
            if (ds_Empdetails.Tables[0].Rows[0]["HRA"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["HRA"]) != string.Empty)
            {
                HraID = Convert.ToInt32(ds_Empdetails.Tables[0].Rows[0]["HRA"]);

                if (HraID == 0)
                {
                    lbl_hra.Visible = false;
                    lbl_TxtHra.Visible = false;

                }
                else
                {
                    if(HraID==1)
                    {
                        lbl_TxtHra.Text = "HRA Metro";
                    }
                    else
                    {
                        lbl_TxtHra.Text = "HRA Non-Metro";
                    }
                }
              
            }

            int Medical_Allowance = 0;

            if (ds_Empdetails.Tables[0].Rows[0]["MedicalAlllowance"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["MedicalAlllowance"]) != string.Empty)
            {
                Medical_Allowance = Convert.ToInt16(ds_Empdetails.Tables[0].Rows[0]["MedicalAlllowance"]);
                if (Medical_Allowance == 0)
                {
                    lbl_TxtMedical.Text = "No";
                }
                else
                {
                    lbl_TxtMedical.Text = "Yes";
                }
            }

            int CEAId = 0;
            if (ds_Empdetails.Tables[0].Rows[0]["CEDAllowance"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["CEDAllowance"]) != string.Empty)
            {
                CEAId = Convert.ToInt16(ds_Empdetails.Tables[0].Rows[0]["CEDAllowance"]);
                if (CEAId == 0)
                {
                    lbl_TxtCEA.Text = "NO";
                }
                else
                {
                    lbl_TxtCEA.Text = "Yes";
                }
            }

            //if (ds_Empdetails.Tables[0].Rows[0]["Emp_Ctc"] != DBNull.Value && Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Emp_Ctc"]) != string.Empty)
            //{
            //    txtCustomField1.Text = Convert.ToString(ds_Empdetails.Tables[0].Rows[0]["Emp_Ctc"]);
            //}

        }
        lbl_CompOffOT.Text = (blCOffeligible && blOTeligible) ? rm.GetString("ShiftSetting_Yes", ci) : rm.GetString("ShiftSetting_No", ci);
    }
    private void LoadStrings(CultureInfo ci)
    {
        lbl_EntranceName.Text = rm.GetString("lbl_Entrance", ci);
        lblContractor.Text = rm.GetString("lbl_Contractor", ci);
        lblHostelWorker.Text = "Blocking is required";
        lbl_AnniversaryDate.Text = rm.GetString("EmployeeMaster_AnniversaryDate", ci);
        lbl_BasicSalary1.Text = rm.GetString("EmployeeMaster_BasicSalary", ci);
        lbl_BloodGroup1.Text = rm.GetString("EmployeeMaster_BloodGroup", ci);
        lbl_CardNo.Text = rm.GetString("TerminalDataType_Card_No", ci);
        lbl_City.Text = rm.GetString("Masters_Generic_City", ci);
        lbl_ContactAddress.Text = rm.GetString("EmployeeMaster_ContactAddress", ci);
        lbl_Country1.Text = rm.GetString("Masters_Generic_Country", ci);
        lbl_DateofBirth.Text = rm.GetString("EmployeeMaster_DateOfBirth", ci);
        lbl_DateofBirthAsPerRec.Text = rm.GetString("EmployeeMaster_DateOfBirthAsPerRecord", ci);
        lbl_DateofJoining.Text = rm.GetString("EmployeeMaster_DateOfJoining", ci);
        lbl_Designation1.Text = rm.GetString("EmployeeMaster_Designation", ci);
        lblDesigEffectiveDate.Text = rm.GetString("EmployeeMaster_BasicSal_EffectiveDate", ci);
        lblBasicSalEffectiveDate.Text = rm.GetString("EmployeeMaster_BasicSal_EffectiveDate", ci);
        lbl_District1.Text = rm.GetString("EmployeeMaster_District", ci);
        lbl_EmailID1.Text = rm.GetString("EmployeeMaster_EmailId", ci);
        lbl_EmployeeFirstName.Text = rm.GetString("email_EmployeeName", ci);
        lbl_EmployeeID.Text = rm.GetString("email_EmployeeId", ci);
        lbl_EmployeeStatus.Text = rm.GetString("EmployeeMaster_EmployeeStatus", ci);
        lbl_FathersName.Text = rm.GetString("EmployeeMaster_FathersName", ci);
        lbl_Gender1.Text = rm.GetString("EmployeeMaster_Gender", ci);
        lbl_LastName.Text = rm.GetString("EmployeeMaster_LastName", ci);
        lbl_LeaveSanctioninguthority.Text = rm.GetString("EmployeeMaster_LeaveSanctioningAuthority", ci);
        lbl_Maritalstatus.Text = rm.GetString("EmployeeMaster_MaritalStatus", ci);
        lbl_MiddleName.Text = rm.GetString("EmployeeMaster_MiddleName", ci);
        lbl_MobileNumber.Text = rm.GetString("EmployeeMaster_MobileNumber", ci);
        lbl_MothersName.Text = rm.GetString("EmployeeMaster_MothersName", ci);
        lbl_Nationality1.Text = rm.GetString("EmployeeMaster_Nationality", ci);
        lbl_NoofChildren.Text = rm.GetString("EmployeeMaster_NoOfChildren", ci);
        lbl_NoofSpouse.Text = rm.GetString("EmployeeMaster_NoOfSpouse", ci);
        lbl_PassportexpiryDate.Text = rm.GetString("EmployeeMaster_PassportExpiryDate", ci);
        lbl_PassportNo1.Text = rm.GetString("EmployeeMaster_PassportNo", ci);
        lbl_PermanentAddress.Text = rm.GetString("EmployeeMaster_PermanentAddress", ci);
        lbl_PersonalMailID.Text = rm.GetString("EmployeeMaster_PersionalMailId", ci);
        lbl_PhoneNumber.Text = rm.GetString("EmployeeMaster_PhoneNumber", ci);
        lbl_PreviousExperience.Text = rm.GetString("EmployeeMaster_PreviousExperience", ci);
        lbl_QualifactionattheTimeofJoining.Text = rm.GetString("EmployeeMaster_QualifactionAtTheTimeOfJoining", ci);
        lbl_QualificationduringEmployment.Text = rm.GetString("EmployeeMaster_QualificationDuringEmployment", ci);
        lbl_Religion1.Text = rm.GetString("EmployeeMaster_Religion", ci);
        lbl_ReportingTo1.Text = rm.GetString("EmployeeMaster_ReportingTo", ci);
        lbl_State1.Text = rm.GetString("Masters_Generic_State", ci);
        lbl_Transportation.Text = rm.GetString("EmployeeMaster_Transportation", ci);
        lbl_UserGroup1.Text = rm.GetString("EmployeeMaster_UserGroup", ci);
        lbl_UserName1.Text = rm.GetString("EmployeeMaster_UserName_AD", ci);
        lbl_VehicleNumber.Text = rm.GetString("EmployeeMaster_VehicleNumber", ci);
        lbl_VehicleType1.Text = rm.GetString("EmployeeMaster_VehicleType", ci);
        lbl_VisaExpiryDate.Text = rm.GetString("EmployeeMaster_VisaExpiryDate", ci);
        lbl_VisaNO1.Text = rm.GetString("EmployeeMaster_VisaNo", ci);
        lbl_OrganizationLevel.Text = rm.GetString("UserGroups_OrganizationLevel", ci);
        lbl_OTEligible1.Text = rm.GetString("EmployeeMaster_OTEligible", ci);
        lbl_OTEligible.Text = rm.GetString("EmployeeMaster_OTEligible", ci);
        lbl_CompOffAndOT.Text = rm.GetString("lblOTCompOffApproval", ci);
        lbl_OutDoorEmployee.Text = rm.GetString("EmployeeMaster_OutDoorEmployee", ci);
        lbl_EligiblefoESI.Text = rm.GetString("chk_EmployeeMaster_EligibleForESI", ci);
        lbl_PFeligible.Text = rm.GetString("chk_EmployeeMaster_EligibleForPF", ci);
        lbl_CompensationOffEligible.Text = rm.GetString("chk_EmployeeMaster_CompensationOffEligible", ci);
        lbl_ExcludefromReports.Text = rm.GetString("chk_EmployeeMaster_ExcludeFromReports", ci);
        lbl_HeaderEmployeeMaster.Text = rm.GetString("Masters_Employee_EmployeeMaster", ci);
        lblEmployeeMaster.Text = rm.GetString("Masters_Employee_EmployeeMaster", ci);
        lblEmployeeMaster1.Text = rm.GetString("Masters_Employee_EmployeeMaster", ci);
        lblEmployeeMaster2.Text = rm.GetString("Masters_Employee_EmployeeMaster", ci);
        lblFlexibleTimings.Text = rm.GetString("FlexibleTimings", ci);
        btn_Cancel.Text = rm.GetString("btn_Cancel", ci);
        btn_Modify.Text = rm.GetString("btn_Modify", ci);
        btn_Delete.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Delete", ci);
        btn_Cancel1.Text = rm.GetString("btn_Cancel", ci);
        btn_Modify1.Text = rm.GetString("btn_Modify", ci);
        btn_Delete1.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Delete", ci);
        btn_Cancel2.Text = rm.GetString("btn_Cancel", ci);
        btn_Modify2.Text = rm.GetString("btn_Modify", ci);
        btn_Delete2.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Delete", ci);
        btn_Cancel3.Text = rm.GetString("btn_Cancel", ci);
        btn_Modify3.Text = rm.GetString("btn_Modify", ci);
        btn_Delete3.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Delete", ci);
        btn_PermanentDelete.Text = "&nbsp;&nbsp;" + rm.GetString("btn_PermanentDelete", ci);
        btn_Restore.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Restore", ci);
        btn_PermanentDeleteLP.Text = "&nbsp;&nbsp;" + rm.GetString("btn_PermanentDelete", ci);
        btn_RestoreLP.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Restore", ci);
        btn_PermanentDeleteOf.Text = "&nbsp;&nbsp;" + rm.GetString("btn_PermanentDelete", ci);
        btn_RestoreOf.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Restore", ci);
        btn_PermanentDeleteP.Text = "&nbsp;&nbsp;" + rm.GetString("btn_PermanentDelete", ci);
        btn_RestoreP.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Restore", ci);
        lblEmpCategory.Text = rm.GetString("lblEmpCategory", ci);
        lblEmpType.Text = rm.GetString("lblEmpType", ci);
        lblEmpCategoryEffDate.Text = rm.GetString("EmployeeMaster_BasicSal_EffectiveDate", ci);
        lblEmpTypeEffDate.Text = rm.GetString("EmployeeMaster_BasicSal_EffectiveDate", ci);
        btn_Personal_main.Text = rm.GetString("Employee_personal", ci);
        btn_Official_blur.Text = rm.GetString("Employee_official", ci);
        btn_LeavePolicy_blur.Text = rm.GetString("Employee_LeavePolicy", ci);
        btn_Others_blur.Text = rm.GetString("Employee_Others", ci);
        btn_Personal_blur.Text = rm.GetString("Employee_personal", ci);
        btn_Official_main.Text = rm.GetString("Employee_official", ci);
        btn_LeavePolicy_blur1.Text = rm.GetString("Employee_LeavePolicy", ci);
        btn_Others_blur1.Text = rm.GetString("Employee_Others", ci);
        btn_Personal_blur1.Text = rm.GetString("Employee_personal", ci);
        btn_Official_blur1.Text = rm.GetString("Employee_official", ci);
        btn_LeavePolicy_main.Text = rm.GetString("Employee_LeavePolicy", ci);
        btn_Others_blur2.Text = rm.GetString("Employee_Others", ci);
        btn_Personal_blur2.Text = rm.GetString("Employee_personal", ci);
        btn_Official_blur2.Text = rm.GetString("Employee_official", ci);
        btn_LeavePolicy_blur2.Text = rm.GetString("Employee_LeavePolicy", ci);
        btn_Others_main.Text = rm.GetString("Employee_Others", ci);
        //lblCustomField1.Text = rm.GetString("Employee_CustomField1", ci);
        //lblCustomField2.Text = rm.GetString("Employee_CustomField2", ci);
        //lblCustomField3.Text = rm.GetString("Employee_CustomField3", ci);
        //lblCustomField4.Text = rm.GetString("Employee_CustomField4", ci);
        //lblCustomField5.Text = rm.GetString("Employee_CustomField5", ci);
        lbl_Personal.Text = rm.GetString("Employee_personal", ci);
        lbl_Others.Text = rm.GetString("Employee_Others", ci);
        lbl_Official.Text = rm.GetString("Employee_official", ci);
        lbl_LeavePolicy.Text = rm.GetString("Employee_LeavePolicy", ci);
        lblIsActiveDate.Text = rm.GetString("lbl_InActiveDate", ci);

        lblMobileClock.Text = rm.GetString("lblMobileClock", ci);
        lblSMSEnableDisable.Text = rm.GetString("lblSMSEnableDisable", ci);

        lbl_hra.Text = "HRA Allowance";
        lbl_CA.Text = "Conveyance Allowance";
        lbl_PFESI.Text= "PFESI Policy";
        lbl_TaxPolicy.Text = "Tax Policy";
        lbl_Medical.Text = "Medical Allowance";
        lbl_CEA.Text = "Children Education Allowance";

    }
    private void loadcss()
    {
        CultureInfo ci;
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        htmlEmployee.Attributes.Add("dir", rm.GetString("Direction", ci));
        if (source_Language == "Resources.Resource_AR")
        {
            stylebootstrap.Href = "../bootstrap/css/bootstrap-rtl.min.css";
            stylefontawesome.Href = "../bootstrap/font-awesome/css/font-awesome-rtl.css";
            stylebuild.Href = "../bootstrap/font-awesome/css/build-rtl.css";
            stylejvectormap.Href = "../plugins/jvectormap/jquery-jvectormap-1.2.2-rtl.css";
            styleAdminLTE.Href = "../dist/css/AdminLTE.min-rtl.css";
            styleallskins.Href = "../dist/css/_all-skins.min-rtl.css";
            stylecustom.Href = "../dist/css/custom-rtl.css";
            stylefonts.Href = "../dist/css/fonts.css";
            styledatepicker3.Href = "../plugins/datepicker/datepicker3-rtl.css";
            styledaterangepicker.Href = "../plugins/daterangepicker/daterangepicker-bs3-rtl.css";
            styleProgressBar.Href = "../css/ProgressBar-rtl.css";
        }
        else
        {
            stylebootstrap.Href = "../bootstrap/css/bootstrap.min.css";
            stylefontawesome.Href = "../bootstrap/font-awesome/css/font-awesome.css";
            stylebuild.Href = "../bootstrap/font-awesome/css/build.css";
            stylejvectormap.Href = "../plugins/jvectormap/jquery-jvectormap-1.2.2.css";
            styleAdminLTE.Href = "../dist/css/AdminLTE.min.css";
            styleallskins.Href = "../dist/css/_all-skins.min.css";
            stylecustom.Href = "../dist/css/custom.css";
            stylefonts.Href = "../dist/css/fonts.css";
            styledatepicker3.Href = "../plugins/datepicker/datepicker3.css";
            styledaterangepicker.Href = "../plugins/daterangepicker/daterangepicker-bs3.css";
            styleProgressBar.Href = "../css/ProgressBar.css";
        }
    }
    private void UserRights()
    {
        if (ViewState["vw_ds_Checkuser"] == null)
        {
            ds_Checkuser = objCheckUser.checkRights(18, Convert.ToInt32(Session["userGroup_Id"]), "");
            ViewState["vw_ds_Checkuser"] = ds_Checkuser;
        }
        else
            ds_Checkuser = (DataSet)ViewState["vw_ds_Checkuser"];
        if (ds_Checkuser.Tables[0].Rows.Count > 0)
        {
            if (ds_Checkuser.Tables[0].Rows[0]["viewPrv"] == DBNull.Value || Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["viewPrv"]) != 1)
                Response.Redirect("TA_UI_Master_Employee.aspx");
            if (ds_Checkuser.Tables[0].Rows[0]["modifyPrv"] != DBNull.Value && Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["modifyPrv"]) == 1)
                EnableModifyControls(true);
            else
                EnableModifyControls(false);
            if (ds_Checkuser.Tables[0].Rows[0]["deletePrv"] != DBNull.Value && Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["deletePrv"]) == 1)
                EnableDeleteControls(true);
            else
                EnableDeleteControls(false);
        }
        else
            Response.Redirect("MasterLandingPage.aspx");
    }
    private void EnableDeleteControls(bool isEnable)
    {
        this.btn_Delete3.Visible = this.btn_Delete2.Visible = this.btn_Delete1.Visible = this.btn_Delete.Visible = isEnable;
    }
    private void EnableModifyControls(bool isEnable)
    {
        this.btn_Modify3.Visible = this.btn_Modify2.Visible = this.btn_Modify1.Visible = this.btn_Modify.Visible = isEnable;
    }
    private void EnableRestoreControls(bool isEnable)
    {
        btn_RestoreOf.Visible = btn_RestoreLP.Visible = btn_RestoreP.Visible = btn_Restore.Visible = isEnable;
    }
    #endregion
    #region ButtonEvents
    protected void btn_Modify_Click(object sender, EventArgs e)
    {
        Random rnd = new Random();
        Response.Redirect("TA_UI_Master_EmployeeModify.aspx?Rn=" + rnd.NextDouble() + "&Emp_Id=" + intEmpid + "&curPage=" + Convert.ToString(hidPage.Value));
    }
    protected void btn_Delete_Click(object sender, EventArgs e)
    {
        int count = objEmployee.CountEmployee(intEmpid);
        if (count == 0)
        {
            objEmployee.delete_Employees(Convert.ToString(intEmpid), "TemporaryDelete", EmployeeID, Convert.ToBoolean(Session["ApplnMode"]));
            Session["ModeToDisplay"] = null;
            base.MessageWithRedirect(rm.GetString("Alert_Employeedeletedsuccessfully", ci), "TA_UI_Master_Employee.aspx");
        }
        else
        {
            base.Message(rm.GetString("Master_Employee_Cannot_Delete", ci));
            Page.RegisterStartupScript("divshow", "<script>div_show();</script>");
        }
    }
    protected void btn_Cancel_Click(object sender, EventArgs e)
    {
        Session["EmployeeData"] = null;
        Response.Redirect("TA_UI_Master_Employee.aspx");
    }
    /// <summary>
    /// Handles the Click event of the btn_Restore control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btn_Restore_Click(object sender, EventArgs e)
    {
        string strEmpcodeID = lbl_EmpCodeID.Text;
        int Count = objEmployee.CheckDuplicateEmployeeCodeupdate(strEmpcodeID, intEmpid, Convert.ToBoolean(Session["ApplnMode"]));
        if (Count > 0)
            base.Message(rm.GetString("Master_Employee_Cannot_Delete", ci));
        else
        {
            objEmployee.delete_Employees(Convert.ToString(intEmpid), "Restore", EmployeeID, Convert.ToBoolean(Session["ApplnMode"]));
            Session["ModeToDisplay"] = null;
            base.MessageWithRedirect(rm.GetString("Alert_Employeerestoredsuccessfully", ci), "TA_UI_Master_Employee.aspx");
        }
    }
    /// <summary>
    /// Handles the Click event of the btn_PermanentDelete control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btn_PermanentDelete_Click(object sender, EventArgs e)
    {
        int Count = objEmployee.CountEmployee(intEmpid);
        if (Count > 0)
            base.Message(rm.GetString("Master_Employee_Cannot_Delete", ci));
        else
        {
            objEmployee.delete_Employees(Convert.ToString(intEmpid), "PermanentDelete", EmployeeID, Convert.ToBoolean(Session["ApplnMode"]));
            Session["ModeToDisplay"] = null;
            base.MessageWithRedirect(rm.GetString("Alert_Employeedeletedsuccessfully", ci), "TA_UI_Master_Employee.aspx");
        }
    }
    #endregion
}
