コード例 #1
0
        private OfficeHourQuestionTag OfficeHourQuestionTagMap(IDataReader reader)
        {
            OfficeHourQuestionTag item = new OfficeHourQuestionTag();
            int startingIndex          = 0;

            item.OfficeHourQuestionId = reader.GetSafeInt32(startingIndex++);
            item.TagId   = reader.GetSafeInt32(startingIndex++);
            item.TagName = reader.GetSafeString(startingIndex++);

            return(item);
        }
コード例 #2
0
        public OfficeHour Get(int Id)
        {
            OfficeHour         session  = null;
            OfficeHourQuestion question = null;
            Dictionary <int, OfficeHourQuestion> book = new Dictionary <int, OfficeHourQuestion>();
            OfficeHourQuestionTag tag = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.OfficeHours_SelectById"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", Id);
            }, map : delegate(IDataReader reader, short set)
            {
                if (set == 0)
                {
                    session = OfficeHourMap(reader);
                }
                else if (set == 1)
                {
                    question = OfficeHourQuestionMap(reader);
                    if (session.Questions == null)
                    {
                        session.Questions = new List <OfficeHourQuestion>();
                    }
                    session.Questions.Add(question);

                    book.Add(question.Id, question);
                }
                else if (set == 2)
                {
                    tag = OfficeHourQuestionTagMap(reader);

                    var parent = book[tag.OfficeHourQuestionId];

                    if (parent.Tags == null)
                    {
                        parent.Tags = new List <Tag>();
                    }

                    Tag t     = new Tag();
                    t.Id      = tag.TagId;
                    t.TagName = tag.TagName;
                    parent.Tags.Add(t);
                }
            }
                                    );
            return(session);
        }
コード例 #3
0
        private void ProcessOfficeHourQuestionTagData(IDataReader reader, Dictionary <int, OfficeHourQuestion> Diary, List <OfficeHourQuestion> question)
        {
            OfficeHourQuestionTag label = OfficeHourQuestionTagMap(reader);

            var parentQuestion = Diary[label.OfficeHourQuestionId];

            Tag t = new Tag();

            t.Id      = label.TagId;
            t.TagName = label.TagName;

            if (parentQuestion.Tags == null)
            {
                parentQuestion.Tags = new List <Tag>();
            }

            parentQuestion.Tags.Add(t);
        }
コード例 #4
0
        private OfficeHourQuestionTag OfficeHourQuestionTagMap(IDataReader reader)
        {
            OfficeHourQuestionTag item = new OfficeHourQuestionTag();
            int startingIndex = 0;

            item.OfficeHourQuestionId = reader.GetSafeInt32(startingIndex++);
            item.TagId = reader.GetSafeInt32(startingIndex++);
            item.TagName = reader.GetSafeString(startingIndex++);

            return item;
        }