// string ConnectionString = ConfigurationManager.ConnectionStrings["compusport.Data.ConnectionString"].ToString(); protected void Page_Load(object sender, EventArgs e) { bool AthleteAlreadyInList = false; customerid = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customerid.CustomerId)[0]; // currentUser = SiteUtils.GetCurrentSiteUser(); // mpuser = DataRepository.MpUsersProvider.GetByUserId(2); //mpuser = DataRepository.MpUsersProvider.GetByUserId(2); if (!IsPostBack) { //athletelist = DataRepository.MpUserRolesProvider.GetByRoleId(9); //userslist = DataRepository.MpUsersProvider.GetAll(); //userslist.Sort("Name"); customer = DataRepository.CustomerProvider.GetAll(); customer.Sort("FirstName"); // customer.Sort("LastName"); //customer.Sort("FirstName" + "LastName"); foreach (var item in customer) { //foreach (MpUserRoles a in athletelist) //{ // if (a.UserId == item.UserId) //{ cust = DataRepository.CustomerProvider.GetByCustomerId(item.CustomerId); // lessonlist = DataRepository.LessonProvider.GetByUserId(athlete.UserId); { if (DropDownList1.Items.Count > 0) { if (DropDownList1.Items.Contains(DropDownList1.Items.FindByValue(item.CustomerId.ToString()))) { AthleteAlreadyInList = true; } else { AthleteAlreadyInList = false; } } if (!AthleteAlreadyInList) { x++; DropDownList1.Items.Add(item.FirstName + " " + item.LastName); DropDownList1.Items[x].Value = item.CustomerId.ToString(); continue; } } } // } //} } }
protected void CreateErrorsPlist(string strGuid, Customer customer) { TList <Lesson> lessons = new TList <Lesson>(); TList <Movie> movies = new TList <Movie>(); TList <MovieClip> movieclips = new TList <MovieClip>(); TList <MovieError> movieerrors = new TList <MovieError>(); SwingErrorLookup sel = new SwingErrorLookup(); //string path = @"C:\Projects\SwingModel\Solution\SwingModel Website\Mobile\XML\" + strGuid + "-Errors.plist"; string path = @"G:\SwingModelLive\Mobile\XML\" + strGuid + "-Errors.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) { sw.WriteLine("<array>"); sw.WriteLine("<string>" + l.LessonDate.Year.ToString() + "-" + l.LessonDate.Month.ToString() + "-" + l.LessonDate.Day.ToString() + "-" + l.LessonDate.Hour.ToString() + "-" + l.LessonDate.Minute.ToString() + "</string>"); movies = DataRepository.MovieProvider.GetByLessonId(l.LessonId); movieclips = DataRepository.MovieClipProvider.GetByMovieId(movies[0].MovieId); movieclips.Sort("EndFrame"); for (int i = 0; i < 10; i++) { sw.WriteLine("<array>"); sw.WriteLine("<integer>" + (i + 1).ToString() + "</integer>"); movieerrors = DataRepository.MovieErrorProvider.GetByMovieClipId(movieclips[i].MovieClipId); if (movieerrors.Count < 1) { sw.WriteLine("<string></string>"); } else { foreach (MovieError me in movieerrors) { sel = DataRepository.SwingErrorLookupProvider.GetBySwingErrorId(me.SwingErrorId); sw.WriteLine("<string>" + sel.TextDescription + "</string>"); } } sw.WriteLine("</array>"); } sw.WriteLine("</array>"); } sw.WriteLine("</array>"); sw.WriteLine("</plist>"); sw.Close(); fs.Close(); return; }
//protected override void OnPreLoad(EventArgs e) //{ // if (Page.User.Identity.IsAuthenticated) // { // try // { // customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; // customerexists = true; // } // catch // { // //no entry in Customer table for current member // customerexists = false; // } // } //} //protected override void OnPreRender(EventArgs e) //{ // CheckProfiles myCheckProfiles = new CheckProfiles(); // //MessageBox.Show(Convert.ToString(myCheckProfiles.Personal())); // //MessageBox.Show(Convert.ToString(myCheckProfiles.Address())); // //MessageBox.Show(Convert.ToString(myCheckProfiles.Contact())); // //if (this.User.Identity.IsAuthenticated) // //{ // if (!myCheckProfiles.Personal()) // { // //MessageBox.Show("1a"); // this.Page.Response.Redirect("~/Users/MyAccount.aspx"); // } // if (!myCheckProfiles.Address()) // { // if (myCheckProfiles.Personal() && myCheckProfiles.Facility()) // { // //MessageBox.Show("2a"); // this.Page.Response.Redirect("~/Users/MyAccount.aspx"); // } // } // if (!myCheckProfiles.Facility()) // { // if (myCheckProfiles.Personal() && myCheckProfiles.Address()) // { // //MessageBox.Show("3a"); // this.Page.Response.Redirect("~/Users/MyAccount.aspx"); // } // } // if (!myCheckProfiles.Dimensions()) // { // if (myCheckProfiles.Personal() && myCheckProfiles.Address() && myCheckProfiles.Facility()) // { // //MessageBox.Show("4a"); // this.Page.Response.Redirect("~/Users/MyDimensions.aspx"); // } // } // if (!myCheckProfiles.Golf()) // { // if (myCheckProfiles.Personal() && myCheckProfiles.Address() && myCheckProfiles.Facility() && myCheckProfiles.Dimensions()) // { // //MessageBox.Show("5a"); // this.Page.Response.Redirect("~/Users/MyGolf.aspx"); // } // } // //} //} protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Image1.Visible = false; Label1.Visible = false; FileUpload1.Visible = false; Label5.Visible = false; Label6.Visible = false; Label7.Visible = false; Label2.Visible = false; Label3.Visible = false; } customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; teacher = DataRepository.TeacherProvider.GetByAspnetMembershipUserId(customer.AspnetMembershipUserId)[0]; customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0]; customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite); // Label1.Text = customersite.SiteName; teachersatsite = DataRepository.TeacherSiteProvider.GetBySiteId(customerprofile.CustomerSite); teachersatsite.Sort("TeacherId ASC"); if (DropDownList1.Items.Count.Equals(0)) { DropDownList1.Items.Clear(); DropDownList1.Items.Add("Make a Selection"); DropDownList1.Items[0].Value = "-1"; int x = 0; foreach (TeacherSite ts in teachersatsite) { x++; string userrolename = string.Empty; teacher = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId); CoachSearched = DataRepository.TeacherProvider.GetByTeacherId(teacher.TeacherId); Guid MemGuid = new Guid(CoachSearched.AspnetMembershipUserId.ToString()); MembershipUser user = Membership.GetUser(MemGuid); string[] userrole = Roles.GetRolesForUser(user.UserName); userrolename = userrole[0]; if (userrolename != "Athletes") { DropDownList1.Items.Add(teacher.FirstName + " " + teacher.LastName); DropDownList1.Items[x].Value = teacher.TeacherId.ToString(); } } } }
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); } }
protected void Page_Load(object sender, EventArgs e) { bool AthleteAlreadyInList = false; customerid = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customerid.CustomerId)[0]; if (!IsPostBack) { customer = DataRepository.CustomerProvider.GetAll(); customer.Sort("FirstName"); foreach (var item in customer) { cust = DataRepository.CustomerProvider.GetByCustomerId(item.CustomerId); { if (DropDownList1.Items.Count > 0) { if (DropDownList1.Items.Contains(DropDownList1.Items.FindByValue(item.CustomerId.ToString()))) { AthleteAlreadyInList = true; } else { AthleteAlreadyInList = false; } } if (!AthleteAlreadyInList) { x++; DropDownList1.Items.Add(item.FirstName + " " + item.LastName); DropDownList1.Items[x].Value = item.CustomerId.ToString(); continue; } } } } }
private TList <Movie> GetMovies(int lessonTypeId) { TList <Movie> movies = new TList <Movie>(); DataRepository.CustomerProvider.DeepLoad(customer); LessonQuery lessonQuery = new LessonQuery(); lessonQuery.AppendEquals(string.Empty, LessonColumn.CustomerId, customer.CustomerId.ToString()); lessonQuery.AppendEquals("AND", LessonColumn.LessonTypeId, lessonTypeId.ToString()); TList <Lesson> lessons = DataRepository.LessonProvider.Find(lessonQuery.GetParameters()); foreach (Lesson l in lessons) { DataRepository.LessonProvider.DeepLoad(l); foreach (Movie m in l.MovieCollection) { DataRepository.MovieProvider.DeepLoad(m); movies.Add(m); } } // movies.Sort("MovieType ASC, DateRecorded DESC"); movies.Sort("DateRecorded DESC"); return(movies); }
/// <summary> /// Build object to string result /// </summary> /// <param name="lstRosters"></param> /// <param name="date"></param> /// <returns></returns> private static object BuildListSection(TList<Roster> lstRosters, DateTime? date) { object lst = null; try { DataRepository.RosterProvider.DeepLoad(lstRosters); // Lay danh sach doctor theo appointment var lstDoctor = new TList<Users>(); // Lay danh sach service theo appointment var lstService = new TList<Services>(); foreach (var roster in lstRosters) { Roster roster1 = roster; if (!lstDoctor.Exists(doctor => doctor.Username == roster1.Username)) { lstDoctor.Add(roster.UsernameSource); } lstDoctor.Sort((p1, p2) => p1.DisplayName.CompareTo(p2.DisplayName)); DataRepository.UsersProvider.DeepLoad(roster1.UsernameSource); if (!lstService.Exists(service => service.Id == roster1.UsernameSource.ServicesId)) { lstService.Add(DataRepository.ServicesProvider.GetById(Convert.ToInt32(roster1.UsernameSource.ServicesId))); } } // Sort theo priority lstService.Sort("PriorityIndex ASC"); var dtStart = Convert.ToDateTime(date); var dtEnd = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 23, 59, 59); dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day); lst = lstService.Select(service => new { service.Id, Title = string.IsNullOrEmpty(service.ShortTitle) ? service.Title : service.ShortTitle, Date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", date), Doctors = lstDoctor.Where(doctor => doctor.ServicesId == service.Id) .Select(doctor => new { key = doctor.Username, label = doctor.DisplayName, Rosters = lstRosters.Where(roster => roster.Username == doctor.Username) .Select(roster => new { startTime = (roster.StartTime < dtStart ? dtStart : roster.StartTime).ToString("MM-dd-yyyy HH:mm:ss"), endTime = (roster.EndTime > dtEnd ? dtEnd : roster.EndTime).ToString("MM-dd-yyyy HH:mm:ss"), color = roster.RosterTypeIdSource.ColorCode }).ToList() }).ToList() }).ToList(); } catch (Exception ex) { LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient()); } return lst; }
protected void Page_Load(object sender, EventArgs e) { TList <RegionLookup> regions = new TList <RegionLookup>(); TList <CustomerSite> customersites = new TList <CustomerSite>(); CountryLookup countrylookup = new CountryLookup(); StateProvince sp = new StateProvince(); Teacher hi = new Teacher(); TList <TeacherSite> facilityteachers = new TList <TeacherSite>(); string[] roles = Roles.GetAllRoles(); int i = 0; regions = DataRepository.RegionLookupProvider.GetByUs(1); foreach (RegionLookup r in regions) { i++; System.Web.UI.WebControls.Label lblHeader = new System.Web.UI.WebControls.Label(); System.Web.UI.WebControls.Label lblContent = new System.Web.UI.WebControls.Label(); lblHeader.Text = r.RegionName; customersites = DataRepository.CustomerSiteProvider.GetByRegion(r.RegionId); customersites.Sort("SiteName"); lblContent.Text = ""; #region [commented] /*foreach (CustomerSite cs in customersites) * { * lblContent.Text = lblContent.Text + "<b>" + cs.SiteName + "</b><br>" + cs.Address1 + "<br>"; + try + { + if (!cs.Address2.Equals("") && !cs.Address2.Equals(null)) + lblContent.Text = lblContent.Text + cs.Address2 + "<br>"; + } + catch (Exception ex) + { + } + sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince)); + lblContent.Text = lblContent.Text + cs.City + " " + sp.StateProvinceAbbvr + " " + cs.ZipCode + "<br>"; + + lblContent.Text = lblContent.Text + "<br>"; + }*/ #endregion [commented] foreach (CustomerSite cs in customersites) { if (cs.CustomerSiteId != 15) { if (cs.IsApproved.Equals(1) && !cs.CustomerSiteId.Equals(9)) { facilityteachers = DataRepository.TeacherSiteProvider.GetBySiteId(cs.CustomerSiteId); foreach (TeacherSite ts in facilityteachers) { try { string userrolename = string.Empty; hi = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId); // hi = DataRepository.TeacherProvider.GetByTeacherId(cs.FacilityAdministratorId); Guid MemGuid = new Guid(hi.AspnetMembershipUserId.ToString()); MembershipUser user = Membership.GetUser(MemGuid); string[] userrole = Roles.GetRolesForUser(user.UserName); userrolename = userrole[0]; if (userrolename != "Athletes") { if (userrolename == "Teachers") { userrolename = "Coach"; } lblContent.Text = lblContent.Text + "<table><tr><td colspan=5>" + "<b>" + cs.SiteName + "</b></td>" + "<tr><td width=300 valign=top>" + cs.Address1 + "<br>"; // try { if (!cs.Address2.Equals("") && !cs.Address2.Equals(null)) { lblContent.Text = lblContent.Text + cs.Address2 + "<br>"; } } catch (Exception ex) { } if ((cs.StateProvince != string.Empty) || (cs.StateProvince != null)) { sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince)); } else { cs.StateProvince = ""; } // sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince)); if (cs.StateProvince.Equals("-1")) { lblContent.Text = lblContent.Text + cs.City + " " + cs.ZipCode + "</td>"; } else { lblContent.Text = lblContent.Text + cs.City + " " + sp.StateProvinceAbbvr + " " + cs.ZipCode + "</td>"; } lblContent.Text = lblContent.Text + "<td width=180 align=right valign=top><font color=black>" + userrolename + ":<br>Website:</font></td>"; lblContent.Text = lblContent.Text + "<td width=180 valign=top> <a href=../Contact/CoachProfile.aspx?teacherid=" + hi.TeacherId.ToString() + ">" + hi.FirstName + " " + hi.LastName + "</a>"; if (cs.Website.Equals("-1")) { lblContent.Text = lblContent.Text + "<br>None</td>"; } else { lblContent.Text = lblContent.Text + "<br><a href=http://" + cs.Website + " target=_blank>click here</a></td>"; } lblContent.Text = lblContent.Text + //"<td width=180 align=right valign=top><font color=black>Schedule Lesson:" "<td width=180 align=right valign=top><font color=black> <br>Email Coach:</font></td>"; lblContent.Text = lblContent.Text + //<a href=../Contact/ScheduleLesson.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a>" "<td width=100><a href=../Contact/EmailTeacher.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a></td></tr>"; lblContent.Text = lblContent.Text + "</table>"; } } catch (Exception ex) { } } } } } AjaxControlToolkit.AccordionPane ap2 = new AjaxControlToolkit.AccordionPane(); ap2.ID = "dynPane" + i.ToString(); if (lblHeader.Text != "Alaska & Hawaii") { ap2.HeaderContainer.Controls.Add(lblHeader); ap2.ContentContainer.Controls.Add(lblContent); Accordion2.Panes.Add(ap2); } } i = 0; regions = DataRepository.RegionLookupProvider.GetByUs(0); foreach (RegionLookup r in regions) { i++; System.Web.UI.WebControls.Label lblHeader2 = new System.Web.UI.WebControls.Label(); System.Web.UI.WebControls.Label lblContent2 = new System.Web.UI.WebControls.Label(); lblHeader2.Text = r.RegionName; customersites = DataRepository.CustomerSiteProvider.GetByRegion(r.RegionId); customersites.Sort("SiteName"); lblContent2.Text = ""; foreach (CustomerSite cs in customersites) { facilityteachers = DataRepository.TeacherSiteProvider.GetBySiteId(cs.CustomerSiteId); foreach (TeacherSite ts in facilityteachers) { try { string userrolename = string.Empty; hi = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId); Guid MemGuid = new Guid(hi.AspnetMembershipUserId.ToString()); MembershipUser user = Membership.GetUser(MemGuid); string[] userrole = Roles.GetRolesForUser(user.UserName); userrolename = userrole[0]; if (userrolename != "Athletes") { if (userrolename == "Teachers") { userrolename = "Coach"; } if (cs.IsApproved.Equals(1) && !cs.CustomerSiteId.Equals(9)) { lblContent2.Text = lblContent2.Text + "<table><tr><td colspan=5>" + "<b>" + cs.SiteName + "</b></td>" + "<tr><td width=300 valign=top>" + cs.Address1 + "<br>"; //; try { if (!cs.Address2.Equals("") && !cs.Address2.Equals(null)) { lblContent2.Text = lblContent2.Text + cs.Address2; } //+"<br>"; } catch (Exception ex) { } //sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince)); if ((cs.StateProvince.Equals(string.Empty) || cs.StateProvince.Equals(null))) { countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(cs.Country); } else { if (cs.Country == 41) { sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(int.Parse(cs.StateProvince)); } } if ((cs.StateProvince.Equals("-1")) || (cs.StateProvince.Equals(string.Empty)) || (cs.StateProvince.Equals(null))) { lblContent2.Text = lblContent2.Text + cs.City + " " + countrylookup.CountryName + " " + cs.ZipCode + "</td>"; } else { lblContent2.Text = lblContent2.Text + cs.City + " " + sp.StateProvinceName + " " + cs.ZipCode + "</td>"; } lblContent2.Text = lblContent2.Text + "<td width=180 align=right valign=top><font color=black>" + userrolename + ":<br>Website:</font></td>"; lblContent2.Text = lblContent2.Text + "<td width=180 valign=top> <a href=../Contact/CoachProfile.aspx?teacherid=" + hi.TeacherId.ToString() + ">" + hi.FirstName + " " + hi.LastName + "</a>"; if (cs.Website.Equals("-1")) { lblContent2.Text = lblContent2.Text + "<br>None</td>"; } else { lblContent2.Text = lblContent2.Text + "<br><a href=http://" + cs.Website + " target=_blank>click here</a></td>"; } lblContent2.Text = lblContent2.Text + "<td width=180 align=right valign=top><br>Email Coach:</font></td>"; //<font color=black>Schedule Lesson:"+ lblContent2.Text = lblContent2.Text + // //<a href=mailto:[email protected]?subject=Support%20Inquiry + cs.CustomerSiteId.ToString() + >click here</a>" //"<td width=100><br><a href=mailto:[email protected]?subject=Support%20Inquiry + cs.CustomerSiteId.ToString() + >click here</a></td></tr>"; "<td width=100><a href=../Contact/EmailTeacher.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a></td></tr>"; lblContent2.Text = lblContent2.Text + "</table>"; } } } catch (Exception ex) { } } } AjaxControlToolkit.AccordionPane ap3 = new AjaxControlToolkit.AccordionPane(); ap3.ID = "dynPane" + i.ToString(); if (lblHeader2.Text != "India" && lblHeader2.Text != "Antarctica" && lblHeader2.Text != "Russia" && lblHeader2.Text != "Greenland" && lblHeader2.Text != "Caribbean" && lblHeader2.Text != "Central & South America") { ap3.HeaderContainer.Controls.Add(lblHeader2); ap3.ContentContainer.Controls.Add(lblContent2); Accordion4.Panes.Add(ap3); } } }
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(); } }
private void LoadRightDropDown() { TList <Movie> movies = GetMovies(int.Parse(DropDownList2.SelectedValue)); if (DropDownList3.Items.Count > 0) { DropDownList3.Items.Clear(); } movies.Sort("DateRecorded DESC"); if (DropDownList1.SelectedItem.Text.EndsWith("Side View – Initial")) // for 0 { foreach (Movie m in movies) { if (m.MovieType == 1 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View – Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 0 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Side View – Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } if (m.MovieType == 2 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Side View – Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } } //if (DropDownList1.SelectedItem.Text.EndsWith("Back View - Initial")) // for 1 if (DropDownList1.SelectedItem.Text.EndsWith("Back View – Initial")) // for 1 { foreach (Movie m in movies) { if (m.MovieType == 3 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View - Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 1 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View - Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 1 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Back View – Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } if (m.MovieType == 3 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Back View - Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } } if (DropDownList1.SelectedItem.Text.EndsWith("Side View – Final")) // for 2 { foreach (Movie m in movies) { if (m.MovieType == 3 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View - Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 2 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Side View – Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } if (m.MovieType == 0 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Side View – Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } } if (DropDownList1.SelectedItem.Text.EndsWith("Back View - Final")) // for 3 { foreach (Movie m in movies) { if (m.MovieType == 3 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View - Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 1 && m != leftMovie && m.DateRecorded.Equals(leftMovie.DateRecorded)) { ListItem item = new ListItem(m.DateRecorded + " Back View - Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } foreach (Movie m in movies) { if (m.MovieType == 1 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Back View – Initial", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } if (m.MovieType == 3 && m != leftMovie) { ListItem item = new ListItem(m.DateRecorded + " Back View - Final", m.MovieId.ToString(), true); DropDownList3.Items.Add(item); } } } if (DropDownList3.Items.Count > 0) { DropDownList3.SelectedIndex = 0; rightMovie = DataRepository.MovieProvider.GetByMovieId(int.Parse(DropDownList3.SelectedValue)); } }
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; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { teacher = DataRepository.TeacherProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; // customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(teacher.TeacherId)[0]; try { var Data = DataRepository.CustomerProfileProvider.GetByCustomerId(teacher.TeacherId); if (Data.Count > 0) { customerprofile = Data[0]; } } catch (Exception ex) { var error = ex.Message; } } catch (Exception ex) { var error = ex.Message; } siteid = DataRepository.TeacherSiteProvider.GetByTeacherId(teacher.TeacherId)[0]; teachersatsite = DataRepository.TeacherSiteProvider.GetBySiteId(siteid.SiteId); //Label1.Text = customersite.SiteName; //teachersatsite = DataRepository.TeacherSiteProvider.GetBySiteId(customerprofile.CustomerSite); //teachersatsite = DataRepository.TeacherSiteProvider.GetAll(); teachersatsite.Sort("TeacherId ASC"); string logusrname1 = User.Identity.Name; if (DropDownList1.Items.Count.Equals(0)) { DropDownList1.Items.Clear(); DropDownList1.Items.Add("Make a Selection"); DropDownList1.Items[0].Value = "-1"; foreach (TeacherSite ts in teachersatsite) { teacher = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId); Guid MemGuid = new Guid(teacher.AspnetMembershipUserId.ToString()); MembershipUser user = Membership.GetUser(MemGuid); string[] userrole = Roles.GetRolesForUser(user.UserName); string userrolename = string.Empty; userrolename = userrole[0]; if (userrolename != "Athletes") { if (DropDownList1.Items.Count > 0) { if (DropDownList1.Items.Contains(DropDownList1.Items.FindByValue(teacher.TeacherId.ToString()))) { AthleteAlreadyInList = true; } else { AthleteAlreadyInList = false; } } if (!AthleteAlreadyInList) { x++; DropDownList1.Items.Add(teacher.FirstName + " " + teacher.LastName); DropDownList1.Items[x].Value = teacher.TeacherId.ToString(); } } } } } }
public static void Init(RepositoryItemCheckedComboBoxEdit repo, CheckState check, LoaiDuLieu loai) { repo.SelectAllItemCaption = "[Tất cả]"; repo.TextEditStyle = TextEditStyles.Standard; repo.Items.Clear(); List <CheckedListBoxItem> _list = new List <CheckedListBoxItem>(); _list.Add(new CheckedListBoxItem(-1, "[Không xét]")); switch (loai) { case LoaiDuLieu.BacDaoTao: VList <ViewBacDaoTao> _vBacDaoTao = new VList <ViewBacDaoTao>(); _vBacDaoTao = DataServices.ViewBacDaoTao.GetAll(); _vBacDaoTao.Sort("TenBacDaoTao"); foreach (ViewBacDaoTao v in _vBacDaoTao) { _list.Add(new CheckedListBoxItem(v.MaBacDaoTao, v.TenBacDaoTao, check, true)); } break; case LoaiDuLieu.ChucVu: TList <ChucVu> _tChucVu = new TList <ChucVu>(); _tChucVu = DataServices.ChucVu.GetAll(); _tChucVu.Sort("TenChucVu"); foreach (ChucVu t in _tChucVu) { _list.Add(new CheckedListBoxItem(t.MaChucVu, t.TenChucVu, check, true)); } break; case LoaiDuLieu.HocHam: TList <HocHam> _tHocHam = new TList <HocHam>(); _tHocHam = DataServices.HocHam.GetAll(); _tHocHam.Sort("TenHocHam"); foreach (HocHam t in _tHocHam) { _list.Add(new CheckedListBoxItem(t.MaHocHam, t.TenHocHam, check, true)); } break; case LoaiDuLieu.HocVi: TList <HocVi> _tHocVi = new TList <HocVi>(); _tHocVi = DataServices.HocVi.GetAll(); _tHocVi.Sort("TenHocVi"); foreach (HocVi t in _tHocVi) { _list.Add(new CheckedListBoxItem(t.MaHocVi, t.TenHocVi, check, true)); } break; case LoaiDuLieu.HinhThucDangKy: TList <HinhThucDaoTao> _tHinhThucDangKy = new TList <HinhThucDaoTao>(); _tHinhThucDangKy = DataServices.HinhThucDaoTao.GetAll(); _tHinhThucDangKy.Sort("TenHinhThucDaoTao"); foreach (HinhThucDaoTao t in _tHinhThucDangKy) { _list.Add(new CheckedListBoxItem(t.MaHinhThucDaoTao, t.TenHinhThucDaoTao, check, true)); } break; case LoaiDuLieu.LoaiGiangVien: TList <LoaiGiangVien> _tLoaiGiangVien = new TList <LoaiGiangVien>(); _tLoaiGiangVien = DataServices.LoaiGiangVien.GetAll(); _tLoaiGiangVien.Sort("TenLoaiGiangVien"); foreach (LoaiGiangVien t in _tLoaiGiangVien) { _list.Add(new CheckedListBoxItem(t.MaLoaiGiangVien, t.TenLoaiGiangVien, check, true)); } break; case LoaiDuLieu.LoaiNhanVien: TList <LoaiNhanVien> _tLoaiNhanVien = new TList <LoaiNhanVien>(); _tLoaiNhanVien = DataServices.LoaiNhanVien.GetAll(); _tLoaiNhanVien.Sort("TenLoaiNhanVien"); foreach (LoaiNhanVien t in _tLoaiNhanVien) { _list.Add(new CheckedListBoxItem(t.MaLoaiNhanVien, t.TenLoaiNhanVien, check, true)); } break; case LoaiDuLieu.NgachLuong: TList <NgachCongChuc> _tNgachCongChuc = new TList <NgachCongChuc>(); _tNgachCongChuc = DataServices.NgachCongChuc.GetAll(); _tNgachCongChuc.Sort("MaQuanLy"); foreach (NgachCongChuc t in _tNgachCongChuc) { _list.Add(new CheckedListBoxItem(t.MaQuanLy, t.MaQuanLy + " - " + t.TenNgach, check, true)); } break; default: return; } repo.Items.AddRange(_list.ToArray()); repo.SeparatorChar = ';'; //Toàn bộ repo đều có chung kiểu Validate: repo.Validating += new System.ComponentModel.CancelEventHandler(repositoryItemCheckedComboBoxEditLoaiNhanVien_Validating); }