Пример #1
0
        private List <string> GetImageURLList(DSZModel dsData)
        {
            var imagesURL = new List <string>();

            if (!string.IsNullOrEmpty(dsData.Image1))
            {
                imagesURL.Add(dsData.Image1);
            }
            if (!string.IsNullOrEmpty(dsData.Image2))
            {
                imagesURL.Add(dsData.Image2);
            }
            if (!string.IsNullOrEmpty(dsData.Image3))
            {
                imagesURL.Add(dsData.Image3);
            }
            if (!string.IsNullOrEmpty(dsData.Image4))
            {
                imagesURL.Add(dsData.Image4);
            }
            if (!string.IsNullOrEmpty(dsData.Image5))
            {
                imagesURL.Add(dsData.Image5);
            }
            if (!string.IsNullOrEmpty(dsData.Image6))
            {
                imagesURL.Add(dsData.Image6);
            }
            if (!string.IsNullOrEmpty(dsData.Image7))
            {
                imagesURL.Add(dsData.Image7);
            }
            if (!string.IsNullOrEmpty(dsData.Image8))
            {
                imagesURL.Add(dsData.Image8);
            }
            if (!string.IsNullOrEmpty(dsData.Image9))
            {
                imagesURL.Add(dsData.Image9);
            }
            if (!string.IsNullOrEmpty(dsData.Image10))
            {
                imagesURL.Add(dsData.Image10);
            }
            if (!string.IsNullOrEmpty(dsData.Image11))
            {
                imagesURL.Add(dsData.Image11);
            }
            if (!string.IsNullOrEmpty(dsData.Image12))
            {
                imagesURL.Add(dsData.Image12);
            }
            if (!string.IsNullOrEmpty(dsData.Image13))
            {
                imagesURL.Add(dsData.Image13);
            }
            if (!string.IsNullOrEmpty(dsData.Image14))
            {
                imagesURL.Add(dsData.Image14);
            }
            if (!string.IsNullOrEmpty(dsData.Image15))
            {
                imagesURL.Add(dsData.Image15);
            }
            return(imagesURL);
        }
Пример #2
0
        private IList <DSZModel> ConvertToDSZModel(IList <DropshipzoneProduct> dszProducts)
        {
            var dsDatas = new List <DSZModel>();

            foreach (var dszProduct in dszProducts)
            {
                var dsData = new DSZModel();
                dsData.SKU          = dszProduct.sku;
                dsData.Category     = dszProduct.Category;
                dsData.Title        = dszProduct.title;
                dsData.InventoryQty = Convert.ToDecimal(dszProduct.stock_qty);
                dsData.Status       = dszProduct.status;
                dsData.Price        = Convert.ToDecimal(dszProduct.price);
                dsData.RrpPrice     = dszProduct.RrpPrice;
                if (dszProduct.zone_rates != null && dszProduct.zone_rates.Count > 0)
                {
                    var zoneRate = dszProduct.zone_rates.FirstOrDefault();
                    dsData.ACT    = zoneRate.act;
                    dsData.NSW_M  = zoneRate.nsw_m;
                    dsData.NSW_R  = zoneRate.nsw_r;
                    dsData.NT_M   = zoneRate.nt_m;
                    dsData.NT_R   = zoneRate.nt_r;
                    dsData.QLD_M  = zoneRate.qld_m;
                    dsData.QLD_R  = zoneRate.qld_r;
                    dsData.REMOTE = zoneRate.remote;
                    dsData.SA_M   = zoneRate.sa_m;
                    dsData.SA_R   = zoneRate.sa_r;
                    dsData.TAS_M  = zoneRate.tas_m;
                    dsData.TAS_R  = zoneRate.tas_r;
                    dsData.VIC_M  = zoneRate.vic_m;
                    dsData.VIC_R  = zoneRate.vic_r;
                    dsData.WA_M   = zoneRate.wa_m;
                    dsData.WA_R   = zoneRate.wa_r;
                }
                dsData.IsBulkyItem  = dszProduct.bulky_item;
                dsData.Discontinued = dszProduct.discontinued;
                dsData.EANCode      = dszProduct.eancode;
                dsData.Brand        = dszProduct.brand;
                //dsData.MPN=dszProduct.mpn
                dsData.Weight      = dszProduct.weight;
                dsData.Length      = dszProduct.length;
                dsData.Width       = dszProduct.width;
                dsData.Height      = dszProduct.height;
                dsData.Description = dszProduct.desc;
                dsData.Color       = dszProduct.colour;
                if (dszProduct.gallery != null && dszProduct.gallery.Count > 0)
                {
                    var imgIndex = 1;
                    foreach (var img in dszProduct.gallery)
                    {
                        switch (imgIndex)
                        {
                        case 1:
                            dsData.Image1 = img;
                            break;

                        case 2:
                            dsData.Image2 = img;
                            break;

                        case 3:
                            dsData.Image3 = img;
                            break;

                        case 4:
                            dsData.Image4 = img;
                            break;

                        case 5:
                            dsData.Image5 = img;
                            break;

                        case 6:
                            dsData.Image6 = img;
                            break;

                        case 7:
                            dsData.Image7 = img;
                            break;

                        case 8:
                            dsData.Image8 = img;
                            break;

                        case 9:
                            dsData.Image9 = img;
                            break;

                        case 10:
                            dsData.Image10 = img;
                            break;

                        case 11:
                            dsData.Image11 = img;
                            break;

                        case 12:
                            dsData.Image12 = img;
                            break;

                        case 13:
                            dsData.Image13 = img;
                            break;

                        case 14:
                            dsData.Image14 = img;
                            break;

                        case 15:
                            dsData.Image15 = img;
                            break;

                        default:
                            break;
                        }

                        imgIndex++;
                    }
                }


                dsDatas.Add(dsData);
            }
            return(dsDatas);
        }