public void UcMenu_Loaded(object sender, RoutedEventArgs e) { if (IsRefreshMenu) { try { _unitofwork = ((MainWindow)Window.GetWindow(this))._unitofwork; _cloudPosUnitofwork = ((MainWindow)Window.GetWindow(this)).CloudPosUnitofwork; lvCategoryBreakFast.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.StandardStats.Equals("BreakFast")); lvCategoryStarter.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.StandardStats.Equals("Starter")); lvCategoryMain.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.StandardStats.Equals("Main")); lvCategoryDessert.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.StandardStats.Equals("Dessert")); lvCategoryBeverages.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.Type == (int)ProductType.Beverage); lvCategoryBeer.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.Type == (int)ProductType.Beer); lvCategoryWine.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.Type == (int)ProductType.Wine); lvCategoryOther.ItemsSource = _cloudPosUnitofwork.ProductRepository.Get(p => p.Type == (int)ProductType.Other); IsRefreshMenu = false; //orderingTable = ((MainWindow) Window.GetWindow(this)).currentTable; //orderingChair = ((MainWindow) Window.GetWindow(this)).currentChair; //if (orderingTable == null) //{ // return; //} //((MainWindow) Window.GetWindow(this)).en.ucOrder.RefreshControlAllChair(); } catch (Exception ex) { } } }
public AllEmployeeLogin(Window main, EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork, MaterialDesignThemes.Wpf.Chip cUser, int typeshow) { _unitofwork = unitofwork; _cloudPosUnitofwork = cloudPosUnitofwork; _employee = _cloudPosUnitofwork.EmployeeRepository.Get(x => x.Deleted == 0).ToList(); _main = main; _cUser = cUser; _typeshow = typeshow; InitializeComponent(); initData(); this.Loaded += AllEmployeeLogin_Loaded; LoadForm = new DispatcherTimer(); LoadForm.Tick += LoadForm_Tick; LoadForm.Interval = new TimeSpan(0, 0, 0, 0, 1); }
public MainWindow() { InitializeComponent(); currentTable = null; emp = App.Current.Properties["EmpLogin"] as Employee; proTable = pgbReservedTable as ProgressBar; proChair = pgbReservedChair as ProgressBar; cUser.Content = EmpLoginListData.emploglist.Count() + " employee(s) available"; //string[] config = ReadWriteData.ReadDBConfig(); //if (config != null) //{ // _unitofwork = new EmployeewsOfLocalPOS(config[0], config[1], config[2], config[3]); //} //else //{ // _unitofwork = new EmployeewsOfLocalPOS(); //} _unitofwork = new EmployeewsOfLocalPOS(); CloudPosUnitofwork = new EmployeewsOfCloudPOS(); try { b = new Table(_unitofwork, CloudPosUnitofwork); d = new Dash(); en = new Entry(); info = new Info(); st = new SettingFoodPage(CloudPosUnitofwork); stts = new SettingTableSize(); WorkTimer = new DispatcherTimer(); WorkTimer.Tick += WorkTime_Tick; WorkTimer.Interval = new TimeSpan(0, 0, 1); WorkTimer.Start(); DispatcherTimer RefreshTimer = new DispatcherTimer(); RefreshTimer.Tick += Refresh_Tick; RefreshTimer.Interval = new TimeSpan(0, 2, 0); RefreshTimer.Start(); CheckWorkingTimer = new DispatcherTimer(); CheckWorkingTimer.Tick += CheckWorking_Tick; CheckWorkingTimer.Interval = new TimeSpan(0, 5, 0); initProgressTableChair(); this.Loaded += (sender, args) => { bntTable.IsEnabled = true; bntDash.IsEnabled = false; bntEntry.IsEnabled = true; myFrame.Navigate(d); }; this.Closing += (sender, args) => { WorkTimer.Stop(); _unitofwork.Dispose(); }; } catch (Exception ex) { MessageBox.Show("Something went wrong: \n" + ex.Message); AppLog.Error(ex); } }
public OrderForPrint GetAndConverOrderDetails(OrderNote targetOrder, EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork) { // convert foreach (var orderDetailsTemp in targetOrder.OrderNoteDetails) { OrderDetails.Add(new OrderDetailsForPrint() { Quan = orderDetailsTemp.Quan, ProductName = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Name, ProductPrice = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Price, ProductId = orderDetailsTemp.ProductId, ProductType = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Type, }); } return(this); }
/// <summary> /// Convert the list of OrderDetailsTemp's data to OrderDetailForPrint /// </summary> /// <param name="targetTable"></param> /// <param name="unitofwork"></param> /// <returns></returns> public OrderForPrint GetAndConverOrderDetails(Entities.Table targetTable, EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork, int printType) { // get Chairs data from target Table var targetChairs = unitofwork.ChairRepository.Get(x => x.TableOwned == targetTable.TableId); // get OrderDetailsTemp data from target Table List <OrderDetailsTemp> targetOrderDetails = new List <OrderDetailsTemp>(); foreach (var chair in targetChairs) { targetOrderDetails.AddRange(unitofwork.OrderDetailsTempRepository.Get(x => x.ChairId == chair.ChairId)); } // convert foreach (var orderDetailsTemp in targetOrderDetails) { if (orderDetailsTemp.IsPrinted == 1 && (DoPrintHelper.Bar_Printing == printType || printType == DoPrintHelper.Kitchen_Printing)) { // ignore the printed orderDetails is only available when bar printing and kitchen printing continue; } OrderDetails.Add(new OrderDetailsForPrint() { Quan = orderDetailsTemp.Quan, ProductName = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Name, ProductPrice = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Price, ProductId = orderDetailsTemp.ProductId, ProductType = cloudPosUnitofwork.ProductRepository.Get(p => p.ProductId == orderDetailsTemp.ProductId).First().Type, ChairNumber = unitofwork.ChairRepository.Get(c => c.ChairId == orderDetailsTemp.ChairId).First().ChairNumber, Note = orderDetailsTemp.Note, SelectedStats = orderDetailsTemp.SelectedStats, }); } return(this); }