protected void btnUpdate_Click(object sender, EventArgs e) { if (this.FormCheck()) { try { HR_Payment PaymentSer = getPayment(); if (Convert.ToInt32(DBHelp.ExeScalar("select count(*) from HR_Payment where ID=" + base.Request["Code"] + " and YearMonth='" + PaymentSer.YearMonth + "'")) > 0) { this.PaymentSer.Update(PaymentSer); } else { this.PaymentSer.Add(PaymentSer); } base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('保存成功!');</script>"); } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } } }
private void IniData(string Yearmonth) { HR_Payment Payment = this.PaymentSer.GetModel(Convert.ToInt32(base.Request["Code"]), Yearmonth); HR_PERSON Salary = this.perSer.GetSalary(Convert.ToInt32(base.Request["Code"])); if (Payment != null) { this.lblName.Text = Payment.Name; this.ddlYear.SelectedValue = Payment.YearMonth.Substring(0, 4); this.ddlMonth.SelectedValue = Payment.YearMonth.Substring(5, 2); this.txtBasicSalary.Text = Payment.BasicSalary.ToString(); this.txtFullAttendence.Text = Payment.FullAttendence.ToString(); this.txtMobileFee.Text = Payment.MobileFee.ToString(); this.txtSpecialAward.Text = Payment.SpecialAward.ToString(); this.txtSpecialAwardNote.Text = Payment.SpecialAwardNote.ToString(); this.txtGonglin.Text = Payment.GongLin.ToString(); this.txtPositionPerformance.Text = Payment.PositionPerformance.ToString(); this.txtPositionFee.Text = Payment.PositionFee.ToString(); this.txtWorkPerformance.Text = Payment.WorkPerformance.ToString(); this.lblFullPayment.Text = Payment.FullPayment.ToString(); this.txtWorkDays.Text = Payment.WorkDays.ToString(); this.lblDefaultWorkDays.Text = Payment.DefaultWorkDays.ToString(); this.lblShouldPayment.Text = Payment.ShouldPayment.ToString(); this.txtUnionFee.Text = Payment.UnionFee.ToString(); this.txtDeduction.Text = Payment.Deduction.ToString(); this.txtDeductionNote.Text = Payment.DeductionNote.ToString(); this.txtYangLaoJin.Text = Payment.YangLaoJin.ToString(); this.lblActualPayment.Text = Payment.ActualPayment.ToString(); if (Payment.UpdateTime != null) { this.txtUpdateTime.Text = Payment.UpdateTime.ToString(); } if (Payment.UpdatePersonName != null) { txtUpdatePerson.Text = Payment.UpdatePersonName.ToString(); } } else { this.lblName.Text = Salary.Name; this.txtBasicSalary.Text = Salary.BasicSalary.ToString(); this.txtGonglin.Text = Salary.GongLin.ToString(); this.txtMobileFee.Text = Salary.MobileFee.ToString(); this.txtPositionFee.Text = Salary.PositionFee.ToString(); this.txtYangLaoJin.Text = Salary.YangLaoJin.ToString(); this.txtUnionFee.Text = Salary.UnionFee.ToString(); this.lblDefaultWorkDays.Text = Salary.DefaultWorkDays.ToString(); } this.ChkRetailed.Checked = Salary.IsRetailed; this.ChkQuit.Checked = Salary.IsQuit; if (Salary.OnBoardTime != null) { OnBoadTime = (DateTime)Salary.OnBoardTime; this.lblOnBoardTime.Text = OnBoadTime.ToString("yyyy-MM-dd"); } if (Salary.QuitTime != null) { QuitTime = (DateTime)Salary.OnBoardTime; this.lblQuitTime.Text = QuitTime.ToString("yyyy-MM-dd"); } if (this.ChkRetailed.Checked) { this.txtPositionPerformance.Enabled = false; this.txtPositionPerformance.Text = "0"; this.txtWorkPerformance.Enabled = false; this.txtWorkPerformance.Text = "0"; this.txtYangLaoJin.Enabled = false; this.txtYangLaoJin.Text = "0"; } }