예제 #1
0
        protected bool Exist_GenreCategory_InOthers(int catId, int genId)
        {
            VodioContainer ve   = new VodioContainer();
            List <Movie>   movs = ve.Movies.Where(m => m.Id != null).ToList();
            int            temp = Int32.Parse(dt);

            Movie thisMovie = movs[temp];

            movs.Remove(thisMovie);

            foreach (Movie m in movs)
            {
                List <Category> cats = m.Categories.ToList();
                List <Genre>    gens = m.Genres.ToList();
                foreach (Category c in cats)
                {
                    foreach (Genre g in gens)
                    {
                        if (c.Id == catId && g.Id == genId)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
예제 #2
0
        protected void AddBanner_Click(object sender, EventArgs e)
        {
            VodioContainer ve = new VodioContainer();

            string fn = (string)Session["fileName"];

            Bitmap Banner = new Bitmap(Path.Combine(Properties.Settings.Default.PosterDir, fn));

            int temp = Int32.Parse(dt);


            var ban = ve.Banners.Where(b => b.Id == temp).FirstOrDefault();


            ban.Url        = fn;
            ban.Width      = Banner.Width;
            ban.Height     = Banner.Height;
            ban.UrlToClick = Url2ClickText.Text;
            ban.MovieId    = int.Parse(MovieIdText.Text);
            ban.CategoryId = int.Parse(CategoryIdText.Text);
            ban.GenreId    = int.Parse(GenreIdText.Text);
            ban.ListName   = ListNameText.Text;

            ve.Entry(ban).State = System.Data.Entity.EntityState.Modified;
            ve.SaveChanges();
            Response.Write(@"<script language='javascript'>alert('Update successfully!');</script>");
        }
예제 #3
0
        protected void AllCat_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //if (!Page.IsPostBack)
            //{
            VodioContainer ve = new VodioContainer();
            //String dt = Request.QueryString["dt"];
            int             temp = Int32.Parse(dt);
            int             id   = int.Parse(e.CommandArgument.ToString());
            var             tt   = (int)((GridView)sender).DataKeys[id].Value;
            List <Category> cats = ve.Categories.Where(a => a.Name.Contains(SearchBox.Text)).ToList();


            if (e.CommandName == "Add2Cat")
            {
                //Category newCat = ve.Categories.Where(c => c.Id == tt).FirstOrDefault();
                Category newCat  = cats[id];
                Movie    thisMov = ve.Movies.Where(a => a.Id == temp).FirstOrDefault();
                thisMov.Categories.Add(newCat);
                ve.SaveChanges();
                Load_MovieCategory();

                Check_CategoryGenre_table(tt, temp);
            }
            //}
        }
예제 #4
0
        protected void AllGen_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            VodioContainer ve = new VodioContainer();
            //String dt = Return_Dt();
            int temp = Int32.Parse(dt);
            int id   = int.Parse(e.CommandArgument.ToString());

            List <Genre> gens = ve.Genres.Where(a => a.Name.Contains(SearchBox.Text)).ToList();


            //string idt = AllGen.Rows[id].Cells[0].Text;
            //int tid = (int)((GridView)sender).DataKeys[].Value;
            //var tt = (int)((GridView)sender).DataKeys[id].Value;


            if (e.CommandName == "Add2Gen")
            {
                //Genre newGen = ve.Genres.Where(g => g.Id == tt).FirstOrDefault();
                Genre newGen  = gens[id];
                Movie thisMov = ve.Movies.Where(a => a.Id == temp).FirstOrDefault();
                thisMov.Genres.Add(newGen);
                ve.SaveChanges();
                Load_MovieGenre();

                Check_CategoryGenre_table(newGen.Id, temp);
            }
        }
예제 #5
0
        protected void Roles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            VodioContainer ve   = new VodioContainer();
            int            temp = Int32.Parse(dt);

            int id = int.Parse(e.CommandArgument.ToString());

            bindDate();
            int tempId = rols[id].Id;

            if (e.CommandName == "Delete")
            {
                Movie mov = ve.Movies.Where(a => a.Id == temp).FirstOrDefault();
                //List<Role> rols = mov.Roles.Where(a => a.Id != null).ToList();
                Role delrol = mov.Roles.Where(a => a.Id == tempId).FirstOrDefault();

                ve.Movies.Where(a => a.Id == temp).FirstOrDefault().Roles.Remove(delrol);
                //    ve.Entry(category1).State = System.Data.Entity.EntityState.Modified;
                if (delrol != null)
                {
                    ve.Entry(delrol).State = System.Data.Entity.EntityState.Deleted;
                    ve.SaveChanges();
                }
                bindDate();
            }
        }
예제 #6
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (!Page.IsPostBack)
            {
                VodioContainer ve  = new VodioContainer();
                int            id  = int.Parse(e.CommandArgument.ToString());
                List <Agent>   ags = ve.Agents.Where(a => a.Name.Contains(SearchBox.Text)).ToList();

                int dt = ags[id].Id;
                //var dt = (int)((GridView)sender).DataKeys[id].Value;

                if (e.CommandName == "Delete")
                {
                    //var ag1 = ve.Agents.Where(c => c.Id == dt).FirstOrDefault();
                    //ve.Agents.Remove(ag1);
                    //ve.SaveChanges();
                    //Page_Load(null, null);
                }
                if (e.CommandName == "Edit")
                {
                    //Response.Redirect("EditPage.aspx?dt=" + dt);

                    Response.Redirect("editAgent.aspx?dt=" + dt);
                }
            }
        }
예제 #7
0
        private void bindGridView()
        {
            VodioContainer ve = new VodioContainer();
            List <Agent>   ag = ve.Agents.Where(a => a.Name != null).ToList();

            GridView1.DataSource = ag;
            GridView1.DataBind();
        }
예제 #8
0
        protected void Show_All_Movies()
        {
            VodioContainer ve   = new VodioContainer();
            List <Movie>   movs = ve.Movies.ToList();

            AllMovie.DataSource = movs;
            AllMovie.DataBind();
        }
예제 #9
0
        protected void SearchM_Click(object sender, EventArgs e)
        {
            VodioContainer ve = new VodioContainer();
            List <Agent>   ag = ve.Agents.Where(a => a.Name.Contains(SearchBox.Text)).ToList();

            GridView1.DataSource = ag;
            GridView1.DataBind();
        }
예제 #10
0
        protected void SearchM_Click(object sender, EventArgs e)
        {
            VodioContainer ve  = new VodioContainer();
            List <Genre>   gen = ve.Genres.Where(a => a.Name.Contains(SearchBox.Text)).ToList();

            AllGen.DataSource = gen;
            AllGen.DataBind();
        }
예제 #11
0
        protected void SearchM_Click(object sender, EventArgs e)
        {
            VodioContainer  ve  = new VodioContainer();
            List <Category> cat = ve.Categories.Where(a => a.Name.Contains(SearchBox.Text)).ToList();

            GridView1.DataSource = cat;
            GridView1.DataBind();
        }
예제 #12
0
        private void bindGridView()
        {
            VodioContainer ve  = new VodioContainer();
            List <Genre>   gen = ve.Genres.Where(a => a.Name != null).ToList();

            GridView1.DataSource = gen;
            GridView1.DataBind();
        }
예제 #13
0
        protected void bindData()
        {
            VodioContainer ve   = new VodioContainer();
            List <Banner>  bans = ve.Banners.ToList();

            bans1.DataSource = bans;
            bans1.DataBind();
        }
예제 #14
0
        protected void load_data()
        {
            VodioContainer ve  = new VodioContainer();
            List <Bundle>  bun = ve.Bundles.ToList();

            bundles1.DataSource = bun;
            bundles1.DataBind();
        }
예제 #15
0
        protected void SearchM_Click(object sender, EventArgs e)
        {
            VodioContainer ve  = new VodioContainer();
            List <Movie>   mov = ve.Movies.Where(a => a.Title.Contains(SearchBox.Text)).ToList();

            GridView1.DataSource = mov;
            GridView1.DataBind();
        }
예제 #16
0
        private void bindGridView()
        {
            VodioContainer ve  = new VodioContainer();
            List <Movie>   mov = ve.Movies.Where(a => a.Title != null).ToList();

            GridView1.DataSource = mov;
            GridView1.DataBind();
        }
예제 #17
0
        private void bindGridView()
        {
            VodioContainer  ve  = new VodioContainer();
            List <Category> cat = ve.Categories.Where(a => a.Name != null).ToList();

            GridView1.DataSource = cat;
            GridView1.DataBind();
        }
예제 #18
0
        protected void show_gridView()
        {
            VodioContainer ve   = new VodioContainer();
            List <Banner>  bans = ve.Banners.ToList();

            ban1.DataSource = bans;
            ban1.DataBind();
        }
