internal static async Task <Profile> GetByUniqueIDChildAsync(System.Int32 uniqueID)
        {
            var criteria = new ProfileCriteria {
                UniqueID = uniqueID
            };


            return(await DataPortal.FetchAsync <Profile>(criteria));
        }
        /// <summary>
        /// Returns a <see cref="Profile"/> object of the specified criteria.
        /// </summary>
        /// <param name="username">No additional detail available.</param>
        /// <param name="applicationName">No additional detail available.</param>
        /// <returns>A <see cref="Profile"/> object of the specified criteria.</returns>
        internal static Profile GetByUsernameApplicationNameChild(System.String username, System.String applicationName)
        {
            var criteria = new ProfileCriteria {
                Username = username, ApplicationName = applicationName
            };


            return(DataPortal.FetchChild <Profile>(criteria));
        }
示例#3
0
        public static async Task <ProfileList> GetByUsernameApplicationNameAsync(System.String username, System.String applicationName)
        {
            var criteria = new ProfileCriteria {
                Username = username, ApplicationName = applicationName
            };


            return(await DataPortal.FetchAsync <ProfileList>(criteria));
        }
        public static async Task DeleteProfileAsync(System.Int32 uniqueID)
        {
            var criteria = new ProfileCriteria {
                UniqueID = uniqueID
            };


            await DataPortal.DeleteAsync <Profile>(criteria);
        }
        /// <summary>
        /// Returns a <see cref="Profile"/> object of the specified criteria.
        /// </summary>
        /// <param name="uniqueID">No additional detail available.</param>
        /// <returns>A <see cref="Profile"/> object of the specified criteria.</returns>
        internal static Profile GetByUniqueIDChild(System.Int32 uniqueID)
        {
            var criteria = new ProfileCriteria {
                UniqueID = uniqueID
            };


            return(DataPortal.FetchChild <Profile>(criteria));
        }
示例#6
0
        /// <summary>
        /// Returns a <see cref="ProfileList"/> object of the specified criteria.
        /// </summary>
        /// <param name="uniqueID">No additional detail available.</param>
        /// <returns>A <see cref="ProfileList"/> object of the specified criteria.</returns>
        public static ProfileList GetByUniqueID(System.Int32 uniqueID)
        {
            var criteria = new ProfileCriteria {
                UniqueID = uniqueID
            };


            return(DataPortal.Fetch <ProfileList>(criteria));
        }
示例#7
0
        public static async Task <ProfileList> GetByUniqueIDAsync(System.Int32 uniqueID)
        {
            var criteria = new ProfileCriteria {
                UniqueID = uniqueID
            };


            return(await DataPortal.FetchAsync <ProfileList>(criteria));
        }
示例#8
0
        /// <summary>
        /// Returns a <see cref="ProfileList"/> object of the specified criteria.
        /// </summary>
        /// <param name="username">No additional detail available.</param>
        /// <param name="applicationName">No additional detail available.</param>
        /// <returns>A <see cref="ProfileList"/> object of the specified criteria.</returns>
        public static ProfileList GetByUsernameApplicationName(System.String username, System.String applicationName)
        {
            var criteria = new ProfileCriteria {
                Username = username, ApplicationName = applicationName
            };


            return(DataPortal.Fetch <ProfileList>(criteria));
        }
示例#9
0
        public static void GetProfileList(System.String username, EventHandler <DataPortalResult <ProfileList> > handler)
        {
            var criteria = new ProfileCriteria {
                Username = username
            };

            var dp = new DataPortal <ProfileList>();

            dp.FetchCompleted += handler;
            dp.BeginFetch(criteria);
        }
        private void DataPortal_Fetch(ProfileCriteria criteria)
        {
            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return;
            }

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [UniqueID], [Username], [ApplicationName], [IsAnonymous], [LastActivityDate], [LastUpdatedDate] FROM [dbo].[Profiles] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Business.Profile.GetProfile(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
示例#11
0
        private void Child_Fetch(ProfileCriteria criteria)
        {
            bool cancel = false;

            OnChildFetching(criteria, ref cancel);
            if (cancel)
            {
                return;
            }

            string commandText = String.Format("SELECT [UniqueID], [Username], [ApplicationName], [IsAnonymous], [LastActivityDate], [LastUpdatedDate] FROM [dbo].[Profiles] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            Map(reader);
                        }
                        else
                        {
                            throw new Exception(String.Format("The record was not found in 'dbo.Profiles' using the following criteria: {0}.", criteria));
                        }
                    }
                }
            }

            OnChildFetched();


            MarkAsChild();
        }
示例#12
0
 /// <summary>
 /// Determines if a record exists in the Profile in the database for the specified criteria.
 /// </summary>
 public static async Task <bool> ExistsAsync(ProfileCriteria criteria)
 {
     return(await PetShop.Business.ExistsCommand.ExecuteAsync(criteria));
 }
示例#13
0
 /// <summary>
 /// Determines if a record exists in the Profile in the database for the specified criteria.
 /// </summary>
 /// <param name="criteria">The criteria parameter is a <see cref="ProfileList"/> object.</param>
 /// <returns>A boolean value of true is returned if a record is found.</returns>
 public static bool Exists(ProfileCriteria criteria)
 {
     return(PetShop.Business.Profile.Exists(criteria));
 }
示例#14
0
 /// <summary>
 /// CodeSmith generated stub method that is called when fetching the child <see cref="Profile"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="ProfileCriteria"/> object containing the criteria of the object to fetch.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object fetching should proceed.</param>
 partial void OnFetching(ProfileCriteria criteria, ref bool cancel);
示例#15
0
 public static async Task <ProfileList> GetByCriteriaAsync(ProfileCriteria criteria)
 {
     return(await DataPortal.FetchAsync <ProfileList>(criteria));
 }
示例#16
0
 public static ProfileList GetByCriteria(ProfileCriteria criteria)
 {
     return(DataPortal.Fetch <ProfileList>(criteria));
 }
 /// <summary>
 /// Determines if a record exists in the Profiles table in the database for the specified criteria.
 /// </summary>
 /// <param name="criteria">The criteria parameter is an <see cref="Profile"/> object.</param>
 /// <returns>A boolean value of true is returned if a record is found.</returns>
 public static bool Exists(ProfileCriteria criteria)
 {
     return(PetShop.Business.ExistsCommand.Execute(criteria));
 }
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the <see cref="Profile"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="ProfileCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 partial void OnDeleting(ProfileCriteria criteria, ref bool cancel);