private void EmpListDemoLoader() { this.ddlEmployee.DataTextField = "EmpName"; this.ddlEmployee.DataValueField = "EmpID"; this.ddlEmployee.Items.Clear(); this.ddlEmployee.Items.Add(new ListItem("Please Select", "null")); this.ddlEmployee.DataSource = EmployeeBusController.FilterEmployees(new List <EmployeeItemBO>(employees), employeeFilter); this.ddlEmployee.DataBind(); }
protected void btnDelete_Click(object sender, EventArgs e) { if (ddlEmployee.SelectedValue == "null" || String.IsNullOrEmpty(ddlEmployee.SelectedValue)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Nothing is selected to delete.')", true); } else { bool result = EmployeeBusController.DeleteEmployee(ddlEmployee.SelectedValue); if (result) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Employee Deleted Successfully')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Employee not deleted. Some Problem Occurred')", true); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { EmployeeBO employee = new EmployeeBO(); employee.EmpAADHAR = this.ed_UID.Text; employee.EmpBloodGroup = this.ed_ddlBloodGroup.SelectedValue; employee.EmpCaste = this.ed_ddlCaste.SelectedValue; employee.EmpDepartmentCD = this.ed_ddlDepartment.SelectedValue; employee.EmpDesignationCD = this.ed_ddlDesignation.SelectedValue; employee.EmpDNI = this.ed_DNI.Text; employee.EmpDOB = this.ed_DOB.Text; employee.EmpDOJ = this.ed_DOJ.Text; employee.EmpDOR = this.ed_DOR.Text; employee.EmpEmailId = this.ed_Email.Text; employee.EmpEmergencyContactNo = this.ed_EmergencyPhone.Text; employee.EmpGroup = this.ed_ddlCategory.SelectedValue; employee.EmpIsActive = this.ed_IsActive.Text; employee.EmpMaritalStatus = this.ed_ddlMStatus.SelectedValue; employee.EmpName = this.ed_Name.Text; employee.EmpPAN = this.ed_PAN.Text; employee.EmpPersonalContactNo = this.ed_Phone.Text; employee.EmpQualification = this.ed_Qualification.Text; employee.EmpQuarterNumber = this.ed_Quarter.Text; employee.EmpReligion = this.ed_ddlReligion.SelectedValue; employee.EmpRemarks = this.ed_Remarks.Text; employee.EmpResidentialAddress = this.ed_Address.Text; employee.EmpSex = this.ed_ddlGender.SelectedValue; employee.EmpID = this.ddlEmployee.SelectedValue; bool result = EmployeeBusController.UpdateEmployee(employee); if (result) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Employee Updated Successfully')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Employee not updated. Some Problem Occurred')", true); } }
private void ShowEmpDetails(string EmpID) { EmployeeBO employee = EmployeeBusController.GetEmployee(EmpID); if (employee.EmpID != null) { this.ed_Name.Text = employee.EmpName; this.ed_UID.Text = employee.EmpAADHAR; this.ed_PAN.Text = employee.EmpPAN; this.ed_Address.Text = employee.EmpResidentialAddress; this.ed_Email.Text = employee.EmpEmailId; this.ed_Phone.Text = employee.EmpPersonalContactNo; this.ed_Qualification.Text = employee.EmpQualification; this.ed_Quarter.Text = employee.EmpQuarterNumber; this.ed_IsActive.Text = employee.EmpIsActive == "Y" ? "YES" : "NO"; this.ed_EmergencyPhone.Text = employee.EmpEmergencyContactNo; this.ed_Remarks.Text = employee.EmpRemarks; this.ed_DOB.Text = employee.EmpDOB; this.ed_DOJ.Text = employee.EmpDOJ; this.ed_DOR.Text = employee.EmpDOR; this.ed_DNI.Text = employee.EmpDNI; this.ed_ddlCaste.ClearSelection(); try { this.ed_ddlCaste.Items.FindByValue(employee.EmpCaste).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlCaste.Items.FindByValue("null").Selected = true; } this.ed_ddlCategory.ClearSelection(); try { this.ed_ddlCategory.Items.FindByValue(employee.EmpGroup).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlCategory.Items.FindByValue("null").Selected = true; } this.ed_ddlReligion.ClearSelection(); try { this.ed_ddlReligion.Items.FindByValue(employee.EmpReligion).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlReligion.Items.FindByValue("null").Selected = true; } this.ed_ddlMStatus.ClearSelection(); try { this.ed_ddlMStatus.Items.FindByValue(employee.EmpMaritalStatus).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlMStatus.Items.FindByValue("null").Selected = true; } this.ed_ddlDepartment.ClearSelection(); try { this.ed_ddlDepartment.Items.FindByValue(employee.EmpDepartmentCD).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlDepartment.Items.FindByValue("null").Selected = true; } this.ed_ddlDesignation.ClearSelection(); try { this.ed_ddlDesignation.Items.FindByValue(employee.EmpDesignationCD).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlDesignation.Items.FindByValue("null").Selected = true; } this.ed_ddlGender.ClearSelection(); try { this.ed_ddlGender.Items.FindByValue(employee.EmpSex).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlGender.Items.FindByValue("null").Selected = true; } this.ed_ddlBloodGroup.ClearSelection(); try { this.ed_ddlBloodGroup.Items.FindByValue(employee.EmpBloodGroup).Selected = true; } catch (NullReferenceException ex) { this.ed_ddlBloodGroup.Items.FindByValue("null").Selected = true; } btnAdd.Enabled = false; } else { btnAdd.Enabled = true; } }