コード例 #1
0
        public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets        = Substitute.ForPartsOf <Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any <int>(), Arg.Any <string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any <int>(), Arg.Any <string>()).Returns(false);

            _paymentProviders = new List <IPaymentProvider> {
                _cashPayment, _nets
            };

            _fakePaymentDao        = Substitute.For <IPaymentDao>();
            _fakeReceiptController = Substitute.For <IReceiptController>();
            _fakeCashDrawer        = Substitute.For <ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price       = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price       = 100,
            };
        }
コード例 #2
0
 public static IInvoice createInvoice(IEmployee emp, ICashDrawer drawer, DatabaseClass dc)
 {
     //Console.WriteLine("Creating invoice with employee name = " + emp.getName());
     string[] attributeNames  = { "Employee_Id", "Invoice_Create_Time", "Cash_Drawer_Id" };
     string[] attributeValues = { emp.getIdAsString(), "CURRENT_TIMESTAMP", drawer.getId().ToString() };
     dc.insert("Invoice", attributeNames, attributeValues);
     return(new Invoice(emp, Convert.ToInt16(dc.getLastInsertId(INVOICE_TABLE_STRING)), drawer.getId()));
 }
コード例 #3
0
 public BusinessLogic(IDatabaseAccess db, IPrinterModule pm)
 {
     this._db             = db;
     this._currentInvoice = null;
     this.pm = pm;
     this.currentCashDrawer = null;
     this._isOrderStarted   = false;
 }
コード例 #4
0
        private void UnclaimDevices()
        {
            ICashDrawer drawer = _posDeviceManager.GetCashDrawer();

            drawer.Release();
            IReceiptPrinter printer = _posDeviceManager.GetReceiptPrinter();

            printer.Release();
        }
コード例 #5
0
 public ICashDrawer GetCashDrawer()
 {
     if (_drawer == null)
     {
         DeviceInfo drawerDeviceInfo = _exp.GetDevice("CashDrawer");
         CashDrawer drawer           = (CashDrawer)_exp.CreateInstance(drawerDeviceInfo);
         _drawer = new DrawerWrapper(drawer, _messageBus);
         drawer.Open();
     }
     return(_drawer);
 }
コード例 #6
0
        private void ClaimPOSDevices()
        {
            //  open (if not already opened), claim and enable the cash drawer and receipt printer.
            ICashDrawer drawer = _posDeviceManager.GetCashDrawer();

            drawer.Claim();
            drawer.Enable();
            IReceiptPrinter printer = _posDeviceManager.GetReceiptPrinter();

            printer.Claim();
            printer.Enable();
        }
コード例 #7
0
        public PaymentViewModel(BBQRMSEntities dataService, IMessageBus messageBus, OrderViewModel order, IPOSDeviceManager posDeviceManager)
        {
            Order       = order;
            DataService = dataService;
            MessageBus  = messageBus;

            _cashDrawer = posDeviceManager.GetCashDrawer();

            PaymentTypes   = new ObservableCollection <PaymentType>(DataService.PaymentTypes.Execute());
            PaymentType    = PaymentTypes.Where(x => x.Id == ServerProxy.PaymentTypes.Cash).FirstOrDefault();
            PaymentVisible = "Visible";
            PaymentZIndex  = 200;
        }
コード例 #8
0
ファイル: PaymentController.cs プロジェクト: KasperSK/TripleA
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="paymentProviderList">List of providers to be used with the payment controller</param>
 /// <param name="receiptController">The receipt controller to be used by the payment controller</param>
 /// <param name="paymentDao">The dao to be used by the payment controller</param>
 /// <param name="cashDrawer">The cashdrawer to be used by the payment controller</param>
 public PaymentController(IEnumerable <IPaymentProvider> paymentProviderList,
                          IReceiptController receiptController, IPaymentDao paymentDao, ICashDrawer cashDrawer)
 {
     _receiptController = receiptController;
     _paymentDao        = paymentDao;
     CashDrawer         = cashDrawer;
     _paymentProviders  = new List <IPaymentProvider>();
     foreach (var paymentProvider in paymentProviderList)
     {
         _paymentProviders.Add(paymentProvider);
     }
     _paymentProviders.ForEach(e => e.Init());
 }
        public void SetUp()
        {
            _receiptController = Substitute.For<IReceiptController>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _productDao = Substitute.For<IProductDao>();
            _paymentDao = Substitute.For<IPaymentDao>();
            _orderDao = Substitute.For<IOrderDao>();

            var paymentProviders = new List<IPaymentProvider> {new CashPayment()};
            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
        public void SetUp()
        {
            _orderLines = new List<OrderLine>();

            _receiptController = Substitute.For<IReceiptController>();
            _productController = Substitute.For<IProductController>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _paymentDao = Substitute.For<IPaymentDao>();
            _orderDao = Substitute.For<IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any<OrderLine>())).Do(x => _orderLines.Add(x.Arg<OrderLine>()));

            var paymentProviders = new List<IPaymentProvider>() { new CashPayment() };
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
コード例 #11
0
        public void SetUp()
        {
            _receiptController = Substitute.For <IReceiptController>();
            _cashDrawer        = Substitute.For <ICashDrawer>();
            _productDao        = Substitute.For <IProductDao>();
            _paymentDao        = Substitute.For <IPaymentDao>();
            _orderDao          = Substitute.For <IOrderDao>();

            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
        public void SetUp()
        {
            _orderLines = new List <OrderLine>();

            _receiptController = Substitute.For <IReceiptController>();
            _productController = Substitute.For <IProductController>();
            _cashDrawer        = Substitute.For <ICashDrawer>();
            _paymentDao        = Substitute.For <IPaymentDao>();
            _orderDao          = Substitute.For <IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any <OrderLine>())).Do(x => _orderLines.Add(x.Arg <OrderLine>()));

            var paymentProviders = new List <IPaymentProvider>()
            {
                new CashPayment()
            };

            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount    = new Discount();
            _product     = new Product("Test", 100, true);

            _printer    = Substitute.For <IPrinter>();
            _cashDrawer = Substitute.For <ICashDrawer>();
            _dalFacade  = Substitute.For <IDalFacade>();

            _productDao        = new ProductDao(_dalFacade);
            _paymentDao        = new PaymentDao(_dalFacade);
            _orderDao          = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
コード例 #14
0
        public ICashReport getDrawerReport(ICashDrawer drawer)
        {
            if (drawer != null)
            {
                string queryNumberOfOrders = "SELECT COUNT(*) " +
                                             "FROM Invoice " +
                                             "WHERE Cash_Drawer_Id = " + drawer.getId().ToString() + " " +
                                             "  AND Is_Void = 0";
                string queryCredit = "SELECT SUM(Amount) " +
                                     "FROM Invoice i JOIN Cash_Drawer c ON i.Cash_Drawer_Id = c.Cash_Drawer_Id " +
                                     "JOIN Line_Payment l ON i.Invoice_Id = l.Invoice_Id " +
                                     "WHERE c.Cash_Drawer_Id = " + drawer.getId().ToString() + " AND " +
                                     "Payment_Type = 'CREDIT' AND Is_Void = 0";
                string queryGift = "SELECT SUM(Amount) " +
                                   "FROM Invoice i JOIN Cash_Drawer c ON i.Cash_Drawer_Id = c.Cash_Drawer_Id " +
                                   "JOIN Line_Payment l ON i.Invoice_Id = l.Invoice_Id " +
                                   "WHERE c.Cash_Drawer_Id = " + drawer.getId().ToString() + " AND " +
                                   "Payment_Type = 'GIFT' AND Is_Void = 0";
                string queryNet = "SELECT SUM(Invoice_Total) " +
                                  "FROM Invoice i JOIN Cash_Drawer c ON i.Cash_Drawer_Id = c.Cash_Drawer_Id " +
                                  "WHERE c.Cash_Drawer_Id = " + drawer.getId().ToString() + " " +
                                  "  AND Is_Void = 0";
                string queryTax = "SELECT SUM(Tax) " +
                                  "FROM Invoice i JOIN Cash_Drawer c ON i.Cash_Drawer_Id = c.Cash_Drawer_Id " +
                                  "WHERE c.Cash_Drawer_Id = " + drawer.getId().ToString() + " " +
                                  "  AND Is_Void = 0";
                string queryGross = "SELECT SUM(Invoice_Total) + SUM(Tax) " +
                                    "FROM Invoice i JOIN Cash_Drawer c ON i.Cash_Drawer_Id = c.Cash_Drawer_Id " +
                                    "WHERE c.Cash_Drawer_Id = " + drawer.getId().ToString() + " " +
                                    "  AND Is_Void = 0";

                string numResult = dc.query(queryNumberOfOrders).Trim('\n', ' ');
                int    numSales  = 0;
                if (numResult != null && numResult != "")
                {
                    numSales = Convert.ToInt32(numResult);
                }

                string  netResult = dc.query(queryNet).Trim('\n', ' ');
                decimal netSales  = 0;
                if (netResult != null && netResult != "")
                {
                    netSales = Convert.ToDecimal(netResult);
                }

                string  creditResult = dc.query(queryCredit).Trim('\n', ' ');
                decimal creditSales  = 0;
                if (creditResult != null && creditResult != "")
                {
                    creditSales = Convert.ToDecimal(creditResult);
                }
                string  giftResult = dc.query(queryGift).Trim('\n', ' ');
                decimal giftSales  = 0;
                if (giftResult != null && giftResult != "")
                {
                    giftSales = Convert.ToDecimal(giftResult);
                }
                string  taxResult = dc.query(queryTax).Trim('\n', ' ');
                decimal taxSales  = 0;
                if (taxResult != null && taxResult != "")
                {
                    taxSales = Convert.ToDecimal(taxResult);
                }
                string  totalResult = dc.query(queryGross).Trim('\n', ' ');
                decimal totalSales  = 0;
                if (totalResult != null && totalResult != "")
                {
                    totalSales = Convert.ToDecimal(totalResult);
                }


                decimal cashSales   = totalSales - creditSales - giftSales;
                decimal cashToCount = totalSales - creditSales - giftSales;

                return(new CashReport(numSales, cashSales, creditSales, giftSales, netSales, taxSales, totalSales, cashToCount));
            }
            return(null);
        }
コード例 #15
0
 public void logOnCashDrawer(string empId, string bank)
 {
     currentCashDrawer = _db.createCashDrawer(_db.getEmployeeById(empId), bank);
 }
コード例 #16
0
 //--------------------- Invoice Methods -----------------------------------------------
 public IInvoice createInvoice(IEmployee emp, ICashDrawer drawer)
 {
     return(DatabaseInvoiceQuery.createInvoice(emp, drawer, dc));
 }
コード例 #17
0
 public void SetUp()
 {
     _uut = new CashDrawers.CashDrawer(1000);
 }
コード例 #18
0
 public void SetUp()
 {
     _uut = new CashDrawers.CashDrawer(1000);
 }
コード例 #19
0
        public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets = Substitute.ForPartsOf<Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any<int>(), Arg.Any<string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any<int>(), Arg.Any<string>()).Returns(false);

            _paymentProviders = new List<IPaymentProvider> {_cashPayment, _nets};

            _fakePaymentDao = Substitute.For<IPaymentDao>();
            _fakeReceiptController = Substitute.For<IReceiptController>();
            _fakeCashDrawer = Substitute.For<ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {

                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price = 100,
            };
        }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount = new Discount();
            _product = new Product("Test", 100, true);

            _printer = Substitute.For<IPrinter>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _dalFacade = Substitute.For<IDalFacade>();

            _productDao = new ProductDao(_dalFacade);
            _paymentDao = new PaymentDao(_dalFacade);
            _orderDao = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List<IPaymentProvider> { new CashPayment() };
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
コード例 #21
0
ファイル: PaymentController.cs プロジェクト: KasperSK/TripleA
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="paymentProviderList">List of providers to be used with the payment controller</param>
 /// <param name="receiptController">The receipt controller to be used by the payment controller</param>
 /// <param name="paymentDao">The dao to be used by the payment controller</param>
 /// <param name="cashDrawer">The cashdrawer to be used by the payment controller</param>
 public PaymentController(IEnumerable<IPaymentProvider> paymentProviderList,
     IReceiptController receiptController, IPaymentDao paymentDao, ICashDrawer cashDrawer)
 {
     _receiptController = receiptController;
     _paymentDao = paymentDao;
     CashDrawer = cashDrawer;
     _paymentProviders = new List<IPaymentProvider>();
     foreach (var paymentProvider in paymentProviderList)
     {
         _paymentProviders.Add(paymentProvider);
     }
     _paymentProviders.ForEach(e => e.Init());
 }