Example #1
0
        public ActionResult publish(casepublist modal)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Redirect("/home"));
            }
            //判断是否存在respondid 存在的话是站内输入  不存在的话是手动输入
            //if (modal.respondentid == null)
            //{
            //    if (modal.respondent == null) { }
            //    ModelState.AddModelError("","应诉人不能为空");
            //    return View();
            //}

            //应诉人可以为空
            if (string.IsNullOrEmpty(modal.content))
            {
                ModelState.AddModelError("", "案件内容不能为空");
                return(View());
            }
            if (modal.content.Length < 50)
            {
                ModelState.AddModelError("", "输入的案件信息需要在50字以上,请补充内容");
                return(View());
            }
            CaseInfo dbcase = new CaseInfo();
            var      result = dbcase.PublishCase(modal);

            if (result == 1)
            {
                return(Redirect("/home"));
            }
            ModelState.AddModelError("", "发布案件出现问题,请修改信息后重新发布");
            return(View());
        }
Example #2
0
        /// <summary>
        /// 发布案件
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int PublishCase(casepublist model)
        {
            CaseService dbcase = new CaseService();

            //应诉人是站内的用户
            if (model.respondentid != null)
            {
                M_Case caseitem = new M_Case
                {
                    CaseOfSubmit    = DateTime.Now,
                    Complainant     = model.publishname,
                    ComplainantId   = model.publishid,
                    DateOfBegin     = DateTime.Now,
                    DateOfEnd       = DateTime.Now.AddDays(10),
                    originalpay     = int.Parse(model.paynum),
                    Publisher       = model.publishname,
                    PublisherId     = model.publishid,
                    Respondent      = model.respondent,
                    RespondentId    = model.respondentid,
                    StatementOfCase = model.content,
                    StateOfCase     = model.savemod == "保存"?WholeSituation.CaseState.DRAFT:WholeSituation.CaseState.PUBLISH,
                    Title           = model.casetitle,
                    OtherPay1       = model.paymod1,
                    OtherPay2       = model.paymod2,
                    OtherPay3       = model.paymod3,
                };
                var result = dbcase.AddEntity(caseitem);
                if (result.ID != 0)
                {
                    return(1);
                }
            }
            //应诉人是手写的用户 没有应诉人id
            else
            {
                M_Case caseitem = new M_Case
                {
                    CaseOfSubmit      = DateTime.Now,
                    Complainant       = model.publishid,
                    ComplainantId     = model.publishid,
                    DateOfBegin       = DateTime.Now,
                    DateOfEnd         = DateTime.Now.AddDays(10),
                    originalpay       = int.Parse(model.paynum),
                    Publisher         = model.publishname,
                    PublisherId       = model.publishid,
                    Respondent        = model.respondent,
                    RespondentEmail   = model.respondentEmail,
                    RespondentAddress = model.respondentAddress,
                    RespondentPhone   = model.respondentPhone,
                    StatementOfCase   = model.content,
                    StateOfCase       = model.savemod == "保存" ? WholeSituation.CaseState.DRAFT : WholeSituation.CaseState.PUBLISH,
                    Title             = model.casetitle,
                    OtherPay1         = model.paymod1,
                    OtherPay2         = model.paymod2,
                    OtherPay3         = model.paymod3,
                };
                var result = dbcase.AddEntity(caseitem);
                if (result.ID != 0)
                {
                    return(1);
                }
            }
            return(1);
        }