private void btnThemBan_Click(object sender, EventArgs e) { int soNguoi = 0; try { soNguoi = int.Parse(maskedTextBox_SoNguoi.Text); } catch { } frm_FormPhu_NhapSo f = new frm_FormPhu_NhapSo(); f.ShowDialog(); int SoBan = f.Number; if (SoBan <= 0) { return; } if (TimBanCoTrongHeThong(SoBan) == null) { Tables tempTable = new Tables(1, SoBan, this.txt_ViTriBan.Text, soNguoi); IDBanDangChon = Tables.AddWithOutput(tempTable); Orders tempOrder = new Orders(IDBanDangChon, this.txt_NhanVienOrder.Text, DateTime.Now, 0, 0, 0, 0); objOrder.Add(tempOrder); LoadDSBan(); IDOrderDangChon = Orders.GetOrderByTableID(IDBanDangChon)[0].OrderID; } else { MessageBox.Show("Bàn này đã tồn tại trong hệ thống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.lblSoBan.Text = SoBan.ToString(); }
private void sửaToolStripMenuItem_Click(object sender, EventArgs e) { if (this.listView_CacMonDaGoi.Items.Count != 0 && this.listView_CacMonDaGoi.SelectedItems.Count != 0) { frm_FormPhu_NhapSo f = new frm_FormPhu_NhapSo(); f.ShowDialog(); int ID = int.Parse(this.listView_CacMonDaGoi.SelectedItems[0].SubItems[6].Text); int SoLuong = f.Number; float GiaCa = Converts.ReturnFloat(this.listView_CacMonDaGoi.SelectedItems[0].SubItems[3].Text); try { OrderDetails.Update(ID, SoLuong, GiaCa); } catch (Exception ex) { MessageBox.Show(ex.Message); } LoadListView_CacMonDaChon(); } }
private void btn_ThemMon_Click(object sender, EventArgs e) { frm_FormPhu_NhapSo f = new frm_FormPhu_NhapSo(); f.ShowDialog(); if (f.Number <= 0) { MessageBox.Show("Dữ liệu vừa nhập không hợp lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.listView_Products.Items.Count != 0 && this.listView_Products.SelectedItems.Count != 0) { int productID = int.Parse(this.listView_Products.SelectedItems[0].SubItems[3].Text); float Price = Prices.GetPriceByDateAndProductID(DateTime.Now, productID); IDOrderDangChon = Orders.GetOrderByTableID(IDBanDangChon)[0].OrderID; OrderDetails tempOrderDeTail = new OrderDetails(IDOrderDangChon, productID, Price, f.Number, 0); objOrderDetail.Add(tempOrderDeTail); LoadListView_CacMonDaChon(); LoadDSBan(); } }