private void btnThanhtoan_Click(object sender, EventArgs e) { DialogResult msg = MessageBox.Show("Có phải bạn muốn xóa thực hiện thanh toán không?", "Thanh toán", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); try { if (msg == DialogResult.OK) { goiMonBS bs = new goiMonBS(); bs.danhsach_goimon_thanhtoanBS(magoimon, convertToMaBan(cmbBan.Text)); } } catch { MessageBox.Show("Qúa trình thực hiện đã có lỗi"); } cmbBan.Text = ""; cmbTang.Text = ""; cmbTen.Text = ""; cmbBan.Enabled = true; cmbTang.Enabled = true; cmbTen.Enabled = false; btnSudungban.Enabled = true; txtSoLuong.Enabled = false; btnThem.Enabled = false; btnThanhtoan.Enabled = false; btnXoa.Enabled = false; loadds_goiMon(laymagoimon()); }
private void simpleButton3_Click(object sender, EventArgs e) { if (cmbTen.Text == "" & txtSoLuong.Text == "") { MessageBox.Show("Bạn phải chọn từ Combobox một sản phẩm và nhập vào Textbox một giá trị"); } else if (cmbTen.Text == "") { MessageBox.Show("Bạn phải chọn từ Combobox một sản phẩm !"); } else if (txtSoLuong.Text == "") { MessageBox.Show("Bạn phải nhập một giá trị vào Textbox !"); txtSoLuong.Focus(); } else { if (trangthai == false) { maban = convertToMaBan(cmbBan.Text); magoimon1(); try { danhsachgoimonBS bs = new danhsachgoimonBS(); bs.themvao_ds_goimon(magm, convertToMaSP(cmbTen.Text), Convert.ToInt32(txtSoLuong.Text)); } catch { MessageBox.Show("Đã có lỗi xảy ra trong quá trình thêm"); } } else if (trangthai == true) { try { goiMonBS bs = new goiMonBS(); bs.danhsach_goimon_themBS(Convert.ToString(ma_goi_mon), convertToMaSP(cmbTen.Text), Convert.ToInt32(txtSoLuong.Text)); MessageBox.Show(Convert.ToString(ma_goi_mon)); MessageBox.Show(convertToMaSP(cmbTen.Text)); MessageBox.Show(txtSoLuong.Text); } catch { MessageBox.Show("Có lỗi xảy ra trong quá trình thêm"); } } } loadds_goiMon(laymagoimon()); lbGia.Text = "" + Convert.ToString(thanhtoan(laymagoimon())) + " vnđ"; }
private void hienthidanhsachgoimon() { goiMonBS bs = new goiMonBS(); List <danhsachGoiMon> ds = bs.dsgoimon(laymagoimon()); for (int i = 0; i < ds.Count; i++) { listView1.Items.Add(ds[i].ma_sp.ToString()); listView1.Items[i].SubItems.Add(ds[i].soluong.ToString()); } }
private string laymagoimon() { string text = ""; goiMonBS bs = new goiMonBS(); List <goiMonDB> ds = bs.laymasogoimon(convertToMaBan(cmbBan.Text)); for (int i = 0; i < ds.Count; i++) { text = ds[i].ma_goimon.ToString(); magoimon = ds[i].ma_goimon.ToString(); } return(text); }
private void Valuema_goi_mon() { goiMonBS bs = new goiMonBS(); List <goiMonDB> ds = bs.loadGoiMon(); int a = Convert.ToInt32(ds.Count.ToString()); if (a == 0) { ma_goi_mon = 0; } else { ma_goi_mon = a + 1; } }
private void btnXoa_Click(object sender, EventArgs e) { DialogResult msg = MessageBox.Show("Có phải bạn muốn xóa " + listView1.SelectedItems[0].Text + " không?", "Xóa", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); try { if (msg == DialogResult.OK) { goiMonBS bs = new goiMonBS(); bs.danhsach_goimon_xoaBS(ten); MessageBox.Show("Xóa thành công"); } } catch { MessageBox.Show("Đã có lỗi xảy ra trong quá trình xóa"); } loadds_goiMon(laymagoimon()); }
private void simpleButton7_Click(object sender, EventArgs e) { try { Valuema_goi_mon(); goiMonBS goimon = new goiMonBS(); BanBS banbs = new BanBS(); //them vao bang goi mon goimon.goimon_themBS(Convert.ToString(ma_goi_mon), convertToMaTang(cmbTang.Text), convertToMaBan(cmbBan.Text), convertToMaUser(user.Text)); banbs.ban_thangthai_suaBS(convertToMaBan(cmbBan.Text)); MessageBox.Show("Bàn sẵn sàng để sử dụng"); } catch { MessageBox.Show("Có lỗi xảy ra khi sử dụng bàn này"); } btnSudungban.Enabled = false; cmbTen.Enabled = true; txtSoLuong.Enabled = true; btnThem.Enabled = true; btnThanhtoan.Enabled = true; }