private void ClearForm()
 {
     TBEmpCode.Text    = string.Empty;
     TBFirstName.Text  = string.Empty;
     TBMiddleName.Text = string.Empty;
     TBLastName.Text   = string.Empty;
     TBSearchCode.Text = string.Empty;
     TBDOB.Text        = string.Empty;
     DDLMaritalStatus.SelectedIndex = 0;
     DDLGender.SelectedIndex        = 0;
     TBDOJ.Text = string.Empty;
     DDLBusinessLocation.ClearSelection();
     DDLDepartment.ClearSelection();
     DDLEmployeeDesignation.ClearSelection();
     CBNotAnEmployee.Checked = false;
     DDLWorkingShift.ClearSelection();
     TBAddressLine1.Text = string.Empty;
     TBAddressLine2.Text = string.Empty;
     TBCity.Text         = string.Empty;
     TBState.Text        = string.Empty;
     TBCountry.Text      = string.Empty;
     TBPin.Text          = string.Empty;
     TBPhoneNumber.Text  = string.Empty;
     TBMobileNumber.Text = string.Empty;
     TBFaxNumber.Text    = string.Empty;
     TBEmail.Text        = string.Empty;
     TBWebsite.Text      = string.Empty;
     btnSubmit.Text      = "Submit";
 }
    private void ShowEmployeeDetails(int recordId)
    {
        string    Query     = "SELECT * FROM View_EmployeeDetails WHERE ID='" + recordId + "'";
        DataSet   DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, Query);
        DataTable DTRecords = DSRecords.Tables[0];

        if (DTRecords.Rows.Count > 0)
        {
            MVEmployee.ActiveViewIndex = 1;
            ImgLogo.ImageUrl           = DTRecords.Rows[0]["Image"].ToString();
            TBEmpCode.Text             = DTRecords.Rows[0]["EmployeeCode"].ToString();
            TBFirstName.Text           = DTRecords.Rows[0]["FirstName"].ToString();
            TBMiddleName.Text          = DTRecords.Rows[0]["MiddleName"].ToString();
            TBLastName.Text            = DTRecords.Rows[0]["LastName"].ToString();
            TBSearchCode.Text          = DTRecords.Rows[0]["SearchCode"].ToString();
            TBDOB.Text = DTRecords.Rows[0]["DateOfBirth"].ToString();
            DDLMaritalStatus.ClearSelection();
            DDLMaritalStatus.Items.FindByText(DTRecords.Rows[0]["MartialStatus"].ToString()).Selected = true;
            DDLGender.ClearSelection();
            DDLGender.Items.FindByText(DTRecords.Rows[0]["Gender"].ToString()).Selected = true;
            TBDOJ.Text = DTRecords.Rows[0]["DateOfJoining"].ToString();
            BindDDLBusinessLocation();
            DDLBusinessLocation.ClearSelection();
            DDLBusinessLocation.Items.FindByValue(DTRecords.Rows[0]["BusinessLocation"].ToString()).Selected = true;
            BindDDLDepartment();
            DDLDepartment.ClearSelection();
            DDLDepartment.Items.FindByValue(DTRecords.Rows[0]["Department"].ToString()).Selected = true;
            BindDDLDesignation();
            DDLEmployeeDesignation.ClearSelection();
            DDLEmployeeDesignation.Items.FindByValue(DTRecords.Rows[0]["Designation"].ToString()).Selected = true;
            //CBCanRequestReportViaSMS.Checked = Convert.ToBoolean(DTRecords.Rows[0]["EmployeeCode"].ToString());
            CBNotAnEmployee.Checked = Convert.ToBoolean(DTRecords.Rows[0]["NotAnEmployee"].ToString());
            BindDDLWorkShift();
            DDLWorkingShift.ClearSelection();
            DDLWorkingShift.Items.FindByValue(DTRecords.Rows[0]["WorkingShift"].ToString()).Selected = true;
            TBAddressLine1.Text = DTRecords.Rows[0]["Address1"].ToString();
            TBAddressLine2.Text = DTRecords.Rows[0]["Address2"].ToString();
            TBCity.Text         = DTRecords.Rows[0]["City"].ToString();
            TBState.Text        = DTRecords.Rows[0]["State"].ToString();
            TBCountry.Text      = DTRecords.Rows[0]["Country"].ToString();
            TBPin.Text          = DTRecords.Rows[0]["ZipCode"].ToString();
            TBPhoneNumber.Text  = DTRecords.Rows[0]["TelephoneNumber"].ToString();
            TBMobileNumber.Text = DTRecords.Rows[0]["MobileNumber"].ToString();
            TBFaxNumber.Text    = DTRecords.Rows[0]["FaxNumber"].ToString();
            TBEmail.Text        = DTRecords.Rows[0]["Email"].ToString();
            TBWebsite.Text      = DTRecords.Rows[0]["Website"].ToString();
            btnSubmit.Text      = "Update";
        }
    }
    private void BindDDLWorkShift()
    {
        SqlParameter[] arrparm = new SqlParameter[2];
        arrparm[0] = new SqlParameter("@Action", "SELECT_ByStatus");
        arrparm[1] = new SqlParameter("@Status", true);
        DataSet DSRecordWorkShift = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_EmployeeWorkShift_CRUD", arrparm);

        if (DSRecordWorkShift.Tables[0].Rows.Count > 0)
        {
            DDLWorkingShift.DataSource     = DSRecordWorkShift.Tables[0];
            DDLWorkingShift.DataTextField  = "Name";
            DDLWorkingShift.DataValueField = "ID";
            DDLWorkingShift.DataBind();
            DDLWorkingShift.Items.Insert(0, new ListItem("Select", "0"));
        }
    }