private void refreshButton_Click(object sender, EventArgs e) { RequestSecondaryQuestions request3 = new RequestSecondaryQuestions(); request3.id = this.ticketId; 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); } bool ctrl = false; this.subTicketsList.Items.Clear(); foreach (TroubleTicket ticket in response3.secondaryQuestions) { addSubTicket(ticket.id, ticket.title, ticket.state); if (ticket.state.Equals("waiting")) { ctrl = true; } } if (ctrl) { makeSubmitButtonUclickable(); makeAnswerTextBoxUnavailable(); } else { activateAnswerTextBox(); activateSubmitButton(); } }
private void assignedTicketsList_MouseDoubleClick(object sender, MouseEventArgs e) { //Creates new window showAssignedTicketITSolver wind = new showAssignedTicketITSolver(); wind.name = this.name; wind.email = this.email; wind.solverid = this.solverid; wind.ticketId = this.assignedTicketsList.SelectedItems[0].SubItems[0].Text; bool ctrl = false; //-------------------------------------------------- //Request information for the clicked trouble ticket //-------------------------------------------------- RequestTroubleTicket request2 = new RequestTroubleTicket(); request2.id = this.assignedTicketsList.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); if (response2.answer != null) { if (!response2.answer.Equals("")) { wind.makeAnswerTextBoxUnavailable(); wind.makeSubmitButtonUclickable(); wind.makeSubmitIssueButtonUnclickable(); wind.makeRefreshButtonUnclickable(); } } 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.assignedTicketsList.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("waiting")) { ctrl = true; } } if (ctrl == true) { wind.makeSubmitButtonUclickable(); wind.makeAnswerTextBoxUnavailable(); } wind.ShowDialog(); this.refreshButton_Click(sender, e); }