Esempio n. 1
0
 /// <summary>
 /// Pull in promotion that PeiPei is looking for. 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ddPromotion_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     int promotionId = Convert.ToInt32(this.ddPromotion.SelectedValue);
     OTCPromotion promotion = new OTCPromotion(promotionId);
     this.txtPromotionDescription.Value = promotion.PromotionDesc;
     this.txtPromotionKey.Text = promotion.PromotionKey;
     this.txtPromotionName.Text = promotion.PromotionName;
     this.txtNumberOfUses.Text = promotion.UsageCount.ToString();
     this.txtDiscountRate.Text =  promotion.PromotionDiscount.ToString();
 }
Esempio n. 2
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            OTCPromotion promotion = new OTCPromotion();
            promotion.IsMultyUse = this.chkInfinate.Checked || Convert.ToInt32(this.txtNumberOfUses.Text) > 1;
            promotion.PromotionDesc = this.txtPromotionDescription.Value;
            promotion.PromotionDiscount = Convert.ToDouble("." + this.txtDiscountRate.Text);
            promotion.PromotionKey = this.txtPromotionKey.Text;
            promotion.PromotionName = this.txtPromotionName.Text;

            if(this.ddPromotion.SelectedIndex > 0)
                promotion.Save();
            else
                promotion.Add();
        }
Esempio n. 3
0
        /// <summary>
        ///  Need to fix this
        /// </summary>
        /// <returns></returns>
        private double getOrderTotal()
        {
            double promotionDiscount = 0.0;
            string promotionName     = "";

            if(Request.QueryString.ToString().IndexOf("PKY") > -1){
                OTCPromotion p = new OTCPromotion(Request.QueryString["PKY"]);
                promotionDiscount = p.PromotionDiscount;
                promotionName     = p.PromotionName;
            }
            OTCShoppingCart cart = new OTCShoppingCart(this.m_shoppingCartId);
            double transactionTotal = cart.CartTotal;// + Convert.ToDouble(this.ddShippingMethods.SelectedItem.Value));
            double discount         = transactionTotal * promotionDiscount;
            double productTotal     = discount> 0 ? (transactionTotal - discount) : transactionTotal;
            double shippingTotal    = Convert.ToDouble(this.ddShippingMethods.SelectedItem.Value);
            double tax              = productTotal * this.m_salesTax;
            double total            = (productTotal + tax) + shippingTotal;
            return(total);
        }
Esempio n. 4
0
        public void BuildCartTotals()
        {
            double promotionDiscount = 0.00;
            string promotionName     = "";

            if(Request.QueryString.ToString().IndexOf("PKY") > -1){
                OTCPromotion p = new OTCPromotion(Request.QueryString["PKY"]);
                promotionDiscount = p.PromotionDiscount;
                promotionName     = p.PromotionName;
            }

            OTCShoppingCart cart = new OTCShoppingCart(this.m_shoppingCartId);
            double transactionTotal = cart.CartTotal;// + Convert.ToDouble(this.ddShippingMethods.SelectedItem.Value));
            double discount         = transactionTotal * promotionDiscount;
            double productTotal     = discount> 0 ? (transactionTotal - discount) : transactionTotal;
            double shippingTotal    = getShippingCost(this.ddShippingMethods.SelectedItem.Value);
            double tax              = productTotal * this.m_salesTax;
            double total            = (productTotal + tax) + shippingTotal;

            Response.Write("<input type=\"hidden\" value=\"" + cart.CartTotal + "\" id=\"cartTotal\">"
                    + CR + "<table border=\"0\">"
                    + CR + " <tr>"
                    + CR + "  <td>SubTotal: </td>"
                    + CR + "  <td><b>" + cart.CartTotal.ToString("c") + "</td>"
                    + CR + " </tr>"
                    + CR + " <tr>"
                    + CR + "  <td>Shipping: </td>"
                    + CR + "  <td><b><span id=\"shippingTotal\">" + shippingTotal.ToString("c") + "</span></td>"
                    + CR + " </tr>"
                    + CR + " <tr class=\"tax\">"
                    + CR + "  <td>Tax: </td>"
                    + CR + "  <td>6.25% for MA Residents</td>"
                    + CR + " </tr>"
                    );

            if(promotionDiscount > 0)
                Response.Write(" <tr>"
                        + CR + "  <td>Promotion Discount: </td>"
                        + CR + "  <td>" + promotionDiscount.ToString("p") + "</td>"
                        + CR + " </tr>"
                        );

            this.m_orderTotal = total;

            Response.Write(" <tr>"
                    + CR + "  <td>Total: </td>"
                    + CR + "  <td><b><font color=\"red\"><span id=\"total\">" + total.ToString("c") + "</span></td>"
                    + CR + " </tr>"
                    + CR + "</table>" + CR
                    );
        }