Ejemplo n.º 1
0
        // ��̨����
        public IList<CY.UME.Core.Business.AccountGroup> GetGroupAccountByAccountGroup(CY.UME.Core.Business.AccountGroup accountGroup, CY.UME.Core.PagingInfo pagingInfo)
        {
            IList<Core.Business.AccountGroup> accountGroupList = new List<Core.Business.AccountGroup>();

            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            #region ����
            string tables = "AccountGroup";
            string pK = "Id";
            string sort = "Id Desc";
            int pageNum = pagingInfo.CurrentPage;
            int pageSize = pagingInfo.PageSize;
            string fields = "[Id], [AccountId],[GroupId],[DateCreated],[Role],[LastVisitDate],[Name]";
            string group = String.Empty;
            string filter = strFilter(accountGroup);

            #endregion

            sql.AddParameter("@Tables", SqlDbType.VarChar, tables);
            sql.AddParameter("@PK", SqlDbType.VarChar, pK);
            sql.AddParameter("@Sort", SqlDbType.VarChar, sort);
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);
            sql.AddParameter("@Fields", SqlDbType.VarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            sql.AddParameter("@Group", SqlDbType.VarChar, group);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.AccountGroup ag = new AccountGroup();

                    if (!reader.IsDBNull(0)) ag.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) ag.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) ag.GroupId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) ag.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) ag.Role = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) ag.LastVisitDate = reader.GetDateTime(5);
                    if (!reader.IsDBNull(6)) ag.Name = reader.GetString(6);

                    accountGroup.MarkOld();
                    accountGroupList.Add(ag);
                }
                reader.Close();
            }

            return accountGroupList;
        }