public override void Process(SupportCase supportCase)
 {
     _messagingService.Lock(true);
     _messagingService.RespondToClient(supportCase);
     _messagingService.EscalateToManagement(supportCase);
     _messagingService.Lock(false);
 }
 public override void Process(SupportCase supportCase)
 {
     _messagingService.Lock(true);
     _messagingService.RespondToClient(supportCase);
     _messagingService.EscalateToManagement(supportCase);
     _messagingService.Lock(false);
 }
Esempio n. 3
0
        public void Should_not_notify_management_when_case_is_not_escalated()
        {
            SupportCase = SupportCaseProcessor.InitiateSupportCase("Make the corners rounded.");
            SupportCaseProcessor.Process(SupportCase);

            MessagingService.AssertWasNotCalled(m => m.EscalateToManagement(Arg <SupportCase> .Is.Anything));
        }
Esempio n. 4
0
 public void Setup()
 {
     _systemClock      = MockRepository.GenerateStub <ISystemClock>();
     _logger           = MockRepository.GenerateMock <ILogger>(); //a Mock, because it's key to the test assertions
     _messagingService = new MessagingService(_logger);
     _supportCase      = new SupportCase("Interacting with the logger", _systemClock);
 }
Esempio n. 5
0
 public void Setup()
 {
     _systemClock      = MockRepository.GenerateStub <ISystemClock>();
     _logger           = new MockLogger();
     _messagingService = new MessagingService(_logger);
     _supportCase      = new SupportCase("Looking at the logs", _systemClock);
 }
Esempio n. 6
0
        public async Task EmailGeneralSupportQueue(SupportCase supportCase)
        {
            var templateData = new EmailTemplate <SupportTemplateData>()
            {
                Data = new SupportTemplateData
                {
                    DynamicPropertyName1  = "FirstName",
                    DynamicPropertyValue1 = supportCase.FirstName,
                    DynamicPropertyName2  = "LastName",
                    DynamicPropertyValue2 = supportCase.LastName,
                    DynamicPropertyName3  = "Email",
                    DynamicPropertyValue3 = supportCase.Email,
                    DynamicPropertyName4  = "Vendor",
                    DynamicPropertyValue4 = supportCase.Vendor ?? "N/A",
                },
                Message = new EmailDisplayText()
                {
                    EmailSubject = supportCase.Subject,
                    DynamicText  = supportCase.Message
                }
            };
            var recipient = SendgridMappers.DetermineRecipient(_settings, supportCase.Subject);

            await SendSingleTemplateEmailSingleRcptAttachment(_settings?.SendgridSettings?.FromEmail, recipient, _settings?.SendgridSettings?.CriticalSupportTemplateID, templateData, supportCase.File);
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TimeReported,TimeStarted,TimeFEScheduled,TimeSolved,TotalTimeOnSite,BusinessCentreId,PersonId,PersonId1,Descrition,PurchaseOrderId")] SupportCase supportCase)
        {
            if (id != supportCase.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supportCase);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupportCaseExists(supportCase.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId1"]        = new SelectList(_context.Person, "Id", "Id", supportCase.PersonId1);
            ViewData["BusinessCentreId"] = new SelectList(_context.BusinessCentre, "Id", "Id", supportCase.BusinessCentreId);
            ViewData["PersonId"]         = new SelectList(_context.Person, "Id", "Id", supportCase.PersonId);
            ViewData["PurchaseOrderId"]  = new SelectList(_context.PurchaseOrder, "Id", "Id", supportCase.PurchaseOrderId);
            return(View(supportCase));
        }
Esempio n. 8
0
        public void Should_notify_management_when_case_is_escalated()
        {
            SupportCase             = SupportCaseProcessor.InitiateSupportCase("Make the corners rounded.");
            SupportCase.IsEscalated = true;

            SupportCaseProcessor.Process(SupportCase);

            MessagingService.AssertWasCalled(m => m.EscalateToManagement(SupportCase));
        }
        public static SupportCase ToSupportCase(this WebSupportCase webSupportCase)
        {
            SupportCase supportCase = new SupportCase();

            supportCase.set_CaseNumber(webSupportCase.get_CaseNumber());
            supportCase.set_CaseURL(webSupportCase.get_CaseURL());
            supportCase.set_LastUpdated(webSupportCase.get_LastUpdated());
            supportCase.set_Status((CaseStatus)webSupportCase.get_Status());
            supportCase.set_Title(webSupportCase.get_Title());
            return(supportCase);
        }
        private async void btnAddCase_Click(object sender, RoutedEventArgs e)
        {
            Customer    customer    = new Customer(Convert.ToInt32(tbSSN.Text), tbName.Text, Convert.ToInt32(tbPhoneNumber.Text), tbEmail.Text);
            SupportCase supportCase = new SupportCase(tbDescription.Text, tbTitle.Text, tbCategory.Text);

            await SharedLibrary.DataAccess.AddAsync(customer, supportCase);

            tbSSN.Text         = String.Empty;
            tbName.Text        = String.Empty;
            tbPhoneNumber.Text = String.Empty;
            tbEmail.Text       = String.Empty;
            tbDescription.Text = String.Empty;
            tbTitle.Text       = String.Empty;
            tbCategory.Text    = String.Empty;
        }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("Id,TimeReported,TimeStarted,TimeFEScheduled,TimeSolved,TotalTimeOnSite,BusinessCentreId,PersonId,PersonId1,Descrition,PurchaseOrderId")] SupportCase supportCase)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supportCase);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId1"]        = new SelectList(_context.Person, "Id", "Id", supportCase.PersonId1);
            ViewData["BusinessCentreId"] = new SelectList(_context.BusinessCentre, "Id", "Id", supportCase.BusinessCentreId);
            ViewData["PersonId"]         = new SelectList(_context.Person, "Id", "Id", supportCase.PersonId);
            ViewData["PurchaseOrderId"]  = new SelectList(_context.PurchaseOrder, "Id", "Id", supportCase.PurchaseOrderId);
            return(View(supportCase));
        }
