Exemplo n.º 1
0
        public Section GetSection(int id)
        {
            Section sections = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Sections_SelectByIdV4"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", id);
            }, map : delegate(IDataReader reader, short set)
            {
                if (set == 0)
                {
                    sections = MapSection(reader);
                }
                else if (set == 1)
                {
                    SectionInstructors si = SectionInstructorsMapCourse(reader);
                    if (sections.Instructors == null)
                    {
                        sections.Instructors = new List <SectionInstructors>();
                    }
                    sections.Instructors.Add(si);
                }
            }
                                    );
            return(sections);
        }
Exemplo n.º 2
0
        private SectionInstructors SectionInstructorsMapCourse(IDataReader reader)
        {
            SectionInstructors item = new SectionInstructors();
            int startingIndex       = 0;

            item.SectionId    = reader.GetSafeInt32(startingIndex++);
            item.InstructorId = reader.GetSafeInt32(startingIndex++);
            item.Name         = reader.GetSafeString(startingIndex++);
            return(item);
        }
Exemplo n.º 3
0
        public List <SectionInstructors> GetChosenInstructors(int id)
        {
            List <SectionInstructors> List = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.SectionInstructors_SelectBySectionId"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", id);
            }, map : delegate(IDataReader reader, short set)
            {
                SectionInstructors si = SectionInstructorsMapCourse(reader);

                if (List == null)
                {
                    List = new List <SectionInstructors>();
                }

                List.Add(si);
            });

            return(List);
        }