Exemplo n.º 1
0
 private EbayExporter(string hostname) : base(hostname)
 {
     this.hostname          = hostname;
     ebayProduct            = new ebay_product();
     shipping_domestic      = new ShippingServiceOptionsTypeCollection();
     shipping_international = new InternationalShippingServiceOptionsTypeCollection();
 }
Exemplo n.º 2
0
        public ActionResult ProductSettings(long?id)
        {
            int?         categoryid  = null;
            ebay_product ebayproduct = null;

            if (id.HasValue)
            {
                var p = repository.GetProduct(id.Value, subdomainid.Value);
                if (p != null && p.ebayID.HasValue)
                {
                    ebayproduct = p.ebay_product;
                    categoryid  = p.ebay_product.categoryid;

                    // expires entry
                    if (p.ebay_product.isActive && p.ebay_product.endTime < DateTime.UtcNow)
                    {
                        p.ebay_product.isActive = false;
                        repository.Save("ProductSettings");
                    }
                }
            }

            var viewmodel = new EbayProductViewModel(ebayproduct, MASTERdomain, db);

            viewmodel.PopulateCategories(categoryid);

            return(View(viewmodel));
        }
Exemplo n.º 3
0
 public void BuildItem(ebay_product ep)
 {
     BuildItem(ep.products.First(),
               ep.categoryid,
               ep.quantity,
               ep.condition,
               ep.returnPolicy.ToEnum <ReturnsAccepted>(),
               ep.duration,
               ep.refundPolicy,
               ep.returnWithin,
               ep.includeAddress,
               ep.profileid.Value,
               ep.dispatchTime,
               ep.autorelist,
               Listing.GetTradelrSupportedType(ep.listingType.ToEnum <ListingTypeCodeType>()),
               ep.startPrice,
               ep.buynowPrice,
               ep.reservePrice);
 }
Exemplo n.º 4
0
 private static string ToJqgridModel(this ebay_product value)
 {
     return(string.Format("<tr><td colspan='5'><strong>{0}</strong> <a href='{1}' target='_blank'>view</a></td></tr>", value.isActive?"Active":"Ended", value.ToExternalLink()));
 }
Exemplo n.º 5
0
        public EbayProductViewModel(ebay_product _ebayproduct, MASTERsubdomain sd, tradelrDataContext db)
        {
            categories     = new List <IEnumerable <SelectListItem> >();
            sitecategories = db.ebay_categories.Where(x => x.siteid == siteid.ToString());
            currency       = sd.currency.ToCurrency();

            if (_ebayproduct == null)
            {
                // new product
                this.ebayproduct = new ebay_product();
                siteid           = SiteCodeType.US;
                includeAddress   = true;
                quantity         = 1;
                conditions       = Enumerable.Empty <SelectListItem>();
                durations        = Enumerable.Empty <SelectListItem>();
                TypeList         = typeof(ListingType).ToSelectList(true, null, null, ListingType.FixedPriceItem.ToString());
            }
            else
            {
                // existing product
                ebayproduct    = _ebayproduct;
                siteid         = ebayproduct.siteid.ToEnum <SiteCodeType>();
                includeAddress = ebayproduct.includeAddress;
                isPosted       = true;
                isActive       = ebayproduct.isActive;
                quantity       = ebayproduct.quantity;

                var leafcategory = sitecategories.Single(x => x.categoryid == ebayproduct.categoryid);

                durations = leafcategory.ebay_listingdurations.Where(x => x.listingtypeid == ebayproduct.listingType)
                            .Select(x => new SelectListItem()
                {
                    Text = DurationNames.ContainsKey(x.duration)
                                                 ? DurationNames[x.duration]
                                                 : x.duration,
                    Value    = x.duration,
                    Selected = x.duration == ebayproduct.duration
                });
                conditions = leafcategory.ebay_conditions.Select(x => new SelectListItem()
                {
                    Text     = x.name,
                    Value    = x.value.ToString(),
                    Selected =
                        x.value == ebayproduct.condition
                });

                ListingID = ebayproduct.ebayid;

                // intervals
                if (ebayproduct.startTime.HasValue)
                {
                    StartDate = ebayproduct.startTime.Value.ToString(GeneralConstants.DATEFORMAT_INVOICE);
                }

                if (ebayproduct.endTime.HasValue)
                {
                    EndDate = ebayproduct.endTime.Value.ToString(GeneralConstants.DATEFORMAT_INVOICE);
                }

                // prices
                if (ebayproduct.startPrice.HasValue)
                {
                    StartPrice = ebayproduct.startPrice.Value.ToString("n" + currency.decimalCount);
                }
                if (ebayproduct.buynowPrice.HasValue)
                {
                    BuynowPrice = ebayproduct.buynowPrice.Value.ToString("n" + currency.decimalCount);
                }
                if (ebayproduct.reservePrice.HasValue)
                {
                    ReservePrice = ebayproduct.reservePrice.Value.ToString("n" + currency.decimalCount);
                }

                ViewLocation = ebayproduct.ToExternalLink();
                ListingFees  = ebayproduct.listingFees;

                TypeList = typeof(ListingType)
                           .ToSelectList(true, null, null,
                                         Listing.GetTradelrSupportedType(ebayproduct.listingType.ToEnum <ListingTypeCodeType>()).ToString());
            }

            dispatchTimes = db.ebay_dispatchtimes
                            .Where(x => x.siteid == siteid.ToString())
                            .OrderBy(x => x.dispatchTime)
                            .Select(x => new SelectListItem()
            {
                Text     = x.name,
                Value    = x.dispatchTime.ToString(),
                Selected = x.dispatchTime == ebayproduct.dispatchTime
            });

            shippingProfiles = sd.ebay_shippingprofiles
                               .Where(x => x.siteid == siteid.ToString())
                               .Select(x => new SelectListItem()
            {
                Text     = x.title,
                Value    = x.id.ToString(),
                Selected = x.id == ebayproduct.profileid
            });
        }