private void gridViewOrders_Click(object sender, EventArgs e) { ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); string amazonOrderID = (string)gridViewOrders.GetRowCellValue(gridViewOrders.FocusedRowHandle, colAmazonOrderID); gridControlLineas.DataSource = dbContext.amazonorderLineas.Where(w => w.AmazonOrderID == amazonOrderID).ToList(); }
private void GrabarPoliticaPAYMENT(XmlNode elem, string cuenta) { bool PoliticaNueva = false; MyEntityModel.ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); long PoliticaId = Convert.ToInt64(elem["profileId"].InnerText); MyEntityModel.EbayProfiles profile = dbContext.ebayprofiles.Where(w => w.profileId == PoliticaId).FirstOrDefault(); if (profile == null) { PoliticaNueva = true; profile = new EbayProfiles(); } profile.cuenta = cuenta; profile.profileId = PoliticaId; profile.profileType = elem["profileType"].InnerText; profile.profileDesc = elem["profileDesc"].InnerText; profile.siteId = Convert.ToInt16(elem["siteId"].InnerText); profile.paypalEmailAddress = elem["paymentInfo"]["paypalEmailAddress"].InnerText; if (PoliticaNueva) { dbContext.ebayprofiles.Add(profile); } dbContext.SaveChanges(); }
private void pintarCompras() { ApplicationDbContextSql dbcontext = new ApplicationDbContextSql(); int currentRowHandle = gridViewArticulos.FocusedRowHandle; MyEntityModel.Articulo articulo = (MyEntityModel.Articulo)gridViewArticulos.GetRow(currentRowHandle); if (articulo != null) { gridControlCompras.Invoke((MethodInvoker)(() => gridControlCompras.DataSource = dbcontext.Lineas.Where(w => w.ArticuloID == articulo.ArticuloID && w.Tipo.Contains("B")).OrderByDescending(o => o.Fecha).ToList())); // gridControlCompras.DataSource = dbcontext.Lineas.Where(w => w.ArticuloID == articulo.ArticuloID && w.Tipo.Contains("B")).OrderByDescending(o => o.Fecha).ToList(); } else { gridControlCompras.Invoke((MethodInvoker)(() => gridControlCompras.DataSource = null)); // gridControlCompras.DataSource = null; } }
private void pintarEnvios() { ApplicationDbContextSql dbcontext = new ApplicationDbContextSql(); RepuestosDeMovilesDbContext dbcontextRepuestos = new RepuestosDeMovilesDbContext(); int currentRowHandle = gridViewArticulos.FocusedRowHandle; MyEntityModel.Articulo articulo = (MyEntityModel.Articulo)gridViewArticulos.GetRow(currentRowHandle); if (articulo != null) { gridControlEnvios.Invoke((MethodInvoker)(() => gridControlEnvios.DataSource = dbcontextRepuestos.L_ENVIOS.Where(w => w.ARTICULO == articulo.Codigo.Trim()).OrderByDescending(o => o.FECHA).ToList())); // gridControlEnvios.DataSource = dbcontextRepuestos.L_ENVIOS.Where(w => w.ARTICULO == articulo.Codigo.Trim()).OrderByDescending(o => o.FECHA).ToList(); } else { gridControlEnvios.Invoke((MethodInvoker)(() => gridControlEnvios.DataSource = null)); // gridControlEnvios.DataSource = null; } }
private void fnGrabarOrderLinea(TransactionType orderLinea) { bool nuevo = false; ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); EbayOrderLinea ebayOrderLinea; ebayOrderLinea = dbContext.EbayOrderLinea.Where(w => w.ExtendedOrderID == orderLinea.ExtendedOrderID).FirstOrDefault(); if (ebayOrderLinea == null) { ebayOrderLinea = new EbayOrderLinea(); nuevo = true; } Debug.WriteLine(orderLinea.ExtendedOrderID); ebayOrderLinea.ExtendedOrderID = orderLinea.ExtendedOrderID; ebayOrderLinea.BuyerMessage = orderLinea.BuyerMessage; ebayOrderLinea.BuyerCheckoutMessage = orderLinea.BuyerCheckoutMessage; ebayOrderLinea.CreatedDate = orderLinea.CreatedDate; ebayOrderLinea.ItemID = orderLinea.Item.ItemID; ebayOrderLinea.Titulo = orderLinea.Item.Title; ebayOrderLinea.QuantityPurchased = orderLinea.QuantityPurchased; ebayOrderLinea.TransactionPrice = (decimal)orderLinea.TransactionPrice.Value; if (orderLinea.FinalValueFee != null) { ebayOrderLinea.EbayFee = (decimal)orderLinea.FinalValueFee.Value; } if (orderLinea.ShippingDetails.SellingManagerSalesRecordNumberSpecified) { ebayOrderLinea.SellingManagerSalesRecordNumber = orderLinea.ShippingDetails.SellingManagerSalesRecordNumber; } if (orderLinea.Status.PaymentHoldStatusSpecified) { ebayOrderLinea.PaymentHoldStatus = orderLinea.Status.PaymentHoldStatus.ToString(); } if (nuevo) { dbContext.EbayOrderLinea.Add(ebayOrderLinea); } dbContext.SaveChanges(); }
public GetOrdersUserControl() { InitializeComponent(); ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); this.Dock = DockStyle.Fill; this.HandleDestroyed += handleDestroyed; checkedListBoxControlCuentas.Items.Clear(); foreach (string cuenta in credencialesEbay.Cuentas) { checkedListBoxControlCuentas.Items.Add(cuenta, true); } DateTime CreateTimeFromPrev = DateTime.Now.AddDays(-5).ToUniversalTime(); try { CreateTimeFromPrev = (DateTime)dbContext.datos.FirstOrDefault().FechaActualizacionEbay; } catch { } dateEditDesde.DateTime = CreateTimeFromPrev; if (File.Exists("Layouts\\EbayGetOrders\\gridViewOrders.xml")) { gridViewOrders.RestoreLayoutFromXml("Layouts\\EbayGetOrders\\gridViewOrders.xml"); } if (File.Exists("Layouts\\EbayGetOrders\\layout.xml")) { layoutControl1.RestoreLayoutFromXml("Layouts\\EbayGetOrders\\layout.xml"); string filePath = "Layouts\\EbayGetOrders\\layout.xml"; layoutControl1.RestoreLayoutExFromXml(filePath, new List <string> { "checkedListBoxControlCuentas", "gridControlOrders", "gridViewOrders", "simpleButtonLeer" }); } gridControlOrders.DataSource = dbContext.EbayOrder.OrderByDescending(o => o.EbayOrdersID).ToList(); }
private void GrabarPoliticaSHIPPING(XmlNode elem, string cuenta) { bool PoliticaNueva = false; MyEntityModel.ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); long PoliticaId = Convert.ToInt64(elem["profileId"].InnerText); MyEntityModel.EbayProfiles profile = dbContext.ebayprofiles.Where(w => w.profileId == PoliticaId).FirstOrDefault(); if (profile == null) { PoliticaNueva = true; profile = new EbayProfiles(); } profile.cuenta = cuenta; profile.profileId = PoliticaId; profile.profileType = elem["profileType"].InnerText; if (elem["profileDesc"] == null) { profile.profileDesc = ""; } else { profile.profileDesc = elem["profileDesc"].InnerText; } profile.siteId = Convert.ToInt16(elem["siteId"].InnerText); profile.SPI_shippingPolicyName = elem["shippingPolicyInfo"]["shippingPolicyName"].InnerText; profile.SPI_domesticShippingType = elem["shippingPolicyInfo"]["domesticShippingType"].InnerText; profile.SPI_intlShippingType = elem["shippingPolicyInfo"]["intlShippingType"].InnerText; profile.SPI_dispatchTimeMax = Convert.ToInt16(elem["shippingPolicyInfo"]["dispatchTimeMax"].InnerText); profile.SPI_shippingOption = Convert.ToInt16(elem["shippingPolicyInfo"]["shippingOption"].InnerText); profile.SPI_SPDI_domesticFlatCalcDiscountProfileId = Convert.ToInt16(elem["shippingPolicyInfo"]["shippingProfileDiscountInfo"]["domesticFlatCalcDiscountProfileId"].InnerText); profile.SPI_SPDI_intlFlatCalcDiscountProfileId = Convert.ToInt16(elem["shippingPolicyInfo"]["shippingProfileDiscountInfo"]["intlFlatCalcDiscountProfileId"].InnerText); profile.SPI_SPDI_applyDomesticPromoShippingProfile = Convert.ToBoolean(elem["shippingPolicyInfo"]["shippingProfileDiscountInfo"]["applyDomesticPromoShippingProfile"].InnerText); profile.SPI_SPDI_applyIntlPromoShippingProfile = Convert.ToBoolean(elem["shippingPolicyInfo"]["shippingProfileDiscountInfo"]["applyIntlPromoShippingProfile"].InnerText); XmlNode shippingPolicyInfo = elem["shippingPolicyInfo"]; XmlNodeList li = shippingPolicyInfo.SelectNodes(".//domesticShippingPolicyInfoService"); XmlNode domesticShippingPolicyInfoService = shippingPolicyInfo["domesticShippingPolicyInfoService"]; int ContadordomesticShippingType = 0; foreach (XmlNode child in shippingPolicyInfo.ChildNodes) { if (child.Name == "domesticShippingPolicyInfoService") { if (ContadordomesticShippingType == 0) { profile.SPI_DSPIS_shippingService_0 = child["shippingService"].InnerText; profile.SPI_DSPIS_sortOrderId_0 = Convert.ToInt16(child["sortOrderId"].InnerText); profile.SPI_DSPIS_freeShipping_0 = Convert.ToBoolean(child["freeShipping"].InnerText); profile.SPI_DSPIS_fastShipping_0 = Convert.ToBoolean(child["fastShipping"].InnerText); string c = child["shippingServiceAdditionalCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceAdditionalCost_0 = Convert.ToDecimal(c); c = child["shippingServiceCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceCost_0 = Convert.ToDecimal(c); } if (ContadordomesticShippingType == 1) { profile.SPI_DSPIS_shippingService_1 = child["shippingService"].InnerText; profile.SPI_DSPIS_sortOrderId_1 = Convert.ToInt16(child["sortOrderId"].InnerText); profile.SPI_DSPIS_freeShipping_1 = Convert.ToBoolean(child["freeShipping"].InnerText); profile.SPI_DSPIS_fastShipping_1 = Convert.ToBoolean(child["fastShipping"].InnerText); string c = child["shippingServiceAdditionalCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceAdditionalCost_1 = Convert.ToDecimal(c); c = child["shippingServiceCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceCost_1 = Convert.ToDecimal(c); } if (ContadordomesticShippingType == 2) { profile.SPI_DSPIS_shippingService_2 = child["shippingService"].InnerText; profile.SPI_DSPIS_sortOrderId_2 = Convert.ToInt16(child["sortOrderId"].InnerText); profile.SPI_DSPIS_freeShipping_2 = Convert.ToBoolean(child["freeShipping"].InnerText); profile.SPI_DSPIS_fastShipping_2 = Convert.ToBoolean(child["fastShipping"].InnerText); string c = child["shippingServiceAdditionalCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceAdditionalCost_2 = Convert.ToDecimal(c); c = child["shippingServiceCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceCost_2 = Convert.ToDecimal(c); } if (ContadordomesticShippingType == 3) { profile.SPI_DSPIS_shippingService_3 = child["shippingService"].InnerText; profile.SPI_DSPIS_sortOrderId_3 = Convert.ToInt16(child["sortOrderId"].InnerText); profile.SPI_DSPIS_freeShipping_3 = Convert.ToBoolean(child["freeShipping"].InnerText); profile.SPI_DSPIS_fastShipping_3 = Convert.ToBoolean(child["fastShipping"].InnerText); string c = child["shippingServiceAdditionalCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceAdditionalCost_3 = Convert.ToDecimal(c); c = child["shippingServiceCost"].InnerText.Replace(',', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); c = c.Replace('.', Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)); profile.SPI_DSPIS_shippingServiceCost_3 = Convert.ToDecimal(c); } ContadordomesticShippingType++; } } if (PoliticaNueva) { dbContext.ebayprofiles.Add(profile); } dbContext.SaveChanges(); }
private void simpleButtonActualizar_Click(object sender, EventArgs e) { ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); gridControlOrders.DataSource = dbContext.amazonorders.OrderByDescending(o => o.purchaseDate).ToList(); }
private void fnGrabarOrder(OrderType order) { bool nuevo = false; ApplicationDbContextSql dbContext = new ApplicationDbContextSql(); EbayOrder ebayOrder; ebayOrder = dbContext.EbayOrder.Where(w => w.OrderID == order.OrderID).FirstOrDefault(); if (ebayOrder == null) { ebayOrder = new EbayOrder(); nuevo = true; } Debug.WriteLine(order.BuyerUserID); ebayOrder.AmountPaid = (decimal)order.AmountPaid.Value; ebayOrder.AmountSaved = (decimal)order.AmountSaved.Value; ebayOrder.BuyerCheckoutMessage = order.BuyerCheckoutMessage; ebayOrder.BuyerUserID = order.BuyerUserID; if (order.CancelStatusSpecified) { ebayOrder.CancelStatus = order.CancelStatus.ToString(); } ebayOrder.checkoutStatus = new CheckoutStatus(); if (order.CheckoutStatus.LastModifiedTimeSpecified) { ebayOrder.checkoutStatus.LastModifiedTime = order.CheckoutStatus.LastModifiedTime; } if (order.CheckoutStatus.PaymentMethodSpecified) { ebayOrder.checkoutStatus.PaymentMethod = order.CheckoutStatus.PaymentMethod.ToString(); } if (order.CheckoutStatus.StatusSpecified) { ebayOrder.checkoutStatus.Status = order.CheckoutStatus.Status.ToString(); } if (order.CreatedTimeSpecified) { ebayOrder.CreatedTime = order.CreatedTime; } ebayOrder.OrderID = order.OrderID; if (order.OrderStatusSpecified) { ebayOrder.OrderStatus = order.OrderStatus.ToString(); } if (order.PaidTimeSpecified) { ebayOrder.PaidTime = order.PaidTime; } if (order.PaymentHoldStatusSpecified) { ebayOrder.PaymentHoldStatus = order.PaymentHoldStatus.ToString(); } ebayOrder.SellerUserID = order.SellerUserID; if (order.ShippedTimeSpecified) { ebayOrder.ShippedTime = order.ShippedTime; } ebayOrder.shippingAddress = new ShippingAddress(); ebayOrder.shippingAddress.AddressID = order.ShippingAddress.AddressID; ebayOrder.shippingAddress.CityName = order.ShippingAddress.CityName; ebayOrder.shippingAddress.CompanyName = order.ShippingAddress.CompanyName; ebayOrder.shippingAddress.Country = order.ShippingAddress.Country.ToString(); ebayOrder.shippingAddress.CountryName = order.ShippingAddress.CountryName; ebayOrder.shippingAddress.FirstName = order.ShippingAddress.FirstName; ebayOrder.shippingAddress.LastName = order.ShippingAddress.LastName; ebayOrder.shippingAddress.Name = order.ShippingAddress.Name; ebayOrder.shippingAddress.Phone = order.ShippingAddress.Phone; ebayOrder.shippingAddress.Phone2 = order.ShippingAddress.Phone2; ebayOrder.shippingAddress.PostalCode = order.ShippingAddress.PostalCode; ebayOrder.shippingAddress.StateOrProvince = order.ShippingAddress.StateOrProvince; ebayOrder.shippingAddress.Street = order.ShippingAddress.Street; ebayOrder.shippingAddress.Street1 = order.ShippingAddress.Street1; ebayOrder.shippingAddress.Street2 = order.ShippingAddress.Street2; ebayOrder.shippingDetails = new ShippingDetails(); ebayOrder.shippingDetails.SellingManagerSalesRecordNumber = order.ShippingDetails.SellingManagerSalesRecordNumber; ebayOrder.shippingServiceSelected = new ShippingServiceSelected(); if (order.ShippingServiceSelected.ExpeditedServiceSpecified) { ebayOrder.shippingServiceSelected.ExpeditedService = order.ShippingServiceSelected.ExpeditedService; } if (order.ShippingServiceSelected.FreeShippingSpecified) { ebayOrder.shippingServiceSelected.FreeShipping = order.ShippingServiceSelected.FreeShipping; } ebayOrder.shippingServiceSelected.ShippingService = order.ShippingServiceSelected.ShippingService; if (order.ShippingServiceSelected.ShippingServiceAdditionalCost != null) { ebayOrder.shippingServiceSelected.ShippingServiceAdditionalCost = (decimal)order.ShippingServiceSelected.ShippingServiceAdditionalCost.Value; } if (order.ShippingServiceSelected.ShippingServiceCost != null) { ebayOrder.shippingServiceSelected.ShippingServiceCost = (decimal)order.ShippingServiceSelected.ShippingServiceCost.Value; } ebayOrder.Subtotal = (decimal)order.Subtotal.Value; ebayOrder.Total = (decimal)order.Total.Value; // ebayOrder.externalTransaction.ExternalTransactionID = order.ExternalTransaction[0].ExternalTransactionID; ebayOrder.externalTransaction = new ExternalTransaction(); if (order.ExternalTransaction.Count > 0) { ebayOrder.externalTransaction.ExternalTransactionStatus = order.ExternalTransaction[0].ExternalTransactionStatus.ToString(); ebayOrder.externalTransaction.ExternalTransactionTime = order.ExternalTransaction[0].ExternalTransactionTime; ebayOrder.externalTransaction.FeeOrCreditAmount = (decimal)order.ExternalTransaction[0].FeeOrCreditAmount.Value; ebayOrder.externalTransaction.PaymentOrRefundAmount = (decimal)order.ExternalTransaction[0].PaymentOrRefundAmount.Value; } if (nuevo) { dbContext.EbayOrder.Add(ebayOrder); } dbContext.SaveChanges(); // { "No se puede convertir un objeto de tipo 'eBay.Service.Core.Soap.TransactionType' al tipo 'MyEntityModel.EbayOrderLinea'."} foreach (TransactionType ebayOrderLinea in order.TransactionArray) { fnGrabarOrderLinea(ebayOrderLinea); } }