public void GetTicketTimeTrack() { TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(new int[] { 1, 2 }); Assert.IsNotNull(tickets, "No tickets were returned"); Assert.IsNotEmpty(tickets, "No tickets were returned"); TicketTimeTrackCollection ticketTimeTracks = null; foreach (Ticket t in tickets) { ticketTimeTracks = TestSetup.KayakoApiService.Tickets.GetTicketTimeTracks(t.Id); if (ticketTimeTracks.Count > 0) { break; } } Assert.IsNotNull(ticketTimeTracks, "No ticket time tracks were returned"); Assert.IsNotEmpty(ticketTimeTracks, "No ticket time tracks were returned"); TicketTimeTrack randomTicketTimeTrackToGet = ticketTimeTracks[new Random().Next(ticketTimeTracks.Count)]; Trace.WriteLine("GetTicketType using ticket time tracks id: " + randomTicketTimeTrackToGet.Id); TicketTimeTrack ticketTimeTrack = TestSetup.KayakoApiService.Tickets.GetTicketTimeTrack(randomTicketTimeTrackToGet.TicketId, randomTicketTimeTrackToGet.Id); CompareTicketTimeTracks(ticketTimeTrack, randomTicketTimeTrackToGet); }
public void CreateDeleteTicketPosts() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); StaffUserCollection staff = TestSetup.KayakoApiService.Staff.GetStaffUsers(); StaffUser randomStaffUser = staff[new Random().Next(staff.Count)]; TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; const string subject = "New Post Subject"; const string contents = "This will be the contents"; TicketPostRequest request = new TicketPostRequest() { TicketId = randomTicket.Id, Subject = subject, Contents = contents, StaffId = randomStaffUser.Id, IsPrivate = false }; TicketPost createdPost = TestSetup.KayakoApiService.Tickets.AddTicketPost(request); Assert.IsNotNull(createdPost); Assert.AreEqual(createdPost.StaffId, randomStaffUser.Id); //Assert.AreEqual(createdPost.Contents, String.Format("{0}\n{1}", contents, randomStaffUser.Signature)); //Subject? bool success = TestSetup.KayakoApiService.Tickets.DeleteTicketPost(randomTicket.Id, createdPost.Id); Assert.IsTrue(success); }
public void CreateDeleteTicketAttachment() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); StaffUserCollection staff = TestSetup.KayakoApiService.Staff.GetStaffUsers(); StaffUser randomStaffUser = staff[new Random().Next(staff.Count)]; TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; TicketPostCollection ticketPosts = TestSetup.KayakoApiService.Tickets.GetTicketPosts(randomTicket.Id); TicketPost randomPost = ticketPosts[new Random().Next(ticketPosts.Count)]; string contents = Convert.ToBase64String(Encoding.UTF8.GetBytes("This is the file contents")); TicketAttachmentRequest request = new TicketAttachmentRequest() { TicketId = randomTicket.Id, TicketPostId = randomPost.Id, FileName = "TheFilename.txt", Contents = contents }; TicketAttachment createdAttachment = TestSetup.KayakoApiService.Tickets.AddTicketAttachment(request); Assert.AreEqual(createdAttachment.TicketId, randomTicket.Id); Assert.AreEqual(createdAttachment.TicketPostId, randomPost.Id); Assert.AreEqual(createdAttachment.FileName, "TheFilename.txt"); //Assert.AreEqual(createdAttachment.Contents, contents); bool success = TestSetup.KayakoApiService.Tickets.DeleteTicketAttachment(randomTicket.Id, createdAttachment.Id); Assert.IsTrue(success); }
public void CreateDeleteTicketPosts() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); StaffUserCollection staff = TestSetup.KayakoApiService.Staff.GetStaffUsers(); StaffUser randomStaffUser = staff[new Random().Next(staff.Count)]; TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; string contents = "This will be the contents"; TicketNoteRequest request = new TicketNoteRequest() { TicketId = randomTicket.Id, Content = contents, StaffId = randomStaffUser.Id, ForStaffId = randomStaffUser.Id, NoteColor = NoteColor.Purple }; TicketNote createdNote = TestSetup.KayakoApiService.Tickets.AddTicketNote(request); Assert.IsNotNull(createdNote); Assert.AreEqual(createdNote.Content, contents); Assert.AreEqual(createdNote.ForStaffId, randomStaffUser.Id); //Assert.AreEqual(createdNote.CreatorStaffId, randomStaffUser.Id); Assert.AreEqual(createdNote.NoteColor, NoteColor.Purple); Assert.AreEqual(createdNote.TicketId, randomTicket.Id); bool success = TestSetup.KayakoApiService.Tickets.DeleteTicketNote(randomTicket.Id, createdNote.Id); Assert.IsTrue(success); }
public void GetAllTickets() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Assert.IsNotNull(tickets, "No tickets were returned"); Assert.IsNotEmpty(tickets, "No tickets were returned"); }
public void GetAllTicketPosts() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; TicketPostCollection ticketPosts = TestSetup.KayakoApiService.Tickets.GetTicketPosts(randomTicket.Id); Assert.IsNotNull(ticketPosts, "No ticket posts were returned for ticket id " + randomTicket.Id); Assert.IsNotEmpty(ticketPosts, "No ticket posts were returned for ticket id " + randomTicket.Id); }
/// <summary> /// 订单分析扩展方法 /// </summary> /// <param name="tc"></param> /// <param name="GameCode"></param> /// <param name="price"></param> public static void AnalyzeOrderEx(this TicketCollection tc, string GameCode, decimal price = 2M) { tc.BetCount = 0; tc.TotalMoney = 0; tc.ForEach(t => { AnalyzeTicket(t, GameCode, price); // t.AnalyzeTicket(GameCode, price); tc.BetCount += t.BetCount; tc.TotalMoney += t.TicketMoney; }); }
public void Setup() { _kayakoApiRequest = new Mock <IKayakoApiRequest>(); _ticketController = new TicketController(_kayakoApiRequest.Object); _responseTicketCollection = new TicketCollection { new Ticket() }; _createTicketRequestRequiredFields = new TicketRequest { Subject = "Subject", FullName = "Fullname", Email = "*****@*****.**", Contents = "Contents", DepartmentId = 1, TicketStatusId = 2, TicketPriorityId = 3, TicketTypeId = 4 }; _createTicketRequiredFieldsParameters = "subject=Subject&fullname=Fullname&[email protected]&contents=Contents&departmentid=1&ticketstatusid=2&ticketpriorityid=3&tickettypeid=4"; _responseTicketCustomFields = new TicketCustomFields { FieldGroups = new List <TicketCustomFieldGroup> { new TicketCustomFieldGroup { Id = 1, Title = "Title", Fields = new[] { new TicketCustomField { Type = TicketCustomFieldType.Text, Name = "FieldName1", FieldContent = "content1" }, new TicketCustomField { Type = TicketCustomFieldType.Text, Name = "FieldName2", FieldContent = "content2" } } } } }; }
private Ticket GetTicketRequest(string id) { string apiMethod = String.Format("/Tickets/Ticket/{0}/", id); TicketCollection tickets = Connector.ExecuteGet <TicketCollection>(apiMethod); if (tickets.Count > 0) { return(tickets[0]); } return(null); }
/// <summary> /// Run a search on tickets. You can combine the search factors to make the span multiple areas. /// For example, to search the full name, contents and email you can send the arguments as: /// query=John&fullname=1&email=1&contents=1 /// </summary> public TicketCollection SearchTickets(TicketSearchQuery query) { if (String.IsNullOrEmpty(query.Query)) { throw new ArgumentException("A search query must be provided"); } string apiMethod = "/Tickets/TicketSearch"; RequestBodyBuilder parameters = query.GetRequestBodyParameters(); TicketCollection tickets = Connector.ExecutePost <TicketCollection>(apiMethod, parameters.ToString()); return(tickets); }
/// <summary> /// Retrieve a filtered list of tickets from the help desk. /// </summary> /// <param name="departmentIds">Filter the tickets by the specified department id(s)</param> /// <param name="ticketStatusIds">Filter the tickets by the specified ticket status id(s). Pass null or empty array for no filter</param> /// <param name="ownerStaffIds">Filter the tickets by the specified owner staff id(s). Pass null or empty array for no filter</param> /// <param name="userIds">Filter the tickets by the specified user id(s). Pass null or empty array for no filter</param> /// <param name="count">Total ticket count for retrieval</param> /// <param name="start">Start ticket for retrieval</param> public TicketCollection GetTickets(int[] departmentIds, int[] ticketStatusIds, int[] ownerStaffIds, int[] userIds, int count, int start) { string deptIdParameter = JoinIntParameters(departmentIds); string ticketStatusIdParameter = JoinIntParameters(ticketStatusIds); string ownerStaffIdParameter = JoinIntParameters(ownerStaffIds); string userIdParameter = JoinIntParameters(userIds); string apiMethod = String.Format("/Tickets/Ticket/ListAll/{0}/{1}/{2}/{3}/{4}/{5}", deptIdParameter, ticketStatusIdParameter, ownerStaffIdParameter, userIdParameter, count, start); TicketCollection tickets = Connector.ExecuteGet <TicketCollection>(apiMethod); return(tickets); }
public void GetTicket() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Assert.IsNotNull(tickets, "No tickets were returned"); Assert.IsNotEmpty(tickets, "No tickets were returned"); Ticket ticketToGet = tickets[new Random().Next(tickets.Count)]; Trace.WriteLine("GetTicket using ticket id: " + ticketToGet.Id); Ticket ticketById = TestSetup.KayakoApiService.Tickets.GetTicket(ticketToGet.Id); Ticket ticketByDisplayId = TestSetup.KayakoApiService.Tickets.GetTicket(ticketToGet.DisplayId); //CompareTickets(ticketById, ticketToGet); CompareTickets(ticketById, ticketByDisplayId); //CompareTickets(ticketByDisplayId, ticketToGet); }
public void GetTicketPost() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; TicketPostCollection ticketPosts = TestSetup.KayakoApiService.Tickets.GetTicketPosts(randomTicket.Id); Assert.IsNotNull(ticketPosts, "No ticket posts were returned for ticket id " + randomTicket.Id); Assert.IsNotEmpty(ticketPosts, "No ticket posts were returned for ticket id " + randomTicket.Id); TicketPost randomTicketPostToGet = ticketPosts[new Random().Next(ticketPosts.Count)]; Trace.WriteLine("GetTicketPost using ticket post id: " + randomTicketPostToGet.Id); TicketPost ticketPriority = TestSetup.KayakoApiService.Tickets.GetTicketPost(randomTicket.Id, randomTicketPostToGet.Id); CompareTicketPost(ticketPriority, randomTicketPostToGet); }
public void GetTicketTimeTracks() { TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }); TicketTimeTrackCollection ticketTimeTracks = null; foreach (Ticket t in tickets) { ticketTimeTracks = TestSetup.KayakoApiService.Tickets.GetTicketTimeTracks(t.Id); if (ticketTimeTracks.Count > 0) { break; } } Assert.IsNotNull(tickets, "No ticket time tracks were returned"); Assert.IsNotEmpty(tickets, "No ticket time tracks returned"); }
public void GetTicketNote() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; TicketNoteCollection notes = TestSetup.KayakoApiService.Tickets.GetTicketNotes(randomTicket.Id); Assert.IsNotNull(notes, "No ticket notes were returned for ticket id " + randomTicket.Id); Assert.IsNotEmpty(notes, "No ticket notes were returned for ticket id " + randomTicket.Id); TicketNote randomTicketNoteToGet = notes[new Random().Next(notes.Count)]; Trace.WriteLine("GetTicketNote using ticket note id: " + randomTicketNoteToGet.Id); TicketNote ticketNote = TestSetup.KayakoApiService.Tickets.GetTicketNote(randomTicket.Id, randomTicketNoteToGet.Id); CompareTicketNote(ticketNote, randomTicketNoteToGet); }
///<summary> /// 分析订单的票 ///</summary> ///<param name="order">订单</param> ///<returns>票集合</returns> public static TicketCollection AnalyzeTickets(Order order) { // 将所有号码,按照玩法进行分组 var groupAntecodes = order.AntecodeList.GroupBy((item) => item.GameType); var ticketList = new TicketCollection(); foreach (var group in groupAntecodes) { var gameType = group.Key; // 获取玩法一张票最多可以携带的号码数量 var maxCount = TicketRuleGetter.GetMaxAntecodeCountEachTicket(order.GameCode, gameType); // 解析此玩法所有号码,并返回多张票 var innerTicketList = GetTicketsByAntecodes(group.ToArray(), maxCount, () => new Ticket() { GameType = gameType, Amount = order.Amount, }); ticketList.AddRange(innerTicketList); } return(ticketList); }
public void UpdateTicketCustomFields() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); int idToUse = -1; foreach (Ticket ticket in tickets) { TicketCustomFields ticketCustomFields = TestSetup.KayakoApiService.Tickets.GetTicketCustomFields(ticket.Id); if (ticketCustomFields.FieldGroups.Count > 0) { if (ticketCustomFields.FieldGroups.Where(tcf => tcf.Fields.Length > 0 && tcf.Fields.Any(a => a.Type == Core.Constants.TicketCustomFieldType.Text || a.Type == Core.Constants.TicketCustomFieldType.TextArea)).Any()) { idToUse = ticket.Id; break; } } } if (idToUse != -1) { TicketCustomFields ticketCustomFields = TestSetup.KayakoApiService.Tickets.GetTicketCustomFields(idToUse); TicketCustomFieldGroup group = ticketCustomFields.FieldGroups.FirstOrDefault(tcf => tcf.Fields.Length > 0 && tcf.Fields.Any(a => a.Type == Core.Constants.TicketCustomFieldType.Text || a.Type == Core.Constants.TicketCustomFieldType.TextArea)); TicketCustomField field = group.Fields.FirstOrDefault(type => type.Type == Core.Constants.TicketCustomFieldType.Text || type.Type == Core.Constants.TicketCustomFieldType.TextArea); field.FieldContent = String.Format("This was updated at : {0}", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); TicketCustomFields updatedTicketCustomFields = TestSetup.KayakoApiService.Tickets.UpdateTicketCustomFields(idToUse, ticketCustomFields); TicketCustomFieldGroup updatedGroup = updatedTicketCustomFields.FieldGroups.FirstOrDefault(customField => customField.Fields.Length > 0 && customField.Fields.Any(a => a.Type == Core.Constants.TicketCustomFieldType.Text || a.Type == Core.Constants.TicketCustomFieldType.TextArea)); TicketCustomField updatedField = updatedGroup.Fields.FirstOrDefault(type => type.Type == Core.Constants.TicketCustomFieldType.Text || type.Type == Core.Constants.TicketCustomFieldType.TextArea); Assert.AreEqual(field.FieldContent, updatedField.FieldContent); } else { throw new Exception("Could not find any tickets with any text/text area custom fields."); } }
public IReadOnlyList <ITicket> Parse(string content) { var ticketCollection = new TicketCollection(); foreach (var level1Node in JObject.Parse(content).SelectTokens("response")) { foreach (var level2Node in level1Node.Children()) { foreach (var level3Node in level2Node.Children()) { foreach (var ticketNode in level3Node.Children()) { var ticket = ticketNode.ToObject <Ticket>(); ticketCollection.Tickets.Add(ticket); } } } } var ticketList = new List <ITicket>(ticketCollection.Tickets); return(ticketList); }
public void DoTicketSearch() { DepartmentCollection depts = TestSetup.KayakoApiService.Departments.GetDepartments(); depts.Add(new Department() { Id = 0 }); TicketCollection tickets = TestSetup.KayakoApiService.Tickets.GetTickets(depts.Select(d => d.Id).ToArray()); Ticket randomTicket = tickets[new Random().Next(tickets.Count)]; int expectedSearchAmount = tickets.Where(t => t.Email.Equals(randomTicket.Email, StringComparison.InvariantCultureIgnoreCase)).Count(); TicketSearchQuery query = new TicketSearchQuery(randomTicket.Email); query.AddSearchField(TicketSearchField.EmailAddress); TicketCollection queriedTickets = TestSetup.KayakoApiService.Tickets.SearchTickets(query); Assert.AreEqual(expectedSearchAmount, queriedTickets.Count); }
public void GetAllTicketsByQueueIdTest() { TicketCollection CreatedSet = new TicketCollection(); //Select everything in the database. TicketCollection PreSelectionSet = HelpdeskService.GetTicketsByQueueId(1, true); //Add the new items into the database and keep of collection of them for deletion later... for (int x = 0; x < 10; x++) { Ticket temp = NewTicket(); temp.Queue.QueueId = 1; HelpdeskService.CreateTicket(temp); CreatedSet.Add(temp); } //Get teh values of everything in teh datbase now that we have done some insertions. TicketCollection PostSelectionSet = HelpdeskService.GetTicketsByQueueId(1, true); //Check their counts to make sure everything went into the database correctly. Assert.IsTrue((PreSelectionSet.Count + 10) >= PostSelectionSet.Count); }
public Ticket CreateTicket(TicketRequest ticketRequest) { string apiMethod = "/Tickets/Ticket"; ticketRequest.EnsureValidData(RequestTypes.Create); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestData("subject", ticketRequest.Subject); parameters.AppendRequestData("fullname", ticketRequest.FullName); parameters.AppendRequestData("email", ticketRequest.Email); parameters.AppendRequestData("contents", ticketRequest.Contents); parameters.AppendRequestData("departmentid", ticketRequest.DepartmentId); parameters.AppendRequestData("ticketstatusid", ticketRequest.TicketStatusId); parameters.AppendRequestData("ticketpriorityid", ticketRequest.TicketPriorityId); parameters.AppendRequestData("tickettypeid", ticketRequest.TicketTypeId); if (ticketRequest.AutoUserId != null) { parameters.AppendRequestData("autouserid", Convert.ToInt32(ticketRequest.AutoUserId)); } else if (ticketRequest.UserId != null) { parameters.AppendRequestData("userid", ticketRequest.UserId); } else if (ticketRequest.StaffId != null) { parameters.AppendRequestData("staffid", ticketRequest.StaffId); } if (ticketRequest.OwnerStaffId != null) { parameters.AppendRequestData("ownerstaffid", ticketRequest.OwnerStaffId); } if (ticketRequest.TemplateGroupId != null) { parameters.AppendRequestData("templategroup", ticketRequest.TemplateGroupId); } else if (!string.IsNullOrEmpty(ticketRequest.TemplateGroupName)) { parameters.AppendRequestData("templategroup", ticketRequest.TemplateGroupName); } if (ticketRequest.IgnoreAutoResponder != null) { parameters.AppendRequestData("ignoreautoresponder", Convert.ToInt32(ticketRequest.IgnoreAutoResponder)); } if (ticketRequest.CreationType != null) { parameters.AppendRequestData("type", EnumUtility.ToApiString(ticketRequest.CreationType)); } TicketCollection tickets = Connector.ExecutePost <TicketCollection>(apiMethod, parameters.ToString()); if (tickets.Count > 0) { return(tickets[0]); } return(null); }
public override void ButtonPressed(object parentForm, TicketCollection theTickets, Ticket currentTicket, User currentUser, Person currentCustomer) { try { if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection) { frmConfigurationSettingsWarning frmConfigurationSettingsWarning = new frmConfigurationSettingsWarning(); frmConfigurationSettingsWarning.ShowDialog(); return; } if (currentTicket != null) { currentOpenTicket = currentTicket; currentOpenTicketId = currentTicket.ID; currentUserId = currentUser.ID; } else { currentOpenTicket = null; currentOpenTicketId = string.Empty; currentUserId = string.Empty; } if (ConfigurationHelper.Instance.ENABLE_bLOYAL) { if (!ServiceURLHelper.IsbLoyalServiceUrlDown) { int ticketId = 0; int userId = 0; int.TryParse(currentUser.ID, out userId); if (int.TryParse(currentOpenTicketId, out ticketId) && currentTicket != null && currentTicket.Items != null) { if (currentTicket.Items.Count == 0 && currentTicket.AmountDue == 0 && currentTicket.PaymentTotal > 0) { frmTicketIsFullyPaid frmTicketIsFullyPaid = new frmTicketIsFullyPaid(true, Messages.ADD_IETM_WARNING); frmTicketIsFullyPaid.ShowDialog(); } else if (currentTicket.Items.Count > 0 && currentTicket.AmountDue == 0 && currentTicket.PaymentTotal > 0) { frmTicketIsFullyPaid frmTicketIsFullyPaid = new frmTicketIsFullyPaid(true, Messages.APPLY_PAYMENT_WARNING); frmTicketIsFullyPaid.ShowDialog(); } else if (currentTicket.Items.Count > 0 && currentTicket.AmountDue > 0) { if (DiscountSets.OrderLevelDiscountId > 0 && DiscountSets.ItemLevelDiscountId > 0 && DiscountSets.ItemLevelSalePriceId > 0) { frmCalculateSalesTransaction frmCalculateSalesTransaction = new frmCalculateSalesTransaction(userId, ticketId, currentTicket); frmCalculateSalesTransaction.ShowDialog(); } else { frmbLoyalDiscountRuleWarning frmbLoyalDiscountRuleWarning = new frmbLoyalDiscountRuleWarning(); frmbLoyalDiscountRuleWarning.ShowDialog(); } } } else { frmShowWarningMessage frmshowWarning = new frmShowWarningMessage(); frmshowWarning.ShowDialog(); } } else { frmbLoyalServiceUrlDownWarning frmServiceUrlDown = new frmbLoyalServiceUrlDownWarning(); frmServiceUrlDown.ShowDialog(); } } else { DisableEnablebLoyalFunctionality disableEnablebLoyal = new DisableEnablebLoyalFunctionality(); disableEnablebLoyal.ShowDialog(); } } catch (Exception ex) { LoggerHelper.Instance.WriteLogError(ex, "CalculateSalesTransaction OEButtonPressed"); } }
public abstract void ButtonPressed(object parentForm, TicketCollection theTickets, Ticket currentTicket, User currentUser, Person currentCustomer);
public void Setup() { _kayakoApiRequest = new Mock<IKayakoApiRequest>(); _ticketController = new TicketController(_kayakoApiRequest.Object); _responseTicketCollection = new TicketCollection { new Ticket() }; _createTicketRequestRequiredFields = new TicketRequest { Subject = "Subject", FullName = "Fullname", Email = "*****@*****.**", Contents = "Contents", DepartmentId = 1, TicketStatusId = 2, TicketPriorityId = 3, TicketTypeId = 4 }; _createTicketRequiredFieldsParameters = "subject=Subject&fullname=Fullname&[email protected]&contents=Contents&departmentid=1&ticketstatusid=2&ticketpriorityid=3&tickettypeid=4"; _responseTicketCustomFields = new TicketCustomFields { FieldGroups = new List<TicketCustomFieldGroup> { new TicketCustomFieldGroup { Id = 1, Title = "Title", Fields = new[] { new TicketCustomField { Type = TicketCustomFieldType.Text, Name = "FieldName1", FieldContent = "content1" }, new TicketCustomField { Type = TicketCustomFieldType.Text, Name = "FieldName2", FieldContent = "content2" } } } } }; }
public override void ButtonPressed(object parentForm, TicketCollection theTickets, Ticket currentTicket, User currentUser, Person currentCustomer) { try { if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection) { frmConfigurationSettingsWarning frmConfigurationSettingsWarning = new frmConfigurationSettingsWarning(); frmConfigurationSettingsWarning.ShowDialog(); return; } if (currentTicket != null) { currentOpenTicket = currentTicket; currentOpenTicketId = currentTicket.ID; currentUserId = currentUser.ID; } else { currentOpenTicket = null; currentOpenTicketId = string.Empty; currentUserId = string.Empty; } if (ConfigurationHelper.Instance.ENABLE_bLOYAL) { if (!ServiceURLHelper.IsbLoyalServiceUrlDown) { int ticketId = 0; int.TryParse(currentOpenTicketId, out ticketId); if (currentTicket != null && ticketId > 0 && currentTicket.AmountDue == 0 && currentTicket.PaymentTotal > 0) { frmTicketIsFullyPaid frmTicketIsFullyPaid = new frmTicketIsFullyPaid(true, Messages.APPLY_PAYMENT_WARNING); frmTicketIsFullyPaid.ShowDialog(); } else if (ticketId > 0) { var services = new Provider.LoyaltyEngineServices(); string key = string.Empty; key = AsyncHelper.RunSync(() => services.GetSessionAsync()); if (!string.IsNullOrWhiteSpace(key)) { frmApplyCoupon frmApplyCoupon = new frmApplyCoupon(key); frmApplyCoupon.ShowDialog(); } else { if (ServiceURLHelper.IsbLoyalServiceUrlDown) { frmbLoyalServiceUrlDownWarning frmServiceUrlDown = new frmbLoyalServiceUrlDownWarning(); frmServiceUrlDown.ShowDialog(); } else { frmServerOfflineWarning offLineMsg = new frmServerOfflineWarning(); offLineMsg.ShowDialog(); } } } else { frmShowWarningMessage frmshowWarning = new frmShowWarningMessage(); frmshowWarning.ShowDialog(); } } else { frmbLoyalServiceUrlDownWarning frmServiceUrlDown = new frmbLoyalServiceUrlDownWarning(); frmServiceUrlDown.ShowDialog(); } } else { DisableEnablebLoyalFunctionality disableEnablebLoyal = new DisableEnablebLoyalFunctionality(); disableEnablebLoyal.ShowDialog(); } } catch (Exception ex) { LoggerHelper.Instance.WriteLogError(ex, "ApplyCoupon OEButtonPressed"); } }
public Ticket UpdateTicket(TicketRequest request) { request.EnsureValidData(RequestTypes.Update); RequestBodyBuilder parameters = new RequestBodyBuilder(); if (!String.IsNullOrEmpty(request.Subject)) { parameters.AppendRequestData("subject", request.Subject); } if (!String.IsNullOrEmpty(request.FullName)) { parameters.AppendRequestData("fullname", request.FullName); } if (!String.IsNullOrEmpty(request.Email)) { parameters.AppendRequestData("email", request.Email); } if (request.DepartmentId != null) { parameters.AppendRequestData("departmentid", request.DepartmentId); } if (request.TicketStatusId != null) { parameters.AppendRequestData("ticketstatusid", request.TicketStatusId); } if (request.TicketPriorityId != null) { parameters.AppendRequestData("ticketpriorityid", request.TicketPriorityId); } if (request.TicketTypeId != null) { parameters.AppendRequestData("tickettypeid", request.TicketTypeId); } if (request.OwnerStaffId != null) { parameters.AppendRequestData("ownerstaffid", request.OwnerStaffId); } if (request.UserId != null) { parameters.AppendRequestData("userid", request.UserId); } if (request.TemplateGroupId != null) { parameters.AppendRequestData("templategroup", request.TemplateGroupId); } else if (!string.IsNullOrEmpty(request.TemplateGroupName)) { parameters.AppendRequestData("templategroup", request.TemplateGroupName); } string apiMethod = String.Format("/Tickets/Ticket/{0}", request.Id); TicketCollection tickets = Connector.ExecutePut <TicketCollection>(apiMethod, parameters.ToString()); if (tickets != null && tickets.Count > 0) { return(tickets[0]); } return(null); }