public ActionResult Create(string Gallery_Name, string Details, int Page_ID) { //if (ModelState.IsValid) //{ VideoGallery videogallery = new VideoGallery(); videogallery.Gallery_Name = Gallery_Name; videogallery.Details = Details; videogallery.Date_Added = DateTime.Now; videogallery.Added_By = User.Identity.Name.ToString();///TODO auth videogallery.Archived = false; db.VideoGalleries.Add(videogallery); db.SaveChanges(); PageVideoGalleryAssign vidGalAssign = new PageVideoGalleryAssign(); vidGalAssign.Page_ID = Page_ID; vidGalAssign.VideoGallery = videogallery; db.PageVideoGalleryAssigns.Add(vidGalAssign); db.SaveChanges(); return(RedirectToAction("Edit", new { Page_ID = Page_ID, Video_Gallery_ID = videogallery.Video_Gallery_ID })); //} //else //{ // VideoGalleryCreateViewModel vidGalViewMod = new VideoGalleryCreateViewModel(); // vidGalViewMod.Gallery_Name = Gallery_Name; // vidGalViewMod.Details = Details; // vidGalViewMod.Page_ID = Page_ID; // ModelState.AddModelError("", "Invalid Mode"); // return View(vidGalViewMod); //} }
public bool UpdateVideoGallery(VideoGallery gallery) { bool isUpdate = true; using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString)) { SqlCommand command = new SqlCommand(StoreProcedure.UpdateVideoGallery, connection); command.CommandType = CommandType.StoredProcedure; foreach (var item in gallery.GetType().GetProperties()) { string name = item.Name; var value = item.GetValue(gallery, null); command.Parameters.Add(new SqlParameter("@" + name, value == null ? DBNull.Value : value)); } try { connection.Open(); command.ExecuteNonQuery(); } catch (Exception e) { isUpdate = false; UtilityManager.WriteLogError(e.ToString()); } finally { connection.Close(); } } return(isUpdate); }
public ActionResult Edit([Bind(Include = "Video_Gallery_ID,Gallery_Name,Archived,Details,Page_ID")] VideoGalleryEditViewModel vidGalViewMod) { if (ModelState.IsValid) { VideoGallery videogallery = db.VideoGalleries.Find(vidGalViewMod.Video_Gallery_ID); if (videogallery != null) { videogallery.Gallery_Name = vidGalViewMod.Gallery_Name; videogallery.Details = vidGalViewMod.Details; if (videogallery.Archived != vidGalViewMod.Archived) { videogallery.Archived = vidGalViewMod.Archived; videogallery.Date_Archive = DateTime.Now; videogallery.Archive_By = User.Identity.Name.ToString(); ///TODO: auth } videogallery.Last_Updated = DateTime.Now; videogallery.Updated_By = User.Identity.Name.ToString();///TODO: Auth db.SaveChanges(); return(RedirectToAction("Edit", new { Page_ID = vidGalViewMod.Page_ID, Video_Gallery_ID = vidGalViewMod.Video_Gallery_ID })); } else { ModelState.AddModelError("", "No Video Gallery found with the ID '" + vidGalViewMod.Video_Gallery_ID + "'"); return(View(vidGalViewMod)); } } return(View(vidGalViewMod)); }
public virtual IActionResult GaleriPictureList(int id) { VideoGallery galeri = _videoGalleryRepository.GetById(id); if (galeri == null) { throw new ArgumentException("No product picture found with the specified id"); } List <Video> gridData = _videoRepository.Table.Where(x => x.VideoGalleryId == id).ToList(); VideoListModel model = new VideoListModel { Data = gridData.Select(x => { VideoModel galeriPicturemodel = new VideoModel { Id = x.Id, DisplayOrder = x.DisplayOrder, Published = x.Published, IsApproved = x.IsApproved, EmbedCode = x.EmbedCode, Descriptions = x.Descriptions, VideoGalleryId = x.VideoGalleryId }; return(galeriPicturemodel); }), Total = gridData.Count() }; return(Json(model)); }
public virtual IActionResult GaleriPictureAdd(int pictureId, string pictureUrl, int videoId, int displayOrder, string description, string embedcode, bool published, bool isaproved, int galeriId) { if (galeriId == 0) { throw new ArgumentException(); } VideoGallery galeri = _videoGalleryRepository.GetById(galeriId) ?? throw new ArgumentException("No product found with the specified id"); Video addVideo = new Video { Descriptions = description, DisplayOrder = displayOrder, EmbedCode = embedcode, IsApproved = isaproved, Published = published, VideoGalleryId = galeriId, PictureId = pictureId, PictureUrl = pictureUrl }; _videoRepository.Insert(addVideo); return(Json(new { Result = true })); }
public void CreateVideoEntity(string embed, VideoGallery gallery) { var embedCode = ""; int pos = embed.LastIndexOf("/") + 1; embedCode = embed.Substring(pos, embed.Length - pos); VideoType videoType; if (embed.ToLower().Contains("youtu")) { videoType = VideoType.Youtube; } else if (embed.ToLower().Contains("vimeo")) { videoType = VideoType.Vimeo; } else { videoType = VideoType.Other; } var video = new Video { Embed = embedCode, VideoType = videoType, VideoGallery = gallery }; this.CreateVideo(video); }
public async Task <int> Create(VideoGalleryViewModel model) { try { var list = _IVideoGalleryRepository.ListAll().Where(o => o.IsActive == model.IsActive).Select(q => q.Order).ToList(); int maxOrder = 0; if (list.Count > 0) { maxOrder = list.Max() + 1; } else { maxOrder = 1; } VideoGallery vgallery = new VideoGallery() { Order = maxOrder, IsActive = model.IsActive, DateCreated = DateTime.Now, DateModified = DateTime.Now, UserCreated = model.UserCreated, UserModified = model.UserModified, EmbedKey = model.EmbedKey, ImageURL = model.ImageURL, VideoEmbed = model.VideoEmbed }; return((await _IVideoGalleryRepository.AddAsync(vgallery)).Id); } catch (Exception ex) { return(0); } }
public VideoGallery GetVideoGalleryById(long id) { VideoGallery list = new VideoGallery(); using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString)) { SqlCommand command = new SqlCommand(StoreProcedure.GetVideoGalleryById, connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@Id", id)); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); list = UtilityManager.DataReaderMap <VideoGallery>(reader); return(list); } catch (Exception e) { UtilityManager.WriteLogError(e.ToString()); return(list); } finally { connection.Close(); } } }
/// <summary> /// UpdateVideo /// </summary> /// <param name="videoGallery"></param> public void UpdateVideo(VideoGallery videoGallery) { if (videoGallery == null) { throw new ArgumentNullException(nameof(videoGallery)); } _videoGalleryRepository.Update(videoGallery); }
public void AddOrUpdate(VideoGallery videoGallery) { if (videoGallery == null) { throw new ArgumentNullException(nameof(videoGallery)); } _videoGalleries.AddOrUpdate(videoGallery); }
/// <summary> /// InsertVideo /// </summary> /// <param name="videoGallery"></param> public void InsertVideo(VideoGallery videoGallery) { if (videoGallery == null) { throw new ArgumentNullException(nameof(videoGallery)); } _videoGalleryRepository.Insert(videoGallery); }
public VideoGalleryEditViewModel(VideoGallery vidGal, int Page_ID) { this.Page_ID = Page_ID; this.Video_Gallery_ID = vidGal.Video_Gallery_ID; this.Gallery_Name = vidGal.Gallery_Name; this.Details = vidGal.Details; this.videos = (List <Video>)vidGal.Videos.ToList(); this.Archived = vidGal.Archived; }
public virtual IActionResult GalleryDelete(int?id) { VideoGallery result = _videoGalleryRepository.GetById(id); if (result.Id > 0) { _videoGalleryRepository.Delete(result); } return(new NullJsonResult()); }
public PageViewModel(Page page) { this.thisPage = page; this.Feedback_Message = ""; this.Feedback_Name = ""; if (this.thisPage.Banner != null) { this.thisPage.Banner.BannerElements = page.Banner.BannerElements.Where(x => x.Archived == false).ToList(); } this.assColls = this.thisPage.PageCollectionAssigns.Where(x => x.Archived == false).ToList(); this.assVidGals = this.thisPage.PageVideoGalleryAssigns.Where(x => x.Archived == false).ToList(); this.assCals = this.thisPage.PageCalenderAssigns.Where(x => x.Archived == false).ToList(); this.assLibs = this.thisPage.PageLibraryAssigns.Where(x => x.Archived == false).ToList(); this.assPhotoGals = this.thisPage.PageGalleryAssigns.Where(x => x.Archived == false).ToList(); this.assQuickLinkLists = this.thisPage.PageQuickLinkListsAssigns.Where(x => x.Archived == false).ToList(); this.collections = new List <Collection>(); this.calenders = new List <Calender>(); this.videoGalleries = new List <VideoGallery>(); this.libraries = new List <Library>(); this.photoGalleries = new List <Gallery>(); this.quickLinkLists = new List <QuickLinkList>(); foreach (var collIDAss in assColls.OrderBy(x => x.Sequence_No)) { Collection curColl = (from res in db.Collections where res.Collection_ID == collIDAss.Collection_ID select res).FirstOrDefault(); this.collections.Add(curColl); } foreach (var calIDAss in this.assCals) { Calender curCal = (from res in db.Calenders where res.Calender_ID == calIDAss.Calender_ID select res).FirstOrDefault(); this.calenders.Add(curCal); } foreach (var vidGalIDAss in this.assVidGals) { VideoGallery curVidGal = (from res in db.VideoGalleries where res.Video_Gallery_ID == vidGalIDAss.Video_Gallery_ID select res).FirstOrDefault(); this.videoGalleries.Add(curVidGal); } foreach (var libIDAss in this.assLibs) { Library curLib = (from res in db.Libraries where res.Library_ID == libIDAss.Library_ID select res).FirstOrDefault(); this.libraries.Add(curLib); } foreach (var photoGalIDAss in this.assPhotoGals) { Gallery photoGal = (from res in db.Galleries where res.Gallery_ID == photoGalIDAss.Gallery_ID select res).FirstOrDefault(); this.photoGalleries.Add(photoGal); } foreach (var quickLinkListIDAss in this.assQuickLinkLists) { QuickLinkList qList = (from res in db.QuickLinkLists where res.Link_List_ID == quickLinkListIDAss.Link_List_ID select res).FirstOrDefault(); this.quickLinkLists.Add(qList); } }
public ActionResult Edit(int Page_ID, int Video_Gallery_ID) { VideoGallery videogallery = db.VideoGalleries.Find(Video_Gallery_ID); if (videogallery == null) { return(HttpNotFound()); } VideoGalleryEditViewModel vidGalViewMod = new VideoGalleryEditViewModel(videogallery, Page_ID); return(View(vidGalViewMod)); }
public IActionResult GalleryCreate(VideoKategoriModel model) { if (!string.IsNullOrEmpty(model.Name)) { VideoGallery result = new VideoGallery { Name = model.Name, Published = model.Published }; _videoGalleryRepository.Insert(result); } return(new NullJsonResult()); }
public bool AddVideo(VideoGallery video) { try { _entity.VideoGalleries.Add(video); _entity.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public VideoGalleryViewModel(VideoGallery v) { Id = v.Id; ImageURL = v.ImageURL; VideoEmbed = v.VideoEmbed; EmbedKey = v.EmbedKey; IsActive = v.IsActive; Order = v.Order; DateCreated = v.DateCreated; DateModified = v.DateModified; UserCreated = v.UserCreated; UserModified = v.UserModified; }
public void AddVideoToGallery(string galleryName, Video video) { var gallery = this.dbContext.VideoGalleries.FirstOrDefault(g => g.Name == galleryName); if (gallery != null) { gallery.Videos.Add(video); } else { gallery = new VideoGallery(galleryName); gallery.Videos.Add(video); this.dbContext.VideoGalleries.Add(gallery); } }
public bool DeleteVideo(long id) { try { VideoGallery video = _entity.VideoGalleries.First(m => m.Id == id); _entity.VideoGalleries.Remove(video); _entity.SaveChanges(); return(true); } catch (Exception ex) { // Logging.TrackError(ex, "CreateLab"); return(false); } }
public bool UpdateVideo(VideoGallery videoeoinfo) { try { var objgallery = _entity.VideoGalleries.Single(d => d.Id == videoeoinfo.Id); objgallery.VideoURL = videoeoinfo.VideoURL; objgallery.Tittle = videoeoinfo.Tittle; objgallery.Description = videoeoinfo.Description; objgallery.Id = videoeoinfo.Id; _entity.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public virtual IActionResult GalleryEdit(VideoKategoriModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } VideoGallery result = _videoGalleryRepository.GetById(model.Id); if (result == null) { return(new NullJsonResult()); } result.Name = model.Name; result.Published = model.Published; _videoGalleryRepository.Update(result); return(new NullJsonResult()); }
public virtual IActionResult Edit(int id) { VideoGallery galery = _videoGalleryRepository.GetById(id); if (galery == null) { return(RedirectToAction("List")); } VideoKategoriModel model = new VideoKategoriModel { Id = galery.Id, Name = galery.Name, Published = galery.Published }; model.VideoSearchModel.GaleryId = galery.Id; model.VideoSearchModel.SetGridPageSize(); return(View(model)); }
public long InsertVideoGallery(VideoGallery gallery) { long id = 0; using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString)) { SqlCommand command = new SqlCommand(StoreProcedure.InsertVideoGallery, connection); command.CommandType = CommandType.StoredProcedure; SqlParameter returnValue = new SqlParameter("@" + "Id", SqlDbType.Int); returnValue.Direction = ParameterDirection.Output; command.Parameters.Add(returnValue); foreach (var item in gallery.GetType().GetProperties()) { if (item.Name != "Id") { string name = item.Name; var value = item.GetValue(gallery, null); command.Parameters.Add(new SqlParameter("@" + name, value == null ? DBNull.Value : value)); } } try { connection.Open(); command.ExecuteNonQuery(); id = (int)command.Parameters["@Id"].Value; } catch (Exception ex) { UtilityManager.WriteLogError(ex.ToString()); } finally { connection.Close(); } } return(id); }
private void initializeThreads() { m_ThreadVideoGallery = new Thread(new ThreadStart(fetchVideos)); m_ThreadPictureGallery = new Thread(new ThreadStart(fetchPictures)); m_ThreadPosts = new Thread(new ThreadStart(fetchPosts)); m_ThreadPages = new Thread(new ThreadStart(fetchPages)); m_ThreadEvents = new Thread(new ThreadStart(fetchEvents)); m_VideoGallery = new VideoGallery(); m_ThreadTimeline = new Thread(() => fetchTimeline(null)); m_ThreadTimeline.IsBackground = true; m_ThreadVideoGallery.IsBackground = true; m_ThreadPictureGallery.IsBackground = true; m_ThreadPosts.IsBackground = true; m_ThreadPages.IsBackground = true; m_ThreadEvents.IsBackground = true; m_ThreadPosts.Start(); m_ThreadPages.Start(); m_ThreadEvents.Start(); m_ThreadVideoGallery.Start(); m_ThreadPictureGallery.Start(); m_ThreadTimeline.Start(); }
/// <summary> /// Method to get the list of videos for the selected tribute /// </summary> /// <param name="objVideoGallery">Filled Video Gallery Entity</param> /// <returns>List of videos in the gallery</returns> public List<VideoGallery> GetVideosOfTribute(VideoGallery objVideoGallery) { return FacadeManager.VideoManager.GetVideoGalleryRecords(objVideoGallery); }
/// <summary> /// Method to set the User tribute id to get the list of Videos for tribute /// </summary> /// <returns>Filled Video Gallery entity with UserTributeId</returns> private VideoGallery SetVideoEntityObject(int currentPage) { VideoGallery objVideoGallery = new VideoGallery(); Videos objVideo = new Videos(); objVideo.UserTributeId = _tributeId; // _userTributeId; objVideoGallery.Videos = objVideo; //TO DO: to be picked dynamically objVideoGallery.PageNumber = currentPage; objVideoGallery.PageSize = pageSize; return objVideoGallery; }
public static long InsertVideoGallery(VideoGallery gallery) { SqlNewsEventsProvider provider = new SqlNewsEventsProvider(); return(provider.InsertVideoGallery(gallery)); }
public static bool UpdateVideoGallery(VideoGallery gallery) { SqlNewsEventsProvider provider = new SqlNewsEventsProvider(); return(provider.UpdateVideoGallery(gallery)); }
public void Delete(VideoGallery videoGallery) { _videoGalleries.Remove(videoGallery); }
/// <summary> /// Method to get the details of video. /// </summary> /// <param name="objVideoGallery">Video Gallery entity containing User Tribute id, Page size and Page number</param> /// <returns>Filled VideoGallery entity</returns> public VideoGallery GetVideoDetails(VideoGallery objVideoGallery) { VideoResource objVideo = new VideoResource(); object[] param = { objVideoGallery }; return objVideo.GetVideoDetails(param); }
public PageEditViewModel(Page page) { this.Page_ID = page.Page_ID; this.Page_Name = page.Page_Name; this.URL = page.URL; this.Title_Text = page.Title_Text; this.Is_Default = page.Is_Default; this.Parent_Page_ID = page.Parent_Page_ID; this.banner = page.Banner; this.Display_In_Menu = page.Display_In_Menu; this.Redirect = page.Redirect; this.Redirect_URL = page.Redirect_URL; this.Allow_Feedback = page.Allow_Feedback; this.Recipients_Temp = ""; this.allFeedback = page.Feedbacks.ToList(); this.collections = new List <Collection>(); this.galleries = new List <Gallery>(); this.libraries = new List <Library>(); this.calenders = new List <Calender>(); this.videoGalleries = new List <VideoGallery>(); this.availablePages = new List <Page>(); this.recipients = new List <NotificationRecipent>(); this.quickLinkLists = new List <QuickLinkList>(); this.assColls = page.PageCollectionAssigns.Where(x => x.Archived == false).ToList(); this.assVidGals = page.PageVideoGalleryAssigns.Where(x => x.Archived == false).ToList(); this.assCals = page.PageCalenderAssigns.Where(x => x.Archived == false).ToList(); this.assLibs = page.PageLibraryAssigns.Where(x => x.Archived == false).ToList(); this.assPhotoGals = page.PageGalleryAssigns.Where(x => x.Archived == false).ToList(); this.assQuickLinkLists = page.PageQuickLinkListsAssigns.Where(x => x.Archived == false).ToList(); this.assRecipients = page.PageRecipientAssigns.ToList(); availablePages = (List <Page>)(from pg in db.Pages where pg.Archived == false select pg).ToList(); availableBanners = (List <Banner>)(from b in db.Banners select b).ToList(); availableContentTypes = (List <ContentType>)(from c in db.ContentTypes select c).ToList(); foreach (var collIDAss in assColls.OrderBy(x => x.Sequence_No)) { Collection curColl = (from res in db.Collections where res.Collection_ID == collIDAss.Collection_ID select res).FirstOrDefault(); this.collections.Add(curColl); } foreach (var calIDAss in this.assCals) { Calender curCal = (from res in db.Calenders where res.Calender_ID == calIDAss.Calender_ID select res).FirstOrDefault(); this.calenders.Add(curCal); } foreach (var vidGalIDAss in this.assVidGals) { VideoGallery curVidGal = (from res in db.VideoGalleries where res.Video_Gallery_ID == vidGalIDAss.Video_Gallery_ID select res).FirstOrDefault(); this.videoGalleries.Add(curVidGal); } foreach (var libIDAss in this.assLibs) { Library curLib = (from res in db.Libraries where res.Library_ID == libIDAss.Library_ID select res).FirstOrDefault(); this.libraries.Add(curLib); } foreach (var photoGalIDAss in this.assPhotoGals) { Gallery photoGal = (from res in db.Galleries where res.Gallery_ID == photoGalIDAss.Gallery_ID select res).FirstOrDefault(); this.galleries.Add(photoGal); } foreach (var quickLinkListIDAss in this.assQuickLinkLists) { QuickLinkList qList = (from res in db.QuickLinkLists where res.Link_List_ID == quickLinkListIDAss.Link_List_ID select res).FirstOrDefault(); this.quickLinkLists.Add(qList); } foreach (var recipientsIDAss in this.assRecipients) { NotificationRecipent rec = (from res in db.NotificationRecipents where res.Recipient_ID == recipientsIDAss.Recipient_ID select res).FirstOrDefault(); this.recipients.Add(rec); this.Recipients_Temp += rec.Recipient_ID + "," + rec.Recipient_Name + "," + rec.Recipient_Email + "|"; } if (this.Recipients_Temp.Length > 0) { this.Recipients_Temp = this.Recipients_Temp.Substring(0, this.Recipients_Temp.Length - 1); } }
public VideoGalleryCreateViewModel(VideoGallery vidGal, int Page_ID) { this.Gallery_Name = vidGal.Gallery_Name; this.Details = this.Details; }
protected void VideoCreatioFacebookWallPost() { string tributeHome; string videoUrl; if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local")) { tributeHome = Session["APP_PATH"] + _tributeUrl; } else { tributeHome = "http://" + _tributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + _tributeUrl; } tributeHome += "/"; videoUrl = tributeHome + "Video.aspx"; string query_string = string.Empty; if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local")) { query_string = "?TributeType=" + HttpUtility.UrlEncode(_tributeType); videoUrl = videoUrl + query_string; tributeHome = tributeHome + query_string; } aTributeHome.HRef = tributeHome; StateManager objStateManager = StateManager.Instance; if (Request.QueryString["post_on_facebook"] != null && Request.QueryString["post_on_facebook"].ToString().Equals("True")) { if (Request.QueryString["videoId"] != null) { _videoId = int.Parse(Request.QueryString["videoId"].ToString()); objStateManager.Add("VideoSession", _videoId, StateManager.State.Session); } else if (objStateManager.Get("VideoSession", StateManager.State.Session) != null) { _videoId = int.Parse(objStateManager.Get("VideoSession", StateManager.State.Session).ToString()); } Videos objVideo = new Videos(); objVideo.VideoId = _videoId; objVideo.UserId = _userId; VideoGallery objVideoGallery = new VideoGallery(); objVideoGallery.Videos = objVideo;//this.View.UserTributeId VideoManager mgr = new VideoManager(); objVideoGallery = mgr.GetVideoDetails(objVideoGallery); videoUrl += (videoUrl.Contains("?") ? "&" : "?") + "mode=view&videoId=" + _videoId.ToString(); StringBuilder sb = new StringBuilder(); sb.Append("<script type=\"text/javascript\">\n"); sb.Append("$(document).addEvent('fb_connected', function() {\n"); sb.Append(" var attachments = {\n"); sb.Append(" name: '"); sb.Append(string.Format("{0} added a video on the: {1} {2} Tribute", _userName, _tributeName, _tributeType)); sb.Append("',\n"); sb.Append(" href: '"); sb.Append(videoUrl); sb.Append("',\n"); sb.Append(" caption: '<b>Website:</b> "); sb.Append(tributeHome); sb.Append("',\n"); sb.Append(" description: '<b>Video:</b> "); sb.Append(objVideoGallery.Videos.VideoCaption); sb.Append("',\n"); sb.Append(" media: [{\n"); sb.Append(" type: 'image',\n"); sb.Append(" src:'"); sb.Append(string.Format("http://img.youtube.com/vi/{0}/default.jpg", objVideoGallery.IdForDisplay)); sb.Append("',\n"); sb.Append(" href: '"); sb.Append(videoUrl); sb.Append("'\n"); sb.Append(" }]\n"); sb.Append(" };\n"); sb.Append(" var action_link = [{\n"); sb.Append(" text: '"); sb.Append(string.Format("Visit {0} Tribute", _tributeType)); sb.Append("',\n"); sb.Append(" href: '"); sb.Append(tributeHome); sb.Append("'\n"); sb.Append(" }]\n"); sb.Append(" publish_stream('', attachments, action_link, null, null, function() {});"); sb.Append("});\n"); sb.Append("</script>"); ClientScript.RegisterStartupScript(GetType(), "facebook_wall_post", sb.ToString()); } }
public ActionResult AddVideo(int Page_ID, int Video_Gallery_ID, string Title_Text, string Caption) { VideoGallery vidGal = db.VideoGalleries.Find(Video_Gallery_ID); VideoGalleryEditViewModel vidGalViewMod = new VideoGalleryEditViewModel(vidGal, Page_ID); Regex rgx = new Regex("[^a-zA-Z0-9]"); string dirName = rgx.Replace(vidGal.Gallery_Name, ""); string pathRoot = "~/video/galleries/" + dirName + "/"; string dbRoot = "video/galleries/" + dirName + "/"; string ImgpathRoot = "~/images/videos/" + dirName + "/"; string ImgdbRoot = "images/videos/" + dirName + "/"; if (!System.IO.Directory.Exists(Server.MapPath(pathRoot))) { System.IO.Directory.CreateDirectory(Server.MapPath(pathRoot)); } if (!System.IO.Directory.Exists(Server.MapPath(ImgpathRoot))) { System.IO.Directory.CreateDirectory(Server.MapPath(ImgpathRoot)); } if (Request.Files["WMVFile"] != null && Request.Files["MP4File"] != null && Request.Files["BannerImage"] != null) { HttpPostedFileBase wmvFile = Request.Files["WMVFile"]; HttpPostedFileBase mp4File = Request.Files["MP4File"]; HttpPostedFileBase imgFile = Request.Files["BannerImage"]; if (wmvFile.ContentLength <= 0) { ModelState.AddModelError("", "You must include a 'WMV File'"); return(View("Edit", vidGalViewMod)); } else if (mp4File.ContentLength <= 0) { ModelState.AddModelError("", "You must include a 'MP4 File'"); return(View("Edit", vidGalViewMod)); } else if (imgFile.ContentLength <= 0) { ModelState.AddModelError("", "You must include a 'Preview Image'"); return(View("Edit", vidGalViewMod)); } else { string WMVfileName = wmvFile.FileName; string WMVfileNameNoEx = Path.GetFileNameWithoutExtension(wmvFile.FileName); string WMVext = Path.GetExtension(wmvFile.FileName).ToLower(); string MP4fileName = mp4File.FileName; string MP4fileNameNoEx = Path.GetFileNameWithoutExtension(mp4File.FileName); string MP4ext = Path.GetExtension(mp4File.FileName).ToLower(); string ImgfileName = imgFile.FileName; string ImgfileNameNoEx = Path.GetFileNameWithoutExtension(imgFile.FileName); string Imgext = Path.GetExtension(imgFile.FileName).ToLower(); if (WMVext != ".wmv") { ModelState.AddModelError("", "The 'WMV File' must be of type .wmv"); return(View("Edit", vidGalViewMod)); } else if (MP4ext != ".mp4") { ModelState.AddModelError("", "The 'WMV File' must be of type .wmv"); return(View("Edit", vidGalViewMod)); } else if (Imgext != ".jpg" && Imgext != ".png") { ModelState.AddModelError("", "The 'Preview Image' must be of type .jpg or .png"); return(View("Edit", vidGalViewMod)); } else { WMVfileNameNoEx = UploadFile(wmvFile, pathRoot, WMVfileNameNoEx, WMVext); WMVfileNameNoEx = UploadFile(mp4File, pathRoot, WMVfileNameNoEx, MP4ext); ImgfileNameNoEx = UploadFile(imgFile, ImgpathRoot, ImgfileNameNoEx, Imgext); Video vid = new Video(); vid.Date_Added = DateTime.Now; vid.Added_By = User.Identity.Name.ToString();///TODO: auth vid.Archived = false; vid.Title_Text = Title_Text; vid.Caption = Caption; vid.VideoGallery = vidGal; vid.Thumb_Path = ImgdbRoot + ImgfileNameNoEx + Imgext; vid.File_Path = dbRoot + WMVfileNameNoEx; db.Videos.Add(vid); db.SaveChanges(); return(RedirectToAction("Edit", new { Page_ID = Page_ID, Video_Gallery_ID = Video_Gallery_ID })); } } } else { ModelState.AddModelError("", "You must select each of the following files: WMV File, MP4 File, Preview Image"); return(View("Edit", vidGalViewMod)); } }
/// <summary> /// Method to get the details of selected video /// </summary> /// <param name="objVideoGallery">Video Id</param> /// <returns>Filled Video Gallery entity</returns> public VideoGallery GetVideoDetails(VideoGallery objVideoGallery) { return FacadeManager.VideoManager.GetVideoDetails(objVideoGallery); }
/// <summary> /// Method to send the request to Video Resource to get the list of videos for Video Tribute /// </summary> /// <param name="objVideoGallery">Video Gallery entity conatining UserTributeId, Page size and Page number</param> /// <returns>List of Videos</returns> public List<VideoGallery> GetVideoGalleryRecords(VideoGallery objVideoGallery) { VideoResource objVideo = new VideoResource(); object[] param = { objVideoGallery }; return objVideo.GetVideoGalleryRecords(param); }
public void CreateGallery(VideoGallery gallery) { videoGalleryRepository.Add(gallery); unitOfWork.Save(); }
public void EditGallery(VideoGallery gallery) { throw new NotImplementedException(); }