private void Dgvnhanvien_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.RowIndex < dgvnhanvien.RowCount - 1) { DataGridViewRow row = dgvnhanvien.Rows[e.RowIndex]; textBox3.Text = row.Cells["manv"].Value.ToString(); txbngayvaolam.Text = row.Cells["ngayvaolamnv"].Value.ToString(); cbbmacv.Text = row.Cells["macv"].Value.ToString(); cbbmabp.Text = row.Cells["mabp"].Value.ToString(); txttennv.Text = row.Cells["tennv"].Value.ToString(); txtemail.Text = row.Cells["emailnv"].Value.ToString(); txtdiachi.Text = row.Cells["diachinv"].Value.ToString(); txtsotk.Text = row.Cells["sotaikhoan"].Value.ToString(); txttendangnhap.Text = row.Cells["tendangnhapnv"].Value.ToString(); txtmatkhau.Text = row.Cells["matkhaunv"].Value.ToString(); txtsodt.Text = row.Cells["dienthoainv"].Value.ToString(); dgvnhanvien.Tag = row.Cells["manv"].Value.ToString(); string matrangthai = row.Cells["matrangthainv"].Value.ToString(); if (matrangthai == "elimi") { txbghichunhanvien.Text = "Nhân viên đã rời khỏi\n\tVào ngày: " + row.Cells["ngaynghiviec"].Value.ToString(); OptimizedPerformance.disableButton(new Button[] { btnsuanhanvien, btnxoanhanvien }); } else { OptimizedPerformance.enableButton(new Button[] { btnsuanhanvien, btnxoanhanvien }); txbghichunhanvien.Text = "Bình thường"; } } }
private async void loadBan() { picBoxLoadingTable.Show(); picBoxLoadingTable.Update(); OptimizedPerformance.fromTableToDgv(await objBan.loadTableBan(), dgvban, "ban"); picBoxLoadingTable.Hide(); }
private void DgvKhachhang_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.RowIndex < dgvKhachhang.RowCount - 1) { DataGridViewRow row = dgvKhachhang.Rows[e.RowIndex]; txbmakh.Text = row.Cells["makh"].Value.ToString(); txbloaikh.Text = dgvKhachhang.Rows[e.RowIndex].Tag.ToString(); txbtenkh.Text = row.Cells["tenkh"].Value.ToString(); txbdienthoaikh.Text = row.Cells["dienthoaikh"].Value.ToString(); txbdiachikh.Text = row.Cells["diachikh"].Value.ToString(); dpngaysinhkh.Value = DateTime.Parse(row.Cells["ngaysinhkh"].Value.ToString()); txbemailkh.Text = row.Cells["emailkh"].Value.ToString(); txbdiemkh.Text = row.Cells["diemkh"].Value.ToString(); txbtiendatieukh.Text = row.Cells["tiendatieukh"].Value.ToString(); dgvKhachhang.Tag = row.Cells["makh"].Value.ToString(); string matrangthai = row.Cells["matrangthaikh"].Value.ToString(); if (matrangthai == "elimi") { txbghichukh.Text = "Đã xóa TK vào ngày " + row.Cells["ngayhuytk"].Value.ToString(); OptimizedPerformance.disableButton(new Button[] { btnSuakh, btnXoakh }); } else { OptimizedPerformance.enableButton(new Button[] { btnSuakh, btnXoakh }); txbghichukh.Text = "Hoạt động bình thường"; } if (row.Cells["ngayhuytk"] != null) { txbngayxoa.Text = row.Cells["ngayhuytk"].Value.ToString(); } } }
private void Dgvban_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { DataGridViewRow row = dgvban.Rows[e.RowIndex]; txtmaban.Text = row.Cells["maban"].Value.ToString(); txttenban.Text = row.Cells["tenban"].Value.ToString(); cbbkhuvuc.Text = row.Cells["khuvuc"].Value.ToString(); string matrangthai = row.Cells["matrangthai"].Value.ToString(); if (matrangthai == "elimi") { txbtentrangthai.Text = "Dừng hoạt động"; OptimizedPerformance.disableButton(new Button[] { btnxoa, btnsua }); } else { OptimizedPerformance.enableButton(new Button[] { btnxoa, btnsua }); txbtentrangthai.Text = "Hoạt động bình thường"; } if (row.Cells["ngayxoaban"] != null) { txbngayxoa.Text = row.Cells["ngayxoaban"].Value.ToString(); } } }
private void Btnsuanhanvien_Click(object sender, EventArgs e) { OptimizedPerformance.SaveHistory(pnNhanvien, "sua", dgvnhanvien); String manv = dgvnhanvien.Tag.ToString(); String macv = cbbmacv.Text; String mabp = cbbmabp.Text; String tennv = txttennv.Text; String dienthoai = txtsodt.Text; String email = txtemail.Text; String diachi = txtdiachi.Text; String sotk = txtsotk.Text; String tendangnhap = txttendangnhap.Text; String matkhau = txtmatkhau.Text; if (String.IsNullOrWhiteSpace(macv) | String.IsNullOrWhiteSpace(mabp) | String.IsNullOrWhiteSpace(tennv) | String.IsNullOrWhiteSpace(dienthoai) | String.IsNullOrWhiteSpace(email) | String.IsNullOrWhiteSpace(diachi) | String.IsNullOrWhiteSpace(sotk)) { MessageBox.Show("Vui lòng không bỏ trống những trường có (*)"); } else { String query = "themnhanvien @MANV @MACV @MABP @TENNV @DIENTHOAINV @EMAILNV @DIACHINV @SOTAIKHOANNV @TENDANGNHAP @MATKHAU @REQUEST"; int res = ConnectDataBase.SessionConnect.executeNonQuery(query, new object[] { manv, macv, mabp, tennv, dienthoai, email, diachi, sotk, tendangnhap, matkhau, "update" }); if (res > 0) { MessageBox.Show("Cập nhật thành công"); loadNhanVien(""); btncleartextnhanvien.PerformClick(); } } }
private async void loadNhanVien(String input) { picBoxLoadingStaff.Show(); picBoxLoadingStaff.Update(); DataTable table = await objNhanVien.loadTableNhanVien(input, cbbtimtheonhanvien.Text); OptimizedPerformance.fromTableToDgv(table, dgvnhanvien, "nhanvien"); picBoxLoadingStaff.Hide(); }
//-------------------------------------------- #region Khách hàng public async void loadKhachHang(string input) { picBoxKhachHang.Show(); picBoxKhachHang.Update(); DataTable table = await new KhachHang().loadTableKhachHang(input, cbbtimtheokh.Text); OptimizedPerformance.fromTableToDgv(table, dgvKhachhang, "khachhang"); picBoxKhachHang.Hide(); }
// Hết khai báo public BangDieuKhien() { InitializeComponent(); // tab bàn loadKhuvuc(); loadBan(); OptimizedPerformance.formatCurrency(dgvKhachhang, "kh"); OptimizedPerformance.formatCurrency(dgvmonan, "ma"); OptimizedPerformance.formatCurrency(dgvthucuong, "tu"); //--------------------------------- OptimizedPerformance.DoubleBuffered(dgvban, true); OptimizedPerformance.DoubleBuffered(dgvmonan, true); OptimizedPerformance.DoubleBuffered(dgvthucuong, true); OptimizedPerformance.DoubleBuffered(dgvnhanvien, true); OptimizedPerformance.DoubleBuffered(dgvKhachhang, true); }
private void IconButton1_Click(object sender, EventArgs e) /// button xoa nhan vien { OptimizedPerformance.SaveHistory(pnNhanvien, "xoa", dgvnhanvien); String manv = dgvnhanvien.Tag.ToString(); String query = "xoanhanvien @manv"; int res = ConnectDataBase.SessionConnect.executeNonQuery(query, new object[] { manv }); if (res > 0) { MessageBox.Show("Xóa nhân viên thành công !"); loadNhanVien(""); btncleartextnhanvien.PerformClick(); } }
private void BtnXoakh_Click(object sender, EventArgs e) { OptimizedPerformance.SaveHistory(pnKhachhang, "xoa", dgvKhachhang); String makh = dgvKhachhang.Tag.ToString(); String query = "xoakhachhang @makh"; int res = ConnectDataBase.SessionConnect.executeNonQuery(query, new object[] { makh }); if (res > 0) { MessageBox.Show("Xóa nhân khách hàng công !"); loadKhachHang(""); btnClearTextKh.PerformClick(); } }
private async void BtnThemkh_Click(object sender, EventArgs e) { string makh = await new KhachHang().taoMaKh(); string tenkh = txbtenkh.Text; string dienthoaikh = txbdienthoaikh.Text; string diachikh = txbdiachikh.Text; DateTime ngaysinhkh = dpngaysinhkh.Value; string emailkh = txbemailkh.Text; DateTime ngaydangky = DateTime.Now; if (string.IsNullOrWhiteSpace(makh) | string.IsNullOrWhiteSpace(tenkh) | string.IsNullOrWhiteSpace(dienthoaikh) | string.IsNullOrWhiteSpace(diachikh) | ngaysinhkh == null ) { MessageBox.Show("Vui lòng không bỏ trống những trường có (*)"); } else { String query = "thaotackhachhang @makh @tenkh @dienthoaikh @diachikh @ngaysinhkh @emailkh @ngaydangky @REQUEST"; int res = ConnectDataBase.SessionConnect.executeNonQuery(query, new object[] { makh, tenkh, dienthoaikh, diachikh, ngaysinhkh, emailkh, ngaydangky, "insert" //manv,macv,mabp,tennv,dienthoai,email,diachi,sotk, tendangnhap,matkhau,ngayvaolam,"insert" }); if (res > 0) { txbmakh.Text = makh; txbloaikh.Text = "GREEN"; txbdiemkh.Text = "0"; OptimizedPerformance.SaveHistory(pnKhachhang, "them", dgvnhanvien); MessageBox.Show("Thành công"); loadKhachHang(""); btnClearTextKh.PerformClick(); } } }
private async void loadMonan(String input = "") { picBoxLoadingFoods.Show(); picBoxLoadingFoods.Update(); if (String.IsNullOrWhiteSpace(input)) { String query = "select * from monan"; DataTable table = await ConnectDataBase.SessionConnect.executeQueryAsync(query); OptimizedPerformance.fromTableToDgv(table, dgvmonan, "monan"); } else { String query = ""; if (cbbtimtheomonan.Text.Contains("Tên")) { query = "select * from monan where tenmon like N'%" + input.Trim() + "%'"; } else if (cbbtimtheomonan.Text.Contains("Mã")) { query = "select * from monan where mamon like '%" + input.Trim() + "%'"; } DataTable table = await ConnectDataBase.SessionConnect.executeQueryAsync(query); OptimizedPerformance.fromTableToDgv(table, dgvmonan, "monan"); } for (int i = 0; i < dgvmonan.Columns.Count; i++) { if (dgvmonan.Columns[i] is DataGridViewImageColumn) { ((DataGridViewImageColumn)dgvmonan.Columns[i]).ImageLayout = DataGridViewImageCellLayout.Zoom; break; } } picBoxLoadingFoods.Hide(); }
private void Dgvmonan_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.RowIndex < dgvmonan.Rows.Count - 1) { imgboxxemtruoc.Image = null; DataGridViewRow row = dgvmonan.Rows[e.RowIndex]; txtmamon.Text = row.Cells["mamon"].Value.ToString(); txttenmon.Text = row.Cells["tenmon"].Value.ToString(); txtgiaban.Text = row.Cells["giaban"].Value.ToString(); rtbmota.Text = row.Cells["mota"].Value.ToString(); cbbdvt.Text = row.Cells["dvt"].Value.ToString(); if ((Byte[])(row.Cells["hinhanh"].Value) != null && ((Byte[])(row.Cells["hinhanh"].Value)).Length > 0) { Byte[] data = new Byte[0]; data = (Byte[])(row.Cells["hinhanh"].Value); dataImageToZoom = (Byte[])(row.Cells["hinhanh"].Value); MemoryStream mem = new MemoryStream(data); imgboxxemtruoc.Image = Image.FromStream(mem); } string trangthaimonan = row.Cells["matrangthaimonan"].Value.ToString(); if (trangthaimonan == "elimi") { txbtrangthaimonan.Text = "Đã dừng phục vụ"; OptimizedPerformance.disableButton(new Button[] { btnsuamon, btnxoamon }); } else { OptimizedPerformance.enableButton(new Button[] { btnsuamon, btnxoamon }); txbtrangthaimonan.Text = "Vẫn còn phục vụ"; } if (row.Cells["ngayxoamon"] != null) { txbngayxoamonan.Text = row.Cells["ngayxoamon"].Value.ToString(); } } }
//------------------------ #region Tab Nhân Viên private async void Btnthemnhanvien_Click(object sender, EventArgs e) { String manv = await new NhanVien().taoManv(); String macv = cbbmacv.Text; String mabp = cbbmabp.Text; String tennv = txttennv.Text; String dienthoai = txtsodt.Text; String email = txtemail.Text; String diachi = txtdiachi.Text; String sotk = txtsotk.Text; String tendangnhap = txttendangnhap.Text; String matkhau = OptimizedPerformance.encryptor(txtmatkhau.Text); DateTime ngayvaolam = DateTime.Now; if (String.IsNullOrWhiteSpace(macv) | String.IsNullOrWhiteSpace(mabp) | String.IsNullOrWhiteSpace(tennv) | String.IsNullOrWhiteSpace(dienthoai) | String.IsNullOrWhiteSpace(email) | String.IsNullOrWhiteSpace(diachi) | String.IsNullOrWhiteSpace(sotk)) { MessageBox.Show("Vui lòng không bỏ trống những trường có (*)"); } else { String query = "themnhanvien @MANV @MACV @MABP @TENNV @DIENTHOAINV @EMAILNV @DIACHINV @SOTAIKHOANNV @TENDANGNHAP @MATKHAU @NGAYVAOLAM @REQUEST"; int res = ConnectDataBase.SessionConnect.executeNonQuery(query, new object[] { manv, macv, mabp, tennv, dienthoai, email, diachi, sotk, tendangnhap, matkhau, ngayvaolam, "insert" }); if (res > 0) { OptimizedPerformance.SaveHistory(pnNhanvien, "them", dgvnhanvien); MessageBox.Show("Thành công"); loadNhanVien(""); btncleartextnhanvien.PerformClick(); } } }
private void IconButton3_Click(object sender, EventArgs e) { OptimizedPerformance.ClearAllText(this); }
private void Btncleartextthucuong_Click(object sender, EventArgs e) { lblpaththucuong.Text = ""; OptimizedPerformance.ClearAllText(tabControl1); }
private void Btncleartextnhanvien_Click(object sender, EventArgs e) { OptimizedPerformance.ClearAllText(tabControl1); }