コード例 #1
0
        /// <summary>
        /// UpdateMember method
        /// - Update Member table row by member information
        /// </summary>
        /// <param name="member">Member information</param>
        /// <returns></returns>
        public bool UpdateMember(Member member)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = MsSqlDataHelperFactory.Execute(connection,
                                                             CommandType.Text,
                                                             @"UPDATE Product.dbo.Member " +
                                                             @"SET MemberName = @MemberName, IsAvailable = @IsAvailable, Email = @Email, " +
                                                             @"  PhoneNumber = @PhoneNumber, Address = @Address " +
                                                             @"WHERE MemberID = @MemberID ",
                                                             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),
                                                             MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberID", member.MemberID, ParameterDirection.Input)
                                                             );

                    return((ret == 1) ? true : false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        /// <summary>
        /// UpdateMember method
        /// - Update Member table row by member information
        /// </summary>
        /// <param name="member">Member information</param>
        /// <returns></returns>
        public bool UpdateMember(Member member)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = MsSqlDataHelperFactory.Execute(connection,
                                                             CommandType.StoredProcedure,
                                                             "Product.dbo.sp_Memberships_Update_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),
                                                             MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberID", member.MemberID, ParameterDirection.Input)
                                                             );

                    return((ret == 1) ? true : false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        /// <summary>
        /// DeleteMember() method
        /// - Delete Member table row by memberID
        /// </summary>
        /// <param name="memberID">Member ID</param>
        /// <returns></returns>
        public bool DeleteMember(int memberID)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = MsSqlDataHelperFactory.Execute(connection,
                                                             CommandType.StoredProcedure,
                                                             "Product.dbo.sp_Memberships_Delete_Member_By_MemberID",
                                                             MsSqlParameterHelperFactory.CreateParameter <SqlDbType>(providerName, "@MemberID", memberID, SqlDbType.Int, ParameterDirection.Input)
                                                             );

                    return((ret == 1) ? true : false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        /// <summary>
        /// SelectNumsOfMembers method
        /// - Select number of Member table rows by memberName
        /// </summary>
        /// <param name="memberName"></param>
        /// <returns></returns>
        public int SelectNumsOfMembers(string memberName)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = (int)MsSqlDataHelperFactory.SelectScalar(connection,
                                                                       CommandType.StoredProcedure,
                                                                       "Product.dbo.sp_Memberships_Select_Num_Of_Members_By_MemberName",
                                                                       MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberName, ParameterDirection.Input)
                                                                       );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        /// <summary>
        /// DeleteMember() method
        /// - Delete Member table row by memberID
        /// </summary>
        /// <param name="memberID">Member ID</param>
        /// <returns></returns>
        public bool DeleteMember(int memberID)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = MsSqlDataHelperFactory.Execute(connection,
                                                             CommandType.Text,
                                                             @"DELETE FROM Product.dbo.Member " +
                                                             @"WHERE MemberID = @MemberID ",
                                                             MsSqlParameterHelperFactory.CreateParameter <SqlDbType>(providerName, "@MemberID", memberID, SqlDbType.Int, ParameterDirection.Input)
                                                             );

                    return((ret == 1) ? true : false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        /// <summary>
        /// SelectNumsOfMembers method
        /// - Select number of Member table rows by memberName
        /// </summary>
        /// <param name="memberName"></param>
        /// <returns></returns>
        public int SelectNumsOfMembers(string memberName)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    int ret = (int)MsSqlDataHelperFactory.SelectScalar(connection,
                                                                       CommandType.Text,
                                                                       @"SELECT COUNT(*) " +
                                                                       @"FROM Product.dbo.Member " +
                                                                       @"WHERE MemberName like '%' + @MemberName + '%' ",
                                                                       MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberName, ParameterDirection.Input)
                                                                       );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        /// <summary>
        /// SelectMemberHistories() method
        /// - Select MemberHistory table row by fromDate and toDate
        /// </summary>
        /// <param name="fromDate">From date</param>
        /// <param name="toDate">To date</param>
        /// <returns></returns>
        public List <MemberHistory> GetMemberHistories(DateTime fromDate, DateTime toDate)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    return((List <MemberHistory>)MsSqlDataHelperFactory.SelectMultipleEntities <MemberHistory>(connection,
                                                                                                               typeof(MemberHistory),
                                                                                                               CommandType.StoredProcedure,
                                                                                                               "Product.dbo.sp_Memberships_Select_MemberHistory_By_FromToDate",
                                                                                                               MsSqlParameterHelperFactory.CreateParameter(providerName, "@FromDate", fromDate, ParameterDirection.Input),
                                                                                                               MsSqlParameterHelperFactory.CreateParameter(providerName, "@ToDate", toDate, ParameterDirection.Input)
                                                                                                               ));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        /// <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;
            }
        }
