/////نمایش تیکت های ارسالی کارمندان خاشع///// public async Task <IEnumerable <DeveloperTicket> > GetTicket(string id) { var ticket = await(from a in _context.DeveloperTickets .Include(a => a.Person) where a.Active == true && a.PersonNational_ID == id select new DeveloperTicket { DeveloperTicket_ID = a.DeveloperTicket_ID, PersonNational_ID = a.PersonNational_ID, DateOfCreation = ConvertDate.ConvertSha(Convert.ToDateTime(a.DateOfCreation)), Active = a.Active, Status = a.Status, Person = a.Person, UnseenNumber = _context.DeveloperTicketChats.Where(s => s.DeveloperTicket_ID == a.DeveloperTicket_ID && s.Seen == false && s.PersonNational_ID != id).Count() }).OrderByDescending(o => o.DeveloperTicket_ID).ToListAsync(); return(ticket); }
//مشاهده مشتریان بر درخواست های ارسال شده و غیر فعال خود public async Task <IEnumerable <Ticket> > GetDiactiveTicket(string id) { var ticket = await(from a in _context.Tickets.Include(a => a.Services) .Include(a => a.Person) where a.Active == false && a.PersonNational_ID == id select new Ticket { Ticket_ID = a.Ticket_ID, Service_ID = a.Service_ID, Title = a.Title, PersonNational_ID = a.PersonNational_ID, DateOfCreation = ConvertDate.ConvertSha(Convert.ToDateTime(a.DateOfCreation)), Active = a.Active, Status = a.Status, Services = a.Services, Person = a.Person }).ToListAsync(); return(ticket); }
//نمایش پیام های مربوط به یک تیکت بر اساس اینکه کاربر مشتری باشد یا مدیر فنی public async Task <IEnumerable <TicketingChat> > GetTicketingChat(int id, string userId) { var user = await _context.People.SingleOrDefaultAsync(r => r.PersonNational_ID == userId); if (user.Role1 == 3) { var ticket = (from a in _context.TicketingChats.Include(a => a.Ticket) .Include(a => a.Person) where a.Ticket_ID == id && a.Confidential == false select new TicketingChat { TicketingChat_ID = a.TicketingChat_ID, Ticket_ID = a.Ticket_ID, Comment = a.Comment, CommentTime = ConvertDate.ConvertSha(Convert.ToDateTime(a.CommentTime)), PersonNational_ID = a.PersonNational_ID, Confidential = a.Confidential, Ticket = a.Ticket, Person = a.Person }).ToList(); return(ticket); } else { var ticket = await(from a in _context.TicketingChats.Include(a => a.Ticket) .Include(a => a.Person) where a.Ticket_ID == id select new TicketingChat { TicketingChat_ID = a.TicketingChat_ID, Ticket_ID = a.Ticket_ID, Comment = a.Comment, CommentTime = ConvertDate.ConvertSha(Convert.ToDateTime(a.CommentTime)), PersonNational_ID = a.PersonNational_ID, Confidential = a.Confidential, Ticket = a.Ticket, Person = a.Person }).ToListAsync(); return(ticket); } }
//مشاهده تیکت ها توسط مدیر فنی یا پشتیبان public async Task <IEnumerable <Ticket> > GetAllTickets(string id) { var tickets = await(from a in _context.Tickets.Include(a => a.Services) .Include(a => a.Person) where a.Resiver == id select new Ticket { Ticket_ID = a.Ticket_ID, Service_ID = a.Service_ID, Title = a.Title, PersonNational_ID = a.PersonNational_ID, DateOfCreation = ConvertDate.ConvertSha(Convert.ToDateTime(a.DateOfCreation)), Active = a.Active, Status = a.Status, Services = a.Services, Person = a.Person, UnseenNumber = _context.TicketingChats.Where(s => s.Ticket_ID == a.Ticket_ID && s.Seen == false && s.PersonNational_ID != id).Count() }).OrderByDescending(o => o.Ticket_ID).ToListAsync(); return(tickets); }