Ejemplo n.º 1
0
        public JsonResult DisposeQuestion(DisposeQuestionModel model)
        {
            JsonModel jm = new JsonModel();

            if (ModelState.IsValid)
            {
                //获取要处理的上报问题
                IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

                T_Question question = questionBll.GetEntity(m => m.Id == model.Id);
                if (question != null)
                {
                    //修改处理状态并添加处理记录
                    question.Status    = ConstantParam.DISPOSED;
                    question.IsPublish = model.IsPublish ? 1 : 0;
                    T_QuestionDispose questionDispose = new T_QuestionDispose()
                    {
                        DisposeDesc   = model.DisposeDesc,
                        DisposeUserId = GetSessionModel().UserID,
                        QuestionId    = model.Id,
                        DisposeTime   = DateTime.Now
                    };
                    //保存到数据库
                    questionBll.DisposeQuestion(question, questionDispose);

                    IUserPushBLL userPushBLL = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL");

                    var userPush = userPushBLL.GetEntity(p => p.UserId == question.UploadUserId);
                    if (userPush != null)
                    {
                        string registrationId = userPush.RegistrationId;
                        string alert          = "您" + question.UploadTime.ToString("yyyy-MM-dd HH:mm") + "上报的问题已处理";
                        //通知信息
                        bool flag = PropertyUtils.SendPush("上报问题处理", alert, ConstantParam.MOBILE_TYPE_OWNER, registrationId);
                        if (!flag)
                        {
                            jm.Msg = "推送发生异常";
                        }
                    }

                    //日志记录
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    jm.Msg = "该问题不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult DisposeQuestion(int id)
        {
            IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

            T_Question question = questionBll.GetEntity(m => m.Id == id);

            if (question != null)
            {
                DisposeQuestionModel model = new DisposeQuestionModel()
                {
                    Id    = question.Id,
                    Title = question.Title
                };
                return(View(model));
            }
            else
            {
                return(RedirectToAction("QuestionList"));
            }
        }