예제 #1
0
        public IList<CY.UME.Core.Business.Wishing> GetAllWishes(int count)
        {
            IList<Core.Business.Wishing> wishinglist = new List<Core.Business.Wishing>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);
            sql.AddParameter("@Count", SqlDbType.Int, count);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Wishing wishing = new Core.Business.Wishing();
                    long id = 0;
                    if (!reader.IsDBNull(0)) id = reader.GetInt64(0);

                    wishing = CY.UME.Core.Business.Wishing.Load(id);

                    wishing.MarkOld();
                    wishinglist.Add(wishing);
                }
                reader.Close();
            }
            return wishinglist;
        }
예제 #2
0
        // ��̨����ʹ��
        public IList<Core.Business.Wishing> GetAllWishes(string accountName, string Contents, string beginTime, string endTime, Core.PagingInfo pagingInfo)
        {
            IList<Core.Business.Wishing> wishinglist = new List<Core.Business.Wishing>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

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

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "Wishing,Account");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Wishing.Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, "Wishing.Id DESC");
            sql.AddParameter("@Fields", SqlDbType.NVarChar, "[Wishing].[Id],[Wishing].[Content],[Wishing].[DateCreated],[Wishing].[AccountId],[Wishing].[WallColor],[Wishing].[FontColor],[Wishing].[IsTop],[Wishing].[EndDate],[Wishing].[ReplyNum]");

            StringBuilder strFilter = new StringBuilder();
            strFilter.Append(" [Wishing].[AccountId] = [Account].[Id] ");

            // �û�ID
            if (accountName.Length >= 1)
            {
                strFilter.Append(" AND [Account].[Name] LIKE '%" + accountName + "%' ");// AND �û�Id��xxx��Χ��
            }

            if (Contents.Length >= 1)
            {
                strFilter.Append(" AND [Wishing].[Content] LIKE '%" + Contents + "%' ");
            }

            if (beginTime.Length >= 1 && endTime.Length >= 1)
            {
                strFilter.Append(" AND [Wishing].[DateCreated] BETWEEN '" + beginTime + "' AND '" + endTime + "' ");
            }

            sql.AddParameter("@Filter", SqlDbType.NVarChar, strFilter.ToString());

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Wishing wishing = new Core.Business.Wishing();
                    long id = 0;
                    if (!reader.IsDBNull(0)) id = reader.GetInt64(0);

                    wishing = CY.UME.Core.Business.Wishing.Load(id);

                    wishing.MarkOld();
                    wishinglist.Add(wishing);
                }
                reader.Close();
            }
            return wishinglist;
        }
예제 #3
0
        public IList<Core.Business.Wishing> GetSettleWishes(String StrId, int PageSize)
        {
            IList<Core.Business.Wishing> Wishinglist = new List<Core.Business.Wishing>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            String Column = "[Id],[DateCreated],[EndDate],[IsTop],[AccountId],[Content],[WallColor],[FontColor],[ReplyNum]";

            if (StrId.Length >= 1)
            {
                String SelSQL = "SELECT " + Column + " FROM [Wishing] WHERE [Id] IN (" + StrId + ")";
                SqlDataReader reader = sql.ExecuteSqlReader(SelSQL);

                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.Wishing wishing = new Core.Business.Wishing();

                        if (!reader.IsDBNull(0)) wishing.Id = reader.GetInt64(0);
                        if (!reader.IsDBNull(1)) wishing.DateCreated = reader.GetDateTime(1);
                        if (!reader.IsDBNull(2)) wishing.EndDate = reader.GetDateTime(2);
                        if (!reader.IsDBNull(3)) wishing.IsTop = reader.GetBoolean(3);
                        if (!reader.IsDBNull(4)) wishing.AccountId = reader.GetInt64(4);
                        if (!reader.IsDBNull(5)) wishing.Content = reader.GetString(5);
                        if (!reader.IsDBNull(6)) wishing.WallColor = reader.GetString(6);
                        if (!reader.IsDBNull(7)) wishing.FontColor = reader.GetString(7);
                        if (!reader.IsDBNull(8)) wishing.ReplyNum = reader.GetInt32(8);

                        wishing.MarkOld();
                        Wishinglist.Add(wishing);
                    }
                    reader.Close();
                }
            }
            // ������������ﲻ��Ԥ��ֵ
            if (Wishinglist != null && Wishinglist.Count < PageSize)
            {
                PageSize = PageSize - Wishinglist.Count;

                SqlDataReader reader = sql.ExecuteSqlReader("SELECT TOP (" + PageSize + ") " + Column + " FROM [Wishing] WHERE [Id] NOT IN ('" + StrId + "') ORDER BY [DateCreated] DESC");
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.Wishing wishing = new Core.Business.Wishing();

                        if (!reader.IsDBNull(0)) wishing.Id = reader.GetInt64(0);
                        if (!reader.IsDBNull(1)) wishing.DateCreated = reader.GetDateTime(1);
                        if (!reader.IsDBNull(2)) wishing.EndDate = reader.GetDateTime(2);
                        if (!reader.IsDBNull(3)) wishing.IsTop = reader.GetBoolean(3);
                        if (!reader.IsDBNull(4)) wishing.AccountId = reader.GetInt64(4);
                        if (!reader.IsDBNull(5)) wishing.Content = reader.GetString(5);
                        if (!reader.IsDBNull(6)) wishing.WallColor = reader.GetString(6);
                        if (!reader.IsDBNull(7)) wishing.FontColor = reader.GetString(7);
                        if (!reader.IsDBNull(8)) wishing.ReplyNum = reader.GetInt32(8);

                        wishing.MarkOld();
                        Wishinglist.Add(wishing);
                    }
                    reader.Close();
                }
            }
            return Wishinglist;
        }