private void viewKiosk_Click(object sender, EventArgs e) { kioskRequest viewKiosk = new kioskRequest(); viewKiosk.Show(); conn.Close(); this.Close(); }
private void viewKiosk_Click(object sender, EventArgs e) { kioskRequest viewKiosk = new kioskRequest(); if (labelRole.Text == "manager") { viewKiosk.coordButton.Enabled = false; } viewKiosk.Show(); this.Close(); }
private void viewKioskRequestToolStripMenuItem_Click(object sender, EventArgs e) { kioskRequest openRequests = new kioskRequest(); if (coordButton.Enabled == true || mangButton.Enabled == true) { if (coordButton.Enabled == true) { openRequests.coordButton.Enabled = true; openRequests.mangButton.Enabled = false; } else { openRequests.coordButton.Enabled = false; openRequests.mangButton.Enabled = true; } openRequests.Show(); this.Close(); } else { MessageBox.Show("Sorry, you do not have the needed permissions to access this page."); } }
private void dashboardGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { /*generates ticketDetails window populated with database information relevant to datagridview cell selected * ticketDetails viewTicket = new ticketDetails(); * viewTicket.ticketIDText.Text = this.dashboardGrid.CurrentRow.Cells[0].Value.ToString(); * viewTicket.unitIDText.Text = this.dashboardGrid.CurrentRow.Cells[1].Value.ToString(); * viewTicket.equipmentCombo.SelectedValue = this.dashboardGrid.CurrentRow.Cells[2].Value.ToString(); * viewTicket.dateSubmittedDateTimePicker.Text = this.dashboardGrid.CurrentRow.Cells[4].Value.ToString(); * viewTicket.priorityCombo.Text = this.dashboardGrid.CurrentRow.Cells[3].Value.ToString(); * viewTicket.statusCombo.Text = this.dashboardGrid.CurrentRow.Cells[5].Value.ToString(); * viewTicket.welderSignatureText.Text = this.dashboardGrid.CurrentRow.Cells[6].Value.ToString();*/ //create data source and static variables string connectionString = @"Data Source = 10.135.85.184; Initial Catalog = GROUP6; Persist Security Info = True; User ID = Group6; Password = Grp6s2117; MultipleActiveResultSets=true"; SqlConnection con = new SqlConnection(connectionString); int numID = 0; //pull number of rows from database in order to create ticketID con.Open(); SqlCommand comm = new SqlCommand("SELECT COUNT(*) FROM Tickets", con); Int32 count = (Int32)comm.ExecuteScalar(); con.Close(); //create strings for all variables numID = count + 1; /* * using (SqlConnection openCon = new SqlConnection(connectionString)) * { * string injection = "INSERT into Kiosk (ticketID, unitID, equipmentID, priorityLevel, technicianName, additionalInfo, dateSubmitted) VALUES (@ticketID,@unitID,@equipmentID,@priorityLevel, @technicianName, @additionalInfo, @dateSubmitted)"; * using (SqlCommand command = new SqlCommand(injection)) * { * command.Connection = openCon; * command.Parameters.Add("@ticketID", SqlDbType.NVarChar, 50).Value = numID; * command.Parameters.Add("@unitID", SqlDbType.NChar, 10).Value = unitID; * command.Parameters.Add("@equipmentID", SqlDbType.NChar, 10).Value = equipmentID; * command.Parameters.Add("@priorityLevel", SqlDbType.NChar, 10).Value = priorityLevel; * command.Parameters.Add("@technicianName", SqlDbType.NVarChar, 50).Value = technicianName; * command.Parameters.Add("@additionalInfo", SqlDbType.NVarChar, 1000).Value = additionalInfo; * command.Parameters.Add("@dateSubmitted", SqlDbType.DateTime, 30).Value = date; * openCon.Open(); * command.ExecuteNonQuery(); * } * }*/ DialogResult dialogResult = MessageBox.Show("Do you want to approve this ticket?", "Ticket Approval", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { using (SqlConnection openCon = new SqlConnection(connectionString)) { DateTime dateValue; string injection = "INSERT into Tickets (ticketID, unitID, equipmentID, priorityLevel, dateSubmitted, additionalInformation, employeeName) VALUES (@ticketID,@unitID,@equipmentID,@priorityLevel, @dateSubmitted, @additionalInformation, @technicianName)"; using (SqlCommand cmd = new SqlCommand(injection)) { cmd.Connection = openCon; cmd.Parameters.AddWithValue("@ticketID", numID); cmd.Parameters.AddWithValue("@unitID", this.dashboardGrid.CurrentRow.Cells[1].Value.ToString()); cmd.Parameters.AddWithValue("@equipmentID", this.dashboardGrid.CurrentRow.Cells[2].Value.ToString()); cmd.Parameters.AddWithValue("@priorityLevel", this.dashboardGrid.CurrentRow.Cells[3].Value.ToString()); cmd.Parameters.AddWithValue("@dateSubmitted", this.dashboardGrid.CurrentRow.Cells[6].Value.ToString()); cmd.Parameters.AddWithValue("@additionalInformation", this.dashboardGrid.CurrentRow.Cells[5].Value.ToString()); cmd.Parameters.AddWithValue("@technicianName", this.dashboardGrid.CurrentRow.Cells[4].Value.ToString()); openCon.Open(); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Ticket approved and added to Database."); } } } int value; string str = this.dashboardGrid.CurrentRow.Cells[0].Value.ToString(); value = Int32.Parse(str); try { using (SqlConnection con2 = new SqlConnection("Data Source = 10.135.85.184; Initial Catalog = Group6; User ID = Group6; Password = Grp6s2117")) { using (SqlCommand commandDel = new SqlCommand("DELETE FROM Kiosk WHERE ticketID = " + value)) { commandDel.Connection = con2; con2.Open(); commandDel.ExecuteNonQuery(); } } //MessageBox.Show("Weld Request Denied."); kioskRequest refresh = new kioskRequest(); this.Close(); refresh.Show(); } catch (SystemException ex) { MessageBox.Show(string.Format("An error occurred: {0}", ex.Message)); } } else if (dialogResult == DialogResult.No) { DialogResult dialogResult2 = MessageBox.Show("Are you sure? Ticket request will be deleted.", "Deny Ticket?", MessageBoxButtons.YesNo); if (dialogResult2 == DialogResult.Yes) { int value; string str = this.dashboardGrid.CurrentRow.Cells[0].Value.ToString(); value = Int32.Parse(str); int place = 107 - value; try { using (SqlConnection con2 = new SqlConnection("Data Source = 10.135.85.184; Initial Catalog = Group6; User ID = Group6; Password = Grp6s2117")) { using (SqlCommand commandDel = new SqlCommand("DELETE FROM Kiosk WHERE ticketID = " + value)) { commandDel.Connection = con2; con2.Open(); commandDel.ExecuteNonQuery(); } } MessageBox.Show("Weld Request Denied."); kioskRequest refresh = new kioskRequest(); this.Close(); refresh.Show(); } catch (SystemException ex) { MessageBox.Show(string.Format("An error occurred: {0}", ex.Message)); } } else { } } }