예제 #1
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows.Count == 0)
     {
         MessageBox.Show("لا يوجد فئات");
     }
     else
     {
         if (Application.OpenForms.OfType <frmCategoryCRUD>().Any())
         {
             return;
         }
         else
         {
             new frmCategoryCRUD(this, CategoriesLogic.EditButton(dataGridView1)).Show();
         }
     }
 }
예제 #2
0
        //add-update button
        private void BtnCRUD_Click(object sender, EventArgs e)
        {
            //update
            if (parameters.Count > 0)
            {
                try
                {
                    if (Edit(int.Parse(parameters[0]), txtName.Text, btnColorPicker.BackColor.Name.ToString()))
                    {
                        frmCategory.Focus();
                        CategoriesLogic.RefreshAfterEdit(frmCategory.dataGridView1);
                        parameters.Clear();
                        parameters.TrimExcess();
                        this.Close();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            //add
            else
            {
                try
                {
                    if (Insert(txtName.Text, btnColorPicker.BackColor.Name.ToString()))
                    {
                        frmCategory.Focus();
                        CategoriesLogic.RefreshAfterAdd(frmCategory.dataGridView1);
                        this.Close();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
예제 #3
0
 private void TxtSearch_TextChanged(object sender, EventArgs e)
 {
     CategoriesLogic.SearchButton(dataGridView1, txtSearch, true);
 }
예제 #4
0
 private void BtnSearch_Click(object sender, EventArgs e)
 {
     CategoriesLogic.SearchButton(dataGridView1, txtSearch, false);
 }
예제 #5
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     CategoriesLogic.DeleteButton(dataGridView1);
 }