Ejemplo n.º 1
0
 //new shipment
 public Shipment(Customer customer, double length, double width, double height, double weight, ShipmentType shipmentType,
                 InsuranceType insuranceType, double itemValue, double cost, string firstName, string lastName, 
                 Address deliveryAddress, CreditCard creditCard, bool approved, UtilityClass.ShippingSpeed shippingSpeed)
 {
     this.customer = customer;
     this.length = length;
     this.width = width;
     this.height = height;
     this.weight = weight;
     this.shipmentType = shipmentType;
     this.insuranceType = insuranceType;
     this.itemValue = itemValue;
     this.cost = cost;
     this.firstName = firstName;
     this.lastName = lastName;
     this.deliveryAddress = deliveryAddress;
     this.creditCard = creditCard;
     this.approved = approved;
     this.shippingSpeed = shippingSpeed;
 }
        /*
         * Pre:  Credit card information must be complete and valid
         * Post: A credit card object is made out of the input information
         */
        private CreditCard GetCreditCard()
        {
            string cardNum = Regex.Replace(CardNumber.Text, "[^0-9]", "");
            int securityCode = Convert.ToInt32(SecurityCode.Text);
            int expirationMonth = Convert.ToInt32(Month.SelectedValue);
            int expirationYear = Convert.ToInt32(Year.SelectedValue);

            //billing address
            int zip = Convert.ToInt32(ZipPay.Text);
            Address address = new Address(StreetPay.Text, CityPay.Text, StatePay.SelectedValue, zip);

            CreditCard card = new CreditCard(NameOnCard.Text, CardType.SelectedValue, cardNum, securityCode,
                                             expirationMonth, expirationYear, address);

            return card;
        }