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