public Dessert(DessertType dessertType) { DessertType = dessertType; DbItemId = MenuFood.GetDbItemId(dessertType); ItemName = DisplayNames.GetDessertDisplayName(dessertType)[0]; ShortName = DisplayNames.GetDessertDisplayName(dessertType)[1]; PopulateBasePrice(); PopulatePricePerItem(); }
private void btnThemMoi_Click(object sender, EventArgs e) { try { MenuFood menu = new MenuFood(); int MaLH = (cmbTenLTD.SelectedItem as Category).MaLH; menu.GiaBan = (int)cmGia.Value; menu.TenHH = txtTenTD.Text; menu.MaLH = MaLH; if (ThucDonBUS.Insert(menu)) { XtraMessageBox.Show("Thêm thành công", "THÔNG BÁO ", MessageBoxButtons.OK, MessageBoxIcon.Information); txtTenTD.Text = ""; cmGia.Text = ""; cmbTenLTD.Text = ""; } else { XtraMessageBox.Show("Thêm thất bại", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information); } frmDanhSachTD_Load(sender, e); } catch (Exception) { XtraMessageBox.Show("Thêm thất bại", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information); if (string.IsNullOrEmpty(txtTenTD.Text) && string.IsNullOrEmpty(cmGia.Text) && string.IsNullOrEmpty(cmbTenLTD.Text)) { XtraMessageBox.Show("Chưa nhập đầy đủ thông tin", "THÔNG BÁO ", MessageBoxButtons.OK, MessageBoxIcon.Information); labgia.ForeColor = Color.Red; labelx.ForeColor = Color.Red; labelx.Text = "Không được để trống"; labgia.Text = "Không được để trống"; } else if (string.IsNullOrEmpty(txtTenTD.Text)) { XtraMessageBox.Show("Chưa nhập đầy đủ thông tin", "THÔNG BÁO ", MessageBoxButtons.OK, MessageBoxIcon.Information); labgia.ForeColor = Color.Red; labelx.ForeColor = Color.Red; labelx.Text = "Không được để trống"; labgia.Text = ""; } else if (string.IsNullOrEmpty(cmGia.Text)) { XtraMessageBox.Show("Chưa nhập đầy đủ thông tin", "THÔNG BÁO ", MessageBoxButtons.OK, MessageBoxIcon.Information); labgia.ForeColor = Color.Red; labelx.ForeColor = Color.Red; labelx.Text = ""; labgia.Text = "Không được để trống"; } } }
//public static Order ConvertDbCheckToOrder(DBCheck check, decimal tableId, decimal[] guestIds) //{ // //var openOrder = new Order(tableId) // //{ // // IsTakeout = false, // // GuestIds = guestIds // //}; // //foreach (var item in check.Items) // //{ // // var openOrderItem = OrderItemFactory.GetOrderItem(item); // // openOrder.AddItemToOrder(openOrderItem); // //} // //return openOrder; //} public static Dessert GetDessert(GuestItem oldGuestItem) { Dessert newDessert = MenuFood.GetDessertFromMenu(oldGuestItem.ID); newDessert.DbItemId = oldGuestItem.ID; newDessert.WasSentToKitchen = oldGuestItem.OrderSent; newDessert.DbOrderId = (int)oldGuestItem.OrderID; newDessert.ItemCount = 1; return(newDessert); }
public List <MenuFood> GetListMenuByTable(int id) { List <MenuFood> listMenu = new List <MenuFood>(); string query = "select f.name, bi.count, f.Price, f.Price * bi.count as TotalPrice from dbo.BillInfo as bi, dbo.Bill as b, dbo.Food as f where bi.idBill = b.id and bi.idFood = f.id and b.status = 0 and b.idTable = " + id; DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { MenuFood menu = new MenuFood(item); listMenu.Add(menu); } return(listMenu); }
public List <MenuFood> GetListMenuByTable(int id) { List <MenuFood> listMenu = new List <MenuFood>(); string query = "SELECT f.TenHH, bi.SoLuong, f.GiaSP, f.GiaSP*bi.SoLuong AS totalPrice FROM dbo.CTBH AS bi, dbo.HoaDonBanhang AS b, dbo.HangHoa AS f WHERE bi.MaHDBH = b.MAHDBH AND bi.MaHH = f.MaHH AND b.Trangthai=0 AND b.MaBan = " + id; DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { MenuFood menu = new MenuFood(item); listMenu.Add(menu); } return(listMenu); }
public List <MenuFood> GetListMenuByTable(int id) { List <MenuFood> listMenu = new List <MenuFood>(); string query = "SELECT f.name, bi.count, f.price, f.price*bi.count AS totalprice FROM dbo.BillInfo AS bi, dbo.Bill AS b, dbo.Food AS f WHERE bi.idBill = b.id AND bi.idFood = f.id AND b.status = 0 AND b.idTable = " + id; DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { MenuFood menu = new MenuFood(item); listMenu.Add(menu); } return(listMenu); }
public bool Update(MenuFood menu) { try { //&& u.TRANGTHAI == "1"// HANGHOA p = db.HANGHOAs.SingleOrDefault(u => u.MAHH == menu.MaHH); p.MALH = menu.MaLH; p.TENHH = menu.TenHH; p.GIASP = menu.GiaBan; p.TRANGTHAI = menu.TrangThai; p.MAHH = menu.MaHH; db.SaveChanges(); } catch (Exception) { return(false); } return(true); }
private void btnSua_Click(object sender, EventArgs e) { MenuFood menu = new MenuFood(); for (int i = 0; i < gridView1.RowCount; i++) { menu.MaLH = Convert.ToInt32(gridView1.GetRowCellValue(i, "MALH").ToString()); menu.TenHH = gridView1.GetRowCellValue(i, "TENHH").ToString(); menu.GiaBan = Convert.ToInt32(gridView1.GetRowCellValue(i, "GIASP")); menu.MaHH = Convert.ToInt32(gridView1.GetRowCellValue(i, "MAHH").ToString()); ThucDonBUS.Update(menu); } XtraMessageBox.Show("Sửa thành công", "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); frmDanhSachTD_Load(sender, e); }
//hàm thêm mới nhân viên public bool Insert(MenuFood menu) { try { HANGHOA p = new HANGHOA { MAHH = menu.MaHH, TENHH = menu.TenHH, GIASP = menu.GiaBan, TRANGTHAI = menu.TrangThai, MALH = menu.MaLH, }; db.HANGHOAs.Add(p); db.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public App() { InitializeComponent(); //for now.... //Zipline2.Models.User joanne = new Zipline2.Models.User("Joanne", true, "8011"); //Zipline2.Models.User satch = new Zipline2.Models.User("Satch", true, "1168"); //Zipline2.Models.User jim = new Zipline2.Models.User("Jim", true, "4321"); //Users.Instance.AddNewUser(joanne); //Users.Instance.AddNewUser(satch); //Users.Instance.AddNewUser(jim); //var watch = System.Diagnostics.Stopwatch.StartNew(); //The following 4 statements take about a half a second (total). Zipline2.Data.Tables.LoadInitialTableData(); Zipline2.Data.MenuFood.LoadInitialPizzaToppings(); Zipline2.Data.MenuFood.LoadInitialSaladToppings(); Zipline2.Data.MenuDrinks.CreateAllDrinks(); CalculatePlusMinusButtonInfo(); MenuFood.CreateDesserts(); DataLoader.LoadMenuFromFileOrServer(); DataLoader.LoadToppingsFromFileOrServer(); MainPage = new MainMasterDetailPage(); }
public override Tuple <string, decimal> GetMenuDbItemKeys() { return(Tuple.Create <string, decimal>("Dessert", MenuFood.GetDbItemId(DessertType))); }
public bool Delete(MenuFood menu) { return(menuDAO.Update(menu)); }
public bool Insert(MenuFood menu) { return(menuDAO.Insert(menu)); }