Esempio n. 1
0
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            string id = Dgv.SelectedRows[0].Cells[0].Value.ToString();

            if (!String.IsNullOrEmpty(RowTitleText.Text))
            {
                MySql sql = new MySql();
                sql.OpenConnection();

                if (sql.EditComponent(ControlType, id, RowTitleText.Text, RowDescText.Text))
                {
                    MessageBox.Show("Successfully Updated!\n For advanced updates please click the Edit " + ControlType + " button. ");
                }
                else
                {
                    MessageBox.Show("No updates detected!\n For advanced updates please click the Edit " + ControlType + " button. ");
                }

                sql.CloseConnection();
            }
            else
            {
                MessageBox.Show(ControlType + " Title must not be empty!", "Missing attributes");
                return;
            }

            setDgv();
            RowTitleText.Clear();
            RowDescText.Clear();
            UpdateBtn.Visible = false;
        }
Esempio n. 2
0
 private void Dgv_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (Dgv.SelectedRows.Count > 1)
     {
         DeleteBtn.Text  = "Delete " + ControlType + "s";
         EditBtn.Enabled = false;
         RowTitleText.Clear();
         RowDescText.Clear();
     }
     else
     {
         DeleteBtn.Text    = "Delete " + ControlType;
         EditBtn.Enabled   = true;
         RowTitleText.Text = Dgv.SelectedRows[0].Cells[1].Value.ToString();
         RowDescText.Text  = Dgv.SelectedRows[0].Cells[2].Value.ToString();
     }
     UpdateBtn.Visible = false;
 }