コード例 #9
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.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;
            }
        }
コード例 #10
0
        /// <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;
            }
        }
コード例 #11
0
        /// <summary>
        /// SelectMembers method
        /// - Select Member table rows by memberName
        /// </summary>
        /// <param name="memberName">Member name</param>
        /// <returns></returns>
        public List <Member> SelectMembers(string memberName)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    List <Member> ret = (List <Member>)MsSqlDataHelperFactory.SelectMultipleEntities <Member>(connection,
                                                                                                              typeof(Member),
                                                                                                              CommandType.StoredProcedure,
                                                                                                              "Product.dbo.sp_Memberships_Select_Members_By_MemberName",
                                                                                                              MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberName, ParameterDirection.Input)
                                                                                                              );

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #12
0
        /// <summary>
        /// SelectMemberHistories() method
        /// - Select MemberHistory table row by fromDate and toDate
        /// </summary>
        /// <param name="fromDate">From date</param>
        /// <param name="toDate">To date</param>
        /// <returns></returns>
        public List <MemberHistory> SelectMemberHistories(DateTime fromDate, DateTime toDate)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    return((List <MemberHistory>)MsSqlDataHelperFactory.SelectMultipleEntities <MemberHistory>(connection,
                                                                                                               typeof(MemberHistory),
                                                                                                               CommandType.Text,
                                                                                                               @"SELECT Sequence, MemberID, MemberName, Successful, Message, InsertedDate " +
                                                                                                               @"FROM Product.dbo.MemberHistory " +
                                                                                                               @"WHERE InsertedDate >= @FromDate AND InsertedDate <= @ToDate " +
                                                                                                               @"ORDER BY InsertedDate DESC ",
                                                                                                               MsSqlParameterHelperFactory.CreateParameter(providerName, "@FromDate", fromDate, ParameterDirection.Input),
                                                                                                               MsSqlParameterHelperFactory.CreateParameter(providerName, "@ToDate", toDate, ParameterDirection.Input)
                                                                                                               ));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #13
0
        /// <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;
            }
        }
コード例 #14
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;
            }
        }
コード例 #15
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;
            }
        }
コード例 #16
0
        /// <summary>
        /// SelectMembers method
        /// - Select Member table rows by memberName
        /// </summary>
        /// <param name="memberName">Member name</param>
        /// <returns></returns>
        public List <Member> SelectMembers(string memberName)
        {
            try
            {
                using (connection)
                {
                    connection.Open();

                    List <Member> ret = (List <Member>)MsSqlDataHelperFactory.SelectMultipleEntities <Member>(connection,
                                                                                                              typeof(Member),
                                                                                                              CommandType.Text,
                                                                                                              @"SELECT MemberID, MemberName, IsAvailable, Email, PhoneNumber, Address, InsertedDate, UpdatedDate " +
                                                                                                              @"FROM Product.dbo.Member " +
                                                                                                              @"WHERE MemberName like '%' + @MemberName + '%' ",
                                                                                                              MsSqlParameterHelperFactory.CreateParameter(providerName, "@MemberName", memberName, ParameterDirection.Input)
                                                                                                              );

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