private void btnSave_Click(object sender, EventArgs e) { var bll = new InsuranceFundBLL(); var fund = new InsuranceFund(); fund.InsuranceFundType = (int)InsuranceFundType.住房公积金; fund.Number = this.txtHouseNumber.Text; fund.PaymentAddress = this.txtHousePaymentAddress.Text; fund.PaymentStartDate = this.dtphousePaymentStartDate.Value; if (this.dtpHousePaymentEndDate.Checked) { fund.PaymentEndDate = this.dtpHousePaymentEndDate.Value; } if (!string.IsNullOrWhiteSpace(this.txtHouseBasicNum.Text)) { fund.BasicNum = float.Parse(this.txtHouseBasicNum.Text); } var insurance = new InsuranceFund(); insurance.InsuranceFundType = (int)InsuranceFundType.社保; insurance.Number = this.txtSocialNumber.Text; insurance.PaymentAddress = this.txtSocialPaymentAddress.Text; insurance.PaymentStartDate = this.dtpSocialPaymentStartDate.Value; if (this.dtpSocialPaymentEndDate.Checked) { insurance.PaymentEndDate = this.dtpSocialPaymentEndDate.Value; } if (!string.IsNullOrWhiteSpace(this.txtSocialBasicNum.Text)) { insurance.BasicNum = float.Parse(this.txtSocialBasicNum.Text); } var result = true; if (isEdit) { fund.InsuranceFundID = this._fundID.Value; result = result && bll.UpdateInsuranceFund(fund).Data; insurance.InsuranceFundID = this._insuranceID.Value; result = result && bll.UpdateInsuranceFund(insurance).Data; } else { fund.PeopleID = this._currentPeopleID; result = result && bll.InsertInsuranceFund(fund).Data; insurance.PeopleID = this._currentPeopleID; result = result && bll.InsertInsuranceFund(insurance).Data; } if (result) { MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } }