Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         clsSQLServerMediaConnection getData = new clsSQLServerMediaConnection();
         List <Media> mediaList = getData.getPresentationMediaListByLetter(MediaType.MediaTypes.MOVIES, "A");
         int          counter   = 0;
         foreach (Media media in mediaList)
         {
             counter++;
             //media.ImageURL = "~/ImageHandlerRequest.ashx?op=GetPicRan&type=1" + "&randomKey=" + DateTime.Now.Ticks.ToString() + counter;
             media.ImageURL = "~/ImageHandlerRequest.ashx?op=GetPicByName&type=1&name=" + Server.UrlEncode(media.Name);
         }
         lbl_ContentTitle.Text    = "Showing " + mediaSelection.SelectedValue + " - " + mediaList.Count + " results were found!";
         imageDataList.DataSource = mediaList;
         imageDataList.DataBind();
     }
 }
Exemple #2
0
        protected void searchLoadData()
        {
            string media           = mediaSelection.SelectedValue;
            string displayViewMode = displayMode.SelectedValue;
            string letter          = ddlLetter.SelectedValue;
            string searchText      = txt_SearchValue.Text;

            clsSQLServerMediaConnection getData = new clsSQLServerMediaConnection();

            MediaType.MediaTypes typeSelected = getMediaTypeValueSelected(media);
            int typeValueSelected             = getMediaNumericValueSelected(media);

            List <Media> mediaList = new List <Media>();

            if (searchText == String.Empty)
            {
                // search by letter
                mediaList = getData.getPresentationMediaListByLetter(typeSelected, letter);
            }
            else
            {
                // search by value
                mediaList = getData.getPresentationMediaListByValue(typeSelected, searchText);
            }

            lbl_ContentTitle.Text = "Showing " + mediaSelection.SelectedValue + " - " + mediaList.Count + " results were found!";

            if (displayViewMode == "Image Grid")
            {
                if (mediaList.Count > 0)
                {
                    foreach (Media m in mediaList)
                    {
                        m.ImageURL = "~/ImageHandlerRequest.ashx?op=GetPicByName&type=" + typeValueSelected + "&name=" + Server.UrlEncode(m.Name);
                    }

                    imageDataList.DataSource = mediaList;
                    imageDataList.DataBind();
                }
                else
                {
                    // no elements found
                }
            }
            else
            {
                imageDataList.DataSource = null;
                imageDataList.DataBind();

                if (displayViewMode == "Details")
                {
                    if (mediaList.Count > 0)
                    {
                        foreach (Media m in mediaList)
                        {
                            m.ImageURL = "~/ImageHandlerRequest.ashx?op=GetPicByName&type=" + typeValueSelected + "&name=" + Server.UrlEncode(m.Name);
                        }
                        gridMediaList.DataSource = mediaList;
                        gridMediaList.DataBind();
                    }
                    else
                    {
                        // no elements
                    }
                }
            }
        }