/// <summary>
        /// InsertMember method
        /// - InsertMember Member table row from member information
        /// </summary>
        /// <param name="member">Member information</param>
        /// <returns></returns>
        public Member InsertMember(Member member)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    Member ret = (Member)MsSqlDataHelperFactory.SelectSingleEntity <Member>(connection,
                                                                                            typeof(Member),
                                                                                            CommandType.StoredProcedure,
                                                                                            "Product.dbo.sp_Memberships_Insert_Member",
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", member.MemberName, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@IsAvailable", member.IsAvailable, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@Email", member.Email, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@PhoneNumber", member.PhoneNumber, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@Address", member.Address, ParameterDirection.Input)
                                                                                            );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// InsertMemberHistory method
        /// - Insert MemberHistory table row from member history information
        /// </summary>
        /// <param name="member">Member history information</param>
        /// <returns></returns>
        public MemberHistory InsertMemberHistory(MemberHistory memberHistory)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    return((MemberHistory)MsSqlDataHelperFactory.SelectSingleEntity <MemberHistory>(connection,
                                                                                                    typeof(MemberHistory),
                                                                                                    CommandType.Text,
                                                                                                    @"INSERT INTO Product.dbo.MemberHistory " +
                                                                                                    @"( MemberID, MemberName, Successful, Message, InsertedDate ) " +
                                                                                                    @"VALUES " +
                                                                                                    @"( @MemberID, @MemberName, @Successful, @Message, GETDATE() ) " +
                                                                                                    @" " +
                                                                                                    @"SELECT Sequence, MemberID, MemberName, Successful, Message, InsertedDate " +
                                                                                                    @"FROM Product.dbo.MemberHistory " +
                                                                                                    @"WHERE MemberID = @MemberID AND MemberName = @MemberName " +
                                                                                                    @"  AND Successful = @Successful AND Message = @Message " +
                                                                                                    @"ORDER BY InsertedDate DESC ",
                                                                                                    MsSqlParameterHelperFactory.CreateParameter <SqlDbType>(providerName, "@MemberID", memberHistory.MemberID, SqlDbType.Int, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberHistory.MemberName, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@Successful", memberHistory.IsSuccess, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@Message", memberHistory.Message, ParameterDirection.Input)
                                                                                                    ));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        /// <summary>
        /// SelectMember method
        /// - Select Member table row by memberID
        /// </summary>
        /// <param name="memberID">Member ID</param>
        /// <returns></returns>
        public Member SelectMember(int memberID)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    Member ret = (Member)MsSqlDataHelperFactory.SelectSingleEntity <Member>(connection,
                                                                                            typeof(Member),
                                                                                            CommandType.Text,
                                                                                            @"SELECT MemberID, MemberName, IsAvailable, Email, PhoneNumber, Address, InsertedDate, UpdatedDate " +
                                                                                            @"FROM Product.dbo.Member " +
                                                                                            @"WHERE MemberID = @MemberID ",
                                                                                            MsSqlParameterHelperFactory.CreateParameter <SqlDbType>(providerName, "@MemberID", memberID, SqlDbType.Int, ParameterDirection.Input)
                                                                                            );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// SelectMember method
        /// - Select Member table row by memberID
        /// </summary>
        /// <param name="memberID">Member ID</param>
        /// <returns></returns>
        public Member SelectMember(int memberID)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    Member ret = (Member)MsSqlDataHelperFactory.SelectSingleEntity <Member>(connection,
                                                                                            typeof(Member),
                                                                                            CommandType.StoredProcedure,
                                                                                            "Product.dbo.sp_Memberships_Select_Member_By_MemberID",
                                                                                            MsSqlParameterHelperFactory.CreateParameter <SqlDbType>(providerName, "@MemberID", memberID, SqlDbType.Int, ParameterDirection.Input)
                                                                                            );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// InsertMemberHistory method
        /// - Insert MemberHistory table row from member history information
        /// </summary>
        /// <param name="member">Member history information</param>
        /// <returns></returns>
        public MemberHistory InsertMemberHistory(MemberHistory memberHistory)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    return((MemberHistory)MsSqlDataHelperFactory.SelectSingleEntity <MemberHistory>(connection,
                                                                                                    typeof(MemberHistory),
                                                                                                    CommandType.StoredProcedure,
                                                                                                    "Product.dbo.sp_Memberships_Insert_MemberHistory",
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberID", memberHistory.MemberID, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberHistory.MemberName, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@Successful", memberHistory.IsSuccess, ParameterDirection.Input),
                                                                                                    MsSqlParameterHelperFactory.CreateParameter(providerName, "@Message", memberHistory.Message, ParameterDirection.Input)
                                                                                                    ));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        /// <summary>
        /// InsertMember method
        /// - Insert Member table row from member information
        /// </summary>
        /// <param name="member">Member information</param>
        /// <returns></returns>
        public Member InsertMember(Member member)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    Member ret = (Member)MsSqlDataHelperFactory.SelectSingleEntity <Member>(connection,
                                                                                            typeof(Member),
                                                                                            CommandType.Text,
                                                                                            @"INSERT INTO Product.dbo.Member " +
                                                                                            @"( MemberName, IsAvailable, Email, PhoneNumber, Address, InsertedDate, UpdatedDate ) " +
                                                                                            @"VALUES " +
                                                                                            @"( @MemberName, @IsAvailable, @Email, @PhoneNumber, @Address, GETDATE(), NULL ) " +
                                                                                            @" " +
                                                                                            @"SELECT MemberID, MemberName, IsAvailable, Email, PhoneNumber, Address, InsertedDate, UpdatedDate " +
                                                                                            @"FROM Product.dbo.Member " +
                                                                                            @"WHERE MemberName = @MemberName AND IsAvailable = @IsAvailable AND Email = @Email " +
                                                                                            @"  AND PhoneNumber = @PhoneNumber AND Address = @Address " +
                                                                                            @"ORDER BY InsertedDate DESC ",
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", member.MemberName, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@IsAvailable", member.IsAvailable, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@Email", member.Email, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@PhoneNumber", member.PhoneNumber, ParameterDirection.Input),
                                                                                            MsSqlParameterHelperFactory.CreateParameter(providerName, "@Address", member.Address, ParameterDirection.Input)
                                                                                            );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }