Exemple #1
0
        public static void fnCodigosEsteMaestro(string codigo, List <string> ListaCodigos)
        {
            IList <MyEntityModel.Escandallo> Escandallos;

            MyEntityModel.ApplicationDbContextSql dbContextSQL = new MyEntityModel.ApplicationDbContextSql();

            int ArticuloID = FuncionesEbay.fnArticuloID(codigo);

            if (ArticuloID != 0)
            {
                Escandallos = dbContextSQL.Escandallos.Where(w => w.ArticuloID == ArticuloID).ToList();
                foreach (var escandallo in Escandallos)
                {
                    string c = dbContextSQL.Articulos.Where(w => w.ArticuloID == escandallo.DetalleID).FirstOrDefault().Codigo;
                    ListaCodigos.Add(c.Trim());
                }
            }
        }
Exemple #2
0
        public static List <string> fnListaCodigos(string codigo)
        {
            List <string> ListaCodigos = new List <string>();

            ListaCodigos.Add(codigo.Trim());
            FuncionesEbay.fnCodigosEsteDetalle(codigo, ListaCodigos); // todos los codigos en el que este es detalle
            FuncionesEbay.fnCodigosEsteMaestro(codigo, ListaCodigos);

            List <string> LC = new List <string>();

            LC = ListaCodigos.ToList();
            foreach (string c in LC)
            {
                FuncionesEbay.fnCodigosEsteDetalle(codigo, ListaCodigos);
                FuncionesEbay.fnCodigosEsteMaestro(codigo, ListaCodigos);
            }
            ListaCodigos = ListaCodigos.Distinct().ToList();
            return(ListaCodigos);
        }
Exemple #3
0
        private void GrabarOrderItems(List <OrderItem> orderItems, Order order)
        {
            bool nuevo;
//            return;
            ApplicationDbContextSql dbContext = new ApplicationDbContextSql();
            var transaction = dbContext.Database.BeginTransaction(IsolationLevel.RepeatableRead);

            foreach (OrderItem item in orderItems)
            {
                AmazonOrderLinea amazonOrderLinea = dbContext.amazonorderLineas.Where(w => w.AmazonOrderLineaID == item.OrderItemId).FirstOrDefault();
                if (amazonOrderLinea == null)
                {
                    nuevo            = true;
                    amazonOrderLinea = new AmazonOrderLinea();
                }
                else
                {
                    nuevo = false;
                }
                amazonOrderLinea.OrderItemId        = item.OrderItemId;
                amazonOrderLinea.AmazonOrderID      = order.AmazonOrderId;
                amazonOrderLinea.AmazonOrderLineaID = item.OrderItemId;
                if (item.IsSetASIN())
                {
                    amazonOrderLinea.Asin = item.ASIN;
                }
                amazonOrderLinea.Cuenta = order.SellerOrderId;
                if (item.IsSetItemPrice())
                {
                    amazonOrderLinea.ItemPriceAmount       = FuncionesEbay.fnSpreciodprecio(item.ItemPrice.Amount);
                    amazonOrderLinea.ItemPriceCurrencyCode = item.ItemPrice.CurrencyCode;
                }
                if (item.IsSetQuantityOrdered())
                {
                    amazonOrderLinea.QuantityOrdered = item.QuantityOrdered;
                }
                if (item.IsSetQuantityShipped())
                {
                    amazonOrderLinea.QuantityShipped = item.QuantityShipped;
                }
                if (item.IsSetSellerSKU())
                {
                    amazonOrderLinea.SellerSKU = item.SellerSKU;
                }
                if (item.IsSetShippingPrice())
                {
                    amazonOrderLinea.ShippingPriceAmount       = FuncionesEbay.fnSpreciodprecio(item.ShippingPrice.Amount);
                    amazonOrderLinea.ShippingPriceCurrencyCode = item.ShippingPrice.CurrencyCode;
                }
                if (item.IsSetTitle())
                {
                    amazonOrderLinea.Title = item.Title;
                }

                if (nuevo)
                {
                    dbContext.amazonorderLineas.Add(amazonOrderLinea);
                }
            }
            try
            {
                dbContext.SaveChanges();
                transaction.Commit();
                dbContext.Dispose();
            }
            catch (Exception e)
            {
            }
        }
