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

            if (int.TryParse(listingId, out result))
            {
                var    carImageUrLs = SQLHelper.GetImageURLs(result);
                string outputString = null;
                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;

                    for (int i = 0; i < count; i++)
                    {
                        var image = new ServerImage
                        {
                            FileUrl      = fullImageUrLs[i],
                            ThumbnailUrl = thumbnailImageUrLs[i]
                        };
                        list.Add(image);
                    }

                    var js = new JavaScriptSerializer();
                    outputString = js.Serialize(list);
                }

                context.Response.Write(outputString ?? "0");
            }
        }
Exemplo 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));
        }