Beispiel #1
0
        // ------------------------------------------------
        /// <summary>
        ///     Calculate the Commissions for a given 
        ///     transaction.
        /// </summary>
        /// <param name="transactionID"></param>
        /// <returns></returns>
        public static TransactionCommission GetCommission(int transactionID)
        {
            TransactionCommission retVal = new TransactionCommission() { TransactionID = transactionID };

            // ----------------------------------------------------------
            // Find data in the Accounting Tables based on Transaction ID

            Transaction transaction = new Transaction(transactionID);

            // ------------------------------------------------
            // For now, fake it. But this will come from the DB

            ProductCommission prodComm = new ProductCommission(transaction.ProductID, transaction.BinID, transaction.TransactionDate);

            // -----------------------------------
            // Perform the Calculation and set the
            // properties on the return object.

            retVal.BinID = prodComm.BinID;
            retVal.TransactionID = transactionID;
            retVal.ProductID = prodComm.ProductID;
            retVal.CommissionAmount = (double)transaction.UnitCount * prodComm.CommissionFactor;

            return retVal;
        }
Beispiel #2
0
        public void Transaction()
        {
            int binID = Convert.ToInt32(TestContext.DataRow["BinID"]);
            int unitCount = Convert.ToInt32(TestContext.DataRow["Count"]);
            int transactionID = Convert.ToInt32(TestContext.DataRow["ID"]);
            int productID = Convert.ToInt32(TestContext.DataRow["ProductID"]);

            Transaction tran = new Transaction(transactionID);

            Assert.AreEqual(binID, tran.BinID);
            Assert.AreEqual(productID, tran.ProductID);
            Assert.AreEqual(unitCount, tran.UnitCount);
        }