• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Basket类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Basket的典型用法代码示例。如果您正苦于以下问题:C# Basket类的具体用法?C# Basket怎么用?C# Basket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Basket类属于命名空间,在下文中一共展示了Basket类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: rpNews_ItemCommand

    protected void rpNews_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        Basket objBasket = new Basket();
        switch (strCommand)
        {
            case "Delete":
                int nDelete = objBasket.DeleteById(nID);
                BindDataToGrid(1);
                break;

            case "Edit":

                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_ORDER_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;
            case "Active":
                int nActive = objBasket.UpdateStatus(nID, EnumeType.INACTIVE);

                BindDataToGrid(1);
                break;

            case "Inactive":
                int nInactive = objBasket.UpdateStatus(nID, EnumeType.ACTIVE);

                BindDataToGrid(1);
                break;
        }
    }
开发者ID:changtraicantinh,项目名称:atpgroup,代码行数:30,代码来源:OrderMain.ascx.cs


示例2: CalculatePostageFor

        public PostageResult CalculatePostageFor(Basket basket)
        {
            if (basket == null)
            {
                throw new ArgumentNullException("basket");
            }

            var postages = postageRepository.GetAll();

            var postZone = basket.Country.PostZone;

            var totalWeight = (int)basket.BasketItems
                .Sum(bi => bi.TotalWeight);

            var postageToApply = postages
                .Where(p => totalWeight <= p.MaxWeight && p.IsActive)
                .OrderBy(p => p.MaxWeight)
                .FirstOrDefault();

            var postageDescription = string.Format("for {0}", basket.Country.Name);

            if (postageToApply == null) return PostageResult.WithDefault(postZone, postageDescription);

            var multiplier = postZone.Multiplier;
            var total = new Money(Math.Round(postageToApply.Price.Amount * multiplier, 2, MidpointRounding.AwayFromZero));

            return PostageResult.WithPrice(total, postageDescription);
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:28,代码来源:PostageService.cs


示例3: SetUp

        public void SetUp()
        {
            var size = new Size
            {
                Name = "Medium",
                IsActive = true,
                IsInStock = true
            };

            var product = new Product
            {
                Name = "Widget",
                Description = "Our best Widget",
                
            };

            using (DomainEvent.TurnOff())
            {
                product.AddSize(size);
            }

            InSession(session => session.Save(product));

            sizeId = size.Id;

            var basket = new Basket();

            InSession(session => session.Save(basket));

            basketId = basket.Id;
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:31,代码来源:BasketMapTests.cs


示例4: PopulateOrderForView

		static void PopulateOrderForView(Order order, Basket basket)
		{
			if (order.Basket == null) order.Basket = basket;
			if (order.Contact == null) order.Contact = new Contact();
			if (order.Contact1 == null) order.Contact1 = new Contact();
			if (order.Card == null) order.Card = new Card();
		}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:7,代码来源:CheckoutController.cs


示例5: Can_Serialize_Class_with_Typed_Dictionary

        public void Can_Serialize_Class_with_Typed_Dictionary()
        {
            var basket = new Basket();
            basket.Items.Add(new Item { type = 1, color = 2 }, 10);
            basket.Items.Add(new Item { type = 4, color = 1 }, 20);

            Serialize(basket);
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:8,代码来源:ReportedIssues.cs


示例6: SetUpTest

        public void SetUpTest()
        {
            _basket = new Basket();
            _basket.Items.Add(new BasketItem { Id = 2 });
            _basket.State = BasketState.Archived;

            Console.WriteLine();
        }
开发者ID:eskitek,项目名称:BasketStateMachine,代码行数:8,代码来源:BasketTests_Archived.cs


示例7: Setup

 public void Setup()
 {
     _basket = new Basket(new BasketService(
         new ProductRepository(),
         new DiscountOfferCalculatorService(new DiscountOfferRepository()),
         new BulkBuytOfferCalculatorService(new BulkBuyOfferRepository()),
         new NonOfferCalculatorService()));
 }
开发者ID:SachinKainth,项目名称:Basket,代码行数:8,代码来源:BasketTests.cs


示例8: SetUpTest

        public void SetUpTest()
        {
            _basket = new Basket();
            _basket.Items.Add(new BasketItem { Id = 2 });
            _basket.State = BasketState.ContainsStuff;

            Console.WriteLine();
        }
开发者ID:eskitek,项目名称:BasketStateMachine,代码行数:8,代码来源:BasketTests_ContainsStuff.cs


示例9: RemoveUnlisted

 /// <summary>
 /// remove unlisted symbols, leaving only verified symbols remaining.
 /// tradelink has a list of verified nasdaq and nyse symbols, but it is not guaranteed to be all inclusive.
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public static Basket RemoveUnlisted(Basket input)
 {
     Basket output = new BasketImpl();
     for (int i =0; i<input.Count; i++)
         if (NYSE.isListed(input[i].symbol) || NASDAQ.isListed(input[i].symbol))
             output.Add(input[i]);
     return output;
 }
开发者ID:bluejack2000,项目名称:core,代码行数:14,代码来源:Fetch.cs


示例10: lbtSusscess_Click

    protected void lbtSusscess_Click(object sender, EventArgs e)
    {
        Basket objBasket = new Basket();
        objBasket.Data.BasketName = "Đơn hàng ngày " + DateTime.Now.ToString("hh:mm:ss tt mm/dd/yyyy ");
        objBasket.Data.CustomerName = txtFullName.Text;
        if (fileYC.Value != "")
        {
            objBasket.Data.BasketContent = Support.UploadFile(fileYC, "fileyc");
        }
        else
        {
            objBasket.Data.BasketContent = "";
        }

        objBasket.Data.CustomerAddress = txtAddress.Text;
        objBasket.Data.CustomerTel = txtPhone.Text;
        objBasket.Data.CustomerEmail = txtEmail.Text;
        objBasket.Data.Status = 0;
        objBasket.Data.DateCreated = ConvertData.ConvertToString(ConvertData.ConvertDatetimeToInt(DateTime.Today));

        int nResult = objBasket.Insert();

        //insert item to table basket details

        string nID = Request.QueryString["id"];

        int nCount = nID.Split('-').Length - 1;
        ArrayList alProducts = new ArrayList(nID.Split('-'));

        BasketDetail objBasketDetail = new BasketDetail();

        string strInsert;
        if (nResult > 0)
        {
            for (int i = 0; i < nCount; i++)
            {
                objBasketDetail.Data.ProductID2 = ConvertData.ConvertToInt(alProducts[i]);
                objBasketDetail.Data.BasketID = nResult;
                objBasketDetail.Data.Quantity = 1;
                objBasketDetail.Insert();
            }

            if (Request.Cookies["simpleCart"] != null)
            {
                HttpCookie myCookie = new HttpCookie("simpleCart");
                myCookie.Expires = DateTime.Now.AddDays(-1d);
                Response.Cookies.Add(myCookie);
            }

            Response.Redirect("Default.aspx?mess=2");

        }
        else
        {
            strInsert = "Đơn đặt hàng bị lỗi ! bạn vui lòng pm Y!M hỗ trợ để chúng tôi giúp bạn. Thân ái";
            MessageBoxss.Show(strInsert);
        }
    }
开发者ID:changtraicantinh,项目名称:atpgroup,代码行数:58,代码来源:Order.ascx.cs


示例11: ShouldAddItemsToTheBasket

        public void ShouldAddItemsToTheBasket()
        {
            var basket = new Basket();
            var item2 = new Item { NoOfProducts = 2, PriceOfProduct = "3", ProductName = "Milk", ItemCreatedDate = new DateTime(2013, 09, 18), ItemExpiryDate = new DateTime(2013, 09, 21) };

            int count = basket.AddItemsToTheBasket(item2).Count;

            Assert.That(count, Is.EqualTo(1));
        }
开发者ID:rekhabothiraj,项目名称:ShoppingCart,代码行数:9,代码来源:BasketTests.cs


示例12: Remove

 /// <summary>
 /// removes all elements of baskets that match.
 /// unmatching elements are ignored
 /// </summary>
 /// <param name="mb"></param>
 public void Remove(Basket mb)
 {
     List<int> remove = new List<int>();
     for (int i = 0; i < symbols.Count; i++)
         for (int j = 0; j < mb.Count; j++)
             if (symbols[i].Symbol == mb[j].Symbol)
                 remove.Add(i);
     for (int i = remove.Count - 1; i >= 0; i--)
         symbols.RemoveAt(remove[i]);
 }
开发者ID:antonywu,项目名称:tradelink,代码行数:15,代码来源:BasketImpl.cs


示例13: Basket

 static Basket()
 {
     if (HttpContext.Current.Session["ShoppingCart"] == null) {
         Instance = new Basket();
         Instance.Items = new List<BasketItem>();
         HttpContext.Current.Session["ShoppingCart"] = Instance;
     } else {
         Instance = (Basket)HttpContext.Current.Session["ShoppingCart"];
     }
 }
开发者ID:Chengxuan,项目名称:ClothStore,代码行数:10,代码来源:Basket.cs


示例14: AddItem

        public void AddItem([FromBody] OnlineStore.Contracts.Basket addItem)
        {
            var basketId = dbContext.Baskets.FirstOrDefault(k => k.BasketName == addItem.BasketName);
            if (basketId != null)
            {
                var bskId = dbContext.Items.Where(i => i.BasketId == basketId.BasketId).ToList();
                var getItem = addItem.BasketItems.First();
                var item = dbContext.Items.FirstOrDefault(k => k.BasketId == basketId.BasketId &&
                    k.ProductId == getItem.ProductId);
                if (item == null)
                {
                    item = new Item
                    {
                        ProductId = getItem.ProductId,
                        BasketId = basketId.BasketId,
                        Price = getItem.Price,
                        Quantity = getItem.Quantity
                    };

                    dbContext.Items.AddObject(item);
                }
                else
                {
                    item.Quantity++;
                }

                dbContext.SaveChanges();
                dbContext.AcceptAllChanges();

            }
            else
            {
                basketId = new Basket
                {
                    BasketName = addItem.BasketName,
                    CustomerId = addItem.CustomerId,
                    CreatedDateTime = DateTime.Now,
                    IsCheckedOut = false
                };
                dbContext.Baskets.AddObject(basketId);
                dbContext.SaveChanges();

                var itemToAdd = addItem.BasketItems.First();
                var item = dbContext.Products.First(p => p.ProductId == itemToAdd.ProductId);

                dbContext.Items.AddObject(new Item
                {
                    BasketId = basketId.BasketId,
                    ProductId = item.ProductId,
                    Price = item.Price,
                    Quantity = 1
                });
                dbContext.SaveChanges();
            }
        }
开发者ID:umzie,项目名称:OnlineStore,代码行数:55,代码来源:MyCartController.cs


示例15: Main

        public static void Main(string[] args)
        {
            Basket<int> basket = new Basket<int>(5);

            Producer producer = new ProducerImpl(basket);
            Consumer consumer = new ConsumerImpl(basket);
            producer.produce();
            consumer.consume();

            Console.ReadLine();
        }
开发者ID:Cody1988,项目名称:ProducerAndConsumer,代码行数:11,代码来源:Program.cs


示例16: AddBasket

        public void AddBasket(int lastID, DateTime? date)
        {
            //TODO: modify AddProduct method and ModifyProduct make one method remove code duplication
            Basket tmpProduct = new Basket()
            {
                ID = (lastID++),
                CreationDate = date
            };

            _basketDataProvider.Add(tmpProduct);
        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:11,代码来源:OrderBasketController.cs


示例17: Subtract

 /// <summary>
 /// gets symbols removed from newbasket, given original basket
 /// </summary>
 /// <param name="old"></param>
 /// <param name="newb"></param>
 /// <returns></returns>
 public static Basket Subtract(Basket old, Basket newb)
 {
     if (old.Count == 0) return new BasketImpl();
     Basket rem = new BasketImpl();
     foreach (Security sec in old)
     {
         if (!newb.ToString().Contains(sec.Symbol))
             rem.Add(sec);
     }
     return rem;
 }
开发者ID:wang-shun,项目名称:tradelink,代码行数:17,代码来源:BasketImpl.cs


示例18: CalculateBasket

        public double CalculateBasket(int[] books)
        {
            Basket basket = new Basket();

            foreach (int bookCode in books)
            {
                basket.AddBookToCheapestPack(bookCode);
            }

            return basket.GetTotalPrice();
        }
开发者ID:vfportero,项目名称:Noviembre-KataPotter,代码行数:11,代码来源:BookPriceCalculator.cs


示例19: CreateBasket

 public CreateBasketResponse CreateBasket(CreateBasketRequest request)
 {
     CreateBasketResponse response = new CreateBasketResponse();
     Basket basket = new Basket();
     basket.SetDeliveryOption(GetCheapestDeliveryOption());
     AddProductsToBasket(request.ProductsToAdd, basket);
     ThrowExceptionIfBasketIsInvalid(basket);
     _basketRepository.Save(basket);
     _uow.Commit();
     response.Basket = basket.ConvertToBasketView();
     return response;
 }
开发者ID:robertnadar,项目名称:AspNetDesign,代码行数:12,代码来源:BasketService.cs


示例20: AddItem

        public void AddItem(Basket addItem)
        {
            HttpClient client = new HttpClient();
            MediaTypeFormatter formatter = new JsonMediaTypeFormatter();
            HttpContent content = new ObjectContent<Basket>(addItem, formatter);
            var response = client.PostAsync(string.Format("http://localhost:38696/api/MyCart"), content).Result;

            if (response.IsSuccessStatusCode)
            {

            }
        }
开发者ID:umzie,项目名称:OnlineStore,代码行数:12,代码来源:BasketManager.cs



注:本文中的Basket类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BatchAccountContext类代码示例发布时间:2022-05-24
下一篇:
C# BasicRequest类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap