//PRICING
        void Entry_Completed(object sender, EventArgs e)
        {
            double gauge  = Convert.ToDouble(pageGauge.Text.ToString());
            double width  = Convert.ToDouble(pageWidth.Text.ToString());
            double length = Convert.ToDouble(pageLength.Text.ToString());
            double sheets = Convert.ToDouble(pageSheets.Text.ToString());

            quantity    = pageSheets.Text.ToString();
            matSelected = pickerMaterial.SelectedItem.ToString();
            string surfSelected  = pickerSurface.SelectedItem.ToString();
            string colorSelected = pickerColor.SelectedItem.ToString();
            double price;

            //Validation
            if (!(sheets > 0))
            {
                warningLabel.Text = "You must enter a valid quantity!";
            }
            if ((matSelected == "Vinyl") | (matSelected == "APET"))
            {
                if ((gauge < .009) | (gauge > .030))
                {
                    warningLabel.Text = "You must enter a gauge between .009 and .030!"; warningLabel.IsVisible = true; goto GaugeFix;
                }
                if ((width < 20) | (width > 50))
                {
                    warningLabel.Text = "You must enter a width between 20 and 50 inches!"; warningLabel.IsVisible = true; goto WidthFix;
                }
                if ((length < 20) | (length > 70))
                {
                    warningLabel.Text = "You must enter a length between 20 and 70 inches!"; warningLabel.IsVisible = true; goto LengthFix;
                }
                double vinylWeight      = .05 * gauge * width * length;
                double vinylTotalWeight = vinylWeight * sheets;
                if (!(vinylTotalWeight > 1999))
                {
                    warningLabel.Text = "You must enter a quantity above the minimum of 2000 pounds!"; warningLabel.IsVisible = true; goto WeightFix;
                }
                //Vinyl Price
                double vinylBase     = 1.3;
                double vinylClearUp  = -.02;
                double vinylGlossUp  = -.01;
                double vinylVelvetUp = .1;
                double vinylColorUp  = .2;
                if (surfSelected == "Gloss/Gloss")
                {
                    vinylBase = vinylBase + vinylGlossUp;
                }
                if (surfSelected == "Velvet One Side")
                {
                    vinylBase = vinylBase + vinylVelvetUp;
                }
                if (colorSelected == "Clear")
                {
                    vinylBase = vinylBase + vinylClearUp;
                }
                if (colorSelected == "Stock Color")
                {
                    vinylBase = vinylBase + vinylColorUp;
                }
                vinylBase = vinylBase * vinylWeight;
                price     = StockPricingCode.StockPricing(column, vinylWeight, vinylBase, sheets);
            }
            else//Styrene
            {
                if ((gauge < .009) | (gauge > .250))
                {
                    warningLabel.Text = "You must enter a gauge between .009 and .250!"; warningLabel.IsVisible = true; goto GaugeFix;
                }
                if ((width < 12) | (width > 68))
                {
                    warningLabel.Text = "You must enter a width between 20 and 130 inches!"; warningLabel.IsVisible = true; goto WidthFix;
                }
                if ((length < 20) | (length > 130))
                {
                    warningLabel.Text = "You must enter a length between 20 and 130 inches!"; warningLabel.IsVisible = true; goto LengthFix;
                }
                double styreneWeight      = .04 * gauge * width * length;
                double styreneTotalWeight = styreneWeight * sheets;
                if (!(styreneTotalWeight > 1999))
                {
                    warningLabel.Text = "You must enter a quantity above the minimum of 2000 pounds!"; warningLabel.IsVisible = true; goto WeightFix;
                }
                //Styrene Price
                double styreneBase = 1.35;
                double transUp     = -.02;
                double deadUp      = -.1;
                double glossUp     = .05;
                if (colorSelected == "Translucent White")
                {
                    styreneBase = styreneBase + transUp;
                }
                if (colorSelected == "Dean White")
                {
                    styreneBase = styreneBase + deadUp;
                }
                if (surfSelected == "Gloss/Matte")
                {
                    styreneBase = styreneBase + glossUp;
                }
                styreneBase = styreneBase * styreneWeight;
                price       = StockPricingCode.StockPricing(column, styreneWeight, styreneBase, sheets);
            }
            warningLabel.IsVisible = true;
            if (pricingString == "dog")
            {
                pricingString = quantity + " sheets " + gauge.ToString("N3") + " " + colorSelected + " " + surfSelected + " " + matSelected + " " + width.ToString() + "x" + length.ToString() + " sheets " + price.ToString("C2") + " per sheet delivered";
            }
            else
            {
                pricingString = pricingString + "\r" + quantity + " sheets " + gauge.ToString("N3") + " " + colorSelected + " " + surfSelected + " " + matSelected + " " + width.ToString() + "x" + length.ToString() + " sheets " + price.ToString("C2") + " per sheet delivered";
            }
            warningLabel.Text      = pricingString;
            copyClicked.IsVisible  = true;
            emailClicked.IsVisible = true;

            goto WeightFix;

            GaugeFix  : pageGauge.Text  = ""; pageGauge.Focus();
            WidthFix  : pageWidth.Text  = ""; pageGauge.Focus();
            LengthFix : pageLength.Text = ""; pageGauge.Focus();
            WeightFix : pageSheets.Text = ""; pageSheets.Focus();
        }
Esempio n. 2
0
        void Entry_Completed(object sender, EventArgs e)
        {
            string quantityString = ((Entry)sender).Text;

            quantity = Convert.ToDouble(quantityString);
            double vinylBase     = 1.3;
            double styreneBase   = 1.38;
            double vinylClearUp  = -.02;
            double vinylGlossUp  = -.01;
            double vinylVelvetUp = .2;
            double vinylColorUp  = .3;

            //Standard styrene and vinyl pricing
            if (itemBasePrice == 0)
            {//VINYL
                if ((itemMaterial == "Vinyl") | (itemMaterial == "APET"))
                {
                    if (!((itemColor == "White") | (itemColor == "Clear")))//COLORS
                    {
                        vinylBase = vinylBase + vinylColorUp;
                    }
                    if (itemColor == "Clear")
                    {
                        vinylBase = vinylBase + vinylClearUp;
                    }
                    if (itemSurface == "Gloss/Gloss")
                    {
                        vinylBase = vinylBase + vinylGlossUp;
                    }
                    if (itemSurface == "Velvet/Gloss")
                    {
                        vinylBase = vinylBase + vinylVelvetUp;
                    }
                    itemBasePrice = vinylBase * itemWeight;
                }
                if (itemMaterial == "Styrene")
                {
                    if (itemColor == "Dead White")
                    {
                        styreneBase = styreneBase + .11;
                    }
                    if (itemColor == "Translucent White")
                    {
                        styreneBase = styreneBase - .05;
                    }
                    itemBasePrice = styreneBase * itemWeight * .95;//allowance for downgauge
                    if ((quantity * itemWeight) > 999)
                    {
                        column = column + 16;
                    }
                }
            }
            //Send to stockPricing Code
            price = StockPricingCode.StockPricing(column, itemWeight, itemBasePrice, quantity);
            //RETURN
            if (pricingString == "dog")
            {
                pricingString = quantity + " sheets " + itemDescription + " " + price.ToString("C2") + " per sheet delivered";
            }
            else
            {
                pricingString = pricingString + "\r" + quantity + " sheets " + itemDescription + " " + price.ToString("C2") + " per sheet delivered";
            }

            testingBinding1.Text = pricingString;
            pageQuantity.Text    = "";
            pageQuantity.Focus();
            copyClicked.IsVisible  = true;
            emailClicked.IsVisible = true;
        }