private void bindDropDownLists() { #region Bind Default Child Data msClass.Items.Add(new ListItem("Null", "Null")); DojoClassManager _classManager = new DojoClassManager(); DojoClassCollection _classCollection = _classManager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass _class in _classCollection) { ListItem i = new ListItem(_class.ToString(), _class.ID.ToString()); msClass.Items.Add(i); } msMember.Items.Add(new ListItem("Null", "Null")); DojoMemberManager memberManager = new DojoMemberManager(); DojoMemberCollection memberCollection = memberManager.GetCollection(string.Empty, string.Empty, null); foreach (DojoMember member in memberCollection) { ListItem i = new ListItem(member.ToString(), member.ID.ToString()); msMember.Items.Add(i); } msRank.Items.Add(new ListItem("Null", "Null")); DojoRankManager rankManager = new DojoRankManager(); DojoRankCollection rankCollection = rankManager.GetCollection(string.Empty, string.Empty, null); foreach (DojoRank rank in rankCollection) { ListItem i = new ListItem(rank.ToString(), rank.ID.ToString()); msRank.Items.Add(i); } #endregion }
public DojoClassCollection RequestClasses(DateTime start, DateTime end) { DojoClassCollection results = new DojoClassCollection(); DojoClassManager m = new DojoClassManager(); DojoClassCollection classes = m.GetCollection("ClassStart>=#" + start.ToString() + "# AND ClassEnd<=#" + end.ToString() + "#", "ClassStart", null); return(classes); }
protected override void OnPreRender(EventArgs e) { DojoClassManager cManager; DojoAttendanceEntryManager aManager; string classQuery; string attendanceQuery; EnsureChildControls(); if (this.backTime == TimeSpan.Zero) { classQuery = "SigninEnd>=#" + localTime.Subtract(backTime).ToString() + "# AND " + "SigninStart<=#" + localTime.ToString() + "#"; } else { classQuery = "ClassEnd>=#" + localTime.Subtract(backTime).Date.ToString() + "# AND " + "ClassStart<=#" + localTime.AddDays(1).Date.ToString() + "#"; } attendanceQuery = "MemberID=" + memberID.ToString() + " AND " + classQuery; cManager = new DojoClassManager(); aManager = new DojoAttendanceEntryManager();; // Be sure to adjust the backtime if you want earlier signin times. classes = cManager.GetCollection(classQuery, "ClassStart", DojoClassFlags.Instructor, DojoClassFlags.InstructorRank, DojoClassFlags.InstructorPrivateContact); classIdArray = new string[classes.Count]; for (int x = 0; x < classes.Count; x++) { classIdArray[x] = classes[x].iD.ToString(); } Page.ClientScript.RegisterHiddenField("___" + ClientID + "Classes", string.Join(",", classIdArray)); attendance = aManager.GetCollection(attendanceQuery, string.Empty, DojoAttendanceEntryFlags.Class); }
public DojoClassCollection Clone() { DojoClassCollection clonedDojoClass = new DojoClassCollection(count); lock (this) { foreach (DojoClass item in this) { clonedDojoClass.Add(item); } } return(clonedDojoClass); }
private void bind() { #region Bind Default Child Data DojoClassManager _classManager = new DojoClassManager(); DojoClassCollection _classCollection = _classManager.GetCollection(string.Empty, string.Empty, null); ComponentArt.Web.UI.ComboBoxItem ClassNullItem = new ComponentArt.Web.UI.ComboBoxItem(); ClassNullItem.Text = "Null"; ClassNullItem.Value = "Null"; comboClass.Items.Add(ClassNullItem); foreach (DojoClass _class in _classCollection) { ComponentArt.Web.UI.ComboBoxItem i = new ComponentArt.Web.UI.ComboBoxItem(); i.Text = _class.ToString(); i.Value = _class.ID.ToString(); comboClass.Items.Add(i); } DojoMemberManager memberManager = new DojoMemberManager(); DojoMemberCollection memberCollection = memberManager.GetCollection(string.Empty, string.Empty, null); ComponentArt.Web.UI.ComboBoxItem MemberNullItem = new ComponentArt.Web.UI.ComboBoxItem(); MemberNullItem.Text = "Null"; MemberNullItem.Value = "Null"; comboMember.Items.Add(MemberNullItem); foreach (DojoMember member in memberCollection) { ComponentArt.Web.UI.ComboBoxItem i = new ComponentArt.Web.UI.ComboBoxItem(); i.Text = member.ToString(); i.Value = member.ID.ToString(); comboMember.Items.Add(i); } DojoRankManager rankManager = new DojoRankManager(); DojoRankCollection rankCollection = rankManager.GetCollection(string.Empty, string.Empty, null); ComponentArt.Web.UI.ComboBoxItem RankNullItem = new ComponentArt.Web.UI.ComboBoxItem(); RankNullItem.Text = "Null"; RankNullItem.Value = "Null"; comboRank.Items.Add(RankNullItem); foreach (DojoRank rank in rankCollection) { ComponentArt.Web.UI.ComboBoxItem i = new ComponentArt.Web.UI.ComboBoxItem(); i.Text = rank.ToString(); i.Value = rank.ID.ToString(); comboRank.Items.Add(i); } #endregion }
/// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void RenderContent(HtmlTextWriter output) { DojoClassManager m = new DojoClassManager(); DojoClassCollection dojoClassCollection = m.GetCollection(string.Empty, string.Empty, null); // Render Header Row this.headerLockEnabled = true; RenderRow(this.HeaderRowCssClass, ); bool rowflag = false; string rowCssClass; // // Render Records // foreach (DojoClass dojoClass in dojoClassCollection) { if (rowflag) { rowCssClass = defaultRowCssClass; } else { rowCssClass = alternateRowCssClass; } rowflag = !rowflag; output.WriteBeginTag("tr"); output.WriteAttribute("i", dojoClass.ID.ToString()); output.WriteLine(HtmlTextWriter.TagRightChar); output.Indent++; output.Indent--; output.WriteEndTag("tr"); output.WriteLine(); } }
/// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void RenderContent(HtmlTextWriter output) { IFormatProvider enFormat = new System.Globalization.CultureInfo("en-US", true); // Attendance Index int attendanceIndex = 0; // The current attendance entry int attendanceIndexMonth = 0; // The current attendance entry at beginning of month int classIndex = 0; // The current class int classIndexMonth = 0; // The current class at beginning of month int year = DateTime.Now.Year; // This year in an integer // Classes DojoAttendanceEntryCollection attendance = null; DojoClassCollection classes = null; // Start card at beginning of year DateTime startDate = DateTime.Parse("1/1/" + year.ToString(), enFormat); // Start times for classes every day DateTime testDateLow = startDate; DateTime testDateHigh = startDate; string[] startStrings = __classTimes.Split('|'); DateTime[] startTimes = new DateTime[startStrings.Length]; TimeSpan[] startSpansBack = new TimeSpan[startStrings.Length]; TimeSpan[] startSpansFor = new TimeSpan[startStrings.Length]; // Parse class string for (int i = 0; i < startTimes.Length; i++) { string[] temp = startStrings[i].Split(','); startTimes[i] = DateTime.Parse(temp[0]); // initialize start spans if (temp.Length > 2) { startSpansFor[i] = TimeSpan.FromMinutes(double.Parse(temp[1])); startSpansBack[i] = TimeSpan.FromMinutes(double.Parse(temp[2])); } else if (temp.Length > 1) { startSpansFor[i] = TimeSpan.FromMinutes(double.Parse(temp[1])); startSpansBack[i] = TimeSpan.Zero; } else { startSpansFor[i] = TimeSpan.Zero; startSpansBack[i] = TimeSpan.Zero; } } // Load member DojoMember m = new DojoMember(__memberID); // Load member's attendance DojoAttendanceEntryManager aem = new DojoAttendanceEntryManager(); attendance = aem.GetCollection("MemberID=" + __memberID + " AND ClassStart>#1/1/" + year.ToString() + "#" + " AND ClassStart<#1/1/" + (year + 1).ToString() + "#", "ClassStart", DojoAttendanceEntryFlags.Class); if (__fillBlanks) { // Load classes DojoClassManager cm = new DojoClassManager(); classes = cm.GetCollection("ClassStart>#1/1/" + year.ToString() + "#" + " AND ClassStart<#1/1/" + (year + 1).ToString() + "#", "ClassStart", null); } // If there is no attendance, display no attendance error if (attendance.Count == 0) { output.WriteFullBeginTag("tr"); output.WriteFullBeginTag("td"); output.Write("No Attendance"); output.WriteEndTag("td"); output.WriteEndTag("tr"); output.WriteLine(); return; } #region Classes From January to December for (int month = 1; month <= 12; month++) { output.WriteFullBeginTag("tr"); // Class Column output.WriteBeginTag("td"); if (this.SubHeaderCssClass != string.Empty) { output.WriteAttribute("class", this.SubHeaderCssClass); } if (this.__dateCellWidth != Unit.Empty) { output.WriteAttribute("width", this.__dateCellWidth.ToString()); } if (this.__dateCellHeight != Unit.Empty) { output.WriteAttribute("height", this.__dateCellHeight.ToString()); } output.Write(HtmlTextWriter.TagRightChar); output.Write(DateTime.Parse(month.ToString() + "/1/2005", enFormat).ToString("MMMM")); output.WriteEndTag("td"); // Days Columns for (int day = 1; day <= 31; day++) { if (day > DateTime.DaysInMonth(year, month)) { output.WriteBeginTag("td"); if (this.SubHeaderCssClass != string.Empty) { output.WriteAttribute("class", this.SubHeaderCssClass); } if (this.__dateCellWidth != Unit.Empty) { output.WriteAttribute("width", this.__dateCellWidth.ToString()); } if (this.__dateCellHeight != Unit.Empty) { output.WriteAttribute("height", this.__dateCellHeight.ToString()); } output.Write(HtmlTextWriter.TagRightChar); output.Write(" "); output.WriteEndTag("td"); continue; } output.WriteBeginTag("td"); if (this.SubHeaderCssClass != string.Empty) { output.WriteAttribute("class", this.SubHeaderCssClass); } if (this.__dateCellWidth != Unit.Empty) { output.WriteAttribute("width", this.__dateCellWidth.ToString()); } if (this.__dateCellHeight != Unit.Empty) { output.WriteAttribute("height", this.__dateCellHeight.ToString()); } output.Write(HtmlTextWriter.TagRightChar); output.Write(day.ToString("##00")); output.WriteEndTag("td"); } output.WriteEndTag("tr"); output.WriteLine(); attendanceIndexMonth = attendanceIndex; classIndexMonth = classIndex; // Class Column and Class Rows for (int iClass = 0; iClass < startTimes.Length; iClass++) { attendanceIndex = attendanceIndexMonth; classIndex = classIndexMonth; output.WriteFullBeginTag("tr"); // Class Title output.WriteFullBeginTag("td"); output.Write(startTimes[iClass].ToString("hh:mm tt")); output.WriteEndTag("td"); for (int day = 1; day <= 31; day++) { if (day > DateTime.DaysInMonth(year, month)) { output.WriteBeginTag("td"); if (this.__blankCellCssClass != string.Empty) { output.WriteAttribute("class", this.__blankCellCssClass); } if (this.__dateCellWidth != Unit.Empty) { output.WriteAttribute("width", this.__dateCellWidth.ToString()); } if (this.__dateCellHeight != Unit.Empty) { output.WriteAttribute("height", this.__dateCellHeight.ToString()); } output.Write(HtmlTextWriter.TagRightChar); output.Write(" "); output.WriteEndTag("td"); continue; } testDateLow = DateTime.Parse(month.ToString() + "/" + day.ToString() + "/" + year.ToString() + " " + startTimes[iClass].Hour.ToString("00") + ":" + startTimes[iClass].Minute.ToString("00"), enFormat); testDateHigh = testDateLow.Add(startSpansFor[iClass]); // set high test date testDateLow = testDateLow.Subtract(startSpansBack[iClass]); // set low test date // Make sure attendance examined is equal to or more than the test date while (attendance[attendanceIndex].Class.ClassStart < testDateLow && attendanceIndex + 1 < attendance.Count) { attendanceIndex++; } // Make sure classes examined is equal to or more than the test date while (classes[classIndex].ClassStart < testDateLow && classIndex + 1 < classes.Count) { classIndex++; } output.WriteBeginTag("td"); if (this.__fillBlanks && !dateCheck(classes[classIndex].ClassStart, testDateLow, testDateHigh) && this.__blankCellCssClass != string.Empty) { output.WriteAttribute("class", __blankCellCssClass); } else if (this.__fillBlanks && classes[classIndex].Instructor.ID == this.__memberID && this.__instructorCellCssClass != string.Empty) { output.WriteAttribute("class", __instructorCellCssClass); } else if (this.__fillBlanks && classes[classIndex].ParentSeminar != null && this.__seminarCellCssClass != string.Empty) { output.WriteAttribute("class", __seminarCellCssClass); } else if (this.__dateCellCssClass != string.Empty) { output.WriteAttribute("class", this.__dateCellCssClass); } if (this.__dateCellWidth != Unit.Empty) { output.WriteAttribute("width", this.__dateCellWidth.ToString()); } if (this.__dateCellHeight != Unit.Empty) { output.WriteAttribute("height", this.__dateCellHeight.ToString()); } output.Write(HtmlTextWriter.TagRightChar); // Now that we have the record closest to the month and date // check to see if it is on the month date and time of the start time, // if it is, display a tick mark, if not an empty if (dateCheck(attendance[attendanceIndex].Class.ClassStart, testDateLow, testDateHigh)) { if (attendance[attendanceIndex].Class.Instructor.ID == this.__memberID) { output.Write("I"); } else { output.Write("X"); } } else { output.Write(" "); } output.WriteEndTag("td"); } output.WriteEndTag("tr"); output.WriteLine(); } #endregion } #region Legend output.WriteFullBeginTag("tr"); output.WriteBeginTag("td"); output.Write(HtmlTextWriter.TagRightChar); output.Write("Legend"); output.WriteEndTag("td"); output.WriteBeginTag("td"); if (this.__blankCellCssClass != string.Empty) { output.WriteAttribute("class", __blankCellCssClass); } output.WriteAttribute("colspan", "6"); output.Write(HtmlTextWriter.TagRightChar); output.Write("No Class"); output.WriteEndTag("td"); output.WriteBeginTag("td"); output.WriteAttribute("colspan", "6"); output.Write(HtmlTextWriter.TagRightChar); output.Write("Unattended"); output.WriteEndTag("td"); output.WriteBeginTag("td"); output.WriteAttribute("colspan", "6"); output.Write(HtmlTextWriter.TagRightChar); output.Write("X - Attended"); output.WriteEndTag("td"); output.WriteBeginTag("td"); if (this.__instructorCellCssClass != string.Empty) { output.WriteAttribute("class", this.__instructorCellCssClass); } output.WriteAttribute("colspan", "6"); output.Write(HtmlTextWriter.TagRightChar); output.Write("I - Instructed"); output.WriteEndTag("td"); output.WriteBeginTag("td"); if (this.__seminarCellCssClass != string.Empty) { output.WriteAttribute("class", this.__seminarCellCssClass); } output.WriteAttribute("colspan", "7"); output.Write(HtmlTextWriter.TagRightChar); output.Write("Seminar"); output.WriteEndTag("td"); output.WriteEndTag("tr"); #endregion }
public void LoadDefaults() { DojoAccessControlGroupCollection accessControls; DojoAttendanceEntryCollection attendanceEntries; DojoBulkAttendanceEntryCollection bulkAttendances; DojoClassCollection classes; DojoClassDefinitionCollection classDefinitions; DojoMemberCollection members; DojoMembershipCollection memberships; DojoMembershipTemplateCollection membershipTemplates; DojoMemberTypeCollection memberTypes; DojoMemberTypeTemplateCollection memberTypeTemplates; DojoOrganizationCollection organizations; DojoPromotionCollection promotions; DojoPromotionFlagCollection promotionFlags; DojoPromotionStatusCollection promotionStatuses; DojoRankCollection ranks; DojoTestCollection tests; DojoTestListCollection testLists; DojoTestListJournalEntryCollection testListJournalEntries; DojoTestListJournalEntryTypeCollection testListJournalEntryTypes; DojoTestListStatusCollection testListStatuses; DojoSeminarCollection seminars; DojoSeminarOptionCollection seminarOptions; DojoSeminarRegistrationCollection seminarRegistrations; DojoSeminarRegistrationOptionCollection seminarRegistrationOptions; GreyFoxContactCollection locations; accessControls = new DojoAccessControlGroupCollection(); attendanceEntries = new DojoAttendanceEntryCollection(); bulkAttendances = new DojoBulkAttendanceEntryCollection(); classes = new DojoClassCollection(); classDefinitions = new DojoClassDefinitionCollection(); members = new DojoMemberCollection(); memberships = new DojoMembershipCollection(); membershipTemplates = new DojoMembershipTemplateCollection(); memberTypes = new DojoMemberTypeCollection(); memberTypeTemplates = new DojoMemberTypeTemplateCollection(); organizations = new DojoOrganizationCollection(); promotions = new DojoPromotionCollection(); promotionFlags = new DojoPromotionFlagCollection(); promotionStatuses = new DojoPromotionStatusCollection(); ranks = new DojoRankCollection(); tests = new DojoTestCollection(); testLists = new DojoTestListCollection(); testListJournalEntries = new DojoTestListJournalEntryCollection(); testListJournalEntryTypes = new DojoTestListJournalEntryTypeCollection(); testListStatuses = new DojoTestListStatusCollection(); seminars = new DojoSeminarCollection(); seminarOptions = new DojoSeminarOptionCollection(); seminarRegistrations = new DojoSeminarRegistrationCollection(); seminarRegistrationOptions = new DojoSeminarRegistrationOptionCollection(); locations = new GreyFoxContactCollection(); organizations = new DojoOrganizationManager().GetCollection(string.Empty, string.Empty, null); memberTypes = new DojoMemberTypeManager().GetCollection(string.Empty, string.Empty); memberTypeTemplates = new DojoMemberTypeTemplateManager().GetCollection(string.Empty, string.Empty, null); ranks = new DojoRankManager().GetCollection(string.Empty, string.Empty, null); membershipTemplates = new DojoMembershipTemplateManager().GetCollection(string.Empty, string.Empty, null); Dictionary <string, DojoMemberType> memberTypesDictionary = new Dictionary <string, DojoMemberType>(); foreach (DojoMemberType memberType in memberTypes) { memberTypesDictionary.Add(memberType.Name, memberType); } Dictionary <string, DojoMemberTypeTemplate> memberTypeTemplatesDictionary = new Dictionary <string, DojoMemberTypeTemplate>(); foreach (DojoMemberTypeTemplate typeTemplate in memberTypeTemplates) { memberTypeTemplatesDictionary.Add(typeTemplate.Name, typeTemplate); } Dictionary <string, DojoRank> ranksDictionary = new Dictionary <string, DojoRank>(); foreach (DojoRank rank in ranks) { ranksDictionary.Add(rank.Name, rank); } Dictionary <string, DojoMembershipTemplate> membershipTemplatesDictionary = new Dictionary <string, DojoMembershipTemplate>(); foreach (DojoMembershipTemplate template in membershipTemplates) { membershipTemplatesDictionary.Add(template.Name, template); } CsvParser.CsvStream csv = CsvParser.StreamParse(Localization.Defaults.Defaults_en_US, false); string rowType; string[] r = csv.GetNextRow(); while (r != null) { rowType = r[0]; if (rowType == Localization.Defaults.CSVMembershipTemplate) { DojoMembershipTemplate template = TessenFactory.MembershipTemplate( r[1], r[2], bool.Parse(r[3]), bool.Parse(r[4]), bool.Parse(r[5]), decimal.Parse(r[6]), decimal.Parse(r[7]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[8]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[9]), DojoOrganization.NewPlaceHolder(0), 1, int.Parse(r[11]), int.Parse(r[12]), decimal.Parse(r[13]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[14]), int.Parse(r[15]), int.Parse(r[16]), decimal.Parse(r[17]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[18]), int.Parse(r[19]), int.Parse(r[20]), decimal.Parse(r[21]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[22]), int.Parse(r[23]), int.Parse(r[24]), int.Parse(r[25]), int.Parse(r[26]), ranksDictionary.ContainsKey(r[27]) ? ranksDictionary[r[27]] : null, ranksDictionary.ContainsKey(r[28]) ? ranksDictionary[r[28]] : null); membershipTemplates.Add(template); membershipTemplatesDictionary.Add(template.Name, template); template.Save(); } else if (rowType == Localization.Defaults.CSVMemberTypeTemplate) { DojoMemberTypeTemplate template = TessenFactory.MemberTypeTemplate( r[1], r[2], memberTypeTemplatesDictionary.ContainsKey(r[3].ToString()) ? memberTypeTemplatesDictionary[r[3]] : null, memberTypesDictionary.ContainsKey(r[4]) ? memberTypesDictionary[r[4]] : null, bool.Parse(r[5]), bool.Parse(r[6]), bool.Parse(r[7]), bool.Parse(r[8]), int.Parse(r[9]), int.Parse(r[10]), int.Parse(r[11]), int.Parse(r[12]), ranksDictionary.ContainsKey(r[13]) ? ranksDictionary[r[13]] : null, ranksDictionary.ContainsKey(r[14]) ? ranksDictionary[r[14]] : null, membershipTemplatesDictionary.ContainsKey(r[15]) ? membershipTemplatesDictionary[r[15]] : null, membershipTemplatesDictionary.ContainsKey(r[16]) ? membershipTemplatesDictionary[r[16]] : null, membershipTemplatesDictionary.ContainsKey(r[17]) ? membershipTemplatesDictionary[r[17]] : null, membershipTemplatesDictionary.ContainsKey(r[18]) ? membershipTemplatesDictionary[r[18]] : null, membershipTemplatesDictionary.ContainsKey(r[19]) ? membershipTemplatesDictionary[r[19]] : null); memberTypeTemplates.Add(template); memberTypeTemplatesDictionary.Add(template.Name, template); template.Save(); } r = csv.GetNextRow(); } }
/// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void RenderContent(HtmlTextWriter output) { EnsureChildControls(); StringBuilder whereQuery = new StringBuilder(); DojoClassManager m = new DojoClassManager(); // // Qualify Parent Definition Selection in Query // if (parentDefinitionID == 0) { whereQuery.Append("(ParentDefinitionID=null OR ParentDefinitionID=0) "); } else if (parentDefinitionID > 0) { whereQuery.Append("ParentDefinitionID=" + parentDefinitionID.ToString() + ") "); } // // Qualify Parent Seminar Selection in Query // if (parentSeminarID == 0) { if (whereQuery.Length > 0) { whereQuery.Append("AND (ParentSeminarID=null OR ParentSeminarID=0) "); } else { whereQuery.Append("(ParentSeminarID=null OR ParentSeminarID=0) "); } } else if (parentSeminarID > 0) { whereQuery.Append("(ParentSeminarID=" + parentSeminarID.ToString() + ") "); } switch (ddSearchMode.SelectedItem.Text) { case "Today": // today if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(LocalTime.Date); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(LocalTime.Date.AddDays(1)); whereQuery.Append("#)"); break; case "This Month": if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date)); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date).AddMonths(1)); whereQuery.Append("#)"); break; case "Last Month": if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(DateManipulator.SubtractMonths(DateManipulator.FirstOfMonth(LocalTime.Date), 1)); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(DateManipulator.FirstOfMonth(LocalTime.Date)); whereQuery.Append("#)"); break; case "This Week": if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(DateManipulator.FirstOfWeek(LocalTime.Date)); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(DateManipulator.LastOfWeek(LocalTime.Date).AddDays(1)); whereQuery.Append("#)"); break; case "Last Week": if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(DateManipulator.FirstOfWeek(LocalTime.Date).Subtract(TimeSpan.FromDays(7))); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(DateManipulator.LastOfWeek(LocalTime.Date).Subtract(TimeSpan.FromDays(6))); whereQuery.Append("#)"); break; case "This Year": if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("(ClassStart>=#"); whereQuery.Append(DateTime.Parse("1/1/" + LocalTime.Date.Year.ToString())); whereQuery.Append("# AND ClassStart <#"); whereQuery.Append(DateTime.Parse("1/1/" + (LocalTime.Date.Year + 1).ToString())); whereQuery.Append("#)"); break; } if (cbSeminarFilter.Checked) { if (whereQuery.Length > 0) { whereQuery.Append(" AND "); } whereQuery.Append("ParentSeminarID IS NOT NULL"); } DojoClassCollection dojoClassCollection = m.GetCollection(whereQuery.ToString(), "ClassStart ASC", new DojoClassFlags[] { DojoClassFlags.Instructor, DojoClassFlags.InstructorPrivateContact }); bool rowflag = false; string rowCssClass; string currentIndex = string.Empty; string previousIndex = string.Empty; // // Render Records // foreach (DojoClass entry in dojoClassCollection) { #region Index Rows Rendering currentIndex = entry.ClassStart.ToLongDateString(); if (currentIndex != previousIndex) { output.WriteFullBeginTag("tr"); output.WriteBeginTag("td"); output.WriteAttribute("valign", "top"); output.WriteAttribute("colspan", "4"); output.WriteAttribute("class", indexRowCssClass); output.Write(HtmlTextWriter.TagRightChar); output.Write(currentIndex); output.WriteEndTag("td"); output.WriteEndTag("tr"); previousIndex = currentIndex; } #endregion if (rowflag) { rowCssClass = this.defaultRowCssClass; } else { rowCssClass = this.alternateRowCssClass; } rowflag = !rowflag; output.WriteBeginTag("tr"); output.WriteAttribute("i", entry.ID.ToString()); output.WriteLine(HtmlTextWriter.TagRightChar); output.Indent++; // // Render Main Representation of Record // output.WriteBeginTag("td"); output.WriteAttribute("valign", "top"); output.WriteAttribute("class", rowCssClass); output.Write(HtmlTextWriter.TagRightChar); output.WriteFullBeginTag("strong"); output.Write(entry.Name); output.WriteEndTag("strong"); output.Write("<br>"); output.Write(entry.Instructor.PrivateContact.FullName); output.WriteEndTag("td"); output.WriteLine(); // // Render Class Start and End Dates // output.WriteBeginTag("td"); output.WriteAttribute("class", rowCssClass); output.WriteAttribute("valign", "top"); output.Write(HtmlTextWriter.TagRightChar); // output.Write(entry.ClassStart.ToLongDateString()); // output.Write("<br />"); output.Write(entry.ClassStart.ToShortTimeString()); output.Write(" - "); output.Write(entry.ClassEnd.ToShortTimeString()); output.WriteEndTag("td"); output.WriteLine(); output.Indent--; output.WriteEndTag("tr"); output.WriteLine(); } }
private void bindDropDownLists() { #region Bind General Child Data msRegistration.Items.Add(new ListItem("Null", "Null")); DojoSeminarRegistrationManager registrationManager = new DojoSeminarRegistrationManager(); DojoSeminarRegistrationCollection registrationCollection = registrationManager.GetCollection(string.Empty, string.Empty, null); foreach (DojoSeminarRegistration registration in registrationCollection) { ListItem i = new ListItem(registration.ToString(), registration.ID.ToString()); msRegistration.Items.Add(i); } msParentReservation.Items.Add(new ListItem("Null", "Null")); DojoSeminarReservationManager parentReservationManager = new DojoSeminarReservationManager(); DojoSeminarReservationCollection parentReservationCollection = parentReservationManager.GetCollection(string.Empty, string.Empty, null); foreach (DojoSeminarReservation parentReservation in parentReservationCollection) { ListItem i = new ListItem(parentReservation.ToString(), parentReservation.ID.ToString()); msParentReservation.Items.Add(i); } #endregion #region Bind Classes Child Data msClass1.Items.Add(new ListItem("Null", "Null")); DojoClassManager class1Manager = new DojoClassManager(); DojoClassCollection class1Collection = class1Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class1 in class1Collection) { ListItem i = new ListItem(class1.ToString(), class1.ID.ToString()); msClass1.Items.Add(i); } msClass2.Items.Add(new ListItem("Null", "Null")); DojoClassManager class2Manager = new DojoClassManager(); DojoClassCollection class2Collection = class2Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class2 in class2Collection) { ListItem i = new ListItem(class2.ToString(), class2.ID.ToString()); msClass2.Items.Add(i); } msClass3.Items.Add(new ListItem("Null", "Null")); DojoClassManager class3Manager = new DojoClassManager(); DojoClassCollection class3Collection = class3Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class3 in class3Collection) { ListItem i = new ListItem(class3.ToString(), class3.ID.ToString()); msClass3.Items.Add(i); } msClass4.Items.Add(new ListItem("Null", "Null")); DojoClassManager class4Manager = new DojoClassManager(); DojoClassCollection class4Collection = class4Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class4 in class4Collection) { ListItem i = new ListItem(class4.ToString(), class4.ID.ToString()); msClass4.Items.Add(i); } msClass5.Items.Add(new ListItem("Null", "Null")); DojoClassManager class5Manager = new DojoClassManager(); DojoClassCollection class5Collection = class5Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class5 in class5Collection) { ListItem i = new ListItem(class5.ToString(), class5.ID.ToString()); msClass5.Items.Add(i); } msClass6.Items.Add(new ListItem("Null", "Null")); DojoClassManager class6Manager = new DojoClassManager(); DojoClassCollection class6Collection = class6Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class6 in class6Collection) { ListItem i = new ListItem(class6.ToString(), class6.ID.ToString()); msClass6.Items.Add(i); } msClass7.Items.Add(new ListItem("Null", "Null")); DojoClassManager class7Manager = new DojoClassManager(); DojoClassCollection class7Collection = class7Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class7 in class7Collection) { ListItem i = new ListItem(class7.ToString(), class7.ID.ToString()); msClass7.Items.Add(i); } msClass8.Items.Add(new ListItem("Null", "Null")); DojoClassManager class8Manager = new DojoClassManager(); DojoClassCollection class8Collection = class8Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class8 in class8Collection) { ListItem i = new ListItem(class8.ToString(), class8.ID.ToString()); msClass8.Items.Add(i); } msClass9.Items.Add(new ListItem("Null", "Null")); DojoClassManager class9Manager = new DojoClassManager(); DojoClassCollection class9Collection = class9Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class9 in class9Collection) { ListItem i = new ListItem(class9.ToString(), class9.ID.ToString()); msClass9.Items.Add(i); } msClass10.Items.Add(new ListItem("Null", "Null")); DojoClassManager class10Manager = new DojoClassManager(); DojoClassCollection class10Collection = class10Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClass class10 in class10Collection) { ListItem i = new ListItem(class10.ToString(), class10.ID.ToString()); msClass10.Items.Add(i); } #endregion #region Bind Definitions Child Data msDefinition1.Items.Add(new ListItem("Null", "Null")); DojoClassDefinitionManager definition1Manager = new DojoClassDefinitionManager(); DojoClassDefinitionCollection definition1Collection = definition1Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClassDefinition definition1 in definition1Collection) { ListItem i = new ListItem(definition1.ToString(), definition1.ID.ToString()); msDefinition1.Items.Add(i); } msDefinition2.Items.Add(new ListItem("Null", "Null")); DojoClassDefinitionManager definition2Manager = new DojoClassDefinitionManager(); DojoClassDefinitionCollection definition2Collection = definition2Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClassDefinition definition2 in definition2Collection) { ListItem i = new ListItem(definition2.ToString(), definition2.ID.ToString()); msDefinition2.Items.Add(i); } msDefinition3.Items.Add(new ListItem("Null", "Null")); DojoClassDefinitionManager definition3Manager = new DojoClassDefinitionManager(); DojoClassDefinitionCollection definition3Collection = definition3Manager.GetCollection(string.Empty, string.Empty, null); foreach (DojoClassDefinition definition3 in definition3Collection) { ListItem i = new ListItem(definition3.ToString(), definition3.ID.ToString()); msDefinition3.Items.Add(i); } #endregion }