protected void btnMixedShapeOnClick(object sender, EventArgs e)
        {
            Page.Validate("mrMixedShape");
            if (Page.IsValid)
            {
                if (ckbxRehabilitationDataImperial.Checked)
                {
                    Distance distanceMixedRoundDiameter = new Distance(tbxRehabilitationDataRoundDiameter.Text);
                    decimal roundDiameter = GetValueInEng3With2Decimals(distanceMixedRoundDiameter.ToStringInEng3());
                    tbxRehabilitationDataRoundDiameter.Text = roundDiameter.ToString();

                    Distance distanceMixedRoundDepth = new Distance(tbxRehabilitationDataRoundDepth.Text);
                    decimal roundDepth = GetValueInEng3With2Decimals(distanceMixedRoundDepth.ToStringInEng3());
                    tbxRehabilitationDataRoundDepth.Text = roundDepth.ToString();

                    Distance distanceMixedRectangleLongSid = new Distance(tbxRehabilitationDataRectangleLongSide.Text);
                    decimal rectangleLongSide = GetValueInEng3With2Decimals(distanceMixedRectangleLongSid.ToStringInEng3());
                    tbxRehabilitationDataRectangleLongSide.Text = rectangleLongSide.ToString();

                    Distance distanceMixedShortSide = new Distance(tbxRehabilitationDataRectangleShortSide.Text);
                    decimal rectangleShortSide = GetValueInEng3With2Decimals(distanceMixedShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangleShortSide.Text = rectangleShortSide.ToString();

                    Distance distanceMixedRectangleDepth = new Distance(tbxRehabilitationDataRectangleDepth.Text);
                    decimal rectangleDepth = GetValueInEng3With2Decimals(distanceMixedRectangleDepth.ToStringInEng3());
                    tbxRehabilitationDataRectangleDepth.Text = rectangleDepth.ToString();

                    decimal pi = Decimal.Round(decimal.Parse(Math.PI.ToString()), 4);
                    double radius = double.Parse(distanceMixedRoundDiameter.ToStringInEng3()) / 2;
                    decimal radiusSquare = decimal.Parse(Math.Pow(radius, 2).ToString());

                    // Recalculate Round Floor
                    decimal roundFloor = 0;
                    tbxRehabilitationDataRoundFloor.Text = "";
                    if (ckbxRehabilitationDataRoundFloor.Checked)
                    {
                        roundFloor = Decimal.Round(pi * (radiusSquare), 2);
                        Distance floorDistance = new Distance(roundFloor.ToString());
                        tbxRehabilitationDataRoundFloor.Text = floorDistance.ToStringInEng3();
                    }

                    // Recalculate Round Ceiling
                    decimal roundCeiling = 0;
                    tbxRehabilitationDataRoundCeiling.Text = "";
                    if (ckbxRehabilitationDataRoundCeiling.Checked)
                    {
                        roundCeiling = Decimal.Round(pi * (radiusSquare), 2);
                        Distance ceilingDistance = new Distance(roundCeiling.ToString());
                        tbxRehabilitationDataRoundCeiling.Text = ceilingDistance.ToStringInEng3(); ;

                        // Graphic
                        lblDataRoundCeilingLabel.Text = tbxRehabilitationDataRoundCeiling.Text;
                    }

                    // Recalculate Round Benching
                    decimal roundBenching = 0;
                    tbxRehabilitationDataRoundBenching.Text = "";
                    if (ckbxRehabilitationDataRoundBenching.Checked)
                    {
                        roundBenching = Decimal.Round((pi * (radiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(roundBenching.ToString());
                        tbxRehabilitationDataRoundBenching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate round surface area
                    decimal roundSurfaceArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * roundDiameter) * roundDepth), 2);
                    Distance roundSurfaceAreaDistance = new Distance(roundSurfaceArea.ToString());
                    tbxRehabilitationDataRoundSurfaceArea.Text = roundSurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Rectangle floor
                    decimal rectangleFloor = 0;
                    tbxRehabilitationDataRectangleFloor.Text = "";
                    if (ckbxRehabilitationDataRectangleFloor.Checked)
                    {
                        rectangleFloor = Decimal.Round((rectangleLongSide * rectangleShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangleFloor.ToString());
                        tbxRehabilitationDataRectangleFloor.Text = ceilingDistance.ToStringInEng3();
                    }

                    // Recalculate Rectangle ceiling
                    decimal rectangleCeiling = 0;
                    tbxRehabilitationDataRectangleCeiling.Text = "";
                    if (ckbxRehabilitationDataRectangleCeiling.Checked)
                    {
                        rectangleCeiling = Decimal.Round((rectangleLongSide * rectangleShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangleCeiling.ToString());
                        tbxRehabilitationDataRectangleCeiling.Text = ceilingDistance.ToStringInEng3();

                        //Graphic
                        lblRectangleCeilingLabel.Text = tbxRehabilitationDataRectangleCeiling.Text;
                    }

                    // Recalculate Rectangle benching
                    decimal rectangleBenching = 0;
                    tbxRehabilitationDataRectangleBenching.Text = "";
                    if (ckbxRehabilitationDataRectangleBenching.Checked)
                    {
                        rectangleBenching = Decimal.Round(((rectangleLongSide * rectangleShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangleBenching.ToString());
                        tbxRehabilitationDataRectangleBenching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate rectangle  surface area
                    decimal rectangleSurfaceArea = decimal.Round(((rectangleLongSide * 2) + (rectangleShortSide * 2)) * rectangleDepth, 2);
                    Distance rectangleSurfaceAreaDistance = new Distance(rectangleSurfaceArea.ToString());
                    tbxRehabilitationDataRectangleSufaceArea.Text = rectangleSurfaceAreaDistance.ToStringInEng3();

                    // Recalculte total depth
                    decimal totalDetph = decimal.Round((roundDepth + rectangleDepth), 0);
                    Distance totalDetphDistance = new Distance(totalDetph.ToString());
                    tbxRehabilitationDataMixedTotalDepth.Text = totalDetphDistance.ToStringInEng3();

                    // Recalculate total surface area
                    decimal totalSurfaceArea = decimal.Round(rectangleSurfaceArea + roundSurfaceArea + roundFloor + roundCeiling + roundBenching + rectangleFloor + rectangleCeiling + rectangleBenching, 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // Graphic
                    lblDataRoundDiameterLabel.Text = tbxRehabilitationDataRoundDiameter.Text;
                    lblDataRoundDepthLabel.Text = tbxRehabilitationDataRoundDepth.Text;
                    lblDataRoundSurfaceAreaLabel.Text = tbxRehabilitationDataRoundSurfaceArea.Text;

                    lblRectangleLongSideLabel.Text = tbxRehabilitationDataRectangleLongSide.Text;
                    lblRectangleShortSideLabel.Text = tbxRehabilitationDataRectangleShortSide.Text;
                    lblRectangleDephtLabel.Text = tbxRehabilitationDataRectangleDepth.Text;
                    lblRectangleSurfaceAreaLabel.Text = tbxRehabilitationDataRectangleSufaceArea.Text;

                    lblMixedTotalDepthLabel.Text = tbxRehabilitationDataMixedTotalDepth.Text;
                    lblTotalMixedSurfaceAreaLabel.Text = "Total Surface Area: " + tbxRehabilitationDataMixedTotalSurfaceArea.Text;

                    // Recalculate Top total surface area
                    decimal roundTotalSurfaceArea = decimal.Round(roundSurfaceArea + roundFloor + roundCeiling + roundBenching, 2);
                    Distance roundTotalSurfaceAreaDistance = new Distance(roundTotalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedRoundTotalSurfaceArea.Text = roundTotalSurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Down total surface area
                    decimal mixesRectangleTotalSurfaceArea = decimal.Round(rectangleSurfaceArea + rectangleFloor + rectangleCeiling + rectangleBenching, 2);
                    Distance mixesRectangleTotalSurfaceAreaDistance = new Distance(mixesRectangleTotalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedRectangleTotalSurfaceArea.Text = mixesRectangleTotalSurfaceAreaDistance.ToStringInEng3();
                }
                else
                {
                    Distance distanceMixedRoundDiameter = new Distance(tbxRehabilitationDataRoundDiameter.Text);
                    decimal roundDiameter = GetValueInEng3With2Decimals(distanceMixedRoundDiameter.ToStringInEng3());
                    tbxRehabilitationDataRoundDiameter.Text = distanceMixedRoundDiameter.ToStringInMet2();

                    Distance distanceMixedRoundDepth = new Distance(tbxRehabilitationDataRoundDepth.Text);
                    decimal roundDepth = GetValueInEng3With2Decimals(distanceMixedRoundDepth.ToStringInEng3());
                    tbxRehabilitationDataRoundDepth.Text = distanceMixedRoundDepth.ToStringInMet2();

                    Distance distanceMixedRectangleLongSid = new Distance(tbxRehabilitationDataRectangleLongSide.Text);
                    decimal rectangleLongSide = GetValueInEng3With2Decimals(distanceMixedRectangleLongSid.ToStringInEng3());
                    tbxRehabilitationDataRectangleLongSide.Text = distanceMixedRectangleLongSid.ToStringInMet2();

                    Distance distanceMixedShortSide = new Distance(tbxRehabilitationDataRectangleShortSide.Text);
                    decimal rectangleShortSide = GetValueInEng3With2Decimals(distanceMixedShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangleShortSide.Text = distanceMixedShortSide.ToStringInMet2();

                    Distance distanceMixedRectangleDepth = new Distance(tbxRehabilitationDataRectangleDepth.Text);
                    decimal rectangleDepth = decimal.Parse(distanceMixedRectangleDepth.ToStringInEng3());
                    tbxRehabilitationDataRectangleDepth.Text = distanceMixedRectangleDepth.ToStringInMet2();

                    decimal pi = Decimal.Round(decimal.Parse(Math.PI.ToString()), 4);
                    double radius = double.Parse(distanceMixedRoundDiameter.ToStringInEng3()) / 2;
                    decimal radiusSquare = decimal.Parse(Math.Pow(radius, 2).ToString());

                    // Recalculate Round Floor
                    decimal roundFloor = 0;
                    tbxRehabilitationDataRoundFloor.Text = "";
                    if (ckbxRehabilitationDataRoundFloor.Checked)
                    {
                        roundFloor = Decimal.Round(pi * (radiusSquare), 2);
                        Distance floorDistance = new Distance(roundFloor.ToString());
                        tbxRehabilitationDataRoundFloor.Text = floorDistance.ToStringInMet2();
                    }

                    // Recalculate Round Ceiling
                    decimal roundCeiling = 0;
                    tbxRehabilitationDataRoundCeiling.Text = "";
                    if (ckbxRehabilitationDataRoundCeiling.Checked)
                    {
                        roundCeiling = Decimal.Round(pi * (radiusSquare), 2);
                        Distance ceilingDistance = new Distance(roundCeiling.ToString());
                        tbxRehabilitationDataRoundCeiling.Text = ceilingDistance.ToStringInMet2(); ;

                        // Graphic
                        lblDataRoundCeilingLabel.Text = tbxRehabilitationDataRoundCeiling.Text;
                    }

                    // Recalculate Round Benching
                    decimal roundBenching = 0;
                    tbxRehabilitationDataRoundBenching.Text = "";
                    if (ckbxRehabilitationDataRoundBenching.Checked)
                    {
                        roundBenching = Decimal.Round((pi * (radiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(roundBenching.ToString());
                        tbxRehabilitationDataRoundBenching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate round surface area
                    decimal roundSurfaceArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * roundDiameter) * roundDepth), 2);
                    Distance roundSurfaceAreaDistance = new Distance(roundSurfaceArea.ToString());
                    tbxRehabilitationDataRoundSurfaceArea.Text = roundSurfaceAreaDistance.ToStringInMet2();

                    // Recalculate Rectangle floor
                    decimal rectangleFloor = 0;
                    tbxRehabilitationDataRectangleFloor.Text = "";
                    if (ckbxRehabilitationDataRectangleFloor.Checked)
                    {
                        rectangleFloor = Decimal.Round((rectangleLongSide * rectangleShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangleFloor.ToString());
                        tbxRehabilitationDataRectangleFloor.Text = ceilingDistance.ToStringInMet2();
                    }

                    // Recalculate Rectangle ceiling
                    decimal rectangleCeiling = 0;
                    tbxRehabilitationDataRectangleCeiling.Text = "";
                    if (ckbxRehabilitationDataRectangleCeiling.Checked)
                    {
                        rectangleCeiling = Decimal.Round((rectangleLongSide * rectangleShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangleCeiling.ToString());
                        tbxRehabilitationDataRectangleCeiling.Text = ceilingDistance.ToStringInMet2();

                        //Graphic
                        lblRectangleCeilingLabel.Text = tbxRehabilitationDataRectangleCeiling.Text;
                    }

                    // Recalculate Rectangle benching
                    decimal rectangleBenching = 0;
                    tbxRehabilitationDataRectangleBenching.Text = "";
                    if (ckbxRehabilitationDataRectangleBenching.Checked)
                    {
                        rectangleBenching = Decimal.Round(((rectangleLongSide * rectangleShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangleBenching.ToString());
                        tbxRehabilitationDataRectangleBenching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate rectangle  surface area
                    decimal rectangleSurfaceArea = decimal.Round(((rectangleLongSide * 2) + (rectangleShortSide * 2)) * rectangleDepth, 2);
                    Distance rectangleSurfaceAreaDistance = new Distance(rectangleSurfaceArea.ToString());
                    tbxRehabilitationDataRectangleSufaceArea.Text = rectangleSurfaceAreaDistance.ToStringInMet2();

                    // Recalculte total depth
                    decimal totalDetph = decimal.Round((roundDepth + rectangleDepth), 0);
                    Distance totalDetphDistance = new Distance(totalDetph.ToString());
                    tbxRehabilitationDataMixedTotalDepth.Text = totalDetphDistance.ToStringInMet2();

                    // Recalculate total surface area
                    decimal totalSurfaceArea = decimal.Round(rectangleSurfaceArea + roundSurfaceArea + roundFloor + roundCeiling + roundBenching + rectangleFloor + rectangleCeiling + rectangleBenching, 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // Graphic
                    lblDataRoundDiameterLabel.Text = tbxRehabilitationDataRoundDiameter.Text;
                    lblDataRoundDepthLabel.Text = tbxRehabilitationDataRoundDepth.Text;
                    lblDataRoundSurfaceAreaLabel.Text = tbxRehabilitationDataRoundSurfaceArea.Text;

                    lblRectangleLongSideLabel.Text = tbxRehabilitationDataRectangleLongSide.Text;
                    lblRectangleShortSideLabel.Text = tbxRehabilitationDataRectangleShortSide.Text;
                    lblRectangleDephtLabel.Text = tbxRehabilitationDataRectangleDepth.Text;
                    lblRectangleSurfaceAreaLabel.Text = tbxRehabilitationDataRectangleSufaceArea.Text;

                    lblMixedTotalDepthLabel.Text = tbxRehabilitationDataMixedTotalDepth.Text;
                    lblTotalMixedSurfaceAreaLabel.Text = "Total Surface Area: " + tbxRehabilitationDataMixedTotalSurfaceArea.Text;

                    // Recalculate Top total surface area
                    decimal roundTotalSurfaceArea = decimal.Round(roundSurfaceArea + roundFloor + roundCeiling + roundBenching, 2);
                    Distance roundTotalSurfaceAreaDistance = new Distance(roundTotalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedRoundTotalSurfaceArea.Text = roundTotalSurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Down total surface area
                    decimal mixesRectangleTotalSurfaceArea = decimal.Round(rectangleSurfaceArea + rectangleFloor + rectangleCeiling + rectangleBenching, 2);
                    Distance mixesRectangleTotalSurfaceAreaDistance = new Distance(mixesRectangleTotalSurfaceArea.ToString());
                    tbxRehabilitationDataMixedRectangleTotalSurfaceArea.Text = mixesRectangleTotalSurfaceAreaDistance.ToStringInEng3();
                }
            }
        }
        protected void btnRoundShapeOnClick(object sender, EventArgs e)
        {
            Page.Validate("mrRoundShape");
            if (Page.IsValid)
            {
                if (ckbxRehabilitationDataImperial.Checked)
                {
                    Distance distanceRoundChimneyDiameter = new Distance(tbxRehabilitationDataChimneyDiameter.Text);
                    decimal chimneyDiameter = GetValueInEng3With2Decimals(distanceRoundChimneyDiameter.ToStringInEng3());
                    tbxRehabilitationDataChimneyDiameter.Text = chimneyDiameter.ToString();

                    Distance distanceRoundChimneyDepth = new Distance(tbxRehabilitationDataChimneyDepth.Text);
                    decimal chimneyDepth = GetValueInEng3With2Decimals(distanceRoundChimneyDepth.ToStringInEng3());
                    tbxRehabilitationDataChimneyDepth.Text = chimneyDepth.ToString();

                    Distance distanceRoundBarrelDiameter = new Distance(tbxRehabilitationDataBarrelDiameter.Text);
                    decimal barrelDiameter = GetValueInEng3With2Decimals(distanceRoundBarrelDiameter.ToStringInEng3());
                    tbxRehabilitationDataBarrelDiameter.Text = barrelDiameter.ToString();

                    Distance distanceRoundBarrelDepth = new Distance(tbxRehabilitationDataBarrelDepth.Text);
                    decimal barrelDepth = GetValueInEng3With2Decimals(distanceRoundBarrelDepth.ToStringInEng3());
                    tbxRehabilitationDataBarrelDepth.Text = barrelDepth.ToString();

                    decimal pi = Decimal.Round(decimal.Parse(Math.PI.ToString()), 4);
                    double chimneyRadius = double.Parse(distanceRoundChimneyDiameter.ToStringInEng3()) / 2;
                    decimal chimneyRadiusSquare = decimal.Parse(Math.Pow(chimneyRadius, 2).ToString());
                    double barrelRadius = double.Parse(distanceRoundBarrelDiameter.ToStringInEng3()) / 2;
                    decimal barrelRadiusSquare = decimal.Parse(Math.Pow(barrelRadius, 2).ToString());

                    // Recalculate chimmney Floor
                    decimal chimneyFloor = 0;
                    tbxRehabilitationDataChimneyFloor.Text = "";
                    if (ckbxRehabilitationDataChimneyFloor.Checked)
                    {
                        chimneyFloor = Decimal.Round(pi * (chimneyRadiusSquare), 2);
                        Distance floorDistance = new Distance(chimneyFloor.ToString());
                        tbxRehabilitationDataChimneyFloor.Text = floorDistance.ToStringInEng3();
                    }

                    // Recalculate Chimney Ceiling
                    decimal chimneyCeiling = 0;
                    tbxRehabilitationDataChimneyCeiling.Text = "";
                    if (ckbxRehabilitationDataChimneyCeiling.Checked)
                    {
                        chimneyCeiling = Decimal.Round(pi * (chimneyRadiusSquare), 2);
                        Distance ceilingDistance = new Distance(chimneyCeiling.ToString());
                        tbxRehabilitationDataChimneyCeiling.Text = ceilingDistance.ToStringInEng3();

                        //Graphic
                        lblRoudChimneyCeilingLabel.Text = tbxRehabilitationDataChimneyCeiling.Text;
                    }

                    // Recalculate chimney Benching
                    decimal chimneyBenching = 0;
                    tbxRehabilitationDataChimneyBenching.Text = "";
                    if (ckbxRehabilitationDataChimneyBenching.Checked)
                    {
                        chimneyBenching = Decimal.Round((pi * (chimneyRadiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(chimneyBenching.ToString());
                        tbxRehabilitationDataChimneyBenching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate chimney surface area
                    decimal chimneyArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * chimneyDiameter) * chimneyDepth), 2);
                    Distance chimneyAreaDistance = new Distance(chimneyArea.ToString());
                    tbxRehabilitationDataChimneySurfaceArea.Text = chimneyAreaDistance.ToStringInEng3();

                    // Recalculate Barrel Floor
                    decimal barrelFloor = 0;
                    tbxRehabilitationDataBarrelFloor.Text = "";

                    if (ckbxRehabilitationDataBarrelFloor.Checked)
                    {
                        barrelFloor = Decimal.Round(pi * (barrelRadiusSquare), 2);
                        Distance floorDistance = new Distance(barrelFloor.ToString());
                        tbxRehabilitationDataBarrelFloor.Text = floorDistance.ToStringInEng3();
                    }

                    // Recalculate Barrel Ceiling
                    decimal barrelCeiling = 0;
                    tbxRehabilitationDataBarrelCeiling.Text = "";
                    if (ckbxRehabilitationDataBarrelCeiling.Checked)
                    {
                        barrelCeiling = Decimal.Round(pi * (barrelRadiusSquare), 2);
                        Distance ceilingDistance = new Distance(barrelCeiling.ToString());
                        tbxRehabilitationDataBarrelCeiling.Text = ceilingDistance.ToStringInEng3();

                        // Graphic
                        lblRoundBarrelCeilingLabel.Text = tbxRehabilitationDataBarrelCeiling.Text;
                    }

                    // Recalculate Barrel Benching
                    decimal barrelBenching = 0;
                    tbxRehabilitationDataBarrelBenching.Text = "";
                    if (ckbxRehabilitationDataBarrelBenching.Checked)
                    {
                        barrelBenching = Decimal.Round((pi * (barrelRadiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(barrelBenching.ToString());
                        tbxRehabilitationDataBarrelBenching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate Barrel surface area
                    decimal barrelArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * barrelDiameter) * barrelDepth), 2);
                    Distance barrelAreaDistance = new Distance(barrelArea.ToString());
                    tbxRehabilitationDataBarrelSurfaceArea.Text = barrelAreaDistance.ToStringInEng3();

                    // Recalculte total depth
                    decimal totalDepth = decimal.Round(chimneyDepth + barrelDepth, 0);
                    Distance totalDepthDistance = new Distance(totalDepth.ToString());
                    tbxRehabilitationDataRoundTotalDepth.Text = totalDepthDistance.ToStringInEng3();

                    // Recalculate total surface area
                    decimal totalSurfaceArea = decimal.Round((chimneyArea + barrelArea + chimneyFloor + chimneyCeiling + chimneyBenching + barrelFloor + barrelCeiling + barrelBenching), 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataRoundTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // For Graphic
                    lblRoudChimneyDiameterLabel.Text = tbxRehabilitationDataChimneyDiameter.Text;
                    lblRoudChimneyDepthLabel.Text = tbxRehabilitationDataChimneyDepth.Text;
                    lblRoundChimneySurfaceAreaLabel.Text = tbxRehabilitationDataChimneySurfaceArea.Text;

                    lblRoudBarrelDiameterLabel.Text = tbxRehabilitationDataBarrelDiameter.Text;
                    lblRoudBarrelDepthLabel.Text = tbxRehabilitationDataBarrelDepth.Text;
                    lblRoundBarrelSurfaceAreaLabel.Text = tbxRehabilitationDataBarrelSurfaceArea.Text;

                    lblRoundTotalDepthLabel.Text = tbxRehabilitationDataRoundTotalDepth.Text;
                    lblRoundTotalSurfaceArea.Text = "Total Surface Area: " + tbxRehabilitationDataRoundTotalSurfaceArea.Text;

                    decimal chimneyTotalSurfaceArea = decimal.Round(chimneyArea + chimneyFloor + chimneyCeiling + chimneyBenching, 2);
                    Distance chimneyTotalSurfaceAreaDistance = new Distance(chimneyTotalSurfaceArea.ToString());
                    tbxRehabilitationDataChimneyTotalSurfaceArea.Text = chimneyTotalSurfaceAreaDistance.ToStringInEng3();

                    decimal barrelTotalSurfaceArea = decimal.Round(barrelArea + barrelFloor + barrelCeiling + barrelBenching, 2);
                    Distance barrelTotalSurfaceAreaDistance = new Distance(barrelTotalSurfaceArea.ToString());
                    tbxRehabilitationDataBarrelTotalSurfaceArea.Text = barrelTotalSurfaceAreaDistance.ToStringInEng3();
                }
                else
                {
                    Distance distanceRoundChimneyDiameter = new Distance(tbxRehabilitationDataChimneyDiameter.Text);
                    decimal chimneyDiameter = decimal.Parse(distanceRoundChimneyDiameter.ToStringInEng3());
                    tbxRehabilitationDataChimneyDiameter.Text = distanceRoundChimneyDiameter.ToStringInMet2();

                    Distance distanceRoundChimneyDepth = new Distance(tbxRehabilitationDataChimneyDepth.Text);
                    decimal chimneyDepth = decimal.Parse(distanceRoundChimneyDepth.ToStringInEng3());
                    tbxRehabilitationDataChimneyDepth.Text = distanceRoundChimneyDepth.ToStringInMet2();

                    Distance distanceRoundBarrelDiameter = new Distance(tbxRehabilitationDataBarrelDiameter.Text);
                    decimal barrelDiameter = decimal.Parse(distanceRoundBarrelDiameter.ToStringInEng3());
                    tbxRehabilitationDataBarrelDiameter.Text = distanceRoundBarrelDiameter.ToStringInMet2();

                    Distance distanceRoundBarrelDepth = new Distance(tbxRehabilitationDataBarrelDepth.Text);
                    decimal barrelDepth = decimal.Parse(distanceRoundBarrelDepth.ToStringInEng3());
                    tbxRehabilitationDataBarrelDepth.Text = distanceRoundBarrelDepth.ToStringInMet2();

                    decimal pi = Decimal.Round(decimal.Parse(Math.PI.ToString()), 4);
                    double chimneyRadius = double.Parse(distanceRoundChimneyDiameter.ToStringInEng3()) / 2;
                    decimal chimneyRadiusSquare = decimal.Parse(Math.Pow(chimneyRadius, 2).ToString());
                    double barrelRadius = double.Parse(distanceRoundBarrelDiameter.ToStringInEng3()) / 2;
                    decimal barrelRadiusSquare = decimal.Parse(Math.Pow(barrelRadius, 2).ToString());

                    // Recalculate chimmney Floor
                    decimal chimneyFloor = 0;
                    tbxRehabilitationDataChimneyFloor.Text = "";
                    if (ckbxRehabilitationDataChimneyFloor.Checked)
                    {
                        chimneyFloor = Decimal.Round(pi * (chimneyRadiusSquare), 2);
                        Distance floorDistance = new Distance(chimneyFloor.ToString());
                        tbxRehabilitationDataChimneyFloor.Text = floorDistance.ToStringInMet2();
                    }

                    // Recalculate Chimney Ceiling
                    decimal chimneyCeiling = 0;
                    tbxRehabilitationDataChimneyCeiling.Text = "";
                    if (ckbxRehabilitationDataChimneyCeiling.Checked)
                    {
                        chimneyCeiling = Decimal.Round(pi * (chimneyRadiusSquare), 2);
                        Distance ceilingDistance = new Distance(chimneyCeiling.ToString());
                        tbxRehabilitationDataChimneyCeiling.Text = ceilingDistance.ToStringInMet2();

                        //Graphic
                        lblRoudChimneyCeilingLabel.Text = tbxRehabilitationDataChimneyCeiling.Text;
                    }

                    // Recalculate chimney Benching
                    decimal chimneyBenching = 0;
                    tbxRehabilitationDataChimneyBenching.Text = "";
                    if (ckbxRehabilitationDataChimneyBenching.Checked)
                    {
                        chimneyBenching = Decimal.Round((pi * (chimneyRadiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(chimneyBenching.ToString());
                        tbxRehabilitationDataChimneyBenching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate chimney surface area
                    decimal chimneyArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * chimneyDiameter) * chimneyDepth), 2);
                    Distance chimneyAreaDistance = new Distance(chimneyArea.ToString());
                    tbxRehabilitationDataChimneySurfaceArea.Text = chimneyAreaDistance.ToStringInMet2();

                    // Recalculate Barrel Floor
                    decimal barrelFloor = 0;
                    tbxRehabilitationDataBarrelFloor.Text = "";
                    if (ckbxRehabilitationDataBarrelFloor.Checked)
                    {
                        barrelFloor = Decimal.Round(pi * (barrelRadiusSquare), 2);
                        Distance floorDistance = new Distance(barrelFloor.ToString());
                        tbxRehabilitationDataBarrelFloor.Text = floorDistance.ToStringInMet2();
                    }

                    // Recalculate Barrel Ceiling
                    decimal barrelCeiling = 0;
                    tbxRehabilitationDataBarrelCeiling.Text = "";
                    if (ckbxRehabilitationDataBarrelCeiling.Checked)
                    {
                        barrelCeiling = Decimal.Round(pi * (barrelRadiusSquare), 2);
                        Distance ceilingDistance = new Distance(barrelCeiling.ToString());
                        tbxRehabilitationDataBarrelCeiling.Text = ceilingDistance.ToStringInMet2();

                        // Graphic
                        lblRoundBarrelCeilingLabel.Text = tbxRehabilitationDataBarrelCeiling.Text;
                    }

                    // Recalculate Barrel Benching
                    decimal barrelBenching = 0;
                    tbxRehabilitationDataBarrelBenching.Text = "";
                    if (ckbxRehabilitationDataBarrelBenching.Checked)
                    {
                        barrelBenching = Decimal.Round((pi * (barrelRadiusSquare)) * decimal.Parse("0.06"), 2);
                        Distance benchingDistance = new Distance(barrelBenching.ToString());
                        tbxRehabilitationDataBarrelBenching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate Barrel surface area
                    decimal barrelArea = Decimal.Round((2 * pi * (decimal.Parse("0.5") * barrelDiameter) * barrelDepth), 2);
                    Distance barrelAreaDistance = new Distance(barrelArea.ToString());
                    tbxRehabilitationDataBarrelSurfaceArea.Text = barrelAreaDistance.ToStringInMet2();

                    // Recalculte total depth
                    decimal totalDepth = decimal.Round(chimneyDepth + barrelDepth, 0);
                    Distance totalDepthDistance = new Distance(totalDepth.ToString());
                    tbxRehabilitationDataRoundTotalDepth.Text = totalDepthDistance.ToStringInMet2();

                    // Recalculate total surface area
                    decimal totalSurfaceArea = decimal.Round((chimneyArea + barrelArea + chimneyFloor + chimneyCeiling + chimneyBenching + barrelFloor + barrelCeiling + barrelBenching), 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataRoundTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // For Graphic
                    lblRoudChimneyDiameterLabel.Text = tbxRehabilitationDataChimneyDiameter.Text;
                    lblRoudChimneyDepthLabel.Text = tbxRehabilitationDataChimneyDepth.Text;
                    lblRoundChimneySurfaceAreaLabel.Text = tbxRehabilitationDataChimneySurfaceArea.Text;

                    lblRoudBarrelDiameterLabel.Text = tbxRehabilitationDataBarrelDiameter.Text;
                    lblRoudBarrelDepthLabel.Text = tbxRehabilitationDataBarrelDepth.Text;
                    lblRoundBarrelSurfaceAreaLabel.Text = tbxRehabilitationDataBarrelSurfaceArea.Text;

                    lblRoundTotalDepthLabel.Text = tbxRehabilitationDataRoundTotalDepth.Text;
                    lblRoundTotalSurfaceArea.Text = "Total Surface Area: " + tbxRehabilitationDataRoundTotalSurfaceArea.Text;

                    decimal chimneyTotalSurfaceArea = decimal.Round(chimneyArea + chimneyFloor + chimneyCeiling + chimneyBenching, 2);
                    Distance chimneyTotalSurfaceAreaDistance = new Distance(chimneyTotalSurfaceArea.ToString());
                    tbxRehabilitationDataChimneyTotalSurfaceArea.Text = chimneyTotalSurfaceAreaDistance.ToStringInEng3();

                    decimal barrelTotalSurfaceArea = decimal.Round(barrelArea + barrelFloor + barrelCeiling + barrelBenching, 2);
                    Distance barrelTotalSurfaceAreaDistance = new Distance(barrelTotalSurfaceArea.ToString());
                    tbxRehabilitationDataBarrelTotalSurfaceArea.Text = barrelTotalSurfaceAreaDistance.ToStringInEng3();
                }
            }
        }
        protected void btnRectangularShapeOnClick(object sender, EventArgs e)
        {
            Page.Validate("mrRectangularShape");
            if (Page.IsValid)
            {
                if (ckbxRehabilitationDataImperial.Checked)
                {
                    Distance distanceRectangularRectangle1LongSide = new Distance(tbxRehabilitationDataRectangle1LongSide.Text);
                    decimal rectangle1LongSide = GetValueInEng3With2Decimals(distanceRectangularRectangle1LongSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle1LongSide.Text = rectangle1LongSide.ToString();

                    Distance distanceRectangularRectangle1ShortSide = new Distance(tbxRehabilitationDataRectangle1ShortSide.Text);
                    decimal rectangle1ShortSide = GetValueInEng3With2Decimals(distanceRectangularRectangle1ShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle1ShortSide.Text = rectangle1ShortSide.ToString();

                    Distance distanceRectangularRectangle1Depth = new Distance(tbxRehabilitationDataRectangle1Depth.Text);
                    decimal rectangle1Depth = GetValueInEng3With2Decimals(distanceRectangularRectangle1Depth.ToStringInEng3());
                    tbxRehabilitationDataRectangle1Depth.Text = rectangle1Depth.ToString();

                    Distance distanceRectangularRectangle2LongSide = new Distance(tbxRehabilitationDataRectangle2LongSide.Text);
                    decimal rectangle2LongSide = GetValueInEng3With2Decimals(distanceRectangularRectangle2LongSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle2LongSide.Text = rectangle2LongSide.ToString();

                    Distance distanceRectangularRectangle2ShortSide = new Distance(tbxRehabilitationDataRectangle2ShortSide.Text);
                    decimal rectangle2ShortSide = GetValueInEng3With2Decimals(distanceRectangularRectangle2ShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle2ShortSide.Text = rectangle2ShortSide.ToString();

                    Distance distanceRectangularRectangle2Depth = new Distance(tbxRehabilitationDataRectangle2Depth.Text);
                    decimal rectangle2Depth = GetValueInEng3With2Decimals(distanceRectangularRectangle2Depth.ToStringInEng3());
                    tbxRehabilitationDataRectangle2Depth.Text = rectangle2Depth.ToString();

                    // Recalculate Rectangle1 floor
                    decimal rectangle1Floor = 0;
                    tbxRehabilitationDataRectangle1Floor.Text = "";
                    if (ckbxRehabilitationDataRectangle1Floor.Checked)
                    {
                        rectangle1Floor = Decimal.Round((rectangle1LongSide * rectangle1ShortSide), 2);
                        Distance floorDistance = new Distance(rectangle1Floor.ToString());
                        tbxRehabilitationDataRectangle1Floor.Text = floorDistance.ToStringInEng3();
                    }

                    // Recalculate Rectangle1 ceiling
                    decimal rectangle1Ceiling = 0;
                    tbxRehabilitationDataRectangle1Ceiling.Text = "";
                    if (ckbxRehabilitationDataRectangle1Ceiling.Checked)
                    {
                        rectangle1Ceiling = Decimal.Round((rectangle1LongSide * rectangle1ShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangle1Ceiling.ToString());
                        tbxRehabilitationDataRectangle1Ceiling.Text = ceilingDistance.ToStringInEng3();

                        //Graphic
                        lblRectangular1CeilingLabel.Text = tbxRehabilitationDataRectangle1Ceiling.Text;
                    }

                    // Recalculate Rectangle1 benching
                    decimal rectangle1Benching = 0;
                    tbxRehabilitationDataRectangle1Benching.Text = "";
                    if (ckbxRehabilitationDataRectangle1Benching.Checked)
                    {
                        rectangle1Benching = Decimal.Round(((rectangle1LongSide * rectangle1ShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangle1Benching.ToString());
                        tbxRehabilitationDataRectangle1Benching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate rectangle 1 surface area
                    decimal rectangle1SurfaceArea = decimal.Round(((rectangle1LongSide * 2) + (rectangle1ShortSide * 2)) * rectangle1Depth, 2);
                    Distance rectangle1SurfaceAreaDistance = new Distance(rectangle1SurfaceArea.ToString());
                    tbxRehabilitationDataRectangle1SurfaceArea.Text = rectangle1SurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Rectangle2 floor
                    decimal rectangle2Floor = 0;
                    tbxRehabilitationDataRectangle2Floor.Text = "";
                    if (ckbxRehabilitationDataRectangle2Floor.Checked)
                    {
                        rectangle2Floor = Decimal.Round((rectangle2LongSide * rectangle2ShortSide), 2);
                        Distance floorDistance = new Distance(rectangle2Floor.ToString());
                        tbxRehabilitationDataRectangle2Floor.Text = floorDistance.ToStringInEng3();
                    }

                    // Recalculate Rectangle2 ceiling
                    decimal rectangle2Ceiling = 0;
                    tbxRehabilitationDataRectangle2Ceiling.Text = "";
                    if (ckbxRehabilitationDataRectangle2Ceiling.Checked)
                    {
                        rectangle2Ceiling = Decimal.Round((rectangle2LongSide * rectangle2ShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangle2Ceiling.ToString());
                        tbxRehabilitationDataRectangle2Ceiling.Text = ceilingDistance.ToStringInEng3();

                        //Graphic
                        lblRectangular2CeilingLabel.Text = tbxRehabilitationDataRectangle2Ceiling.Text;
                    }

                    // Recalculate Rectangle2 benching
                    decimal rectangle2Benching = 0;
                    tbxRehabilitationDataRectangle2Benching.Text = "";
                    if (ckbxRehabilitationDataRectangle2Benching.Checked)
                    {
                        rectangle2Benching = Decimal.Round(((rectangle2LongSide * rectangle2ShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangle2Benching.ToString());
                        tbxRehabilitationDataRectangle2Benching.Text = benchingDistance.ToStringInEng3();
                    }

                    // Recalculate rectangle 2 surface area
                    decimal rectangle2SurfaceArea = decimal.Round(((rectangle2LongSide * 2) + (rectangle2ShortSide * 2)) * rectangle2Depth, 2);
                    Distance rectangle2SurfaceAreaDistance = new Distance(rectangle2SurfaceArea.ToString());
                    tbxRehabilitationDataRectangle2SurfaceArea.Text = rectangle2SurfaceAreaDistance.ToStringInEng3();

                    // Recalculate total depth
                    decimal totalDepth = decimal.Round(rectangle1Depth + rectangle2Depth, 0);
                    Distance totalDepthDistance = new Distance(totalDepth.ToString());
                    tbxRehabilitationDataRectangularTotalDepth.Text = totalDepthDistance.ToStringInEng3();

                    // Recalculate rectangle total surface area
                    decimal totalSurfaceArea = decimal.Round(rectangle1SurfaceArea + rectangle2SurfaceArea + rectangle1Floor + rectangle1Ceiling + rectangle1Benching + rectangle2Floor + rectangle2Ceiling + rectangle2Benching, 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangularTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // Graphic
                    lblRectangular1LongSideLabel.Text = tbxRehabilitationDataRectangle1LongSide.Text;
                    lblRectangular1ShortSideLabel.Text = tbxRehabilitationDataRectangle1ShortSide.Text;
                    lblRectangular1DephtLabel.Text = tbxRehabilitationDataRectangle1Depth.Text;
                    lblRectangle1SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle1SurfaceArea.Text;

                    lblRectangle2LongSideLabel.Text = tbxRehabilitationDataRectangle2LongSide.Text;
                    lblRectangular2ShortSideLabel.Text = tbxRehabilitationDataRectangle2ShortSide.Text;
                    lblRectangular2Depth.Text = tbxRehabilitationDataRectangle2Depth.Text;
                    lblRectangle2SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle2SurfaceArea.Text;

                    lblRectangularTotalDepthLabel.Text = tbxRehabilitationDataRectangularTotalDepth.Text;
                    lblRectangularTotalSurfaceAreaLabel.Text = "Total Surface Area: " + tbxRehabilitationDataRectangularTotalSurfaceArea.Text;

                    // Recalculate Top total surface area
                    decimal rectangle1TotalSurfaceArea = decimal.Round(rectangle1SurfaceArea + rectangle1Floor + rectangle1Ceiling + rectangle1Benching, 2);
                    Distance rectangle1TotalSurfaceAreaDistance = new Distance(rectangle1TotalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangle1TotalSurfaceArea.Text = rectangle1TotalSurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Down total surface area
                    decimal rectangle2TotalSurfaceArea = decimal.Round(rectangle2SurfaceArea + rectangle2Floor + rectangle2Ceiling + rectangle2Benching, 2);
                    Distance rectangle2TotalSurfaceAreaDistance = new Distance(rectangle2TotalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangle2TotalSurfaceArea.Text = rectangle2TotalSurfaceAreaDistance.ToStringInEng3();
                }
                else
                {
                    Distance distanceRectangularRectangle1LongSide = new Distance(tbxRehabilitationDataRectangle1LongSide.Text);
                    decimal rectangle1LongSide = GetValueInEng3With2Decimals(distanceRectangularRectangle1LongSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle1LongSide.Text = distanceRectangularRectangle1LongSide.ToStringInMet2();

                    Distance distanceRectangularRectangle1ShortSide = new Distance(tbxRehabilitationDataRectangle1ShortSide.Text);
                    decimal rectangle1ShortSide = GetValueInEng3With2Decimals(distanceRectangularRectangle1ShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle1ShortSide.Text = distanceRectangularRectangle1ShortSide.ToStringInMet2();

                    Distance distanceRectangularRectangle1Depth = new Distance(tbxRehabilitationDataRectangle1Depth.Text);
                    decimal rectangle1Depth = GetValueInEng3With2Decimals(distanceRectangularRectangle1Depth.ToStringInEng3());
                    tbxRehabilitationDataRectangle1Depth.Text = distanceRectangularRectangle1Depth.ToStringInMet2();

                    Distance distanceRectangularRectangle2LongSide = new Distance(tbxRehabilitationDataRectangle2LongSide.Text);
                    decimal rectangle2LongSide = GetValueInEng3With2Decimals(distanceRectangularRectangle2LongSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle2LongSide.Text = distanceRectangularRectangle2LongSide.ToStringInMet2();

                    Distance distanceRectangularRectangle2ShortSide = new Distance(tbxRehabilitationDataRectangle2ShortSide.Text);
                    decimal rectangle2ShortSide = GetValueInEng3With2Decimals(distanceRectangularRectangle2ShortSide.ToStringInEng3());
                    tbxRehabilitationDataRectangle2ShortSide.Text = distanceRectangularRectangle2ShortSide.ToStringInMet2();

                    Distance distanceRectangularRectangle2Depth = new Distance(tbxRehabilitationDataRectangle2Depth.Text);
                    decimal rectangle2Depth = GetValueInEng3With2Decimals(distanceRectangularRectangle2Depth.ToStringInEng3());
                    tbxRehabilitationDataRectangle2Depth.Text = distanceRectangularRectangle2Depth.ToStringInMet2();

                    // Recalculate Rectangle1 floor
                    decimal rectangle1Floor = 0;
                    tbxRehabilitationDataRectangle1Floor.Text = "";
                    if (ckbxRehabilitationDataRectangle1Floor.Checked)
                    {
                        rectangle1Floor = Decimal.Round((rectangle1LongSide * rectangle1ShortSide), 2);
                        Distance floorDistance = new Distance(rectangle1Floor.ToString());
                        tbxRehabilitationDataRectangle1Floor.Text = floorDistance.ToStringInMet2();
                    }

                    // Recalculate Rectangle1 ceiling
                    decimal rectangle1Ceiling = 0;
                    tbxRehabilitationDataRectangle1Ceiling.Text = "";
                    if (ckbxRehabilitationDataRectangle1Ceiling.Checked)
                    {
                        rectangle1Ceiling = Decimal.Round((rectangle1LongSide * rectangle1ShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangle1Ceiling.ToString());
                        tbxRehabilitationDataRectangle1Ceiling.Text = ceilingDistance.ToStringInMet2();

                        //Graphic
                        lblRectangular1CeilingLabel.Text = tbxRehabilitationDataRectangle1Ceiling.Text;
                    }

                    // Recalculate Rectangle1 benching
                    decimal rectangle1Benching = 0;
                    tbxRehabilitationDataRectangle1Benching.Text = "";
                    if (ckbxRehabilitationDataRectangle1Benching.Checked)
                    {
                        rectangle1Benching = Decimal.Round(((rectangle1LongSide * rectangle1ShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangle1Benching.ToString());
                        tbxRehabilitationDataRectangle1Benching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate rectangle 1 surface area
                    decimal rectangle1SurfaceArea = decimal.Round(((rectangle1LongSide * 2) + (rectangle1ShortSide * 2)) * rectangle1Depth, 2);
                    Distance rectangle1SurfaceAreaDistance = new Distance(rectangle1SurfaceArea.ToString());
                    tbxRehabilitationDataRectangle1SurfaceArea.Text = rectangle1SurfaceAreaDistance.ToStringInMet2();

                    // Recalculate Rectangle2 floor
                    decimal rectangle2Floor = 0;
                    tbxRehabilitationDataRectangle2Floor.Text = "";
                    if (ckbxRehabilitationDataRectangle2Floor.Checked)
                    {
                        rectangle2Floor  = Decimal.Round((rectangle2LongSide * rectangle2ShortSide), 2);
                        Distance floorDistance = new Distance(rectangle2Floor.ToString());
                        tbxRehabilitationDataRectangle2Floor.Text = floorDistance.ToStringInMet2();

                    }

                    // Recalculate Rectangle2 ceiling
                    decimal rectangle2Ceiling = 0;
                    tbxRehabilitationDataRectangle2Ceiling.Text = "";
                    if (ckbxRehabilitationDataRectangle2Ceiling.Checked)
                    {
                        rectangle2Ceiling = Decimal.Round((rectangle2LongSide * rectangle2ShortSide), 2);
                        Distance ceilingDistance = new Distance(rectangle2Ceiling.ToString());
                        tbxRehabilitationDataRectangle2Ceiling.Text = ceilingDistance.ToStringInMet2();

                        //Graphic
                        lblRectangular2CeilingLabel.Text = tbxRehabilitationDataRectangle2Ceiling.Text;
                    }

                    // Recalculate Rectangle2 benching
                    decimal rectangle2Benching = 0;
                    tbxRehabilitationDataRectangle2Benching.Text = "";
                    if (ckbxRehabilitationDataRectangle2Benching.Checked)
                    {
                        rectangle2Benching = Decimal.Round(((rectangle2LongSide * rectangle2ShortSide) * decimal.Parse("0.06")), 2);
                        Distance benchingDistance = new Distance(rectangle2Benching.ToString());
                        tbxRehabilitationDataRectangle2Benching.Text = benchingDistance.ToStringInMet2();
                    }

                    // Recalculate rectangle 2 surface area
                    decimal rectangle2SurfaceArea = decimal.Round(((rectangle2LongSide * 2) + (rectangle2ShortSide * 2)) * rectangle2Depth, 2);
                    Distance rectangle2SurfaceAreaDistance = new Distance(rectangle2SurfaceArea.ToString());
                    tbxRehabilitationDataRectangle2SurfaceArea.Text = rectangle2SurfaceAreaDistance.ToStringInMet2();

                    // Recalculate total depth
                    decimal totalDepth = decimal.Round(rectangle1Depth + rectangle2Depth, 0);
                    Distance totalDepthDistance = new Distance(totalDepth.ToString());
                    tbxRehabilitationDataRectangularTotalDepth.Text = totalDepthDistance.ToStringInMet2();

                    // Recalculate rectangle total surface area
                    decimal totalSurfaceArea = decimal.Round(rectangle1SurfaceArea + rectangle2SurfaceArea + rectangle1Floor + rectangle1Ceiling + rectangle1Benching + rectangle2Floor + rectangle2Ceiling + rectangle2Benching, 0);
                    Distance totalSurfaceAreaDistance = new Distance(totalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangularTotalSurfaceArea.Text = totalSurfaceAreaDistance.ToStringInEng3();

                    // Graphic
                    lblRectangular1LongSideLabel.Text = tbxRehabilitationDataRectangle1LongSide.Text;
                    lblRectangular1ShortSideLabel.Text = tbxRehabilitationDataRectangle1ShortSide.Text;
                    lblRectangular1DephtLabel.Text = tbxRehabilitationDataRectangle1Depth.Text;
                    lblRectangle1SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle1SurfaceArea.Text;

                    lblRectangle2LongSideLabel.Text = tbxRehabilitationDataRectangle2LongSide.Text;
                    lblRectangular2ShortSideLabel.Text = tbxRehabilitationDataRectangle2ShortSide.Text;
                    lblRectangular2Depth.Text = tbxRehabilitationDataRectangle2Depth.Text;
                    lblRectangle2SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle2SurfaceArea.Text;

                    lblRectangularTotalDepthLabel.Text = tbxRehabilitationDataRectangularTotalDepth.Text;
                    lblRectangularTotalSurfaceAreaLabel.Text = "Total Surface Area: " + tbxRehabilitationDataRectangularTotalSurfaceArea.Text;

                    // Recalculate Top total surface area
                    decimal rectangle1TotalSurfaceArea = decimal.Round(rectangle1SurfaceArea + rectangle1Floor + rectangle1Ceiling + rectangle1Benching, 2);
                    Distance rectangle1TotalSurfaceAreaDistance = new Distance(rectangle1TotalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangle1TotalSurfaceArea.Text = rectangle1TotalSurfaceAreaDistance.ToStringInEng3();

                    // Recalculate Down total surface area
                    decimal rectangle2TotalSurfaceArea = decimal.Round(rectangle2SurfaceArea + rectangle2Floor + rectangle2Ceiling + rectangle2Benching, 2);
                    Distance rectangle2TotalSurfaceAreaDistance = new Distance(rectangle2TotalSurfaceArea.ToString());
                    tbxRehabilitationDataRectangle2TotalSurfaceArea.Text = rectangle2TotalSurfaceAreaDistance.ToStringInEng3();
                }
            }
        }
Example #4
0
        // ////////////////////////////////////////////////////////////////////////
        // PRIVATE METHODS
        //
        /// <summary>
        /// UpdateForReport
        /// </summary>
        /// <param name="unitType">unitType</param>
        private void UpdateForReport(string unitType)
        {
            // Load comments
            foreach (FlM1ReportTDS.M1ReportByClientRow row in (FlM1ReportTDS.M1ReportByClientDataTable)Table)
            {
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByWorkId(row.WorkID, row.COMPANY_ID);
                row.M1Comments = workGateway.GetComments(row.WorkID);
            }

            // Update for unit type
            FlM1LateralReportGateway flM1LateralReportGateway = new FlM1LateralReportGateway(Data);
            flM1LateralReportGateway.ClearBeforeFill = false;
            FlM1LateralReport flM1LateralReport = new FlM1LateralReport(Data);

            foreach (FlM1ReportTDS.M1ReportByClientRow row in (FlM1ReportTDS.M1ReportByClientDataTable)Table)
            {
                if (!row.IsM1CommentsNull())
                {
                    row.M1Comments = row.M1Comments.Replace("<br>", "\n");
                }

                Distance d;

                if (unitType == "Metric")
                {
                    if (!row.IsSize_Null())
                    {
                        if (Distance.IsValidDistance(row.Size_))
                        {
                            d = new Distance(row.Size_);
                            row.Size_ = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsLengthNull())
                    {
                        if (Distance.IsValidDistance(row.Length))
                        {
                            d = new Distance(row.Length);
                            row.Length = d.ToStringInMet2();
                        }
                    }

                    if (!row.IsUSMHDepthNull())
                    {
                        if (Distance.IsValidDistance(row.USMHDepth))
                        {
                            d = new Distance(row.USMHDepth);
                            row.USMHDepth = d.ToStringInMet2();
                        }
                    }

                    if (!row.IsDSMHDepthNull())
                    {
                        if (Distance.IsValidDistance(row.DSMHDepth))
                        {
                            d = new Distance(row.DSMHDepth);
                            row.DSMHDepth = d.ToStringInMet2();
                        }
                    }

                    if (!row.IsUSMHMouth12Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth12))
                        {
                            d = new Distance(row.USMHMouth12);
                            row.USMHMouth12 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsUSMHMouth1Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth1))
                        {
                            d = new Distance(row.USMHMouth1);
                            row.USMHMouth1 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsUSMHMouth2Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth2))
                        {
                            d = new Distance(row.USMHMouth2);
                            row.USMHMouth2 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsUSMHMouth3Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth3))
                        {
                            d = new Distance(row.USMHMouth3);
                            row.USMHMouth3 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsUSMHMouth4Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth4))
                        {
                            d = new Distance(row.USMHMouth4);
                            row.USMHMouth4 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsUSMHMouth5Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth5))
                        {
                            d = new Distance(row.USMHMouth5);
                            row.USMHMouth5 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth12Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth12))
                        {
                            d = new Distance(row.DSMHMouth12);
                            row.DSMHMouth12 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth1Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth1))
                        {
                            d = new Distance(row.DSMHMouth1);
                            row.DSMHMouth1 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth2Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth2))
                        {
                            d = new Distance(row.DSMHMouth2);
                            row.DSMHMouth2 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth3Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth3))
                        {
                            d = new Distance(row.DSMHMouth3);
                            row.DSMHMouth3 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth4Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth4))
                        {
                            d = new Distance(row.DSMHMouth4);
                            row.DSMHMouth4 = d.ToStringInMil2();
                        }
                    }

                    if (!row.IsDSMHMouth5Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth5))
                        {
                            d = new Distance(row.DSMHMouth5);
                            row.DSMHMouth5 = d.ToStringInMil2();
                        }
                    }
                }

                if (unitType == "Imperial")
                {
                    if (!row.IsSize_Null())
                    {
                        if (Distance.IsValidDistance(row.Size_))
                        {
                            Distance distance = new Distance(row.Size_);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.Size_) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.Size_) * 0.03937;
                                            row.Size_ = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.Size_ = row.Size_ + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsLengthNull())
                    {
                        d = new Distance(row.Length);
                        row.Length = d.ToStringInEng1();
                    }

                    if (!row.IsUSMHDepthNull())
                    {
                        if (Distance.IsValidDistance(row.USMHDepth))
                        {
                            Distance distance = new Distance(row.USMHDepth);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHDepth = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.Size_) > 99)
                                        {
                                            double newUSMHDepth = 0;
                                            newUSMHDepth = Convert.ToDouble(row.Size_) * 0.03937;
                                            row.USMHDepth = Convert.ToString(Math.Ceiling(newUSMHDepth)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHDepth = row.USMHDepth + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHDepth = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHDepth = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHDepthNull())
                    {
                        if (Distance.IsValidDistance(row.DSMHDepth))
                        {
                            Distance distance = new Distance(row.DSMHDepth);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHDepth = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.Size_) > 99)
                                        {
                                            double newDSMHDepth = 0;
                                            newDSMHDepth = Convert.ToDouble(row.Size_) * 0.03937;
                                            row.DSMHDepth = Convert.ToString(Math.Ceiling(newDSMHDepth)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHDepth = row.USMHDepth + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHDepth = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHDepth = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth12Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth12))
                        {
                            Distance distance = new Distance(row.USMHMouth12);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth12 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth12) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth12) * 0.03937;
                                            row.USMHMouth12 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth12 = row.USMHMouth12 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth12 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth12 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth1Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth1))
                        {
                            Distance distance = new Distance(row.USMHMouth1);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth1 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth1) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth1) * 0.03937;
                                            row.USMHMouth1 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth1 = row.USMHMouth1 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth1 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth1 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth2Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth2))
                        {
                            Distance distance = new Distance(row.USMHMouth2);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth2 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth2) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth2) * 0.03937;
                                            row.USMHMouth2 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth2 = row.USMHMouth2 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth2 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth2 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth3Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth3))
                        {
                            Distance distance = new Distance(row.USMHMouth3);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth3 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth3) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth3) * 0.03937;
                                            row.USMHMouth3 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth3 = row.USMHMouth3 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth3 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth3 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth4Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth4))
                        {
                            Distance distance = new Distance(row.USMHMouth4);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth4 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth4) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth4) * 0.03937;
                                            row.USMHMouth4 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth4 = row.USMHMouth4 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth4 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth4 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsUSMHMouth5Null())
                    {
                        if (Distance.IsValidDistance(row.USMHMouth5))
                        {
                            Distance distance = new Distance(row.USMHMouth5);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.USMHMouth5 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.USMHMouth5) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.USMHMouth5) * 0.03937;
                                            row.USMHMouth5 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.USMHMouth5 = row.USMHMouth5 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.USMHMouth5 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.USMHMouth5 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth12Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth12))
                        {
                            Distance distance = new Distance(row.DSMHMouth12);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth12 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth12) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth12) * 0.03937;
                                            row.DSMHMouth12 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth12 = row.DSMHMouth12 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth12 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth12 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth1Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth1))
                        {
                            Distance distance = new Distance(row.DSMHMouth1);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth1 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth1) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth1) * 0.03937;
                                            row.DSMHMouth1 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth1 = row.DSMHMouth1 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth1 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth1 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth2Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth2))
                        {
                            Distance distance = new Distance(row.DSMHMouth2);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth2 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth2) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth2) * 0.03937;
                                            row.DSMHMouth2 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth2 = row.DSMHMouth2 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth2 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth2 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth3Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth3))
                        {
                            Distance distance = new Distance(row.DSMHMouth3);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth3 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth3) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth3) * 0.03937;
                                            row.DSMHMouth3 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth3 = row.DSMHMouth3 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth3 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth3 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth4Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth4))
                        {
                            Distance distance = new Distance(row.DSMHMouth4);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth4 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth4) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth4) * 0.03937;
                                            row.DSMHMouth4 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth4 = row.DSMHMouth4 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth4 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth4 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsDSMHMouth5Null())
                    {
                        if (Distance.IsValidDistance(row.DSMHMouth5))
                        {
                            Distance distance = new Distance(row.DSMHMouth5);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.DSMHMouth5 = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    try
                                    {
                                        if (Convert.ToDouble(row.DSMHMouth5) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.DSMHMouth5) * 0.03937;
                                            row.DSMHMouth5 = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.DSMHMouth5 = row.DSMHMouth5 + "\"";
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    break;
                                case 4:
                                    row.DSMHMouth5 = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.DSMHMouth5 = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }
                }

                flM1LateralReportGateway.LoadByAssetId(row.AssetID, row.COMPANY_ID);
                flM1LateralReport.UpdateForReport(row.FlowOrderID, unitType);
            }
        }
Example #5
0
        // ////////////////////////////////////////////////////////////////////////
        // PRIVATE METHODS
        //
        /// <summary>
        /// UpdateForReport
        /// </summary>
        /// <param name="unitType">unitType</param>
        public void UpdateForReport(string unitType)
        {
            // Load comments
            foreach (FlM1ReportTDS.M2_SECTIONRow row in (FlM1ReportTDS.M2_SECTIONDataTable)Table)
            {
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByWorkId(row.WorkID, row.COMPANY_ID);

                row.Comments = workGateway.GetComments(row.WorkID);

                Distance d;

                if (unitType == "Metric")
                {
                    if (!row.IsSize_Null())
                    {
                        d = new Distance(row.Size_);
                        row.Size_ = d.ToStringInMet2();
                    }

                    if (!row.IsVideoLengthNull())
                    {
                        d = new Distance(row.VideoLength);
                        row.VideoLength = d.ToStringInMet2();
                    }

                    if (!row.IsSurfaceGradeNull())
                    {
                        if (row.SurfaceGrade == "0-3 ft")
                        {
                            row.SurfaceGrade = "0-0.91 m";
                        }

                        if (row.SurfaceGrade == "3-6 ft")
                        {
                            row.SurfaceGrade = "0.91-1.83 m";
                        }

                        if (row.SurfaceGrade == "6 ft +")
                        {
                            row.SurfaceGrade = "1.83 m +";
                        }
                    }
                }

                if (unitType == "Imperial")
                {
                    if (!row.IsSize_Null())
                    {
                        if (Distance.IsValidDistance(row.Size_))
                        {
                            Distance distance = new Distance(row.Size_);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    if (Convert.ToDouble(row.Size_) > 99)
                                    {
                                        double newSize_ = 0;
                                        newSize_ = Convert.ToDouble(row.Size_) * 0.03937;
                                        row.Size_ = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                    }
                                    else
                                    {
                                        row.Size_ = row.Size_ + "\"";
                                    }
                                    break;
                                case 4:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.Size_ = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }

                    if (!row.IsVideoLengthNull())
                    {
                        d = new Distance(row.VideoLength);
                        row.VideoLength = d.ToStringInEng1();
                    }
                }
            }

            // Update for unit type
            //foreach (FlM1ReportTDS.M2_SECTIONRow row in (FlM1ReportTDS.M2_SECTIONDataTable)Table)
            //{
                //Distance d;

                //if (unitType == "Metric")
                //{
                //    if (!row.IsSize_Null())
                //    {
                //        d = new Distance(row.Size_);
                //        row.Size_ = d.ToStringInMet2();
                //    }

                //    if (!row.IsVideoLengthNull())
                //    {
                //        d = new Distance(row.VideoLength);
                //        row.VideoLength = d.ToStringInMet2();
                //    }

                //    if (!row.IsSurfaceGradeNull())
                //    {
                //        if (row.SurfaceGrade == "0-3 ft")
                //        {
                //            row.SurfaceGrade = "0-0.91 m";
                //        }

                //        if (row.SurfaceGrade == "3-6 ft")
                //        {
                //            row.SurfaceGrade = "0.91-1.83 m";
                //        }

                //        if (row.SurfaceGrade == "6 ft +")
                //        {
                //            row.SurfaceGrade = "1.83 m +";
                //        }
                //    }
                //}

                //if (unitType == "Imperial")
                //{
                //    if (!row.IsSize_Null())
                //    {
                //        if (Distance.IsValidDistance(row.Size_))
                //        {
                //            Distance distance = new Distance(row.Size_);

                //            switch (distance.DistanceType)
                //            {
                //                case 2:
                //                    row.Size_ = distance.ToStringInEng1();
                //                    break;
                //                case 3:
                //                    if (Convert.ToDouble(row.Size_) > 99)
                //                    {
                //                        double newSize_ = 0;
                //                        newSize_ = Convert.ToDouble(row.Size_) * 0.03937;
                //                        row.Size_ = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                //                    }
                //                    else
                //                    {
                //                        row.Size_ = row.Size_ + "\"";
                //                    }
                //                    break;
                //                case 4:
                //                    row.Size_ = distance.ToStringInEng1();
                //                    break;
                //                case 5:
                //                    row.Size_ = distance.ToStringInEng1();
                //                    break;
                //            }
                //        }
                //    }

                //    if (!row.IsVideoLengthNull())
                //    {
                //        d = new Distance(row.VideoLength);
                //        row.VideoLength = d.ToStringInEng1();
                //    }
                //}
            //}
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// UpdateForReport
        /// </summary>
        /// <param name="flowOrderId">flowOrderId</param>
        /// <param name="unitType">unitType</param>
        public void UpdateForReport(string flowOrderId, string unitType)
        {
            foreach (FlM1ReportTDS.M1_LATERALRow row in (FlM1ReportTDS.M1_LATERALDataTable)Table)
            {
                Distance d;

                if (!row.IsVideoDistanceNull())
                {
                    if (Distance.IsValidDistance(row.VideoDistance))
                    {
                        d = new Distance(row.VideoDistance);

                        try
                        {
                            row.VideoDistanceDouble = d.ToDoubleInEng3();
                        }
                        catch
                        {
                            row.VideoDistanceDouble = Convert.ToDouble(row.VideoDistance);
                        }
                    }
                }

                if (!row.IsCommentsNull())
                {
                    row.Comments = row.Comments.Replace("<br>", "\n");
                }

                if (unitType == "Metric")
                {
                    if (!row.IsDistanceFromUSMHNull())
                    {
                        d = new Distance(row.DistanceFromUSMH);
                        row.DistanceFromUSMH = d.ToStringInMet2();
                    }

                    if (!row.IsDistanceFromDSMHNull())
                    {
                        d = new Distance(row.DistanceFromDSMH);
                        row.DistanceFromDSMH = d.ToStringInMet2();
                    }

                    if (!row.IsVideoDistanceNull())
                    {
                        d = new Distance(row.VideoDistance);
                        row.VideoDistance = d.ToStringInMet2();
                    }

                    if (!row.IsDistanceToCentreNull())
                    {
                        d = new Distance(row.DistanceToCentre);
                        row.DistanceToCentre = d.ToStringInMet2();
                    }

                    if (!row.IsReverseSetupNull())
                    {
                        d = new Distance(row.ReverseSetup);
                        row.ReverseSetup = d.ToStringInMet2();
                    }

                    if (!row.IsSize_Null())
                    {
                        if (Distance.IsValidDistance(row.Size_))
                        {
                            d = new Distance(row.Size_);
                            row.Size_ = d.ToStringInMet2();
                        }
                    }
                }

                if (unitType == "Imperial")
                {
                    if (!row.IsDistanceFromUSMHNull())
                    {
                        d = new Distance(row.DistanceFromUSMH);
                        row.DistanceFromUSMH = d.ToStringInEng1();
                    }

                    if (!row.IsDistanceFromDSMHNull())
                    {
                        d = new Distance(row.DistanceFromDSMH);
                        row.DistanceFromDSMH = d.ToStringInEng1();
                    }

                    if (!row.IsVideoDistanceNull())
                    {
                        d = new Distance(row.VideoDistance);
                        row.VideoDistance = d.ToStringInEng1();
                    }

                    if (!row.IsDistanceToCentreNull())
                    {
                        d = new Distance(row.DistanceToCentre);
                        row.DistanceToCentre = d.ToStringInEng1();
                    }

                    if (!row.IsReverseSetupNull())
                    {
                        d = new Distance(row.ReverseSetup);
                        row.ReverseSetup = d.ToStringInEng1();
                    }

                    if (!row.IsSize_Null())
                    {
                        try
                        {
                            if (Distance.IsValidDistance(row.Size_))                            {

                                Distance distance = new Distance(row.Size_);

                                switch (distance.DistanceType)
                                {
                                    case 2:
                                        row.Size_ = distance.ToStringInEng1();
                                        break;
                                    case 3:
                                        if (Convert.ToDouble(row.Size_) > 99)
                                        {
                                            double newSize_ = 0;
                                            newSize_ = Convert.ToDouble(row.Size_) * 0.03937;
                                            row.Size_ = Convert.ToString(Math.Ceiling(newSize_)) + "\"";
                                        }
                                        else
                                        {
                                            row.Size_ = row.Size_ + "\"";
                                        }
                                        break;
                                    case 4:
                                        row.Size_ = distance.ToStringInEng1();
                                        break;
                                    case 5:
                                        row.Size_ = distance.ToStringInEng1();
                                        break;
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }

                // Update flow order
                if (row.FlowOrderIDLateralID == "")
                {
                    row.FlowOrderIDLateralID = flowOrderId + "-FL-" + row.LateralID;
                }
            }
        }