Ejemplo n.º 1
0
        public Member CreateMember(int libraryId, string firstName, string lastName, string email, string phone)
        {
            if (firstName == null)
            {
                throw new ArgumentNullException(nameof(firstName));
            }

            if (lastName == null)
            {
                throw new ArgumentNullException(nameof(lastName));
            }

            if (email == null)
            {
                throw new ArgumentNullException(nameof(email));
            }

            if (phone == null)
            {
                throw new ArgumentNullException(nameof(phone));
            }

            var d = new CreateMemberDataDelegate(libraryId, firstName, lastName, email, phone);

            return(executor.ExecuteNonQuery(d)); //prodecure has OUTPUT parameters
        }
Ejemplo n.º 2
0
        public Member CreateMember(string email, string firstName, string lastName, string phone, string billingAddress, int points, DateTimeOffset joinedOn, DateTimeOffset birthDate, string status)
        {
            if (string.IsNullOrWhiteSpace(email))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(email));
            }

            if (string.IsNullOrWhiteSpace(firstName))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(firstName));
            }

            if (string.IsNullOrWhiteSpace(lastName))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(lastName));
            }

            if (string.IsNullOrWhiteSpace(phone))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(phone));
            }

            if (string.IsNullOrEmpty(billingAddress))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(billingAddress));
            }

            if (points < 0)
            {
                throw new ArgumentException("The parameter cannot be negative or empty.", nameof(points));
            }

            if (string.IsNullOrWhiteSpace(status))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(status));
            }

            var d = new CreateMemberDataDelegate(email, firstName, lastName, phone, billingAddress, points, joinedOn, birthDate, status);

            return(executor.ExecuteNonQuery(d));
        }