Exemplo n.º 1
0
        //------------------------------------------
        #endregion

        #region --------------GetAll--------------
        public List <AdvPlacesEntity> GetAll(AdvPlaceTypes PlaceType, int pageIndex, int pageSize, out int totalRecords)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                List <AdvPlacesEntity> advPlacesList = new List <AdvPlacesEntity>();
                AdvPlacesEntity        advPlaces;
                SqlCommand             myCommand = new SqlCommand("AdvPlaces_GetAll", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@PlaceType", SqlDbType.Int, 4).Value        = (int)PlaceType;
                myCommand.Parameters.Add("@pageIndex", SqlDbType.Int, 4).Value        = pageIndex;
                myCommand.Parameters.Add("@pageSize", SqlDbType.Int, 4).Value         = pageSize;
                myCommand.Parameters.Add("@TotalRecords", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                // Execute the command
                SqlDataReader dr;
                myConnection.Open();
                dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    (advPlaces) = PopulateEntity(dr);
                    advPlacesList.Add(advPlaces);
                }
                dr.Close();
                myConnection.Close();
                //Gets result rows count
                totalRecords = (int)myCommand.Parameters["@TotalRecords"].Value;
                return(advPlacesList);
            }
        }
Exemplo n.º 2
0
 public static List <AdvPlacesEntity> GetAll(AdvPlaceTypes PlaceType, int pageIndex, int pageSize, out int totalRecords)
 {
     return(AdvPlacesSqlDataPrvider.Instance.GetAll(PlaceType, pageIndex, pageSize, out totalRecords));
 }
Exemplo n.º 3
0
        //------------------------------------------
        #endregion

        #region --------------GetAll--------------
        public static List <AdvPlacesEntity> GetAll(AdvPlaceTypes PlaceType)
        {
            int totalRecords = 0;

            return(AdvPlacesSqlDataPrvider.Instance.GetAll(PlaceType, -1, -1, out totalRecords));
        }