protected void btnDelete_ServerClick(object sender, EventArgs e) { try { if (gridEmployees.Selection.Count > 0) { var id = (Int32)gridEmployees.GetSelectedFieldValues("EmpId")[0]; var ml = new Employee_ML() { EmpId = Convert.ToInt32(id) }; new Employee_BL().DeleteEmployee(ml); GetEmployees(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#SelectErrorModal').modal('show')});</script>", false); } } catch (Exception) { throw; } }
private void GetEmployees() { var ml = new Employee_ML() { EmpName = string.IsNullOrEmpty(txtNameSearch.Text) ? "" : txtNameSearch.Text, EmpBranch = string.IsNullOrEmpty(txtBranchSearch.Text) ? "" : txtBranchSearch.Text }; gridEmployees.DataSource = new Employee_BL().GetEmployees(ml); gridEmployees.DataBind(); }
public bool DeleteEmployee(Employee_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@EmpId", ml.EmpId} }; return new DBAccessController().DeleteRecord(StoredProcedures.sp_RemoveEmployee, DataDic); } catch (System.Exception) { throw; } }
public DataTable GetEmployees(Employee_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@EmpName",ml.EmpName}, {"@EmpBranch",ml.EmpBranch} }; return new DBAccessController().RetriveRecordsWithPara(StoredProcedures.sp_GetEmployeeDetails, DataDic); } catch (System.Exception) { throw; } }
public bool AddEmployee(Employee_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@EmpName", ml.EmpName}, {"@EmpPhone",ml.EmpPhone}, {"@EmpEmail",ml.EmpEmail}, {"@EmpBranch",ml.EmpBranch} }; return new DBAccessController().InsertRecord(StoredProcedures.sp_AddEmployee, DataDic); } catch (System.Exception) { throw; } }
private void AddRecord() { try { var ml = new Employee_ML() { EmpName = txtName.Value, EmpPhone = txtMobile.Value, EmpEmail = txtEmail.Value, EmpBranch = txtBranch.Value }; var result = new Employee_BL().AddEmployee(ml); if (result) { GetEmployees(); } } catch (Exception) { throw; } }
protected void btnUpdate_ServerClick(object sender, EventArgs e) { try { var ml = new Employee_ML() { EmpId = (Int32)gridEmployees.GetSelectedFieldValues("EmpId")[0], EmpName = txtName.Value, EmpPhone = txtMobile.Value, EmpEmail = txtEmail.Value, EmpBranch = txtBranch.Value }; var result = new Employee_BL().UpdateEmployee(ml); if (result) { GetEmployees(); } } catch (Exception) { throw; } }