Exemplo n.º 1
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        Commerce.Common.Product product = null;
        if (lblID.Text != string.Empty)
        {
            product = new Commerce.Common.Product(int.Parse(lblID.Text));
        }
        else
        {
            product = new Commerce.Common.Product();
        }
        product.AdminComments = txtAdminComments.Text;
        product.CurrencyCode  = ddlCurrencyCodeID.SelectedValue.Trim();
        product.DimensionUnit = txtDimensionUnit.Text;

        product.ProductName      = txtProductName.Text;
        product.ShortDescription = txtShortDescription.Text;
        product.Sku            = txtSku.Text;
        product.StockLocation  = txtStockLocation.Text;
        product.Status         = (ProductStatus)int.Parse(ddlStatusID.SelectedValue);
        product.ShippingType   = (ShippingType)int.Parse(ddlShippingTypeID.SelectedValue);
        product.ProductType    = (ProductType)int.Parse(ddlProductTypeID.SelectedValue);
        product.UnitOfMeasure  = txtUnitOfMeasure.Text;
        product.ManufacturerID = int.Parse(ddlManufacturerID.SelectedValue);
        product.ShipEstimateID = int.Parse(ddlShipEstimateID.SelectedValue);
        product.TaxTypeID      = int.Parse(ddlTaxTypeID.SelectedValue);

        int     parsedInt = 0;
        decimal parsedDec = 0;

        int.TryParse(txtListOrder.Text, out parsedInt);
        product.ListOrder = parsedInt;

        decimal.TryParse(txtOurPrice.Text, out parsedDec);
        product.OurPrice = decimal.Parse(txtOurPrice.Text);

        decimal.TryParse(txtRetailPrice.Text, out parsedDec);
        product.RetailPrice = parsedDec;

        decimal.TryParse(txtHeight.Text, out parsedDec);
        product.Height = parsedDec;

        decimal.TryParse(txtLength.Text, out parsedDec);
        product.Length = parsedDec;

        decimal.TryParse(txtWeight.Text, out parsedDec);
        product.Weight = parsedDec;


        decimal.TryParse(txtWidth.Text, out parsedDec);
        product.Width = parsedDec;


        try {
            product.Save(Utility.GetUserName());
            ResultMessage1.ShowSuccess("Update Successful");
        } catch (Exception x) {
            ThrowError(x.Message);
        }
    }
 protected void AddToCart_Click(object sender, ImageClickEventArgs e)
 {
     Commerce.Common.Product prod = new Commerce.Common.Product(ProductID);
     prod.Quantity = 1;
     OrderController.AddItem(prod);
     Response.Redirect("~/AddItemResult.aspx", false);
 }
Exemplo n.º 3
0
    protected void AddBundle(object sender, EventArgs e)
    {
        decimal discountPercent = 0;
        decimal discountAmount  = 0;
        decimal price           = 0;
        int     productID       = 0;
        int     bundleID        = 0;

        Commerce.Common.Product prod = null;
        List <BundleItem>       list = PromotionService.GetBundleByProduct(product.ProductID);

        foreach (Commerce.Promotions.BundleItem bundleItem in list)
        {
            discountPercent = Convert.ToDecimal(bundleItem.DiscountPercent);
            price           = bundleItem.OurPrice;
            discountAmount  = price * discountPercent / 100;
            productID       = bundleItem.ProductID;
            bundleID        = bundleItem.BundleID;

            prod                = new Commerce.Common.Product(productID);
            prod.ImageFile      = prod.DefaultImage;
            prod.Quantity       = 1;
            prod.DiscountAmount = discountAmount;
            prod.PromoCode      = "BUNDLE:" + bundleID.ToString();
            OrderController.AddItem(prod);
        }
        Response.Redirect("additemresult.aspx", false);
    }
Exemplo n.º 4
0
    /****************************************************************
     *
     * AddToCart()
     *
     ***************************************************************/
    protected void AddToCart(string sGUID, int nQty)
    {
        productGUID = new Guid(sGUID);
        try
        {
            product = ProductController.GetProductDeepByGUID(productGUID);
            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID        = product.ProductID;
            productSku       = product.Sku;
            product.Quantity = nQty;

            OrderController.AddCallCenterItem(product);

            /********************
             * //* the following if stmt is to track orders from TheLoveDepot.com 2/10
             * string sID = "";
             * sID = HttpContext.Current.Request.Cookies["ID"].Value;
             * if (sID != null)
             * {
             *  Order currentOrder = OrderController.GetCurrentOrder();
             *  OrderController.AddNote(sID, currentOrder);
             * }
             **************/
        }
        catch (Exception ex)
        {
            LovRubLogger.LogException(ex);
            throw ex;
        }
    }
Exemplo n.º 5
0
    protected void btnMen3_Click(object sender, EventArgs e)
    {
        string sProductGUID = "a3ba18d1-b7d0-488c-9687-706873e0ee53";

        productGUID = new Guid(sProductGUID);
        try
        {
            product = ProductController.GetProductDeepByGUID(productGUID);
            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID        = product.ProductID;
            productSku       = product.Sku;
            product.Quantity = 3;
            OrderController.AddItem(product);
            AddKeyForOrderMotion();
            //This behavior is by design
            //See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassendtopic.asp
            Response.Redirect("additemresult.aspx", false);
            //Response.Redirect("order.aspx", false); KPL
        }
        catch (Exception ex)
        {
            LovRubLogger.LogException(ex); // 04/10/08 KPL added
            throw ex;
        }
    }
Exemplo n.º 6
0
    protected void btnWomen3_Click(object sender, EventArgs e)
    {
        string sProductGUID = "f6d3b994-d5ca-491f-b55a-f22fa8974b25";

        productGUID = new Guid(sProductGUID);
        try
        {
            product = ProductController.GetProductDeepByGUID(productGUID);
            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID        = product.ProductID;
            productSku       = product.Sku;
            product.Quantity = 3;
            OrderController.AddItem(product);
            AddKeyForOrderMotion();
            //This behavior is by design
            //See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassendtopic.asp
            Response.Redirect("additemresult.aspx", false);
            //Response.Redirect("order.aspx", false); KPL
        }
        catch (Exception ex)
        {
            LovRubLogger.LogException(ex); // 04/10/08 KPL added
            throw ex;
            //ExceptionPolicy.HandleException(ex, "Application Exception");
            //Response.Redirect(Page.ResolveUrl("~/ExceptionPage.aspx"), false);
        }
    }
Exemplo n.º 7
0
    public void LoadAttributes(Commerce.Common.Product product)
    {
        //get the attributes for this product
        lblID.Text = product.ProductID.ToString();

        //get the atts, if they exist for this product
        ViewState["atts"] = product.Attributes;
        BindAttList(product.Attributes);

        LoadAttributeTemplates();
    }
Exemplo n.º 8
0
    protected void AddToCart(int productID)
    {
        Commerce.Common.Product prod = new Commerce.Common.Product(productID);
        prod.Quantity  = 1;
        prod.ImageFile = prod.DefaultImage;
        //prod.SelectedAttributes = "";
        prod.PromoCode      = "";
        prod.DiscountAmount = 0;

        OrderController.AddItem(prod);
    }
Exemplo n.º 9
0
    /****************************************************************
     *
     * AddToCart()
     *
     * *************************************************************/
    void AddToCart(string sGUID, int nQty)
    {
        //string sFemaleProductGUID = "f6d3b994-d5ca-491f-b55a-f22fa8974b25";
        productGUID = new Guid(sGUID);
        try
        {
            product = ProductController.GetProductDeepByGUID(productGUID);
            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID        = product.ProductID;
            productSku       = product.Sku;
            product.Quantity = nQty;
            OrderController.AddCallCenterItem(product);

            //**********************************************************************************
            // Add keycode for OrderMotion
            // but only add one note, so check to see if the keycode note has already been added.
            //**********************************************************************************
            bool bIsCallCtrOrder = false;
            currentOrder = OrderController.GetCurrentOrder();
            OrderNoteCollection noteCollection = currentOrder.Notes;
            int nCount = noteCollection.Count;
            for (int nIndex = 0; nCount > nIndex; nIndex++)
            {
                OrderNote note = noteCollection[nIndex];
                //if (note.Equals("CALLCENTER"))
                if (true == note.Note.Equals("CALLCENTER"))
                {
                    bIsCallCtrOrder = true;
                    break;
                }
            }
            if (false == bIsCallCtrOrder)
            {
                OrderController.AddNote("CALLCENTER", currentOrder);
            }
        }
        catch (Exception ex)
        {
            LovRubLogger.LogException(ex);
            throw ex;
        }
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //###############################################################################
        //  Page Validators - these must be implemented or they will be redirected
        //###############################################################################
        try {
            string sProductGUID = Utility.GetParameter("guid");
            productID  = Utility.GetIntParameter("id");
            productSku = Utility.GetParameter("n");

            if (sProductGUID != string.Empty)
            {
                productGUID = new Guid(sProductGUID);
                product     = ProductController.GetProductDeepByGUID(productGUID);
            }
            else if (productID != 0)
            {
                product = ProductController.GetProductDeep(productID);
            }
            else if (productSku != string.Empty)
            {
                product = ProductController.GetProductDeep(productSku);
            }

            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID  = product.ProductID;
            productSku = product.Sku;
        }
        catch (Exception ex) {
            //throw ex;
            //ExceptionPolicy.HandleException(ex, "Application Exception");
            Response.Redirect(Page.ResolveUrl("~/ExceptionPage.aspx"), false);
        }
        //##############################################################################

        //load the product ratings

        BindProductInfo();
        //TickStats(); KPL
    }
Exemplo n.º 11
0
    /****************************************************************
     *
     * AddToCart()
     *
     * *************************************************************/
    void AddToCart(string sGUID, int nQty)
    {
        productGUID = new Guid(sGUID);
        try
        {
            product = ProductController.GetProductDeepByGUID(productGUID);
            //make sure we have a product
            TestCondition.IsTrue(product.IsLoaded, "Invalid url/product id");

            //set the page variables
            productID        = product.ProductID;
            productSku       = product.Sku;
            product.Quantity = nQty;
            OrderController.AddCallCenterItem(product);
        }
        catch (Exception ex)
        {
            LovRubLogger.LogException(ex);
            throw ex;
        }
    }
Exemplo n.º 12
0
    void LoadEditData()
    {
        Commerce.Common.Product product = new Commerce.Common.Product(productID);
        ProductAttributes1.LoadAttributes(product);
        LoadDropDowns();

        //Page Title ...
        this.Title = "Product Details: " + product.ProductName;

        lblID.Text               = productID.ToString();
        txtSku.Text              = product.Sku;
        txtProductName.Text      = product.ProductName;
        lblProductName.Text      = product.ProductName;
        txtShortDescription.Text = product.ShortDescription;

        ddlManufacturerID.SelectedValue = product.ManufacturerID.ToString();
        ddlStatusID.SelectedValue       = Convert.ToInt16(product.Status).ToString();
        ddlProductTypeID.SelectedValue  = Convert.ToInt16(product.ProductType).ToString();
        ddlShippingTypeID.SelectedValue = Convert.ToInt16(product.ShippingType).ToString();
        ddlShipEstimateID.SelectedValue = product.ShipEstimateID.ToString();
        ddlTaxTypeID.SelectedValue      = product.TaxTypeID.ToString();

        txtStockLocation.Text = product.StockLocation;
        product.OurPrice      = Math.Round(product.OurPrice, 2);
        product.RetailPrice   = Math.Round(product.RetailPrice, 2);

        txtOurPrice.Text    = product.OurPrice.ToString();
        txtRetailPrice.Text = product.RetailPrice.ToString();


        txtWeight.Text = product.Weight.ToString();
        ddlCurrencyCodeID.SelectedValue = product.CurrencyCode.ToString();
        txtUnitOfMeasure.Text           = product.UnitOfMeasure;
        txtAdminComments.Text           = product.AdminComments;
        txtLength.Text        = product.Length.ToString();
        txtHeight.Text        = product.Height.ToString();
        txtWidth.Text         = product.Width.ToString();
        txtDimensionUnit.Text = product.DimensionUnit;
        txtListOrder.Text     = product.ListOrder.ToString();
    }
Exemplo n.º 13
0
        /// <summary>
        /// Sets the pricing of a product according to the discounts found, and
        /// returns the discount information (title, etc).
        /// </summary>
        /// <param name="product"></param>
        /// <returns>ProductDiscount</returns>
        public static ProductDiscount SetProductPricing(Commerce.Common.Product product)
        {
            ProductDiscount discount = GetProductDiscount(product.ProductID);

            if (discount == null)
            {
                //this is a normal pricing scheme
                //meaning that the "everyday discount" off of retail
                //is in effect
                discount             = new ProductDiscount();
                discount.Title       = ConfigurationManager.AppSettings["discountTitle"];
                discount.Description = ConfigurationManager.AppSettings["discountDescription"];
                //the price has already been set by the merchant
                //in the product's RetailPrice. So back-calculate it
                if (product.RetailPrice > 0)
                {
                    discount.Discount = product.OurPrice / product.RetailPrice * 100;
                }
                discount.DiscountedPrice = product.OurPrice;
                discount.DiscountAmount  = product.RetailPrice - product.OurPrice;
            }
            product.OurPrice     = discount.DiscountedPrice;
            product.YouSavePrice = discount.DiscountAmount;

            //calc the percent saved
            //this is calculated as the overall savings between the
            //retail price, and the final discounted price
            decimal dSavingsRate = 1;

            if (product.RetailPrice != 0)
            {
                dSavingsRate = discount.DiscountedPrice / product.RetailPrice;
            }
            decimal savingsPercent = 1 - (dSavingsRate);

            product.YouSavePercent = Math.Round(savingsPercent, 2);


            return(discount);
        }
Exemplo n.º 14
0
    protected void AddFreeItemToCart()
    {
        int nCartItems = OrderController.GetCartItemCount();

        bool bAddFreeItem = false;

        int nTotalQty          = 0;
        int nMaleFullQty       = 0;
        int nMaleDiscountQty   = 0;
        int nFemaleFullQty     = 0;
        int nFemaleDiscountQty = 0;
        int nRL6FullQty        = 0;
        int nRLG6DiscountQty   = 0;
        int nRLFreeQty         = 0;
        int nSeasonalQty       = 0;
        int nSurvivalFullQty   = 0;
        int nChocBDFullQty     = 0;
        int nCherBDFullQty     = 0;

        int nLipLovFullQty     = 0;
        int nLipLovDiscountQty = 0;
        int nFullQty           = 0;
        int nFreeItemsToAdd    = 0;


        if (true == OrderController.IsFreeItemInCart())
        {
            return;
        }

        // Calculate total, male, female, RubLov qty

        /****** commented out 11/24/09 removed discounts
         * OrderController.DetermineBasketContents(
         *                                      out nTotalQty,
         *                                      out nMaleFullQty,
         *                                      out nMaleDiscountQty,
         *                                      out nFemaleFullQty,
         *                                      out nFemaleDiscountQty,
         *                                      out nRL6FullQty,
         *                                      out nRLG6DiscountQty,
         *                                      out nRLFreeQty,
         *                                      out nSeasonalQty,
         *                                      out nLipLovFullQty,
         *                                      out nLipLovDiscountQty,
         *                                      out nSurvivalFullQty);
         ****** commented out 11/24/09 removed discounts ************/

        OrderController.DetermineBasketContents(
            out nTotalQty,
            out nMaleFullQty,
            out nFemaleFullQty,
            out nRL6FullQty,
            out nRLFreeQty,
            out nLipLovFullQty,
            out nSurvivalFullQty,
            out nChocBDFullQty,
            out nCherBDFullQty);
        // should be 1 freebie per order.
        if ((nTotalQty > 0) && (0 == nRLFreeQty))
        {
            nFreeItemsToAdd = 1;
        }

        if (nFreeItemsToAdd > 0)
        {
            try
            {
                string sFreeMassageGelGUID      = "f7ada596-0385-4314-8b13-bd949d3856f0";
                Guid   productGUID              = new Guid(sFreeMassageGelGUID);
                Commerce.Common.Product product = ProductController.GetProductDeepByGUID(productGUID);
                product.Quantity = nFreeItemsToAdd;
                OrderController.AddCallCenterItem(product);
            }
            catch (Exception ex)
            {
                LovRubLogger.LogException(ex);
                throw ex;
            }
        }
    }
