예제 #1
0
        protected override void GenerateOutput()
        {
            if (this.GetStaffId())
            {
                try {
                    if (!this.GetWeekNo())
                    {
                        this._weekNo = 1;
                    }

                    Core.Helpers.Elements.DataGrids.Timetables.StaffTimetable staffTimetable = new Core.Helpers.Elements.DataGrids.Timetables.StaffTimetable(this._staffId);
                    staffTimetable.IsCurrentSession = true;
                    staffTimetable.WeekNo           = this._weekNo;

                    staffTimetable.TopControls.Left.OnClick  = "getUpdatedResponse('Timetable', '?path=/staff/modify/ajax/teaching/timetable/" + this._staffId + "/WeekNo/');";
                    staffTimetable.TopControls.Right.OnClick = "getUpdatedResponse('Timetable', '?path=/staff/modify/ajax/teaching/timetable/" + this._staffId + "/WeekNo/');";

                    staffTimetable.Events.Unavailable.Href  = "/staff/modify/teaching/timetable/StaffId/WeekNo/DayNo/Period/#Unavailable";
                    staffTimetable.Events.Free.Href         = "/staff/modify/teaching/timetable/StaffId/WeekNo/DayNo/Period/#Free";
                    staffTimetable.Events.BusyOther.Href    = "/staff/modify/teaching/timetable/StaffId/WeekNo/DayNo/Period/#Busy";
                    staffTimetable.Events.BusyTeaching.Href = "/staff/modify/teaching/timetable/StaffId/WeekNo/DayNo/Period/#Teaching";

                    this.Page.Contents = staffTimetable.ToString();
                }
                catch (Core.Helpers.Elements.DataGrids.Timetables.InvalidStaffIdException) {
                    Core.Helpers.Elements.Alerts.Alert unknownStaffMemberAlert = new Core.Helpers.Elements.Alerts.Alert("UnknownStaffMember");
                    unknownStaffMemberAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                    unknownStaffMemberAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Timetable/unknown.html").ToString();
                    unknownStaffMemberAlert.NoScript     = false;
                    unknownStaffMemberAlert.ShowCloseBox = false;
                    unknownStaffMemberAlert.StartHidden  = false;

                    this.Page.Contents = unknownStaffMemberAlert.ToString();
                }
                catch (Core.Helpers.Elements.DataGrids.Timetables.NoTimetableException) {
                    Core.Helpers.Constructor noTimetableConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Timetable/notimetable.html");
                    noTimetableConstructor.SetVariable("StaffId", this._staffId.ToString());

                    Core.Helpers.Elements.Alerts.Alert noTimetableAlert = new Core.Helpers.Elements.Alerts.Alert("NoTimetable");
                    noTimetableAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                    noTimetableAlert.Message      = noTimetableConstructor.ToString();
                    noTimetableAlert.NoScript     = false;
                    noTimetableAlert.ShowCloseBox = false;
                    noTimetableAlert.StartHidden  = false;

                    this.Page.Contents = noTimetableAlert.ToString();
                }
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert invalidInput = new Core.Helpers.Elements.Alerts.Alert("InvalidInput");
                invalidInput.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                invalidInput.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Timetable/invalidinput.html").ToString();
                invalidInput.NoScript     = false;
                invalidInput.ShowCloseBox = false;
                invalidInput.StartHidden  = false;

                this.Page.Contents = invalidInput.ToString();
            }
        }
예제 #2
0
        protected override void SetBreadcrumbTrails()
        {
            foreach (Core.Helpers.Elements.Tabs.Tab tab in this.Tabs)
            {
                switch (tab.Id)
                {
                case "Landing":
                    tab.BreadcrumbTrail.Add("Home", "?path=/home/", null);
                    tab.BreadcrumbTrail.Add("Cover Management", "?path=/cover/", null);
                    tab.BreadcrumbTrail.Add("Arrange");
                    tab.BreadcrumbTrail.Add("Calendar", "?path=/cover/arrange/calendar/", null);
                    break;
                }

                tab.Content.SetVariable("BreadcrumbTrail", tab.BreadcrumbTrail.ToString());

                Core.Helpers.Elements.Alerts.Alert reminderAlert = new Core.Helpers.Elements.Alerts.Alert("Reminder");
                reminderAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                reminderAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Landing/reminder.html").ToString();
                reminderAlert.NoScript     = false;
                reminderAlert.ShowCloseBox = true;
                reminderAlert.StartHidden  = false;

                tab.Content.SetVariable("AlertReminder", reminderAlert.ToString());
            }
        }
예제 #3
0
        private void SetToBadStaffId()
        {
            Core.Helpers.Elements.Alerts.Alert badStaffIdAlert = new Core.Helpers.Elements.Alerts.Alert("BadStaffId");
            badStaffIdAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
            badStaffIdAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Timetable/badstaffid.html").ToString();

            this.Page.Contents = badStaffIdAlert.ToString();
        }
예제 #4
0
        private void SetToTimetableExists()
        {
            Core.Helpers.Constructor timetableExistsConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Timetable/timetableexists.html");
            timetableExistsConstructor.SetVariable("StaffId", this._staffId.ToString());

            Core.Helpers.Elements.Alerts.Alert timetableExistsAlert = new Core.Helpers.Elements.Alerts.Alert("TimetableExists");
            timetableExistsAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
            timetableExistsAlert.Message = timetableExistsConstructor.ToString();

            this.Page.Contents = timetableExistsAlert.ToString();
        }
