Exemplo n.º 1
0
        public bool addRegister(Register register)
        {
            // mask register "using"
            registers.Add(register);

            return true;
        }
Exemplo n.º 2
0
 public void makePaymentTest()
 {
     int registerId = 0; // TODO: Initialize to an appropriate value
     Register target = new Register(registerId); // TODO: Initialize to an appropriate value
     target.makePayment();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 3
0
        public bool removeRegister(Register register)
        {
            int numberOfRegister = getNumberOfRegisters();
            registers.Remove(register);

            if (numberOfRegister == registers.Count - 1)
            {
                return true;
            }
            else
            {
                Debug.WriteLine("Register {0} is not existed!", register.Id);
                return false;
            }
        }
Exemplo n.º 4
0
        public void addRegisterTest()
        {
            string name = "ABC Market";
            string address = "123 Somewhere St, aCity, aState 00000";
            decimal taxRate = 0.08m;
            Store target = new Store(1, name, address, taxRate);

            Register aRegister = new Register(1234,target);
            target.addRegister(aRegister);
            Assert.AreEqual(0, target.getRegisters().IndexOf(aRegister));

            Register anotherRegister = new Register(2345);
            target.addRegister(anotherRegister);
            Assert.AreEqual(1, target.getRegisters().IndexOf(anotherRegister));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="register"></param>
        public void insertReceipt(Register register)
        {
            string query = "INSERT Receipt(saleDate, storeId, registerId, employeeId) " +
                            "VALUES ('" + register.Sale.SaleDate.ToString("yyyy-MM-d hh:mm:ss") + "'," +
                             register.Store.Id + "," + register.Id + "," + register.Cashier.EmployeeId + ")";
            UInt64 receiptId = Insert2(query);

            foreach (SalesLineItem lineItem in register.Sale.ItemList)
            {
                query = "INSERT SalesLineItem(qty, itemId) " +
                            "VALUES (" + lineItem.Quantity + "," + lineItem.ProductId + ")";
                UInt64 saleId = Insert2(query);

                query = "INSERT LineItemReceipt(saleId, receiptId) " +
                            "VALUES (" + saleId + "," + receiptId + ")";
                Insert2(query);
            }

            foreach (PaymentMethod payment in register.Sale.Payments)
            {
                // Hard code
                int paymentTypeId = 0;
                switch (payment.GetType().Name)
                {
                    case "CashPayment":
                        paymentTypeId = 1;
                        break;
                    case "CheckPayment":
                        paymentTypeId = 2;
                        break;
                    case "CreditCardPayment":
                        paymentTypeId = 3;
                        break;
                }
                if (paymentTypeId == 0)
                {
                    MessageBox.Show("Undefined payment method.");
                    System.Environment.Exit(-1);
                }

                query = "INSERT Payment(paymentTypeId, amount) " +
                            "VALUES (" + paymentTypeId + "," + payment.Amount + ")";
                UInt64 paymentId = Insert2(query);

                query = "INSERT PaymentReceipt(receiptId, paymentId) " +
                            "VALUES (" + receiptId + "," + paymentId + ")";
                Insert2(query);
            }
        }
Exemplo n.º 6
0
 public void setRegister(Register register)
 {
     this.register = register;
 }