Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u = new Utility();
                //string staff_code = u.GetStaffCodefromContext(Context);
                string staff_code = u.GetsStaffCodefromRequest(Request);
                Cerval_Configuration c2 = new Cerval_Configuration("StaffIntranet_SEN-MANAGERS");
                string s_sen = ""; bool display = false;
                s_sen = c2.Value;
                if (!c2.valid)//try revert to config file
                {
                    System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                    s_sen = ar.GetValue("SEN-MANAGERS", typeof(string)).ToString();
                }
                staff_code = staff_code.Trim();
                char[]   c1      = new char[1]; c1[0] = ','; s_sen = s_sen.ToUpper();
                string[] s_array = new string[10]; s_array = s_sen.Split(c1);


                if (s_array.Contains(staff_code.ToUpper()))
                {
                    SENEdit1.SenId     = new Guid(Request.QueryString["SENID"]);
                    SENEdit1.StudentId = new Guid(Request.QueryString["StudentID"]);
                    SENEdit1.UpdateControls();
                    SENEdit1.Visible = true;
                }
                else
                {
                    Response.Write("<br/><h3>You do not have permission to edit SEN data.</h3><br/>" + s_sen + "<br/>" + staff_code + "<br/>" + s_array[4].ToString());
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DDList_Sets.Items.Clear();
            //get sets for this user..
            Utility u          = new Utility();
            string  staff_code = u.GetsStaffCodefromRequest(Request);

#if DEBUG
            staff_code = "CC";
#endif

            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Exam_Results_Years");
            string s = c.Value;
            //s contains the years we want to process as comma sep list
            string[] s1 = new string[1]; s1[0] = ",";
            string[] s2 = new string[10];
            s2 = s.Split(s1, StringSplitOptions.None);
            GroupList gl1 = new GroupList();
            gl1.LoadStaff(staff_code, DateTime.Now, GroupList.GroupListOrder.GroupName);
            foreach (Group g in gl1._groups)
            {
                s = g._GroupID.ToString();
                foreach (string s3 in s2)
                {
                    if (g._GroupCode.StartsWith(s3))
                    {
                        DDList_Sets.Items.Add(new ListItem(g._GroupCode, s));
                    }
                }
            }
            if (DDList_Sets.Items.Count > 0)
            {
                DDList_Sets.SelectedIndex = 0;
            }
        }
        protected void TextBox_mask_TextChanged(object sender, EventArgs e)
        {
            //do search...
            //string s1 = @"c:\users\cc\documents";


            Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_StaffDocuments");
            string s1 = c1.Value;

            if (!c1.valid)//try revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s1 = ar.GetValue("StaffDocuments", typeof(string)).ToString();
            }


            Table1.Rows.Clear();
            TableRow  r = new TableRow();
            TableCell c = new TableCell();

            c.Controls.Add(new LiteralControl("FileName"));
            r.Cells.Add(c);
            Table1.Rows.Add(r);
            c = new TableCell();
            c.Controls.Add(new LiteralControl("In Folder"));
            r.Cells.Add(c);
            SearchDirectory(s1, TextBox_mask.Text + "*");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_TTD_AllowRoomEdit");
            string s = c.Value;

            if (!c.valid)//try revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s = ar.GetValue("TTD_AllowRoomEdit", typeof(string)).ToString();
            }
            if (s.ToUpper() == "TRUE")
            {
                MenuList.InnerHtml += "<a href =\"EditRooms.aspx\">Edit Rooms</a><br />";
            }

            c = new Cerval_Configuration("StaffIntranet_TTPlan_Title");
            Information.InnerHtml = c.Value + "<br />";

            c = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
            DateTime d = new DateTime();

            try
            {
                d = System.Convert.ToDateTime(c.Value);

                Information.InnerHtml += "Timetable as at " + d.ToShortDateString() + "<br/> Please select a choice from the options below:<br /><br />";
            }
            catch { }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string file_name = Server.MapPath(@"~/App_Data/tt_data.ttd");
            Cerval_Configuration c;

            c = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
            DateTime date1 = new DateTime();

            try { date1 = System.Convert.ToDateTime(c.Value); }
            catch { date1 = DateTime.Now; }

            TTData tt1 = new TTData();

            c = new Cerval_Configuration("StaffIntranet_UseOldTTDfile");
            if (c.Value.ToUpper() == "TRUE")
            {
                tt1.Load(file_name, date1, date1, false, false, "");
            }
            else
            {
                tt1.Load_DB(date1); //load from database
            }
            string[] r   = new string[255];
            string[] per = new string[5];
            per[0] = "1"; per[1] = "2"; per[2] = "3"; per[3] = "4"; per[4] = "5";
            int    n = 0; string s1 = "";
            string s = "<p><TABLE BORDER  class= \"TimetableTable\"   ><tr><th>Day</th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> </tr>";

            //only going to do mon-fri  period 1,2,3,4,5
            string[] days        = new string[5]; days[0] = "MO "; days[1] = "TU "; days[2] = "WE "; days[3] = "TH "; days[4] = "FR ";
            string   ExcludeList = ",MAF,";

            for (int d = 0; d < 5; d++)
            {
                s += "<tr><td>" + days[d] + "</td>";
                for (int p = 0; p < 5; p++)
                {
                    s += "<td>";
                    n  = tt1.FindFreeStaff(d, per[p], ref r);
                    for (int i = 0; i < n; i++)
                    {
                        if (r[i].Trim().Length > 0)
                        {
                            s1 = "," + r[i].Trim().ToUpper() + ",";
                            if (!ExcludeList.Contains(s1))
                            {
                                s += r[i] + ", ";
                            }
                        }
                    }
                    s += "</td>";
                }
                s += "</tr>";
            }
            s += "</table>";
            s += "<br/><p>The following staff are excluded in the search above:<br/>" + ExcludeList + "</p>";
            content.InnerHtml = s;
        }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SetupList();
         Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_TTPlan_Title");
         Information.InnerHtml = c.Value + "<br/> <br/>Select the Year for the display and then press Display.";
     }
 }
Example #7
0
        protected void Button_Save_Click(object sender, EventArgs e)
        {
            Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_ExamsStartYear");
            Cerval_Configuration c2 = new Cerval_Configuration("StaffIntranet_ExamsStartSeason");

            c1.Value = TextBox_Year.Text;
            c2.Value = DropDownList_Season.SelectedValue;
            c1.Save();
            c2.Save();
        }