Esempio n. 12
0
        public static List <CustomerCaseList> GetAll(string status1, string status2)
        {
            Customer    customer    = new Customer();
            SupportCase supportCase = new SupportCase();
            var         joinedList  = new List <CustomerCaseList>();

            var task   = Task.Run(async() => await ReadJson());
            var number = task.Result.NumberOfItems;

            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                conn.Open();

                var        query = "SELECT TOP (@Limit) * FROM SupportCases INNER JOIN Customers ON Customers.SSNumber = SupportCases.CustomerNumber WHERE SupportCases.Status IN (@Status1, @Status2) ORDER BY SupportCases.CaseNumber DESC;";
                SqlCommand cmd   = new SqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@Limit", number);
                cmd.Parameters.AddWithValue("@Status1", status1);
                cmd.Parameters.AddWithValue("@Status2", status2);

                var result = cmd.ExecuteReader();

                while (result.Read())
                {
                    int      CaseNumber     = result.GetInt32(0);
                    int      CustomerNumber = result.GetInt32(1);
                    string   Status         = result.GetString(2);
                    string   Description    = result.GetString(3);
                    string   Title          = result.GetString(4);
                    string   Category       = result.GetString(5);
                    DateTime Time           = result.GetDateTime(6);

                    int    SSN         = result.GetInt32(7);
                    string Name        = result.GetString(8);
                    int    PhoneNumber = result.GetInt32(9);
                    string Email       = result.GetString(10);

                    customer    = new Customer(SSN, Name, PhoneNumber, Email);
                    supportCase = new SupportCase(CaseNumber, CustomerNumber, Status, Description, Title, Category, Time);
                    joinedList.Add(new CustomerCaseList(customer, supportCase));
                }

                return(joinedList);
            }
        }
