protected override void GenerateOutput() { Core.Helpers.Elements.Ajax.Xml.Collection responseXml = new Core.Helpers.Elements.Ajax.Xml.Collection(); if (this.HasStaffId() && this.HasDepartmentId()) { Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder(); paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", this._staffId); paramBuilder.AddParameter(SqlDbType.Int, "@DepartmentId", this._departmentId); using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Staff/Modify/Update/Teaching/department.sql", paramBuilder.Parameters)) { dataReader.Read(); if (((int)dataReader["Status"]).Equals(2)) { dataReader.NextResult(); while (dataReader.Read()) { responseXml.Add("Department" + (int)dataReader["DepartmentId"], dataReader["ClassName"] as string, null); } } else { responseXml.Add("Department" + this._departmentId, "Yellow", null); } } } this.Page.Contents = responseXml.ToString(); }
protected override void GenerateOutput() { Core.Helpers.Path.Parser sourcePath = new Core.Helpers.Path.Parser(Core.WebServer.Request["sourcepath"]); Core.Helpers.Elements.Ajax.Xml.Collection xmlCollection = new Core.Helpers.Elements.Ajax.Xml.Collection(); Core.Helpers.Elements.Ajax.Xml.Element xmlElement = new Core.Helpers.Elements.Ajax.Xml.Element(); if (!sourcePath.IsEmpty) { if (this.CheckInputValidity(sourcePath)) { xmlElement.Value = this._selectedDate.Year + "/" + this._selectedDate.Month + "/" + this._selectedDate.Day + "/"; } } xmlCollection.Add(xmlElement); this.Page.Contents = xmlCollection.ToString(); }
protected override void GenerateOutput() { Core.Helpers.Elements.Ajax.Xml.Collection xmlCollection = new Core.Helpers.Elements.Ajax.Xml.Collection(); if (this.CheckInputValidity()) { if (this.Path.HasNext()) { int staffId; bool successfulParse = int.TryParse(this.Path.Next(), out staffId); if (successfulParse) { Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder(); paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", staffId); paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate); using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Attendance/Attendance/modify.sql", paramBuilder.Parameters)) { if (dataReader.Read()) { xmlCollection.Add(null, dataReader["Colour"] as string, null); } else { xmlCollection.Add(null, "Yellow", null); } } } else { xmlCollection.Add(null, "Yellow", null); } } else { xmlCollection.Add(null, "Yellow", null); } } else { xmlCollection.Add(null, "Yellow", null); } this.Page.Contents = xmlCollection.ToString(); }
protected override void GenerateOutput() { Core.Helpers.Elements.Ajax.Xml.Collection xmlCollection = new Core.Helpers.Elements.Ajax.Xml.Collection(); bool isInternalStaff; int coverId; int staffId; if (this.CheckInputValidity() && this.IsInternalStaff(out isInternalStaff) && this.GetValue(out coverId) && this.GetValue(out staffId)) { DateTime startDate = Core.WebServer.PleaseTakes.Session.CurrentInstance.School.Settings.Timetabling.SessionDetails.CurrentSession.GetDateSessionInformation(this._selectedDate).RotationStartDate; DateTime endDate = Core.WebServer.PleaseTakes.Session.CurrentInstance.School.Settings.Timetabling.SessionDetails.CurrentSession.GetDateSessionInformation(this._selectedDate).RotationEndDate; Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder(); paramBuilder.AddParameter(SqlDbType.Bit, "@IsInternalStaff", isInternalStaff); paramBuilder.AddParameter(SqlDbType.Int, "@CoverId", coverId); paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", staffId); paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@StartDate", startDate); paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@EndDate", endDate); paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek); paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1)); using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Selection/Selection/modify.sql", paramBuilder.Parameters)) { dataReader.Read(); if ((bool)dataReader["Status"]) { dataReader.NextResult(); if (dataReader.HasRows) { while (dataReader.Read()) { Core.Helpers.Elements.Ajax.Xml.Element xmlElement = new Core.Helpers.Elements.Ajax.Xml.Element(); if ((bool)dataReader["IsRequest"]) { Records.RequestBase record = new Records.RequestBase(); xmlElement.Id = "Request" + (int)dataReader["Id"]; if ((bool)dataReader["RequestHasCover"]) { Records.CoverSelected newRecord = new Records.CoverSelected(); xmlElement.ClassName = "Green"; UserManagement.StaffNameFormatter staffAbsenteeNameFormatter = new UserManagement.StaffNameFormatter(); staffAbsenteeNameFormatter.Forename = dataReader["RequestAbsentForename"] as string; staffAbsenteeNameFormatter.Surname = dataReader["RequestAbsentSurname"] as string; staffAbsenteeNameFormatter.HoldingName = dataReader["RequestAbsentHoldingname"] as string; newRecord.AbsenteeName = staffAbsenteeNameFormatter; //newRecord.AbsenteeName = Core.Utils.FormatStaffName(dataReader["RequestAbsentForename"] as string, dataReader["RequestAbsentSurname"] as string, dataReader["RequestAbsentHoldingname"] as string, false, false, false); newRecord.Period = (int)dataReader["RequestPeriod"]; newRecord.CommitmentName = dataReader["RequestCommitmentName"] as string; newRecord.IsInternalCover = (bool)dataReader["IsInternalCover"]; UserManagement.StaffNameFormatter staffCoveringNameFormatter = new UserManagement.StaffNameFormatter(); staffCoveringNameFormatter.Forename = dataReader["RequestCoverForename"] as string; staffCoveringNameFormatter.Surname = dataReader["RequestCoverSurname"] as string; staffCoveringNameFormatter.HoldingName = dataReader["RequestCoverHoldingName"] as string; newRecord.CoverStaffName = staffCoveringNameFormatter; //newRecord.CoverStaffName = Core.Utils.FormatStaffName(dataReader["RequestCoverForename"] as string, dataReader["RequestCoverSurname"] as string, dataReader["RequestCoverHoldingName"] as string, false, false, false); record = newRecord; } else { Records.NoCoverSelected newRecord = new Records.NoCoverSelected(); xmlElement.ClassName = "Red"; UserManagement.StaffNameFormatter absenteeNameFormatter = new UserManagement.StaffNameFormatter(); absenteeNameFormatter.Forename = dataReader["RequestAbsentForename"] as string; absenteeNameFormatter.Surname = dataReader["RequestAbsentSurname"] as string; absenteeNameFormatter.HoldingName = dataReader["RequestAbsentHoldingName"] as string; newRecord.AbsenteeName = absenteeNameFormatter; //newRecord.AbsenteeName = Core.Utils.FormatStaffName(dataReader["RequestAbsentForename"] as string, dataReader["RequestAbsentSurname"] as string, dataReader["RequestAbsentHoldingName"] as string, false, false, false); newRecord.Period = (int)dataReader["RequestPeriod"]; newRecord.CommitmentName = dataReader["RequestCommitmentName"] as string; record = newRecord; } xmlElement.InnerHtml = record.InnerHtml; } else { Records.Selection record = new Records.Selection(); int entitlement = (int)dataReader["SelectionEntitlement"]; xmlElement.Id = "Selection" + (int)dataReader["Id"]; record.IsInternal = isInternalStaff; if (isInternalStaff) { UserManagement.StaffNameFormatter nameFormatter = new UserManagement.StaffNameFormatter(); nameFormatter.Forename = dataReader["SelectionForename"] as string; nameFormatter.Surname = dataReader["SelectionSurname"] as string; nameFormatter.HoldingName = dataReader["SelectionHoldingName"] as string; record.StaffName = nameFormatter; } else { UserManagement.StaffNameFormatter nameFormatter = new UserManagement.StaffNameFormatter(); nameFormatter.Forename = dataReader["SelectionForename"] as string; nameFormatter.Surname = dataReader["SelectionSurname"] as string; record.StaffName = nameFormatter; } if ((bool)dataReader["SelectionIsSelected"]) { xmlElement.ClassName = "Green"; } else if (entitlement.Equals(0)) { xmlElement.ClassName = "Red"; } else { xmlElement.ClassName = ""; } record.Entitlement = entitlement; xmlElement.InnerHtml = record.InnerHtml; } xmlCollection.Add(xmlElement); } } } } } this.Page.Contents = xmlCollection.ToString(); }
protected override void GenerateOutput() { Core.Helpers.Elements.Ajax.Xml.Collection xmlCollection = new Core.Helpers.Elements.Ajax.Xml.Collection(); if (this.CheckInputValidity()) { Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder(); paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", this._staffId); paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate); paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek); paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1)); if (this._period.Equals(0)) { paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMin", 1); paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMax", this._periods); } else { paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMin", this._period); paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMax", this._period); } using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Attendance/Periods/modify.sql", paramBuilder.Parameters)) { if (dataReader.HasRows) { while (dataReader.Read()) { int period = (int)dataReader["Period"]; string id = "Periods" + this._staffId + "-" + period; string classes = "Large "; Core.Helpers.Constructor innerHtml = new Core.Helpers.Constructor("/Templates/Specific/Cover/Arrange/Attendance/periodsinner.html"); switch ((dataReader["Status"] as string).ToLower()) { case "absent": classes += "Red"; innerHtml.SetVariable("Symbol", "A"); break; case "present": classes += "Green"; innerHtml.SetVariable("Symbol", "P"); break; case "presentyeargroupaway": classes += "Blue"; innerHtml.SetVariable("Symbol", "P"); break; case "presentisbusy": classes += "Indigo"; innerHtml.SetVariable("Symbol", "P"); break; } innerHtml.SetVariable("StaffId", this._staffId.ToString()); innerHtml.SetVariable("Year", this._selectedDate.Year.ToString()); innerHtml.SetVariable("Month", this._selectedDate.Month.ToString()); innerHtml.SetVariable("Day", this._selectedDate.Day.ToString()); innerHtml.SetVariable("Period", period.ToString()); xmlCollection.Add(id, classes, innerHtml.ToString()); } } } } this.Page.Contents = xmlCollection.ToString(); }