public ActionResult AddToFeatured(string href, string href_mobile, string name, string image, int plstType, int ContID, string ContType)
 {
     if (Session["Roles"] != null && Session["Roles"].Equals("Admin"))
     {
         hypster_tv_DAL.homeSlideshowManager slideshowManager = new hypster_tv_DAL.homeSlideshowManager();
         hypster_tv_DAL.homeSlideshow        slideshow        = new hypster_tv_DAL.homeSlideshow();
         slideshow = slideshowManager.homeSlideshowByID(ContID);
         hypster_tv_DAL.Image_Resize_Manager image_resizer = new hypster_tv_DAL.Image_Resize_Manager();
         image_resizer.Resize_Image(System.Configuration.ConfigurationManager.AppSettings["homeSlideshowStorage_Path"] + "\\" + image, 800, -1, System.Drawing.Imaging.ImageFormat.Jpeg, System.Configuration.ConfigurationManager.AppSettings["homeSlideshowStorage_Path"] + "\\" + "sm_" + image);
         hypster_tv_DAL.featuredContentManagement fc_manager = new hypster_tv_DAL.featuredContentManagement();
         hypster_tv_DAL.FeaturedContent           fc_add     = new hypster_tv_DAL.FeaturedContent();
         fc_add.fc_active      = true;
         fc_add.fc_href        = href;
         fc_add.fc_href_mobile = href_mobile;
         fc_add.fc_name        = name;
         fc_add.fc_image       = "sm_" + image; // need to resize
         fc_add.fc_type        = plstType;
         fc_manager.hyDB.FeaturedContents.AddObject(fc_add);
         fc_manager.hyDB.SaveChanges();
         return(RedirectPermanent("/WebsiteManagement/manageFeatured"));
     }
     else
     {
         return(RedirectPermanent("/home/"));
     }
 }
        public ActionResult AddToFeatured()
        {
            if (Session["Roles"] != null && Session["Roles"].Equals("Admin"))
            {
                int id = 0;
                if (Request.QueryString["id"] != null)
                {
                    Int32.TryParse(Request.QueryString["id"].ToString(), out id);
                }

                string type = "";
                if (Request.QueryString["type"] != null)
                {
                    type = Request.QueryString["type"].ToString();
                }

                ViewBag.ContID   = id;
                ViewBag.ContType = type;
                hypster_tv_DAL.homeSlideshowManager slideshowManager = new hypster_tv_DAL.homeSlideshowManager();
                hypster_tv_DAL.homeSlideshow        slideshow        = new hypster_tv_DAL.homeSlideshow();
                slideshow = slideshowManager.homeSlideshowByID(id);
                return(View(slideshow));
            }
            else
            {
                return(RedirectPermanent("/home/"));
            }
        }
 public ActionResult EditSlideshow(int id)
 {
     hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
     hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
     //hypster_tv_DAL.homeslideImageTracking tracking = new hypster_tv_DAL.homeslideImageTracking();
     slide      = homeSlideshowManager.homeSlideshowByID(id);
     ViewBag.ID = id;
     return(View(slide));
 }
        public ActionResult Activate(int id)
        {
            hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
            hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
            slide = homeSlideshowManager.homeSlideshowByID(id);

            if (slide.homeSlideshow_ID != 0)
            {
                homeSlideshowManager.ActivateHomeSlideshow(slide.homeSlideshow_ID);
            }
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 public ActionResult Activate(int id)
 {
     if (Session["Roles"] != null && Session["Roles"].Equals("Admin"))
     {
         hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
         hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
         slide = homeSlideshowManager.homeSlideshowByID(id);
         if (slide.homeSlideshow_ID != 0)
         {
             homeSlideshowManager.ActivateHomeSlideshow(slide.homeSlideshow_ID);
         }
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectPermanent("/home/"));
     }
 }
        public ActionResult Delete(int id)
        {
            hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
            hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
            slide = homeSlideshowManager.homeSlideshowByID(id);

            if (slide.homeSlideshow_ID != 0)
            {
                //remove image
                System.IO.FileInfo del_file = new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["homeSlideshowStorage_Path"] + "\\" + slide.ImageSrc);
                del_file.Delete();

                homeSlideshowManager.DeleteHomeSlideshow(slide.homeSlideshow_ID);
            }

            homeSlideshowManager.ResetSortOrder();

            return(RedirectToAction("Index"));
        }
        public ActionResult EditSlideshow(HttpPostedFileBase file, int id, string ImgSrc, string href)
        {
            //string[] s = Request.AppRelativeCurrentExecutionFilePath.Split('/');
            hypster_tv_DAL.Hypster_Entities     hyDB = new hypster_tv_DAL.Hypster_Entities();
            hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
            hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
            //slide = homeSlideshowManager.homeSlideshowByID(Convert.ToInt32(s[s.Length - 1]));
            slide = homeSlideshowManager.homeSlideshowByID(id);
            string image_guid = "";

            if (file != null && file.ContentLength > 0)
            {
                var extension = System.IO.Path.GetExtension(file.FileName);
                var path      = System.IO.Path.Combine(Server.MapPath("~/uploads"), "new_home_slide" + extension);
                file.SaveAs(path);

                image_guid = System.Guid.NewGuid().ToString();
                //
                // resize image
                //
                hypster_tv_DAL.Image_Resize_Manager image_resizer = new hypster_tv_DAL.Image_Resize_Manager();
                image_resizer.Resize_Image(path, 621, 376, System.Drawing.Imaging.ImageFormat.Jpeg);

                System.IO.FileInfo file_slide = new System.IO.FileInfo(Server.MapPath("~/uploads") + "\\" + "new_home_slide" + extension);
                file_slide.CopyTo(System.Configuration.ConfigurationManager.AppSettings["homeSlideshowStorage_Path"] + "\\" + image_guid + extension, true);

                //delete file
                System.IO.FileInfo del_file = new System.IO.FileInfo(Server.MapPath("~/uploads") + "\\" + "new_home_slide" + extension);
                del_file.Delete();
                slide.ImageSrc = image_guid + extension;
            }
            else
            {
                slide.ImageSrc = ImgSrc;
            }
            slide.href = href;
            hyDB.sp_homeSlideshow_UpdateHomeSlideshow(slide.homeSlideshow_ID, slide.href, slide.ImageSrc);
            hyDB.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #8
0
 public ActionResult Delete(int id)
 {
     if (Session["Roles"] != null && Session["Roles"].Equals("Admin"))
     {
         hypster_tv_DAL.homeSlideshowManager homeSlideshowManager = new hypster_tv_DAL.homeSlideshowManager();
         hypster_tv_DAL.homeSlideshow        slide = new hypster_tv_DAL.homeSlideshow();
         slide = homeSlideshowManager.homeSlideshowByID(id);
         if (slide.homeSlideshow_ID != 0)
         {
             //remove image
             System.IO.FileInfo del_file = new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["homeSlideshowStorage_Path"] + "\\" + slide.ImageSrc);
             del_file.Delete();
             homeSlideshowManager.DeleteHomeSlideshow(slide.homeSlideshow_ID);
         }
         homeSlideshowManager.ResetSortOrder();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectPermanent("/home/"));
     }
 }