protected void btnSave_Click(object sender, EventArgs e) { var obj = new DEPARTMENT(); obj.DEPARTMENT_CODE = popTxtDepartmentCode.Text; obj.DEPARTMENT_NAME = txtDepartmentName.Text; var cmd = new DepartmentService(obj); if (flag.Text.Equals("Add")) { obj.Action = ActionEnum.Create; obj.CREATE_DATE = DateTime.Now; obj.CREATE_EMPLOYEE_ID = 0; obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Add(); } else { obj.Action = ActionEnum.Update; obj.DEPARTMENT_ID = Convert.ToInt32(ViewState["depId"].ToString()); obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Edit(); } ViewState["depId"] = null; Response.Redirect("SearchDepartment.aspx"); }
public DepartmentService(DEPARTMENT item) { _item = item; }
private void InitialDataPopup() { if (ViewState["depId"] != null) { var cmd = new DepartmentService(); _department = cmd.Select(Convert.ToInt32(ViewState["depId"].ToString())); if (_department != null) { popTxtDepartmentCode.Text = _department.DEPARTMENT_CODE; txtDepartmentName.Text = _department.DEPARTMENT_NAME; flag.Text = "Edit"; } } }
public List<DEPARTMENT> GetALL(DEPARTMENT item) { using (var ctx = new SPWEntities()) { var list = ctx.DEPARTMENT.Where(x => x.DEPARTMENT_CODE.Contains(item.DEPARTMENT_CODE)).ToList(); return list; } }