Esempio n. 1
0
        private void GetImageUrlList(HttpContext context)
        {
            string listingId = context.Request.QueryString["ListingId"];
            int    result;

            if (int.TryParse(listingId, out result))
            {
                var carImageUrLs = GetImageURLs(result);
                if (!String.IsNullOrEmpty(carImageUrLs.ImageURLs))
                {
                    var list = new List <ServerImage>();

                    var fullImageUrLs      = CommonHelper.GetArrayFromString(carImageUrLs.ImageURLs);
                    var thumbnailImageUrLs = CommonHelper.GetArrayFromString(carImageUrLs.ThumnailURLs);
                    int count          = fullImageUrLs.Length;
                    int countThumbnail = thumbnailImageUrLs.Length;
                    for (int i = 0; i < count; i++)
                    {
                        var image = new ServerImage
                        {
                            FileUrl      = fullImageUrLs[i],
                            ThumbnailUrl = i >= countThumbnail ? String.Empty : thumbnailImageUrLs[i]
                        };
                        list.Add(image);
                    }

                    var js = new JavaScriptSerializer();
                    context.Response.Write(js.Serialize(list));
                }
                else
                {
                    context.Response.Write("0");
                }
            }
        }
Esempio n. 2
0
        private void GetImageUrl(HttpContext context)
        {
            var fileName = context.Request.QueryString["uploadedfile"];
            var dealerId = context.Request.QueryString["DealerId"];
            var vin      = context.Request.QueryString["Vin"];

            var image = new ServerImage
            {
                FileUrl      = string.Format("{0}DealerImages/{1}/{2}/NormalSizeImages/{3}", GetWebAppRoot(), dealerId, vin, fileName),
                ThumbnailUrl = string.Format("{0}DealerImages/{1}/{2}/ThumbnailSizeImages/{3}", GetWebAppRoot(), dealerId, vin, fileName)
            };
            var js = new JavaScriptSerializer();

            context.Response.Write(js.Serialize(image));
        }