Пример #1
0
        public JsonResult UpdateAgreement(int agreementType, string agreementContent)
        {
            var  model     = SystemAgreementApplication.GetAgreement((Entities.AgreementInfo.AgreementTypes)agreementType);
            bool isSuccess = false;

            if (model == null)
            {//第一次修改,则新增
                model = new Entities.AgreementInfo();
                model.AgreementType    = agreementType.ToEnum <Entities.AgreementInfo.AgreementTypes>(Entities.AgreementInfo.AgreementTypes.Buyers);
                model.AgreementContent = ProcessHtml(agreementContent);
                SystemAgreementApplication.AddAgreement(model);
                isSuccess = true;
            }
            else
            {
                model.AgreementType    = agreementType.ToEnum <Entities.AgreementInfo.AgreementTypes>(Entities.AgreementInfo.AgreementTypes.Buyers);
                model.AgreementContent = ProcessHtml(agreementContent);
                isSuccess = SystemAgreementApplication.UpdateAgreement(model);
            }
            if (isSuccess)
            {
                return(Json(new Result()
                {
                    success = true, msg = "更新协议成功!"
                }));
            }
            else
            {
                return(Json(new Result()
                {
                    success = false, msg = "更新协议失败!"
                }));
            }
        }
Пример #2
0
        public JsonResult UpdateAgreement(int agreementType, string agreementContent)
        {
            AgreementInfo agreement = SystemAgreementApplication.GetAgreement((AgreementInfo.AgreementTypes)agreementType);
            bool          flag      = false;

            if (agreement == null)
            {
                agreement = new AgreementInfo
                {
                    AgreementType    = agreementType,
                    AgreementContent = this.ProcessHtml(agreementContent)
                };
                SystemAgreementApplication.AddAgreement(agreement);
                flag = true;
            }
            else
            {
                agreement.AgreementType    = agreementType;
                agreement.AgreementContent = this.ProcessHtml(agreementContent);
                flag = SystemAgreementApplication.UpdateAgreement(agreement);
            }
            if (flag)
            {
                BaseController.Result result = new BaseController.Result
                {
                    success = true,
                    msg     = "更新协议成功!"
                };
                return(base.Json(result));
            }
            BaseController.Result data = new BaseController.Result
            {
                success = false,
                msg     = "更新协议失败!"
            };
            return(base.Json(data));
        }