Example #1
0
        private void upd_info_button_Click(object sender, EventArgs e)
        {
            if (nameTextBox.Text == "" || usernameTextBox.Text == "" || passwordTextBox.Text == "")
            {
                MessageBox.Show("Please, insert all specified values.");
            }
            else
            {
                int r = controllerObj.A_UpdateAdmin(nameTextBox.Text.ToString(), usernameTextBox.Text.ToString(), passwordTextBox.Text.ToString(), (int)_aid);

                if (r > 0)
                {
                    MessageBox.Show("Information updated successfully");
                }
                else
                {
                    MessageBox.Show("Error in updating information.");
                }
            }
        }
        private void upd_admin_button_Click(object sender, EventArgs e)
        {
            if (nameTextBox.Text == "" || usernameTextBox.Text == "" || passwordTextBox.Text == "")
            {
                MessageBox.Show("Please, insert all specified values.");
            }
            else
            {
                int r = controllerObj.A_UpdateAdmin(nameTextBox.Text.ToString(), usernameTextBox.Text.ToString(), passwordTextBox.Text.ToString(), Convert.ToInt32(adminsComboBox.SelectedValue));

                if (r > 0)
                {
                    MessageBox.Show("Admin updated successfully");
                    DataTable dt = controllerObj.SelectAdmin_name_id();
                    adminsComboBox.DataSource    = dt;
                    adminsComboBox.DisplayMember = "Name";
                    adminsComboBox.ValueMember   = "AID";
                }
                else
                {
                    MessageBox.Show("Error in updating admin.");
                }
            }
        }