Esempio n. 1
0
        public Ticket AddSupportTicket(Ticket supportTicket)
        {
            var obj = ticketRepository.Add(supportTicket);

            var noti = new Notification()
            {
                Id = Guid.NewGuid(),
                To = "admin",
                CreateBy = supportTicket.CreateBy,
                CreateAt = DateTime.Now,
                Read = false,
                Title = supportTicket.Title

            };

            notificationRepository.Add(noti);

            return obj;
        }
Esempio n. 2
0
        public Ticket UpdateSupportTicket(Ticket supportTicket)
        {
            var obj = ticketRepository.Update(supportTicket);

            return obj;
        }
Esempio n. 3
0
        public Ticket ReplySupportTicket(Ticket supportTicket)
        {
            foreach (var item in supportTicket.TicketItems)
            {
                if (item.Id == Guid.Empty)
                {
                    item.Id = Guid.NewGuid();
                    ticketItemRepository.Add(item);
                }
            }

            //Notify to ticket owner
            var noti = new Notification()
            {
                Id = Guid.NewGuid(),
                To = supportTicket.CreateBy,
                CreateBy = supportTicket.CreateBy,
                CreateAt = DateTime.Now,
                Read = false,
                Title = supportTicket.Title

            };

            notificationRepository.Add(noti);
            return supportTicket;
        }
Esempio n. 4
0
        public JsonResult PostTicketMessage(Ticket supportTicket)
        {
            if (supportTicket != null)
            {

                // UPdate Ticket Items
                if (supportTicket.TicketItems != null)
                {
                    foreach (var item in supportTicket.TicketItems)
                    {
                        item.SupportTicketId = supportTicket.Id;
                        item.CreateAt = DateTime.Now;
                        item.CreateBy = User.Identity.Name;
                    }
                }
                supportService.ReplySupportTicket(supportTicket);
                return Json(true);
            }
            return Json(false);
        }
Esempio n. 5
0
        public JsonResult PostRaiseTicket(Ticket ticket)
        {
            if (ticket != null)
            {
                ticket.Id = Guid.NewGuid();
                ticket.Status = "Open";
                ticket.CreateBy = User.Identity.Name;

                foreach (var item in ticket.TicketItems)
                {
                    item.Id = Guid.NewGuid();
                    item.SupportTicketId = ticket.Id;
                    item.CreateAt = DateTime.Now;
                    item.CreateBy = User.Identity.Name;
                }

                supportService.AddSupportTicket(ticket);
                return Json(true);
            }
            return Json(false);
        }
Esempio n. 6
0
        public JsonResult GetRaiseTicket()
        {
            List<Ticket> lst = new List<Ticket>();
            var result = supportService.GetSupportTickets();
            foreach (var item in result)
            {
                var ticket = new Ticket()
                {
                    Id = item.Id,
                    Title = item.Title,
                    CreateBy = item.CreateBy,
                    Status = item.Status
                };

                ticket.TicketItems = new List<TicketItem>();

                if (item.TicketItems != null)
                {
                    foreach (var tItem in item.TicketItems)
                    {
                        var ticketItem = new TicketItem()
                        {
                            Id = tItem.Id,
                            SupportTicketId = tItem.SupportTicketId,
                            CreateBy = tItem.CreateBy,
                            CreateAt = tItem.CreateAt,
                            Message = tItem.Message,
                            Read = tItem.Read

                        };

                        ticket.TicketItems.Add(ticketItem);
                    }

                }

                lst.Add(ticket);

            }
            return Json(lst, JsonRequestBehavior.AllowGet);
        }