protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); CurrentTab = AdminTabType.Marketing; ValidateCurrentUserHasPermission(SystemPermissions.MarketingView); _promFactory = Factory.Instance.CreatePromotionFactory(); }
public SBInventoryPromotionController() { _factory = new PromotionFactory(); _factoryProduct = new ProductFactory(); ViewBag.ListStore = GetListStore(); listPropertyReject = new List <string>(); listPropertyReject.Add("DiscountType"); }
public void AdditionalPromotionTest2() { String[] promoArgs = { "Additional", "Apple", "66", "3" }; Catalog.updateInventory(); PromotionFactory promoFactory = new PromotionFactory(); Promotion promoTest = promoFactory.createPromotion(promoArgs); double discount10000 = promoTest.getDiscount(10000); Assert.AreEqual(discount10000, 1225, 0.001); }
public void GroupPromotionTest2() { String[] promoArgs = { "Group", "Apple", "2.27", "4" }; Catalog.updateInventory(); PromotionFactory promoFactory = new PromotionFactory(); Promotion promoTest = promoFactory.createPromotion(promoArgs); double discount10000 = promoTest.getDiscount(10000); Assert.AreEqual(discount10000, 1825, 0.001); }
public void SalePromotionTest() { String[] promoArgs = { "Sale", "Apple", "0.30" }; Catalog.updateInventory(); PromotionFactory promoFactory = new PromotionFactory(); Promotion promoTest = promoFactory.createPromotion(promoArgs); double discount1000 = promoTest.getDiscount(10000); Assert.AreEqual(discount1000, 4500, 0.001); }
protected override void OnPieceMoved() { if (Piece is Pawn) { if (AlliancesToPromote.Contains(Piece.Alliance)) { ChessPiece NewPiece = PromotionFactory.GetPiece(Row, Column); Piece = NewPiece; } } }
public decimal GetTotal() { var promotion = new PromotionFactory() .Create(Rentals) .Discount(); var total = Rentals.Sum(x => x.GetCharge()); total *= promotion; return(total); }
protected void btnAddPromotion_Click(object sender, EventArgs e) { String title = txtTitle.Text; String description = txtDescription.Text; int discount = Int32.Parse(txtDiscount.Text); Promotion x = PromotionFactory.create(title, description, discount); PromotionRepositories.insertPromo(x); erMessage.Text = "Successfully added new Promotion!"; }
public void TestPromotionNotImplemented() { // arrange string coupon = ""; var typeExpect = Throws.TypeOf <NotImplementedException>(); // act PromotionFactory promoFactory = new PromotionFactory(); ActualValueDelegate <object> testDelegate = () => promoFactory.GetPromotionByCode(coupon); // assert Assert.That(testDelegate, typeExpect); }
public void TestPromotionDefault() { // arrange string coupon = "NONE"; Type expectType = typeof(DefaultPromotion); // act PromotionFactory promoFactory = new PromotionFactory(); IPromotion promo = promoFactory.GetPromotionByCode(coupon); Type actualType = promo.GetType(); // assert Assert.AreEqual(expectType, actualType); }
public void TestPromotionStarCard() { // arrange string coupon = "STARCARD"; Type expectType = typeof(PromotionStarCard); // act PromotionFactory promoFactory = new PromotionFactory(); IPromotion promo = promoFactory.GetPromotionByCode(coupon); Type actualType = promo.GetType(); // assert Assert.AreEqual(expectType, actualType); }
public void TestDiscount10Percent() { // arrange string coupon = "DIS10"; Type expectType = typeof(PromotionDis10); // act PromotionFactory promoFactory = new PromotionFactory(); IPromotion promo = promoFactory.GetPromotionByCode(coupon); Type actualType = promo.GetType(); // assert Assert.AreEqual(expectType, actualType); }
public Promotion() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); MyBLL = PromotionFactory.CreatePromotion(); pub = new Public_Class(); myproduct = new Product(); MyLimits = PromotionLimitFactory.CreatePromotionLimit(); }
public void InstanceCreatedWithCorrectParameters() { const string qualifyingProductId = "qualifyingProductId"; const int quantityToQualify = 10; const string discountProductId = "discountProductId"; const decimal discountPercentage = 0.5m; IPromotionFactory factory = new PromotionFactory(); var instance = factory.Create(qualifyingProductId, quantityToQualify, discountProductId, discountPercentage); var concrete = Assert.IsAssignableFrom <Promotion>(instance); qualifyingProductId.ShouldBe(concrete.QualifyingProductId); quantityToQualify.ShouldBe(concrete.QuantityToQualify); discountProductId.ShouldBe(concrete.DiscountProductId); discountPercentage.ShouldBe(concrete.DiscountPercentage); }
public static void create(String title, String desc, int discount) { Promotion newPromo = PromotionFactory.create(title, desc, discount); PromotionHandler.create(newPromo); }
static void Main(string[] args) { bool loopContinue = true; while (loopContinue) { Console.WriteLine("Commiting New Changes with push"); Console.WriteLine("Please Enter Option No. 1)Product Price Calculation"); int option = Convert.ToInt32(Console.ReadLine()); List <SkuProduct> prodList = new List <SkuProduct>(); SkuProduct productA = new SkuProduct(); SkuProduct productB = new SkuProduct(); SkuProductCombo productCombo = new SkuProductCombo(); int count, total, finalAmount = 0; List <int> finalPrice = new List <int>(); PromotionFactory promofactory = new PromotionFactory(); PromotionCombinationFactory prmoCombFacory = new PromotionCombinationFactory(); switch (option) { case 1: Console.WriteLine("Enter no. of prod to buy for Product A"); count = Convert.ToInt32(Console.ReadLine()); productA.SkuName = "A"; productA.count = count; prodList.Add(productA); Console.WriteLine("Enter no. of prod to buy for Product B"); count = Convert.ToInt32(Console.ReadLine()); productB.SkuName = "B"; productB.count = count; prodList.Add(productB); Console.WriteLine("Enter no. of prod to buy for Product C"); count = Convert.ToInt32(Console.ReadLine()); productCombo.SkuName1 = "C"; productCombo.count1 = count; Console.WriteLine("Enter no. of prod to buy for Product D"); count = Convert.ToInt32(Console.ReadLine()); productCombo.SkuName2 = "D"; productCombo.count2 = count; foreach (SkuProduct prod in prodList) { IPromotion promo = promofactory.GetPromoOffer(prod.SkuName); total = promo.CalculatePrice(prod.count); finalPrice.Add(total); } IPromotionCombined promocomb = prmoCombFacory.GetPromoOffer(productCombo.SkuName1, productCombo.SkuName2); total = promocomb.CalculatePrice(productCombo.count1, productCombo.count2); finalPrice.Add(total); foreach (int val in finalPrice) { finalAmount = finalAmount + val; } Console.WriteLine(finalAmount); break; default: Console.WriteLine("Value didn’t match earlier."); break; } } }