private void txtTimKiem_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { ListView lsv = LayMenuMon(); if (lsv == null) { return; } lsv.Items.Clear(); lsv.LargeImageList.Images.Clear(); // Tìm kiếm món if (radMenuMon.Checked) { List <MonDTO> dsMon = MonBUS.LayDanhSachMon(loaiDangChon, txtTimKiem.Text); LayDanhSachMon(lsv, dsMon); } // Tìm kiếm topping else { List <ToppingDTO> dsTopping = ToppingBUS.LayDanhSachTopping(loaiDangChon, txtTimKiem.Text); LayDanhSachTopping(lsv, dsTopping); } } }
private void LoadDSMon(string timKiem = "", bool trangThai = true) { if (chkMAConSuDung.Checked == false) { List <MonDTO> lstMon = MonBUS.LayDanhSachMon(timKiem, trangThai); dgvDSMon.DataSource = lstMon; } else { dgvDSMon.DataSource = MonBUS.LayDSMonAnBiXoa(); dgvDSMon.CurrentCell = null; XoaForm(false); btnCapNhat.Hide(); btnThem.Hide(); btnXoa.Hide(); btnLamMoi.Hide(); btnKhoiPhuc.Show(); if (dgvDSMon.Rows.Count > 0) { btnKhoiPhuc.Enabled = true; } else { btnKhoiPhuc.Enabled = false; } chkTrangThai.Checked = false; picHinh.Image = null; } }
public void HienMonTheoLoai(int maMon) { List <MonDTO> lsMon = MonBUS.LayDanhSachMon(maMon); rpvBaoCao.LocalReport.ReportEmbeddedResource = path + "rptMonTheoLoai.rdlc"; rpvBaoCao.LocalReport.DataSources.Add(new ReportDataSource("DSMON", lsMon)); rpvBaoCao.RefreshReport(); }
private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e) { //Lấy mã loại truyền từ report cha int maLoai = int.Parse(e.Parameters["paMaLoai"].Values[0]); //Lấy dữ liệu cho report con List <MonDTO> lsMon = MonBUS.LayDanhSachMon(maLoai); //Đỗ dữ liệu cho report con e.DataSources.Add(new ReportDataSource("DSMON", lsMon)); }
private void LoadDSCTHD() { DataGridViewComboBoxColumn cboMon = (DataGridViewComboBoxColumn)dgvCTHDBanHang.Columns["colMaMon"]; cboMon.DataSource = MonBUS.LayDanhSachMon(""); cboMon.DisplayMember = "TenMon"; cboMon.ValueMember = "MaMon"; dgvCTHDBanHang.DataSource = CTHDBanHangBUS.LayDSCTHDBanHang(_hdBH.MaHD); }
//Load DSCTHDBanHang theo mã HD private void LoadChiTietHD(int maHD) { //Load món ăn vào column mã món ăn DataGridViewComboBoxColumn cboMaMon = (DataGridViewComboBoxColumn)dgvDSCTHDThanhToan.Columns["colMaMon"]; cboMaMon.DataSource = MonBUS.LayDanhSachMon(""); cboMaMon.DisplayMember = "TenMon"; cboMaMon.ValueMember = "MaMon"; dgvDSCTHDThanhToan.AutoGenerateColumns = false; dgvDSCTHDThanhToan.DataSource = CTHDBanHangBUS.LayChiTietHD(maHD); dgvDSCTHDThanhToan.CurrentCell = null; }
private void LoadDSCTHDBanHang() { //Load Tên món ăn vào cột mã món ăn trong dgvCTHDThanhToan DataGridViewComboBoxColumn cboMon = (DataGridViewComboBoxColumn)dgvCTHDThanhToan.Columns["colMaMon"]; cboMon.DataSource = MonBUS.LayDanhSachMon(""); cboMon.DisplayMember = "TenMon"; cboMon.ValueMember = "MaMon"; //Load vào dữ liệu CTHD vào dgvCTHDThanhToan dgvCTHDThanhToan.DataSource = CTHDBanHangBUS.LayDSCTHDBanHang(hdBH.MaHD); dgvCTHDThanhToan.CurrentCell = null; AddStatus(-1); }
private void LoadDSMonAnTimKiem(string strTK) { lsvTimKiem.Clear(); lsvTimKiem.LargeImageList = imlMonAn; List <MonDTO> ls = MonBUS.LayDanhSachMon(strTK); for (int i = 0; i < ls.Count; i++) { ListViewItem lvi = new ListViewItem(ls[i].TenMon); lvi.SubItems.Add(ls[i].MaMon); lvi.SubItems.Add(ls[i].DonGia.ToString()); lvi.SubItems.Add(ls[i].HinhAnh); if (File.Exists("image\\" + ls[i].HinhAnh)) { byte[] byteHA = File.ReadAllBytes("image\\" + ls[i].HinhAnh); MemoryStream ms = new MemoryStream(byteHA); Image img = Image.FromStream(ms); imlMonAn.Images.Add(img); lvi.ImageIndex = imlMonAn.Images.Count - 1; } lsvTimKiem.Items.Add(lvi); } }
private void TaiDuLieu() { for (int i = 0; i < panelLoai.Controls.Count; i++) { Control ctrl = panelLoai.Controls[i]; if (ctrl.GetType() == typeof(MaterialFlatButton)) { if (ctrl.Tag.GetType() == typeof(LoaiMonDTO)) { ImageList iml = new ImageList(); iml.ColorDepth = ColorDepth.Depth32Bit; iml.ImageSize = new Size(64, 64); ListView lsv = new ListView(); lsv.Tag = ctrl.Tag; lsv.LargeImageList = iml; lsv.Name = ctrl.Name; lsv.ShowGroups = true; lsv.TileSize = new Size(230, 100); lsv.GridLines = true; lsv.FullRowSelect = true; lsv.View = View.Tile; lsv.Dock = DockStyle.Fill; lsv.Font = new Font("Segoe UI", 14.25F); TaoGroupMon(lsv); lsv.Columns.Add("Tên món"); lsv.Columns.Add("Đơn giá"); lsv.Click += new EventHandler(ThemMon); List <MonDTO> lsMon = MonBUS.LayDanhSachMon(Convert.ToInt32(lsv.Name)); LayDanhSachMon(lsv, lsMon); panelMenu.Controls.Add(lsv); } } } List <LoaiToppingDTO> lsLoaiTopping = LoaiToppingBUS.LayDanhSachLoaiTopping(); foreach (LoaiToppingDTO loaiTopping in lsLoaiTopping) { ImageList iml = new ImageList(); iml.ColorDepth = ColorDepth.Depth32Bit; iml.ImageSize = new Size(80, 80); ListView lsv = new ListView(); lsv.Tag = loaiTopping; lsv.LargeImageList = iml; lsv.Name = loaiTopping.MaLoaiTopping + ""; lsv.ShowGroups = true; lsv.TileSize = new Size(230, 100); lsv.GridLines = true; lsv.FullRowSelect = true; lsv.View = View.Tile; lsv.Dock = DockStyle.Fill; lsv.Font = new Font("Segoe UI", 14.25F); TaoGroupTopping(lsv); lsv.Columns.Add("Tên món"); lsv.Columns.Add("Đơn giá"); lsv.Click += new EventHandler(ThemTopping); List <ToppingDTO> lsTopping = ToppingBUS.LayDanhSachTopping(loaiTopping.MaLoaiTopping); LayDanhSachTopping(lsv, lsTopping); panelMenu.Controls.Add(lsv); } panelMenu.Controls["0"].Visible = true; panelMenu.Controls["0"].BringToFront(); }
private void QLM_LoadDanhSachMonDaXoa(string timKiem = "", int maLoaiMon = 0) { dgvMon.DataSource = MonBUS.LayDanhSachMon(maLoaiMon, timKiem, false); }
// Kết thúc Khu vực chức năng Quản lý loại topping // ---------------------------------------------- // Bắt đầu Khu vực chức năng Quản lý món private void QLM_LoadDanhSachMon(string timKiem = "", int maLoaiMon = 0) { List <MonDTO> lsMon = MonBUS.LayDanhSachMon(maLoaiMon, timKiem); dgvMon.DataSource = lsMon; }