コード例 #1
0
        public static String SaveGroups(List <String> SubjectID, List <String> Class, List <int> Group, Boolean IsFinal = false)
        {
            string paramInfo = "";
            Dictionary <String, Group> Groups = Clone.Dictionary <String, Group>((Dictionary <String, Group>)(CurrentSession.Get("Groups") ?? InputHelper.Groups));

            for (int i = 0; i < SubjectID.Count; i++)
            {
                String aKey = SubjectID[i] + "_" + Class[i];
                if (Groups.ContainsKey(aKey)) // bo cung dc
                {
                    Groups[aKey].GroupID = Group[i];
                }

                paramInfo += "MH:" + SubjectID[i] + " Class: " + Class[i] + " Group: " + Group[i] + "<br />";
            }
            if (IsFinal)
            {
                InputHelper.Groups = Clone.Dictionary <String, Group>(Groups);
                OutputHelper.SaveOBJ("Groups", InputHelper.Groups);
            }
            else
            {
                CurrentSession.Set("Groups", Clone.Dictionary <String, Group>(Groups));
            }
            return(paramInfo);
        }
コード例 #2
0
        public static String SaveIgnoreGroups(List <String> SubjectID, List <String> Class, List <String> Check, Boolean IsFinal = false)
        {
            string paramInfo = "";
            Dictionary <String, Group> IgnoreGroups = Clone.Dictionary <String, Group>((Dictionary <String, Group>)(CurrentSession.Get("IgnoreGroups") ?? InputHelper.Groups));

            for (int i = 0; i < SubjectID.Count; i++)
            {
                String aKey = SubjectID[i] + "_" + Class[i];
                if (IgnoreGroups.ContainsKey(aKey))
                {
                    IgnoreGroups[aKey].IsIgnored = (Check[i] == "checked") ? true : false; // Check[i] != "undefined"
                }
                paramInfo += "MH:" + SubjectID[i] + " Class: " + Class[i] + " Check: " + Check[i] + "<br />";
            }

            if (IsFinal)
            {
                InputHelper.Groups = Clone.Dictionary <String, Group>(IgnoreGroups);

                //for (int i = 0; i < SubjectID.Count; i++)
                //{
                //    if (InputHelper.Groups.ContainsKey(SubjectID[i] + "_" + Class[i]))
                //    {
                //        if (Check[i] == "undefined")
                //            InputHelper.Groups[SubjectID[i] + "_" + Class[i]].IsIgnored = false;
                //        else
                //            InputHelper.Groups[SubjectID[i] + "_" + Class[i]].IsIgnored = true;
                //    }
                //}
                OutputHelper.SaveOBJ("Groups", InputHelper.Groups);
            }
            else
            {
                CurrentSession.Set("IgnoreGroups", Clone.Dictionary <String, Group>(IgnoreGroups));
            }
            return(paramInfo);
        }