public void UpdateVideo()
 {
     try
     {
         VirtualVideo objVideo = VirtualTourController.GetVirtualVideosById(VirtualId);
         VideoFile     = fileUpldVideo;
         objVideo.name = txtName.Text;
         if (VideoFile.HasFile)
         {
             if (VideoFile.PostedFile.ContentType == "video/mp4")
             {
                 string fileName = Path.GetFileName(VideoFile.FileName);
                 string path     = "~/Videos/" + fileName;
                 VideoFile.SaveAs(Server.MapPath(path));
                 objVideo.path        = path;
                 objVideo.ContentType = "video/mp4";
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please Select MP4 Video File');", true);
             }
         }
         objVideo = new VirtualTourController().UpdateVideos(objVideo);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void BindValues()
 {
     try
     {
         VirtualVideo objVideo = VirtualTourController.GetVirtualVideosById(VirtualId);
         txtName.Text  = objVideo.name;
         editVideo.Src = objVideo.path;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public string GetSource(long Id)
 {
     try
     {
         string       src      = "";
         VirtualVideo objVideo = VirtualTourController.GetVirtualVideosById(Id);
         src = objVideo.path;
         return(src);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
 public VirtualVideo UpdateVideos(VirtualVideo objVideo)
 {
     try
     {
         objVideo.updateDate = DateTime.Now;
         using (var context = new FitnessCenterEntities())
         {
             context.VirtualVideos.Attach(context.VirtualVideos.Single(x => x.ID == objVideo.ID));
             context.VirtualVideos.ApplyCurrentValues(objVideo);
             context.SaveChanges();
             return(objVideo);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #5
0
 public VirtualVideo InsertVideos(VirtualVideo objVideo)
 {
     try
     {
         objVideo.insertDate = DateTime.Now;
         objVideo.isDeleted  = false;
         using (var context = new FitnessCenterEntities())
         {
             context.VirtualVideos.AddObject(objVideo);
             context.SaveChanges();
             return(objVideo);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #6
0
        public void ProcessRequest(HttpContext context)
        {
            int id = int.Parse(context.Request.QueryString["Id"]);

            byte[] bytes = new byte[10];
            string contentType;
            string name;

            VirtualVideo objVideo = VirtualTourController.GetVirtualVideosById(id);

            // bytes = objVideo.data;
            contentType = objVideo.ContentType;
            name        = objVideo.name;

            context.Response.Clear();
            context.Response.Buffer = true;
            context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name);
            context.Response.ContentType = contentType;
            context.Response.BinaryWrite(bytes);
            context.Response.End();
        }
 public void InsertVideo()
 {
     try
     {
         VideoFile = fileUpldVideo;
         if (VideoFile.HasFile)
         {
             if (VideoFile.PostedFile.ContentType == "video/mp4")
             {
                 VirtualVideo objVideo = new VirtualVideo();
                 string       fileName = Path.GetFileName(VideoFile.FileName);
                 string       path     = "~/Videos/" + fileName;
                 VideoFile.SaveAs(Server.MapPath(path));
                 objVideo.name = txtName.Text;
                 //using (BinaryReader br = new BinaryReader(fileUpldVideo.PostedFile.InputStream))
                 //{
                 //byte[] data = br.ReadBytes((int)fileUpldVideo.PostedFile.InputStream.Length);
                 objVideo.path        = path;
                 objVideo.ContentType = "video/mp4";
                 //}
                 objVideo = new VirtualTourController().InsertVideos(objVideo);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please Select MP4 Video File');", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please Select Video File');", true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }