private void Section_UC_MouseClick(object sender, MouseEventArgs e) { AddStatusLabel.Hide(); DeleteStatusLabel.Hide(); RefreshStatusLabel.Hide(); ClearedLabel.Hide(); }
private void Subjects_UC_MouseClick(object sender, MouseEventArgs e) { SearchStatusLabel.Hide(); AddStatusLabel.Hide(); DeleteStatusLabel.Hide(); RefreshedLabel.Hide(); ClearedLabel.Hide(); }
private void Students_UC_MouseClick(object sender, MouseEventArgs e) { AddedLabel.Hide(); UpdateStatusLabel.Hide(); DeleteStatusLabel.Hide(); RefreshedLabel.Hide(); ClearedLabel.Hide(); SearchStatusLabel.Text = ""; }
private void Settings_UC_MouseClick(object sender, MouseEventArgs e) { IDTextField.Text = ""; NameTextField.Text = ""; UsernameTextField.Text = ""; PasswordTextField.Text = ""; PhoneTextField.Text = ""; UpdateStatusLabel.Hide(); DeleteStatusLabel.Hide(); }
private void DeleteButton_Click(object sender, EventArgs e) { if (tempSubcode != "" || tempTitle != "") { DialogResult result = MessageBox.Show("Do you really want to delete subject with subject code '" + tempSubcode + "' ?", "Confirmation", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { using (SqlCommand cmd = new SqlCommand("DeleteSubject_SP", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@subCode", tempSubcode); cmd.Parameters.AddWithValue("@title", tempTitle); con.Open(); try { cmd.ExecuteNonQuery(); DeleteStatusLabel.ForeColor = Color.Green; DeleteStatusLabel.Text = "Deleted successfully"; DeleteStatusLabel.Show(); } catch (Exception) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Error!"; DeleteStatusLabel.Show(); } con.Close(); SubjectdataGridView(); } } else if (result == DialogResult.No) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Cancelled"; DeleteStatusLabel.Show(); } else { // } } else { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Value is empty!"; DeleteStatusLabel.Show(); } }
private void DeleteButton_Click(object sender, EventArgs e) { if (SSIDTextField.Text != "") { DialogResult result = MessageBox.Show("Do you really want to delete '" + SSIDTextField.Text + "' ?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { using (SqlCommand cmd = new SqlCommand("DeleteSection_SP", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ssid", SSIDTextField.Text); con.Open(); try { cmd.ExecuteNonQuery(); DeleteStatusLabel.ForeColor = Color.Green; DeleteStatusLabel.Text = "Deleted successfully"; DeleteStatusLabel.Show(); } catch (Exception z) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Error!"; DeleteStatusLabel.Show(); MessageBox.Show("" + z); } con.Close(); } SectiondataGridView(); } else if (result == DialogResult.No) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Cancelled!"; DeleteStatusLabel.Show(); } else { // } } else { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Value is empty!"; DeleteStatusLabel.Show(); } }
public void DeleteButton_Click(object sender, EventArgs e) { if (UsernameTextField.Text != "") { DialogResult result = MessageBox.Show("Do you really want to delete the user '" + UsernameTextField.Text + "' ?\nThe user won't be able to login to the system after deletion.", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SqlCommand cmd = new SqlCommand("DeleteAdmin_SP", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@username", UsernameTextField.Text); con.Open(); try { cmd.ExecuteNonQuery(); DeleteStatusLabel.ForeColor = Color.Green; DeleteStatusLabel.Text = "Deleted successfully"; DeleteStatusLabel.Show(); } catch (Exception) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Error!"; DeleteStatusLabel.Show(); } con.Close(); SettingdataGridView(); } else if (result == DialogResult.No) { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "Cancelled"; DeleteStatusLabel.Show(); } else { //DeleteStatusLabel.ForeColor = Color.Red; //DeleteStatusLabel.Text = "Value is empty!"; //DeleteStatusLabel.Show(); } } else { DeleteStatusLabel.ForeColor = Color.Red; DeleteStatusLabel.Text = "value is empty!"; DeleteStatusLabel.Show(); } }