Пример #1
0
        public ActionResult EbayProfileCreate(string profileName, string siteid)
        {
            var profile = new ebay_shippingprofile();

            profile.title  = profileName;
            profile.siteid = siteid;

            MASTERdomain.ebay_shippingprofiles.Add(profile);

            repository.Save("EbayProfileCreate");

            return(Json(new { text = profile.title, value = profile.id }.ToJsonOKData()));
        }
Пример #2
0
        public static EbayShippingProfile ToModel(this ebay_shippingprofile row)
        {
            var currency = row.MASTERsubdomain.currency.ToCurrency();

            var result = new EbayShippingProfile()
            {
                domesticRules = row.ebay_shippingrules
                                .Where(x => !x.ebay_shippingservice.isInternational)
                                .ToModel(currency),
                internationalRules = row.ebay_shippingrules
                                     .Where(x => x.ebay_shippingservice.isInternational)
                                     .ToModel(currency)
            };

            return(result);
        }
Пример #3
0
        public override void StartSynchronisation(bool?upload)
        {
            using (var repository = new TradelrRepository())
            {
                // create default shipping profile
                var sd = repository.GetSubDomain(subdomainid);

                if (sd == null)
                {
                    throw new ArgumentException("Cannot find domain for subdomainid " + subdomainid);
                }

                // create network location
                var inventoryLocation = new inventoryLocation
                {
                    name       = LOCATIONNAME_EBAY,
                    subdomain  = subdomainid,
                    lastUpdate = DateTime.UtcNow
                };
                repository.AddInventoryLocation(inventoryLocation, subdomainid);

                // add shipping profile if there's none
                foreach (var site in EbayService.SupportedSites)
                {
                    if (sd.ebay_shippingprofiles.Count(x => x.siteid == site.ToString()) != 0)
                    {
                        continue;
                    }

                    var shippingprofile = new ebay_shippingprofile
                    {
                        title  = "Default",
                        siteid = site.ToString()
                    };

                    sd.ebay_shippingprofiles.Add(shippingprofile);

                    repository.Save("ebay.StartSynchronisation");
                }
            }
        }