public void UpdateQueueTest() { TicketQueue temp = NewQueue(); InsertQueueIntoDatabase(temp); //Make sure the insertion worked smoothly. Assert.IsTrue(temp.Equals(SelectQueueById(temp.QueueId)), "The created queue and selected queue do not match. Insertion or selection might have failed"); //Change the values... temp.Name = "Testing Queue2"; temp.Description = "New Description"; temp.IsActive = false; temp.Creator = "blevinsn"; temp.CreationDate = DateTime.Now; //Peform the update. HelpdeskService.UpdateQueue(temp); //Create a new instance of the module object and compare them... TicketQueue temp2 = SelectQueueById(temp.QueueId); //Make sure they match. Assert.IsTrue(temp.Equals(temp2), "The updated queue did not match equality with the prepared module values in the method."); }
public static string GetTicketQueueItem(RestCommand command, int ticketQueueID) { TicketQueueItem ticketQueueItem = TicketQueue.GetTicketQueueItem(command.LoginUser, ticketQueueID); if (ticketQueueItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(ticketQueueItem.GetXml("TicketQueueItem", true)); }
public void CreateQueueTest() { TicketQueue temp = NewQueue(); HelpdeskService.CreateQueue(temp); Trace.WriteLine(temp.QueueId); Assert.IsTrue(SelectQueueById(temp.QueueId) != null, "The internal selection query used to verify this test failed to return the a row."); Assert.IsTrue(temp.QueueId > 0, "The returned Id from the CreateQueue test did not return a value greater than 0."); }
/// <summary> /// Creates shiny new queues that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private TicketQueue NewQueue() { TicketQueue expected = new TicketQueue(); expected.CreationDate = TestDate; expected.Creator = "nblevins"; expected.Description = "This is my testing description of this Queue."; expected.IsActive = true; expected.Name = "Testing Queue"; return(expected); }
public ShiftManagerTicker( ITickerManager tickerManager, WorkshiftsCM workshiftsCM, MultiLevelTicketQueue inputQueue, TicketQueue doneQueue, Accounting accounting) { this.workshiftsCM = workshiftsCM; this.tickerManager = tickerManager; this.inputQueue = inputQueue; this.doneQueue = doneQueue; this.accounting = accounting; }
public void DeleteQueueTest() { TicketQueue temp = NewQueue(); InsertQueueIntoDatabase(temp); //Make sure the insert and select are working. Assert.IsTrue(SelectQueueById(temp.QueueId) != null, "The select query failed to return any results."); HelpdeskService.DeleteQueue(temp.QueueId); Assert.IsTrue(SelectQueueById(temp.QueueId) == null, "The selection returned a row, meaning that the delete statmen failed."); }
public static string GetTicketQueue(RestCommand command) { TicketQueue ticketQueue = new TicketQueue(command.LoginUser); ticketQueue.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(ticketQueue.GetXml("TicketQueue", "TicketQueueItem", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }
public void GetAllEnabledQueuesTest() { TicketQueueCollection CreatedSet = new TicketQueueCollection(); //Select everything in teh database. TicketQueueCollection PreSelectionSet = HelpdeskService.GetAllEnabledQueues(); //Add the new items into the database and keep of collection of them for deletion later... for (int x = 0; x < 10; x++) { TicketQueue temp = NewQueue(); HelpdeskService.CreateQueue(temp); CreatedSet.Add(temp); } //Get teh values of everything in teh datbase now that we have done some insertions. TicketQueueCollection PostSelectionSet = HelpdeskService.GetAllEnabledQueues(); //Check their counts to make sure everything went into the database correctly. Assert.IsTrue((PreSelectionSet.Count + 10) == PostSelectionSet.Count); }
public async Task <IActionResult> Index() { var user = await _userManager.GetUserAsync(HttpContext.User); var tickets = _ticketRepository.GetAll(); var myTickets = new TicketQueue(tickets.Where(t => t.CustomerUserId == user.Id)); myTickets.QueueName = "My Tickets"; var myAssignedTickets = new TicketQueue(tickets.Where(t => t.TechnicianUserId == user.Id)); myAssignedTickets.QueueName = "Assigned Tickets"; var myGroupTickets = new TicketQueue(tickets.Where(t => t.SubTechnicalGroupId == user.SubTechnicalGroupId && t.TechnicianUserId == null)); myGroupTickets.QueueName = "Group Tickets"; var viewModel = new TicketQueueViewModel() { myTickets, myAssignedTickets, myGroupTickets }; return(View(viewModel)); }
/// <summary> /// Helper method to insert values into the database. If successful, it will set the appropriate row id. /// </summary> /// <param name="Module"></param> private void InsertQueueIntoDatabase(TicketQueue queue) { HelpdeskService.CreateQueue(queue); }
public static void CreateQueue(TicketQueue queue) { LoadProviders(); _provider.CreateQueue(queue); }
/// <summary> /// Creates shiny new queues that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private TicketQueue NewQueue() { TicketQueue expected = new TicketQueue(); expected.CreationDate = TestDate; expected.Creator = "nblevins"; expected.Description = "This is my testing description of this Queue."; expected.IsActive = true; expected.Name = "Testing Queue"; return expected; }
private void BtnLogin_Click(object sender, EventArgs e) { ////////////// try { connectionstring = (@"Data Source=isys4363.walton.uark.edu;Initial Catalog=TicketingSystem;User ID=isys4363a;Password=GohogsUA20"); var cmd1 = "SELECT * FROM Login WHERE UserID= '" + txtUsername.Text.Trim() + "' and Password = '******' and UserType = '" + User_Type_cmbox.SelectedItem.ToString() + "'"; //Data Source=essql1.walton.uark.edu;Initial Catalog=PROJECTS2050;User ID=PROJECTS2050;Password=MV05sts$ //SqlDataAdapter SDA = new SqlDataAdapter(Authentication, connection); } catch { MessageBox.Show("Please fill out all fields"); } //DataTable Logintbl = new DataTable(); //SDA.Fill(Logintbl); connectionstring = (@"Data Source=isys4363.walton.uark.edu;Initial Catalog=TicketingSystem;User ID=isys4363a;Password=GohogsUA20"); var cmd = "SELECT * FROM Login WHERE UserID= '" + txtUsername.Text.Trim() + "' and Password = '******' and UserType = '" + User_Type_cmbox.SelectedItem.ToString() + "'"; connection = new SqlConnection(connectionstring); connection.Open(); var dataadapter = new SqlDataAdapter(cmd, connection); var ds = new DataSet(); dataadapter.Fill(ds); connection.Close(); DataTable dt = new DataTable(); if ((ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0) && (txtUsername.Text != "") && (txtPassword.Text != "") && (User_Type_cmbox.SelectedIndex > -1)) { Form Admin = new TicketInformation(); Form Supervisor = new TicketQueue(); Form User = new Submit_Ticket(); MessageBox.Show("Login Successful"); this.Hide(); if (User_Type_cmbox.SelectedIndex == 0)//Admin { Admin.Show(); } else { if (User_Type_cmbox.SelectedIndex == 1)//STAFF { LoginIDInfo2 = LoginIDtxt.Text; User.Show(); } else { if (User_Type_cmbox.SelectedIndex == 2)//STUDENT { LoginIDInfo2 = LoginIDtxt.Text; User.Show(); } else { if (User_Type_cmbox.SelectedIndex == 3)//Supervisor { Supervisor.Show(); } else { MessageBox.Show("Please Choose Status"); } } } } } else { MessageBox.Show("Authentication not complete.", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Helper method to insert values into the database. If successful, it will set the appropriate row id. /// </summary> /// <param name="Module"></param> private void InsertQueueIntoDatabase(TicketQueue queue) { HelpdeskService.CreateQueue(queue); }
public async Task <IActionResult> CreateTicket([FromBody] TicketCreateDto ticketCreate) { var createdById = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); User createdBy = await _userRepo.GetUser(createdById); if (createdBy == null) { ModelState.AddModelError("CreatedBy", "User does not exist"); } User assignedTo = await _userRepo.GetUser(ticketCreate.AssignedToId); if (assignedTo == null) { ModelState.AddModelError("AssignedTo", "User does not exist"); } Client client = await _clientRepo.GetClient(ticketCreate.ClientId); if (client == null) { ModelState.AddModelError("Client", "Client does not exist"); } ConfigItem item = await _clientRepo.GetConfigItem(ticketCreate.ConfigItemId); if (item == null) { ModelState.AddModelError("Config Item", "Configuration Item does not exist"); } TicketPriority priority = await _repo.GetTicketPriority(ticketCreate.TicketPriorityId); if (priority == null) { ModelState.AddModelError("Ticket Priority", "Priority does not exist"); } TicketStatus status = await _repo.GetTicketStatus(ticketCreate.TicketStatusId); if (status == null) { ModelState.AddModelError("Ticket Status", "Ticket Status does not exist"); } TicketType type = await _repo.GetTicketType(ticketCreate.TicketTypeId); if (type == null) { ModelState.AddModelError("Ticket Type", "Ticket Type does not exisit"); } TicketQueue queue = await _repo.GetTicketQueue(ticketCreate.TicketQueueId); if (queue == null) { ModelState.AddModelError("Queue", "Ticket Queue does not exisit"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createdAt = DateTime.Now; var updatedAt = DateTime.Now; Ticket newTicket = new Ticket { Description = ticketCreate.Description, Details = ticketCreate.Details, CreatedAt = createdAt, UpdatedAt = updatedAt, AssignedTo = assignedTo, CreatedBy = createdBy, TicketPriority = priority, TicketStatus = status, TicketType = type, TicketQueue = queue, Client = client, ConfigItem = item }; _repo.Create(newTicket); if (await _repo.Save()) { var ticketToReturn = _mapper.Map <TicketDetailDto>(newTicket); return(CreatedAtRoute("GetTicket", new { controller = "Tickets", id = newTicket.Id }, ticketToReturn)); } return(BadRequest()); }
public async Task <IActionResult> UpdateTicket(int id, [FromBody] TicketUpdateDto ticketUpdate) { Ticket ticket = await _repo.GetTicket(id); if (ticket == null) { return(NotFound()); } if (!string.IsNullOrEmpty(ticketUpdate.Description) || !string.IsNullOrWhiteSpace(ticketUpdate.Description)) { ticket.Description = ticketUpdate.Description; } if (!string.IsNullOrEmpty(ticketUpdate.Details) || !string.IsNullOrWhiteSpace(ticketUpdate.Details)) { ticket.Details = ticketUpdate.Details; } if (ticketUpdate.AssignedToId > 0) { User user = await _userRepo.GetUser(ticketUpdate.AssignedToId); if (user == null) { return(BadRequest(new { error = "User not found" })); } ticket.AssignedTo = user; } if (ticketUpdate.TicketStatusId > 0) { TicketStatus status = await _repo.GetTicketStatus(ticketUpdate.TicketStatusId); if (status == null) { return(BadRequest(new { error = "status not found" })); } ticket.TicketStatus = status; } if (ticketUpdate.TicketPriorityId > 0) { TicketPriority priority = await _repo.GetTicketPriority(ticketUpdate.TicketPriorityId); if (priority == null) { return(BadRequest(new { error = "priority not found" })); } ticket.TicketPriority = priority; } if (ticketUpdate.TicketTypeId > 0) { TicketType type = await _repo.GetTicketType(ticketUpdate.TicketTypeId); if (type == null) { return(BadRequest(new { error = "Ticket Type not found" })); } ticket.TicketType = type; } if (ticketUpdate.TicketQueueId > 0) { TicketQueue queue = await _repo.GetTicketQueue(ticketUpdate.TicketQueueId); if (queue == null) { return(BadRequest(new { error = "Ticket Queue not found" })); } ticket.TicketQueue = queue; } if (ticketUpdate.ClientId > 0) { Client client = await _clientRepo.GetClient(ticketUpdate.ClientId); if (client == null) { return(BadRequest(new { error = "Ticket Client not found" })); } ticket.Client = client; } if (ticketUpdate.ConfigItemId > 0) { ConfigItem item = await _clientRepo.GetConfigItem(ticketUpdate.ConfigItemId); if (item == null) { return(BadRequest(new { error = "Ticket Config Item not found" })); } ticket.ConfigItem = item; } ticket.UpdatedAt = DateTime.Now; if (await _repo.Save()) { var ticketToReturn = _mapper.Map <TicketDetailDto>(ticket); return(Ok(ticketToReturn)); } return(BadRequest(new { error = "Ticket cannot be saved" })); }
public abstract void CreateQueue(TicketQueue queue);
/// <summary> /// Creates shiny new queues that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private Ticket NewTicket() { //Make the complex objects and retunr their ID. TicketQueue que = new TicketQueue(0, "nblevins", "description", "QueueName", TestDate, true); HelpdeskService.CreateQueue(que); TicketCategory cat = new TicketCategory(0, "Category Name", "Category Description", true, que.QueueId); HelpdeskService.CreateCategory(cat); TicketModule mod = new TicketModule(0, que.QueueId, "Module Name", "Description", true); HelpdeskService.CreateModule(mod); Requestor req = new Requestor(0, "nbleivns", "Blevins", "444-444-4444", "*****@*****.**"); HelpdeskService.CreateRequestor(req); TicketStatus stat = new TicketStatus(0, "Status Name", "Description", 1, true); HelpdeskService.CreateStatus(stat); //Set up the ticket... Ticket temp = new Ticket(); temp.Category = cat; temp.CreationDate = TestDate; temp.Creator = "nblevins"; temp.Description = "This is my ticket decription."; temp.DueDate = TestDate + new TimeSpan(2, 0, 0); temp.Module = mod; temp.Priority = TicketPriority.Medium; temp.Requestor = req; temp.Responses = new TicketResponseCollection(); temp.Status = stat; temp.Assignment = new AssignmentCollection(); temp.Queue = que; //Build the company... Company comp = new Company(); comp.Address1 = "addy1"; comp.Address2 = "addy2"; comp.City = "some city"; comp.ContactNumber1 = "444-444-4444"; comp.ContactNumber2 = "322-333-3333"; comp.Name = "New Company"; comp.ParentId = 0; comp.State = "TN"; comp.Website = "www.sworps.com"; comp.Zip_Code = "33333-3333"; Requestor MainReq = new Requestor(); MainReq.ContactNumber = "555-555-5555"; MainReq.Email = "*****@*****.**"; MainReq.FirstName = "nathan 1"; MainReq.LastName = "bleivns 1"; HelpdeskService.CreateRequestor(MainReq); comp.MainContact = MainReq; Requestor SecReq = new Requestor(); SecReq.ContactNumber = "555-222-5555"; SecReq.Email = "*****@*****.**"; SecReq.FirstName = "nathan 2"; SecReq.LastName = "bleivns 2"; HelpdeskService.CreateRequestor(SecReq); comp.SecondaryContact = SecReq; temp.Company = comp; return temp; }
/// <summary> /// Creates shiny new queues that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private Ticket NewTicket() { //Make the complex objects and retunr their ID. TicketQueue que = new TicketQueue(0, "nblevins", "description", "QueueName", TestDate, true); HelpdeskService.CreateQueue(que); TicketCategory cat = new TicketCategory(0, "Category Name", "Category Description", true, que.QueueId); HelpdeskService.CreateCategory(cat); TicketModule mod = new TicketModule(0, que.QueueId, "Module Name", "Description", true); HelpdeskService.CreateModule(mod); Requestor req = new Requestor(0, "nbleivns", "Blevins", "444-444-4444", "*****@*****.**"); HelpdeskService.CreateRequestor(req); TicketStatus stat = new TicketStatus(0, "Status Name", "Description", 1, true); HelpdeskService.CreateStatus(stat); //Set up the ticket... Ticket temp = new Ticket(); temp.Category = cat; temp.CreationDate = TestDate; temp.Creator = "nblevins"; temp.Description = "This is my ticket decription."; temp.DueDate = TestDate + new TimeSpan(2, 0, 0); temp.Module = mod; temp.Priority = TicketPriority.Medium; temp.Requestor = req; temp.Responses = new TicketResponseCollection(); temp.Status = stat; temp.Assignment = new AssignmentCollection(); temp.Queue = que; //Build the company... Company comp = new Company(); comp.Address1 = "addy1"; comp.Address2 = "addy2"; comp.City = "some city"; comp.ContactNumber1 = "444-444-4444"; comp.ContactNumber2 = "322-333-3333"; comp.Name = "New Company"; comp.ParentId = 0; comp.State = "TN"; comp.Website = "www.sworps.com"; comp.Zip_Code = "33333-3333"; Requestor MainReq = new Requestor(); MainReq.ContactNumber = "555-555-5555"; MainReq.Email = "*****@*****.**"; MainReq.FirstName = "nathan 1"; MainReq.LastName = "bleivns 1"; HelpdeskService.CreateRequestor(MainReq); comp.MainContact = MainReq; Requestor SecReq = new Requestor(); SecReq.ContactNumber = "555-222-5555"; SecReq.Email = "*****@*****.**"; SecReq.FirstName = "nathan 2"; SecReq.LastName = "bleivns 2"; HelpdeskService.CreateRequestor(SecReq); comp.SecondaryContact = SecReq; temp.Company = comp; return(temp); }
public abstract void UpdateQueue(TicketQueue queue);