예제 #1
0
        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();
        }
예제 #2
0
        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();
        }