private void Menu_Form_Load(object sender, EventArgs e) { //checking table status //if table status = "USING" //Show the food in bill //if table status ="FREE" //create new BillId; tableDTO dto = new tableDTO(); dto.tableID = tableId; DataSet result = new DataSet(); tableBO bo = new tableBO(); result = bo.getTableStatus(dto); if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { if (result.Tables[0].Rows[0][0].ToString().Trim() == "FREE") { billId = createId(); txt_NumberBill.Text = billId; } else { //if it is USING loadingBillByTableId(); } } loadingMenu(); }
private void paymentEvent(Object sender, EventArgs e, string billId, string tableId) { billDTO dto = new billDTO(); dto.billId = billId; billBO bo = new billBO(); int result = bo.paymentForBill(dto); if (result != -1) { tableDTO tabledto = new tableDTO(); tabledto.tableID = tableId; tabledto.status = "FREE"; tableBO tablebo = new tableBO(); int result2 = -1; result2 = tablebo.setTableStatus(tabledto); if (result2 != -1) { MessageBox.Show("Thanh toán thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Table_Form form = new Table_Form(); form.userlogin = userlogin; this.Hide(); form.ShowDialog(); this.Close(); } else { MessageBox.Show("Lỗi khi thay đổi trạng thái bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Thanh toán thất bại, vui lòng kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_CancelBill_Click(object sender, EventArgs e) { if (dgv_BillDetails.Rows.Count == 0) { MessageBox.Show("Không có món nào trong hóa đơn, vui lòng thử lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (userlogin.POSITION == "QUANLY" || userlogin.POSITION == "THUNGAN") { DialogResult dialog = MessageBox.Show("Bạn có muốn cancel Bill này chứ ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialog == DialogResult.Yes) { billDTO dto = new billDTO(); dto.billId = txt_NumberBill.Text; billBO bo = new billBO(); int result = bo.cancelBill(dto); if (result != -1) { tableDTO tabledto = new tableDTO(); tabledto.tableID = tableId; tabledto.status = "FREE"; tableBO tablebo = new tableBO(); int result1 = tablebo.setTableStatus(tabledto); if (result1 != -1) { MessageBox.Show("Đã cancel Bill !!!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Table_Form form = new Table_Form(); form.userlogin = userlogin; this.Hide(); form.ShowDialog(); this.Close(); } else { MessageBox.Show("Lỗi khi thay đổi trạng thái bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Đã có lỗi xảy ra, vui lòng kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Bạn không có quyền này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public DataSet getTableStatus(tableDTO dto) { DataSet result = new DataSet(); string query = @"SELECT Status FROM tableList WHERE TableId = @TableId"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@TableId", dto.tableID), }; DataAccess data = new DataAccess(); result = data.GetDataSet(query, para); return(result); }
public int setTableStatus(tableDTO dto) { int result = -1; string query = @"UPDATE tableList SET Status = @Status WHERE TableId = @TableId"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@Status", dto.status), new SqlParameter("@TableId", dto.tableID), }; DataAccess data = new DataAccess(); result = data.Execute(query, para); return(result); }
public void ShouldCreateTable() { var tableDTO = new tableDTO() { Name = "Magos destruidores de mundos.", DescriptionAttribute = "Um mundo de magos, bla bla bla, e bla bla bla", GameStyle = "3D&T Alpha", MaxOfParticipants = 10, Password = "******", TableMaster = new User() { Name = "Gilberto" }, Participants = new List <User>(), Private = true }; ITableManager tableManager = new TableManager(); var table = tableManager.Create(tableDTO); }
private void addFood(Object sender, EventArgs e, string foodId, int foodPrice) { billDTO dto = new billDTO(); //create tempcartid dto.billId = txt_NumberBill.Text; dto.tableId = tableId; dto.username = userlogin.USERNAME; //update ordinal number ordinal = ordinal + 1; dto.ordinalNumber = ordinal; dto.foodId = foodId; dto.cost = foodPrice; dto.quantity = quantity; dto.date = DateTime.Now; dto.status = "USING"; //set table status tableDTO table = new tableDTO(); table.status = "USING"; table.tableID = tableId; tableBO tablebo = new tableBO(); tablebo.setTableStatus(table); // billBO billbo = new billBO(); int result = billbo.addFood(dto); quantity = 1; if (result != -1) { loadingGridView(); } else { MessageBox.Show("Đã có lỗi xảy ra, vui lòng kiểm tra lại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void bnt_DeleteFoodDetail_Click(object sender, EventArgs e) { if (dgv_BillDetails.Rows.Count == 0) { MessageBox.Show("Hiện không còn món nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (dgv_BillDetails.Rows.Count == 1) { tableDTO tabledto = new tableDTO(); tabledto.tableID = tableId; tabledto.status = "FREE"; tableBO tablebo = new tableBO(); int result1 = tablebo.setTableStatus(tabledto); if (result1 != -1) { } else { MessageBox.Show("Lỗi khi thay đổi trạng thái bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } billDTO dto = new billDTO(); dto.billId = txt_NumberBill.Text; dto.ordinalNumber = int.Parse(dgv_BillDetails.CurrentRow.Cells["OrdinalNumber"].Value.ToString()); billBO bo = new billBO(); int result = bo.deleteSingleFoodByBillIdAndOrdinalNumber(dto); if (result != -1) { loadingGridView(); } else { MessageBox.Show("Có lỗi xảy ra ,Vui lòng thử lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }