Example #1
0
            private void LoadOrCreateSectionFromLine(string line)
            {
                var    match       = SectionPattern.Match(line);
                var    sectionKey  = match.Groups[1].Value.Trim();
                string description = null;
                string groupKey    = null;

                if (GroupSectionPattern.IsMatch(sectionKey))
                {
                    var match1 = GroupSectionPattern.Match(sectionKey);
                    groupKey    = match1.Value.Trim();
                    match1      = match1.NextMatch().NextMatch();
                    description = match1.Value.Trim();
                }

                if (!Sections.TryGetValue(sectionKey, out loadedSection))
                {
                    loadedSection = new Section(sectionKey, description);

                    Sections.Add(sectionKey, loadedSection);

                    if (groupKey != null)
                    {
                        Dictionary <string, Section> groupSection;
                        if (!GroupSections.TryGetValue(groupKey, out groupSection))
                        {
                            groupSection = new Dictionary <string, Section>();

                            GroupSections.Add(groupKey, groupSection);
                        }

                        if (!groupSection.ContainsKey(description))
                        {
                            groupSection.Add(description, loadedSection);
                        }
                    }
                }
            }
        public TeacherModel()
        {
            BasicRepository _basic = new BasicRepository();

            BasicContants.StoredProcedure = "GetTeacherRoles";
            Roles    = _basic.Get();
            RoleList = Roles.ToRoleSelectListItems(RoleID);

            BasicContants.StoredProcedure = "GetGender";
            Genders    = _basic.Get();
            GenderList = Genders.ToGenderSelectListItems(GenderID);

            BasicContants.StoredProcedure = "GetCity";
            Cities   = _basic.Get();
            CityList = Cities.ToCitySelectListItems(CityID);

            BasicContants.StoredProcedure = "GetDesignation";
            Designations    = _basic.Get();
            DesignationList = Designations.ToDesignationSelectListItems(DesignationID);

            BasicContants.StoredProcedure = "GetGroupSection";
            GroupSections    = _basic.Get();
            GroupSectionList = GroupSections.ToGroupSectionSelectListItems(GroupSectionID);
        }