private void btnSave_Click(object sender, EventArgs e) { if (this.btnSave.Tag == null) { //Add DepartmentModel dptModel = new DepartmentModel(); dptModel.Name = this.txtDptName.Text.Trim(); dptModel.Code = this.txtDptCode.Text.Trim(); dptModel.CreatedBy = UIContext.LoginUser.Account; dptModel.CreatedDate = DateTime.Now; dptModel.UpdatedBy = UIContext.LoginUser.Account; dptModel.UpdatedDate = DateTime.Now; if (this.rboIn.Checked) { dptModel.Type = (int)DepartmentModel.DeptType.IN; } else { dptModel.Type = (int)DepartmentModel.DeptType.OUT; } _departmentModel.Create(dptModel); btnClear_Click(null, null); } else { var dptModel = new DepartmentModel(); dptModel.Code = this.txtDptCode.Text.Trim(); dptModel.Name = this.txtDptName.Text.Trim(); dptModel.UpdatedBy = UIContext.LoginUser.Account; dptModel.UpdatedDate = DateTime.Now; _departmentModel.Update(dptModel); btnClear_Click(null, null); } this.grdDpt.DataSource = _departmentModel.GetAll(); }
public DepartmentModel GetEntityFromBiz(BizLayer.Department bizDpt) { DepartmentModel dpt = null; if (bizDpt != null) { dpt = new DepartmentModel(); dpt.Code = bizDpt.Code; dpt.Name = bizDpt.Name; dpt.CreatedBy = bizDpt.CreatedBy; dpt.CreatedDate = bizDpt.CreatedDate; dpt.UpdatedBy = bizDpt.UpdatedBy; dpt.UpdatedDate = bizDpt.UpdatedDate; dpt.Type = bizDpt.Type; } return dpt; }
public void Create(DepartmentModel dpt) { var dbDpt = GetBizModel(dpt); _bizDepartment.Create(dbDpt); }
public BizLayer.Department GetBizModel(DepartmentModel dpt) { BizLayer.Department bizDpt = null; if (dpt != null) { bizDpt = new BizLayer.Department(); bizDpt.Code = dpt.Code; bizDpt.Name = dpt.Name; bizDpt.CreatedBy = dpt.CreatedBy; bizDpt.CreatedDate = dpt.CreatedDate; bizDpt.UpdatedBy = dpt.UpdatedBy; bizDpt.UpdatedDate = dpt.UpdatedDate; bizDpt.Type = dpt.Type; } return bizDpt; }