private void cboMon_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboMon.SelectedItem != null) { Data.MENUMON mon = (Data.MENUMON)cboMon.SelectedItem; txtMonTinhGio.Text = mon.TenDai; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { txtSoPhutToiThieu.Text = mTransit.CaiDatBanHang.SoPhutToiThieu + ""; Data.MENUMON mon = (from x in mTransit.KaraokeEntities.MENUMONs where x.MonID == mTransit.CaiDatBanHang.MonTinhGio select x).FirstOrDefault(); if (mon != null) { txtMonTinhGio.Text = mon.TenDai; } cboNhom.ItemsSource = Data.BOMenuNhom.GetAll(mTransit.KaraokeEntities); cboNhom.SelectedValuePath = "NhomID"; cboNhom.DisplayMemberPath = "TenDai"; }
public void ImportItem(string url) { _OnImportExport("----------------------------", false); _OnImportExport(String.Format("Đọc tập tin excel..."), false); var listItem = ExcelReader.GetDataToList(url, MON, ImportExportItem.GetProductData); List <Data.MENUNHOM> listNhom = new List <Data.MENUNHOM>(); //List<Data.MENUMON> listMon = new List<Data.MENUMON>(); _OnImportExport(String.Format("Xóa dữ liệu cũ..."), false); mKaraokeEntities.ExecuteStoreCommand("SP_DELETE_ALL_MENU"); _OnImportExport(String.Format("Tạo {0}...", MAYIN), false); Data.MAYIN mayin = new Data.MAYIN(); mayin.TenMayIn = "Test"; mayin.TieuDeIn = "BẾP"; mayin.SoLanIn = 1; mayin.Visual = true; mKaraokeEntities.MAYINs.AddObject(mayin); _OnImportExport(String.Format("Tạo {0}...", MAYIN), false); Data.MAYIN mayinBill = new Data.MAYIN(); mayinBill.TenMayIn = "Test"; mayinBill.TieuDeIn = "HÓA ĐƠN"; mayinBill.SoLanIn = 1; mayinBill.MayInHoaDon = true; mayinBill.Visual = true; mKaraokeEntities.MAYINs.AddObject(mayinBill); _OnImportExport(String.Format("Tạo {0}...", DONVI), false); Data.DONVI donvi = mKaraokeEntities.DONVIs.Where(o => o.DonViID == 1).FirstOrDefault(); if (donvi == null) { donvi = new Data.DONVI(); donvi.TenDonVi = "Số lượng"; donvi.Visual = true; mKaraokeEntities.DONVIs.AddObject(donvi); } _OnImportExport(String.Format("Tạo {0}...", LOAIDONVIBAN), false); Data.LOAIBAN loaiban = mKaraokeEntities.LOAIBANs.Where(o => o.LoaiBanID == 1).FirstOrDefault(); if (loaiban == null) { loaiban.TenLoaiBan = "Cái"; loaiban.KichThuocBan = 1; loaiban.Visual = true; mKaraokeEntities.LOAIBANs.AddObject(loaiban); donvi.LOAIBANs.Add(loaiban); } foreach (var item in listItem) { var nhom = (from a in listNhom where a.TenNgan == item.TenNhom select a).FirstOrDefault(); if (nhom == null) { _OnImportExport(String.Format("Tạo {0}---{1}", NHOM, item.TenNhom), false); nhom = new Data.MENUNHOM(); nhom.TenDai = nhom.TenNgan = item.TenNhom; nhom.Visual = true; mKaraokeEntities.MENUNHOMs.AddObject(nhom); listNhom.Add(nhom); } var mon = (from a in nhom.MENUMONs where a.TenNgan == item.TenMon select a).FirstOrDefault(); if (mon == null) { _OnImportExport(String.Format("Tạo {0}---{1}", MON, item.TenMon), false); mon = new Data.MENUMON(); mon.TenNgan = mon.TenDai = item.TenMon; mon.Gia = item.DonGia; mon.Visual = true; nhom.MENUMONs.Add(mon); donvi.MENUMONs.Add(mon); nhom.SLMonChoPhepTonKho++; Data.MENUITEMMAYIN monmayin = new Data.MENUITEMMAYIN(); mon.MENUITEMMAYINs.Add(monmayin); mayin.MENUITEMMAYINs.Add(monmayin); mKaraokeEntities.MENUMONs.AddObject(mon); //listMon.Add(mon); } _OnImportExport(String.Format("Tạo {0}---{1}", CHITIETMON, item.ChiTietMon), false); Data.MENUKICHTHUOCMON ktm = new Data.MENUKICHTHUOCMON(); ktm.TenLoaiBan = item.ChiTietMon; ktm.GiaBanMacDinh = item.DonGia; ktm.SoLuongBanBan = item.SoLuongBanMacDinh; ktm.KichThuocLoaiBan = 1; ktm.Visual = true; ktm.ChoPhepTonKho = true; mon.SLMonChoPhepTonKho++; mon.MENUKICHTHUOCMONs.Add(ktm); loaiban.MENUKICHTHUOCMONs.Add(ktm); donvi.MENUKICHTHUOCMONs.Add(ktm); mKaraokeEntities.MENUKICHTHUOCMONs.AddObject(ktm); } _OnImportExport(String.Format("Lưu dữ liệu..."), false); mKaraokeEntities.SaveChanges(); _OnImportExport(String.Format("Lưu dữ liệu thành công ...{0}", url), false); }
public void ImportItem(string url) { _OnImportExport("----------------------------", false); _OnImportExport(String.Format("Đọc tập tin excel..."), false); var listItem = ExcelReader.GetDataToList(url, MON, ImportExportItem.GetProductData); List<Data.MENUNHOM> listNhom = new List<Data.MENUNHOM>(); //List<Data.MENUMON> listMon = new List<Data.MENUMON>(); _OnImportExport(String.Format("Xóa dữ liệu cũ..."), false); mKaraokeEntities.ExecuteStoreCommand("SP_DELETE_ALL_MENU"); _OnImportExport(String.Format("Tạo {0}...", MAYIN), false); Data.MAYIN mayin = new Data.MAYIN(); mayin.TenMayIn = "Test"; mayin.TieuDeIn = "BẾP"; mayin.SoLanIn = 1; mayin.Visual = true; mKaraokeEntities.MAYINs.AddObject(mayin); _OnImportExport(String.Format("Tạo {0}...", MAYIN), false); Data.MAYIN mayinBill = new Data.MAYIN(); mayinBill.TenMayIn = "Test"; mayinBill.TieuDeIn = "HÓA ĐƠN"; mayinBill.SoLanIn = 1; mayinBill.MayInHoaDon = true; mayinBill.Visual = true; mKaraokeEntities.MAYINs.AddObject(mayinBill); _OnImportExport(String.Format("Tạo {0}...", DONVI), false); Data.DONVI donvi = mKaraokeEntities.DONVIs.Where(o => o.DonViID == 1).FirstOrDefault(); if (donvi==null) { donvi = new Data.DONVI(); donvi.TenDonVi = "Số lượng"; donvi.Visual = true; mKaraokeEntities.DONVIs.AddObject(donvi); } _OnImportExport(String.Format("Tạo {0}...", LOAIDONVIBAN), false); Data.LOAIBAN loaiban = mKaraokeEntities.LOAIBANs.Where(o => o.LoaiBanID == 1).FirstOrDefault(); if (loaiban==null) { loaiban.TenLoaiBan = "Cái"; loaiban.KichThuocBan = 1; loaiban.Visual = true; mKaraokeEntities.LOAIBANs.AddObject(loaiban); donvi.LOAIBANs.Add(loaiban); } foreach (var item in listItem) { var nhom = (from a in listNhom where a.TenNgan == item.TenNhom select a).FirstOrDefault(); if (nhom==null) { _OnImportExport(String.Format("Tạo {0}---{1}", NHOM, item.TenNhom), false); nhom = new Data.MENUNHOM(); nhom.TenDai = nhom.TenNgan = item.TenNhom; nhom.Visual = true; mKaraokeEntities.MENUNHOMs.AddObject(nhom); listNhom.Add(nhom); } var mon = (from a in nhom.MENUMONs where a.TenNgan == item.TenMon select a).FirstOrDefault(); if (mon==null) { _OnImportExport(String.Format("Tạo {0}---{1}", MON, item.TenMon), false); mon = new Data.MENUMON(); mon.TenNgan = mon.TenDai = item.TenMon; mon.Gia = item.DonGia; mon.Visual = true; nhom.MENUMONs.Add(mon); donvi.MENUMONs.Add(mon); nhom.SLMonChoPhepTonKho++; Data.MENUITEMMAYIN monmayin = new Data.MENUITEMMAYIN(); mon.MENUITEMMAYINs.Add(monmayin); mayin.MENUITEMMAYINs.Add(monmayin); mKaraokeEntities.MENUMONs.AddObject(mon); //listMon.Add(mon); } _OnImportExport(String.Format("Tạo {0}---{1}", CHITIETMON, item.ChiTietMon), false); Data.MENUKICHTHUOCMON ktm = new Data.MENUKICHTHUOCMON(); ktm.TenLoaiBan = item.ChiTietMon; ktm.GiaBanMacDinh = item.DonGia; ktm.SoLuongBanBan = item.SoLuongBanMacDinh; ktm.KichThuocLoaiBan = 1; ktm.Visual = true; ktm.ChoPhepTonKho = true; mon.SLMonChoPhepTonKho++; mon.MENUKICHTHUOCMONs.Add(ktm); loaiban.MENUKICHTHUOCMONs.Add(ktm); donvi.MENUKICHTHUOCMONs.Add(ktm); mKaraokeEntities.MENUKICHTHUOCMONs.AddObject(ktm); } _OnImportExport(String.Format("Lưu dữ liệu..."), false); mKaraokeEntities.SaveChanges(); _OnImportExport(String.Format("Lưu dữ liệu thành công ...{0}",url), false); }
public BOMenuKichThuocMon(Data.MENUKICHTHUOCMON menuKichThuocMon, Data.MENUMON menuMon) { MenuKichThuocMon = menuKichThuocMon; MenuMon = menuMon; }
public BOMenuMon(Data.MENUMON menuMon, Data.MENUNHOM menuNhom) { MenuMon = menuMon; MenuNhom = menuNhom; }