private void UpdateButton_Click(object sender, EventArgs e) { if (tempUSN != "") { SqlCommand cmd = new SqlCommand("UpdateClass_SP", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@usn", tempUSN); cmd.Parameters.AddWithValue("@ssid", SSIDTextField.Text); con.Open(); try { cmd.ExecuteNonQuery(); UpdateStatusLabel.ForeColor = Color.Green; UpdateStatusLabel.Text = "Updated successfully"; UpdateStatusLabel.Show(); } catch (Exception) { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Error!"; UpdateStatusLabel.Show(); MessageBox.Show("Value is missing ;\nUSN or SSID not found,\nTry again with a valid details."); } con.Close(); ClassdataGridView(); } else { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Value is empty!"; UpdateStatusLabel.Show(); } }
private void Exams_UC_MouseClick(object sender, MouseEventArgs e) { SearchStatusLabel.Hide(); AddStatusLabel.Hide(); UpdateStatusLabel.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 UpdateStatusButton_Click(object sender, EventArgs e) { if (tempUSN != "" || tempSubcode != "") { int a = Convert.ToInt32(numericUpDown1.Value); int b = Convert.ToInt32(numericUpDown2.Value); int c = Convert.ToInt32(numericUpDown3.Value); int f; if (a < b && a < c) { f = (b + c) / 2; } else if (b < a && b < c) { f = (a + c) / 2; } else { f = (a + b) / 2; } using (SqlCommand cmd = new SqlCommand("UpdateExam_SP", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@usn", tempUSN); cmd.Parameters.AddWithValue("@subCode", tempSubcode); cmd.Parameters.AddWithValue("@test1", a); cmd.Parameters.AddWithValue("@test2", b); cmd.Parameters.AddWithValue("@test3", c); cmd.Parameters.AddWithValue("@final", f); con.Open(); try { cmd.ExecuteNonQuery(); UpdateStatusLabel.ForeColor = Color.Green; UpdateStatusLabel.Text = "Updated successfully"; UpdateStatusLabel.Show(); } catch (Exception) { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Error!"; UpdateStatusLabel.Show(); } con.Close(); } ExamdataGridView(); } else { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Value is empty!"; UpdateStatusLabel.Show(); } }
private void Settings_UC_MouseClick(object sender, MouseEventArgs e) { IDTextField.Text = ""; NameTextField.Text = ""; UsernameTextField.Text = ""; PasswordTextField.Text = ""; PhoneTextField.Text = ""; UpdateStatusLabel.Hide(); DeleteStatusLabel.Hide(); }
public Form1() { InitializeComponent(); axWindowsMediaPlayer1.settings.mute = true; updateStatusLabelDelegate = new UpdateStatusLabel(UpdateLabel); resetStatusLabelDelegate = new ResetStatusLabel(LabelReset); fileSearchThread = new FileSearchThread(); updateLabelThread = new UpdateLabelThread(this); ResetPreviewWindows(); }
private void UpdateButton_Click(object sender, EventArgs e) { if (UsernameTextField.Text != "") { using (SqlCommand cmd = new SqlCommand("UpdateAdmin_SP", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@username", UsernameTextField.Text); cmd.Parameters.AddWithValue("@password", PasswordTextField.Text); cmd.Parameters.AddWithValue("@phone", PhoneTextField.Text); con.Open(); try { cmd.ExecuteNonQuery(); UpdateStatusLabel.ForeColor = Color.Green; UpdateStatusLabel.Text = "Updated successfully"; UpdateStatusLabel.Show(); } catch (Exception) { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Error!"; UpdateStatusLabel.Show(); } con.Close(); SettingdataGridView(); } } else { UpdateStatusLabel.ForeColor = Color.Red; UpdateStatusLabel.Text = "Value is empty!"; UpdateStatusLabel.Show(); } }
private void SearchNameTextField_MouseClick(object sender, MouseEventArgs e) { SearchUSNTextField.Text = ""; SearchStatusLabel.Hide(); UpdateStatusLabel.Hide(); }