public void PrintResult() { try { var l1Support = new Level1Support(); var l2Support = new Level2Support(); var l3Support = new Level3Support(); var requestAssign = new RequestAssign(); l1Support.AssignToNextLevel(l2Support).AssignToNextLevel(l3Support); requestAssign.HandleRequest(l1Support, "L3"); requestAssign.HandleRequest(l3Support, "L1"); } catch (Exception ex) { Console.WriteLine($"Error:{ex.Message}"); } }
private void unassignedTicketsList_MouseDoubleClick(object sender, MouseEventArgs e) { //-------------------------------------------- //Assigns the clicked trouble ticket to solver //-------------------------------------------- RequestAssign request = new RequestAssign(); request.id = this.unassignedTicketsList.SelectedItems[0].SubItems[0].Text; request.solverId = this.solverid; request.solverName = this.name; ResponseAssign response = (ResponseAssign)WebRequestPost.makeRequest <ResponseAssign>("/troubletickets/assign", request); if (response.error.Equals("1")) { MessageBox.Show( response.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!response.error.Equals("0")) { MessageBox.Show( "What??", "Seriously, what?", MessageBoxButtons.OK, MessageBoxIcon.Question); } //-------------------------------------------- //Creates new window showAssignedTicketITSolver wind = new showAssignedTicketITSolver(); wind.name = this.name; wind.email = this.email; wind.solverid = this.solverid; wind.ticketId = this.unassignedTicketsList.SelectedItems[0].SubItems[0].Text; bool ctrl = false; //-------------------------------------------- //Request information for the clicked trouble ticket //-------------------------------------------- RequestTroubleTicket request2 = new RequestTroubleTicket(); request2.id = this.unassignedTicketsList.SelectedItems[0].SubItems[0].Text; ResponseTroubleTicket response2 = (ResponseTroubleTicket)WebRequestPost.makeRequest <ResponseTroubleTicket>("/troubletickets/get", request2); if (response2.error.Equals("1")) { MessageBox.Show( response2.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!response2.error.Equals("0")) { MessageBox.Show( "What??", "Seriously, what?", MessageBoxButtons.OK, MessageBoxIcon.Question); } //-------------------------------------------- wind.changeAnswerText(response2.answer); wind.changeDescriptionText(response2.description); wind.changeStatusText(response2.state); wind.changeTitleText(response2.title); wind.changeAuthorText(response2.name); wind.changeDateText(response2.date); //-------------------------------------------- //Request for secondary questions //-------------------------------------------- RequestSecondaryQuestions request3 = new RequestSecondaryQuestions(); request3.id = this.unassignedTicketsList.SelectedItems[0].SubItems[0].Text; ResponseSecondaryQuestions response3 = (ResponseSecondaryQuestions)WebRequestPost.makeRequest <ResponseSecondaryQuestions>("/troubletickets/getsecondaryquestions", request3); if (response3.error.Equals("1")) { MessageBox.Show( response3.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!response3.error.Equals("0")) { MessageBox.Show( "What??", "Seriously, what?", MessageBoxButtons.OK, MessageBoxIcon.Question); } //-------------------------------------------- foreach (TroubleTicket ticket in response3.secondaryQuestions) { wind.addSubTicket(ticket.id, ticket.title, ticket.state); if (ticket.state.Equals("unsolved")) { ctrl = true; } } if (ctrl == true) { wind.makeSubmitButtonUclickable(); wind.makeAnswerTextBoxUnavailable(); } refreshButton_Click(sender, e); wind.ShowDialog(); refreshButton_Click(sender, e); }