public List <TicketPreview> MakeFromSummary(IQueryable <Ticket> tickets) { List <TicketPreview> ticketPreviewList = new List <TicketPreview>(); foreach (var ticket in tickets) { var submitter = _ctx.User.Find(ticket.Submiter); var role = _ctx.UserRole.FirstOrDefault(q => q.UserRoleId == submitter.RoleId); TicketPreview ticketPreview = new TicketPreview { TicketId = ticket.TicketId, TicketCategoryId = ticket.TicketCategoryId, TicketNo = ticket.TicketNo, Title = ticket.Title, CreatedAt = ticket.CreatedAt, Status = ticket.Status }; if (role != null) { ticketPreview.RoleName = role.Name; } ticketPreview.Submiter = ticket.Submiter; ticketPreview.Responder = ticket.Responder; ticketPreview.DueDateAnswer = ticket.DueDateAnswer; ticketPreview.Description = ticket.Description; ticketPreviewList.Add(ticketPreview); } return(ticketPreviewList); }
private void btnPrint_Click(object sender, EventArgs e) { List <FormTicketListPrint> items = new List <FormTicketListPrint>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { Ticket t = dataGridView1.Rows[i].DataBoundItem as Ticket; items.Add ( new FormTicketListPrint ( t.Nom, t.Prenom, t.Age, t.Sexe, t.VilleDepart, t.VilleArrivee, float.Parse(t.Siege), t.PrixTicket.ToString(), t.Remboussement.ToString(), t.NumeroCNI, t.Observation, float.Parse(t.Telephone) ) ); } Form f = new TicketPreview("TicketListRpt.rdlc", items); f.Show(); }
public List <TicketPreview> MakeFrom(IQueryable <Ticket> tickets, int logedInUserId) { List <TicketPreview> ticketPreviewList = new List <TicketPreview>(); foreach (var ticket in tickets) { var submitter = _ctx.User.Find(ticket.Submiter); var role = _ctx.UserRole.FirstOrDefault(q => q.UserRoleId == submitter.RoleId); TicketPreview ticketPreview = new TicketPreview { TicketId = ticket.TicketId, TicketNo = ticket.TicketNo, Title = ticket.Title, CreatedAt = ticket.CreatedAt, Status = ticket.Status, DPPMNumber = ticket.DPPMno, TicketCategoryId = ticket.TicketCategoryId, EmailCC = ticket.EmailCC }; if (role != null) { ticketPreview.RoleName = role.Name; } ticketPreview.Submiter = ticket.Submiter; ticketPreview.Responder = ticket.Responder; ticketPreview.SubmiterFlag = ticket.SubmiterFlag; ticketPreview.ResponderFlag = ticket.ResponderFlag; ticketPreview.DueDateAnswer = ticket.DueDateAnswer; ticketPreview.Description = ticket.Description; ticketPreview.NextCommenter = ticket.NextCommenter; ticketPreview.ticketNoReference = _ticketBusinessService.CheckTicketReferences(ticket.TicketId) == null ? null : _ticketBusinessService.CheckTicketReferences(ticket.TicketId).TicketNo; if (logedInUserId != 0) { ticketPreview.IsEscalated = _ticketBusinessService.IsEscalated(ticket.TicketId, logedInUserId); } ticketPreviewList.Add(ticketPreview); } return(ticketPreviewList); }
public ActionResult Index() { if (Common.CheckAdmin()) { return(RedirectToAction("Login", "Default")); } ViewBag.DebugMode = DebugMode; if (DebugMode == false) { var ticketPreview = _ticketBusinessService.GetQueryableSummary(); List <User> submiters = new List <User>(); List <TicketPreview> submitersRating = new List <TicketPreview>(); List <TicketPreview> responderRating = new List <TicketPreview>(); List <User> responders = new List <User>(); List <TicketPreview> solvedDate = new List <TicketPreview>(); List <User> EscalateData1 = new List <User>(); List <User> EscalateData2 = new List <User>(); List <User> EscalateData3 = new List <User>(); List <TicketNote> SubmiterNote = new List <TicketNote>(); List <TicketNote> ResponderNote = new List <TicketNote>(); List <TicketNote> EscalatedFromNote = new List <TicketNote>(); List <TicketNote> Escalated1Note = new List <TicketNote>(); List <TicketNote> Escalated2Note = new List <TicketNote>(); List <TicketNote> Escalated3Note = new List <TicketNote>(); if (ticketPreview != null) { foreach (var ticket in ticketPreview) { User submiterData = _userBusinessService.GetDetail(ticket.Submiter); Rating ratingDataSubmiter = _ratingBusinessService.GetRatingFromSubmiter(ticket.TicketId, ticket.Submiter); TicketNote noteSubmiter = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, ticket.Submiter); TicketNote notesubmiter = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteSubmiter == null ? null : /*noteSubmiter.RespondTime*/ new string[] { noteSubmiter == null ? null : noteSubmiter.RespondTime, ratingDataSubmiter == null ? null : ratingDataSubmiter.RespondTime, }.Max() }; SubmiterNote.Add(notesubmiter); TicketNote noteResponder = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, ticket.Responder); Rating ratingDataResponder = _ratingBusinessService.GetRatingFromResponder(ticket.TicketId, ticket.Responder); TicketNote noteresponder = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = new string[] { noteResponder == null ? null : noteResponder.RespondTime, ratingDataResponder == null ? null : ratingDataResponder.RespondTime, }.Max() }; ResponderNote.Add(noteresponder); if (ratingDataSubmiter != null) { TicketPreview ratingdata = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = ratingDataSubmiter.CreatedAt, Rate = ratingDataSubmiter.Rate }; submitersRating.Add(ratingdata); } else { TicketPreview ratingdata = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = null, Rate = 0 }; submitersRating.Add(ratingdata); } if (submiterData != null) { User submiter = new User() { UserId = ticket.TicketId, Name = submiterData.Name, AreaName = submiterData.AreaName, POH_Name = _mstEmployeeBService.GetDetailbyUserName(submiterData.Username) == null ? null : _mstEmployeeBService.GetDetailbyUserName(submiterData.Username).Business_Area }; submiters.Add(submiter); } else { User submiter = new User() { UserId = ticket.TicketId, Name = "", AreaName = "", POH_Name = "" }; submiters.Add(submiter); } if (ticket.Responder != 0) { User responderData = _userBusinessService.GetDetail(ticket.Responder); TicketResolution SolvedDateData = _ticketResolutionBusinessService.GetByTicket(ticket.TicketId); Rating ratingresponder = _ratingBusinessService.GetRatingFromSubmiter(ticket.TicketId, ticket.Submiter); int[] escalateId = new int[4] { 0, 0, 0, 0 }; int i = 0; foreach (var item in _ticketBusinessService.getlistIdEscalatedbyTicket(ticket.TicketId)) { escalateId[i] = item; } EscalateLog escalateData = escalateId[0] == 0 ? null : _ticketBusinessService.getEscalatedDetail(escalateId[0]); EscalateLog escalateData2 = escalateId[1] == 0 ? null : _ticketBusinessService.getEscalatedDetail(escalateId[1]); EscalateLog escalateData3 = escalateId[2] == 0 ? null : _ticketBusinessService.getEscalatedDetail(escalateId[2]); if (responderData != null) { User responder = new User() { UserId = ticket.TicketId, Name = responderData.Name, AreaName = responderData.AreaName, POH_Name = responderData.EmployeeId == 0 ? null : _mstEmployeeBService.GetDetail(responderData.EmployeeId).Business_Area, }; responders.Add(responder); } else { User responder = new User() { UserId = ticket.TicketId, Name = "", AreaName = "", POH_Name = "" }; responders.Add(responder); } if (SolvedDateData != null) { TicketPreview solveddate = new TicketPreview() { TicketNo = ticket.TicketNo, Description = SolvedDateData.Description, SolvedDate = SolvedDateData.CreatedAt }; solvedDate.Add(solveddate); } else { TicketPreview solveddate = new TicketPreview() { TicketNo = ticket.TicketNo, Description = null, SolvedDate = null }; solvedDate.Add(solveddate); } if (ratingresponder != null) { TicketPreview rateResponder = new TicketPreview() { TicketId = ticket.TicketId, Rate = ratingresponder.Rate, Description = ratingresponder.Description }; responderRating.Add(rateResponder); } else { TicketPreview rateResponder = new TicketPreview() { TicketId = ticket.TicketId, Rate = 0, Description = null }; responderRating.Add(rateResponder); } if (escalateData != null) { User userEscalate1 = new User() { UserId = ticket.TicketId, Name = _userBusinessService.GetDetail(escalateData.EscalateTo).Name, AreaName = _userBusinessService.GetDetail(escalateData.EscalateTo).AreaName == null ? "HEAD OFFICE" : _userBusinessService.GetDetail(escalateData.EscalateTo).AreaName, Position = _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData.EscalateTo).EmployeeId) == null ? null : _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData.EscalateTo).EmployeeId).Business_Area, Username = _userBusinessService.GetDetail(escalateData.EscalateFrom).Name, BranchName = _userBusinessService.GetDetail(escalateData.EscalateFrom).AreaName == null ? "HEAD OFFICE" : _userBusinessService.GetDetail(escalateData.EscalateFrom).AreaName, POH_Name = _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData.EscalateFrom).EmployeeId) == null ? null : _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData.EscalateFrom).EmployeeId).Business_Area, }; EscalateData1.Add(userEscalate1); TicketDiscussion replyEsFrom = _ticketDiscussionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateFrom); TicketResolution ResolutionEsFrom = _ticketResolutionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateFrom); TicketNote noteEsFrom = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateFrom); TicketNote noteesFrom = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteEsFrom == null ? null : noteEsFrom.RespondTime /* new double[] { noteResponder == null ? 0 : noteResponder.RespondTime, replySubmiter == null ? 0 : replySubmiter.RespondTime, ResolutionResponder == null ? 0 : ResolutionResponder.RespondTime }.Max()*/ }; EscalatedFromNote.Add(noteesFrom); TicketDiscussion replyEs1 = _ticketDiscussionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateTo); TicketResolution ResolutionEs1 = _ticketResolutionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateTo); TicketNote noteEs1 = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData.EscalateTo); TicketNote notees1 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteEs1 == null ? null : noteEs1.RespondTime /*new double[] { noteResponder == null ? 0 : noteResponder.RespondTime, replySubmiter == null ? 0 : replySubmiter.RespondTime, ResolutionResponder == null ? 0 : ResolutionResponder.RespondTime }.Max()*/ }; Escalated1Note.Add(notees1); } else { User userEscalate1 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, Username = null, POH_Name = null, BranchName = null, Position = null }; EscalateData1.Add(userEscalate1); TicketNote noteesFrom = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; EscalatedFromNote.Add(noteesFrom); TicketNote notees1 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated1Note.Add(notees1); } if (escalateData2 != null) { User userEscalate2 = new User() { UserId = ticket.TicketId, Name = _userBusinessService.GetDetail(escalateData2.EscalateTo).Name, AreaName = _userBusinessService.GetDetail(escalateData2.EscalateTo).AreaName == null ? "HEAD OFFICE" : _userBusinessService.GetDetail(escalateData2.EscalateTo).AreaName, POH_Name = _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData2.EscalateTo).EmployeeId) == null ? null : _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData2.EscalateTo).EmployeeId).Business_Area, }; EscalateData2.Add(userEscalate2); TicketDiscussion replyEs2 = _ticketDiscussionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData2.EscalateTo); TicketResolution ResolutionEs2 = _ticketResolutionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData2.EscalateTo); TicketNote noteEs2 = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData2.EscalateTo); TicketNote notees2 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteEs2 == null ? null : noteEs2.RespondTime/* new double[] { noteResponder == null ? 0 : noteResponder.RespondTime, replySubmiter == null ? 0 : replySubmiter.RespondTime, ResolutionResponder == null ? 0 : ResolutionResponder.RespondTime }.Max()*/ }; Escalated2Note.Add(notees2); } else { User userEscalate2 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, POH_Name = null }; EscalateData2.Add(userEscalate2); TicketNote notees2 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated2Note.Add(notees2); } if (escalateData3 != null) { User userEscalate3 = new User() { UserId = ticket.TicketId, Name = _userBusinessService.GetDetail(escalateData3.EscalateTo).Name, AreaName = _userBusinessService.GetDetail(escalateData3.EscalateTo).AreaName == null ? "HEAD OFFICE" : _userBusinessService.GetDetail(escalateData3.EscalateTo).AreaName, POH_Name = _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData3.EscalateTo).EmployeeId) == null ? null : _mstEmployeeBService.GetDetail(_userBusinessService.GetDetail(escalateData3.EscalateTo).EmployeeId).Business_Area, }; EscalateData3.Add(userEscalate3); TicketDiscussion replyEs3 = _ticketDiscussionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData3.EscalateTo); TicketResolution ResolutionEs3 = _ticketResolutionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData3.EscalateTo); TicketNote noteEs3 = _ticketNoteBusinessService.GetDatebyTicketandUserId(ticket.TicketId, escalateData3.EscalateTo); TicketNote notees3 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteEs3 == null ? null : noteEs3.RespondTime/*new double[] { noteResponder == null ? 0 : noteResponder.RespondTime, replySubmiter == null ? 0 : replySubmiter.RespondTime, ResolutionResponder == null ? 0 : ResolutionResponder.RespondTime }.Max()*/ }; Escalated3Note.Add(notees3); } else { User userEscalate3 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, POH_Name = null }; EscalateData3.Add(userEscalate3); TicketNote notees3 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated3Note.Add(notees3); } } else { TicketNote noteres = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; ResponderNote.Add(noteres); TicketNote noteesFrom = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; EscalatedFromNote.Add(noteesFrom); TicketNote notees1 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated1Note.Add(notees1); TicketNote notees2 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated2Note.Add(notees2); TicketNote notees3 = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; Escalated3Note.Add(notees3); EscalatedFromNote.Add(noteesFrom); if (ticket.Status != 1) { User responder = new User() { UserId = ticket.TicketId, Name = "TREND Admin", AreaName = "-", POH_Name = "-" }; TicketPreview solveddate = new TicketPreview() { TicketNo = ticket.TicketNo, Description = null, SolvedDate = null }; TicketPreview rateResponder = new TicketPreview() { TicketId = ticket.TicketId, Rate = 0, Description = null }; User userEscalate1 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, Username = null, BranchName = null, POH_Name = null, Position = null }; User userEscalate2 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null }; User userEscalate3 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null }; EscalateData1.Add(userEscalate1); EscalateData2.Add(userEscalate2); EscalateData3.Add(userEscalate3); responderRating.Add(rateResponder); solvedDate.Add(solveddate); responders.Add(responder); } else { User responder = new User() { UserId = ticket.TicketId, Name = "", AreaName = "", POH_Name = "" }; TicketPreview solveddate = new TicketPreview() { TicketNo = ticket.TicketNo, Description = null, SolvedDate = null }; TicketPreview rateResponder = new TicketPreview() { TicketId = ticket.TicketId, Rate = 0, Description = null }; User userEscalate1 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, Username = null, POH_Name = null, BranchName = null, Position = null }; User userEscalate2 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, POH_Name = null }; User userEscalate3 = new User() { UserId = ticket.TicketId, Name = null, AreaName = null, POH_Name = null }; EscalateData1.Add(userEscalate1); EscalateData2.Add(userEscalate2); EscalateData3.Add(userEscalate3); responderRating.Add(rateResponder); solvedDate.Add(solveddate); responders.Add(responder); } } } } ViewBag.RespondEsFrom = EscalatedFromNote; ViewBag.RespondEs1 = Escalated1Note; ViewBag.RespondEs2 = Escalated2Note; ViewBag.RespondEs3 = Escalated3Note; ViewBag.NoteSubmiter = SubmiterNote; ViewBag.NoteResponder = ResponderNote; ViewBag.EscalatedLog1 = EscalateData1; ViewBag.EscalatedLog2 = EscalateData2; ViewBag.EscalatedLog3 = EscalateData3; ViewBag.RatingSubmiters = submitersRating; ViewBag.RatingResponders = responderRating; ViewBag.SolvedDate = solvedDate; ViewBag.Submiters = submiters; ViewBag.Responders = responders; return(View(ticketPreview.ToList())); } else { return(View()); } }
// GET: Admin/HelpDesk public ActionResult Index(int?page, String currentFilter, string sortOrder = "", String searchString = "") { if (Common.CheckAdmin()) { return(RedirectToAction("Login", "Default")); } ViewBag.CurrentSort = sortOrder; ViewBag.DateSortParm = String.IsNullOrEmpty(sortOrder) ? "DateDesc" : ""; ViewBag.TitleSortParm = sortOrder == "Title" ? "TitleDesc" : "Title"; ViewBag.StatusSortParm = sortOrder == "Status" ? "StatusDesc" : "Status"; var tickets = _ticketBusinessService.GetHelpDeskList(); switch (sortOrder) { case "DateDesc": tickets = tickets.OrderBy(s => s.CreatedAt); break; case "Title": tickets = tickets.OrderBy(t => t.Title); break; case "TitleDesc": tickets = tickets.OrderByDescending(t => t.Title); break; case "Status": tickets = tickets.OrderBy(t => t.Status); break; case "StatusDesc": tickets = tickets.OrderByDescending(t => t.Status); break; default: tickets = tickets.OrderByDescending(t => t.CreatedAt); break; } if (searchString != null) { page = 1; } else { searchString = currentFilter; } tickets = tickets.Where(ticket => ticket.Title.Contains(searchString) || ticket.TicketNo.Contains(searchString) ); var ticketPreview = _ticketPreviewBusinessService.MakeFrom(tickets, 0); List <InvolvedUser> submiters = new List <InvolvedUser>(); List <User> responders = new List <User>(); List <TicketResolution> ticketresolutions = new List <TicketResolution>(); List <TicketPreview> ratings = new List <TicketPreview>(); List <TicketPreview> ratingresponders = new List <TicketPreview>(); List <User> userData = new List <User>(); List <TicketPreview> userRoles = new List <TicketPreview>(); List <TicketNote> SubmiterNote = new List <TicketNote>(); List <TicketNote> ResponderNote = new List <TicketNote>(); if (ticketPreview != null) { foreach (var ticket in ticketPreview) { User submiterData = _userBusinessService.GetDetail(ticket.Submiter); TicketResolution resolutionData = _ticketResolutionBusinessService.GetByTicket(ticket.TicketId); Rating ratingData = _ratingBusinessService.GetRatingFromSubmiter(ticket.TicketId, ticket.Submiter); TicketNote noteSubmiter = _TicketNote.GetDatebyTicketandUserId(ticket.TicketId, ticket.Submiter); TicketDiscussion replySubmiter = _ticketDiscussionBs.GetDatebyTicketandUserId(ticket.TicketId, ticket.Submiter) == null ? null : _ticketDiscussionBs.GetDatebyTicketandUserId(ticket.TicketId, ticket.Submiter); TicketNote notesubmiter = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteSubmiter == null ? null: noteSubmiter.RespondTime }; SubmiterNote.Add(notesubmiter); if (ratingData != null) { TicketPreview ratingdata = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = ratingData.CreatedAt, Rate = ratingData.Rate }; ratings.Add(ratingdata); } else { TicketPreview ratingdata = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = null, Rate = 0 }; ratings.Add(ratingdata); } if (resolutionData != null) { TicketResolution resolutiondata = new TicketResolution() { TicketId = ticket.TicketId, CreatedAt = resolutionData.CreatedAt }; ticketresolutions.Add(resolutiondata); } else { TicketResolution resolutiondata = new TicketResolution() { TicketId = ticket.TicketId, CreatedAt = null }; ticketresolutions.Add(resolutiondata); } if (submiterData != null) { if (submiterData.RoleId == 0) { TicketPreview userrole = new TicketPreview() { TicketNo = ticket.TicketNo, RoleName = "-" }; userRoles.Add(userrole); } else { TicketPreview userrole = new TicketPreview() { TicketNo = ticket.TicketNo, RoleName = _userRoleBusinessService.GetDetail(submiterData.RoleId).Name }; userRoles.Add(userrole); } InvolvedUser submiter = new InvolvedUser() { TicketNo = ticket.TicketNo, EmployeName = _userBusinessService.GetDetail(ticket.Submiter).Name, }; User userdata = new User() { Username = ticket.TicketNo, BranchName = submiterData.BranchName, AreaName = submiterData.AreaName, POH_Name = _EmployeeMasterBusinessService.GetDetail(submiterData.EmployeeId) == null ?"N/A" : _EmployeeMasterBusinessService.GetDetail(submiterData.EmployeeId).Business_Area }; userData.Add(userdata); submiters.Add(submiter); } else { TicketPreview userrole = new TicketPreview() { TicketNo = ticket.TicketNo, RoleName = "" }; InvolvedUser submiter = new InvolvedUser() { TicketNo = ticket.TicketNo, EmployeName = "" }; User userdata = new User() { Username = ticket.TicketNo, BranchName = "", AreaName = "" }; userData.Add(userdata); userRoles.Add(userrole); submiters.Add(submiter); } if (ticket.Responder != 0) { User responderData = _userBusinessService.GetDetail(ticket.Responder); Rating ratingDataResponder = _ratingBusinessService.GetRatingFromResponder(ticket.TicketId, ticket.Responder); TicketNote noteResponder = _TicketNote.GetDatebyTicketandUserId(ticket.TicketId, ticket.Responder); TicketDiscussion replyResponder = _ticketDiscussionBs.GetDatebyTicketandUserId(ticket.TicketId, ticket.Responder); TicketResolution ResolutionResponder = _ticketResolutionBusinessService.GetDatebyTicketandUserId(ticket.TicketId, ticket.Submiter); TicketNote noteresponder = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = noteResponder == null ? null : noteResponder.RespondTime /* new double[] { noteSubmiter == null ? 0 : noteSubmiter.RespondTime, replySubmiter == null ? 0 : replySubmiter.RespondTime, ResolutionResponder == null ? 0 : ResolutionResponder.RespondTime }.Max()*/ }; ResponderNote.Add(noteresponder); if (responderData != null) { User responderdata = new User() { Username = ticket.TicketNo, Name = responderData.Name }; responders.Add(responderdata); } else { User responderdata = new User() { Username = ticket.TicketNo, Name = null }; responders.Add(responderdata); } if (ratingDataResponder != null) { TicketPreview ratingdataresponder = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = ratingDataResponder.CreatedAt, Rate = ratingDataResponder.Rate }; ratingresponders.Add(ratingdataresponder); } else { TicketPreview ratingdataresponder = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = null, Rate = 0 }; ratingresponders.Add(ratingdataresponder); } } else { TicketNote noteresponder = new TicketNote() { TicketNoteId = ticket.TicketId, RespondTime = null }; ResponderNote.Add(noteresponder); TicketPreview ratingdataresponder = new TicketPreview() { TicketId = ticket.TicketId, ClosedDate = null, Rate = 0 }; User responderdata = new User() { Username = ticket.TicketNo, Name = null }; responders.Add(responderdata); ratingresponders.Add(ratingdataresponder); } } } ViewBag.NoteSubmiter = SubmiterNote; ViewBag.NoteResponder = ResponderNote; ViewBag.Responders = responders; ViewBag.RatingResponders = ratingresponders; ViewBag.Rating = ratings; ViewBag.Resolution = ticketresolutions; ViewBag.UserData = userData; ViewBag.User = userRoles; ViewBag.Submiters = submiters; int pageSize = 999999999; int pageNumber = (page ?? 1); return(View(tickets.ToPagedList(pageNumber, pageSize))); }