コード例 #1
0
ファイル: FeedBackProvider.cs プロジェクト: dalinhuang/ume-v3
        /// <summary>
        /// ��ȡ���з�����Ϣ
        /// </summary>
        /// <returns></returns>
        public IList<Core.Business.FeedBack> GetAllFeedBack(CY.UME.Core.PagingInfo pagingInfo, int KindId, string BeginTime, string EndTime)
        {
            IList<Core.Business.FeedBack> feedBacklist = new List<Core.Business.FeedBack>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnectionString);

            sql.AddParameter("@PageNumber", SqlDbType.Int, pagingInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagingInfo.PageSize);

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "FeedBack");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, "Id DESC");
            sql.AddParameter("@Fields", SqlDbType.NVarChar, "[Id], [FeedBackContent],[KindId],[DateCreated],[Email]");
            string where = " 1 = 1 ";
            if (KindId != 0)
                where += " AND [KindId] = " + KindId;
            if (BeginTime.Length >= 1 && EndTime.Length >= 1)
                where += " AND [DateCreated] Between '" + BeginTime + "' AND '" + EndTime + "' ";
            sql.AddParameter("@Filter", SqlDbType.NVarChar, where);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.FeedBack feedBack = new Core.Business.FeedBack();

                    if (!reader.IsDBNull(0)) feedBack.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) feedBack.FeedBackContent = reader.GetString(1);
                    if (!reader.IsDBNull(2)) feedBack.KindId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) feedBack.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) feedBack.Email = reader.GetString(4);

                    feedBack.MarkOld();
                    feedBacklist.Add(feedBack);
                }
                reader.Close();
            }
            return feedBacklist;
        }
コード例 #2
0
ファイル: FeedBackProvider.cs プロジェクト: dalinhuang/ume-v3
        public Core.Business.FeedBack Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility(SqlConnectionString);

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectFeedBack);

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

                if (!reader.IsDBNull(0)) feedBack.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) feedBack.FeedBackContent = reader.GetString(1);
                if (!reader.IsDBNull(2)) feedBack.KindId = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) feedBack.DateCreated = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) feedBack.Email = reader.GetString(4);

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

                return null;
            }
        }