/// <summary>
        /// Retrieves list of PermissionGroupMap objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of PermissionGroupMap objects</returns>
        private PermissionGroupMapList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //PermissionGroupMap list
            PermissionGroupMapList list = new PermissionGroupMapList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    PermissionGroupMap permissionGroupMapObject = new PermissionGroupMap();
                    FillObject(permissionGroupMapObject, reader);

                    list.Add(permissionGroupMapObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
        /// <summary>
        /// Retrieves all PermissionGroupMap objects by PageRequest
        /// </summary>
        /// <returns>A list of PermissionGroupMap objects</returns>
        public PermissionGroupMapList GetPaged(PagedRequest request)
        {
            using (SqlCommand cmd = GetSPCommand(GETPAGEDPERMISSIONGROUPMAP))
            {
                AddParameter(cmd, pInt32Out("TotalRows"));
                AddParameter(cmd, pInt32("PageIndex", request.PageIndex));
                AddParameter(cmd, pInt32("RowPerPage", request.RowPerPage));
                AddParameter(cmd, pNVarChar("WhereClause", 4000, request.WhereClause));
                AddParameter(cmd, pNVarChar("SortColumn", 128, request.SortColumn));
                AddParameter(cmd, pNVarChar("SortOrder", 4, request.SortOrder));

                PermissionGroupMapList _PermissionGroupMapList = GetList(cmd, ALL_AVAILABLE_RECORDS);
                request.TotalRows = Convert.ToInt32(GetOutParameter(cmd, "TotalRows"));
                return(_PermissionGroupMapList);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieve list of PermissionGroupMap.
        /// </summary>
        /// <param name="fillChild"></param>
        /// <returns>List of PermissionGroupMap</returns>
        public PermissionGroupMapList GetAll(bool fillChild)
        {
            PermissionGroupMapList permissionGroupMapList = new PermissionGroupMapList();

            using (PermissionGroupMapDataAccess data = new PermissionGroupMapDataAccess(ClientContext))
            {
                permissionGroupMapList = data.GetAll();
            }
            if (fillChild)
            {
                foreach (PermissionGroupMap permissionGroupMapObject in permissionGroupMapList)
                {
                    FillPermissionGroupMapWithChilds(permissionGroupMapObject, fillChild);
                }
            }
            return(permissionGroupMapList);
        }