Beispiel #1
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (DepartmentNameTextBox.Text == "")
            {
                MessageBox.Show("Please, enter a department name.");
            }
            else
            {
                int r = controllerObj.A_UpdateDepartment(Convert.ToInt32(DepartmentsComboBox.SelectedValue), DepartmentNameTextBox.Text.ToString());

                if (r > 0)
                {
                    MessageBox.Show("Department updated successfully.");

                    DataTable dt1 = controllerObj.SelectDepIDsNames();
                    DepartmentsComboBox.DataSource    = dt1;
                    DepartmentsComboBox.DisplayMember = "Name";
                    DepartmentsComboBox.ValueMember   = "DepID";
                }
                else
                {
                    MessageBox.Show("Error in updating department.");
                }
            }
        }