Example #1
0
        private void bntLogout_Click(object sender, RoutedEventArgs e)
        {
            if (App.Current.Properties["AdLogin"] != null)
            {
                return;
            }

            AllEmployeeLogin ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, CloudPosUnitofwork, cUser, 3);

            ael.ShowDialog();

            if (App.Current.Properties["CurrentEmpWorking"] == null)
            {
                if (en.IsEnabled == false)
                {
                    myFrame.Navigate(b);
                    bntTable.IsEnabled = false;
                    bntDash.IsEnabled  = true;
                    bntEntry.IsEnabled = true;
                }

                currentTable = null;
            }

            //WorkingHistory wh = App.Current.Properties["EmpWH"] as WorkingHistory;

            //wh.EndTime = DateTime.Now;
            //_unitofwork.WorkingHistoryRepository.Insert(wh);
            //_unitofwork.Save();

            //empSln = _unitofwork.SalaryNoteRepository.Get(sle => sle.EmpId.Equals(emp.EmpId) && sle.ForMonth.Equals(DateTime.Now.Month) && sle.ForYear.Equals(DateTime.Now.Year)).First();
            //var workH = wh.EndTime - wh.StartTime;
            //empSln.WorkHour += workH.Hours + workH.Minutes/60 + workH.Seconds/3600;
            //_unitofwork.SalaryNoteRepository.Update(empSln);
            //_unitofwork.Save();

            //foreach (var table in _unitofwork.TableRepository.Get())
            //{
            //    var orderTemp = _unitofwork.OrderTempRepository.Get(x => x.TableOwned.Equals(table.TableId)).First();
            //    orderTemp.CusId = "CUS0000001";
            //    orderTemp.Ordertime = DateTime.Now;
            //    orderTemp.TotalPrice = 0;
            //    orderTemp.CustomerPay = 0;
            //    orderTemp.PayBack = 0;
            //    table.IsOrdered = 0;
            //    var orderDetails = _unitofwork.OrderDetailsTempRepository.Get(x => x.OrdertempId.Equals(orderTemp.OrdertempId));
            //    if(orderDetails.Count() != 0)
            //    {
            //        foreach(var od in orderDetails)
            //        {
            //            _unitofwork.OrderDetailsTempRepository.Delete(od);
            //            _unitofwork.Save();
            //        }
            //    }
            //}

            //login = new Login();
            //this.Close();
            //login.Show();
        }
Example #2
0
        private void btnEmpDetail_Click(object sender, RoutedEventArgs e)
        {
            if (App.Current.Properties["AdLogin"] != null)
            {
                return;
            }

            AllEmployeeLogin ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, CloudPosUnitofwork, cUser, 2);

            ael.ShowDialog();
        }
        private void btnStartWorking_Click(object sender, RoutedEventArgs e)
        {
            if (App.Current.Properties["AdLogin"] != null)
            {
                return;
            }

            if (App.Current.Properties["CurrentEmpWorking"] != null)
            {
                MessageBox.Show("It's have some employee on working! Please wait!");
                return;
            }

            AllEmployeeLogin ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, CloudPosUnitofwork, cUser, 4);

            ael.ShowDialog();
        }
        //mothod kiem tra single or double
        private void DoClickSingleOrDouble(FrameworkElement ctrl, Rectangle rec)
        {
            int clicks = ClickAttach.GetClicks(ctrl);

            ClickAttach.SetClicks(ctrl, 0);
            if (clicks == 2)
            {
                if (App.Current.Properties["AdLogin"] != null)
                {
                    return;
                }

                EmpLoginList currentEmp = App.Current.Properties["CurrentEmpWorking"] as EmpLoginList;

                AllEmployeeLogin ael;
                Entities.Table   founded = currentTableList.Where(x => x.TableNumber.Equals(int.Parse(rec.Name.Substring(5)))).First();
                if (founded == null)
                {
                    return;
                }

                var ordertempcurrenttable = _unitofwork.OrderTempRepository.Get(x => x.TableOwned.Equals(founded.TableId)).First();

                if (founded.IsPinned == 0)
                {
                    MessageBoxResult mess = MessageBox.Show("You must be pin this table before you want to create new order. Do you want to pin now?", "Warning!", MessageBoxButton.YesNo);
                    if (mess == MessageBoxResult.Yes)
                    {
                        if (founded.ChairAmount == 0)
                        {
                            MessageBox.Show("You must be set Chair Amount greater than 0!");
                            return;
                        }

                        if (currentEmp != null)
                        {
                            if (ordertempcurrenttable != null)
                            {
                                ordertempcurrenttable.EmpId = currentEmp.Emp.EmpId;
                                _unitofwork.OrderTempRepository.Update(ordertempcurrenttable);
                                _unitofwork.Save();
                            }

                            navigateToOrder(currentEmp, founded.TableRec, founded);
                            return;
                        }

                        ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, _cloudPosUnitofwork, ((MainWindow)Window.GetWindow(this)).cUser, 4);
                        ael.ShowDialog();

                        checkCurrentEmp(currentEmp, founded.TableRec, founded, ordertempcurrenttable);
                    }
                }
                else
                {
                    if (founded.ChairAmount == 0)
                    {
                        MessageBox.Show("You must be set Chair Amount greater than 0!");
                        return;
                    }

                    if (founded.IsOrdered == 1)
                    {
                        currentEmp = App.Current.Properties["CurrentEmpWorking"] as EmpLoginList;

                        if (currentEmp != null)
                        {
                            if (currentEmp.Emp.EmpId.Equals(ordertempcurrenttable.EmpId))
                            {
                                navigateToOrder(currentEmp, founded.TableRec, founded);
                                return;
                            }
                            else
                            {
                                navigateToOrder(currentEmp, founded.TableRec, founded);
                                return;
                            }
                        }

                        ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, _cloudPosUnitofwork, ((MainWindow)Window.GetWindow(this)).cUser, 4);
                        ael.ShowDialog();

                        checkCurrentEmp(currentEmp, founded.TableRec, founded, ordertempcurrenttable);
                    }
                    else
                    {
                        currentEmp = App.Current.Properties["CurrentEmpWorking"] as EmpLoginList;

                        if (currentEmp != null)
                        {
                            if (ordertempcurrenttable != null)
                            {
                                ordertempcurrenttable.EmpId = currentEmp.Emp.EmpId;
                                _unitofwork.OrderTempRepository.Update(ordertempcurrenttable);
                                _unitofwork.Save();
                            }

                            checkCurrentEmp(currentEmp, founded.TableRec, founded, ordertempcurrenttable);
                            return;
                        }

                        ael = new AllEmployeeLogin((MainWindow)Window.GetWindow(this), _unitofwork, _cloudPosUnitofwork, ((MainWindow)Window.GetWindow(this)).cUser, 4);
                        ael.ShowDialog();

                        checkCurrentEmp(currentEmp, founded.TableRec, founded, ordertempcurrenttable);
                    }
                }
            }
        }