예제 #1
0
        private void OptData()
        {
            /********   可修改区域 Start  ********/
            Model.SystemSetup_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);
        }
예제 #2
0
        /********  获取数据  可修改区域 Start  ********/
        private Model.SystemSetup_Model GetNewDataModel(HttpContext context)
        {
            Model.SystemSetup_Model model = new Model.SystemSetup_Model();
            if (IsEdit)
            {
                model = bll.GetModelByKeyValue(_pKeyValue);

                if (null == model)
                {
                    throw new HasNotRecordException(_pKeyValue);
                }
            }

            model.ID = string.IsNullOrWhiteSpace(_pKeyValue) ? 0 : int.Parse(_pKeyValue);

            model.KeyCode = UrlHelper.ReqStrByGetOrPost(context, "KeyCode");

            model.SetupValue = UrlHelper.ReqStrByGetOrPost(context, "SetupValue");

            model.SetupType = UrlHelper.ReqStrByGetOrPost(context, "SetupType");

            model.Remark = UrlHelper.ReqStrByGetOrPost(context, "Remark");

            return(model);
        }
예제 #3
0
        private void GetCode_NumberAutoAdd()
        {
            string rltValue = "";
            string KeyCode  = UrlHelper.ReqStr("KeyCode");

            Model.SystemSetup_Model model = Bll.GetFirstModel(" SetupType='NumberAutoAdd'  and KeyCode='" + KeyCode + "'");
            if (null != model)
            {
                model.SetupValue = (int.Parse(model.SetupValue) + 1).ToString();
                Bll.UpdateModel(model);
                rltValue = model.SetupValue;
            }
            ReturnMsg(true, enumReturnTitle.GetData, rltValue);
        }