Esempio n. 13
0
        public async Task EmailGeneralSupportQueue(SupportCase supportCase)
        {
            var templateData = new EmailTemplate <SupportTemplateData>()
            {
                Data = new SupportTemplateData
                {
                    FirstName = supportCase?.FirstName,
                    LastName  = supportCase?.LastName,
                    Email     = supportCase?.Email,
                    Vendor    = supportCase?.Vendor ?? "N/A"
                },
                Message = new EmailDisplayText()
                {
                    EmailSubject = supportCase.Subject,
                    DynamicText  = supportCase.Message
                }
            };
            var recipient = SendgridMappers.DetermineRecipient(_settings, supportCase.Subject);

            await SendSingleTemplateEmailSingleRcptAttachment(_settings?.SendgridSettings?.FromEmail, recipient, _settings?.SendgridSettings?.CriticalSupportTemplateID, templateData, supportCase.File);
        }
Esempio n. 14
0
    protected void ButtonPerformActions_Click(object sender, EventArgs e)
    {
        // Iterate through the grid, find the datakey and the selected action, and perform them.

        foreach (GridDataItem item in this.GridInbox.Items)
        {
            DropDownList listActions = (DropDownList)item.FindControl("DropActions");

            if (listActions == null)
            {
                continue;
            }

            int caseId = (int)item.GetDataKeyValue("CaseId");

            SupportCase openCase = SupportDatabase.GetCase(caseId);

            string phone     = ExtractPhoneFromTitle(openCase.Title);
            People people    = GetPeopleFromPhone(phone);
            bool   closeCase = true;

            foreach (Person person in people)
            {
                string selectedValue = listActions.SelectedValue;

                switch (selectedValue)
                {
                case "TerminateAll":
                    // terminate everything: all activistships, all memberships

                    if (person.IsActivist)
                    {
                        person.TerminateActivist();
                        PWLog.Write(PWLogItem.Person, person.Identity, PWLogAction.ActivistLost, "Activist Lost",
                                    "SMS message from phone# " + phone + " declined all further contact");
                    }

                    Memberships terminateMemberships = person.GetMemberships();

                    foreach (Membership membership in terminateMemberships)
                    {
                        membership.Terminate(EventSource.SMS, _currentUser, "Membership in " + membership.Organization.Name + " terminated after person declined further contact over SMS.");
                    }

                    break;

                case "RenewAll":
                    Memberships renewedMemberships = person.GetRecentMemberships(Membership.GracePeriod);

                    // Get PPSE new expiry date, use as master

                    DateTime masterNewExpiry = DateTime.Today.AddYears(1);

                    foreach (Membership membership in renewedMemberships)
                    {
                        if (membership.OrganizationId == Organization.PPSEid)
                        {
                            if (membership.Expires > DateTime.Now)
                            {
                                // Set to one year from today or one year from previous expiry, whichever is greater

                                masterNewExpiry = membership.Expires.AddYears(1);
                            }
                        }
                    }

                    foreach (Membership renewedMembership in renewedMemberships)
                    {
                        renewedMembership.Expires = masterNewExpiry;

                        Activizr.Logic.Support.PWEvents.CreateEvent(EventSource.SMS, EventType.ReceivedMembershipPayment,
                                                                    person.Identity, renewedMembership.OrganizationId,
                                                                    person.Geography.Identity, person.Identity, 0, Request.UserHostAddress);

                        PWLog.Write(PWLogItem.Person, person.Identity, PWLogAction.MembershipRenewed,
                                    "Membership in " + renewedMembership.Organization.NameShort + " renewed.",
                                    "Membership was renewed over SMS from phone# " + phone + " and will expire " + masterNewExpiry.ToString("yyyy-MM-dd") + ".");
                    }

                    // Renew all memberships. Easist done by logging an event of repayment
                    break;

                default:
                    closeCase = false;
                    break;
                }

                if (closeCase)
                {
                    openCase.CloseWithComment("Handled from PirateWeb interface, using option " + selectedValue + ".");
                }
            }
        }

        PopulateGrid();
        this.GridInbox.Rebind();
    }
 public override void MarkAsClosed(SupportCase supportCase, string finalizer, string finalizeMessage)
 {
 }
 public override void Process(SupportCase supportCase)
 {
     _messagingService.RespondToClient(supportCase);
 }
