Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PricingUnit pricingUnit = db.PricingUnits.Find(id);

            db.PricingUnits.Remove(pricingUnit);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public static void Constructor_InitializesItemUnit(
            [Frozen] PricingUnit priceUnit,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.ItemUnit.Should().NotBeNull();
            model.ItemUnit.Description.Should().Be(priceUnit.Description);
            model.ItemUnit.Name.Should().Be(priceUnit.Name);
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,Price,Multiplier,IsIncluded,Text,PricingItemId,PricingTierId,PricingUnitType, CreateTime")] PricingUnit pricingUnit)
 {
     if (ModelState.IsValid)
     {
         pricingUnit.UpdateTime      = DateTime.Now;
         db.Entry(pricingUnit).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PricingItemId = new SelectList(db.PricingItems, "Id", "Name", pricingUnit.PricingItemId);
     ViewBag.PricingTierId = new SelectList(db.PricingTiers, "Id", "Name", pricingUnit.PricingTierId);
     return(View(pricingUnit));
 }
Esempio n. 4
0
        // GET: PricingUnit/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PricingUnit pricingUnit = db.PricingUnits.Find(id);

            if (pricingUnit == null)
            {
                return(HttpNotFound());
            }
            return(View(pricingUnit));
        }
Esempio n. 5
0
        // GET: PricingUnit/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PricingUnit pricingUnit = db.PricingUnits.Find(id);

            if (pricingUnit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PricingItemId = new SelectList(db.PricingItems, "Id", "Name", pricingUnit.PricingItemId);
            ViewBag.PricingTierId = new SelectList(db.PricingTiers, "Id", "Name", pricingUnit.PricingTierId);
            return(View(pricingUnit));
        }
        public static void Constructor_NullUnitTime_InitializesUnitTime(
            Order order,
            CatalogueItem catalogueItem,
            PricingUnit pricingUnit,
            ServiceRecipient recipient)
        {
            var orderItem = new FlattenedOrderItem
            {
                CatalogueItem = catalogueItem,
                Order         = order,
                PricingUnit   = pricingUnit,
                Recipient     = recipient,
            };

            var odooOrderItem = new OdooOrderItem(orderItem);

            odooOrderItem.UnitTime.Should().BeNull();
        }
        public static void Constructor_DeclarativeProvisioningType_InitializesEstimationPeriod(
            Order order,
            CatalogueItem catalogueItem,
            PricingUnit pricingUnit,
            ServiceRecipient recipient)
        {
            var orderItem = new FlattenedOrderItem
            {
                CatalogueItem    = catalogueItem,
                Order            = order,
                PricingUnit      = pricingUnit,
                ProvisioningType = ProvisioningType.Declarative,
                Recipient        = recipient,
            };

            var odooOrderItem = new OdooOrderItem(orderItem);

            odooOrderItem.EstimationPeriod.Should().BeNull();
        }
        private static CataloguePriceFlat GetFlatPrice(ICataloguePriceListResult price)
        {
            var flatPrice = new CataloguePriceFlat
            {
                CataloguePriceId  = price.CataloguePriceId,
                CatalogueItemName = price.CatalogueItemName,
                CatalogueItemId   = price.CatalogueItemId,
                PricingUnit       = new PricingUnit
                {
                    Description = price.PricingUnitDescription,
                    Name        = price.PricingUnitName,
                    TierName    = price.PricingUnitTierName,
                },
                TimeUnit         = price.TimeUnitId is null ? null : Enumerator.FromValue <TimeUnit>(price.TimeUnitId.Value),
                CurrencyCode     = price.CurrencyCode,
                Price            = price.FlatPrice.GetValueOrDefault(),
                ProvisioningType = Enumerator.FromValue <ProvisioningType>(price.ProvisioningTypeId),
            };

            return(flatPrice);
        }
        private static CataloguePriceTier GetTierPrice(ICataloguePriceListResult price)
        {
            CataloguePriceTier tier = new CataloguePriceTier
            {
                CataloguePriceId  = price.CataloguePriceId,
                CatalogueItemName = price.CatalogueItemName,
                CatalogueItemId   = price.CatalogueItemId,
                CurrencyCode      = price.CurrencyCode,
                PricingUnit       = new PricingUnit
                {
                    Name        = price.PricingUnitName,
                    Description = price.PricingUnitDescription,
                    TierName    = price.PricingUnitTierName,
                },
                TimeUnit         = price.TimeUnitId is null ? null : Enumerator.FromValue <TimeUnit>(price.TimeUnitId.Value),
                ProvisioningType = Enumerator.FromValue <ProvisioningType>(price.ProvisioningTypeId),
            };

            UpdateTierPrices(tier, price);
            return(tier);
        }
 public OrderItemBuilder WithPricingUnit(PricingUnit unit)
 {
     orderItem.PricingUnit = unit;
     return(this);
 }