Example #8
0
        protected void SetupCombo()
        {
            DropDownList_Sets.Items.Clear();
            //get sets for this user..
            Utility u = new Utility();
            //string struser = Context.User.Identity.Name;
            //string staff_code = "";
            //Guid personID = u.GetPersonID(struser, out staff_code);
            Guid   personID   = u.GetPersonIdfromRequest(Request);
            string staff_code = u.GetsStaffCodefromRequest(Request);

#if DEBUG
            staff_code = "CC";
#endif

            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Exam_Results_Years");
            string s = c.Value;
            if (!c.valid)//revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s = ar.GetValue("Exam_Results_Years", typeof(string)).ToString();
            }
            //s contains the years we want to process as comma sep list
            string[] s1 = new string[1]; s1[0] = ",";
            string[] s2 = new string[10];
            s2 = s.Split(s1, StringSplitOptions.None);

            //staff_code = "JA";
            GroupList gl1 = new GroupList();
            gl1.LoadStaff(staff_code, DateTime.Now, GroupList.GroupListOrder.GroupName);
            foreach (Group g in gl1._groups)
            {
                foreach (string s3 in s2)
                {
                    if (g._GroupCode.StartsWith(s3))
                    {
                        ListItem i = new ListItem(g._GroupCode, g._GroupID.ToString());
                        DropDownList_Sets.Items.Add(i);
                    }
                }
                //if (g._GroupCode.StartsWith("12"))
                //if (g._GroupCode.StartsWith("10") || g._GroupCode.StartsWith("7") || g._GroupCode.StartsWith("8") || g._GroupCode.StartsWith("9"))
                //if (g._GroupCode.StartsWith("11"))
                //{
                //  ListItem i = new ListItem(g._GroupCode, g._GroupID.ToString());
                // DropDownList_Sets.Items.Add(i);
                //}
            }
            if (DropDownList_Sets.Items.Count > 0)
            {
                DropDownList_Sets.SelectedIndex = 0;
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //testing
                text1.InnerHtml = Server.MapPath("BaseData");
                //set up the season and year
                TextBox_Year.Text = new Cerval_Configuration("StaffIntranet_ExamsStartYear").Value;
                string s = new Cerval_Configuration("StaffIntranet_ExamsStartSeason").Value;
                DropDownList_Season.SelectedIndex = 1;
                try { DropDownList_Season.SelectedValue = s; } catch { };
                Session["Year"]   = TextBox_Year.Text;
                Session["Season"] = DropDownList_Season.SelectedValue;
#if DEBUG
                Button1.Visible = true;
#endif
            }
            else
            {
                // is post back so we have changed something..
                //check that the Year is a valid year
                int y = 0; bool valid = false;
                try
                {
                    y = System.Convert.ToInt32(TextBox_Year.Text);
                    if ((y > 2000) && (y < 2050))
                    {
                        valid = true;
                    }
                }
                catch
                {
                }

                if (valid)
                {
                    Label_Error.Visible = false;
                    Session["Year"]     = TextBox_Year.Text;
                    Session["Season"]   = DropDownList_Season.SelectedValue;
                }
                else
                {
                    // input not a valid year...  reset display....
                    Label Label_Year = (Label)Master.FindControl("Label_Year");
                    if (Label_Year != null)
                    {
                        TextBox_Year.Text = Label_Year.Text;
                    }
                    Label_Error.Visible = true;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //get the parameter....  the current directory level ..may be null

                string start_directory = Request.QueryString["Path"];
                string s = Table1.TemplateSourceDirectory;
                Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_StaffDocuments");
                string s1 = c1.Value;
                if (!c1.valid)//try revert to config file
                {
                    System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                    s1 = ar.GetValue("StaffDocuments", typeof(string)).ToString();
                }
                //s1 = @"c:\users\cc\documents";
                if (start_directory != null)
                {
                    s1 = s1 + "\\" + start_directory;
                }
                s = s1;
                DirectoryInfo   di     = new DirectoryInfo(s);
                DirectoryInfo[] dilist = di.GetDirectories();
                foreach (DirectoryInfo di1 in dilist)
                {
                    if (!di1.Name.StartsWith("_"))
                    {
                        TableRow r = new TableRow();
                        s = di1.Name;
                        if (start_directory != null)
                        {
                            s = start_directory + "\\" + s;
                        }
                        TableCell c = new TableCell();
                        c.Controls.Add(new LiteralControl("FOLDER:- <A href=\"" + Table1.TemplateSourceDirectory + "/StaffDocuments.aspx?Path=" + s + "\">" + s + "</A>"));
                        r.Cells.Add(c);
                        Table1.Rows.Add(r);
                    }
                }
                FileInfo[] fi = di.GetFiles();
                foreach (FileInfo fiTemp in fi)
                {
                    AddFileToTable(fiTemp, false, start_directory);
                }

                Table1.Font.Name   = "Arial";
                Table1.CellPadding = 5;
                Table1.CellSpacing = 0;
                Table1.ToolTip     = "List of directories and files to downlaod";
            }
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
#if DEBUG
                /*
                 * ISAMS_TimetableScheduleList i1 = new ISAMS_TimetableScheduleList();
                 * ISAMS_Period_List ipl1 = new ISAMS_Period_List();
                 * ISAMS_RoomList irl1 = new ISAMS_RoomList();
                 * i1.LoadListCurrentTT();string isamss = "";
                 * string isamsR = "";string isamsP = "";string isamsD = "";
                 * char c11 = (char)0x09;
                 * foreach(ISAMS_TimeTableSchedule is2 in i1.m_list)
                 * {
                 *  isamsR = "";isamsP = "";isamsD = "";
                 *  foreach(ISAMS_Period ip in ipl1.m_ISAMS_PeriodList)
                 *  {
                 *      if (ip.Id == is2.PeriodId) { isamsP = ip.ShortName; isamsD = ip.day.ToString(); break; }
                 *  }
                 *  foreach(ISAMS_Room ir in irl1.m_list)
                 *  {
                 *      if (is2.RoomId == ir.Id) { isamsR = ir.Code; break; }
                 *  }
                 *  isamss += is2.SetCode + c11 + is2.StaffInitials + c11+ isamsD+c11+isamsP+c11+isamsR+c11+Environment.NewLine;
                 *
                 *  //find the  group ID and ScheduledPeriod Id if possible
                 *  TTData t1 = new TTData();
                 *  Group g1 = t1.Find_Group(is2.SetCode, new DateTime(2017, 9, 6, 01, 0, 0), new DateTime(2018, 7, 31, 01, 0, 0), true);
                 *  ScheduledPeriodRawList schprl1 = new ScheduledPeriodRawList();schprl1.Load_for_Group(g1._GroupID);
                 *
                 * }
                 * //servercontent.InnerHtml = isamss;
                 * Utility u = new Utility();
                 * u.WriteToLogFile(@"D:/temp2.txt", isamss);
                 */
#endif

                System.Security.Principal.IIdentity fred = HttpContext.Current.User.Identity;
                string s     = HttpContext.Current.User.Identity.Name;
                string s5    = Context.User.Identity.Name;
                string email = "";

                IOwinContext        ctx    = Request.GetOwinContext();
                ClaimsPrincipal     user   = ctx.Authentication.User;
                IEnumerable <Claim> claims = user.Claims;
                foreach (Claim c2 in claims)
                {
                    s = c2.Value;
                    if (c2.Type == "email")
                    {
                        email = s;
                    }
                    if (c2.Type == "staff_id")
                    {
                        s5 = s;
                    }
                }
                StreamWriter sw2 = new StreamWriter(@"c:/_TEMP_/StaffLogs_StartForm.txt", true);
                sw2.WriteLine(email + "  :  " + s5 + DateTime.Now.ToString() + " :  " + DateTime.Now.ToString());
                sw2.Close();
                //servercontent.InnerHtml = "<BR/>This is a test site...please report issues to CC.<br/><br/>";
                ViewState.Add("date", DateTime.Now);

                Label fred2 = (Label)Master.FindControl("Label2");
                if (fred2 != null)
                {
                    fred2.Text = "Logged on as:   " + email;
                }
                System.Web.UI.HtmlControls.HtmlGenericControl fred3 = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("dcgsNavBar1");
                if (fred3 != null)
                {
                    Encode   en1        = new Encode();
                    string   s_db       = en1.GetDbConnection();
                    string[] s_dbfields = new string[10];
                    char[]   splits     = new char[2]; splits[0] = ';'; splits[1] = '=';
                    s_dbfields      = s_db.Split(splits);
                    fred3.InnerText = "Staff Intranet (db:" + s_dbfields[1] + ",    Server:" + s_dbfields[3] + ")";
                }


                DateTime d0 = new DateTime(2012, 3, 07, 0, 0, 10);  //embargo time
                DateTime d1 = new DateTime(2012, 3, 08, 6, 00, 05); //release time
                try
                {
                    Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_EmbargoStart");
                    d0 = System.Convert.ToDateTime(c.Value);
                    Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_EmbargoRelease");
                    d1 = System.Convert.ToDateTime(c1.Value);

#if DEBUG
                    d1 = new DateTime(2012, 3, 08, 6, 00, 05);//release time
#endif
                    if ((DateTime.Now > d0) && (DateTime.Now < d1))
                    {
                        Response.Redirect("../Home.aspx");
                    }
                }
                catch
                {
                }

                try
                {
                    Cerval_Configuration c2 = new Cerval_Configuration("StaffIntranet_Welcome_Screen_HTML");
                    s = c2.Value;
                }

                catch (System.Exception e1)
                {
                    s = "Configuration setting not found. " + e1.Message;
                }
                servercontent.InnerHtml += s;
                ViewState.Add("date", DateTime.Now);
            }
            else
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u1 = new Utility();
                PersonID = u1.GetPersonIdfromRequest(Request);
                if (PersonID == new Guid("20744211-d0f0-4e69-af84-020c1023dfda")) //cc
                {
                    PersonID = u1.GetPersonIDX(@"CHALLONERS\mayank.sharma");      //development
                    PersonID = u1.GetPersonIDX(@"CHALLONERS\mayank.sharma");      //development
                    PersonID = u1.GetPersonIDX(@"CHALLONERS\alex.robinson");      //development
                }
#if DEBUG
                u1.Is_student = true;
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\mayank.sharma");     //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\alex.robinson");     //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\michael.taylor2");   //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\jack.bowe");         //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\alexander.lynch");   //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\adam.bosher");       //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\sam.coyne");         //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\kieran.Davis");      //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\William.Kitchener"); //development
                PersonID      = u1.GetPersonIDX(@"CHALLONERS\Oscar.Jones");       //development