Esempio n. 17
0
        public static async Task AddAsync(Customer customer, SupportCase supportCase)
        {
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                try
                {
                    conn.Open();
                    SqlCommand sqlCommand = new SqlCommand("SELECT COUNT(*) from customers where SSNumber = @SSN", conn);
                    sqlCommand.Parameters.AddWithValue("@SSN", customer.SSN);
                    int userCount = (int)sqlCommand.ExecuteScalar();

                    if (userCount > 0)
                    {
                        var        query = @"
                        INSERT INTO SupportCases (CustomerNumber, Status, Description, Title, Category, Time)
                        VALUES(@CustomerNumber, @Status, @Description, @Title, @Category, @Time)
                        ";
                        SqlCommand cmd   = new SqlCommand(query, conn);

                        cmd.Parameters.AddWithValue("@CustomerNumber", customer.SSN);
                        cmd.Parameters.AddWithValue("@Status", supportCase.Status);
                        cmd.Parameters.AddWithValue("@Description", supportCase.Description);
                        cmd.Parameters.AddWithValue("@Title", supportCase.Title);
                        cmd.Parameters.AddWithValue("@Category", supportCase.Category);
                        cmd.Parameters.AddWithValue("@Time", supportCase.Time);

                        await cmd.ExecuteReaderAsync();
                    }

                    else
                    {
                        var        query = @"
                        INSERT INTO Customers (SSNumber, Name, PhoneNumber, Email) 
                        VALUES(@SSNumber, @Name, @PhoneNumber, @Email)
                        INSERT INTO SupportCases (CustomerNumber, Status, Description, Title, Category, Time)
                        VALUES(@CustomerNumber, @Status, @Description, @Title, @Category, @Time)
                        ";
                        SqlCommand cmd   = new SqlCommand(query, conn);

                        cmd.Parameters.AddWithValue("@CustomerNumber", customer.SSN);
                        cmd.Parameters.AddWithValue("@Status", supportCase.Status);
                        cmd.Parameters.AddWithValue("@Description", supportCase.Description);
                        cmd.Parameters.AddWithValue("@Title", supportCase.Title);
                        cmd.Parameters.AddWithValue("@Category", supportCase.Category);
                        cmd.Parameters.AddWithValue("@Time", supportCase.Time);

                        cmd.Parameters.AddWithValue("@SSNumber", customer.SSN);
                        cmd.Parameters.AddWithValue("@Name", customer.Name);
                        cmd.Parameters.AddWithValue("@PhoneNumber", customer.PhoneNumber);
                        cmd.Parameters.AddWithValue("@Email", customer.Email);

                        await cmd.ExecuteReaderAsync();
                    }

                    conn.Close();
                }
                catch {}
                finally
                {
                    conn.Close();
                }
            }
        }
Esempio n. 18
0
 public async Task SendSupportRequest([FromForm] SupportCase supportCase)
 {
     await _sendgrid.EmailGeneralSupportQueue(supportCase);
 }
 public override void MarkAsClosed(SupportCase supportCase, string finalizer, string finalizeMessage)
 {
 }
 public override void Process(SupportCase supportCase)
 {
     _messagingService.RespondToClient(supportCase);
 }
 public override void MarkAsClosed(SupportCase supportCase, string finalizer, string finalizeMessage)
 {
     supportCase.Finalize(finalizer, finalizeMessage);
     _messagingService.RespondToClient(supportCase);
     _messagingService.WriteToLog(supportCase);
 }
 public override void MarkAsClosed(SupportCase supportCase, string finalizer, string finalizeMessage)
 {
     supportCase.Finalize(finalizer, finalizeMessage);
     _messagingService.RespondToClient(supportCase);
     _messagingService.WriteToLog(supportCase);
 }