public Table(EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork)
        {
            _unitofwork         = unitofwork;
            _cloudPosUnitofwork = cloudPosUnitofwork;
            InitializeComponent();

            recShadow = new DropShadowBitmapEffect
            {
                Color = new Color {
                    A = 1, R = 255, G = 0, B = 0
                },
                ShadowDepth = 5,
                Direction   = 270,
                Softness    = 0.60,
                Opacity     = 0.75
            };

            recShadowOrdered = new DropShadowBitmapEffect
            {
                Color = new Color {
                    A = 1, R = 0, G = 55, B = 55
                },
                ShadowDepth = 5,
                Direction   = 270,
                Softness    = 0.60,
                Opacity     = 0.75
            };

            initTableData();

            Loaded += TablePage_loaded;
        }
Ejemplo n.º 2
0
        ////check file tableRuntimeHistory isExist
        //public static bool checkTableRuntimeHistoryFileExist()
        //{
        //    return File.Exists(startupProjectPath + "\\SerializedData\\tableRuntimeHistory.bin");
        //}

        //write khi add new
        public static Entities.Table writeOnAddNew(EmployeewsOfLocalPOS _unitofwork, Rectangle rec, Entities.Employee emp)
        {
            Entities.Table newTable = new Entities.Table()
            {
                TableId     = 0,
                TableNumber = int.Parse(rec.Name.Substring(5)),
                ChairAmount = 0,
                PosX        = Convert.ToInt32(rec.Margin.Left),
                PosY        = Convert.ToInt32(rec.Margin.Top),
                IsPinned    = 0,
                IsOrdered   = 0,
                IsLocked    = 0,
                TableRec    = rec
            };

            _unitofwork.TableRepository.Insert(newTable);
            _unitofwork.Save();

            Entities.OrderTemp newOrderTemp = new Entities.OrderTemp()
            {
                CusId       = "CUS0000001",
                EmpId       = emp.EmpId,
                TableOwned  = _unitofwork.TableRepository.Get(x => x.TableNumber.Equals(newTable.TableNumber)).First().TableId,
                Ordertime   = DateTime.Now,
                TotalPrice  = 0,
                CustomerPay = 0,
                PayBack     = 0
            };

            _unitofwork.OrderTempRepository.Insert(newOrderTemp);
            _unitofwork.Save();

            return(_unitofwork.TableRepository.Get(x => x.TableNumber.Equals(newTable.TableNumber)).First());
        }
Ejemplo n.º 3
0
        public DoPrintHelper(EmployeewsOfLocalPOS unitofwork, EmployeewsOfCloudPOS cloudPosUnitofwork, int printType, OrderNote currentOrder)
        {
            _unitofwork         = unitofwork;
            _cloudPosUnitofwork = cloudPosUnitofwork;
            type     = printType;
            curOrder = currentOrder;
            printDlg = new PrintDialog();

            string[] result = ReadWriteData.ReadPrinterSetting();
            if (result != null)
            {
                _receptionPrinter = result[0];
                _kitchentPrinter  = result[1];
                _barPrinter       = result[2];

                if (int.Parse(result[3]) == 1)
                {
                    isShowReview = true;
                }
                else
                {
                    isShowReview = false;
                }
            }
            else
            {
                _receptionPrinter = "";
                _kitchentPrinter  = "";
                _barPrinter       = "";
                isShowReview      = true;
            }
        }
        public TestPrintWindow()
        {
            InitializeComponent();

            _unitofwork = new EmployeewsOfLocalPOS();
            curTable    = _unitofwork.TableRepository.Get(x => x.TableId == 1).First();
        }
Ejemplo n.º 5
0
        public TableSettingDialog(EmployeewsOfLocalPOS unitofwork, Entities.Table table)
        {
            InitializeComponent();

            _uniofwork = unitofwork;
            curTable   = table;

            this.Loaded     += TableSettingDialog_Loaded;
            this.ResizeMode  = ResizeMode.NoResize;
            this.WindowStyle = WindowStyle.SingleBorderWindow;
        }
        public ConfirmMergeDialog(EmployeewsOfLocalPOS unitofwork, Entities.Table first, Entities.Table second)
        {
            _unitofwork = unitofwork;
            _first      = first;
            _second     = second;
            InitializeComponent();

            initTableData();

            this.WindowStyle = WindowStyle.SingleBorderWindow;
            this.ResizeMode  = ResizeMode.NoResize;
        }
        public SwapOrMergeTable(EmployeewsOfLocalPOS unitofwork, List <Entities.Table> currentTableList, int type) //1: swap, 2: merge
        {
            _unitofwork           = unitofwork;
            _currentTableList     = currentTableList;
            _currentChairList     = _unitofwork.ChairRepository.Get().ToList();
            _orderTempList        = _unitofwork.OrderTempRepository.Get().ToList();
            _orderDetailsTempList = _unitofwork.OrderDetailsTempRepository.Get().ToList();
            _type = type;
            InitializeComponent();

            initTableData();

            this.WindowStyle = WindowStyle.SingleBorderWindow;
            this.ResizeMode  = ResizeMode.NoResize;
        }
Ejemplo n.º 8
0
        public OrderForPrint GetAndConvertOrder(OrderNote targetOrder, EmployeewsOfLocalPOS unitofwork)
        {
            No                = targetOrder.OrdernoteId;
            Casher            = targetOrder.EmpId;
            Customer          = targetOrder.CusId;
            Pax               = targetOrder.Pax;
            Table             = targetOrder.Ordertable;
            Date              = targetOrder.Ordertime;
            TotalPriceNonDisc = targetOrder.TotalPriceNonDisc;
            TotalPrice        = targetOrder.TotalPrice;
            Svc               = targetOrder.Svc;
            Vat               = targetOrder.Vat;
            SaleValue         = targetOrder.SaleValue;
            CustomerPay       = targetOrder.CustomerPay;
            PayBack           = targetOrder.PayBack;

            return(this);
        }
Ejemplo n.º 9
0
        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)
                {
                }
            }
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Convert data of OrderTemp object to OrderForPrint
        /// </summary>
        /// <param name="table">target table that contain order</param>
        public OrderForPrint GetAndConvertOrder(Entities.Table targetTable, EmployeewsOfLocalPOS unitofwork)
        {
            TableOwned = targetTable;

            var targetOrder = unitofwork.OrderTempRepository.Get(x => x.TableOwned == targetTable.TableId).First();

            No                = targetOrder.OrdertempId.ToString();
            Casher            = targetOrder.EmpId;
            Customer          = targetOrder.CusId;
            Table             = targetTable.TableNumber;
            Pax               = targetOrder.Pax;
            Date              = targetOrder.Ordertime;
            TotalPriceNonDisc = targetOrder.TotalPriceNonDisc;
            TotalPrice        = targetOrder.TotalPrice;
            Svc               = targetOrder.Svc;
            Vat               = targetOrder.Vat;
            SaleValue         = targetOrder.SaleValue;
            CustomerPay       = targetOrder.CustomerPay;
            PayBack           = targetOrder.PayBack;

            return(this);
        }
Ejemplo n.º 13
0
        /// <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);
        }
Ejemplo n.º 14
0
        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);
            }
        }