public ActionResult DisplayTicket(long ticketId) { Ticket ticket = Ticket.GetTicket(ticketId); Customer cust = Customer.GetCustomer(ticket.Requester); ViewModel.Ticket m = new ViewModel.Ticket(ticket, cust); var list = TicketHistoryInfoList.GetTicketActivityByTicketNo(ticket.TicketNo).ToList(); List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } list = list.Where(x => agenIdList.Contains(x.TicketOwner)).OrderByDescending(x => x.UpdatedDate).ToList(); ViewBag.TicketHistory = list; return(View(m)); }
// GET: Report public ActionResult IndexReport() { List <ISAT.Web.ViewModel.ReportVM> list = new List <ViewModel.ReportVM>(); string username = User.Identity.Name; List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(username); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } var openList = ISAT.Business.TicketInfoList.GetReportOpenTicket().Where(x => agenIdList.Contains(x.TicketOwner)).OrderByDescending(x => x.CreatedDate); var closedList = ISAT.Business.TicketInfoList.GetReportCloseTicket().Where(x => agenIdList.Contains(x.TicketOwner)).OrderByDescending(x => x.CreatedDate); var newopenList = from c in openList select new ReportVM { TicketId = c.idticket, Subject = c.TicketSubject, NamaCustomer = c.NamaCustomer, Requester = GetRequesterFullName(c.Requester), CreatedDate = c.CreatedDate.ToString("dd MMM yyyy HH':'mm"), UpdatedDate = c.UpdatedDate.ToString("dd MMM yyyy HH':'mm"), Priority = c.Priority, TicketOwner = c.TicketOwner, Status = c.TicketStatus }; var newcloseList = from c in closedList select new ReportVM { TicketId = c.idticket, Subject = c.TicketSubject, NamaCustomer = c.NamaCustomer, Requester = GetRequesterFullName(c.Requester), CreatedDate = c.CreatedDate.ToString("dd MMM yyyy HH':'mm"), UpdatedDate = c.UpdatedDate.ToString("dd MMM yyyy HH':'mm"), Priority = c.Priority, TicketOwner = c.TicketOwner, Status = c.TicketStatus }; list.AddRange(newopenList); list.AddRange(newcloseList); return(View(list)); }
public JsonResult DayToDay(string ticketType) { DateTime baseDate = DateTime.Today; DateTime startDate = baseDate.AddDays(-(int)baseDate.DayOfWeek); DateTime endDate = startDate.AddDays(7).AddSeconds(-1); TicketInfoList list = null; if (!string.IsNullOrEmpty(ticketType)) { list = TicketInfoList.GetReportByDateAndTicketType(startDate, endDate, ticketType); } else { list = TicketInfoList.GetReportByDate(startDate, endDate); } List <TicketInfo> source = new List <TicketInfo>(); List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } source = list.Where(x => agenIdList.Contains(x.CreatedBy)).ToList(); List <MorrisBar> data = new List <MorrisBar>(); for (DateTime i = startDate; i < endDate.AddDays(1); i = i.AddDays(1)) { var tmpList = source.Where(x => x.CreatedDate.Date == i && agenIdList.Contains(x.TicketOwner)).ToList(); MorrisBar bar = new MorrisBar(); bar.Count = tmpList.Count; bar.Open = tmpList.Where(x => x.TicketStatus == "Open").ToList().Count; bar.Closed = tmpList.Where(x => x.TicketStatus == "Closed").ToList().Count; bar.Tanggal = i.Day; data.Add(bar); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult AllCurrentMonthToMonth(string ticketType) { DateTime baseDate = DateTime.Today; DateTime startDate = baseDate.AddDays(1 - baseDate.Day); DateTime endDate = startDate.AddMonths(1).AddSeconds(-1); List <TicketInfo> list = new List <TicketInfo>(); if (!string.IsNullOrEmpty(ticketType)) { list = TicketInfoList.GetReportByDateAndTicketType(startDate, endDate, ticketType).ToList(); } else { list = TicketInfoList.GetReportByDate(startDate, endDate).ToList(); } List <TicketInfo> source = new List <TicketInfo>(); List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } source = list.Where(x => agenIdList.Contains(x.TicketOwner)).ToList(); List <MorrisDonut> data = new List <MorrisDonut>(); MorrisDonut m = new MorrisDonut(); m.label = "Open"; m.value = source.Where(x => x.TicketStatus == "Open").Count(); data.Add(m); m = new MorrisDonut(); m.value = source.Where(x => x.TicketStatus == "Closed").Count(); m.label = "Closed"; data.Add(m); return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult MonthToMonth(string ticketType) { DateTime baseDate = DateTime.Today; DateTime startDate = baseDate.AddDays(1 - baseDate.Day); DateTime endDate = startDate.AddMonths(1).AddSeconds(-1); TicketInfoList list = null; if (!string.IsNullOrEmpty(ticketType)) { list = TicketInfoList.GetReportByDateAndTicketType(new DateTime(DateTime.Now.Year, 1, 1), new DateTime(DateTime.Now.Year, 12, 31), ticketType); } else { list = TicketInfoList.GetReportByDate(new DateTime(DateTime.Now.Year, 1, 1), new DateTime(DateTime.Now.Year, 12, 31)); } List <TicketInfo> source = new List <TicketInfo>(); List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); agenIdList.Add(User.Identity.Name); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } source = list.Where(x => agenIdList.Contains(x.CreatedBy)).ToList(); List <MorrisBar> data = new List <MorrisBar>(); for (int i = 1; i < 13; i++) { var tmpList = source.Where(x => x.CreatedDate.Month == i && agenIdList.Contains(x.TicketOwner)).ToList(); MorrisBar m = new MorrisBar(); m.Count = tmpList.Count; m.Closed = tmpList.Where(x => x.TicketStatus == "Closed").Count(); m.Open = tmpList.Where(x => x.TicketStatus == "Open").Count(); m.Tanggal = i; data.Add(m); } return(Json(data, JsonRequestBehavior.AllowGet)); }
// GET: Inbox public ActionResult IndexInbox() { List <string> agenIdList = new List <string>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } /// var obj = TicketInfoList.GetReportOpenTicket().Where(x => agenIdList.Contains(x.TicketOwner)).OrderByDescending(x => x.CreatedDate); var obj = TicketInfoList.GetReportOpenTicket().OrderByDescending(x => x.CreatedDate); ViewBag.TicketInfoList = obj; return(View()); }
public JsonResult GetGata2(string ticketType) { try { List <TicketUpdate> list = new List <TicketUpdate>(); AgentInfo info = AgentInfo.GetAgentInfo(User.Identity.Name); List <string> agenIdList = new List <string>(); agenIdList.Add(info.idCustAgent); if (info.IsSupervisor) { var infolist = AgentInfoList.GetAgentByGroup(info.GroupName).Where(x => x.SPVID == info.idCustAgent).ToList(); foreach (var item in infolist) { agenIdList.Add(item.idCustAgent); } } var data = TicketInfoList.GetTicketInfoList().Where(x => agenIdList.Contains(x.TicketOwner) && x.TicketType == ticketType).ToList(); var val = from c in data select new TicketUpdate { TicketID = c.TicketNo, Status = c.TicketStatus, Owner = c.TicketOwner, UpdatedDate = c.UpdatedDate.ToString("dd MMM yyyy") }; return(Json(val.ToArray(), JsonRequestBehavior.AllowGet)); } catch (Exception) { throw; } }