Esempio n. 1
0
        protected void RepeaterVideos_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string cmd = e.CommandName;
            string arg = e.CommandArgument.ToString();

            if (cmd == "PagA")
            {
                int pag = (Convert.ToInt16(arg, culture) - 1) <= 0 ? 1 : Convert.ToInt16(arg, culture) - 1;
                RepeaterVideos.DataSource = getVideos(pag, out totalCount, out numberOfPages);
                ViewState["InfoPage"]     = new string[] { pag + " de " + numberOfPages, pag.ToString(culture), totalCount.ToString(culture), numberOfPages.ToString(culture) };
                RepeaterVideos.DataBind();
            }
            else if (cmd == "PagP")
            {
                int pag = Convert.ToInt16(arg) + 1;
                if (Convert.ToInt32(((string[])ViewState["InfoPage"])[3]) >= pag)
                {
                    RepeaterVideos.DataSource = getVideos(pag, out totalCount, out numberOfPages);
                    ViewState["InfoPage"]     = new string[] { pag + " de " + numberOfPages, pag.ToString(culture), totalCount.ToString(culture), numberOfPages.ToString(culture) };
                    RepeaterVideos.DataBind();
                }
            }
            else if (cmd == "Remover")
            {
                DataKartDataContext dk = new DataKartDataContext();
                var video = (from v in dk.Kart_Videos_Grupos
                             where v.idVideo == Convert.ToInt32(arg, culture)
                             select v).FirstOrDefault();
                if (video != null)
                {
                    dk.Kart_Videos_Grupos.DeleteOnSubmit(video);
                    dk.SubmitChanges();
                    CarregarVideos();
                }
            }
        }
Esempio n. 2
0
 private void CarregarVideos()
 {
     RepeaterVideos.DataSource = getVideos(1, out totalCount, out numberOfPages);
     ViewState["InfoPage"]     = new string[] { "1 de " + numberOfPages, "1", totalCount.ToString(), numberOfPages.ToString() };
     RepeaterVideos.DataBind();
 }