예제 #5
0
        protected override void GenerateOutput()
        {
            if (this.HasState())
            {
                Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();
                Core.Helpers.Database.ParameterBuilder       paramBuilder     = new Core.Helpers.Database.ParameterBuilder();
                string sqlPath     = "";
                int    recordCount = 0;
                int    subjectId;

                switch (this._state)
                {
                case TimetableSelectionStates.UniqueYeargroup:
                    this.SetSearchTerm();
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/yeargroups.sql";
                    break;

                case TimetableSelectionStates.UniqueRoom:
                    this.SetSearchTerm();
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/rooms.sql";
                    break;

                case TimetableSelectionStates.ClassSubject:
                    this.SetSearchTerm();
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/subjects.sql";
                    break;

                case TimetableSelectionStates.ClassQualification:
                    this.GetId(out subjectId);
                    paramBuilder.AddParameter(SqlDbType.Int, "@SubjectId", subjectId);

                    this.SetSearchTerm();
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/qualifications.sql";
                    break;

                case TimetableSelectionStates.ClassClass:
                    this.GetId(out subjectId);

                    this.SetSearchTerm();
                    paramBuilder.AddParameter(SqlDbType.Int, "@SubjectQualificationId", subjectId);
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/classes.sql";
                    break;

                case TimetableSelectionStates.ClassRoom:
                    this.SetSearchTerm();
                    sqlPath = "/Sql/Specific/Staff/Modify/Teaching/Timetable/Selection/rooms.sql";
                    break;
                }

                paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", this._searchTerm);

                switch (this._state)
                {
                case TimetableSelectionStates.UniqueRoom:
                case TimetableSelectionStates.ClassRoom:
                    Core.Helpers.Elements.RecordLists.Record noRoomRecord = new Core.Helpers.Elements.RecordLists.Record();

                    noRoomRecord.Colour = Core.Helpers.Elements.RecordLists.Colours.Yellow;
                    noRoomRecord.LeftSide.Image.Source  = "nodoor.png";
                    noRoomRecord.LeftSide.Image.ToolTip = "Teaching does not take place in a room";
                    noRoomRecord.LeftSide.MainText      = "<em>Teaching does not take place in a room</em>";

                    if (this._state.Equals(TimetableSelectionStates.UniqueRoom))
                    {
                        noRoomRecord.OnClick = "setUniqueRoom();";
                    }
                    else
                    {
                        noRoomRecord.OnClick = "setClassRoom();";
                    }

                    recordCollection.Add(noRoomRecord);
                    break;
                }

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader(sqlPath, paramBuilder.Parameters)) {
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            switch (this._state)
                            {
                            case TimetableSelectionStates.UniqueYeargroup:
                                Core.Helpers.Elements.RecordLists.Record yeargroupRecord = new Core.Helpers.Elements.RecordLists.Record();

                                yeargroupRecord.LeftSide.Image.Source  = "yeargroup.png";
                                yeargroupRecord.LeftSide.Image.ToolTip = "Yeargroup";
                                yeargroupRecord.LeftSide.MainText      = dataReader["Name"] as string;
                                yeargroupRecord.OnClick = "setUniqueYeargroup('" + dataReader["Name"] as string + "', " + (int)dataReader["Id"] + ");";

                                recordCount++;
                                recordCollection.Add(yeargroupRecord);
                                break;

                            case TimetableSelectionStates.UniqueRoom:
                            case TimetableSelectionStates.ClassRoom:
                                Core.Helpers.Elements.RecordLists.Record roomRecord = new Core.Helpers.Elements.RecordLists.Record();

                                roomRecord.LeftSide.Image.Source  = "door.png";
                                roomRecord.LeftSide.Image.ToolTip = "Room";
                                roomRecord.LeftSide.MainText      = dataReader["Name"] as string;

                                if (this._state.Equals(TimetableSelectionStates.UniqueRoom))
                                {
                                    roomRecord.OnClick = "setUniqueRoom('" + dataReader["Name"] as string + "', " + (int)dataReader["Id"] + ");";
                                }
                                else
                                {
                                    roomRecord.OnClick = "setClassRoom('" + dataReader["Name"] as string + "', " + (int)dataReader["Id"] + ");";
                                }

                                recordCount++;
                                recordCollection.Add(roomRecord);
                                break;

                            case TimetableSelectionStates.ClassSubject:
                                Core.Helpers.Elements.RecordLists.Record subjectRecord = new Core.Helpers.Elements.RecordLists.Record();

                                subjectRecord.LeftSide.Image.Source  = "subject.png";
                                subjectRecord.LeftSide.Image.ToolTip = "Subject";
                                subjectRecord.LeftSide.MainText      = dataReader["Name"] as string;

                                string subjectName;

                                if (string.IsNullOrEmpty(dataReader["Abbreviation"] as string))
                                {
                                    subjectName = dataReader["Name"] as string;
                                }
                                else
                                {
                                    subjectName = dataReader["Abbreviation"] as string;
                                }

                                subjectRecord.OnClick = "setClassSubject('" + subjectName + "', " + (int)dataReader["Id"] + ");";

                                recordCount++;
                                recordCollection.Add(subjectRecord);
                                break;

                            case TimetableSelectionStates.ClassQualification:
                                Core.Helpers.Elements.RecordLists.Record qualificationRecord = new Core.Helpers.Elements.RecordLists.Record();

                                qualificationRecord.LeftSide.Image.Source  = "lightbulb.png";
                                qualificationRecord.LeftSide.Image.ToolTip = "Qualification";
                                qualificationRecord.LeftSide.MainText      = dataReader["Name"] as string;
                                qualificationRecord.OnClick = "setClassQualification('" + dataReader["Name"] as string + "', " + (int)dataReader["Id"] + ");";

                                recordCount++;
                                recordCollection.Add(qualificationRecord);
                                break;

                            case TimetableSelectionStates.ClassClass:
                                Core.Helpers.Elements.RecordLists.Record classRecord = new Core.Helpers.Elements.RecordLists.Record();

                                classRecord.LeftSide.Image.Source  = "class.png";
                                classRecord.LeftSide.Image.ToolTip = "Class";
                                classRecord.LeftSide.MainText      = dataReader["Name"] as string;
                                classRecord.OnClick = "setClassClass('" + dataReader["Name"] as string + "', " + (int)dataReader["Id"] + ");";

                                recordCount++;
                                recordCollection.Add(classRecord);
                                break;
                            }
                        }

                        this.Page.Contents = recordCollection.ToString();
                    }
                    else
                    {
                        switch (this._state)
                        {
                        case TimetableSelectionStates.UniqueYeargroup:
                            Core.Helpers.Elements.Alerts.Alert noYeargroupsAlert = new Core.Helpers.Elements.Alerts.Alert("NoYeargroups");
                            noYeargroupsAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                            noYeargroupsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/noyeargroups.html").ToString();

                            this.Page.Contents = noYeargroupsAlert.ToString();
                            break;

                        case TimetableSelectionStates.UniqueRoom:
                        case TimetableSelectionStates.ClassRoom:
                            this.Page.Contents = recordCollection.ToString();
                            break;

                        case TimetableSelectionStates.ClassSubject:
                            Core.Helpers.Elements.Alerts.Alert noSubjectsAlert = new Core.Helpers.Elements.Alerts.Alert("NoSubjects");
                            noSubjectsAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                            noSubjectsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/nosubjects.html").ToString();

                            this.Page.Contents = noSubjectsAlert.ToString();
                            break;

                        case TimetableSelectionStates.ClassQualification:
                            Core.Helpers.Elements.Alerts.Alert noQualificationsAlert = new Core.Helpers.Elements.Alerts.Alert("NoQualifications");
                            noQualificationsAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                            noQualificationsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/noqualifications.html").ToString();

                            this.Page.Contents = noQualificationsAlert.ToString();
                            break;

                        case TimetableSelectionStates.ClassClass:
                            Core.Helpers.Elements.Alerts.Alert noClassesAlert = new Core.Helpers.Elements.Alerts.Alert("NoClasses");
                            noClassesAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                            noClassesAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/noclasses.html").ToString();

                            this.Page.Contents = noClassesAlert.ToString();
                            break;
                        }
                    }
                }

                string statusMessage = "";

                switch (this._state)
                {
                case TimetableSelectionStates.UniqueYeargroup:
                    if (recordCount.Equals(0))
                    {
                        statusMessage = "Found no yeargroups!";
                    }
                    else if (recordCount.Equals(1))
                    {
                        statusMessage = "Found <strong>1</strong> yeargroup";
                    }
                    else
                    {
                        statusMessage = "Found <strong>" + recordCount + "</strong> yeargroups";
                    }
                    break;

                case TimetableSelectionStates.UniqueRoom:
                case TimetableSelectionStates.ClassRoom:
                    if (recordCount.Equals(0))
                    {
                        statusMessage = "Found no rooms!";
                    }
                    else if (recordCount.Equals(1))
                    {
                        statusMessage = "Found <strong>1</strong> room";
                    }
                    else
                    {
                        statusMessage = "Found <strong>" + recordCount + "</strong> rooms";
                    }
                    break;

                case TimetableSelectionStates.ClassSubject:
                    if (recordCount.Equals(0))
                    {
                        statusMessage = "Found no subjects!";
                    }
                    else if (recordCount.Equals(1))
                    {
                        statusMessage = "Found <strong>1</strong> subject";
                    }
                    else
                    {
                        statusMessage = "Found <strong>" + recordCount + "</strong> subjects";
                    }
                    break;

                case TimetableSelectionStates.ClassQualification:
                    if (recordCount.Equals(0))
                    {
                        statusMessage = "Found no qualifications!";
                    }
                    else if (recordCount.Equals(1))
                    {
                        statusMessage = "Found <strong>1</strong> qualification";
                    }
                    else
                    {
                        statusMessage = "Found <strong>" + recordCount + "</strong> qualifications";
                    }
                    break;

                case TimetableSelectionStates.ClassClass:
                    if (recordCount.Equals(0))
                    {
                        statusMessage = "Found no classes!";
                    }
                    else if (recordCount.Equals(1))
                    {
                        statusMessage = "Found <strong>1</strong> class";
                    }
                    else
                    {
                        statusMessage = "Found <strong>" + recordCount + "</strong> classes";
                    }
                    break;
                }

                if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("StaffTeachingTimetableSelection"))
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["StaffTeachingTimetableSelection"] = statusMessage;
                }
                else
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("StaffTeachingTimetableSelection", statusMessage);
                }
            }
            else
            {
                if (this._success)
                {
                    Core.Helpers.Elements.Alerts.Alert success = new Core.Helpers.Elements.Alerts.Alert("Success");
                    success.Colour  = Core.Helpers.Elements.Alerts.Colours.Green;
                    success.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/success.html").ToString();

                    this.Page.Contents = success.ToString();
                }
                else
                {
                    Core.Helpers.Elements.Alerts.Alert noSelection = new Core.Helpers.Elements.Alerts.Alert("NoSelection");
                    noSelection.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                    noSelection.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/Selection/noselectionstate.html").ToString();

                    this.Page.Contents = noSelection.ToString();
                }

                if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("StaffTeachingTimetableSelection"))
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["StaffTeachingTimetableSelection"] = "";
                }
                else
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("StaffTeachingTimetableSelection", "");
                }
            }
        }
