private void LoadSummary() { TList <Lesson> listlessons = new TList <Lesson>(); listlessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId); listlessons.Sort("LessonDate DESC"); try { summarymovie = DataRepository.SummaryMovieProvider.GetByLessonId(listlessons[0].LessonId)[0]; wmpfile = "http://www.swingmodel.com/" + summarymovie.FilePath; //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyKey", "MakeSummaryVisible();", true); TList <SummaryMovie> summarymovies = new TList <SummaryMovie>(); summarymovies.Add(summarymovie); TList <Lesson> lessons = new TList <Lesson>(); lessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId); lessons.Sort("LessonDate DESC"); SummaryMovie sm; foreach (Lesson l in lessons) { try { sm = DataRepository.SummaryMovieProvider.GetByLessonId(l.LessonId)[0]; if (!sm.DateRecorded.Equals(summarymovie.DateRecorded)) { summarymovies.Add(sm); } } catch (Exception ex) { } } } catch (Exception) { wmpfile = string.Empty; //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true); //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true); } }
private void LoadSummary() { DropDownList4.Items.Clear(); if (leftMovie == null || rightMovie == null) { System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true); System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true); return; } if (leftMovie.MovieType.Equals(rightMovie.MovieType)) { System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true); System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true); displaysummary = false; } else { if (leftMovie.DateRecorded.Equals(rightMovie.DateRecorded)) { try { summarymovie = DataRepository.SummaryMovieProvider.GetByLessonId(leftMovie.LessonId)[0]; wmpfile = "http://www.swingmodel.com/" + summarymovie.FilePath; displaysummary = true; System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyKey", "MakeSummaryVisible();", true); TList <SummaryMovie> summarymovies = new TList <SummaryMovie>(); summarymovies.Add(summarymovie); TList <Lesson> lessons = new TList <Lesson>(); lessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId); lessons.Sort("LessonDate DESC"); SummaryMovie sm; foreach (Lesson l in lessons) { try { sm = DataRepository.SummaryMovieProvider.GetByLessonId(l.LessonId)[0]; if (!sm.DateRecorded.Equals(summarymovie.DateRecorded)) { summarymovies.Add(sm); } } catch (Exception ex) { } } int x = 0; foreach (SummaryMovie sms in summarymovies) { DropDownList4.Items.Add(sms.DateRecorded.ToString()); DropDownList4.Items[x].Value = sms.LessonId.ToString(); x++; } } catch (Exception) { displaysummary = false; wmpfile = string.Empty; System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true); System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true); } } else { displaysummary = false; System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true); System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true); } } if (displaysummary) { contplay.Attributes["style"] = String.Format("font-family:Arial,Helvetica sans-serif;font-size:12px;color:#000000;text-decoration:none;position:absolute;height:1181px;width:930px;"); fillerleft.Visible = true; fillercenter.Visible = true; fillerright.Visible = true; teachersummaryleft.Visible = true; teachersummarycenter.Visible = true; teachersummaryright.Visible = true; SumDivLeftPanel.Visible = true; SumDivCenterPanel.Visible = true; SummaryVideo.Visible = true; SummaryButtons.Visible = true; SummaryDropDown.Visible = true; SumDivRightPanel.Visible = true; bottomleft.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:23px;left:0px;top:1150px;"); bottomcenter.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:879px;left:24px;top:1150px;"); bottomright.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:23px;left:897px;top:1150px;"); //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "playkey", "PlayFlashMovie();", true); //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "pausekey", "PauseFlashMovie();", true); //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "stopkey", "StopFlashMovie();", true); } else { contplay.Attributes["style"] = String.Format("font-family:Arial,Helvetica sans-serif;font-size:12px;color:#000000;text-decoration:none;position:absolute;height:660px;width:930px;"); fillerleft.Visible = false; fillercenter.Visible = false; fillerright.Visible = false; teachersummaryleft.Visible = false; teachersummarycenter.Visible = false; teachersummaryright.Visible = false; SumDivLeftPanel.Visible = false; SumDivCenterPanel.Visible = false; SummaryVideo.Visible = false; SummaryButtons.Visible = false; SummaryDropDown.Visible = false; SumDivRightPanel.Visible = false; bottomleft.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:23px;left:0px;top:629px;"); bottomcenter.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:879px;left:24px;top:629px;"); bottomright.Attributes["style"] = String.Format("font-family:Arial,Helvetica,sans-serif;font-size:12px;text-decoration:none;position:absolute;height:31px;width:23px;left:897px;top:629px;"); } if (leftMovie.DateRecorded.ToShortDateString().Equals(rightMovie.DateRecorded.ToShortDateString())) { Label2.Text = leftMovie.DateRecorded.ToShortDateString(); Label5.Text = " - "; } else { Label2.Text = ""; Label5.Text = ""; } if (displaysummary) { Label4.Text = summarymovie.DateRecorded.ToShortDateString(); } }
protected void CreateLessonVideos(string strGuid, Customer customer) { TList <Lesson> lessons = new TList <Lesson>(); TList <Movie> movies = new TList <Movie>(); SummaryMovie summarymovie = new SummaryMovie(); string args = ""; string DashedName = ""; string Mp4Filename = ""; string SummaryFilename = ""; DashedName = customer.LastName.ToLower() + "-" + customer.FirstName.ToLower(); lessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId); foreach (Lesson l in lessons) { movies = DataRepository.MovieProvider.GetByLessonId(l.LessonId); foreach (Movie m in movies) { switch (m.MovieType) { case 0: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); break; case 1: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); break; case 2: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); break; case 3: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); break; } args = "-i \"G:\\SwingModelLive\\Users\\MovieFiles\\" + m.FilePath.Replace("Users/MovieFiles/", "") + "\" -y \"G:\\SwingModelLive\\Mobile\\Video\\" + Mp4Filename + "\""; ProcessStartInfo processInfo = new ProcessStartInfo(Server.MapPath("") + "\\ffmpeg.exe", args); //MessageBox.Show(processInfo.FileName); //MessageBox.Show(args); //processInfo.WindowStyle = ProcessWindowStyle.Normal; processInfo.WindowStyle = ProcessWindowStyle.Hidden; processInfo.UseShellExecute = true; Process process = new Process(); process = Process.Start(processInfo); process.WaitForExit(2000); } try { summarymovie = DataRepository.SummaryMovieProvider.GetByLessonId(l.LessonId)[0]; SummaryFilename = summarymovie.FilePath.ToLower().Replace("Users/SummaryFiles/".ToLower() + DashedName.ToLower(), strGuid); SummaryFilename = SummaryFilename.ToLower().Replace(".swf", ".mp4"); args = "-i \"G:\\SwingModelLive\\Users\\SummaryFiles\\" + summarymovie.FilePath.ToLower().Replace("Users/SummaryFiles/".ToLower(), "") + "\" -y \"G:\\SwingModelLive\\Mobile\\Video\\" + SummaryFilename + "\""; ProcessStartInfo processInfo = new ProcessStartInfo(Server.MapPath("") + "\\ffmpeg.exe", args); //MessageBox.Show(processInfo.FileName); //MessageBox.Show(args); //processInfo.WindowStyle = ProcessWindowStyle.Normal; processInfo.WindowStyle = ProcessWindowStyle.Hidden; processInfo.UseShellExecute = true; Process process = new Process(); process = Process.Start(processInfo); process.WaitForExit(2000); } catch (Exception ex) { } } return; }
protected void CreateVideosPlist(string strGuid, Customer customer) { TList <Lesson> lessons = new TList <Lesson>(); TList <Movie> movies = new TList <Movie>(); TList <MovieClip> movieclips = new TList <MovieClip>(); SummaryMovie summarymovie = new SummaryMovie(); string DashedName; string Mp4Filename; string SummaryFilename; DashedName = customer.LastName.ToLower() + "-" + customer.FirstName.ToLower(); //string path = @"C:\Projects\SwingModel\Solution\SwingModel Website\Mobile\XML\" + strGuid + "-Videos.plist"; string path = @"G:\SwingModelLive\Mobile\XML\" + strGuid + "-Videos.plist"; FileStream fs = File.Create(path); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sw.WriteLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"); sw.WriteLine("<plist version=\"1.0\">"); sw.WriteLine("<array>"); lessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId); foreach (Lesson l in lessons) { movies = DataRepository.MovieProvider.GetByLessonId(l.LessonId); foreach (Movie m in movies) { switch (m.MovieType) { case 0: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); sw.WriteLine("<string>" + Mp4Filename + "</string>"); break; case 1: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); sw.WriteLine("<string>" + Mp4Filename + "</string>"); movieclips = DataRepository.MovieClipProvider.GetByMovieId(m.MovieId); movieclips.Sort("EndFrame"); foreach (MovieClip mc in movieclips) { sw.WriteLine("<integer>" + mc.EndFrame.ToString() + "</integer>"); } break; case 2: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); sw.WriteLine("<string>" + Mp4Filename + "</string>"); break; case 3: Mp4Filename = m.FilePath.ToLower().Replace("Users/MovieFiles/".ToLower() + DashedName.ToLower(), strGuid); Mp4Filename = Mp4Filename.ToLower().Replace(".swf", ".mp4"); sw.WriteLine("<string>" + Mp4Filename + "</string>"); movieclips = DataRepository.MovieClipProvider.GetByMovieId(m.MovieId); movieclips.Sort("EndFrame"); foreach (MovieClip mc in movieclips) { sw.WriteLine("<integer>" + mc.EndFrame.ToString() + "</integer>"); } break; } } try { summarymovie = DataRepository.SummaryMovieProvider.GetByLessonId(l.LessonId)[0]; SummaryFilename = summarymovie.FilePath.ToLower().Replace("Users/SummaryFiles/".ToLower() + DashedName.ToLower(), strGuid); SummaryFilename = SummaryFilename.ToLower().Replace(".swf", ".mp4"); } catch (Exception ex) { SummaryFilename = ""; } sw.WriteLine("<string>" + SummaryFilename + "</string>"); } sw.WriteLine("</array>"); sw.WriteLine("</plist>"); sw.Close(); fs.Close(); return; }