예제 #1
0
        /// <summary>
        /// 提交新工单
        /// </summary>
        /// <param name="t">工单信息</param>
        /// <param name="tc">内容信息</param>
        void ITicket.Publish(TTicket t, TTicketChat tc)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                m_iTicket.Create(t);

                m_iTicket.AddReply(t, new TTicketChat
                {
                    TicketId = t.TicketId,
                    Content  = tc.Content,
                    UserId   = tc.UserId,
                    Annex    = tc.Annex
                });

                scope.Complete();
            }
        }
예제 #2
0
        public ActionResult <Result> Reply([FromBody] TTicketChat tc)
        {
            string user_id = Token.GetUserId(HttpContext.Request.Headers["Authorization"].ToString().Substring(7));
            TUser  user    = userServer.Retrieve(new TUser()
            {
                UserId = user_id
            });

            TTicket t = ticketServer.Retrieve(new TTicket {
                TicketId = tc.TicketId
            });

            if (t.UserId != user.UserId && user.Super == 0)
            {
                throw new ResultException("无权操作");
            }

            if (t == null)
            {
                throw new ResultException("工单不存在");
            }

            if (tc.Content == null || tc.Content == "")
            {
                throw new ResultException("工单内容为空");
            }

            if (t.UserId != user.UserId)
            {
                t.StatusId = 700002;//等待回复
            }
            ticketServer.AddReply(t, new TTicketChat
            {
                TicketId = t.TicketId,
                Content  = tc.Content,
                Annex    = tc.Annex,
                UserId   = user.UserId
            });

            return(new Result(200, "成功"));
        }