#endif
                Resultgrid1.StudentId   = u1.GetStudentId(PersonID).ToString();
                Resultgrid1.DisplayType = ResultGrid.GridDisplayType.External;
                Resultgrid1.Visible     = false;

                Resultgrid2.StudentId   = Resultgrid1.StudentId;
                Resultgrid2.DisplayType = ResultGrid.GridDisplayType.Module;
                Resultgrid2.Visible     = false;

                Resultgrid3.StudentId   = Resultgrid1.StudentId;
                Resultgrid3.DisplayType = ResultGrid.GridDisplayType.Predicted;
                Resultgrid3.Visible     = false;

                if ((PersonID != Guid.Empty) && (u1.Is_student))
                {
                    Resultgrid1.Visible = true; Resultgrid2.Visible = true; Resultgrid3.Visible = true;
                }
                else
                {
                    ContentAdd("<center> No Data to display</center>");
                }

                //need to check embargo time
                DateTime d0 = new DateTime(2018, 08, 13, 0, 0, 10);   //embargo time
                DateTime d1 = new DateTime(2018, 08, 16, 08, 00, 00); //release time
                Server_Heading.InnerHtml = "";
                try
                {
                    Cerval_Configuration c0 = new Cerval_Configuration("StudentInformation_ResultsEmbargoStart");
                    d0 = System.Convert.ToDateTime(c0.Value);
                    Cerval_Configuration c1 = new Cerval_Configuration("StudentInformation_ResultsEmbargoRelease");
                    d1 = System.Convert.ToDateTime(c1.Value);
#if DEBUG
                    d1 = new DateTime(2012, 3, 08, 6, 00, 05);//release time
#endif


                    if ((DateTime.Now > d0) && (DateTime.Now < d1))
                    {
                        Resultgrid1.Visible    = false;
                        Resultgrid2.Visible    = false;
                        Resultgrid3.Visible    = false;
                        Server_Heading.Visible = false;
                        VIdatadiv.Visible      = false;
                        scontent = "<h3> Results screen will be available again at " + d1.ToLongTimeString() + " on " + d1.ToLongDateString() + ".</h3><br />   (time now " + DateTime.Now.ToShortTimeString() + " on " + DateTime.Now.ToLongDateString() + ")";
                    }
                }
                catch (Exception e3)

                {
                    Response.Redirect("../content/StartForm.aspx");
                }


                string path = "";
                bool   msg1 = false;
                string adno = u1.GetAdmissionNumber(PersonID).ToString();

                Cerval_Configuration c = new Cerval_Configuration("StudentInformation_ResultsMessageDisplay");

                //see if we want the message stuff
                string s = c.Value.ToUpper();
                if ((PersonID != Guid.Empty) && (s == "TRUE"))
                {
                    if ((u1.Is_student) && (u1.GetAdmissionNumber(PersonID) != 0))
                    {
                        path = Server.MapPath(@"App_Data/Results_names.txt");
                        try
                        {
                            using (StreamReader sr = new StreamReader(path))
                            {
                                while ((s = sr.ReadLine()) != null)
                                {
                                    if (s.Contains(adno))
                                    {
                                        msg1 = true;
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                if (msg1)
                {
                    path = Server.MapPath(@"App_Data/Message1.txt");
                    try
                    {
                        using (StreamReader sr = new StreamReader(path))
                        {
                            Server_Heading.InnerHtml = sr.ReadToEnd();
                        }
                    }
                    catch
                    {
                    }
                }
                //see if we want the message stuff

                Cerval_Configuration c3 = new Cerval_Configuration("StudentInformation_ResultsVILink");
                s = c3.Value.ToUpper();
                if (s == "TRUE")
                {
                    string[] split1 = new string[20];
                    char[]   c1     = new char[1]; c1[0] = (char)0x09;
                    path = Server.MapPath(@"App_Data/VIOffers.txt");
                    //this file is the output from the GCSE options package
                    try
                    {
                        using (StreamReader sr = new StreamReader(path))
                        {
                            while ((s = sr.ReadLine()) != null)
                            {
                                split1 = s.Split(c1);
                                if (split1[0].Contains(adno))
                                {
                                    VIdatadiv.InnerHtml = "Information regarding your Sixth Form Application can be viewed <a href=\"StudentSixthFormApp.aspx\">here</a>.";;
                                }
                            }
                        }
                    }
                    catch { }
                }

                servercontent.InnerHtml = scontent;
            }
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u          = new Utility();
                string  staff_code = u.GetsStaffCodefromRequest(Request);
                string  file_name  = Server.MapPath(@"~/App_Data/tt_data.ttd");

                Cerval_Configuration c     = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
                DateTime             date1 = new DateTime();
                try { date1 = System.Convert.ToDateTime(c.Value); }
                catch { date1 = DateTime.Now; }

                TTData tt1    = new TTData();
                bool   UseTTD = true;
                c = new Cerval_Configuration("StaffIntranet_UseOldTTDfile");
                if (c.Value.ToUpper() == "TRUE")
                {
                    tt1.Load(file_name, date1, date1, false, false, "");
                }
                else
                {
                    tt1.Load_DB(date1); //load from database
                    UseTTD = false;
                }
                //string[] rooms = new string[max_rows];//room names
                //string[] rooms_t = new string[max_rows];//room names
                List <string> rooms = new List <string>();
                List <string> subjects = new List <string>();
                int           no_rooms = 0; int no_rows = 0;
                //string[] subjects = new string[10];
                int no_subjects = 0;
                string[,] data             = new string[30, max_rows]; //has the display data
                long[,] pointers           = new long[30, max_rows];   //has the file ppointers for TTD
                Guid[,] ScheduledPeriodIds = new Guid[30, max_rows];   //has period ids for db use


                string[] setupS = new string[20];
                string[] staffS = new string[20];
                string[] subS   = new string[20];

                char[] c1 = new char[1]; c1[0] = ',';
                char[] c2 = new char[1]; c2[0] = ';';
                char[] c3 = new char[1]; c3[0] = ':';
                staff_code = staff_code.Trim().ToUpper();
                no_rooms   = 0; bool found = false;


                c = new Cerval_Configuration("StaffIntranet_TTD_EditRoomsList");
                //list has staffcode;room1,room2,room3;subject1,sub2:
                string[] initialS = new string[20];
                string[] temp1    = new string[3];
                initialS = c.Value.Split(c3);
                for (int i = 0; i < 9; i++)
                {
                    try
                    {
                        temp1     = initialS[i].Split(c2);
                        setupS[i] = temp1[1];
                        staffS[i] = temp1[0];
                        subS[i]   = temp1[2];
                    }
                    catch { };
                }


                /*
                 * setupS[0] = "P1,P2,P3,P4,P5"; staffS[0] = "LBI"; subS[0] = "PH,ET";
                 * setupS[1] = "P1,P2,P3,P4,P5,B1,B2,B3,B4,Q9,C1,C2,C3"; staffS[1] = "ABR"; subS[1] = "BI,PH,CH";
                 * setupS[2] = "C1,C2,C3"; staffS[2] = "JHO"; subS[2] = "CH";
                 * setupS[3] = "21,22,23,24,31,32,33,34,41"; staffS[3] = "CH"; subS[3] = "MA";
                 * setupS[4] = "N11,N12,N13,N14"; staffS[4] = "AAB"; subS[4] = "GE";
                 * setupS[5] = "11,12,13,14,L4,L5,Q6"; staffS[5] = "EWA"; subS[5] = "FR,GM,SP";
                 * setupS[6] = "N1,N2,N3,N4,Q7,Q8,Q13,ST11"; staffS[6] = "FRO"; subS[6] = "EN,EL,TH";
                 * setupS[7] = "P1,P2,P3,P4,P5,B1,B2,B3,B4,Q9,C1,C2,C3"; staffS[7] = "JA"; subS[7] = "BI,CH,PH";//testing
                 * setupS[8] = "W12,W13,W1,W2,W3,W11,N11,N12,N13,N14,A8,A9"; staffS[8] = "GWS"; subS[8] = "RS,GE,HI";
                 * setupS[9] = "P1"; staffS[9] = "CC"; subS[9] = "RS,GE,HI";//testing
                 * //find the staff
                 */

                staff_code = staff_code.Trim().ToUpper();
                for (int i = 0; i < 10; i++)
                {
                    if (staffS[i] == staff_code)
                    {
                        string [] rooms1 = setupS[i].Split(c1); found = true;
                        foreach (string s1 in rooms1)
                        {
                            rooms.Add(s1);
                        }
                        string[] subject1 = subS[i].Split(c1);
                        foreach (string s1 in subject1)
                        {
                            subjects.Add(s1);
                        }
                        break;
                    }
                }
                if (!found)
                {
                    return;
                }

                no_rooms    = rooms.Count; no_rows = no_rooms;
                no_subjects = subjects.Count;
                foreach (string s1 in rooms)
                {
                    ListItem l = new ListItem(s1, rooms.IndexOf(s1).ToString());
                    DropDownList_room1.Items.Add(l);
                    DropDownList_room2.Items.Add(l);
                }
                int p1 = 0;
                foreach (TTData.TT_period t in tt1.periodlist1.m_list)
                {
                    if (rooms.Contains(t.RoomCode.Trim().ToUpper()))
                    {
                        int r = rooms.IndexOf(t.RoomCode.Trim().ToUpper());
                        try
                        {
                            p1 = System.Convert.ToInt16(t.PeriodCode);
                        }
                        catch
                        {
                            p1 = 0;//reg periods etc
                        }
                        if (p1 > 0)
                        {
                            data[t.DayNo * 5 + p1, r]               = t.SetName + "<br>" + t.StaffCode;
                            pointers[t.DayNo * 5 + p1, r]           = t.File_Position;// only one of these lines works!
                            ScheduledPeriodIds[t.DayNo * 5 + p1, r] = t.ScheduledPeriodId;
                        }
                    }
                    else
                    {
                        foreach (string s1 in subjects)
                        {
                            if (t.SetName.Trim().ToUpper().Contains(s1))
                            {
                                try
                                {
                                    p1 = System.Convert.ToInt16(t.PeriodCode);
                                }
                                catch
                                {
                                    p1 = 0;//reg periods etc
                                }
                                if (p1 > 0)
                                {
                                    // now to add room to the drop downs....
                                    ListItem l = DropDownList_room1.Items.FindByText(t.RoomCode.Trim().ToUpper());
                                    if (l == null)
                                    {
                                        //need to add it...
                                        l = new ListItem(t.RoomCode.Trim().ToUpper(), no_rooms.ToString());
                                        DropDownList_room1.Items.Add(l);
                                        DropDownList_room2.Items.Add(l);

                                        data[t.DayNo * 5 + p1, no_rooms]               = t.SetName + "<br>" + t.StaffCode;
                                        pointers[t.DayNo * 5 + p1, no_rooms]           = t.File_Position;
                                        ScheduledPeriodIds[t.DayNo * 5 + p1, no_rooms] = t.ScheduledPeriodId;
                                        rooms.Add(t.RoomCode.Trim().ToUpper());
                                        no_rooms++;
                                    }
                                    else
                                    {
                                        int r1 = DropDownList_room1.Items.IndexOf(l);
                                        data[t.DayNo * 5 + p1, r1]               = t.SetName + "<br>" + t.StaffCode;
                                        pointers[t.DayNo * 5 + p1, r1]           = t.File_Position;
                                        ScheduledPeriodIds[t.DayNo * 5 + p1, r1] = t.ScheduledPeriodId;
                                    }
                                }
                            }
                        }
                    }
                }

                string[] rooms_t = new string[no_rooms];
                rooms_t            = rooms.ToArray();
                content0.InnerHtml = GenerateTimetable(data, rooms_t, no_rooms);

                //to serialise we need to put data /pointers into 1D arrays...
                string[] data1 = new string[30 * max_rows];
                for (int r = 0; r < max_rows; r++)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        data1[i + r * 30] = data[i, r];
                    }
                }
                ViewState.Add("data", data1);
                ViewState.Add("UseTTD", UseTTD);
                if (!UseTTD)
                {
                    Guid[] ScheduledPeriodIds1 = new Guid[30 * max_rows];
                    for (int r = 0; r < max_rows; r++)
                    {
                        for (int i = 0; i < 30; i++)
                        {
                            ScheduledPeriodIds1[i + r * 30] = ScheduledPeriodIds[i, r];
                        }
                    }
                    ViewState.Add("ScheduledPeriodIds", ScheduledPeriodIds1);
                }
                else
                {
                    long[] pointers1 = new long[30 * max_rows];
                    for (int r = 0; r < max_rows; r++)
                    {
                        for (int i = 0; i < 30; i++)
                        {
                            pointers1[i + r * 30] = pointers[i, r];
                        }
                    }
                    ViewState.Add("pointers", pointers1);
                }
                ViewState.Add("rooms", rooms_t);
                ViewState.Add("no_rooms", no_rooms);
                ViewState.Add("no_rows", no_rows);
                ViewState.Add("UseTTd", UseTTD);
            }
        }
Example #14
0
        protected void Button_savechanges_Click(object sender, EventArgs e)
        {
            // oh deary me... recover the viewstate
            string[] rooms    = new string[max_rows];//room names
            int      no_rooms = 0;

            string[,] data = new string[30, max_rows]; //has the display data
            string[] data1 = new string[30 * max_rows];

            long[,] pointers = new long[30, max_rows];//has the file ppointers...
            long[] pointers1 = new long[30 * max_rows];

            Guid[,] ScheduledPeriodIds = new Guid[30, max_rows];
            Guid[] ScheduledPeriodIds1 = new Guid[30 * max_rows];

            data1 = (string[])ViewState["data"];
            for (int r = 0; r < max_rows; r++)
            {
                for (int i = 0; i < 30; i++)
                {
                    data[i, r] = data1[i + r * 30];
                }
            }
            bool UseTTD = (bool)ViewState["UseTTD"];

            if (UseTTD)
            {
                pointers1 = (long[])ViewState["pointers"];
                for (int r = 0; r < max_rows; r++)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        pointers[i, r] = pointers1[i + r * 30];
                    }
                }
            }
            else
            {
                ScheduledPeriodIds1 = (Guid[])ViewState["ScheduledPeriodIds"];
                for (int r = 0; r < max_rows; r++)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        ScheduledPeriodIds[i, r] = ScheduledPeriodIds1[i + r * 30];
                    }
                }
            }
            no_rooms = (int)ViewState["no_rooms"];
            rooms    = (string[])ViewState["rooms"];
            string file_name = Server.MapPath(@"~/App_Data/tt_data.ttd");

            Cerval_Configuration c     = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
            DateTime             date1 = new DateTime();

            try { date1 = System.Convert.ToDateTime(c.Value); }
            catch { date1 = DateTime.Now; }

            TTData tt1 = new TTData();

            if (UseTTD)
            {
                tt1.Load(file_name, date1, date1, false, false, "");
            }
            else
            {
                tt1.Load_DB(date1);
            }                            //load from database

            int[] room_ttcode = new int[30];
            for (int i = 0; i < 30; i++)
            {
                room_ttcode[i] = -1;
            }
            for (int r = 0; r < no_rooms; r++)
            {
                for (int r1 = 0; r1 < tt1.room_count; r1++)
                {
                    try
                    {
                        if (tt1.RoomCodes[r1].Trim() == rooms[r].Trim())
                        {
                            //so the code here is r1...
                            room_ttcode[r] = r1;// so for row r the integer index is r1 now in room_ttcode[r]
                        }
                    }
                    catch
                    {// to catch nulls in  room_ttcode[]
                    }
                }
            }


            //now all we have to do is go through the file and update the rooms....
            if (UseTTD)
            {
                FileStream fs = new FileStream(file_name, FileMode.Open, FileAccess.ReadWrite);
                for (int r = 0; r < max_rows; r++)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        if (pointers[i, r] > 0)
                        {
                            if (room_ttcode[r] >= 0)
                            {
                                fs.Position = pointers[i, r] + 9;
                                fs.WriteByte((byte)room_ttcode[r]);
                            }
                        }
                    }
                }
                fs.Close();
            }
            else
            {
                for (int r = 0; r < max_rows; r++)                                 //for each row ie each room
                {
                    for (int i = 0; i < 30; i++)                                   //for each period
                    {
                        if (ScheduledPeriodIds[i, r] != Guid.Empty)                //there is a set here
                        {
                            foreach (TTData.TT_period p in tt1.periodlist1.m_list) //find the TT_period
                            {
                                if (p.ScheduledPeriodId == ScheduledPeriodIds[i, r])
                                {
                                    // which room id for this row??
                                    if (room_ttcode[r] >= 0) //ie we found a  ref...
                                    {
                                        Guid new_room = tt1.RoomList1[room_ttcode[r]];
                                        if (p.RoomId != new_room)
                                        {
                                            ScheduledPeriod p1 = new ScheduledPeriod();
                                            p1.Load(p.ScheduledPeriodId);
                                            p1.m_RoomId = new_room;
                                            p1.UpdateRoom();
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #15
0
        void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
            //calls here for any command - including a sort
            if (e.CommandName == "Edit_Grade")
            {
                Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Forecast_Grade_Edit");
                string s1 = c.Value;
                if (!c.valid)//try revert to config file
                {
                    System.Configuration.AppSettingsReader ar = new AppSettingsReader();
                    s1 = ar.GetValue("Exam Entries Forecast Grade Edit", s1.GetType()).ToString();
                }
                if (s1 == "none")
                {
                    visibility(4);
                    {
                        ListBox_PredictedGrades.Visible = false;
                        Button_Save_Prediction.Visible  = false;
                        Label_Title_for_Edit.Text       = "Predicted grades can't be edited at present";
                        return;
                    }
                }


                int             row      = Convert.ToInt32(e.CommandArgument);
                GridViewRow     row1     = GridView1.Rows[row];
                string          s        = Server.HtmlDecode(row1.Cells[0].Text);//is id
                Exam_Entry      ex1      = new Exam_Entry(); ex1.Load(s);
                SimplePupil     p1       = new SimplePupil(); p1.Load(ex1.m_StudentID.ToString());
                ExamOption      exo1     = new ExamOption(); exo1.Load(ex1.m_OptionID);
                Utility         u        = new Utility();
                bool            valid    = false;
                PupilPeriodList PPLlist1 = new PupilPeriodList();
                PPLlist1.LoadList("StudentID", ex1.m_StudentID.ToString(), true, DateTime.Now);
                //now I'd like to find the cse... but we dont know these
                CourseList   cselist1 = new CourseList(ex1.m_OptionID);
                GroupList_SL grplist1 = new GroupList_SL(Label_staffCode.Text.Trim());

                foreach (Course c1 in cselist1._courses)
                {
                    foreach (ScheduledPeriod scp in PPLlist1.m_pupilTTlist)
                    {
                        if (scp.m_groupcode.Substring(2, 2).ToUpper().Trim() == c1.CourseCode.ToUpper().Trim())
                        {
                            if (scp.m_staffcode.Trim().ToUpper() == Label_staffCode.Text.Trim().ToUpper())
                            {
                                if (s1 == "staff")
                                {
                                    valid = true;
                                }
                            }
                            foreach (Group g1 in grplist1._groups)
                            {
                                if (g1._GroupCode == scp.m_groupcode)
                                {
                                    valid = true;                                  //is SL
                                }
                            }
                        }
                    }
                }
                if (s1 == "all")
                {
                    valid = true;
                }
                visibility(4);
                if (!valid)
                {
                    ListBox_PredictedGrades.Visible = false;
                    Button_Save_Prediction.Visible  = false;
                    Label_Title_for_Edit.Text       = "Can't edit this grade as you don't teach the student";
                    return;
                }

                Label_Title_for_Edit.Text   = "Predicted Grade for " + p1.m_GivenName + " " + p1.m_Surname + " for " + exo1.m_OptionCode + ": " + exo1.m_OptionTitle;
                Label_EntryID_for_edit.Text = s;
                ListBox_PredictedGrades.Items.Clear();
                if (exo1.m_OptionQualification == "GCE")
                {
                    ListBox_PredictedGrades.Items.Add("A*");
                    ListBox_PredictedGrades.Items.Add("A");
                    ListBox_PredictedGrades.Items.Add("B");
                    ListBox_PredictedGrades.Items.Add("C");
                    ListBox_PredictedGrades.Items.Add("D");
                    ListBox_PredictedGrades.Items.Add("E");
                    ListBox_PredictedGrades.Items.Add("U");
                }
                if (exo1.m_OptionQualification == "GCSE")
                {
                    ListBox_PredictedGrades.Items.Add("A*");
                    ListBox_PredictedGrades.Items.Add("A");
                    ListBox_PredictedGrades.Items.Add("B");
                    ListBox_PredictedGrades.Items.Add("C");
                    ListBox_PredictedGrades.Items.Add("D");
                    ListBox_PredictedGrades.Items.Add("E");
                    ListBox_PredictedGrades.Items.Add("");
                }
                if (ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)) != null)
                {
                    ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)).Selected = true;
                    Button_Save_Prediction.Visible = true;
                }
                else
                {
                    //ListBox_PredictedGrades.Visible = false;
                    //Button_Save_Prediction.Visible = false;
                    //Label_Title_for_Edit.Text = "Can't edit this grade";
                }
                Button_Save_Prediction.Visible = true;
            }

            if (e.CommandName == "Edit_Button")
            {
                int         row  = Convert.ToInt32(e.CommandArgument);
                GridViewRow row1 = GridView1.Rows[row];
                string      s    = Server.HtmlDecode(row1.Cells[0].Text);//is id
                Exam_Entry  ex1  = new Exam_Entry(); ex1.Load(s);
                ExamsEntries_sql.UpdateCommand = "UPDATE  dbo.tbl_Exams_Entries  SET PredictedGrade = '?' WHERE ExamEntryID ='" + s + "' ";
            }
            if (e.CommandName == "Delete_Button")
            {
                int         row  = Convert.ToInt32(e.CommandArgument);
                GridViewRow row1 = GridView1.Rows[row];
                string      s    = Server.HtmlDecode(row1.Cells[0].Text);
                //do delete...
            }
        }
Example #16
0
        protected void ButtonGenerateTT_Click(object sender, EventArgs e)
        {
            string file_name = Server.MapPath(@"~/App_Data/tt_data.ttd"); int p1 = 0;

            string[,] data = new string[30, max_rows]; //has the display data
            for (int i = 0; i < 30; i++)
            {
                for (int j = 0; j < max_rows; j++)
                {
                    data[i, j] = "";
                }
            }
            string[] staff    = new string[max_rows];
            int      no_staff = 0;

            ListBox_year.Visible = false;
            HeaderDiv.Visible    = false;
            Cerval_Configuration c     = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
            DateTime             date1 = new DateTime();

            try { date1 = System.Convert.ToDateTime(c.Value); }
            catch { date1 = DateTime.Now; }

            TTData tt1 = new TTData();

            c = new Cerval_Configuration("StaffIntranet_UseOldTTDfile");
            if (c.Value.ToUpper() == "TRUE")
            {
                tt1.Load(file_name, date1, date1, false, false, "");
            }
            else
            {
                tt1.Load_DB(date1);
            }
            int x = 0;

            foreach (TTData.TT_period t in tt1.periodlist1.m_list)
            {
                foreach (ListItem l in ListBox_year.Items)
                {
                    if (t.SetName.Substring(0, 2).ToUpper().Contains(l.Text.ToUpper().Trim()) && l.Selected)
                    {
                        //so we want this set....
                        try
                        {
                            p1 = System.Convert.ToInt16(t.PeriodCode);
                        }
                        catch
                        {
                            p1 = 0;//reg periods etc
                        }
                        if (p1 > 0)
                        {
                            x = t.DayNo * 5 + p1;
                            for (int i = 0; i < max_rows; i++)
                            {
                                if (data[x, i] == "")
                                {
                                    data[x, i] = t.SetName + "<br>" + t.StaffCode.Trim();
                                    if ((i + 1) > no_staff)
                                    {
                                        no_staff++;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            content0.InnerHtml = GenerateTimetable(data, staff, no_staff);
        }
Example #17
0
        protected void ButtonGenerateTT_Click(object sender, EventArgs e)
        {
            string s = "";
            string file_name = Server.MapPath(@"~/App_Data/tt_data.ttd"); int p1 = 0;

            string[,] data = new string[30, max_rows]; //has the display data
            string[] staff    = new string[max_rows];
            int      no_staff = 0;

            ListBox_staff.Visible    = false;
            RadioButtonList1.Visible = false;
            HeaderDiv.Visible        = false;
            Cerval_Configuration c     = new Cerval_Configuration("StaffIntranet_TTD_TimetablePlanDate");
            DateTime             date1 = new DateTime();

            try { date1 = System.Convert.ToDateTime(c.Value); }
            catch { date1 = DateTime.Now; }

            TTData tt1 = new TTData();

            c = new Cerval_Configuration("StaffIntranet_UseOldTTDfile");
            if (c.Value.ToUpper() == "TRUE")
            {
                tt1.Load(file_name, date1, date1, false, false, "");
            }
            else
            {
                tt1.Load_DB(date1);
            }

            if (RadioButtonList1.SelectedValue == "Staff")
            {
                foreach (ListItem l in ListBox_staff.Items)
                {
                    if (l.Selected)
                    {
                        s = l.Text;
                        staff[no_staff] = l.Text.Trim().ToUpper(); no_staff++;
                    }
                }
            }

            if (RadioButtonList1.SelectedValue == "Subjects")
            {
                bool found = false;
                foreach (TTData.TT_period t in tt1.periodlist1.m_list)
                {
                    foreach (ListItem l in ListBox_staff.Items)
                    {
                        if (t.SetName.ToUpper().Contains(l.Text.ToUpper().Trim()) && l.Selected)
                        {
                            found = false;
                            s     = t.StaffCode.ToUpper().Trim();
                            for (int r = 0; r < no_staff; r++)
                            {
                                if (staff[r] == s)
                                {
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                staff[no_staff] = s; no_staff++;
                            }
                        }
                    }
                }
            }
            if (RadioButtonList1.SelectedValue == "All")
            {
                foreach (ListItem l in ListBox_staff.Items)
                {
                    if (l.Selected)
                    {
                        s = l.Text;
                        staff[no_staff] = l.Text.Trim().ToUpper(); no_staff++;
                    }
                }
            }

            foreach (TTData.TT_period t in tt1.periodlist1.m_list)
            {
                for (int r = 0; r < no_staff; r++)
                {
                    if (t.StaffCode.Trim().ToUpper() == staff[r])
                    {
                        try
                        {
                            p1 = System.Convert.ToInt16(t.PeriodCode);
                        }
                        catch
                        {
                            p1 = 0;//reg periods etc
                        }
                        if (p1 > 0)
                        {
                            data[t.DayNo * 5 + p1, r] = t.SetName + "<br>" + t.RoomCode;
                        }
                    }
                }
            }
            content0.InnerHtml = GenerateTimetable(data, staff, no_staff);
        }
Example #18
0
        private void UpDateGroupsListBox()
        {
            GroupList gr = new GroupList("");

            GroupListBox.Items.Clear();
            PupilPeriodList ppl     = new PupilPeriodList();
            string          struser = Context.User.Identity.Name;
            //struser = @"challoners\cc";
            Utility u = new Utility();
            string  s = "";
            //Guid personID = u.GetPersonID(struser,out s);
            Guid personID = u.GetPersonIdfromRequest(Request);

            s = u.GetsStaffCodefromRequest(Request);
            if (personID != Guid.Empty)
            {
                struser = s;
            }
            //struser = "******";
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Predicted_Grade_Type");

            s = c.Value;
            if (!c.valid)//try revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s = ar.GetValue("Predicted Grade Type", typeof(string)).ToString();
            }

            //if s =SL then do the lockdown mode for SL
            //if s = staff then do sets for staff
            //if s = ""... ignore...
            if (s == "SL")
            {
                this.Label1.Text = "Select Set. Only Subject Leaders can now change values.";
                //this code to list sets of a subject...
                if ((struser.Trim() == "CC") || (struser.Trim() == "DCO"))
                {
                    struser = "";                                                       //allow all sets
                }
                GroupList_SL grsl = new GroupList_SL(struser);
                foreach (Group g in grsl._groups)
                {
                    if ((g._StartDate < DateTime.Now) && (g._EndDate > DateTime.Now) && (g._GroupCode.StartsWith("13")))
                    {
                        ListItem Item = new ListItem(g._GroupCode, g._GroupID.ToString());
                        GroupListBox.Items.Add(Item);
                    }
                }
            }

            if (s == "STAFF")
            {
                this.Label1.Text = "Select Set ";
                //this code lists sets the user is timetabled to teach....
                ppl.LoadList("StaffCode", struser, false, DateTime.Now);
                bool add = false;
                foreach (Group g in gr._groups)
                {
                    add = false;
                    if ((g._StartDate < DateTime.Now) && (g._EndDate > DateTime.Now))
                    {
                        foreach (ScheduledPeriod p in ppl.m_pupilTTlist)
                        {
                            if ((p.m_groupcode == g._GroupCode) && (g._GroupCode.StartsWith("13")))
                            {
                                add = true;
                            }
                        }
                        if (add)
                        {
                            ListItem Item = new ListItem(g._GroupCode, g._GroupID.ToString());
                            GroupListBox.Items.Add(Item);
                        }
                    }
                }
            }

            GroupListBox.SelectedIndex = 0;
        }
Example #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DateTime d0 = new DateTime(2012, 3, 07, 0, 0, 10);  //embargo time
                DateTime d1 = new DateTime(2012, 3, 08, 6, 00, 05); //release time


                try
                {
                    Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_EmbargoStart");
                    d0 = System.Convert.ToDateTime(c.Value);
                    Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_EmbargoRelease");
                    d1 = System.Convert.ToDateTime(c1.Value);

#if DEBUG
                    d1 = new DateTime(2012, 3, 08, 6, 00, 05);//release time
#endif
                    if ((DateTime.Now > d0) && (DateTime.Now < d1))
                    {
                        Response.Redirect("../Home.aspx");
                    }
                }
                catch
                {
                }



                //check here to ensure proper authentication and roles?
                string              email = ""; bool Is_Staff = false;
                bool                Is_Student = false; PhysicsBooking.Visible = false; ExamsMenu.Visible = false;
                IOwinContext        ctx        = Request.GetOwinContext();
                ClaimsPrincipal     user       = ctx.Authentication.User;
                IEnumerable <Claim> claims     = user.Claims;
                foreach (Claim c2 in claims)
                {
                    if (c2.Type == "email")
                    {
                        email = c2.Value;
                    }
                    if (c2.Type == "PhysicsCanEdit")
                    {
                        PhysicsBooking.Visible = (c2.Value.ToUpper() == "TRUE");
                    }
                    if (c2.Type == "is_staff")
                    {
                        Is_Staff = (c2.Value.ToUpper() == "TRUE");
                    }
                    if (c2.Type == "is_student")
                    {
                        Is_Student = (c2.Value.ToUpper() == "TRUE");
                    }
                    if (c2.Type == "ExamsUser")
                    {
                        ExamsMenu.Visible = (c2.Value.ToUpper() == "TRUE");
                    }
                }
#if DEBUG
                if (Is_Student)
                {
                    Response.Redirect("../StudentInformation/StartForm.aspx");            //if we are here as Student - go away!
                }
                if (!Is_Staff)
                {
                    Response.Redirect("../content/Logout.aspx?email=" + email);          // - go away!
                }
#else
                if (Is_Student)
                {
                    Response.Redirect("../StudentInformation/StartForm.aspx");            //if we are here as Student - go away!
                }
                if (!Is_Staff)
                {
                    Response.Redirect("../admin/home_x.aspx");           // - go away!
                }
                if (!Is_Staff)
                {
                    Response.Redirect("../admin/content/Logout.aspx?email=" + email);          // - go away!
                }
                //for development server
                //if (Is_Student) Response.Redirect("/StudentInformation/StartForm.aspx");//if we are here as Student - go away!
                //if(!Is_Staff) Response.Redirect("/content/Logout.aspx?email="+ email);// - go away!
#endif
                Label2.Text = "Logged on as:   " + email;
            }
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
#if DEBUG
#else
                Context.User = Request.GetOwinContext().Authentication.User;
                //debug
                try {
                    //StreamWriter sw2 = new StreamWriter(@"c:/_TEMP_/StaffLogs1.txt", true);
                    //sw2.WriteLine("In Home.aspx");bool found = false;
                    foreach (Claim c in Request.GetOwinContext().Authentication.User.Claims)
                    {
                        if (c.Type == "staff_code")
                        {
                            //sw2.WriteLine(c.Value);found = true;
                        }
                        if (c.Type == "person_id")
                        {
                            // sw2.WriteLine(c.Value); found = true;
                        }
                    }
                    //if (!found) sw2.WriteLine("no staff code");
                    //sw2.Close();
                }
                catch (Exception ex)
                {
                    //StreamWriter sw2 = new StreamWriter(@"c:/_TEMP_/StaffLogs2.txt", true);
                    //sw2.WriteLine("In Home.aspx but claims failed...");
                    //sw2.WriteLine(ex.ToString());
                    //sw2.WriteLine(Request.GetOwinContext().Authentication.User.ToString());
                    //sw2.Close();
                }


                Utility u          = new Utility();
                string  staff_code = u.GetsStaffCodefromRequest(Request);
#endif
                DateTime d0 = new DateTime(2012, 3, 07, 0, 0, 10);  //embargo time
                DateTime d1 = new DateTime(2012, 3, 08, 6, 00, 05); //release time
                string   s  = "";
                try
                {
                    Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_EmbargoStart");
                    d0 = System.Convert.ToDateTime(c.Value);
                    Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_EmbargoRelease");
                    d1 = System.Convert.ToDateTime(c1.Value);

#if DEBUG
                    d1 = new DateTime(2012, 3, 08, 6, 00, 05);//release time
#endif
                    if ((DateTime.Now > d0) && (DateTime.Now < d1))
                    {
                        s = "<h4>Staff Intranet service is currently unavailable. ";
                        Cerval_Configuration c2 = new Cerval_Configuration("StaffIntranet_EmbargoReason");
                        s += c2.Value;
                        s += "<br />  <br /></h4>";
                        Response.Write(s); return;
                    }
                }
                catch
                { }

#if DEBUG
                //Response.Redirect("/content/ReportGenerator.aspx");
                //Response.Redirect("/content/SENEdit.aspx");
                //Response.Redirect("/content/ExamResultsforStaff.aspx");
                Response.Redirect("/content/testform.aspx");
                //Response.Redirect("/content/StartForm.aspx");
                //Server.Transfer("/content/StudentsComplexLists.aspx");
                //Response.Redirect("/content/music_stuff/UploadSets.aspx");
                Response.Redirect("/content/PupilAcademicProfile.aspx");
                Response.Redirect("/content/NextTT/NextYearTTChoice.aspx");
                Response.Redirect("/content/EditRooms.aspx");
                //Response.Redirect("/content/StartForm.aspx");
#else
#if Admin_test
                Response.Redirect("../admin-test/content/StartForm.aspx");   //for deploy version  TESTING site
#else
                switch (RadioButtonList1.SelectedIndex)
                {
                case 0:
                    Response.Redirect("../admin/content/StartForm.aspx");       //for deploy version
                    break;

                case 1:
                    Response.Redirect("../4matrix/");
                    break;

                case 2:
                    Response.Redirect("../admin/content/Booking/Menu.aspx");
                    break;

                default:
                    Response.Redirect("../admin/content/StartForm.aspx");       //for deploy version
                    break;
                }

                Response.Redirect("../admin/content/StartForm.aspx");   //for deploy version
#endif

                //Response.Redirect("/content/StartForm.aspx");         //for development server
                // have you corrected the links in StaffIntranetMaster.cs???
#endif
            }
        }
Example #21
0
        protected void Update(string grade)
        {
            SimplePupil p1 = new SimplePupil();

            p1.Load(TextBox2.Text);
            bool        found = false;
            string      s;
            string      s1  = "";
            ResultsList rl1 = new ResultsList();

            rl1.m_parameters = 2; rl1.m_db_field2 = "ResultType"; rl1.m_value2 = "6";
            rl1.LoadList("dbo.tbl_Core_Students.StudentId", p1.m_StudentId.ToString());
            foreach (Result r in rl1._results)
            {
                if (r.CourseID.ToString() == TextBox3.Text)
                {
                    // we have a value...
                    //updtae
                    found = true;
                    s     = "UPDATE tbl_Core_Results SET ResultValue='" + grade + "' ";
                    s    += "WHERE ResultID = '" + r.ResultID.ToString() + "'";
                    Encode en1 = new Encode();
                    en1.ExecuteSQL(s);

                    s1  = "Prediction for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno + ")  for ";
                    s1 += r.Coursename + " changed from " + r.Value + "  to  " + grade + ".   Change made by ";
                    s1 += Context.User.Identity.Name + " on   " + DateTime.Now.ToLongDateString();
                    s1 += "   at  " + DateTime.Now.ToShortTimeString();
                }
            }
            if (!found)
            {
                s  = "INSERT INTO dbo.tbl_Core_Results (ResultType, StudentID, ResultValue, ResultDate, ResultText, ";
                s += "CourseId  )";
                s += " VALUES ( '6', '";
                s += p1.m_StudentId.ToString() + "', '";
                s += grade + "', ";
                DateTime d0 = new DateTime();
                d0 = DateTime.Now;//going to normalise to 17th september in this year....
                DateTime d1 = new DateTime(d0.Year, 9, 17);
                s += " CONVERT(DATETIME, '" + d1.ToString("yyyy-MM-dd HH:mm:ss") + "', 102), '";
                s += " ',  '";
                s += TextBox3.Text + "' )";
                Encode en1 = new Encode();
                en1.ExecuteSQL(s);
                s1  = "New Prediction for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno + ")  for ";
                s1 += TextBox1.Text + "    Grade =  " + grade + ".   Change made by ";
                s1 += Context.User.Identity.Name + " on   " + DateTime.Now.ToLongDateString();
                s1 += "   at  " + DateTime.Now.ToShortTimeString();
            }
            MailHelper mail1 = new MailHelper();
            Utility    u     = new Utility();
            //string from_address = u.GetStaffCodefromContext(Context);
            string from_address = u.GetsStaffCodefromRequest(Request);

            from_address = u.Get_StaffEmailAddress(from_address);
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Predicted_Grade_Notification");

            s = c.Value;
            if (!c.valid)//try revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s = ar.GetValue("Predicted Grade Type", typeof(string)).ToString();
            }


            if (s != "")
            {
                mail1.SendMail(from_address, s, null, s1, "*****@*****.**", "A2 Prediction changed - sent of behalf of :" + from_address);
            }
            Server.Transfer("../content/PredictedGrades.aspx?Set=" + TextBox1.Text);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u = new Utility();
                Display_List.Items.FindByValue("Medical").Enabled = u.CheckStaffInConfigGroup(Context, "Medical");
                Display_List.Items.FindByValue("StudentDevelopment Log").Enabled = u.CheckStaffInConfigGroup(Context, "StudentDevelopment");
                StudentDetail1.Visible    = false;
                TimetableControl1.Visible = false;
                e1.Finished        += new EventHandler(e1_Finished);
                e1.Submit          += new EventHandler(e1_Finished);
                ResultGrid1.Visible = false;
                Label_Year.Text     = "";

                if (Request.QueryString.Count >= 1)
                {
                    string type = Request.QueryString["Type"];
                    ViewState.Add("ListType", type);// type = left for past students...
                    if (type == "Student")
                    {
                        string id1  = Request.QueryString["Id"];
                        string name = Request.QueryString["Name"];
                        TextBox_mask.Visible = false;
                        NameList.Visible     = true;
                        Label_Year.Text      = "Single Student";
                        Display_List.Visible = true;
                        ListItem Item = new ListItem(name, id1);
                        NameList.Items.Add(Item); Item.Selected = true; Display(); return;
                    }
                    if (type == "StudentByAdno")
                    {
                        string adno = Request.QueryString["Adno"];
                        try {
                            int         Adno = Convert.ToInt32(adno);
                            SimplePupil p1   = new SimplePupil(); p1.Load_Left(Adno);
                            string      id1  = p1.m_StudentId.ToString();
                            string      name = p1.m_GivenName + " " + p1.m_Surname;
                            TextBox_mask.Visible = false;
                            NameList.Visible     = true;
                            Label_Year.Text      = "Single Student";
                            Display_List.Visible = true;
                            ListItem Item = new ListItem(name, id1);
                            NameList.Items.Add(Item); Item.Selected = true; Display(); return;
                        }
                        catch { }
                    }
                    if ((Request.QueryString["Year"] == "0") || (Request.QueryString["Year"] == ""))
                    {
                        //do mask...
                        TextBox_mask.Visible = true;
                        NameList.Visible     = false;
                        Label_Year.Text      = "Type mask and return";
                        Display_List.Visible = false;
                    }
                    else
                    {
                        Build_NameList(Request.QueryString["Year"]);
                        if (type == "Left")
                        {
                            TextBox_mask.Visible = true;
                        }
                        Label_Year.Text = "Type mask and return";
                        Display();
                    }
                }
                RadioButtonList rbl1 = Display_List;
                try
                {
                    //going to read display keys
                    //StaffIntranet_StudentDetail_Disable
                    Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_StudentDetail_Disable");
                    string[]             v1 = c1.Value.Split(',');
                    for (int i = 0; i < 12; i++)
                    {
                        rbl1.Items[i].Enabled = (v1[i] == "1") ? true : false;
                    }
                }
                catch {}
            }
        }
Example #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                System.Security.Principal.IIdentity fred = HttpContext.Current.User.Identity;
                string s     = HttpContext.Current.User.Identity.Name;
                string s5    = Context.User.Identity.Name;
                string email = "";

                IOwinContext        ctx    = Request.GetOwinContext();
                ClaimsPrincipal     user   = ctx.Authentication.User;
                IEnumerable <Claim> claims = user.Claims;
                foreach (Claim c2 in claims)
                {
                    s = c2.Value;
                    if (c2.Type == "email")
                    {
                        email = s;
                    }
                    if (c2.Type == "person_id")
                    {
                        s5 = s;
                    }
                }
                //StreamWriter sw2 = new StreamWriter(@"c:/_TEMP_/StudentLogs_StartForm.txt", true);
                //sw2.WriteLine(email + "  :  " + s5+DateTime.Now.ToString()+" :  "+DateTime.Now.ToString());
                //sw2.Close();



                s = Request.QueryString["target"];
                if (s == "error")
                {
                    servercontent.InnerHtml = "<h3>error</h3>An unexpected error has occured. Please inform CC.";
                }
                string  path     = "";
                Guid    PersonID = new Guid();
                Utility u1       = new Utility();
                u1.GetPersonIdfromRequest(Request);

#if DEBUG
#endif
                Cerval_Configuration c = new Cerval_Configuration("StudentInformation_HomePageMessage");
                servercontent.InnerHtml = c.Value;
                bool show_photos = false;

                Utility u2 = new Utility();
                if (u1.Is_staff && (u2.Get_StaffCode(PersonID).Trim().ToUpper() == "CC"))
                {
                    show_photos = true;
                }
                //show_photos = true;

                if (PersonID != Guid.Empty)
                {
                    if ((u1.Is_student) && (u1.GetAdmissionNumber(PersonID) != 0))
                    {
                        string adno = u1.GetAdmissionNumber(PersonID).ToString();
                        path = Server.MapPath(@"App_Data/Results_names.txt");
                        try
                        {
                            using (StreamReader sr = new StreamReader(path))
                            {
                                while ((s = sr.ReadLine()) != null)
                                {
                                    if (s.Contains(adno))
                                    {
                                        show_photos = true;
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                    if (u1.Is_staff && (u2.Get_StaffCode(PersonID).Trim().ToUpper() == "CC"))
                    {
                        show_photos = true;
                    }
                }
            }
        }
Example #24
0
        private bool ProcessFile(Exam_Board exb1, string series, ref string Errors)
        {
            //so are we able to do E file or A file...
            string s               = "";
            string line            = "";
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Exams_CentreNumber");
            string centre_number   = "";

            if (c.valid)
            {
                centre_number = c.Value;
            }
            else
            {
                Errors = "Centre Number not found in cerval..." + centre_number; return(false);
            }



            //check that if we are asked for an E file we dont already have one...
            //could just check no entries have been sent for this series...
            ExamEntries_List exl0 = new ExamEntries_List();

            exl0.LoadAllSeries(Year.ToString(), series, true, exb1.m_ExamBoardId.ToString());
            char type = exl0.m_list.Count > 0 ? 'A' : 'E';

            int          n1    = 0;
            Encode       en    = new Encode();
            PupilDetails p1    = new PupilDetails();
            DateTime     date1 = new DateTime();

            date1 = DateTime.Now;


            if (centre_number.Length != 5)
            {
                Errors = "Centre Number wrong!" + centre_number; return(false);
            }

            Exam_File    ef1 = new Exam_File();
            StreamWriter fs  = OpenFile(exb1, type, ref ef1, 194, series, centre_number, "14");

            if (fs == null)
            {
                Errors = "Error opening file"; return(false);
            }
            if (type == 'A')
            {
                //going to find any not yet sent and for these students clear the sent dates...
                exl0.m_list.Clear();



                exl0.LoadAllSeries(Year.ToString(), series, false, exb1.m_ExamBoardId.ToString());


                //now for each student in this list we need to re-send entries....
                foreach (Exam_Entry ex in exl0.m_list)
                {
                    ExamOption exo0 = new ExamOption();
                    exo0.Load(ex.m_OptionID);
                    ExamEntries_List exl2 = new ExamEntries_List();
                    exl2.Load(ex.m_StudentID, Year.ToString(), series, true, exb1.m_ExamBoardId.ToString());
                    foreach (Exam_Entry ex0 in exl2.m_list)
                    {
                        s  = "UPDATE tbl_Exams_Entries SET EntryFileID = NULL , DateEntered = NULL WHERE (ExamEntryID ='" + ex0.m_ExamEntryID.ToString() + "')";
                        n1 = en.Execute_count_SQL(s);
                    }
                }
            }

            ExamEntries_List exl1 = new ExamEntries_List();

            exl1.LoadAllSeries(Year.ToString(), series, false, exb1.m_ExamBoardId.ToString());
            int  n         = 0;
            int  n_record  = -1;//don't write first one
            int  n_records = 0;
            Guid std1      = Guid.Empty;

            foreach (Exam_Entry ex1 in exl1.m_list)
            {
                if (ex1.m_StudentID != std1)
                {
                    //have a new student
                    while (line.Length < 192)
                    {
                        line += " ";
                    }
                    if (n_record >= 0)
                    {
                        fs.WriteLine(line); n_records++;
                    }
                    std1     = ex1.m_StudentID;
                    p1.m_UCI = "";
                    p1.Load(std1.ToString());
                    n_record = 0;
                    line     = "";
                }
                if (n_record == 12)
                {
                    while (line.Length < 192)
                    {
                        line += " ";
                    }
                    fs.WriteLine(line); n_records++;
                    line = ""; n_record = 0;
                }
                n++;
                if (line == "")
                {
                    line = type + "5";
                    if (p1.m_IsOnRole)
                    {
                        line += "C";
                    }
                    else
                    {
                        line += "P";
                    }
                    line += centre_number;
                    s     = p1.m_examNo.ToString();
                    while (s.Length < 4)
                    {
                        s = "0" + s;
                    }
                    line += s;
                    //going to strip , from middle names to space...
                    s = p1.m_Surname + ":" + p1.m_GivenName + " " + p1.m_MiddleName.Replace(",", " ");
                    while (s.Length < 40)
                    {
                        s += " ";
                    }
                    if (s.Length > 40)
                    {
                        s.Substring(0, 40);
                    }
                    line += s;
                    if (p1.m_Gender == "F")
                    {
                        line += "F";
                    }
                    else
                    {
                        line += "M";
                    }
                    if (p1.m_dob == null)
                    {
                        s = "000000";
                    }
                    else
                    {
                        s = p1.m_dob.ToString("ddMMyy");
                    }
                    if (s == "010101")
                    {
                        s = "000000";               //010101  appears to the the defauult date if date in NULL in db
                    }
                    line += s;
                    if ((p1.m_UCI.Length != 13) || (p1.m_examNo == 0))
                    {
                        // todo  .. need to hanlde this error
                        /// clean up or offer UCI generation....
                        Errors  = "No UCI for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno.ToString() + ")";
                        Errors += "Please create UCI for student and re-run";
                        //first mark any entries made for this file as not made........
                        s  = "UPDATE dbo.tbl_Exams_Entries SET EntryFileID = NULL , DateEntered = NULL ";
                        s += " WHERE (EntryFileID ='" + ef1.m_EntryFileId.ToString() + "' )";
                        Encode en1 = new Encode();
                        n1 = en1.Execute_count_SQL(s);
                        fs.Close();
                        return(false);
                    }
                    s     = p1.m_UCI;
                    line += s;
                    line += p1.m_upn.Trim();

                    //TODO....
                    line += p1.m_uln.Trim();
                    //line += "          ";//uln
                    //now the guest flag..... hmm...
                    //ought to do this really for cand from collaboration...

                    line += "             ";// up to byte 108 in jcq mess...
                }
                ExamOption exo1 = new ExamOption();
                exo1.Load(ex1.m_OptionID);
                if (exo1.m_ExamBoardID == exb1.m_ExamBoardId)
                {
                    //add it to the file unless withdrawn
                    if (!ex1.m_withdrawn)
                    {
                        s     = exo1.m_OptionCode + "      "; s = s.Substring(0, 6);
                        line += s + " "; n_record++;
                    }
                    //now update the Exam Entry record...
                    s  = "UPDATE tbl_Exams_Entries SET EntryFileID ='" + ef1.m_EntryFileId.ToString() + "' ";
                    s += " , DateEntered =CONVERT(DATETIME, '" + ef1.m_DateCreated.ToString("yyyy-MM-dd HH:mm:ss") + "', 102)  ";
                    s += " , EntryStatus = '4' ";
                    s += " WHERE (ExamEntryID = '" + ex1.m_ExamEntryID.ToString() + "' )";
                    en.ExecuteSQL(s);
                }
            }
            while (line.Length < 192)
            {
                line += " ";
            }
            if (n_record >= 0)
            {
                fs.WriteLine(line); n_records++;
            }
            EndFile(type, n_records, date1, fs, 194, ef1);
            return(true);
        }