コード例 #1
0
ファイル: TaskController.cs プロジェクト: Michauxquan/MTest
        public JsonResult SavaTaskReply(string reply, string userID, string clientID, string taskID)
        {
            var    model   = JsonConvert.DeserializeObject <IntFactoryEntity.ReplyJson>(reply);
            string replyID = ReplyBusiness.CreateTaskReply(model.taskID, model.content, userID, clientID,
                                                           model.fromReplyID, model.fromReplyUserID, model.fromReplyAgentID);

            ReplyBusiness.AddTaskReplyAttachments(taskID, replyID, model.attachments, userID, clientID);

            if (!string.IsNullOrEmpty(replyID))
            {
                List <Dictionary <string, object> > replys   = new List <Dictionary <string, object> >();
                Dictionary <string, object>         replyObj = new Dictionary <string, object>();
                replyObj.Add("replyID", replyID);
                replyObj.Add("taskID", model.taskID);
                replyObj.Add("content", model.content);
                replyObj.Add("createUser", GetUserBaseObj(OrganizationBusiness.GetUserCacheByUserID(userID, clientID)));
                if (!string.IsNullOrEmpty(model.fromReplyUserID) && !string.IsNullOrEmpty(model.fromReplyAgentID))
                {
                    replyObj.Add("fromReplyUser", GetUserBaseObj(OrganizationBusiness.GetUserCacheByUserID(model.fromReplyUserID, model.fromReplyAgentID)));
                }
                replyObj.Add("attachments", model.attachments);
                replyObj.Add("createTime", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
                replys.Add(replyObj);

                JsonDictionary.Add("taskReplys", replys);
            }

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #2
0
ファイル: TaskController.cs プロジェクト: Michauxquan/MTest
        public JsonResult GetTaskReplys(string taskID, string userID, string clientID, int pageSize = 10, int pageIndex = 1)
        {
            if (!string.IsNullOrEmpty(taskID))
            {
                int pageCount  = 0;
                int totalCount = 0;
                var list       = ReplyBusiness.GetTaskReplys(taskID, pageSize, pageIndex, ref totalCount, ref pageCount);
                List <Dictionary <string, object> > replys = new List <Dictionary <string, object> >();

                foreach (var item in list)
                {
                    Dictionary <string, object> reply = new Dictionary <string, object>();
                    reply.Add("replyID", item.ReplyID);
                    reply.Add("taskID", item.GUID);
                    reply.Add("content", item.Content);
                    reply.Add("createUser", GetUserBaseObj(item.CreateUser));
                    reply.Add("fromReplyUser", GetUserBaseObj(item.FromReplyUser));
                    reply.Add("createTime", item.CreateTime.ToString("yyyy-MM-dd hh:mm:ss"));
                    reply.Add("attachments", item.Attachments);
                    replys.Add(reply);
                }

                JsonDictionary.Add("taskReplys", replys);
                JsonDictionary.Add("totalCount", totalCount);
                JsonDictionary.Add("pageCount", pageCount);
            }

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #3
0
ファイル: PlugController.cs プロジェクト: Michauxquan/MTest
        public JsonResult GetReplys(string guid, EnumLogObjectType type, int pageSize, int pageIndex)
        {
            int totalCount = 0;
            int pageCount  = 0;

            var list = ReplyBusiness.GetReplys(guid, type, pageSize, pageIndex, ref totalCount, ref pageCount, CurrentUser.ClientID);

            JsonDictionary.Add("items", list);
            JsonDictionary.Add("totalCount", totalCount);
            JsonDictionary.Add("pageCount", pageCount);

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #4
0
ファイル: PlugController.cs プロジェクト: Michauxquan/MTest
        public JsonResult SavaReply(EnumLogObjectType type, string entity, string attchmentEntity)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            ReplyEntity          model      = serializer.Deserialize <ReplyEntity>(entity);

            model.Attachments = serializer.Deserialize <List <Attachment> >(attchmentEntity);
            string replyID = "";

            switch (type)
            {
            case EnumLogObjectType.Customer:
                replyID = ReplyBusiness.CreateCustomerReply(model.GUID, model.Content, CurrentUser.UserID, CurrentUser.ClientID, model.FromReplyID, model.FromReplyUserID, model.FromReplyAgentID);
                ReplyBusiness.AddCustomerReplyAttachments(model.GUID, replyID, model.Attachments, CurrentUser.UserID, CurrentUser.ClientID);
                break;

            case EnumLogObjectType.OrderTask:
                replyID = ReplyBusiness.CreateTaskReply(model.GUID, model.Content, CurrentUser.UserID, CurrentUser.ClientID, model.FromReplyID, model.FromReplyUserID, model.FromReplyAgentID);
                ReplyBusiness.AddTaskReplyAttachments(model.GUID, replyID, model.Attachments, CurrentUser.UserID, CurrentUser.ClientID);
                break;
            }


            List <ReplyEntity> list = new List <ReplyEntity>();

            if (!string.IsNullOrEmpty(replyID))
            {
                model.ReplyID      = replyID;
                model.CreateTime   = DateTime.Now;
                model.CreateUser   = OrganizationBusiness.GetUserCacheByUserID(CurrentUser.UserID, CurrentUser.ClientID);;
                model.CreateUserID = CurrentUser.UserID;
                if (!string.IsNullOrEmpty(model.FromReplyUserID) && !string.IsNullOrEmpty(model.FromReplyAgentID))
                {
                    model.FromReplyUser = OrganizationBusiness.GetUserCacheByUserID(model.FromReplyUserID, model.FromReplyAgentID);
                }
                list.Add(model);
            }
            JsonDictionary.Add("items", list);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }