Ejemplo n.º 1
0
        /// <summary>
        /// I tried to build it in a way that much could be
        /// reused for the order by piece.  We didn't have
        /// the name uniform prints yet.  All of that can and
        /// should be refactored.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void placeOrderStandard_Click(object sender, EventArgs e)
        {
            //Get elements from form
            PhotoLineItem lineItem = new PhotoLineItem((PhotoTypeChoices)photoTypeStandard.SelectedIndex, (int)qtyStandard.Value,
                                                       (FinishTypeChoices)finishStandard.SelectedIndex);
            DeliveryTypeChoices deliveryChoice = (DeliveryTypeChoices)deliveryTypeStandard.SelectedIndex;

            //Get Line Rate, discounts and fees
            LineRatesStandard rate = new LineRatesStandard(lineItem);

            lineItem.LineRate = rate.getLineRate();

            PromoDiscount promoDiscount = new PromoDiscount();

            promoDiscount.CalculateDiscount(lineItem, promoCodeTxt.Text);

            DeliveryRateFee deliveryFee = new DeliveryRateFee();

            deliveryFee.setFee(new List <PhotoLineItem> {
                lineItem
            }, deliveryChoice, OrderType.standard);

            //build the order
            Order order = new Order(lineItem, promoDiscount, deliveryFee);

            MessageBox.Show(Receipt.buildReceipt(order));



            //Calculate Total


//            MessageBox.Show("BaseRate: " + rate.getBaseRate() + "\nDeliveryUpcharge: " + rate.getDeliveryRateUpcharge() +
//                "\nFinishUpcarge: " + rate.getFinishTypeUpcharge());
        }
Ejemplo n.º 2
0
 public void CalculateDiscount(PhotoLineItem lineItem, string promoCode)
 {
     if (lineItem.Quantity == 100 && promoCode.ToUpper().Equals("N56M2"))
     {
         amount = 2M;
     }
 }
Ejemplo n.º 3
0
 public void addLine(PhotoLineItem item)
 {
     if (item.LineRate <= 0)
     {
         throw new System.ArgumentException("Parameter not entered", "lineRate");
     }
     lines.Add(item);
 }
Ejemplo n.º 4
0
 //tried using :base() but it still gave an error so i took the lazy (bad) way out and copied the constructor.
 public Order(PhotoLineItem line, Discount discount, Fee fee)
 {
     lines     = new List <PhotoLineItem>();
     discounts = new List <Discount>();
     fees      = new List <Fee>();
     lines.Add(line);
     discounts.Add(discount);
     fees.Add(fee);
 }
Ejemplo n.º 5
0
 public LineRatesStandard(PhotoLineItem lineItem)
 {
     this.lineItem = lineItem;
 }