/// <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;
            }
        }
Ejemplo n.º 2
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;
            }
        }
        /// <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;
            }
        }
        /// <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;
            }
        }