예제 #6
0
        protected override void GenerateOutput()
        {
            this.SetYearAndMonth();

            Core.Helpers.Elements.DataGrids.Calendar.Calendar calendar = new Core.Helpers.Elements.DataGrids.Calendar.Calendar();
            calendar.Year  = this._year;
            calendar.Month = this._month;

            calendar.Events.Past.Type   = Core.Helpers.Elements.DataGrids.CellTypes.Standard;
            calendar.Events.Past.Colour = Core.Helpers.Elements.DataGrids.CellColours.Red;
            calendar.Events.Past.Value  = "Day";

            calendar.Events.NoDay.Type   = Core.Helpers.Elements.DataGrids.CellTypes.Standard;
            calendar.Events.NoDay.Colour = Core.Helpers.Elements.DataGrids.CellColours.Red;
            calendar.Events.NoDay.Value  = "Day";

            calendar.Events.TodayInRange.Type   = Core.Helpers.Elements.DataGrids.CellTypes.Standard;
            calendar.Events.TodayInRange.Colour = Core.Helpers.Elements.DataGrids.CellColours.Yellow;
            calendar.Events.TodayInRange.Value  = "Day";
            calendar.Events.TodayInRange.Href   = "/cover/arrange/attendance/Year/Month/Day/";

            calendar.Events.InRange.Type   = Core.Helpers.Elements.DataGrids.CellTypes.Standard;
            calendar.Events.InRange.Colour = Core.Helpers.Elements.DataGrids.CellColours.Green;
            calendar.Events.InRange.Value  = "Day";
            calendar.Events.InRange.Href   = "/cover/arrange/attendance/Year/Month/Day/";

            calendar.Events.OutOfRange.Type   = Core.Helpers.Elements.DataGrids.CellTypes.Standard;
            calendar.Events.OutOfRange.Colour = Core.Helpers.Elements.DataGrids.CellColours.Red;
            calendar.Events.OutOfRange.Value  = "Day";

            if (this.Path.HasNext())
            {
                Core.Helpers.Elements.Alerts.Alert alert = new Core.Helpers.Elements.Alerts.Alert("");
                switch (this.Path.Next())
                {
                case "invalid":
                    alert.Id           = "InvalidDetails";
                    alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                    alert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Calendar/invalid.html").ToString();
                    alert.NoScript     = false;
                    alert.StartHidden  = false;
                    alert.ShowCloseBox = true;

                    this.Page.Contents = alert.ToString();
                    break;

                case "outofrange":
                    alert.Id           = "OutOfRange";
                    alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                    alert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Calendar/outofrange.html").ToString();
                    alert.NoScript     = false;
                    alert.StartHidden  = false;
                    alert.ShowCloseBox = true;

                    this.Page.Contents = alert.ToString();
                    break;

                case "noperiods":
                    alert.Id           = "NoPeriods";
                    alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                    alert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Calendar/noperiods.html").ToString();
                    alert.NoScript     = false;
                    alert.StartHidden  = false;
                    alert.ShowCloseBox = true;

                    this.Page.Contents = alert.ToString();
                    break;
                }
            }

            calendar.TopControls.Left.Value   = "MonthName, Year";
            calendar.TopControls.Centre.Value = "MonthName, Year";
            calendar.TopControls.Right.Value  = "MonthName, Year";

            calendar.TopControls.Left.OnClick  = "getUpdatedResponse('Calendar', '?path=/cover/arrange/calendar/ajax/Year/Month/ignore/');";
            calendar.TopControls.Right.OnClick = "getUpdatedResponse('Calendar', '?path=/cover/arrange/calendar/ajax/Year/Month/ignore/');";

            this.Page.Contents += calendar.ToString();
        }
예제 #7
0
        protected override void GenerateOutput()
        {
            Core.Helpers.Path.Parser sourcePath = new Core.Helpers.Path.Parser(Core.WebServer.Request["sourcepath"]);
            bool validSourceDate = this.CheckInputValidity(false, sourcePath);
            bool validAjaxDate   = this.CheckInputValidity(true, this.Path);

            if (!validSourceDate && !validAjaxDate)
            {
                Core.Helpers.Elements.Alerts.Alert noDate = new Core.Helpers.Elements.Alerts.Alert("NoDate");
                noDate.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                noDate.NoScript     = false;
                noDate.ShowCloseBox = false;
                noDate.StartHidden  = false;
                noDate.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Slips/Requests/nodate.html").ToString();

                this.Page.Contents = noDate.ToString();
            }
            else
            {
                Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
                string searchTerm = "";

                if (this.Path.HasNext())
                {
                    searchTerm = this.Path.Next();
                }

                paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate);
                paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek);
                paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1));
                paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", searchTerm);

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/slips/selective.sql", paramBuilder.Parameters)) {
                    if (dataReader.HasRows)
                    {
                        Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();

                        while (dataReader.Read())
                        {
                            Records.CoverSelected record = new Records.CoverSelected();
                            record.Record.Colour = Core.Helpers.Elements.RecordLists.Colours.Blue;

                            record.IsInternalCover = (bool)dataReader["IsInternal"];
                            record.Period          = (int)dataReader["Period"];
                            record.CommitmentName  = dataReader["CommitmentName"] as string;

                            UserManagement.StaffNameFormatter absenteeNameFormatter = new UserManagement.StaffNameFormatter();
                            absenteeNameFormatter.Forename    = dataReader["AbsentForename"] as string;
                            absenteeNameFormatter.Surname     = dataReader["AbsentSurname"] as string;
                            absenteeNameFormatter.HoldingName = dataReader["AbsentHoldingName"] as string;

                            record.AbsenteeName        = absenteeNameFormatter;
                            record.AbsenteeNameToolTip = absenteeNameFormatter;

                            UserManagement.StaffNameFormatter coveringNameFormatter = new UserManagement.StaffNameFormatter();
                            coveringNameFormatter.Forename    = dataReader["CoverForename"] as string;
                            coveringNameFormatter.Surname     = dataReader["CoverSurname"] as string;
                            coveringNameFormatter.HoldingName = dataReader["CoverHoldingName"] as string;

                            record.CoverStaffName = coveringNameFormatter;

                            recordCollection.Add(record.Record);
                        }

                        this.Page.Contents = recordCollection.ToString();
                    }
                    else
                    {
                        Core.Helpers.Elements.Alerts.Alert noRequests = new Core.Helpers.Elements.Alerts.Alert("NoRequests");
                        noRequests.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                        noRequests.NoScript     = false;
                        noRequests.ShowCloseBox = false;
                        noRequests.StartHidden  = false;
                        noRequests.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Slips/Requests/norequests.html").ToString();

                        this.Page.Contents = noRequests.ToString();
                    }
                }
            }
        }
예제 #8
0
        protected override void GenerateOutput()
        {
            string searchTerm   = this.GetSearchTerm();
            string alertMessage = this.GetAlertMessage();

            Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
            paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", searchTerm);

            if ((!string.IsNullOrEmpty(alertMessage)) && (alertMessage.Equals("unknownoutside")))
            {
                Core.Helpers.Elements.Alerts.Alert unknownTeachingAlert = new Core.Helpers.Elements.Alerts.Alert("UnknownTeaching");
                unknownTeachingAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                unknownTeachingAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Landing/Outside/unknown.html").ToString();
                unknownTeachingAlert.NoScript     = false;
                unknownTeachingAlert.ShowCloseBox = true;
                unknownTeachingAlert.StartHidden  = false;

                this.Page.Contents = unknownTeachingAlert.ToString();
            }

            using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Staff/Landing/outside.sql", paramBuilder.Parameters)) {
                if (dataReader.HasRows)
                {
                    Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();
                    int recordCount = 0;

                    while (dataReader.Read())
                    {
                        Records.OutsideCoverStaffMember outsideCoverStaffRecord = new Records.OutsideCoverStaffMember();
                        StaffNameFormatter staffName = new StaffNameFormatter();
                        staffName.Forename = dataReader["Forename"] as string;
                        staffName.Surname  = dataReader["Surname"] as string;

                        outsideCoverStaffRecord.Id   = (int)dataReader["OutsideCoverStaffId"];
                        outsideCoverStaffRecord.Name = staffName;

                        recordCollection.Add(outsideCoverStaffRecord.Record);
                        recordCount++;
                    }

                    if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("StaffOutsideCount"))
                    {
                        Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["StaffOutsideCount"] = recordCount;
                    }
                    else
                    {
                        Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("StaffOutsideCount", recordCount);
                    }

                    this.Page.Contents += recordCollection.ToString();
                }
                else
                {
                    Core.Helpers.Elements.Alerts.Alert noOutsideStaffAlert = new Core.Helpers.Elements.Alerts.Alert("NoOutsideStaff");
                    noOutsideStaffAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                    noOutsideStaffAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Landing/Outside/none.html").ToString();
                    noOutsideStaffAlert.NoScript     = false;
                    noOutsideStaffAlert.ShowCloseBox = false;
                    noOutsideStaffAlert.StartHidden  = false;

                    this.Page.Contents += noOutsideStaffAlert.ToString();
                }
            }
        }
예제 #9
0
        protected override void SetTabSpecific()
        {
            foreach (Core.Helpers.Elements.Tabs.Tab tab in this.Tabs)
            {
                Core.Helpers.Elements.MenuBar.Bar menuBar = new Core.Helpers.Elements.MenuBar.Bar();
                menuBar.Text = "Rotation week <strong>" + this._weekNo + "</strong>, <strong>" + ((DayOfWeek)(this._dayNo - 1)) + "</strong>, period <strong>" + this._period + "</strong>";
                menuBar.AddButton("back.png", "Click here to jump back to the staff member's timetable.", "?path=/staff/modify/teaching/" + this._staffId + "/week/" + this._weekNo + "/#Timetable", null);

                switch (tab.Id)
                {
                case "Unavailable":
                    if (this._state.Equals(TimetableStates.Unavailable))
                    {
                        tab.Content.SetVariable("UnavailableForm", new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/current.html").ToString());
                    }
                    else
                    {
                        Core.Helpers.Elements.Forms.BasicForm unavailableForm = new Core.Helpers.Elements.Forms.BasicForm();
                        unavailableForm.Id          = "Unavailable";
                        unavailableForm.HasTopSpace = true;
                        unavailableForm.PostUrl     = "/staff/modify/update/teaching/timetable/";
                        unavailableForm.AddButton(null, "Switch", null, 1, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

                        unavailableForm.AddHiddenField("State", null, "Unavailable");
                        unavailableForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                        unavailableForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                        unavailableForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                        unavailableForm.AddHiddenField("Period", null, this._period.ToString());

                        tab.Content.SetVariable("UnavailableForm", unavailableForm.ToString());
                    }

                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Free":
                    if (this._state.Equals(TimetableStates.Free))
                    {
                        tab.Content.SetVariable("FreeForm", new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/current.html").ToString());
                    }
                    else
                    {
                        Core.Helpers.Elements.Forms.BasicForm freeForm = new Core.Helpers.Elements.Forms.BasicForm();
                        freeForm.Id          = "Free";
                        freeForm.HasTopSpace = true;
                        freeForm.PostUrl     = "/staff/modify/update/teaching/timetable/";
                        freeForm.AddButton(null, "Switch", null, 1, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

                        freeForm.AddHiddenField("State", null, "Free");
                        freeForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                        freeForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                        freeForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                        freeForm.AddHiddenField("Period", null, this._period.ToString());

                        tab.Content.SetVariable("FreeForm", freeForm.ToString());
                    }

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Teaching":
                    Core.Helpers.Elements.Forms.GroupedForm teachingForm = new Core.Helpers.Elements.Forms.GroupedForm();
                    teachingForm.Id             = "Teaching";
                    teachingForm.HasTopSpace    = true;
                    teachingForm.PostUrl        = "/staff/modify/update/teaching/timetable/";
                    teachingForm.RadioGroupName = "SelectedGroup";

                    teachingForm.AddHiddenField("State", null, "Teaching");
                    teachingForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                    teachingForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                    teachingForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                    teachingForm.AddHiddenField("Period", null, this._period.ToString());

                    Core.Helpers.Elements.Forms.Group uniqueGroup = teachingForm.AddGroup("Unique");
                    uniqueGroup.TitleDetails.Image.Src     = "teach.png";
                    uniqueGroup.TitleDetails.Image.Tooltip = "A timetable entry unique to this staff member.";
                    uniqueGroup.TitleDetails.Text          = "<strong>A unique teaching entry</strong>";
                    uniqueGroup.RadioValue = "Unique";

                    if (this.Path.HasNext() && this.Path.Peek().Equals("uniquefail"))
                    {
                        Core.Helpers.Elements.Alerts.Alert uniqueFail = new Core.Helpers.Elements.Alerts.Alert("UniqueFail");
                        uniqueFail.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                        uniqueFail.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/uniquefailed.html").ToString();

                        uniqueGroup.RightPane.Contents = uniqueFail.ToString();
                    }
                    else
                    {
                        uniqueGroup.RightPane.Contents = "&nbsp;";
                    }

                    Core.Helpers.Elements.Forms.Group classGroup = teachingForm.AddGroup("Class");
                    classGroup.TitleDetails.Image.Src     = "teach.png";
                    classGroup.TitleDetails.Image.Tooltip = "A class";
                    classGroup.TitleDetails.Text          = "<strong>A class</strong>";
                    classGroup.RadioValue = "Class";

                    if (this.Path.HasNext() && this.Path.Peek().Equals("classfail"))
                    {
                        Core.Helpers.Elements.Alerts.Alert classFail = new Core.Helpers.Elements.Alerts.Alert("ClassFail");
                        classFail.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                        classFail.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/classfailed.html").ToString();

                        classGroup.RightPane.Contents = classFail.ToString();
                    }
                    else
                    {
                        classGroup.RightPane.Contents = "&nbsp;";
                    }

                    this.CreateUniqueYeargroup(teachingForm, uniqueGroup);
                    this.CreateUniqueRoom(teachingForm, uniqueGroup);
                    this.CreateUniqueName(teachingForm, uniqueGroup);

                    this.CreateClassSubject(teachingForm, classGroup);
                    this.CreateClassQualification(teachingForm, classGroup);
                    this.CreateClassClass(teachingForm, classGroup);
                    this.CreateClassRoom(teachingForm, classGroup);

                    if (this._state.Equals(TimetableStates.Teaching))
                    {
                        if (this._isUnique)
                        {
                            teachingForm.OnReset  = "setFormTo('Teaching', 'Unique');";
                            uniqueGroup.IsDefault = true;
                        }
                        else
                        {
                            teachingForm.OnReset = "setFormTo('Teaching', 'Class');";
                            classGroup.IsDefault = true;
                        }

                        teachingForm.AddButton(null, "Reset", "resetNonFields();", 3, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
                        teachingForm.AddButton(null, "Update", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                    }
                    else
                    {
                        teachingForm.AddButton(null, "Switch", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                    }

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");

                    tab.Content.SetVariable("TeachingForm", teachingForm.ToString());
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Selection":
                    Core.Helpers.Elements.Search.SearchArea selectionSearch = new Core.Helpers.Elements.Search.SearchArea("Selection");
                    selectionSearch.AddButton("search.png", null, "doSelectionSearch();", "Click here to search.");
                    selectionSearch.AddButton("refresh.png", null, "resetSelectionSearch();", "Click here to reset the search criteria.");
                    selectionSearch.AddButton("back.png", null, "switchToTab('Teaching');", "Click here to jump back to the 'Teaching' tab.");
                    selectionSearch.AjaxUrl       = "/staff/modify/ajax/teaching/timetable/selection/search/";
                    selectionSearch.AjaxStatusUrl = "/staff/modify/ajax/teaching/timetable/selection/status/";

                    tab.Content.SetVariable("SearchArea", selectionSearch.ToString());
                    break;

                case "Busy":
                    Core.Helpers.Elements.Forms.BasicForm busyForm = new Core.Helpers.Elements.Forms.BasicForm();
                    busyForm.Id          = "Busy";
                    busyForm.HasTopSpace = true;
                    busyForm.PostUrl     = "/staff/modify/update/teaching/timetable/";

                    busyForm.AddHiddenField("State", null, "Busy");
                    busyForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                    busyForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                    busyForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                    busyForm.AddHiddenField("Period", null, this._period.ToString());

                    Core.Helpers.Elements.Forms.Row busyRow = busyForm.AddRow();
                    busyRow.Description = "<strong>Commitment Name</strong>";

                    if (tab.Alerts.IsEmpty)
                    {
                        busyForm.RightPane.Contents = "&nbsp;";
                    }
                    else
                    {
                        busyForm.RightPane.Contents = tab.Alerts.ToString();
                    }

                    if (this._state.Equals(TimetableStates.Busy))
                    {
                        busyForm.AddButton(null, "Reset", null, 3, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
                        busyForm.AddButton(null, "Update", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                        busyRow.SetToTextField("BusyCommitment", null, this._commitmentName, 1, 0, false, false);
                    }
                    else
                    {
                        busyForm.AddButton(null, "Switch", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                        busyRow.SetToTextField("BusyCommitment", null, null, 1, 0, false, false);
                    }

                    tab.Content.SetVariable("BusyForm", busyForm.ToString());

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;
                }
            }
        }
예제 #10
0
        protected override void GenerateOutput()
        {
            string searchTerm   = this.GetSearchTerm();
            string alertMessage = this.GetAlertMessage();
            List <Accounts.NonTeachingAccount> searchResults = Core.WebServer.PleaseTakes.Session.CurrentInstance.School.Settings.NonTeachingAccounts.Search(searchTerm);

            if ((!string.IsNullOrEmpty(alertMessage)) && (alertMessage.Equals("unknownnonteaching")))
            {
                Core.Helpers.Elements.Alerts.Alert unknownTeachingAlert = new Core.Helpers.Elements.Alerts.Alert("UnknownTeaching");
                unknownTeachingAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                unknownTeachingAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Landing/Nonteaching/unknown.html").ToString();
                unknownTeachingAlert.NoScript     = false;
                unknownTeachingAlert.ShowCloseBox = true;
                unknownTeachingAlert.StartHidden  = false;

                this.Page.Contents = unknownTeachingAlert.ToString();
            }

            if (searchResults.Count > 0)
            {
                Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();

                foreach (Accounts.NonTeachingAccount account in searchResults)
                {
                    Records.NonTeachingStaffMember nonTeachingStaffRecord = new Records.NonTeachingStaffMember();
                    StaffNameFormatter             staffName = new StaffNameFormatter();

                    staffName.DisplayForenameFirst = true;
                    staffName.Forename             = account.Forename;
                    staffName.Surname = account.Surname;

                    nonTeachingStaffRecord.Username        = account.Username;
                    nonTeachingStaffRecord.Name            = staffName;
                    nonTeachingStaffRecord.IsAccountActive = account.IsActive;

                    recordCollection.Add(nonTeachingStaffRecord.Record);
                }

                if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("StaffNonTeachingCount"))
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["StaffNonTeachingCount"] = searchResults.Count;
                }
                else
                {
                    Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("StaffNonTeachingCount", searchResults.Count);
                }

                this.Page.Contents += recordCollection.ToString();
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert noNonTeachingAlert = new Core.Helpers.Elements.Alerts.Alert("NoNonTeaching");
                noNonTeachingAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                noNonTeachingAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Landing/Nonteaching/none.html").ToString();
                noNonTeachingAlert.NoScript     = false;
                noNonTeachingAlert.ShowCloseBox = false;
                noNonTeachingAlert.StartHidden  = false;

                this.Page.Contents += noNonTeachingAlert.ToString();
            }
        }
예제 #11
0
		private Group GetAccountEnabledGroup(GroupedForm parent) {
			Group enabledGroup = parent.AddGroup("Enabled");
			enabledGroup.RadioValue = "Enabled";
			enabledGroup.TitleDetails.Text = "<strong>A PleaseTakes account exists for this teaching staff member</strong>";
			enabledGroup.TitleDetails.Image.Src = "addkey.png";
			enabledGroup.TitleDetails.Image.Tooltip = "An account exists";
			enabledGroup.IsDefault = this._hasAccount;

			string alertMessage = (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountAlert", true);

			if (string.IsNullOrEmpty(alertMessage))
				enabledGroup.RightPane.Contents = "&nbsp;";
			else {
				switch (alertMessage) {
					case "missing":
						Core.Helpers.Elements.Alerts.Alert missingAlert = new Core.Helpers.Elements.Alerts.Alert("MissingDetails");
						missingAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
						missingAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/missing.html").ToString();

						enabledGroup.RightPane.Contents = missingAlert.ToString();
						break;
					case "exists":
						Core.Helpers.Elements.Alerts.Alert alreadyExistsAlert = new Core.Helpers.Elements.Alerts.Alert("AlreadyExists");
						alreadyExistsAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
						alreadyExistsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/exists.html").ToString();

						enabledGroup.RightPane.Contents = alreadyExistsAlert.ToString();
						break;
					case "updated":
						Core.Helpers.Elements.Alerts.Alert updatedAlert = new Core.Helpers.Elements.Alerts.Alert("Updated");
						updatedAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						updatedAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/updated.html").ToString();

						enabledGroup.RightPane.Contents = updatedAlert.ToString();
						break;
					case "created":
						Core.Helpers.Constructor createdConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/created.html");
						createdConstructor.SetVariable("Password", (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountPassword", true));

						Core.Helpers.Elements.Alerts.Alert createdAlert = new Core.Helpers.Elements.Alerts.Alert("Created");
						createdAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						createdAlert.Message = createdConstructor.ToString();

						enabledGroup.RightPane.Contents = createdAlert.ToString();
						break;
					case "deleted":
						Core.Helpers.Elements.Alerts.Alert deletedAlert = new Core.Helpers.Elements.Alerts.Alert("Deleted");
						deletedAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						deletedAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/deleted.html").ToString();

						enabledGroup.RightPane.Contents = deletedAlert.ToString();
						break;
					case "resetnoaccount":
						Core.Helpers.Elements.Alerts.Alert resetNoAccountAlert = new Core.Helpers.Elements.Alerts.Alert("ResetNoAccount");
						resetNoAccountAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Yellow;
						resetNoAccountAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/resetnoaccount.html").ToString();

						enabledGroup.RightPane.Contents = resetNoAccountAlert.ToString();
						break;
					case "resetsuccess":
						Core.Helpers.Constructor resetSuccessConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/resetsuccess.html");
						resetSuccessConstructor.SetVariable("Password", (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountPassword", true));

						Core.Helpers.Elements.Alerts.Alert resetSuccessAlert = new Core.Helpers.Elements.Alerts.Alert("ResetSuccess");
						resetSuccessAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						resetSuccessAlert.Message = resetSuccessConstructor.ToString();

						enabledGroup.RightPane.Contents = resetSuccessAlert.ToString();
						break;
					case "loggedin":
						Core.Helpers.Elements.Alerts.Alert loggedInAlert = new Core.Helpers.Elements.Alerts.Alert("LoggedIn");
						loggedInAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Yellow;
						loggedInAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/loggedin.html").ToString();

						enabledGroup.RightPane.Contents = loggedInAlert.ToString();
						break;
					default:
						enabledGroup.RightPane.Contents = "&nbsp;";
						break;
				}
			}

			Row username = enabledGroup.AddRow();
			username.Description = "<strong>Username</strong>";
			username.SetToTextField("Username", null, this._username, 1, 0, false, false);

			Row password = enabledGroup.AddRow();
			password.Description = "<strong>Password</strong>";

			if (this._hasAccount)
				password.Text = "<a href=\"?path=/staff/modify/update/teaching/account/reset/" + this._staffId + "/\"><em>Click to reset...</em></a>";
			else
				password.Text = "<em>Automatically generated</em>";

			Row accountType = enabledGroup.AddRow();
			accountType.Description = "<strong>Account Type</strong>";
			accountType.SetToRadioGroup();

			RadioGroup typeGroup = (RadioGroup)accountType.FormElement;
			typeGroup.Name = "AccountType";

			RadioButton administrative = typeGroup.AddRadioButton();
			administrative.Value = "Administrative";
			administrative.Label = "Administrative";
			administrative.TabIndex = 2;
			administrative.IsChecked = (this._hasAccount && this._isAdmin);

			RadioButton standard = typeGroup.AddRadioButton();
			standard.Value = "Standard";
			standard.Label = "Standard";
			standard.TabIndex = 3;
			standard.IsChecked = (this._hasAccount && !this._isAdmin);

			Row active = enabledGroup.AddRow();
			active.Description = "<strong>Is Active?</strong>";
			active.SetToRadioGroup();

			RadioGroup activeGroup = (RadioGroup)active.FormElement;
			activeGroup.Name = "Active";

			RadioButton yes = activeGroup.AddRadioButton();
			yes.Value = "Yes";
			yes.Label = "Yes";
			yes.TabIndex = 4;
			yes.IsChecked = (this._hasAccount && this._isActive);

			RadioButton no = activeGroup.AddRadioButton();
			no.Value = "No";
			no.Label = "No";
			no.TabIndex = 5;
			no.IsChecked = (this._hasAccount && !this._isActive);

			return enabledGroup;
		}
예제 #12
0
		protected override void SetTabSpecific() {
			foreach (Core.Helpers.Elements.Tabs.Tab tab in this.Tabs) {
				switch (tab.Id) {
					case "Name":
						Core.Helpers.Elements.Forms.BasicForm nameForm = new Core.Helpers.Elements.Forms.BasicForm();
						nameForm.Id = "Name";
						nameForm.FieldWidths = 250;
						nameForm.HasTopSpace = true;
						nameForm.PostUrl = "/staff/modify/update/teaching/name/";

						nameForm.AddHiddenField("StaffId", null, this._staffId.ToString());

						nameForm.AddButton(null, "Reset", null, 6, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
						nameForm.AddButton(null, "Update", null, 5, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

						if (!string.IsNullOrEmpty(this._alert)) {
							switch (this._alert) {
								case "nameallblank":
									Core.Helpers.Elements.Alerts.Alert nameAllBlankAlert = new Core.Helpers.Elements.Alerts.Alert("NameAllBlank");
									nameAllBlankAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
									nameAllBlankAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Name/nameallblank.html").ToString();
									nameAllBlankAlert.NoScript = false;
									nameAllBlankAlert.ShowCloseBox = false;
									nameAllBlankAlert.StartHidden = false;

									nameForm.RightPane.Contents = nameAllBlankAlert.ToString();
									break;
								case "nameincomplete":
									Core.Helpers.Elements.Alerts.Alert nameIncompleteAlert = new Core.Helpers.Elements.Alerts.Alert("NameIncomplete");
									nameIncompleteAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
									nameIncompleteAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Name/nameincomplete.html").ToString();
									nameIncompleteAlert.NoScript = false;
									nameIncompleteAlert.ShowCloseBox = false;
									nameIncompleteAlert.StartHidden = false;

									nameForm.RightPane.Contents = nameIncompleteAlert.ToString();
									break;
								case "namesuccess":
									Core.Helpers.Elements.Alerts.Alert nameSuccessAlert = new Core.Helpers.Elements.Alerts.Alert("NameSuccess");
									nameSuccessAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
									nameSuccessAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Name/namesuccess.html").ToString();
									nameSuccessAlert.NoScript = false;
									nameSuccessAlert.ShowCloseBox = false;
									nameSuccessAlert.StartHidden = false;

									nameForm.RightPane.Contents = nameSuccessAlert.ToString();
									break;
								case "namenew":
									Core.Helpers.Elements.Alerts.Alert newStaffMemberAlert = new Core.Helpers.Elements.Alerts.Alert("NewStaffMember");
									newStaffMemberAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
									newStaffMemberAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Name/new.html").ToString();
									newStaffMemberAlert.NoScript = false;
									newStaffMemberAlert.ShowCloseBox = false;
									newStaffMemberAlert.StartHidden = false;

									nameForm.RightPane.Contents = newStaffMemberAlert.ToString();
									break;
								default:
									nameForm.RightPane.Contents = "&nbsp;";
									break;
							}
						}
						else
							nameForm.RightPane.Contents = "&nbsp;";

						Core.Helpers.Elements.Forms.Row titleRow = nameForm.AddRow();
						titleRow.Description = "<strong>Title</strong>";
						titleRow.SetToTextField("Title", null, this._name.Title, 1, 0, false, false);

						Core.Helpers.Elements.Forms.Row forenameRow = nameForm.AddRow();
						forenameRow.Description = "<strong>Forename</strong>";
						forenameRow.SetToTextField("Forename", null, this._name.Forename, 2, 0, false, false);

						Core.Helpers.Elements.Forms.Row surnameRow = nameForm.AddRow();
						surnameRow.Description = "<strong>Surname</strong>";
						surnameRow.SetToTextField("Surname", null, this._name.Surname, 3, 0, false, false);

						Core.Helpers.Elements.Forms.Row holdingNameRow = nameForm.AddRow();
						holdingNameRow.Description = "<strong>Holding Name</strong>";
						holdingNameRow.SetToTextField("HoldingName", null, this._name.HoldingName, 4, 0, false, true);

						tab.Content.SetVariable("NameForm", nameForm.ToString());
						break;
					case "Entitlement":
						Core.Helpers.Elements.Forms.BasicForm entitlementForm = new Core.Helpers.Elements.Forms.BasicForm();
						entitlementForm.Id = "Entitlement";
						entitlementForm.HasTopSpace = true;
						entitlementForm.FieldWidths = 250;
						entitlementForm.PostUrl = "/staff/modify/update/teaching/entitlement/";

						entitlementForm.AddHiddenField("StaffId", null, this._staffId.ToString());

						entitlementForm.AddButton(null, "Reset", null, 3, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
						entitlementForm.AddButton(null, "Update", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

						if (!string.IsNullOrEmpty(this._alert)) {
							switch (this._alert) {
								case "entitlementbad":
									Core.Helpers.Elements.Alerts.Alert entitlementBadAlert = new Core.Helpers.Elements.Alerts.Alert("EntitlementBad");
									entitlementBadAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
									entitlementBadAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Entitlement/entitlementbad.html").ToString();
									entitlementBadAlert.NoScript = false;
									entitlementBadAlert.ShowCloseBox = false;
									entitlementBadAlert.StartHidden = false;

									entitlementForm.RightPane.Contents = entitlementBadAlert.ToString();
									break;
								case "entitlementsuccess":
									Core.Helpers.Elements.Alerts.Alert entitlementSuccessAlert = new Core.Helpers.Elements.Alerts.Alert("EntitlementSuccess");
									entitlementSuccessAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
									entitlementSuccessAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Entitlement/entitlementsuccess.html").ToString();
									entitlementSuccessAlert.NoScript = false;
									entitlementSuccessAlert.ShowCloseBox = false;
									entitlementSuccessAlert.StartHidden = false;

									entitlementForm.RightPane.Contents = entitlementSuccessAlert.ToString();
									break;
							}
						}
						else
							entitlementForm.RightPane.Contents = "&nbsp;";

						Core.Helpers.Elements.Forms.Row entitlementRow = entitlementForm.AddRow();
						entitlementRow.Description = "<strong>Entitlement Value</strong>";
						entitlementRow.SetToTextField("Entitlement", null, this._entitlement.ToString(), 1, Core.WebServer.PleaseTakes.Session.CurrentInstance.School.Settings.Timetabling.Layout.NoPeriods.ToString().Length, false, false);

						tab.Content.SetVariable("EntitlementForm", entitlementForm.ToString());
						tab.Content.SetVariable("MaxPeriods", Core.WebServer.PleaseTakes.Session.CurrentInstance.School.Settings.Timetabling.Layout.NoPeriods.ToString());
						break;
					case "Account":
						tab.Content.SetVariable("AccountForm", this.InitialiseAccountForm().ToString());
						break;
					case "Department":
						Core.Helpers.Elements.Search.SearchArea departmentSearch = new Core.Helpers.Elements.Search.SearchArea("Department");
						departmentSearch.AjaxUrl = "/staff/modify/ajax/teaching/department/" + this._staffId + "/search/";
						departmentSearch.AjaxStatusUrl = "/staff/modify/ajax/teaching/department/status/";
						departmentSearch.AddButton("search.png", null, "doSearch('Department');", "Click here to search for departments.");
						departmentSearch.AddButton("refresh.png", null, "resetSearch('Department');", "Click here to reset the department search.");

						tab.Content.SetVariable("DepartmentSearchArea", departmentSearch.ToString());
						break;
					case "Timetable":
						Core.Helpers.Elements.Ajax.Element ajaxTimetableArea = new Core.Helpers.Elements.Ajax.Element("Timetable");
						ajaxTimetableArea.ShowLoadingMessage = true;
						ajaxTimetableArea.GetPath = true;
						ajaxTimetableArea.Url = "/staff/modify/ajax/teaching/timetable/" + this._staffId + "/";

						Core.Helpers.Elements.Alerts.Alert statusAlert = this.GetTimetableStatusMessage();

						if (statusAlert == null)
							tab.Content.DeleteVariable("UpdateAlert");
						else
							tab.Content.SetVariable("UpdateAlert", statusAlert.ToString());

						tab.Content.SetVariable("AjaxTimetable", ajaxTimetableArea.ToString());
						break;
				}
			}
		}
예제 #13
0
        protected override void GenerateOutput()
        {
            if (this.HasStaffId())
            {
                this.SetSearchTerm();

                Core.Helpers.Database.ParameterBuilder       paramBuilder     = new Core.Helpers.Database.ParameterBuilder();
                Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();
                recordCollection.Id = "Department";

                paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", this._staffId);
                paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", this._searchTerm);

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Staff/Modify/Teaching/department.sql", paramBuilder.Parameters)) {
                    dataReader.Read();

                    if (((bool)dataReader["Status"]))
                    {
                        dataReader.NextResult();

                        if (dataReader.HasRows)
                        {
                            int recordCount = 0;

                            while (dataReader.Read())
                            {
                                Core.Helpers.Elements.RecordLists.Record departmentRecord = new Core.Helpers.Elements.RecordLists.Record();

                                int departmentId = (int)dataReader["Id"];

                                departmentRecord.LeftSide.Image.Source  = "books.png";
                                departmentRecord.LeftSide.Image.ToolTip = "Department";
                                departmentRecord.LeftSide.MainText      = dataReader["Name"] as string;
                                departmentRecord.Id      = departmentId.ToString();
                                departmentRecord.OnClick = "getResponse('Department" + departmentId + "', '?path=/staff/modify/update/teaching/department/" + this._staffId + "/" + departmentId + "/', false, false, true);";

                                if ((bool)dataReader["IsSelected"])
                                {
                                    departmentRecord.Colour = Core.Helpers.Elements.RecordLists.Colours.Green;
                                }
                                else
                                {
                                    departmentRecord.Colour = Core.Helpers.Elements.RecordLists.Colours.Blue;
                                }

                                recordCollection.Add(departmentRecord);
                                recordCount++;
                            }

                            this.Page.Contents = recordCollection.ToString();

                            if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("StaffTeachingDepartmentSelection"))
                            {
                                Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["StaffTeachingDepartmentSelection"] = recordCount;
                            }
                            else
                            {
                                Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("StaffTeachingDepartmentSelection", recordCount);
                            }
                        }
                        else
                        {
                            Core.Helpers.Elements.Alerts.Alert noResultsAlert = new Core.Helpers.Elements.Alerts.Alert("NoResults");
                            noResultsAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Yellow;
                            noResultsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Department/noresults.html").ToString();

                            this.Page.Contents = noResultsAlert.ToString();
                        }
                    }
                    else
                    {
                        Core.Helpers.Elements.Alerts.Alert invalidAlert = new Core.Helpers.Elements.Alerts.Alert("InvalidDetails");
                        invalidAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                        invalidAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Department/invalid.html").ToString();

                        this.Page.Contents = invalidAlert.ToString();
                    }
                }
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert missingAlert = new Core.Helpers.Elements.Alerts.Alert("MissingDetails");
                missingAlert.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                missingAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Department/missing.html").ToString();

                this.Page.Contents = missingAlert.ToString();
            }
        }
예제 #14
0
        protected override void GenerateOutput()
        {
            bool   isInternal          = false;
            bool   showZeroEntitlement = false;
            string statusMessage       = "";

            if (this.Path.HasNext())
            {
                int    coverId;
                string searchTerm;

                if (this.GetBoolInput(out isInternal) && this.GetBoolInput(out showZeroEntitlement) && this.CheckInputValidity() && this.GetCoverId(out coverId))
                {
                    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;
                    searchTerm = this.GetSearchTerm();

                    Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
                    paramBuilder.AddParameter(SqlDbType.Int, "@CoverId", coverId);
                    paramBuilder.AddParameter(SqlDbType.Bit, "@GetInternalStaff", isInternal);
                    paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@CurrentDate", this._selectedDate);
                    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));
                    paramBuilder.AddParameter(SqlDbType.Bit, "@ShowZeroEntitlement", showZeroEntitlement);

                    if (string.IsNullOrEmpty(searchTerm))
                    {
                        paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", "");
                    }
                    else
                    {
                        paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", searchTerm);
                    }

                    using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Selection/Selection/list.sql", paramBuilder.Parameters)) {
                        dataReader.Read();

                        if ((bool)dataReader["DoesExist"])
                        {
                            dataReader.NextResult();
                            int staffCount = 0;

                            if (dataReader.HasRows)
                            {
                                Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();
                                recordCollection.Id = "Selection";

                                while (dataReader.Read())
                                {
                                    Records.Selection selectionRecord = new Records.Selection();
                                    selectionRecord.Id          = ((int)dataReader["Id"]).ToString();
                                    selectionRecord.IsInternal  = isInternal;
                                    selectionRecord.Entitlement = (int)dataReader["RemainingEntitlement"];
                                    selectionRecord.IsSelected  = (bool)dataReader["IsSelected"];

                                    if (isInternal)
                                    {
                                        UserManagement.StaffNameFormatter nameFormatter = new UserManagement.StaffNameFormatter();
                                        nameFormatter.Forename    = dataReader["Forename"] as string;
                                        nameFormatter.Surname     = dataReader["Surname"] as string;
                                        nameFormatter.HoldingName = dataReader["HoldingName"] as string;

                                        selectionRecord.StaffName = nameFormatter;
                                    }
                                    else
                                    {
                                        UserManagement.StaffNameFormatter nameFormatter = new UserManagement.StaffNameFormatter();
                                        nameFormatter.Forename = dataReader["Forename"] as string;
                                        nameFormatter.Surname  = dataReader["Surname"] as string;

                                        selectionRecord.StaffName = nameFormatter;
                                    }

                                    recordCollection.Add(selectionRecord.Record);
                                    staffCount++;
                                }

                                this.Page.Contents = recordCollection.ToString();
                            }
                            else
                            {
                                Core.Helpers.Elements.Alerts.Alert noResultsAlert = new Core.Helpers.Elements.Alerts.Alert("NoReults");
                                noResultsAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                                noResultsAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Selection/Selection/noresults.html").ToString();
                                noResultsAlert.NoScript     = false;
                                noResultsAlert.ShowCloseBox = false;
                                noResultsAlert.StartHidden  = false;

                                this.Page.Contents = noResultsAlert.ToString();
                            }

                            if (staffCount.Equals(0))
                            {
                                statusMessage = "<strong>Couldnae find anyone!</strong>";
                            }
                            else
                            if (staffCount.Equals(1))
                            {
                                if (isInternal)
                                {
                                    statusMessage = "Found <strong>1</strong> member of teaching staff";
                                }
                                else
                                {
                                    statusMessage = "Found <strong>1</strong> member of outside cover staff";
                                }
                            }
                            else
                            if (isInternal)
                            {
                                statusMessage = "Found <strong>" + staffCount + "</strong> members of teaching staff";
                            }
                            else
                            {
                                statusMessage = "Found <strong>" + staffCount + "</strong> members of outside cover staff";
                            }
                        }
                        else
                        {
                            Core.Helpers.Elements.Alerts.Alert requestDoesNotExistAlert = new Core.Helpers.Elements.Alerts.Alert("RequestDoesNotExist");
                            requestDoesNotExistAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                            requestDoesNotExistAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Selection/Selection/requestdoesnotexist.html").ToString();
                            requestDoesNotExistAlert.NoScript     = false;
                            requestDoesNotExistAlert.ShowCloseBox = false;
                            requestDoesNotExistAlert.StartHidden  = false;

                            this.Page.Contents = requestDoesNotExistAlert.ToString();
                        }
                    }
                }
                else
                {
                    Core.Helpers.Elements.Alerts.Alert badInputAlert = new Core.Helpers.Elements.Alerts.Alert("BadInput");
                    badInputAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                    badInputAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Selection/Selection/badinput.html").ToString();
                    badInputAlert.NoScript     = false;
                    badInputAlert.ShowCloseBox = false;
                    badInputAlert.StartHidden  = false;

                    this.Page.Contents = badInputAlert.ToString();
                }
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert noRequestSelectedAlert = new Core.Helpers.Elements.Alerts.Alert("NoRequestSelected");
                noRequestSelectedAlert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                noRequestSelectedAlert.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Selection/Selection/norequestselected.html").ToString();
                noRequestSelectedAlert.NoScript     = false;
                noRequestSelectedAlert.ShowCloseBox = false;
                noRequestSelectedAlert.StartHidden  = false;

                this.Page.Contents = noRequestSelectedAlert.ToString();
            }

            if (!string.IsNullOrEmpty(statusMessage))
            {
                string hoverMessage = "";
                if (isInternal && showZeroEntitlement)
                {
                    hoverMessage = "Showing all available teaching staff";
                }
                else if (isInternal && !showZeroEntitlement)
                {
                    hoverMessage = "Showing available teaching staff with a remaining entitlement of 1 or greater";
                }
                else if (!isInternal && showZeroEntitlement)
                {
                    hoverMessage = "Showing all available outside cover staff";
                }
                else
                {
                    hoverMessage = "Showing available outside cover staff with a remaining entitlement of 1 or greater";
                }

                statusMessage = "<p class=\"Plain\" title=\"" + hoverMessage + "\">" + statusMessage + "</p>";
            }

            if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("ArrangeSelectionInfo"))
            {
                Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["ArrangeSelectionInfo"] = statusMessage;
            }
            else
            {
                Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("ArrangeSelectionInfo", statusMessage);
            }
        }
예제 #15
0
        protected override void GenerateOutput()
        {
            if (this.CheckInputValidity())
            {
                Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
                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.Path.HasNext() && this.Path.Peek().Equals("notrequired"))
                {
                    this.Path.Next();
                    paramBuilder.AddParameter(SqlDbType.Bit, "@GetNoCoverRequests", 1);
                }
                else
                {
                    paramBuilder.AddParameter(SqlDbType.Bit, "@GetNoCoverRequests", 0);
                }

                if (this.Path.HasNext())
                {
                    paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", this.Path.Next());
                }
                else
                {
                    paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", "");
                }

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Selection/Requests/list.sql", paramBuilder.Parameters)) {
                    if (dataReader.HasRows)
                    {
                        Core.Helpers.Elements.RecordLists.Collection recordCollection = new Core.Helpers.Elements.RecordLists.Collection();
                        int requestsCount = 0;

                        while (dataReader.Read())
                        {
                            Records.RequestBase record = new Records.RequestBase();

                            if ((bool)dataReader["IsBusy"])
                            {
                                if ((!dataReader["IsYeargroupAway"].Equals(System.DBNull.Value)) && ((bool)dataReader["IsYeargroupAway"]))
                                {
                                    Records.NoCoverRequired newRecord = new Records.NoCoverRequired();
                                    newRecord.CommitmentName  = dataReader["CommitmentName"] as string;
                                    newRecord.IsYeargroupAway = true;
                                    record = newRecord;
                                }
                                else if (!(bool)dataReader["TeachingClass"])
                                {
                                    Records.NoCoverRequired newRecord = new Records.NoCoverRequired();
                                    newRecord.CommitmentName = dataReader["CommitmentName"] as string;
                                    newRecord.IsNotTeaching  = true;
                                    record = newRecord;
                                }
                                else
                                {
                                    if ((bool)dataReader["HasCover"])
                                    {
                                        if ((bool)dataReader["IsInternalCover"])
                                        {
                                            Records.CoverSelected newRecord = new Records.CoverSelected();
                                            newRecord.IsInternalCover = true;
                                            newRecord.Id             = "Request" + (int)dataReader["CoverId"];
                                            newRecord.OnClick        = "switchToSelection(" + (int)dataReader["CoverId"] + ", " + this._selectedDate.Year + ", " + this._selectedDate.Month + ", " + this._selectedDate.Day + ", true)";
                                            newRecord.CommitmentName = dataReader["CommitmentName"] as string;

                                            UserManagement.StaffNameFormatter coveringStaffNameFormatter = new UserManagement.StaffNameFormatter();
                                            coveringStaffNameFormatter.Forename    = dataReader["CoverForename"] as string;
                                            coveringStaffNameFormatter.Surname     = dataReader["CoverSurname"] as string;
                                            coveringStaffNameFormatter.HoldingName = dataReader["CoverHoldingName"] as string;

                                            newRecord.CoverStaffName = coveringStaffNameFormatter;

                                            //newRecord.CoverStaffName = Core.Utils.FormatStaffName(dataReader["CoverForename"] as string, dataReader["CoverSurname"] as string, dataReader["CoverHoldingName"] as string, false, false, false);
                                            record = newRecord;
                                        }
                                        else
                                        {
                                            Records.CoverSelected newRecord = new Records.CoverSelected();
                                            newRecord.IsInternalCover = false;
                                            newRecord.Id             = "Request" + (int)dataReader["CoverId"];
                                            newRecord.OnClick        = "switchToSelection(" + (int)dataReader["CoverId"] + ", " + this._selectedDate.Year + ", " + this._selectedDate.Month + ", " + this._selectedDate.Day + ", true)";
                                            newRecord.CommitmentName = dataReader["CommitmentName"] as string;

                                            UserManagement.StaffNameFormatter coveringStaffNameFormatter = new UserManagement.StaffNameFormatter();
                                            coveringStaffNameFormatter.Forename = dataReader["CoverForename"] as string;
                                            coveringStaffNameFormatter.Surname  = dataReader["CoverSurname"] as string;

                                            newRecord.CoverStaffName = coveringStaffNameFormatter;

                                            //newRecord.CoverStaffName = Core.Utils.FormatStaffName(dataReader["CoverForename"] as string, dataReader["CoverSurname"] as string, null, false, false, false);
                                            record = newRecord;
                                        }
                                    }
                                    else
                                    {
                                        Records.NoCoverSelected newRecord = new Records.NoCoverSelected();
                                        newRecord.Id             = "Request" + (int)dataReader["CoverId"];
                                        newRecord.OnClick        = "switchToSelection(" + (int)dataReader["CoverId"] + ", " + this._selectedDate.Year + ", " + this._selectedDate.Month + ", " + this._selectedDate.Day + ", true)";
                                        newRecord.CommitmentName = dataReader["CommitmentName"] as string;
                                        record = newRecord;
                                    }
                                }
                            }
                            else
                            {
                                Records.NoCoverRequired newRecord = new Records.NoCoverRequired();
                                newRecord.IsYeargroupAway = false;
                                record = newRecord;
                            }

                            UserManagement.StaffNameFormatter absenteeNameFormatter = new UserManagement.StaffNameFormatter();
                            absenteeNameFormatter.Forename    = dataReader["AbsentForename"] as string;
                            absenteeNameFormatter.Surname     = dataReader["AbsentSurname"] as string;
                            absenteeNameFormatter.HoldingName = dataReader["AbsentHoldingName"] as string;

                            record.AbsenteeName        = absenteeNameFormatter;
                            record.AbsenteeNameToolTip = absenteeNameFormatter;

                            //record.AbsenteeName = Core.Utils.FormatStaffName(dataReader["AbsentForename"] as string, dataReader["AbsentSurname"] as string, dataReader["AbsentHoldingName"] as string, false, false, false);
                            //record.AbsenteeNameToolTip = Core.Utils.FormatStaffName(dataReader["AbsentForename"] as string, dataReader["AbsentSurname"] as string, dataReader["AbsentHoldingName"] as string, false, false, false);
                            record.Period = (int)dataReader["Period"];
                            recordCollection.Add(record.Record);
                            requestsCount++;
                        }

                        if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("ArrangeRequestsCount"))
                        {
                            Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["ArrangeRequestsCount"] = requestsCount;
                        }
                        else
                        {
                            Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("ArrangeRequestsCount", requestsCount);
                        }

                        this.Page.Contents = recordCollection.ToString();
                    }
                    else
                    {
                        Core.Helpers.Elements.Alerts.Alert a = new Core.Helpers.Elements.Alerts.Alert("NoRequests");
                        a.Colour       = PleaseTakes.Core.Helpers.Elements.Alerts.Colours.Yellow;
                        a.NoScript     = false;
                        a.ShowCloseBox = false;
                        a.StartHidden  = false;
                        a.Message      = new Core.Helpers.Constructor("/Alerts/Specific/Cover/Arrange/Selection/Requests/norequests.html").ToString();

                        this.Page.Contents = a.ToString();
                    }
                }
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert alert = new Core.Helpers.Elements.Alerts.Alert("Error");
                alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                alert.NoScript     = false;
                alert.ShowCloseBox = false;
                alert.StartHidden  = false;
                alert.Message      = new Core.Helpers.Constructor("/Alerts/Ajax/error.html").ToString();

                this.Page.Contents = alert.ToString();
            }
        }
예제 #16
0
        protected override void GenerateOutput()
        {
            if (this.CheckInputValidity())
            {
                Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
                paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek);
                paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1));
                paramBuilder.AddParameter(SqlDbType.Int, "@MaxPeriods", this._periods);
                paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate);

                if (this.Path.HasNext())
                {
                    paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", this.Path.Next());
                }
                else
                {
                    paramBuilder.AddParameter(SqlDbType.VarChar, "@SearchTerm", "");
                }

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Attendance/Attendance/attendance.sql", paramBuilder.Parameters)) {
                    if (dataReader.HasRows)
                    {
                        Core.Helpers.Elements.RecordLists.Collection collection = new Core.Helpers.Elements.RecordLists.Collection();
                        collection.Id = "Attendance";
                        int recordCount = 0;

                        while (dataReader.Read())
                        {
                            Core.Helpers.Elements.RecordLists.Record record = new Core.Helpers.Elements.RecordLists.Record();

                            int staffId = (int)dataReader["StaffId"];

                            UserManagement.StaffNameFormatter nameFormatter = new UserManagement.StaffNameFormatter();
                            nameFormatter.Forename    = dataReader["Forename"] as string;
                            nameFormatter.Surname     = dataReader["Surname"] as string;
                            nameFormatter.HoldingName = dataReader["HoldingName"] as string;

                            int attendanceRecord = (int)dataReader["AttendanceRecord"];
                            record.Id = "Staff" + staffId.ToString();

                            if (attendanceRecord > 0)
                            {
                                record.Colour = Core.Helpers.Elements.RecordLists.Colours.Red;
                            }

                            record.LeftSide.MainText = nameFormatter.ToString();
                            nameFormatter.IsToolTip  = true;
                            record.LeftSide.SetImage("dude.png", nameFormatter.ToString());
                            record.OnClick = "getResponse('AttendanceStaff" + staffId + "', '?path=/cover/arrange/attendance/ajax/attendance/modify/" + this._selectedDate.Year.ToString() + "/" + this._selectedDate.Month.ToString() + "/" + this._selectedDate.Day.ToString() + "/" + staffId + "/', false, false, true); resetSearch('Periods');";
                            collection.Add(record);
                            recordCount++;
                        }

                        if (Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.ContainsKey("ArrangeAttendanceCount"))
                        {
                            Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage["ArrangeAttendanceCount"] = recordCount;
                        }
                        else
                        {
                            Core.WebServer.PleaseTakes.Session.CurrentInstance.TemporaryStorage.Add("ArrangeAttendanceCount", recordCount);
                        }

                        this.Page.Contents = collection.ToString();
                    }
                    else
                    {
                        Core.Helpers.Elements.Alerts.Alert alert = new Core.Helpers.Elements.Alerts.Alert("NoResults");
                        alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Yellow;
                        alert.NoScript     = false;
                        alert.ShowCloseBox = false;
                        alert.StartHidden  = false;
                        alert.Message      = new Core.Helpers.Constructor("/Alerts/Ajax/noresults.html").ToString();

                        this.Page.Contents = alert.ToString();
                    }
                }
            }
            else
            {
                Core.Helpers.Elements.Alerts.Alert alert = new Core.Helpers.Elements.Alerts.Alert("Error");
                alert.Colour       = Core.Helpers.Elements.Alerts.Colours.Red;
                alert.NoScript     = false;
                alert.ShowCloseBox = false;
                alert.StartHidden  = false;
                alert.Message      = new Core.Helpers.Constructor("/Alerts/Ajax/error.html").ToString();

                this.Page.Contents = alert.ToString();
            }
        }