Example #1
0
        public IList<CY.UME.Core.Business.Album> GetAlbumByPagesAndAccountId(CY.UME.Core.Business.Account account, PagingInfo pageInfo, int viewPermission)
        {
            IList<Core.Business.Album> albumlist = new List<Core.Business.Album>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            StringBuilder sbFilter = new StringBuilder();
            sbFilter.Append(" [AccountId] = ");
            sbFilter.Append(account.Id);

            string permission = String.Empty;
            if (viewPermission == 0)//�Լ�����
            {
                ;
            }
            else if (viewPermission == 1)//���ѷ���
            {
                permission = "(0,1,2)";
            }
            else if (viewPermission == 2)//İ���˷���
            {
                permission = "(0,2)";
            }
            else
            {
                return albumlist;
            }

            if (permission.Length != 0)
            {
                sbFilter.Append(" And ViewPermission in " + permission);
            }

            sql.AddParameter("@Tables", SqlDbType.VarChar, "Album");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@Filter", SqlDbType.VarChar, sbFilter.ToString());
            sql.AddParameter("@Fields", SqlDbType.VarChar, "[Id],[AccountId],[ViewPermission],[DateCreated],[LastModifiedTime],[IsAvatar],[Name],[CoverPath],[ViewPassword]");
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageInfo.PageSize);
            sql.AddParameter("@sort", SqlDbType.NVarChar, "Id DESC");
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Album album = new Core.Business.Album();

                    long id = reader.GetInt64(0);
                    album = Core.Business.Album.Load(id);

                    album.MarkOld();
                    albumlist.Add(album);
                }
                reader.Close();
            }
            return albumlist;
        }
Example #2
0
        public List<Core.Business.Album> GetAll(Core.Business.Account account, bool? isAvatar)
        {
            List<Core.Business.Album> albumlist = new List<Core.Business.Album>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            StringBuilder sbFilter = new StringBuilder();
            sbFilter.Append(" [AccountId] = ");
            sbFilter.Append(account.Id);

            if (isAvatar.HasValue)
            {
                sbFilter.Append(" And [IsAvatar] = ");
                sbFilter.Append(isAvatar.Value ? "1" : "0");
            }

            sql.AddParameter("@Tables", SqlDbType.VarChar, "Album");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@Filter", SqlDbType.VarChar, sbFilter.ToString());
            sql.AddParameter("@Fields", SqlDbType.VarChar, "[Id],[AccountId],[ViewPermission],[DateCreated],[LastModifiedTime],[IsAvatar],[Name],[CoverPath],[ViewPassword]");
            sql.AddParameter("@PageNumber", SqlDbType.Int, 1);
            sql.AddParameter("@PageSize", SqlDbType.Int, int.MaxValue);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Album album = new Core.Business.Album();

                    long id = reader.GetInt64(0);
                    album = Core.Business.Album.Load(id);

                    /*
                    if (!reader.IsDBNull(0)) album.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) album.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) album.ViewPermission = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) album.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) album.LastModifiedTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) album.IsAvatar = reader.GetBoolean(5);
                    if (!reader.IsDBNull(6)) album.Name = reader.GetString(6);
                    if (!reader.IsDBNull(7)) album.CoverPath = reader.GetString(7);
                    if (!reader.IsDBNull(8)) album.ViewPassword = reader.GetString(8);
                    */

                    album.MarkOld();
                    albumlist.Add(album);
                }
                reader.Close();
            }
            return albumlist;
        }
Example #3
0
        public IList<Core.Business.Album> GetAllAlbum()
        {
            IList<Core.Business.Album> albumlist = new List<Core.Business.Album>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Album album = new Core.Business.Album();

                    long id = reader.GetInt64(0);
                    album = Core.Business.Album.Load(id);

                    /*
                    if (!reader.IsDBNull(0)) album.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) album.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) album.ViewPermission = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) album.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) album.LastModifiedTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) album.IsAvatar = reader.GetBoolean(5);
                    if (!reader.IsDBNull(6)) album.Name = reader.GetString(6);
                    if (!reader.IsDBNull(7)) album.CoverPath = reader.GetString(7);
                    if (!reader.IsDBNull(8)) album.ViewPassword = reader.GetString(8);
                    */

                    album.MarkOld();
                    albumlist.Add(album);
                }
                reader.Close();
            }
            return albumlist;
        }
Example #4
0
        public IList<CY.UME.Core.Business.Album> GetGroupAlbum(CY.UME.Core.Business.Group group, int viewpermission, CY.UME.Core.PagingInfo pagingInfo)
        {
            List<Core.Business.Album> albumlist = new List<Core.Business.Album>();

            if (group == null)
            {
                return albumlist;
            }

            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            string filter = "id in (select id from albumExtend where [type]='group' and instanceid =" + group.Id + ")";

            if (viewpermission == 1)
            {
                filter += " and viewpermission=" + viewpermission;
            }

            sql.AddParameter("@Tables", SqlDbType.VarChar, "Album");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id DESC");
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            sql.AddParameter("@Fields", SqlDbType.VarChar, "[Id],[AccountId],[ViewPermission],[DateCreated],[LastModifiedTime],[IsAvatar],[Name],[CoverPath],[ViewPassword]");
            sql.AddParameter("@PageNumber", SqlDbType.Int, pagingInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagingInfo.PageSize);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Album album = new Core.Business.Album();

                    long id = reader.GetInt64(0);

                    if (!reader.IsDBNull(0)) album.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) album.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) album.ViewPermission = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) album.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) album.LastModifiedTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) album.IsAvatar = reader.GetBoolean(5);
                    if (!reader.IsDBNull(6)) album.Name = reader.GetString(6);
                    if (!reader.IsDBNull(7)) album.CoverPath = reader.GetString(7);
                    if (!reader.IsDBNull(8)) album.ViewPassword = reader.GetString(8);

                    album.MarkOld();
                    albumlist.Add(album);
                }
                reader.Close();
            }
            return albumlist;
        }