protected void Button_MakeGroup_Click(object sender, EventArgs e)
        {
            string  s = TextBox_GroupName.Text;
            Utility u = new Utility();
            //string s1 = u.GetStaffCodefromContext(this.Context);
            string s1 = u.GetsStaffCodefromRequest(Request);
            Guid   g  = new Guid(u.Get_StaffID(s1));

            GroupList gl1 = new GroupList();

            gl1.LoadList_StaffPrivateGroups(s1, GroupList.GroupListOrder.GroupName);

            string code = s1 + "_" + (gl1._groups.Count + 1).ToString();

            Group g1 = new Group();

            g1._CourseID = Cerval_Globals.newdawnCse;
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }
            g1._EndDate                    = new DateTime(y, 7, 31);
            g1._GroupCode                  = code;
            g1._GroupManagedBy             = g;
            g1._GroupName                  = s;
            g1._GroupPrimaryAdministrative = false;
            g1._StartDate                  = DateTime.Now.AddDays(-2);
            g1.Save();

            //now need to insert into New Dawn stuff....

            Group g2 = new Group(); g2.Load("StaffGps", DateTime.Now);

            if (g2._valid)
            {
                GroupLink gll1 = new GroupLink();
                gll1.ParentId = g2._GroupID;
                gll1.ChildId  = g1._GroupID;
                gll1.Save();
            }
            gl1._groups.Clear();
            //string staff_code = u.GetStaffCodefromContext(Context);
            string staff_code = u.GetsStaffCodefromRequest(Request);

            gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
            DropDownList_groups.Items.Clear();
            foreach (Group g3 in gl1._groups)
            {
                System.Web.UI.WebControls.ListItem l = new ListItem(g3._GroupName, g3._GroupID.ToString());
                DropDownList_groups.Items.Add(l);
            }
        }
Ejemplo n.º 2
0
        protected void ProcessMakeGroup(string p)
        {
            string s = p;

            string[] parameters = new string[3];
            string[] splitchar  = new string[2];
            //parameters are students%GroupName
            splitchar[0] = "%";
            parameters   = p.Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            splitchar[0] = ":"; splitchar[1] = ",";
            parameters   = parameters[0].Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            s            = parameters[1];//has group name....

            Utility u = new Utility();
            //string s1=u.GetStaffCodefromContext(Context);
            string s1 = u.GetsStaffCodefromRequest(Request);
            Guid   g  = new Guid(u.Get_StaffID(s1));

            GroupList gl1 = new GroupList();

            gl1.LoadList_StaffPrivateGroups(s1, GroupList.GroupListOrder.GroupName);

            string code = s1 + "_" + (gl1._groups.Count + 1).ToString();

            Group g1 = new Group();

            g1._CourseID = Cerval_Globals.newdawnCse;
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }
            g1._EndDate                    = new DateTime(y, 7, 31);
            g1._GroupCode                  = code;
            g1._GroupManagedBy             = g;
            g1._GroupName                  = s;
            g1._GroupPrimaryAdministrative = false;
            g1._StartDate                  = DateTime.Now.AddDays(-2);
            g1.Save();

            //now need to insert into New Dawn stuff....

            Group g2 = new Group(); g2.Load("StaffGps", DateTime.Now);

            if (g2._valid)
            {
                GroupLink gll1 = new GroupLink();
                gll1.ParentId = g2._GroupID;
                gll1.ChildId  = g1._GroupID;
                gll1.Save();
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PostBackStr_MakeGroup = Page.ClientScript.GetPostBackEventReference(this, "MakeGroup");
            string s = Request.Params.Get("Ajaxcall");

            if (s == "1")
            {
                GroupList gl1 = new GroupList();
                Utility   u   = new Utility();

                //string staff_code = u.GetStaffCodefromContext(Context);
                string staff_code = u.GetsStaffCodefromRequest(Request);
                gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
                foreach (Group g in gl1._groups)
                {
                    string s2 = g._GroupCode;
                    s2 += g._GroupName;
                    Response.Write("<option value=\"" + g._GroupID.ToString() + "\">" + g._GroupName + "</option>");
                }
                Response.End(); return;
            }
            if (s == "3")
            {
                s = Request.Params.Get("GroupId");
                Guid  g1  = new Guid(s);
                Group gp1 = new Group(); gp1.Load(g1);
                gp1.Delete();
                GroupList gl1 = new GroupList();
                Utility   u   = new Utility();
                //string staff_code = u.GetStaffCodefromContext(this.Context);
                string staff_code = u.GetsStaffCodefromRequest(Request);
                gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
                foreach (Group g in gl1._groups)
                {
                    string s2 = g._GroupCode;
                    s2 += g._GroupName;
                    Response.Write("<option value=\"" + g._GroupID.ToString() + "\">" + g._GroupName + "</option>");
                }
                Response.End(); return;
            }

            if (IsPostBack)
            {
                s = Request.Params.Get("__EVENTARGUMENT");
                if (s == "MakeGroup")
                {
                    ProcessMakeGroup(Request.Params.Get("__EVENTDATA"));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GroupList gl1 = new GroupList();
                Utility   u   = new Utility();
                //string staff_code = u.GetStaffCodefromContext(this.Context);
                string staff_code = u.GetsStaffCodefromRequest(Request);
                gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);

                foreach (Group g in gl1._groups)
                {
                    string s2 = g._GroupName;
                    System.Web.UI.WebControls.ListItem l = new ListItem(s2, g._GroupID.ToString());
                    DropDownList_groups.Items.Add(l);
                }
            }
        }
        protected void Button_Delete_Click(object sender, EventArgs e)
        {
            string s   = DropDownList_groups.SelectedItem.Text;
            string s2  = DropDownList_groups.SelectedItem.Value;
            Guid   g1  = new Guid(s2);
            Group  gp1 = new Group(); gp1.Load(g1);

            gp1.Delete();
            GroupList gl1 = new GroupList();
            Utility   u   = new Utility();
            //string staff_code = u.GetStaffCodefromContext(this.Context);
            string staff_code = u.GetsStaffCodefromRequest(Request);

            gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
            DropDownList_groups.Items.Clear();
            foreach (Group g in gl1._groups)
            {
                s2 = g._GroupName;
                System.Web.UI.WebControls.ListItem l = new ListItem(s2, g._GroupID.ToString());
                DropDownList_groups.Items.Add(l);
            }
        }
