private void OptData() { /******** 可修改区域 Start ********/ Model.DataDictionary_Model model = GetNewDataModel(CurrentContext); /******** 可修改区域 End ********/ bool issuccess = false; string msg = string.Empty; try { if (IsAdd) { issuccess = bll.AddModel(model); msg = issuccess ? "添加成功。" : "添加失败!"; } else { issuccess = bll.UpdateModel(model); msg = issuccess ? "修改成功。" : "修改失败!"; } } catch (Exception ex) { issuccess = false; msg = string.Format("{0} {1}", msg, ex.Message); } ReturnMsg(issuccess, enumReturnTitle.OptData, msg); }
/******** 获取数据 可修改区域 Start ********/ private Model.DataDictionary_Model GetNewDataModel(HttpContext context) { Model.DataDictionary_Model model = new Model.DataDictionary_Model(); if (IsEdit) { model = bll.GetModelByKeyValue(_pKeyValue); if (null == model) { throw new HasNotRecordException(_pKeyValue); } } model.ID = string.IsNullOrWhiteSpace(_pKeyValue) ? 0 : int.Parse(_pKeyValue); model.CategoryCode = UrlHelper.ReqStrByGetOrPost(context, "CategoryCode"); model.DataKey = UrlHelper.ReqStrByGetOrPost(context, "DataKey"); model.DataValue = UrlHelper.ReqStrByGetOrPost(context, "DataValue"); model.OrderNumber = UrlHelper.ReqIntByGetOrPost(context, "OrderNumber"); return(model); }