Exemple #1
0
        protected async Task InitializeAsync()
        {
            FreshdeskUrl = Data.CurrentOrg.FreshdeskUrl;
            await FreshdeskCache.InitializeAsync(Data.CurrentOrg.Name);

            using (var cn = Data.GetConnection())
            {
                IgnoredTickets = await GetIgnoredTicketsAsync(cn);
            }
        }
Exemple #2
0
        public async Task <IActionResult> OnPostDoActionAsync(int ticketId, int objectId, int teamId, ActionItemType objectType)
        {
            var client = await _freshdeskClientFactory.CreateClientForOrganizationAsync(OrgId);

            var ticket = await client.GetTicketAsync(ticketId, withConversations : true);

            await FreshdeskCache.InitializeAsync(OrgName);

            using (var cn = Data.GetConnection())
            {
                if (objectId == 0)
                {
                    await IgnoreTicketInner(ticketId, teamId, cn);
                }
                else
                {
                    int number = await CreateWorkItemFromTicketAsync(cn, client, ticket, objectId, objectType);

                    var wit = new WorkItemTicket()
                    {
                        TicketId       = ticketId,
                        WorkItemNumber = number,
                        OrganizationId = OrgId,
                        TicketStatus   = ticket.Status,
                        TicketType     = WebhookRequestToWebhookConverter.TicketTypeFromString(ticket.Type),
                        CompanyId      = ticket.CompanyId,
                        CompanyName    = GetCompanyName(ticket.CompanyId ?? 0),
                        ContactId      = ticket.RequesterId,
                        ContactName    = GetContactName(ticket.RequesterId),
                        Subject        = ticket.Subject
                    };

                    await client.UpdateTicketWorkItemAsync(ticketId, number.ToString());

                    await Data.TrySaveAsync(cn, wit);
                }
            }

            return(Redirect($"Tickets/Index"));
        }