예제 #19
0
        private void bindAllCat()
        {
            VodioContainer  ve  = new VodioContainer();
            List <Category> cat = ve.Categories.Where(a => a.Id != null).ToList();

            AllCat.DataSource = cat;
            AllCat.DataBind();
        }
예제 #20
0
        protected void Show_All_Banners()
        {
            VodioContainer ve      = new VodioContainer();
            List <Banner>  allbans = ve.Banners.ToList();

            banners.DataSource = allbans;
            banners.DataBind();
        }
예제 #21
0
        protected void SearchMov_Click(object sender, EventArgs e)
        {
            VodioContainer ve   = new VodioContainer();
            List <Movie>   movs = ve.Movies.Where(m => m.Title.Contains(SearchText.Text)).ToList();

            AllMovie.DataSource = movs;
            AllMovie.DataBind();
            selectedTab = 2;
        }
예제 #22
0
        protected void Load_MovieGenre()
        {
            VodioContainer ve = new VodioContainer();
            //String dt = Request.QueryString["dt"];
            int          temp = Int32.Parse(dt);
            List <Genre> gen2 = ve.Genres.Where(a => a.Movies.Any(m => m.Id == temp)).ToList();

            MovGen.DataSource = gen2;
            MovGen.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String          dt   = Request.QueryString["dt"];
            int             temp = Int32.Parse(dt);
            VodioContainer  ve   = new VodioContainer();
            List <Category> cat  = ve.Categories.Where(a => a.Movies.Any(m => m.Id == temp)).ToList();

            CategoriesShow.DataSource = cat;
            CategoriesShow.DataBind();
        }
예제 #24
0
        protected void Fill_GenCat()
        {
            VodioContainer ve   = new VodioContainer();
            int            temp = Int32.Parse(dt);

            Bundle thisbun = ve.Bundles.Where(b => b.Id == temp).FirstOrDefault();

            genIdT.Text = thisbun.GenreId;
            catIdT.Text = thisbun.CateroryId;
        }
예제 #25
0
        protected void Load_MovieCategory()
        {
            VodioContainer ve = new VodioContainer();
            //String dt = Request.QueryString["dt"];
            int             temp = Int32.Parse(dt);
            List <Category> cat2 = ve.Categories.Where(a => a.Movies.Any(m => m.Id == temp)).ToList();

            MovCat.DataSource = cat2;
            MovCat.DataBind();
        }
예제 #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         VodioContainer ve  = new VodioContainer();
         List <Genre>   gen = ve.Genres.Where(a => a.Name != null).ToList();
         GridView1.DataSource = gen;
         GridView1.DataBind();
     }
 }
예제 #27
0
        protected void Fill_Banners()
        {
            VodioContainer ve   = new VodioContainer();
            int            temp = Int32.Parse(dt);

            Bundle        thisbun = ve.Bundles.Where(b => b.Id == temp).FirstOrDefault();
            List <Banner> bans    = thisbun.Banners.ToList();

            BundleBanners.DataSource = bans;
            BundleBanners.DataBind();
        }
예제 #28
0
        protected void SearchM_Click(object sender, EventArgs e)
        {
            //if (!Page.IsPostBack)
            //{
            VodioContainer ve  = new VodioContainer();
            List <Genre>   gen = ve.Genres.Where(a => a.Name.Contains(SearchBox.Text)).ToList();

            GridView1.DataSource = gen;
            GridView1.DataBind();
            //}
        }
예제 #29
0
        protected void AddCategory_Click(object sender, EventArgs e)
        {
            VodioContainer ve  = new VodioContainer();
            Category       cat = new Category()
            {
                Name = CatNameText.Text
            };

            ve.Categories.Add(cat);
            ve.SaveChanges();
            Response.Write(@"<script language='javascript'>alert('Add successfully!');</script>");
        }
예제 #30
0
        protected void Add_CategoryGenre(int catId, int genId)
        {
            VodioContainer ve = new VodioContainer();
            CategoryGenre  cg = new CategoryGenre()
            {
                Genre    = ve.Genres.Where(a => a.Id == genId).FirstOrDefault(),
                Category = ve.Categories.Where(a => a.Id == catId).FirstOrDefault()
            };

            ve.CategoryGenres.Add(cg);
            ve.SaveChanges();
        }