Exemplo n.º 15
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //Thanks Herman (osi_ni) for portions of this code
        if (Page.IsValid)
        {
            try {
                int manufacturerId = 0;
                int.TryParse(ddlManufacturerID.SelectedValue, out manufacturerId);
                int statusId = 0;
                int.TryParse(ddlStatusID.SelectedValue, out statusId);
                int productTypeId = 0;
                int.TryParse(ddlProductTypeID.SelectedValue, out productTypeId);
                int shippingTypeId = 0;
                int.TryParse(ddlShippingTypeID.SelectedValue, out shippingTypeId);
                int shipEstimateId = 0;
                int.TryParse(ddlShipEstimateID.SelectedValue, out shipEstimateId);
                int taxTypeId = 0;
                int.TryParse(ddlTaxTypeID.SelectedValue, out taxTypeId);
                decimal ourPrice = 0;
                decimal.TryParse(txtOurPrice.Text.Trim(), out ourPrice);
                decimal retailPrice = 0;
                decimal.TryParse(txtRetailPrice.Text.Trim(), out retailPrice);
                decimal weight = 0;
                decimal.TryParse(txtWeight.Text.Trim(), out weight);
                decimal length = 0;
                decimal.TryParse(txtLength.Text.Trim(), out length);
                decimal height = 0;
                decimal.TryParse(txtHeight.Text.Trim(), out height);
                decimal width = 0;
                decimal.TryParse(txtWidth.Text.Trim(), out width);
                int listOrder = 0;
                int.TryParse(txtListOrder.Text.Trim(), out listOrder);

                Commerce.Common.Product product = new Commerce.Common.Product();

                product.Sku              = txtSku.Text.Trim();
                product.ProductName      = txtProductName.Text.Trim();
                product.ShortDescription = txtShortDescription.Text.Trim();
                product.OurPrice         = ourPrice;
                product.RetailPrice      = retailPrice;
                product.ManufacturerID   = manufacturerId;
                product.Status           = (ProductStatus)statusId;
                product.ProductType      = (ProductType)productTypeId;
                product.ShippingType     = (ShippingType)shippingTypeId;
                product.ShipEstimateID   = shipEstimateId;
                product.TaxTypeID        = taxTypeId;
                product.StockLocation    = txtStockLocation.Text.Trim();
                product.Weight           = weight;
                product.CurrencyCode     = ddlCurrencyCodeID.SelectedValue.Trim();
                product.UnitOfMeasure    = txtUnitOfMeasure.Text.Trim();
                product.AdminComments    = txtAdminComments.Text.Trim();
                product.Length           = length;
                product.Height           = height;
                product.Width            = width;
                product.DimensionUnit    = txtDimensionUnit.Text.Trim();
                product.ListOrder        = listOrder;
                //default this to avoid division errors
                product.TotalRatingVotes = 1;
                product.RatingSum        = 4;


                //save it up and redirect
                product.Save(Utility.GetUserName());
                //send to the detail page
                Response.Redirect("admin_product_details.aspx?id=" + product.ProductID.ToString(), false);
            }
            catch (Exception x) {
                ResultMessage1.ShowFail(x.Message);
            }
        }
    }
Exemplo n.º 16
0
 /// <summary>
 /// Updates the XML attributes for a given product
 /// </summary>
 /// <param name="productID"></param>
 /// <param name="atts"></param>
 public static void UpdateProductAttributes(int productID, Commerce.Common.Attributes atts)
 {
     Commerce.Common.Product prod = new Commerce.Common.Product(productID);
     prod.Attributes = atts;
     prod.Save(Utility.GetUserName());
 }