Exemple #4
0
        private void GrabarOrder(Order order, string cuenta)
        {
            bool nuevo = false;
            //           return;
            ApplicationDbContextSql dbContext = new ApplicationDbContextSql();
            var         transaction           = dbContext.Database.BeginTransaction(IsolationLevel.RepeatableRead);
            AmazonOrder amazonOrder           = dbContext.amazonorders.Where(w => w.AmazonOrderID == order.AmazonOrderId).FirstOrDefault();

            if (amazonOrder == null)
            {
                amazonOrder = new AmazonOrder();
                nuevo       = true;
            }
            amazonOrder.AmazonOrderID = order.AmazonOrderId;
            if (order.IsSetBuyerEmail())
            {
                amazonOrder.BuyerEmail = order.BuyerEmail;
            }
            if (order.IsSetBuyerName())
            {
                amazonOrder.BuyerName = order.BuyerName;
            }
            amazonOrder.Cuenta = cuenta;
            if (order.IsSetEarliestDeliveryDate())
            {
                amazonOrder.EarliestDeliveryDate = order.EarliestDeliveryDate;
            }
            if (order.IsSetEarliestShipDate())
            {
                amazonOrder.EarliestShipDate = order.EarliestShipDate;
            }
            if (order.IsSetFulfillmentChannel())
            {
                amazonOrder.fulfillmentChannel = order.FulfillmentChannel;
            }
            if (order.IsSetIsPremiumOrder())
            {
                amazonOrder.IsPremiumOrder = order.IsPremiumOrder;
            }
            if (order.IsSetIsPrime())
            {
                amazonOrder.IsPrime = order.IsPrime;
            }
            if (order.IsSetLastUpdateDate())
            {
                amazonOrder.lastUpdateDate = order.LastUpdateDate;
            }
            if (order.IsSetLatestDeliveryDate())
            {
                amazonOrder.LatestDeliveryDate = order.LatestDeliveryDate;
            }
            if (order.IsSetLatestShipDate())
            {
                amazonOrder.LatestShipDate = order.LatestShipDate;
            }
            if (order.IsSetMarketplaceId())
            {
                amazonOrder.MarketplaceId = order.MarketplaceId;
            }
            if (order.IsSetNumberOfItemsShipped())
            {
                amazonOrder.NumberOfItemsShipped = order.NumberOfItemsShipped;
            }
            if (order.IsSetNumberOfItemsUnshipped())
            {
                amazonOrder.NumberOfItemsUnshipped = order.NumberOfItemsUnshipped;
            }
            if (order.IsSetOrderChannel())
            {
                amazonOrder.orderChannel = order.OrderChannel;
            }
            if (order.IsSetOrderTotal())
            {
                amazonOrder.OrderTotalAmount       = FuncionesEbay.fnSpreciodprecio(order.OrderTotal.Amount);
                amazonOrder.OrderTotalCurrencyCode = order.OrderTotal.CurrencyCode;
            }
            if (order.IsSetOrderType())
            {
                amazonOrder.OrderType = order.OrderType;
            }
            if (order.IsSetPaymentMethod())
            {
                amazonOrder.PaymentMethod = order.PaymentMethod;
            }
            if (order.IsSetPurchaseDate())
            {
                amazonOrder.purchaseDate = order.PurchaseDate;
            }
            if (order.IsSetOrderChannel())
            {
                amazonOrder.salesChannel = order.SalesChannel;
            }
            if (order.IsSetSellerOrderId())
            {
                amazonOrder.SellerOrderID = order.SellerOrderId;
            }
            if (order.IsSetShipmentServiceLevelCategory())
            {
                amazonOrder.ShipmentServiceLevelCategory = order.ShipmentServiceLevelCategory;
            }
            if (order.IsSetShippedByAmazonTFM())
            {
                amazonOrder.ShippedByAmazonTFM = order.ShippedByAmazonTFM;
            }
            if (order.IsSetShippingAddress())
            {
                amazonOrder.ShippingAddressAddressLine1  = order.ShippingAddress.AddressLine1;
                amazonOrder.ShippingAddressAddressLine2  = order.ShippingAddress.AddressLine2;
                amazonOrder.ShippingAddressAddressLine3  = order.ShippingAddress.AddressLine3;
                amazonOrder.ShippingAddressCity          = order.ShippingAddress.City;
                amazonOrder.ShippingAddressCountryCode   = order.ShippingAddress.CountryCode;
                amazonOrder.ShippingAddressDistrict      = order.ShippingAddress.District;
                amazonOrder.ShippingAddressName          = order.ShippingAddress.Name;
                amazonOrder.ShippingAddressPhone         = order.ShippingAddress.Phone;
                amazonOrder.ShippingAddressPostalCode    = order.ShippingAddress.PostalCode;
                amazonOrder.ShippingAddressStateOrRegion = order.ShippingAddress.StateOrRegion;
            }
            if (order.IsSetShipServiceLevel())
            {
                amazonOrder.shipServiceLevel = order.ShipServiceLevel;
            }

            if (nuevo)
            {
                dbContext.amazonorders.Add(amazonOrder);
            }

            dbContext.SaveChanges();
            transaction.Commit();
            dbContext.Dispose();
        }