Exemple #1
0
        public bool Create(WxPostCaseViewModel model)
        {
            CaseService dbcase   = new CaseService();
            M_Case      caseitem = new M_Case()
            {
                CaseOfSubmit    = DateTime.Now,
                Complainant     = model.accuser,
                ComplainantId   = model.accuserid,
                DateOfBegin     = DateTime.Now,
                DateOfEnd       = DateTime.Now.AddDays(10),
                originalpay     = model.originalpay,
                Publisher       = model.accuser,
                PublisherId     = model.accuserid,
                Respondent      = model.respondent,
                RespondentId    = model.respondentid,
                StatementOfCase = model.description,
                StateOfCase     = model.state,
                Title           = model.title,
                OtherPay1       = model.otherPay1,
                OtherPay2       = model.otherPay2,
                OtherPay3       = model.otherPay3,
            };
            var result = dbcase.AddEntity(caseitem);

            if (result.ID != 0)
            {
                return(true);
            }
            return(false);
        }
Exemple #2
0
 /// <summary>
 /// 将Case原始模型转换成微信所需的格式
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 private BasicCaseViewModel _getBasicCase(M_Case c)
 {
     return(new BasicCaseViewModel()
     {
         id = c.ID,
         cover = "",
         description = c.StatementOfCase,
         numberOfComment = dbcomment.LoadEntities(t => t.CaseId == c.ID),
         numberOfJoin = dbpart.LoadEntities(t => t.CaseId == c.ID),
         numberOfFollow = dbfollow.LoadEntities(t => t.caseid == c.ID),
         start_at = c.DateOfBegin.ToShortDateString(),
         state = c.StateOfCase,
         title = c.Title,
     });
 }
Exemple #3
0
        public WxCaseDetailViewModel _getCaseDetailById(int id)
        {
            BasicUserViewModel respondent = new BasicUserViewModel();
            M_Case             caseinfo   = dbcase.LoadEntities(t => t.ID == id).FirstOrDefault();
            var parts = dbpart.LoadEntities(t => t.CaseId == id);

            if (caseinfo.RespondentId != null)
            {
                respondent = dbuser.GetBasicUserById(caseinfo.RespondentId);
            }
            else
            {
                respondent = new BasicUserViewModel()
                {
                    nickname = caseinfo.Respondent,
                }
            };
            var owner = dbuser.GetBasicUserById(caseinfo.PublisherId);

            return(new WxCaseDetailViewModel()
            {
                user = owner,
                basic = new BasicCaseViewModel()
                {
                    description = caseinfo.StatementOfCase,
                    id = caseinfo.ID,
                    numberOfComment = dbcomment.LoadEntities(t => t.CaseId == id),
                    title = caseinfo.Title,
                    start_at = caseinfo.DateOfBegin.ToShortDateString(),
                    state = caseinfo.StateOfCase,
                    numberOfJoin = dbpart.LoadEntities(t => t.CaseId == id),
                    numberOfFollow = dbfollow.LoadEntities(t => t.caseid == id),
                    otherPay1 = caseinfo.OtherPay1,
                    otherPay2 = caseinfo.OtherPay2,
                    otherPay3 = caseinfo.OtherPay3,
                },
                imageSrc = caseinfo.Photo,
                involves = PartInfo.Current.GetPartsByCaseId(id),
                respondent = respondent,
                respondentturnone = caseinfo.TrunOneComplainByRespondent ?? "",
                respondentturntwo = caseinfo.TrunTwoComplainByRespondent ?? "",
                userturnone = caseinfo.TrunOneComplainByComplainant ?? "",
                userturntwo = caseinfo.TrunTwoComplainByComplainant ?? "",
                condition = caseinfo.Condition,
                orginalpay = caseinfo.originalpay,
            });
        }
    }
Exemple #4
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);
        }