/// <summary> /// 实体赋值 /// </summary> /// <param name="model"></param> /// <param name="msg"></param> /// <returns></returns> private bool GetVal(MKingDeeSubject model, ref string msg) { model = model ?? new MKingDeeSubject(); //科目编号(添加没值,修改有值) model.SubjectId = Utils.GetInt(Utils.GetQueryStringValue("SubjectId")); //系统公司编号 model.CompanyId = CurrentUserCompanyID; //核算项目名称 model.ChkItem = Utils.GetFormValue("ChkItem"); //核算项目ID model.ChkId = Utils.GetFormValue("ChkItemId"); //助记码 model.MnemonicCd = Utils.GetFormValue("MnemonicCd"); //父级科目编号 model.PreSubjectId = Utils.GetInt(Utils.GetFormValue("PreSubjectId")); //父级科目名称 model.PreSubjectNm = Utils.GetFormValue("PreSubjectNm"); //科目代码 model.SubjectCd = Utils.GetFormValue("SubjectCd"); //科目名称 model.SubjectNm = Utils.GetFormValue("SubjectNm"); //科目类型 model.SubjectTyp = (FinanceAccountItem)Utils.GetInt(Utils.GetFormValue("SubjectTyp")); model.ItemId = Utils.GetFormValue("ItemId"); msg += model.SubjectCd.Length > 0 ? string.Empty : "科目代码不能为空!<br/>"; msg += model.SubjectNm.Length > 0 ? string.Empty : "科目名称不能为空!<br/>"; return(msg.Length <= 0); }
/// <summary> /// 保存 /// </summary> private void Save() { MKingDeeSubject model = new MKingDeeSubject(); string msg = string.Empty; if (GetVal(model, ref msg)) { string[] msgarr = { UtilsCommons.AjaxReturnJson("1"), UtilsCommons.AjaxReturnJson("-1","保存失败!"), UtilsCommons.AjaxReturnJson("-1","科目代码已存在"), UtilsCommons.AjaxReturnJson("-1","该科目已被使用") }; AjaxResponse(msgarr[new BFinance().AddOrUpdKingDeeSubject(model)]); } AjaxResponse(UtilsCommons.AjaxReturnJson("-1", msg)); }