protected void btnCalculate_Click(object sender, EventArgs e)
    {
        double WinWidth;
        double WinHeight;
        double FrWidth;
        double Margin;
        double WinSqrPrice;
        double AlFramePrice;
        double Workcost;
        double Area;
        double Girth;
        double Price;

        try {
            WinWidth     = double.Parse(txtWinWidth.Text);
            WinHeight    = double.Parse(txtWinHeight.Text);
            FrWidth      = double.Parse(txtFrWidth.Text);
            Margin       = double.Parse(ConfigurationManager.AppSettings["Margin"]);
            WinSqrPrice  = double.Parse(ConfigurationManager.AppSettings["WinSqrPrice"]);
            AlFramePrice = double.Parse(ConfigurationManager.AppSettings["AlFramePrice"]);
            Workcost     = double.Parse(ConfigurationManager.AppSettings["Workcost"]);

            Area = WinWidth * WinHeight / 1000000;
            lblAreaResult.Text = Area.ToString("0.##") + " m^2";
            Girth = (((WinWidth * 2) + (WinHeight * 2) + FrWidth * 4) / 1000);
            lblGirthResult.Text = Girth.ToString("0.##") + " m";
            Price = (1 + (Margin / 100)) * ((Area * WinSqrPrice) + (Girth * AlFramePrice) + (Workcost));
            lblPriceResult.Text = Price.ToString("0.##") + " €";
            lblMessage.Text     = "Ok";
        } catch (Exception) {
            lblMessage.Text = "Jokin meni väärin. Täytitkö kaikki kentät?";
        }
    }
Example #2
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(ProfileType.ToStepValue());
            parameters.Add(ProfileName != null ? ProfileName.ToStepValue() : "$");
            parameters.Add(Position != null ? Position.ToStepValue() : "$");
            parameters.Add(Depth != null ? Depth.ToStepValue() : "$");
            parameters.Add(Width != null ? Width.ToStepValue() : "$");
            parameters.Add(WallThickness != null ? WallThickness.ToStepValue() : "$");
            parameters.Add(Girth != null ? Girth.ToStepValue() : "$");
            parameters.Add(InternalFilletRadius != null ? InternalFilletRadius.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
Example #3
0
        public override void Draw()
        {
            if (Instance == null || !(Instance is System.Windows.Shapes.Rectangle))
            {
                Instance = new System.Windows.Shapes.Rectangle();
            }

            Instance.Width   = Width;
            Instance.Height  = Height;
            Instance.ToolTip = new TextBlock()
            {
                Text     = $"Width:{Width.PxToCm().ToString("F2")}cm\nHeight:{Height.PxToCm().ToString("F2")}cm\nGirth:{Girth.ToString("F2")}cm\nArea:{Area.ToString("F2")}cm²",
                FontSize = 12
            };

            base.Draw();
        }