Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class incidentCategorySearchControl : UserControl
- {
- public static incidentCategorySearchControl Instance { get; set; }
- public incidentCategorySearchControl()
- {
- InitializeComponent();
- Instance = this;
- // This line of code is generated by Data Source Configuration Wizard
- incIncidentCategoryTableAdapter1.Fill(reinvenT_QualityDataSet1.IncIncidentCategory);
- }
- public void updateGridControl()
- {
- MessageBox.Show("..........." );
- //categoryGridControl.RefreshDataSource();
- incIncidentCategoryTableAdapter1.Fill(reinvenT_QualityDataSet1.IncIncidentCategory);
- }
- }
- private void saveCategoryChangeButton_Click(object sender, EventArgs e)
- {
- if (incidentCategoryDescTextBox.Text.Trim().Length == 0)
- {
- MessageBox.Show("Opslaan mislukt controleer a.u.b. of alle verplichte velden juist zijn ingevuld");
- }
- else
- {
- try
- {
- using (SqlConnection con = new SqlConnection(SqlServerConnection.sqlConnection.ConnectionString))
- {
- con.Open();
- using (SqlCommand cmd = new SqlCommand("UPDATE IncIncidentCategory SET IncIncidentCatDescription = @categoryDescription WHERE IncIncidentCategory = @categoryId", con))
- {
- IncidentCategory incidentCategoryUpdate = new IncidentCategory(Convert.ToInt32(incidentCategoryTextBox.Text), incidentCategoryDescTextBox.Text);
- cmd.CommandType = CommandType.Text;
- cmd.Parameters.AddWithValue("@categoryId", incidentCategoryUpdate._categoryId);
- cmd.Parameters.AddWithValue("@categoryDescription", incidentCategoryUpdate._description);
- cmd.ExecuteNonQuery();
- MessageBox.Show("Wijzigingen opgeslagen");
- }
- }
- incidentTypeChange.Instance.refreshCategorySearchBox();
- incidentTypeMaintenance.Instance.refreshCategorySearchBox();
- incidentCategorySearchControl.Instance.updateGridControl(); // update doesn't work
- //var control = new incidentCategorySearchControl();
- //control.updateDataGridView();
- }
- catch
- {
- MessageBox.Show("Voer voor beide velden geldige waarden in a.u.b.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement