コード例 #1
0
        public IList<Core.Business.TopicExtend> GetAllTopicExtend()
        {
            IList<Core.Business.TopicExtend> topicExtendlist = new List<Core.Business.TopicExtend>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            SqlDataReader reader = sql.ExecuteSPReader("USP_TopicExtend_SelectAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.TopicExtend topicExtend = new Core.Business.TopicExtend();

                    if (!reader.IsDBNull(0)) topicExtend.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) topicExtend.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) topicExtend.InstanceId = reader.GetString(2);
                    if (!reader.IsDBNull(3)) topicExtend.Type = reader.GetString(3);

                    topicExtend.MarkOld();
                    topicExtendlist.Add(topicExtend);
                }
                reader.Close();
            }
            return topicExtendlist;
        }
コード例 #2
0
        public int GetTopicesNumByInstanceAndType(string strType, string strInstanceId,int level)
        {
            int count = 0;

            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@Type", SqlDbType.NVarChar, strType);
            sql.AddParameter("@InstanceId", SqlDbType.NVarChar, strInstanceId);
            if (level != -1)
            {
                sql.AddParameter("@Level", SqlDbType.NVarChar, level);
            }

            SqlDataReader reader = sql.ExecuteSPReader("USP_TopicExtend_GetTopicCount_By_InstanceId_And_Type");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.TopicExtend topicExtend = new Core.Business.TopicExtend();

                if (!reader.IsDBNull(0)) count = reader.GetInt32(0);

                reader.Close();
                return count;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return 0;
            }
        }
コード例 #3
0
        public Core.Business.TopicExtend Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("USP_TopicExtend_Select_By_Id");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.TopicExtend topicExtend = new Core.Business.TopicExtend();

                if (!reader.IsDBNull(0)) topicExtend.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) topicExtend.AccountId = reader.GetInt64(1);
                if (!reader.IsDBNull(2)) topicExtend.InstanceId = reader.GetString(2);
                if (!reader.IsDBNull(3)) topicExtend.Type = reader.GetString(3);

                reader.Close();
                return topicExtend;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }