Exemplo n.º 1
0
        public ActionResult Add(PromotionList obj)
        {
            try
            {
                obj.CreateDate = DateTime.Now;
                obj.ModifyDate = DateTime.Now;

                promotionListBusiness.AddNew(obj);
                Response.Redirect("/Manage/PromotionList/Index");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/PromotionList/Index");
            }
            return(View());
        }
        public int TotalPriceCalculator(List <Product> productList)
        {
            var prods            = productList;
            var unitPrice        = new UnitPrices();
            var promotion        = new PromotionList();
            var promoFactor      = new PromotionFactor();
            int totalPrice       = 0;
            int currentPrice     = 0;
            int newCurrentPrice  = 0;
            int currentPriceForC = 0;
            int currentPriceForD = 0;

            foreach (Product prod in prods)
            {
                if (prod.ProductId == ProductEnum.A)
                {
                    currentPrice = (prod.ProductQuantity / (promoFactor.Factors((int)prod.ProductId)))
                                   * promotion.Promotionfor3A
                                   + (prod.ProductQuantity % 3) * unitPrice.UnitPriceforA;
                }
                else if (prod.ProductId == ProductEnum.B)
                {
                    currentPrice = (prod.ProductQuantity / (promoFactor.Factors((int)prod.ProductId))) * promotion.Promotionfor2B
                                   + (prod.ProductQuantity % 2) * unitPrice.UnitPriceforB;
                }
                else if (prod.ProductId == ProductEnum.C)
                {
                    currentPrice     = prod.ProductQuantity * unitPrice.UnitPriceforC;
                    currentPriceForC = currentPrice;
                }
                else if (prod.ProductId == ProductEnum.D)
                {
                    currentPrice     = prod.ProductQuantity * unitPrice.UnitPriceforD;
                    currentPriceForD = currentPrice;
                }

                newCurrentPrice += currentPrice;
            }
            if (currentPriceForC == unitPrice.UnitPriceforC && currentPriceForD == unitPrice.UnitPriceforD)
            {
                newCurrentPrice  = (newCurrentPrice - (currentPriceForC + currentPriceForD));
                newCurrentPrice += promotion.PromotionforCnD;
            }
            totalPrice += newCurrentPrice;

            return(totalPrice);
        }
Exemplo n.º 3
0
        public async Task <ActionResult <PromotionList> > Get()
        {
            PromotionList promotionList = new PromotionList();

            promotionList.Promotions.Add(new Models.Promotion()
            {
                ItemId = "001", Status = "off"
            });
            promotionList.Promotions.Add(new Models.Promotion()
            {
                ItemId = "002", Status = "on"
            });
            promotionList.Promotions.Add(new Models.Promotion()
            {
                ItemId = "003", Status = "on"
            });

            return(promotionList);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 获取数据
 /// </summary>
 public void GetDate()
 {
     try
     {
         List <SeatManage.ClassModel.AMS_Advertisement> modelList = SeatManage.Bll.AdvertisementOperation.GetAdList(null, SeatManage.EnumType.AdType.PromotionAd);
         PromotionList.Clear();
         foreach (SeatManage.ClassModel.AMS_Advertisement model in modelList)
         {
             SeatManage.ClassModel.PromotionAdvertInfo view = SeatManage.ClassModel.PromotionAdvertInfo.ToModel(model.AdContent);
             view.AdContent = model.AdContent;
             view.ID        = model.ID;
             PromotionList.Add(view);
         }
     }
     catch (Exception ex)
     {
         ErrorMessage = ex.Message;
         SeatManage.SeatManageComm.WriteLog.Write("获取学校通知失败" + ex.Message);
     }
 }