private HotelImageGallery MakeImageGallery(HotelDescriptiveInfo objHotelDescriptiveInfo)
    {
        string[] objImageTitles = this.GetImageGalleryImageTitles(objHotelDescriptiveInfo);

        List<HotelImageGalleryItem> lHotelImageGalleryItems = new List<HotelImageGalleryItem>();

        for (int i = 0; i < objImageTitles.Length; i++)
        {
            HotelImageGalleryItem objHotelImageGalleryItem = new HotelImageGalleryItem();

            objHotelImageGalleryItem.ThumbnailImage = this.GetImageGalleryThumbnailImage(objImageTitles[i], objHotelDescriptiveInfo);
            objHotelImageGalleryItem.FullSizeImage = this.GetImageGalleryFullSizeImage(objImageTitles[i], objHotelDescriptiveInfo);

            if (objHotelImageGalleryItem.ThumbnailImage != null && objHotelImageGalleryItem.FullSizeImage != null)
            {
                lHotelImageGalleryItems.Add(objHotelImageGalleryItem);
            }

        }

        HotelImageGallery objHotelImageGallery = new HotelImageGallery();

        objHotelImageGallery.HotelCode = objHotelDescriptiveInfo.HotelCode;
        objHotelImageGallery.HotelName = objHotelDescriptiveInfo.HotelName;
        objHotelImageGallery.CurrentImageNumber = 0;
        objHotelImageGallery.CurrentHomeThumbNumber = 0;
        objHotelImageGallery.Images = lHotelImageGalleryItems.ToArray();

        return objHotelImageGallery;
    }
    private void PutImageGallery(HotelImageGallery objHotelImageGallery)
    {
        List<HotelImageGallery> lHotelImageGalleries = (List<HotelImageGallery>)Session["ImageGalleries"];

        bool bLocated = false;

        for (int i = 0; i < lHotelImageGalleries.Count; i++)
        {
            if (lHotelImageGalleries[i].HotelCode == objHotelImageGallery.HotelCode)
            {
                lHotelImageGalleries[i] = objHotelImageGallery;

                bLocated = true;
                break;
            }

        }

        if (!bLocated)
        {
            lHotelImageGalleries.Add(objHotelImageGallery);
        }

        Session["ImageGalleries"] = lHotelImageGalleries;

        return;
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);

        string strHotelCode = "";

        if (!IsPostBack)
        {
            if (Request.QueryString.Get("hotel") != null && Request.QueryString.Get("hotel") != "")
            {
                strHotelCode = Request.QueryString.Get("hotel");
            }

            hfHotelCode.Value = strHotelCode;
        }

        else
        {
            strHotelCode = hfHotelCode.Value;
        }

        objHotelImageGallery = null;

        if (strHotelCode != "")
        {
            objHotelImageGallery = this.GetImageGallery(strHotelCode);

            if (objHotelImageGallery == null)
            {
                HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"];
                HotelDescriptiveInfoRS objSearchHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["SearchHotelDescriptiveInfoRS"];
                HotelDescriptiveInfoRS objAlternateHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["AlternateHotelDescriptiveInfoRS"];

                HotelDescriptiveInfo objHotelDescriptiveInfo = this.LocateHotelDescriptiveInfo(strHotelCode, objHotelDescriptiveInfoRS);

                if (objHotelDescriptiveInfo == null)
                    objHotelDescriptiveInfo = this.LocateHotelDescriptiveInfo(strHotelCode, objSearchHotelDescriptiveInfoRS);

                if (objHotelDescriptiveInfo == null)
                    objHotelDescriptiveInfo = this.LocateHotelDescriptiveInfo(strHotelCode, objAlternateHotelDescriptiveInfoRS);

                if (objHotelDescriptiveInfo != null)
                {
                    objHotelImageGallery = this.MakeImageGallery(objHotelDescriptiveInfo);
                    this.PutImageGallery(objHotelImageGallery);
                }

            }

        }

        return;
    }