Exemple #1
0
        private async void WorkParseAndAddDBShope()
        {
            List <OfferOrder> offerOrders = sqlCommandTools.GetOfferOrders();

            foreach (OfferOrder offerOrder in offerOrders)
            {
                try
                {
                    if (offerOrder.Store_id == 2062084 && offerOrder.Store_id == 2221046)
                    {
                    }
                    Store store = GetReityngs(offerOrder.Store_id);
                    if (store != null)
                    {
                        if (sqlCommandTools.CheckShope(offerOrder.Store_id))
                        {
                            if (sqlCommandTools.CheckUpdateShope(offerOrder.Store_id))
                            {
                                store.IDShope = offerOrder.Store_id;
                                sqlCommandTools.UpdateStore(store);
                            }
                        }
                        else
                        {
                            store.IDShope = offerOrder.Store_id;
                            sqlCommandTools.AddStore(store);
                        }
                    }
                }
                catch (Exception e)
                {
                    File.AppendAllText("log/WorkParseAndAddDBShope.txt", $"{e.Message}, Order {offerOrder.Id}, Order {offerOrder.Store_id} {Environment.NewLine}");
                }
            }
        }
        private async void WorkUpdatePrice()
        {
            List <OfferOrder> offerOrders = sqlCommandTools.GetOfferOrders();

            for (int i = 0; i < offerOrders.Count; i++)
            {
                try
                {
                    if (sqlCommandTools.CheckPrice(offerOrders[i].Id))
                    {
                        PriceOffer priceOffer = new PriceOffer();
                        priceOffer.DatateUpdate = DateTime.Now.ToString();
                        Offer offer = connectorEPN.GetOffer(offerOrders[i].Id);
                        priceOffer.Price = offer.price;
                        sqlCommandTools.AddPrice(offer.id, priceOffer);
                    }
                }
                catch (Exception e)
                {
                    File.AppendAllText("log/WorkUpdatePrice.txt", $"{e.Message} {Environment.NewLine}");
                }
            }
        }