Пример #1
0
 private void btnDataGrid_Click(object sender, EventArgs e)
 {
     foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
     foodTypeBindingSource.DataSource = Food_TypeBUS.GetAll();
     combSizeFilter.DataSource        = Food_SizeBUS.GetAll();
     combTypeFilter.DataSource        = Food_TypeBUS.GetAll();
     foodDishBindingSource.DataSource = Food_DishBUS.GetAll();
 }
Пример #2
0
 private void btnDataGridRef_Click(object sender, EventArgs e)
 {
     foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
     foodTypeBindingSource.DataSource = Food_TypeBUS.GetAll();
     combSizeFilter.DataSource        = Food_SizeBUS.GetAll();
     combTypeFilter.DataSource        = Food_TypeBUS.GetAll();
     foodDishBindingSource.DataSource = Food_DishBUS.dish_NotLocked();
     txtSearchName.Clear();
 }
Пример #3
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     panCRUD.Enabled                  = false;
     panFilter.Enabled                = false;
     panSave.Enabled                  = true;
     panType_Size.Enabled             = false;
     dataGridDish.Enabled             = false;
     foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
     foodTypeBindingSource.DataSource = Food_TypeBUS.GetAll();
 }
Пример #4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     comboSize.DataSource = Food_SizeBUS.GetAll();
     comboType.DataSource = Food_TypeBUS.GetAll();
     foodDishBindingSource.Add(new Food_Dish());
     foodDishBindingSource.MoveLast();
     dataGridDish.Enabled = false;
     panCRUD.Enabled      = false;
     panFilter.Enabled    = false;
     panSave.Enabled      = true;
     panType_Size.Enabled = false;
 }
Пример #5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSizeName.Text))
     {
         MessageBox.Show("Name field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtSizeName.Focus();
     }
     else
     {
         Food_Size obj = foodSizeBindingSource.Current as Food_Size;
         if (obj.Id == 0)
         {
             if (Food_SizeBUS.checkName(txtSizeName.Text))
             {
                 MessageBox.Show("This name is already exist", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtSizeName.Focus();
             }
             else
             {
                 Food_SizeBUS.insert(obj);
                 foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
                 foodSizeBindingSource.MoveLast();
                 MessageBox.Show("Add successfully!", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 panCRUD.Enabled = true;
                 panSave.Enabled = false;
             }
         }
         else
         {
             Food_SizeBUS.edit(obj);
             MessageBox.Show("Update successfully!", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
             panCRUD.Enabled = true;
             panSave.Enabled = false;
         }
     }
 }
Пример #6
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     panSave.Enabled = false;
     panCRUD.Enabled = true;
     foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
 }
Пример #7
0
 private void btnRef_Click(object sender, EventArgs e)
 {
     foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll();
 }