Пример #1
0
        //public IEnumerable<KeyValuePair<int, string>> GetSpecialIdentifiers()
        //{
        //    using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetInfoLibSpecialIdentifiers.Description()))
        //    {
        //        using (IDataReader reader = database.ExecuteReader(command))
        //        {
        //            while (reader.Read())
        //                yield return new KeyValuePair<int, string>(reader.GetInt32(0), reader.GetString(1));
        //        }
        //    }
        //}

        public InfoLibForumCallItem GetInfoLibForumCallItem()
        {
            using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetInfoLibForumCall.Description()))
            {
                using (IDataReader reader = database.ExecuteReader(command))
                {
                    InfoLibForumCallItem forumCallItem = null;
                    if (reader.Read())
                    {
                        forumCallItem             = new InfoLibForumCallItem();
                        forumCallItem.SummaryItem = new InfoLibItem()
                        {
                            InfoLibItemId = reader.GetInt32(0),
                            ParentId      = reader.GetInt32(1),
                            ItemHeader    = new InfoLibItem.InfoLibItemHeader()
                            {
                                HeaderText = reader.IsDBNull(2) ? null : reader.GetString(2),
                                HeaderType = reader.GetInt16(3).ToEnumObject <InfoLibHeaderType>()
                            },
                            ViewerScope = reader.IsDBNull(4) ? (Scope?)null : reader.GetInt16(4).ToEnumObject <Scope>()
                        };

                        reader.NextResult();

                        if (reader.Read())
                        {
                            forumCallItem.DetailedItem = new InfoLibItem()
                            {
                                InfoLibItemId = reader.GetInt32(0),
                                ParentId      = reader.GetInt32(1),
                                ItemHeader    = new InfoLibItem.InfoLibItemHeader()
                                {
                                    HeaderText = reader.IsDBNull(2) ? null : reader.GetString(2),
                                    HeaderType = reader.GetInt16(3).ToEnumObject <InfoLibHeaderType>()
                                },
                                ViewerScope = reader.IsDBNull(4) ? (Scope?)null : reader.GetInt16(4).ToEnumObject <Scope>()
                            };
                        }
                    }
                    return(forumCallItem);
                }
            }
        }
        private void InitializeView()
        {
            InfoLibForumCallItem forumCallItem = InfoLibBLL.GetInfoLibForumCallItem();

            if (forumCallItem != null)
            {
                divforumCallSummaryView.Visible = true;
                InfoLibItem summaryItem = forumCallItem.SummaryItem;
                litSummaryViewContent.Text = summaryItem.ItemHeader.HeaderText;

                if (forumCallItem.DetailedItem != null)
                {
                    hlMoreLink.Visible = true;
                    NameValueCollection nvColl = new NameValueCollection();
                    nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_ITEMID_INT.Description(),
                               forumCallItem.DetailedItem.InfoLibItemId.ToString());
                    nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_PARENTID_INT.Description(),
                               forumCallItem.DetailedItem.ParentId.ToString());
                    nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_SPECIAL_IDENTIFIER.Description(),
                               InfoLibSpecialIdentifiers.Forum_call.EnumValue <int>().ToString());
                    hlMoreLink.NavigateUrl = InfoLibUtil.ConstructInfoLibItemNavigationUrl(nvColl);
                }
            }
        }