Exemplo n.º 1
0
        protected override string uc_Update()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiContract") != "OK")
            {
                str = "";
            }
            else if (MyRule.AllowEdit)
            {
                //   SYS_LOG.Insert("Hợp Đồng Lao Động", "Cập Nhật", this.txtContractCode.Text);
                base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
                HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT();
                hRMCONTRACT = this.InitClass();
                string str1 = hRMCONTRACT.Update();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(hRMCONTRACT);
                }
                if (!(str1 != "OK"))
                {
                    HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE();
                    hRMEMPLOYEE.Get(this.glkEmployeeCode.EditValue.ToString());
                    if (hRMEMPLOYEE.ContractCode == this.txtContractCode.Text)
                    {
                        hRMEMPLOYEE.ContractCode     = this.txtContractCode.Text;
                        hRMEMPLOYEE.ContractType     = this.cboContractType.Text;
                        hRMEMPLOYEE.ContractSignDate = this.dtFromDate.DateTime;
                        hRMEMPLOYEE.ContractFromDate = this.dtFromDate.DateTime;
                        if (this.cboContractType.SelectedIndex != 1)
                        {
                            hRMEMPLOYEE.ContractToDate = this.dtToDate.DateTime;
                        }
                        else
                        {
                            SqlDateTime maxValue = SqlDateTime.MaxValue;
                            hRMEMPLOYEE.ContractToDate = Convert.ToDateTime(maxValue.ToString());
                        }
                        if (hRMEMPLOYEE.PayForm == 1)
                        {
                            hRMEMPLOYEE.PayMoney        = decimal.Parse(this.calBasicSalary.EditValue.ToString());
                            hRMEMPLOYEE.BasicSalary     = hRMEMPLOYEE.PayMoney;
                            hRMEMPLOYEE.InsuranceSalary = hRMEMPLOYEE.PayMoney;
                            hRMEMPLOYEE.DateSalary      = this.dtSignDate.DateTime;
                        }
                        hRMEMPLOYEE.Update();
                    }
                }
                else
                {
                    XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                this.DoHide();
                str = str1;
            }
            else
            {
                MyRule.Notify();
                str = "";
            }
            return(str);
        }