public override string ToString() { Core.Helpers.Constructor timetableText = new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/timetabletext.html"); timetableText.SetVariable("HighlightedId", this._highlightedId); timetableText.SetVariable("Highlighted", this._highlighted); if (string.IsNullOrEmpty(this._onClick)) { timetableText.DeleteVariable("ChangeLink"); } else { timetableText.SetVariable("ChangeLink", " <a href=\"javascript:void(0);\" onclick=\"" + this._onClick + "\"><em style=\"font-size: 8pt;\">(Change)</em></a>"); } return(timetableText.ToString()); }
protected override void SetPrintContent() { if (this.CheckInputValidity()) { DateTime creationDate = DateTime.Now; Core.Helpers.Constructor pageContent = new Core.Helpers.Constructor("/Templates/Specific/Cover/Slips/Printouts/valid.html"); Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder(); pageContent.SetVariable("CoverDate", this._selectedDate.ToString("dddd, dd MMMM yyyy")); paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate); paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek); paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1)); int internalCount = 0; int outsideCount = 0; using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Slips/Printouts/daylist.sql", paramBuilder.Parameters)) { if (dataReader.HasRows) { Core.Helpers.Constructor internalConstructor = new Core.Helpers.Constructor("/Templates/Specific/Cover/Slips/Printouts/internalcover.html"); Core.Helpers.Elements.CoverSlips.Collection internalCollection = new Core.Helpers.Elements.CoverSlips.Collection(); int pageCount = 0; int pageSlipCount = 0; while (dataReader.Read()) { Core.Helpers.Elements.CoverSlips.Slip slip = new Core.Helpers.Elements.CoverSlips.Slip(); this.PopulateSlip(ref slip, dataReader, true, creationDate); if (pageCount.Equals(0) && pageSlipCount.Equals(3)) { slip.PageBreakBefore = true; pageCount++; pageSlipCount = 0; } else if (pageSlipCount.Equals(3)) { slip.PageBreakBefore = true; pageCount++; pageSlipCount = 0; } else { pageSlipCount++; } internalCollection.Add(slip); internalCount++; } internalConstructor.SetVariable("Slips", internalCollection.ToString()); pageContent.SetVariable("InternalCoverCount", internalCount.ToString()); pageContent.SetVariable("InternalCoverSlips", internalConstructor); } else { pageContent.SetVariable("InternalCoverCount", "0"); pageContent.DeleteVariable("InternalCoverSlips"); } dataReader.NextResult(); if (dataReader.HasRows) { Core.Helpers.Constructor outsideConstructor = new Core.Helpers.Constructor("/Templates/Specific/Cover/Slips/Printouts/outsidecover.html"); Core.Helpers.Elements.CoverSlips.Collection outsideCollection = new Core.Helpers.Elements.CoverSlips.Collection(); if (internalCount > 0) { outsideConstructor.SetVariable("BreakBefore", " class=\"BreakBefore\""); } else { outsideConstructor.DeleteVariable("BreakBefore"); } int pageCount = 0; int pageSlipCount = 0; while (dataReader.Read()) { Core.Helpers.Elements.CoverSlips.Slip slip = new Core.Helpers.Elements.CoverSlips.Slip(); this.PopulateSlip(ref slip, dataReader, false, creationDate); if (!internalCount.Equals(0) && pageCount.Equals(0) && pageSlipCount.Equals(4)) { slip.PageBreakBefore = true; pageCount++; pageSlipCount = 0; } else if (internalCount.Equals(0) && pageCount.Equals(0) && pageSlipCount.Equals(3)) { slip.PageBreakBefore = true; pageCount++; pageSlipCount = 0; } else if (!pageCount.Equals(0) && pageSlipCount.Equals(3)) { slip.PageBreakBefore = true; pageCount++; pageSlipCount = 0; } else { pageSlipCount++; } outsideCollection.Add(slip); outsideCount++; } outsideConstructor.SetVariable("Slips", outsideCollection.ToString()); pageContent.SetVariable("OutsideCoverCount", outsideCount.ToString()); pageContent.SetVariable("OutsideCoverSlips", outsideConstructor); } else { pageContent.SetVariable("OutsideCoverCount", "0"); pageContent.DeleteVariable("OutsideCoverSlips"); } } this.Page.SetVariable("PrintArea", pageContent); } else { this.Page.SetVariable("PrintArea", new Core.Helpers.Constructor("/Templates/Specific/Cover/Slips/Printouts/badrequest.html")); } }