/// <summary> /// 点击保存 /// </summary> private void btnSave_MouseDown(object sender, MouseButtonEventArgs e) { if (txtMoney.Text.Trim().Length == 0) { Message.ShowMessage("金额不能为空", this, errorFlg: true); return; } // 得到分类号 string sortCd = cmbSort.SelectedValue.ToString(); decimal money = Convert.ToDecimal(txtMoney.Text); if (!this.isDoing) { this.isDoing = true; if (!this.isEdit) { if (this.accountDate.HasValue) { if (service.AddAccount(sortCd, money, txtComments.Text, this.accountDate.Value)) { this.main.SuccessFlg = true; } } else { if (service.AddAccount(sortCd, money, txtComments.Text)) { this.main.SuccessFlg = true; } } } else { if (service.EditAccount(this.accountDate.Value, sortCd, money, txtComments.Text)) { this.main.SuccessFlg = true; } } } this.Close(); }