コード例 #1
0
        public void InvoiceBuilderTest()
        {
            Staff saleRep = new Staff("QAD0001", "Shuayb", JobRole.Sale);
            Order order   = Setup();

            InvoiceBuilder iBuild = new InvoiceBuilder();

            iBuild.Order = order;
            iBuild.Staff = saleRep;
            Sale sInvoice = iBuild.Prepare() as Sale;

            Assert.Fail();
        }
コード例 #2
0
ファイル: AccountingInstance.cs プロジェクト: mr360/IMS
        /// <summary>
        /// Process the payment and produces a tax invoice
        /// </summary>
        public string CreatePayment(CreditCard card)
        {
            if (_customer == null || _sInvoice == null)
            {
                return("Need to declare payment parameters!");
            }

            string           lResult    = "";
            PaymentProcessor pProcessor = new PaymentProcessor();

            lResult = pProcessor.SetPaymentDetail(card);
            if (lResult != "VALID")
            {
                return("Payment details are not vaild.");
            }

            string paymentId = pProcessor.Pay(_sInvoice.TotalCost);

            if (paymentId == "ERROR")
            {
                return("An error occoured with the payment system. Unknown!.");
            }

            InvoiceBuilder iBuild = new InvoiceBuilder();

            iBuild.Invoice     = InvoiceType.Tax;
            iBuild.SaleInvoice = _sInvoice;
            iBuild.Customer    = _customer;
            iBuild.PaymentId   = paymentId;
            _tInvoice          = iBuild.Prepare() as Tax;

            UpdateVehicleInventoryState();

            string msg = _manager["Invoice"].Update(_tInvoice);

            if (msg != "Successfully updated.")
            {
                return(msg);
            }
            return("Payment Success.");
        }
コード例 #3
0
ファイル: SaleInstance.cs プロジェクト: mr360/IMS
        public string CreateSale(PriceRate discount)
        {
            if (_vehicle == null || _compatibleAddons == null || _selectedAddons == null)
            {
                return("Missing key sales details");
            }

            OrderBuilder oBuild = new OrderBuilder();

            oBuild.Add(_vehicle, VehicleType.New);
            oBuild.Add(_tradeIn, VehicleType.Trade);
            oBuild.SetDiscount(discount);
            oBuild.Add(_selectedAddons, _compatibleAddons);
            Order orders = oBuild.Prepare();

            InvoiceBuilder iBuild = new InvoiceBuilder();

            iBuild.Staff = _saleRep;
            iBuild.Order = orders;
            _sInvoice    = iBuild.Prepare() as Sale;

            return(_manager["Invoice"].Add(_sInvoice));
        }