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(); }
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(); }
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(); }
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; }
private void btnSearch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearch.Text)) { MessageBox.Show("Search field is empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { foodSizeBindingSource.DataSource = Food_SizeBUS.search(txtSearch.Text); Food_Size fsi = foodSizeBindingSource.Current as Food_Size; } txtSearch.Clear(); }
private void btnDelete_Click(object sender, EventArgs e) { try { Food_Size obj = foodSizeBindingSource.Current as Food_Size; if (MessageBox.Show("Are you sure want to delete this name ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Food_SizeBUS.delete(obj); MessageBox.Show("Delete successfully!", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information); foodSizeBindingSource.RemoveCurrent(); } } catch { MessageBox.Show("Can not delete this name!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGrid_CellClick(object sender, DataGridViewCellEventArgs e) { Food_Dish fdish = foodDishBindingSource.Current as Food_Dish; if (fdish.Id != 0) { int typeID = fdish.TypeId; int sizeID = fdish.SizeId; foodTypeBindingSource.DataSource = Food_TypeBUS.showType(typeID); foodSizeBindingSource.DataSource = Food_SizeBUS.showSize(sizeID); if (fdish.imaGeURL != null) { picBox.Image = Image.FromFile(fdish.imaGeURL); } else { picBox.Image = null; } } }
private void dataDishView_CellClick(object sender, DataGridViewCellEventArgs e) { txtChangeQuan.Enabled = false; btnChangeQuan.Enabled = false; txtNumberD.Enabled = true; btnOrder.Enabled = true; Food_Dish fdish = foodDishBindingSource.Current as Food_Dish; if (fdish.Id != 0) { int typeID = fdish.TypeId; int sizeID = fdish.SizeId; foodTypeBindingSource.DataSource = Food_TypeBUS.showType(typeID); foodSizeBindingSource.DataSource = Food_SizeBUS.showSize(sizeID); //picBox.Image = Image.FromFile(fdish.imaGeURL); txtNumberD.Clear(); } else { return; } }
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; } } }
private void btnCancel_Click(object sender, EventArgs e) { panSave.Enabled = false; panCRUD.Enabled = true; foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll(); }
private void btnRef_Click(object sender, EventArgs e) { foodSizeBindingSource.DataSource = Food_SizeBUS.GetAll(); }