Exemplo n.º 1
0
        public ActionResult SetQuestionDisposer(int id)
        {
            //获取当前物业小区ID
            int currentPlaceId = GetSessionModel().PropertyPlaceId.Value;

            //获取要处理的上报问题
            IQuestionBLL resultBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

            var result = resultBll.GetEntity(r => r.Id == id);

            //如果上报问题结果不为空且未指派处理人
            if (result != null && result.DisposerId == null)
            {
                //初始化异常处理模型
                SetQuestionDisposerModel model = new SetQuestionDisposerModel()
                {
                    Id    = result.Id,
                    Title = result.Title,
                    Desc  = result.Desc
                };
                model.UserList = GetUserList(currentPlaceId);
                return(View(model));
            }
            else
            {
                return(RedirectToAction("QuestionList"));
            }
        }
Exemplo n.º 2
0
        public JsonResult SetQuestionDisposer(SetQuestionDisposerModel model)
        {
            JsonModel jm = new JsonModel();

            if (ModelState.IsValid)
            {
                //获取要指派处理人的上报问题结果
                IQuestionBLL resultBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

                T_Question result = resultBll.GetEntity(m => m.Id == model.Id);
                if (result != null)
                {
                    //指派处理人
                    result.DisposerId = model.DisposerId;
                    //保存到数据库
                    if (resultBll.Update(result))
                    {
                        //日志记录
                        jm.Content = PropertyUtils.ModelToJsonString(model);

                        //推送给处理人
                        IPropertyUserPushBLL userPushBLL = BLLFactory <IPropertyUserPushBLL> .GetBLL("PropertyUserPushBLL");

                        var userPush = userPushBLL.GetEntity(p => p.UserId == model.DisposerId);
                        if (userPush != null)
                        {
                            string registrationId = userPush.RegistrationId;
                            //通知信息
                            bool flag = PropertyUtils.SendPush("业主上报问题", "有新的问题需要您处理,请查看", ConstantParam.MOBILE_TYPE_PROPERTY, registrationId);
                            if (!flag)
                            {
                                jm.Msg = "推送发生异常";
                            }
                        }
                    }
                    else
                    {
                        jm.Msg = "指派处理人失败";
                    }
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }