public RejectedReportResult RejectedReport(ReportParams Params) { var searchCriteria = new TicketSearchParams { Status = TicketStatus.Rejected, ReceivedAtFrom = Params.RangeStart, ReceivedAtTo = Params.RangeEnd, IncludeResearchHistory = true, }; var items = searchCriteria.Search(requestState).ToRejectedReport(); foreach (var item in items) { item.Reasons = CleanReasons(item.Reasons); item.GroupContact = CleanGroupContact(item.GroupContact); } return(new RejectedReportResult { Report = new RejectedReport { Items = items } }); }
public AssignedToReportResult AssignedToReport(AssignedToReportParams Params) { var searchCriteria = new TicketSearchParams { Assignment = new Assignment { Employee = Params.AssignedTo }, ExcludeTicketStatusList = new List <string> { TicketStatus.Closed.ToString().PascalCaseToDescription(), TicketStatus.ClosedDuplicate.ToString().PascalCaseToDescription(), TicketStatus.ClosedTooLate.ToString().PascalCaseToDescription(), }, IsForwardOrder = true }; var items = searchCriteria.Search(requestState).ToAssignedToReport(); foreach (var item in items) { item.Reasons = CleanReasons(item.Reasons); } return(new AssignedToReportResult { OpenTicketCount = items.Count(), Report = new AssignedToReport { Items = items } }); }
public ReadyToCloseReportResult ReadyToCloseReport(ReportParams Params) { var searchCriteria = new TicketSearchParams { IncludeTicketStatusList = new List <string> { TicketStatus.ReadyToClose.ToString().PascalCaseToDescription(), TicketStatus.ReadyToCloseDuplicate.ToString().PascalCaseToDescription(), TicketStatus.ReadyToCloseTooLate.ToString().PascalCaseToDescription(), }, IncludeContactHistory = true }; var items = searchCriteria.Search(requestState).ToReadyToCloseReport(); foreach (var item in items) { item.Reasons = CleanReasons(item.Reasons); item.GroupContact = CleanGroupContact(item.GroupContact); } return(new ReadyToCloseReportResult { Report = new ReadyToCloseReport { Items = items } }); }
public LostFoundReportResult LostFoundReport(LostFoundReportParams Params) { var codes = ticketRepository.GetComplaintCodes(); var lostAndFoundCode = codes.ComplaintCodes.First(c => c.Description.ToLower().Contains("lost property")); var searchCriteria = new TicketSearchParams { LostItem = new LostItem { Category = Params.LostItemCategory, Type = Params.LostItemType }, IncidentAtFrom = Params.RangeStart, IncidentAtTo = Params.RangeEnd, ReasonCode1 = lostAndFoundCode.ToString(), ExcludeTicketStatusList = new List <string> { TicketStatus.Closed.ToString().PascalCaseToDescription(), TicketStatus.ClosedDuplicate.ToString().PascalCaseToDescription(), TicketStatus.ClosedTooLate.ToString().PascalCaseToDescription(), } }; var items = searchCriteria.Search(requestState).ToLostFoundReport(); return(new LostFoundReportResult { Report = new LostFoundReport { Items = items } }); }
public ForActionReportResult ForActionReport(ForActionReportParams Params) { var searchCriteria = new TicketSearchParams { Assignment = new Assignment { GroupContact = new GroupContact(Params.GroupContact) }, ExcludeTicketStatusList = new List <string> { TicketStatus.Closed.ToString().PascalCaseToDescription(), TicketStatus.ClosedDuplicate.ToString().PascalCaseToDescription(), TicketStatus.ClosedTooLate.ToString().PascalCaseToDescription(), }, IsForwardOrder = true }; var items = searchCriteria.Search(requestState).ToForActionReport(); foreach (var item in items) { item.Reasons = CleanReasons(item.Reasons); item.GroupContact = CleanGroupContact(item.GroupContact); } return(new ForActionReportResult { OpenTicketCount = items.Count(), Report = new ForActionReport { Items = items } }); }
public TicketSearchFieldsResult GetTicketSearchFields() { var ticket = TicketSearchParams.EmptyTicketSearchParams(); var searchFields = ExtractHelper.Flatten(ticket).ToList(); return(new TicketSearchFieldsResult { Ticket = ticket, SearchFields = searchFields }); }
public void SearchTicketsResultTest() { var searchCriteria = new TicketSearchParams { ReceivedAtFrom = DateTime.Parse("2014-06-10"), }; var tickets = searchCriteria.Search(requestState); Assert.IsNotNull(tickets); Assert.AreNotEqual(tickets.Count, 0); }
private TicketSearchParams FillSearchCriteria(TicketSearchParams Criteria) { if (servicesProxy.UserService != null) { // translate Username to Id when applicable if (Criteria.Assignment.Employee.Id == null && Criteria.Assignment.Employee.Username != null) { var userResult = servicesProxy.UserService.GetUser(Criteria.Assignment.Employee.Username); if (userResult.OK) { Criteria.Assignment.Employee.Id = userResult.User.Id; } } if (Criteria.Source.ReceivedBy.Id == null && Criteria.Source.ReceivedBy.Username != null) { var userResult = servicesProxy.UserService.GetUser(Criteria.Source.ReceivedBy.Username); if (userResult.OK) { Criteria.Source.ReceivedBy.Id = userResult.User.Id; } } if (Criteria.UpdatedBy != null && Criteria.UpdatedBy.Id == null && Criteria.UpdatedBy.Username != null) { var userResult = servicesProxy.UserService.GetUser(Criteria.UpdatedBy.Username); if (userResult.OK) { Criteria.UpdatedBy.Id = userResult.User.Id; } } // Id is higher precedence than Username if (Criteria.Assignment.Employee.Id != null && Criteria.Assignment.Employee.Username != null) { Criteria.Assignment.Employee.Username = null; } if (Criteria.Source.ReceivedBy.Id == null && Criteria.Source.ReceivedBy.Username != null) { Criteria.Source.ReceivedBy.Username = null; } if (Criteria.UpdatedBy != null && Criteria.UpdatedBy.Id == null && Criteria.UpdatedBy.Username != null) { Criteria.UpdatedBy.Username = null; } } return(Criteria); }
public JsonResult Search(TicketSearchParams Criteria) { log.Debug("Begin Search"); try { var result = ServicesProxy.TicketService.Search(Criteria); log.Debug(string.Format("{0} TicketService.Search: {1}", result.OK ? "Call" : "Fail", result.Errors != null && result.Errors.Count > 0 ? result.Errors.Aggregate((i, j) => i + "." + j) : null)); return(Json(result, JsonRequestBehavior.AllowGet)); } finally { log.Debug("End Search"); } }
public TicketsResult Search(TicketSearchParams Criteria, RequestState RequestState) { InitCusRelContext(); var result = new TicketsResult { Tickets = Criteria.Search(RequestState) }; if (result.Tickets == null) { result.SetFail("No tickets found"); } return(result); }
public void ExplicitEmptySearchTicketsTest() { var Criteria = new TicketSearchParams { Id = 0, IncidentAtTo = null, IncidentAtFrom = null, ReceivedAtFrom = null, ReceivedAtTo = null }; var result = servicesProxy.TicketService.Search(Criteria); Assert.IsNotNull(result); Assert.IsTrue(result.OK); Assert.IsNotNull(result.Tickets); Assert.AreNotEqual(result.Tickets.Count, 0); }
public void Title6SearchTicketsTest() { var maxSearchCount = requestState.MaxSearchCount; requestState.MaxSearchCount = 500; var searchCriteria = new TicketSearchParams { SearchAsUnion = true, ReasonCode1 = "Title VI", IsTitle6 = true, ReceivedAtFrom = DateTime.Now.AddMonths(-2), }; var tickets = searchCriteria.Search(requestState); Assert.IsNotNull(tickets); Assert.AreNotEqual(tickets.Count, 0); Assert.AreNotEqual(tickets.Count, 500); requestState.MaxSearchCount = maxSearchCount; }
/// <summary> /// Due to POCO contacts, and without partial class changes to tblContacts (different namespace), extension methods are used to simulate derived/base class behavior. /// This has small performance penality, using serialization, but the DRY principle is achieved. /// </summary> /// <param name="TicketSearchParams">SearchTicketRequest object </param> /// <returns>SearchContacts object with all populated.</returns> public static SearchContacts CreateSearchContact(this TicketSearchParams TicketSearchParams) { var baseTicket = JsonConvert.DeserializeObject <Ticket>(JsonConvert.SerializeObject(TicketSearchParams)); var contact = baseTicket.CreateContact(); var result = JsonConvert.DeserializeObject <SearchContacts>(JsonConvert.SerializeObject(contact)); result.ReceivedDateTimeFrom = TicketSearchParams.ReceivedAtFrom; result.ReceivedDateTimeTo = TicketSearchParams.ReceivedAtTo; result.IncidentDateTimeFrom = TicketSearchParams.IncidentAtFrom; result.IncidentDateTimeTo = TicketSearchParams.IncidentAtTo; result.ExcludeTicketStatusList = TicketSearchParams.ExcludeTicketStatusList; result.IncludeTicketStatusList = TicketSearchParams.IncludeTicketStatusList; result.IncludeContactHistory = TicketSearchParams.IncludeContactHistory; result.IncludeResearchHistory = TicketSearchParams.IncludeResearchHistory; result.FullName = TicketSearchParams.FullName; result.IsForwardOrder = TicketSearchParams.IsForwardOrder; result.SearchAsUnion = TicketSearchParams.SearchAsUnion; return(result); }
public SearchResultsWrapper <SeachTickets_Result> SeachTickets(TicketSearchParams parameters) { var ticketNumberFormatted = parameters.TicketNumber; var allCategories = staticData.GetTicketCategory(); if (!string.IsNullOrWhiteSpace(parameters.TicketNumber) && !parameters.TicketNumber.StartsWith(Constants.Defaults.TicketNumberPrefix)) { ticketNumberFormatted = Constants.Defaults.TicketNumberPrefix + ticketNumberFormatted; } ObjectParameter recordCount = new ObjectParameter("TotalRecords", typeof(int)); var searchResults = db.SeachTickets(ticketNumberFormatted, parameters.AgentCode, parameters.TicketStatusCode, parameters.Category, parameters.SoldTo, parameters.TableNo, parameters.TotalRecords, parameters.RecordsPerPage, parameters.PagingStartIndex, recordCount).ToList(); for (int i = 0; i < searchResults.Count; i++) { searchResults[i].SearchCategoryDescription = allCategories.First(a => a.Key == searchResults[i].Category).Value; } return(new SearchResultsWrapper <SeachTickets_Result> { RecordCount = (int)recordCount.Value, Results = searchResults }); }
private void SearchTickets() { string categoryComboValue = null; if (CategoryCombo.SelectedValue != null && !string.IsNullOrWhiteSpace(CategoryCombo.SelectedValue.ToString())) { categoryComboValue = CategoryCombo.SelectedValue.ToString(); } var ticketSearchParameter = new TicketSearchParams { TicketNumber = TicketNumberTextBox.Text, Category = categoryComboValue, AgentCode = SoldByTextBox.Text, SoldTo = SoldToTextBox.Text, PagingStartIndex = 1, RecordsPerPage = 100, }; int tableNo = 0; if (!string.IsNullOrEmpty(TableNoTextbox.Text)) { if (!int.TryParse(TableNoTextbox.Text, out tableNo)) { MessageBox.Show("Table No has to be number"); return; } else { ticketSearchParameter.TableNo = tableNo; } } var searchedResult = GetTicketManagerService().SeachTicketsWithWildCards(ticketSearchParameter); TicketListGridView.DataSource = searchedResult.Results; }
public SearchResultsWrapper <SeachTicketsWithWildCards_Result> SeachTicketsWithWildCards(TicketSearchParams parameters) { ObjectParameter recordCount = new ObjectParameter("TotalRecords", typeof(int)); var searchResults = db.SeachTicketsWithWildCards(parameters.TicketNumber, parameters.Category, parameters.AgentCode, parameters.SoldTo, parameters.TableNo, parameters.TotalRecords, parameters.RecordsPerPage, parameters.PagingStartIndex, recordCount).ToList(); return(new SearchResultsWrapper <SeachTicketsWithWildCards_Result> { RecordCount = (int)recordCount.Value, Results = searchResults }); }
public void SearchTicketResultTest() { var searchCriteria = new TicketSearchParams { Id = 362526, Status = TicketStatus.New, Priority = TicketPriority.Normal, Source = new TicketSource { ReceivedAt = DateTime.Parse("2014-06-11 18:46:10.663"), ReceivedBy = new User(Id: "WEB", Username: "******"), Via = TicketSourceVia.WEB, FeedbackId = 26887 }, Contact = new Contact { Name = new Name { First = "Marlena", Last = "Hanlon" }, Address = new Address { Addr1 = null, Addr2 = null, City = "Oakland", State = "CA", ZipCode = null }, Email = "*****@*****.**", Phone = new Phone { Number = null, Kind = PhoneKind.Home }, Status = null }, IsAdaComplaint = false, IsTitle6 = false, Incident = new Incident { IncidentAt = DateTime.Parse("2014-06-11 18:15:00.000"), VehicleNumber = "1601", Route = "1", Location = "Telegraph at 34th", // partial text Destination = "none", City = null, Division = "GO" }, Operator = new Operator { Badge = null, Description = "Picture available" // partial text }, LostItem = new LostItem { Category = "None", Type = "None", }, Reasons = new List <string> { "11. HAZARDOUS OPERATION", "16. CONDUCT/DISCOURTESY" }, Comments = "since the LAW is that when passing bicyclists", // partial text ResponseCriteria = new ResponseCriteria { HasRequestedResponse = true, Via = ResponseCriteriaVia.Email }, Resolution = new Resolution { Action = null, Comment = null, ResolvedAt = null }, Assignment = new Assignment { GroupContact = new GroupContact("K. Hayward Supt Div 6"), Employee = new User(Id: null), }, UpdatedAt = DateTime.Parse("2014-06-11 19:32:26.000"), UpdatedBy = new User(Id: "ACCBTONA"), ReceivedAtFrom = DateTime.Parse("2014-06-10"), ReceivedAtTo = DateTime.Parse("2014-06-13"), IncidentAtFrom = DateTime.Parse("2014-06-11 18:14:00.000"), IncidentAtTo = DateTime.Parse("2014-06-11 18:16:00.000") }; var tickets = searchCriteria.Search(requestState); Assert.IsNotNull(tickets); Assert.AreNotEqual(tickets.Count, 0); }
public TicketsResult Search(TicketSearchParams Criteria) { Criteria = FillSearchCriteria(Criteria); return(ticketRepository.Search(Criteria, servicesProxy.RequestState)); }
public static List <Ticket> Search(this TicketSearchParams searchCriteria, Contracts.Data.CusRel.Common.RequestState RequestState) { var contact = searchCriteria.CreateSearchContact(); return(contact != null?contact.GetTickets(null, RequestState) : null); }