コード例 #1
0
ファイル: frmDepartment.cs プロジェクト: chinayinhui/LYLQ
        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();
        }
コード例 #2
0
ファイル: DepartmentModel.cs プロジェクト: chinayinhui/LYLQ
 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;
 }
コード例 #3
0
ファイル: DepartmentModel.cs プロジェクト: chinayinhui/LYLQ
 public void Create(DepartmentModel dpt)
 {
     var dbDpt = GetBizModel(dpt);
     _bizDepartment.Create(dbDpt);
 }
コード例 #4
0
ファイル: DepartmentModel.cs プロジェクト: chinayinhui/LYLQ
 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;
 }