Ejemplo n.º 6
0
        protected void UpdateMessageList(string t)
        {
            Cerval_Globals cg1 = new Cerval_Globals();

            ListBox_staff.Items.Clear();
            string   s1    = DropDownList_Year.SelectedValue;
            DateTime date1 = new DateTime();

            date1 = DateTime.Now.AddMonths(0);

            if (t == "Group")
            {
                GroupList gl1;
                if (s1 == "My Groups")
                {
                    gl1 = new GroupList();
                    Utility u          = new Utility();
                    string  staff_code = u.GetsStaffCodefromRequest(Request);
                    gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
                    foreach (Group g in gl1._groups)
                    {
                        ListItem l1 = new ListItem(g._GroupName, g._GroupID.ToString());
                        ListBox_staff.Items.Add(l1);
                    }
                    return;
                }
                else
                {
                    gl1 = new GroupList("", date1);
                }
                //put the form groups first
                foreach (Group g in gl1._groups)
                {
                    if (g._GroupCode.StartsWith(s1))
                    {
                        if (g._CourseID == Cerval_Globals.RegistrationCse)//registration../
                        {
                            //only for year groups...
                            ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString());
                            ListBox_staff.Items.Add(l1);
                        }
                    }
                }
                foreach (Group g in gl1._groups)
                {
                    if (g._GroupCode.StartsWith(s1))
                    {
                        if ((g._CourseID != Cerval_Globals.RegistrationCse) && (!Cerval_Globals.NewStructureCourses.Contains(g._CourseID)))
                        {
                            ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString());
                            ListBox_staff.Items.Add(l1);
                        }
                    }
                    if (s1.ToUpper() == "14")
                    {
                        if (g._GroupCode.StartsWith("1") || g._GroupCode.StartsWith("7") || g._GroupCode.StartsWith("8") || g._GroupCode.StartsWith("9"))
                        {
                        }
                        else
                        {
                            ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString());
                            ListBox_staff.Items.Add(l1);
                        }
                    }
                }
            }


            if (t == "Student")
            {
                //StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", "{ fn NOW() }");
                StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", DateTime.Now);
                ListBox_staff.SelectionMode = System.Web.UI.WebControls.ListSelectionMode.Multiple;
                TextBox_textTo.Visible      = true;
            }
        }