示例#1
0
 private async Task SetOffers(List <Offer> offers)
 {
     foreach (Offer offer in offers)
     {
         OfferOrder offerOrder = null;
         PriceOffer priceOffer = null;
         try
         {
             if (!sqlCommandTools.CheckOffer(offer.id))
             {
                 offerOrder = new OfferOrder();
                 priceOffer = new PriceOffer();
                 priceOffer.DatateUpdate = DateTime.Now.ToString();
                 priceOffer.Price        = offer.price;
                 offerOrder.Id           = offer.id;
                 offerOrder.Description  = offer.description;
                 offerOrder.Id_category  = offer.id_category;
                 offerOrder.Name         = offer.name;
                 offerOrder.Store_id     = offer.store_id;
                 offerOrder.PriceOffers  = new List <PriceOffer>();
                 offerOrder.PriceOffers.Add(priceOffer);
                 sqlCommandTools.AddOffer(offerOrder);
             }
         }
         catch (Exception e)
         {
             File.AppendAllText("log/SetOffers.txt", $"{e.Message} {Environment.NewLine}");
         }
     }
 }
示例#2
0
        private async Task <OfferOrder> GetOfferOrder(string idShiping)
        {
            OfferOrder offerOrder1 = null;

            if (sqlCommandTools.CheckOffer(idShiping))
            {
                offerOrder1 = sqlCommandTools.GetOfferOrder(idShiping);
            }
            else
            {
                OfferOrder offerOrder = new OfferOrder();
                PriceOffer priceOffer = new PriceOffer();
                priceOffer.DatateUpdate = DateTime.Now.ToString();
                offerOrder.Id           = idShiping;
                offerOrder.Store_id     = 0;
                offerOrder.Name         = "New";
                offerOrder.PriceOffers  = new List <PriceOffer>();
                offerOrder.PriceOffers.Add(priceOffer);
                sqlCommandTools.AddOffer(offerOrder);
            }
            return(offerOrder1);
        }