Esempio n. 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();
            }
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        public override string ToString()
        {
            Core.Helpers.Constructor timetableText = new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/timetabletext.html");

            timetableText.SetVariable("HighlightedId", this._highlightedId);
            timetableText.SetVariable("Highlighted", this._highlighted);

            if (string.IsNullOrEmpty(this._onClick))
            {
                timetableText.DeleteVariable("ChangeLink");
            }
            else
            {
                timetableText.SetVariable("ChangeLink", "&nbsp;<a href=\"javascript:void(0);\" onclick=\"" + this._onClick + "\"><em style=\"font-size: 8pt;\">(Change)</em></a>");
            }

            return(timetableText.ToString());
        }
Esempio n. 4
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;
		}
Esempio n. 5
0
        protected override void GenerateOutput()
        {
            Core.Helpers.Elements.Ajax.Xml.Collection xmlCollection = new Core.Helpers.Elements.Ajax.Xml.Collection();

            if (this.CheckInputValidity())
            {
                Core.Helpers.Database.ParameterBuilder paramBuilder = new Core.Helpers.Database.ParameterBuilder();
                paramBuilder.AddParameter(SqlDbType.Int, "@StaffId", this._staffId);
                paramBuilder.AddParameter(SqlDbType.SmallDateTime, "@Date", this._selectedDate);
                paramBuilder.AddParameter(SqlDbType.Int, "@WeekNo", this._timetableWeek);
                paramBuilder.AddParameter(SqlDbType.Int, "@DayNo", (int)(this._selectedDate.DayOfWeek + 1));

                if (this._period.Equals(0))
                {
                    paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMin", 1);
                    paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMax", this._periods);
                }
                else
                {
                    paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMin", this._period);
                    paramBuilder.AddParameter(SqlDbType.Int, "@PeriodMax", this._period);
                }

                using (SqlDataReader dataReader = Core.Helpers.Database.Provider.ExecuteReader("/Sql/Specific/Cover/Arrange/Attendance/Periods/modify.sql", paramBuilder.Parameters)) {
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            int    period  = (int)dataReader["Period"];
                            string id      = "Periods" + this._staffId + "-" + period;
                            string classes = "Large ";
                            Core.Helpers.Constructor innerHtml = new Core.Helpers.Constructor("/Templates/Specific/Cover/Arrange/Attendance/periodsinner.html");

                            switch ((dataReader["Status"] as string).ToLower())
                            {
                            case "absent":
                                classes += "Red";
                                innerHtml.SetVariable("Symbol", "A");
                                break;

                            case "present":
                                classes += "Green";
                                innerHtml.SetVariable("Symbol", "P");
                                break;

                            case "presentyeargroupaway":
                                classes += "Blue";
                                innerHtml.SetVariable("Symbol", "P");
                                break;

                            case "presentisbusy":
                                classes += "Indigo";
                                innerHtml.SetVariable("Symbol", "P");
                                break;
                            }

                            innerHtml.SetVariable("StaffId", this._staffId.ToString());
                            innerHtml.SetVariable("Year", this._selectedDate.Year.ToString());
                            innerHtml.SetVariable("Month", this._selectedDate.Month.ToString());
                            innerHtml.SetVariable("Day", this._selectedDate.Day.ToString());
                            innerHtml.SetVariable("Period", period.ToString());

                            xmlCollection.Add(id, classes, innerHtml.ToString());
                        }
                    }
                }
            }

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