/// <summary> /// 保存账户信息 /// </summary> private bool SaveAccountInfo() { try { //添加账户信息 if (!this._isEdit) { var newAccount = new AccountInfo() { AttributeCode = int.Parse(this.cbAttribute.SelectedValue()), AttributeName = this.cbAttribute.Text.Trim(), Code = this.txtCode.Text.Trim(), CommissionRate = decimal.Parse(this.txtCommissionRate.EditValue.ToString()), FinancingAmount = decimal.Parse(this.txtFinacingAmount.Text.Trim()), IncidentalsRate = decimal.Parse(this.txtIncidentalsRate.EditValue.ToString()), IndustryId = int.Parse(this.cbIndustry.SelectedValue()), InvestFund = decimal.Parse(this.txtInvestFund.Text.Trim()), IsDisabled = false, Name = this.txtAccountName.Text.Trim(), NeedAccounting = this.chkYes.Checked ? true : false, PlanCode = int.Parse(this.cbPlan.SelectedValue()), PlanName = this.cbPlan.Text.Trim(), Owner = this.luOwner.SelectedValue(), Remarks = this.memoRemarks.Text.Trim(), StampDutyRate = decimal.Parse(this.txtStampDutyRate.EditValue.ToString()), SecurityCompanyCode = int.Parse(this.cbSecurity.SelectedValue()), SecurityCompanyName = this.cbSecurity.Text.Trim(), TypeCode = int.Parse(this.cbType.SelectedValue()), TypeName = this.cbType.Text.Trim(), }; var isExisted = _accountService.IsExistedAccount(newAccount.Name, newAccount.SecurityCompanyCode, newAccount.AttributeCode); if (!isExisted) { _accountService.AddAccountInfo(newAccount); this._accountId = newAccount.Id; } else { DXMessage.ShowTips("系统已经存在账户名称、开发券商和账户属性相同的账户信息,无法添加!"); return(false); } } //修改账户信息 else { var account = _accountService.GetAccountInfoById(this._accountId); account.IndustryId = int.Parse(this.cbIndustry.SelectedValue()); account.SecurityCompanyCode = int.Parse(this.cbSecurity.SelectedValue()); account.SecurityCompanyName = this.cbSecurity.Text.Trim(); account.AttributeCode = int.Parse(this.cbAttribute.SelectedValue()); account.AttributeName = this.cbAttribute.Text.Trim(); account.TypeCode = int.Parse(this.cbType.SelectedValue()); account.TypeName = this.cbType.Text.Trim(); account.PlanCode = int.Parse(this.cbType.SelectedValue()); account.PlanName = this.cbPlan.Text.Trim(); account.Name = this.txtAccountName.Text.Trim(); account.Code = this.txtCode.Text.Trim(); account.Owner = this.luOwner.SelectedValue(); account.InvestFund = decimal.Parse(this.txtInvestFund.Text.Trim()); account.FinancingAmount = decimal.Parse(this.txtFinacingAmount.Text.Trim()); account.StampDutyRate = decimal.Parse(this.txtStampDutyRate.EditValue.ToString()); account.CommissionRate = decimal.Parse(this.txtCommissionRate.EditValue.ToString()); account.IncidentalsRate = decimal.Parse(this.txtIncidentalsRate.EditValue.ToString()); account.NeedAccounting = this.chkYes.Checked ? true : false; account.Remarks = this.memoRemarks.Text.Trim(); var isExisted = _accountService.IsExistedAccount(account.Name, account.SecurityCompanyCode, account.AttributeCode, account.Id); if (!isExisted) { _accountService.UpdateAccountInfo(account); } else { DXMessage.ShowTips("系统已经存在账户名称、开发券商和账户属性相同的账户信息,无法修改!"); return(false); } } } catch (Exception ex) { DXMessage.ShowError(ex.Message); return(false); } return(true); }