Exemplo n.º 1
0
        public void CalculateRecognitions(long contractId)
        {
            DataRow contractRow = this[contractId];
            var amount = (decimal) contractRow["amount"];
            var rr = new RevenueRecognition(Table.DataSet);
            var product = new Product(Table.DataSet);
            long productId = GetProductId(contractId);

            if (product.GetProductType(productId) == ProductType.Wp)
            {
                rr.Insert(contractId, amount, GetWhenSigned(contractId));
            }
            else if (product.GetProductType(productId) == ProductType.Ss)
            {
                decimal[] allocation = Allocate(amount, 3);
                rr.Insert(contractId, allocation[0], GetWhenSigned(contractId) );
                rr.Insert(contractId, allocation[1], GetWhenSigned(contractId).AddDays(60));
                rr.Insert(contractId, allocation[2], GetWhenSigned(contractId).AddDays(90));
            }
            else if (product.GetProductType(productId) == ProductType.Db)
            {
                decimal[] allocation = Allocate(amount, 3);
                rr.Insert(contractId, allocation[0], GetWhenSigned(contractId));
                rr.Insert(contractId, allocation[1], GetWhenSigned(contractId).AddDays(30));
                rr.Insert(contractId, allocation[2], GetWhenSigned(contractId).AddDays(60));
            }
            else
            {
                throw new Exception("Invalid product ID");
            }
        }
Exemplo n.º 2
0
        public void CalculateRecognitions(long contractId)
        {
            DataRow contractRow = this[contractId];
            var     amount      = (decimal)contractRow["amount"];
            var     rr          = new RevenueRecognition(Table.DataSet);
            var     product     = new Product(Table.DataSet);
            long    productId   = GetProductId(contractId);

            if (product.GetProductType(productId) == ProductType.Wp)
            {
                rr.Insert(contractId, amount, GetWhenSigned(contractId));
            }
            else if (product.GetProductType(productId) == ProductType.Ss)
            {
                decimal[] allocation = Allocate(amount, 3);
                rr.Insert(contractId, allocation[0], GetWhenSigned(contractId));
                rr.Insert(contractId, allocation[1], GetWhenSigned(contractId).AddDays(60));
                rr.Insert(contractId, allocation[2], GetWhenSigned(contractId).AddDays(90));
            }
            else if (product.GetProductType(productId) == ProductType.Db)
            {
                decimal[] allocation = Allocate(amount, 3);
                rr.Insert(contractId, allocation[0], GetWhenSigned(contractId));
                rr.Insert(contractId, allocation[1], GetWhenSigned(contractId).AddDays(30));
                rr.Insert(contractId, allocation[2], GetWhenSigned(contractId).AddDays(60));
            }
            else
            {
                throw new Exception("Invalid product ID");
            }
        }