private void LoadManholeStructureData(int assetId)
        {
            ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeRehabilitationTDS);
            if (manholeRehabilitationManholeDetailsGateway.Table.Rows.Count > 0)
            {
                // ... Round shape
                // ... ... Chimney
                tbxRehabilitationDataChimneyDiameter.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId)));
                lblRoudChimneyDiameterLabel.Text = tbxRehabilitationDataChimneyDiameter.Text;
                tbxRehabilitationDataChimneyDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId)));
                lblRoudChimneyDepthLabel.Text = tbxRehabilitationDataChimneyDepth.Text;

                ckbxRehabilitationDataChimneyFloor.Checked = false;
                tbxRehabilitationDataChimneyFloor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
                {
                    ckbxRehabilitationDataChimneyFloor.Checked = true;
                    tbxRehabilitationDataChimneyFloor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId)));
                }

                ckbxRehabilitationDataChimneyCeiling.Checked = false;
                tbxRehabilitationDataChimneyCeiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataChimneyCeiling.Checked = true;
                    tbxRehabilitationDataChimneyCeiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId)));
                    lblRoudChimneyCeilingLabel.Text = tbxRehabilitationDataChimneyCeiling.Text;
                }

                ckbxRehabilitationDataChimneyBenching.Checked = false;
                tbxRehabilitationDataChimneyBenching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
                {
                    ckbxRehabilitationDataChimneyBenching.Checked = true;
                    tbxRehabilitationDataChimneyBenching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId)));
                }

                tbxRehabilitationDataChimneySurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId)));
                lblRoundChimneySurfaceAreaLabel.Text = tbxRehabilitationDataChimneySurfaceArea.Text;

                // ... ... Barrel
                tbxRehabilitationDataBarrelDiameter.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownDiameter(assetId)));
                lblRoudBarrelDiameterLabel.Text = tbxRehabilitationDataBarrelDiameter.Text;
                tbxRehabilitationDataBarrelDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId)));
                lblRoudBarrelDepthLabel.Text = tbxRehabilitationDataBarrelDepth.Text;

                ckbxRehabilitationDataBarrelFloor.Checked = false;
                tbxRehabilitationDataBarrelFloor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
                {
                    ckbxRehabilitationDataBarrelFloor.Checked = true;
                    tbxRehabilitationDataBarrelFloor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId)));
                }

                ckbxRehabilitationDataBarrelCeiling.Checked = false;
                tbxRehabilitationDataBarrelCeiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataBarrelCeiling.Checked = true;
                    tbxRehabilitationDataBarrelCeiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId)));
                    lblRoundBarrelCeilingLabel.Text = tbxRehabilitationDataBarrelCeiling.Text;
                }

                ckbxRehabilitationDataBarrelBenching.Checked = false;
                tbxRehabilitationDataBarrelBenching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
                {
                    ckbxRehabilitationDataBarrelBenching.Checked = true;
                    tbxRehabilitationDataBarrelBenching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId)));
                }

                tbxRehabilitationDataBarrelSurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId)));
                lblRoundBarrelSurfaceAreaLabel.Text = tbxRehabilitationDataBarrelSurfaceArea.Text;

                if (manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).HasValue)
                {
                    ddlRehabilitationDataRoundManholeRugs.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();
                }
                else
                {
                    ddlRehabilitationDataRoundManholeRugs.SelectedIndex = 1;
                }

                // ... ... Totals
                tbxRehabilitationDataRoundTotalDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId)));
                lblRoundTotalDepthLabel.Text = tbxRehabilitationDataRoundTotalDepth.Text;
                tbxRehabilitationDataRoundTotalSurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId)));
                lblRoundTotalSurfaceArea.Text = tbxRehabilitationDataRoundTotalSurfaceArea.Text;

                // ... Rectangular Shape
                // ... ... Rectangular 1
                tbxRehabilitationDataRectangle1LongSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSide(assetId)));
                lblRectangular1LongSideLabel.Text = tbxRehabilitationDataRectangle1LongSide.Text;
                tbxRehabilitationDataRectangle1ShortSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSide(assetId)));
                lblRectangular1ShortSideLabel.Text = tbxRehabilitationDataRectangle1ShortSide.Text;
                tbxRehabilitationDataRectangle1Depth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId)));
                lblRectangular1DephtLabel.Text = tbxRehabilitationDataRectangle1Depth.Text;

                ckbxRehabilitationDataRectangle1Floor.Checked = false;
                tbxRehabilitationDataRectangle1Floor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle1Floor.Checked = true;
                    tbxRehabilitationDataRectangle1Floor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId)));
                }

                ckbxRehabilitationDataRectangle1Ceiling.Checked = false;
                tbxRehabilitationDataRectangle1Ceiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle1Ceiling.Checked = true;
                    tbxRehabilitationDataRectangle1Ceiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId)));
                    lblRectangular1CeilingLabel.Text = tbxRehabilitationDataRectangle1Ceiling.Text;
                }

                ckbxRehabilitationDataRectangle1Benching.Checked = false;
                tbxRehabilitationDataRectangle1Benching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle1Benching.Checked = true;
                    tbxRehabilitationDataRectangle1Benching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId)));
                }

                tbxRehabilitationDataRectangle1SurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId)));
                lblRectangle1SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle1SurfaceArea.Text;

                // ... ... Rectangular 2
                tbxRehabilitationDataRectangle2LongSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId)));
                lblRectangle2LongSideLabel.Text = tbxRehabilitationDataRectangle2LongSide.Text;
                tbxRehabilitationDataRectangle2ShortSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId)));
                lblRectangular2ShortSideLabel.Text = tbxRehabilitationDataRectangle2ShortSide.Text;
                tbxRehabilitationDataRectangle2Depth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId)));
                lblRectangular2Depth.Text = tbxRehabilitationDataRectangle2Depth.Text;

                ckbxRehabilitationDataRectangle2Floor.Checked = false;
                tbxRehabilitationDataRectangle2Floor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle2Floor.Checked = true;
                    tbxRehabilitationDataRectangle2Floor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId)));
                }

                ckbxRehabilitationDataRectangle2Ceiling.Checked = false;
                tbxRehabilitationDataRectangle2Ceiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle2Ceiling.Checked = true;
                    tbxRehabilitationDataRectangle2Ceiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId)));
                    lblRectangular2CeilingLabel.Text = tbxRehabilitationDataRectangle2Ceiling.Text;
                }

                ckbxRehabilitationDataRectangle2Benching.Checked = false;
                tbxRehabilitationDataRectangle2Benching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
                {
                    ckbxRehabilitationDataRectangle2Benching.Checked = true;
                    tbxRehabilitationDataRectangle2Benching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId)));
                }

                tbxRehabilitationDataRectangle2SurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId)));
                lblRectangle2SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle2SurfaceArea.Text;

                if (manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).HasValue)
                {
                    ddlRehabilitationDataRectangularManholeRugs.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();
                }
                else
                {
                    ddlRehabilitationDataRectangularManholeRugs.SelectedIndex = 1;
                }

                // ... ... Totals
                tbxRehabilitationDataRectangularTotalDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId)));
                lblRectangularTotalDepthLabel.Text = tbxRehabilitationDataRectangularTotalDepth.Text;
                tbxRehabilitationDataRectangularTotalSurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId)));
                lblRectangularTotalSurfaceAreaLabel.Text = tbxRehabilitationDataRectangularTotalSurfaceArea.Text;

                // ... Mix Shape
                // ... ... Top
                tbxRehabilitationDataRoundDiameter.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId)));
                lblDataRoundDiameterLabel.Text = tbxRehabilitationDataRoundDiameter.Text;
                tbxRehabilitationDataRoundDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId)));
                lblDataRoundDepthLabel.Text = tbxRehabilitationDataRoundDepth.Text;

                ckbxRehabilitationDataRoundFloor.Checked = false;
                tbxRehabilitationDataRoundFloor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
                {
                    ckbxRehabilitationDataRoundFloor.Checked = true;
                    tbxRehabilitationDataRoundFloor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId)));
                }

                ckbxRehabilitationDataRoundCeiling.Checked = false;
                tbxRehabilitationDataRoundCeiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataRoundCeiling.Checked = true;
                    tbxRehabilitationDataRoundCeiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId)));
                    lblDataRoundCeilingLabel.Text = tbxRehabilitationDataRoundCeiling.Text;
                }

                ckbxRehabilitationDataRoundBenching.Checked = false;
                tbxRehabilitationDataRoundBenching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
                {
                    ckbxRehabilitationDataRoundBenching.Checked = true;
                    tbxRehabilitationDataRoundBenching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId)));
                }

                tbxRehabilitationDataRoundSurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId)));
                lblDataRoundSurfaceAreaLabel.Text = tbxRehabilitationDataRoundSurfaceArea.Text;

                // ... ... Down
                tbxRehabilitationDataRectangleLongSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId)));
                lblRectangleLongSideLabel.Text = tbxRehabilitationDataRectangleLongSide.Text;
                tbxRehabilitationDataRectangleShortSide.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId)));
                lblRectangleShortSideLabel.Text = tbxRehabilitationDataRectangleShortSide.Text;
                tbxRehabilitationDataRectangleDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId)));
                lblRectangleDephtLabel.Text = tbxRehabilitationDataRectangleDepth.Text;

                ckbxRehabilitationDataRectangleFloor.Checked = false;
                tbxRehabilitationDataRectangleFloor.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
                {
                    ckbxRehabilitationDataRectangleFloor.Checked = true;
                    tbxRehabilitationDataRectangleFloor.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId)));
                }

                ckbxRehabilitationDataRectangleCeiling.Checked = false;
                tbxRehabilitationDataRectangleCeiling.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
                {
                    ckbxRehabilitationDataRectangleCeiling.Checked = true;
                    tbxRehabilitationDataRectangleCeiling.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId)));
                    lblRectangleCeilingLabel.Text = tbxRehabilitationDataRectangleCeiling.Text;
                }

                ckbxRehabilitationDataRectangleBenching.Checked = false;
                tbxRehabilitationDataRectangleBenching.Text = "";
                if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
                {
                    ckbxRehabilitationDataRectangleBenching.Checked = true;
                    tbxRehabilitationDataRectangleBenching.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId)));
                }

                tbxRehabilitationDataRectangleSufaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId)));
                lblRectangleSurfaceAreaLabel.Text = tbxRehabilitationDataRectangleSufaceArea.Text;

                if (manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).HasValue)
                {
                    ddlRehabilitationDataMixManholeRugs.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();
                }
                else
                {
                    ddlRehabilitationDataMixManholeRugs.SelectedIndex = 1;
                }

                // ... ... Totals
                tbxRehabilitationDataMixedTotalDepth.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId)));
                lblMixedTotalDepthLabel.Text = tbxRehabilitationDataMixedTotalDepth.Text;
                tbxRehabilitationDataMixedTotalSurfaceArea.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId)));
                lblTotalMixedSurfaceAreaLabel.Text = tbxRehabilitationDataMixedTotalSurfaceArea.Text;

                // ... Other shape
                tbxRehabilitationDataOtherStructure.Text = GetDistance(new Distance(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId)));
            }
        }
        private void LoadManholeStructureDataForChange(int assetId)
        {
            ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeRehabilitationTDS);
            if (manholeRehabilitationManholeDetailsGateway.Table.Rows.Count > 0)
            {
                // Load manhole structure information
                if (hdfSavedShape.Value == ddlShape.SelectedValue)
                {
                    LoadManholeStructureData(assetId);
                }
                else
                {
                    // ... Round shape
                    // ... ... Chimney
                    tbxRehabilitationDataChimneyDiameter.Text = "";
                    tbxRehabilitationDataChimneyDepth.Text = "";
                    ckbxRehabilitationDataChimneyFloor.Checked = false;
                    tbxRehabilitationDataChimneyFloor.Text = "";
                    ckbxRehabilitationDataChimneyCeiling.Checked = false;
                    tbxRehabilitationDataChimneyCeiling.Text = "";
                    ckbxRehabilitationDataChimneyBenching.Checked = false;
                    tbxRehabilitationDataChimneyBenching.Text = "";
                    tbxRehabilitationDataChimneySurfaceArea.Text = "";

                    // ... ... Barrel
                    tbxRehabilitationDataBarrelDiameter.Text = "";
                    tbxRehabilitationDataBarrelDepth.Text = "";
                    ckbxRehabilitationDataBarrelFloor.Checked = false;
                    tbxRehabilitationDataBarrelFloor.Text = "";
                    ckbxRehabilitationDataBarrelCeiling.Checked = false;
                    tbxRehabilitationDataBarrelCeiling.Text = "";
                    ckbxRehabilitationDataBarrelBenching.Checked = false;
                    tbxRehabilitationDataBarrelBenching.Text = "";
                    tbxRehabilitationDataBarrelSurfaceArea.Text = "";
                    ddlRehabilitationDataRoundManholeRugs.SelectedIndex = 1;

                    // ... ... Totals
                    tbxRehabilitationDataRoundTotalDepth.Text = "";
                    tbxRehabilitationDataRoundTotalSurfaceArea.Text = "";

                    // ... Rectangular Shape
                    // ... ... Rectangular 1
                    tbxRehabilitationDataRectangle1LongSide.Text = "";
                    tbxRehabilitationDataRectangle1ShortSide.Text = "";
                    tbxRehabilitationDataRectangle1Depth.Text = "";
                    ckbxRehabilitationDataRectangle1Floor.Checked = false;
                    tbxRehabilitationDataRectangle1Floor.Text = "";
                    ckbxRehabilitationDataRectangle1Ceiling.Checked = false;
                    tbxRehabilitationDataRectangle1Ceiling.Text = "";
                    ckbxRehabilitationDataRectangle1Benching.Checked = false;
                    tbxRehabilitationDataRectangle1Benching.Text = "";
                    tbxRehabilitationDataRectangle1SurfaceArea.Text = "";

                    // ... ... Rectangular 2
                    tbxRehabilitationDataRectangle2LongSide.Text = "";
                    tbxRehabilitationDataRectangle2ShortSide.Text = "";
                    tbxRehabilitationDataRectangle2Depth.Text = "";
                    ckbxRehabilitationDataRectangle2Floor.Checked = false;
                    tbxRehabilitationDataRectangle2Floor.Text = "";
                    ckbxRehabilitationDataRectangle2Ceiling.Checked = false;
                    tbxRehabilitationDataRectangle2Ceiling.Text = "";
                    ckbxRehabilitationDataRectangle2Benching.Checked = false;
                    tbxRehabilitationDataRectangle2Benching.Text = "";
                    tbxRehabilitationDataRectangle2SurfaceArea.Text = "";
                    ddlRehabilitationDataRectangularManholeRugs.SelectedIndex = 1;

                    // ... ... Totals
                    tbxRehabilitationDataRectangularTotalDepth.Text = "";
                    tbxRehabilitationDataRectangularTotalSurfaceArea.Text = "";

                    // ... Mix Shape
                    // ... ... Top
                    tbxRehabilitationDataRoundDiameter.Text = "";
                    tbxRehabilitationDataRoundDepth.Text = "";
                    ckbxRehabilitationDataRoundFloor.Checked = false;
                    tbxRehabilitationDataRoundFloor.Text = "";
                    ckbxRehabilitationDataRoundCeiling.Checked = false;
                    tbxRehabilitationDataRoundCeiling.Text = "";
                    ckbxRehabilitationDataRoundBenching.Checked = false;
                    tbxRehabilitationDataRoundBenching.Text = "";
                    tbxRehabilitationDataRoundSurfaceArea.Text = "";

                    // ... ... Down
                    tbxRehabilitationDataRectangleLongSide.Text = "";
                    tbxRehabilitationDataRectangleShortSide.Text = "";
                    tbxRehabilitationDataRectangleDepth.Text = "";
                    ckbxRehabilitationDataRectangleFloor.Checked = false;
                    tbxRehabilitationDataRectangleFloor.Text = "";
                    ckbxRehabilitationDataRectangleCeiling.Checked = false;
                    tbxRehabilitationDataRectangleCeiling.Text = "";
                    ckbxRehabilitationDataRectangleBenching.Checked = false;
                    tbxRehabilitationDataRectangleBenching.Text = "";
                    tbxRehabilitationDataRectangleSufaceArea.Text = "";
                    ddlRehabilitationDataMixManholeRugs.SelectedIndex = 1;

                    // ... ... Totals
                    tbxRehabilitationDataMixedTotalDepth.Text = "";
                    tbxRehabilitationDataMixedTotalSurfaceArea.Text = "";

                    // ... Other shape
                    tbxRehabilitationDataOtherStructure.Text = "";

                    // ... graphic
                    lblRoudChimneyDiameterLabel.Text = "";
                    lblRoudChimneyCeilingLabel.Text = "";
                    lblRoudChimneyDepthLabel.Text = "";
                    lblRoundChimneySurfaceAreaLabel.Text = "";
                    lblRoundTotalDepthLabel.Text = "";
                    lblRoundBarrelCeilingLabel.Text = "";
                    lblRoudBarrelDepthLabel.Text = "";
                    lblRoundBarrelSurfaceAreaLabel.Text = "";
                    lblRoudBarrelDiameterLabel.Text = "";
                    lblRoundTotalSurfaceArea.Text = "";

                    lblRectangular1ShortSideLabel.Text = "";
                    lblRectangular1CeilingLabel.Text = "";
                    lblRectangular1LongSideLabel.Text = "";
                    lblRectangle1SurfaceAreaLabel.Text = "";
                    lblRectangular1DephtLabel.Text = "";
                    lblRectangularTotalDepthLabel.Text = "";
                    lblRectangular2CeilingLabel.Text = "";
                    lblRectangular2Depth.Text = "";
                    lblRectangle2LongSideLabel.Text = "";
                    lblRectangle2SurfaceAreaLabel.Text = "";
                    lblRectangular2ShortSideLabel.Text = "";
                    lblRectangularTotalSurfaceAreaLabel.Text = "";

                    lblRectangleShortSideLabel.Text = "";
                    lblRectangleCeilingLabel.Text = "";
                    lblRectangleLongSideLabel.Text = "";
                    lblRectangleSurfaceAreaLabel.Text = "";
                    lblRectangleDephtLabel.Text = "";
                    lblMixedTotalDepthLabel.Text = "";
                    lblDataRoundCeilingLabel.Text = "";
                    lblDataRoundDepthLabel.Text = "";
                    lblDataRoundSurfaceAreaLabel.Text = "";
                    lblDataRoundDiameterLabel.Text = "";
                    lblTotalMixedSurfaceAreaLabel.Text = "";
                }
            }
        }
        /// <summary>
        ///Save
        /// </summary>
        /// <param name="countryId">countryId</param>
        /// <param name="provinceId">provinceId</param>
        /// <param name="countyId">countyId</param>
        /// <param name="cityId">cityId</param>
        /// <param name="projectId">projectId</param>
        /// <param name="companyId">companyId</param>
        public void Save(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int projectId, int companyId)
        {
            //Update Section
            ManholeRehabilitationTDS manholeChanges = (ManholeRehabilitationTDS)Data.GetChanges();

            if (manholeChanges.ManholeDetails.Rows.Count > 0)
            {
                ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeChanges);

                // Update sections
                foreach (ManholeRehabilitationTDS.ManholeDetailsRow manholeDetailsRow in (ManholeRehabilitationTDS.ManholeDetailsDataTable)manholeChanges.ManholeDetails)
                {
                    // Unchanged values
                    int assetId = manholeDetailsRow.AssetID;
                    string mhId = manholeDetailsRow.MHID;

                    // Original values
                    string originalLatitud = manholeRehabilitationManholeDetailsGateway.GetLatitudOriginal(assetId);
                    string originalLongitude = manholeRehabilitationManholeDetailsGateway.GetLongitudeOriginal(assetId);
                    string originalAddress = manholeRehabilitationManholeDetailsGateway.GetAddressOriginal(assetId);
                    string originalManholeShape = manholeRehabilitationManholeDetailsGateway.GetManholeShapeOriginal(assetId);
                    string originalLocation = manholeRehabilitationManholeDetailsGateway.GetLocationOriginal(assetId);
                    int? originalMaterialID = manholeRehabilitationManholeDetailsGateway.GetMaterialIDOriginal(assetId);
                    string originalTopDiameter = manholeRehabilitationManholeDetailsGateway.GetTopDiameterOriginal(assetId);
                    string originalTopDepth = manholeRehabilitationManholeDetailsGateway.GetTopDepthOriginal(assetId);
                    string originalTopFloor = manholeRehabilitationManholeDetailsGateway.GetTopFloorOriginal(assetId);
                    string originalTopCeiling = manholeRehabilitationManholeDetailsGateway.GetTopCeilingOriginal(assetId);
                    string originalTopBenching = manholeRehabilitationManholeDetailsGateway.GetTopBenchingOriginal(assetId);
                    string originalDownDiameter = manholeRehabilitationManholeDetailsGateway.GetDownDiameterOriginal(assetId);
                    string originalDownDepth = manholeRehabilitationManholeDetailsGateway.GetDownDepthOriginal(assetId);
                    string originalDownFloor = manholeRehabilitationManholeDetailsGateway.GetDownFloorOriginal(assetId);
                    string originalDownCeiling = manholeRehabilitationManholeDetailsGateway.GetDownCeilingOriginal(assetId);
                    string originalDownBenching = manholeRehabilitationManholeDetailsGateway.GetDownBenchingOriginal(assetId);
                    string originalRectangle1LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSideOriginal(assetId);
                    string originalRectangle1ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSideOriginal(assetId);
                    string originalRectangle2LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSideOriginal(assetId);
                    string originalRectangle2ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSideOriginal(assetId);
                    string originalTopSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTopSurfaceAreaOriginal(assetId);
                    string originalDownSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetDownSurfaceAreaOriginal(assetId);
                    int? originalManholeRugs = manholeRehabilitationManholeDetailsGateway.GetManholeRugsOriginal(assetId);
                    string originalTotalDepth = manholeRehabilitationManholeDetailsGateway.GetTotalDepthOriginal(assetId);
                    string originalTotalSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceAreaOriginal(assetId);
                    int? originalConditionRating = manholeRehabilitationManholeDetailsGateway.GetConditionRatingOriginal(assetId);

                    // New variables
                    string newLatitud = manholeRehabilitationManholeDetailsGateway.GetLatitud(assetId);
                    string newLongitude = manholeRehabilitationManholeDetailsGateway.GetLongitude(assetId);
                    string newAddress = manholeRehabilitationManholeDetailsGateway.GetAddress(assetId);
                    string newManholeShape = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId);
                    string newLocation = manholeRehabilitationManholeDetailsGateway.GetLocation(assetId);
                    int? newMaterialID = manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId);
                    string newTopDiameter = manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId);
                    string newTopDepth = manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId);
                    string newTopFloor = manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId);
                    string newTopCeiling = manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId);
                    string newTopBenching = manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId);
                    string newDownDiameter = manholeRehabilitationManholeDetailsGateway.GetDownDiameter(assetId);
                    string newDownDepth = manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId);
                    string newDownFloor = manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId);
                    string newDownCeiling = manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId);
                    string newDownBenching = manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId);
                    string newRectangle1LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSide(assetId);
                    string newRectangle1ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSide(assetId);
                    string newRectangle2LongSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId);
                    string newRectangle2ShortSide = manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId);
                    string newTopSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId);
                    string newDownSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId);
                    int? newManholeRugs = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId);
                    string newTotalDepth = manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId);
                    string newTotalSurfaceArea = manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId);
                    int? newConditionRating = manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId);

                    // Update
                    AssetSewerMHGateway assetSewerMHGateway = new AssetSewerMHGateway();
                    assetSewerMHGateway.LoadByAssetId(assetId, companyId);

                    if (assetSewerMHGateway.Table.Rows.Count > 0)
                    {
                        // ... update asset manhole
                        AssetSewerMH assetSewerMH = new AssetSewerMH(assetSewerMHGateway.Data);
                        assetSewerMH.UpdateDirect(assetId, mhId, originalLatitud, originalLongitude, originalAddress, originalManholeShape, originalLocation, originalMaterialID, originalTopDiameter, originalTopDepth, originalTopFloor, originalTopCeiling, originalTopBenching, originalDownDiameter, originalDownDepth, originalDownFloor, originalDownCeiling, originalDownBenching, originalRectangle1LongSide, originalRectangle1ShortSide, originalRectangle2LongSide, originalRectangle2ShortSide, originalTopSurfaceArea, originalDownSurfaceArea, originalManholeRugs, originalTotalDepth, originalTotalSurfaceArea, false, companyId, assetId, mhId, newLatitud, newLongitude, newAddress, newManholeShape, newLocation, newMaterialID, newTopDiameter, newTopDepth, newTopFloor, newTopCeiling, newTopBenching, newDownDiameter, newDownDepth, newDownFloor, newDownCeiling, newDownBenching, newRectangle1LongSide, newRectangle1ShortSide, newRectangle2LongSide, newRectangle2ShortSide, newTopSurfaceArea, newDownSurfaceArea, newManholeRugs, newTotalDepth, newTotalSurfaceArea, false, companyId);

                        // ... update lfs manhole
                        LfsAssetSewerMH lfsAssetSewerMH = new LfsAssetSewerMH(null);
                        lfsAssetSewerMH.UpdateDirect(assetId, false, companyId, originalConditionRating, false, companyId, newConditionRating);
                    }
                }
            }
        }
        private void LoadManholeData(int assetId)
        {
            ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeRehabilitationTDS);
            if (manholeRehabilitationManholeDetailsGateway.Table.Rows.Count > 0)
            {
                // Load Manhole Details for header
                tbxManholeNumber.Text = manholeRehabilitationManholeDetailsGateway.GetMHID(assetId);

                tbxStreet.Text = manholeRehabilitationManholeDetailsGateway.GetAddress(assetId);
                tbxLongitude.Text = manholeRehabilitationManholeDetailsGateway.GetLongitude(assetId);
                tbxLatitude.Text = manholeRehabilitationManholeDetailsGateway.GetLatitud(assetId);

                if (manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId) == "")
                {
                    ddlShape.SelectedValue = "";
                    hdfSavedShape.Value = "";
                }
                else
                {
                    ddlShape.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId);
                    hdfSavedShape.Value = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId);
                }

                if (manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId).HasValue)
                {
                    int? materialId = manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId);
                    int materialsId = (int)materialId;
                    ddlMaterial.SelectedValue = materialsId.ToString();
                }
                else
                {
                    ddlMaterial.SelectedIndex = 0;
                }

                if (manholeRehabilitationManholeDetailsGateway.GetLocation(assetId) == "")
                {
                    ddlLocation.SelectedValue = "";
                }
                else
                {
                    ddlLocation.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetLocation(assetId);
                }

                if (manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).HasValue)
                {
                    ddlConditioningRating.SelectedValue = manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).ToString();
                }
                else
                {
                    ddlConditioningRating.SelectedValue = "-1";
                }
            }
        }
        private void LoadManholeRoundShape(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway)
        {
            // Load manhole structure information
            // ... Round shape
            // ... ... Chimney
            tbxRehabilitationDataChimneyDiameter.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId));
            lblRoudChimneyDiameterLabel.Text = tbxRehabilitationDataChimneyDiameter.Text;
            tbxRehabilitationDataChimneyDepth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId));
            lblRoudChimneyDepthLabel.Text = tbxRehabilitationDataChimneyDepth.Text;

            ckbxRehabilitationDataChimneyFloor.Checked = false;
            tbxRehabilitationDataChimneyFloor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
            {
                ckbxRehabilitationDataChimneyFloor.Checked = true;
                tbxRehabilitationDataChimneyFloor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId));
            }

            ckbxRehabilitationDataChimneyCeiling.Checked = false;
            tbxRehabilitationDataChimneyCeiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
            {
                ckbxRehabilitationDataChimneyCeiling.Checked = true;
                tbxRehabilitationDataChimneyCeiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId));
                lblRoudChimneyCeilingLabel.Text = tbxRehabilitationDataChimneyCeiling.Text;
            }

            ckbxRehabilitationDataChimneyBenching.Checked = false;
            tbxRehabilitationDataChimneyBenching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
            {
                ckbxRehabilitationDataChimneyBenching.Checked = true;
                tbxRehabilitationDataChimneyBenching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId));
            }

            ckbxRehabilitationDataChimneySurfaceArea.Checked = false;
            tbxRehabilitationDataChimneySurfaceArea.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId) != "")
            {
                ckbxRehabilitationDataChimneySurfaceArea.Checked = true;
                tbxRehabilitationDataChimneySurfaceArea.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId));
                lblRoundChimneySurfaceAreaLabel.Text = tbxRehabilitationDataChimneySurfaceArea.Text;
            }

            // Recalculate Top total surface area
            decimal chimneySurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataChimneySurfaceArea.Text);
            decimal chimneyFloor = GetValueValidForCalculations(tbxRehabilitationDataChimneyFloor.Text);
            decimal chimneyCeiling = GetValueValidForCalculations(tbxRehabilitationDataChimneyCeiling.Text);
            decimal chimneyBenching = GetValueValidForCalculations(tbxRehabilitationDataChimneyBenching.Text);

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

            // ... ... Barrel
            tbxRehabilitationDataBarrelDiameter.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownDiameter(assetId));
            lblRoudBarrelDiameterLabel.Text = tbxRehabilitationDataBarrelDiameter.Text;
            tbxRehabilitationDataBarrelDepth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId));
            lblRoudBarrelDepthLabel.Text = tbxRehabilitationDataBarrelDepth.Text;

            ckbxRehabilitationDataBarrelFloor.Checked = false;
            tbxRehabilitationDataBarrelFloor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
            {
                ckbxRehabilitationDataBarrelFloor.Checked = true;
                tbxRehabilitationDataBarrelFloor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId));
            }

            ckbxRehabilitationDataBarrelCeiling.Checked = false;
            tbxRehabilitationDataBarrelCeiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
            {
                ckbxRehabilitationDataBarrelCeiling.Checked = true;
                tbxRehabilitationDataBarrelCeiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId));
                lblRoundBarrelCeilingLabel.Text = tbxRehabilitationDataBarrelCeiling.Text;
            }

            ckbxRehabilitationDataBarrelBenching.Checked = false;
            tbxRehabilitationDataBarrelBenching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
            {
                ckbxRehabilitationDataBarrelBenching.Checked = true;
                tbxRehabilitationDataBarrelBenching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId));
            }

            tbxRehabilitationDataBarrelSurfaceArea.Text = manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId);
            lblRoundBarrelSurfaceAreaLabel.Text = tbxRehabilitationDataBarrelSurfaceArea.Text;

            // Recalculate Top total surface area
            decimal barrelSurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataBarrelSurfaceArea.Text);
            decimal barrelFloor = GetValueValidForCalculations(tbxRehabilitationDataBarrelFloor.Text);
            decimal barrelCeiling = GetValueValidForCalculations(tbxRehabilitationDataBarrelCeiling.Text);
            decimal barrelBenching = GetValueValidForCalculations(tbxRehabilitationDataBarrelBenching.Text);

            decimal barrelTotalSurfaceArea = decimal.Round(barrelSurfaceArea + barrelFloor + barrelCeiling + barrelBenching, 2);
            Distance barrelTotalSurfaceAreaDistance = new Distance(barrelTotalSurfaceArea.ToString());
            tbxRehabilitationDataBarrelTotalSurfaceArea.Text = barrelTotalSurfaceAreaDistance.ToStringInEng3();

            tbxRehabilitationDataBarrelManholeRugs.Text = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();

            // ... ... Totals
            tbxRehabilitationDataRoundTotalDepth.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId));
            lblRoundTotalDepthLabel.Text = tbxRehabilitationDataRoundTotalDepth.Text;
            tbxRehabilitationDataRoundTotalSurfaceArea.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId));
            lblRoundTotalSurfaceArea.Text = tbxRehabilitationDataRoundTotalSurfaceArea.Text;
        }
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// LoadByAssetId
 /// </summary>
 /// <param name="assetId">assetId</param>              
 /// <param name="companyId">companyId</param>
 public void LoadByAssetId(int assetId, int companyId)
 {
     ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(Data);
     manholeRehabilitationManholeDetailsGateway.LoadByAssetId(assetId, companyId);
 }
        private void LoadManholeRectangularShape(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway)
        {
            // ... Rectangular Shape
            // ... ... Rectangular 1
            tbxRehabilitationDataRectangle1LongSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle1LongSide(assetId));
            lblRectangular1LongSideLabel.Text = tbxRehabilitationDataRectangle1LongSide.Text;
            tbxRehabilitationDataRectangle1ShortSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle1ShortSide(assetId));
            lblRectangular1ShortSideLabel.Text = tbxRehabilitationDataRectangle1ShortSide.Text;
            tbxRehabilitationDataRectangle1Depth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId));
            lblRectangular1DephtLabel.Text = tbxRehabilitationDataRectangle1Depth.Text;

            ckbxRehabilitationDataRectangle1Floor.Checked = false;
            tbxRehabilitationDataRectangle1Floor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
            {
                ckbxRehabilitationDataRectangle1Floor.Checked = true;
                tbxRehabilitationDataRectangle1Floor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId));
            }

            ckbxRehabilitationDataRectangle1Ceiling.Checked = false;
            tbxRehabilitationDataRectangle1Ceiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
            {
                ckbxRehabilitationDataRectangle1Ceiling.Checked = true;
                tbxRehabilitationDataRectangle1Ceiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId));
                lblRectangular1CeilingLabel.Text = tbxRehabilitationDataRectangle1Ceiling.Text;
            }

            ckbxRehabilitationDataRectangle1Benching.Checked = false;
            tbxRehabilitationDataRectangle1Benching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
            {
                ckbxRehabilitationDataRectangle1Benching.Checked = true;
                tbxRehabilitationDataRectangle1Benching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId));
            }

            tbxRehabilitationDataRectangle1SurfaceArea.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId));
            lblRectangle1SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle1SurfaceArea.Text;

            // Recalculate rectangle 1 total surface area
            decimal rectangle1SurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataRectangle1SurfaceArea.Text);
            decimal rectangle1Floor = GetValueValidForCalculations(tbxRehabilitationDataRectangle1Floor.Text);
            decimal rectangle1Ceiling = GetValueValidForCalculations(tbxRehabilitationDataRectangle1Ceiling.Text);
            decimal rectangle1Benching = GetValueValidForCalculations(tbxRehabilitationDataRectangle1Benching.Text);

            decimal rectangle1TotalSurfaceArea = decimal.Round(rectangle1SurfaceArea + rectangle1Floor + rectangle1Ceiling + rectangle1Benching, 2);
            Distance rectangle1TotalSurfaceAreaDistance = new Distance(rectangle1TotalSurfaceArea.ToString());
            tbxRehabilitationDataRectangle1TotalSurfaceArea.Text = rectangle1TotalSurfaceAreaDistance.ToStringInEng3();

            // ... ... Rectangular 2
            tbxRehabilitationDataRectangle2LongSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId));
            lblRectangle2LongSideLabel.Text = tbxRehabilitationDataRectangle2LongSide.Text;
            tbxRehabilitationDataRectangle2ShortSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId));
            lblRectangular2ShortSideLabel.Text = tbxRehabilitationDataRectangle2ShortSide.Text;
            tbxRehabilitationDataRectangle2Depth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId));
            lblRectangular2Depth.Text = tbxRehabilitationDataRectangle2Depth.Text;

            ckbxRehabilitationDataRectangle2Floor.Checked = false;
            tbxRehabilitationDataRectangle2Floor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
            {
                ckbxRehabilitationDataRectangle2Floor.Checked = true;
                tbxRehabilitationDataRectangle2Floor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId));
            }

            ckbxRehabilitationDataRectangle2Ceiling.Checked = false;
            tbxRehabilitationDataRectangle2Ceiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
            {
                ckbxRehabilitationDataRectangle2Ceiling.Checked = true;
                tbxRehabilitationDataRectangle2Ceiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId));
                lblRectangular2CeilingLabel.Text = tbxRehabilitationDataRectangle2Ceiling.Text;
            }

            ckbxRehabilitationDataRectangle2Benching.Checked = false;
            tbxRehabilitationDataRectangle2Benching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
            {
                ckbxRehabilitationDataRectangle2Benching.Checked = true;
                tbxRehabilitationDataRectangle2Benching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId));
            }

            tbxRehabilitationDataRectangle2SurfaceArea.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId));
            lblRectangle2SurfaceAreaLabel.Text = tbxRehabilitationDataRectangle2SurfaceArea.Text;

            // Recalculate rectangle 2 total surface area
            decimal rectangle2SurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataRectangle2SurfaceArea.Text);
            decimal rectangle2Floor = GetValueValidForCalculations(tbxRehabilitationDataRectangle2Floor.Text);
            decimal rectangle2Ceiling = GetValueValidForCalculations(tbxRehabilitationDataRectangle2Ceiling.Text);
            decimal rectangle2Benching = GetValueValidForCalculations(tbxRehabilitationDataRectangle2Benching.Text);

            decimal rectangle2TotalSurfaceArea = decimal.Round(rectangle2SurfaceArea + rectangle2Floor + rectangle2Ceiling + rectangle2Benching, 2);
            Distance rectangle2TotalSurfaceAreaDistance = new Distance(rectangle2TotalSurfaceArea.ToString());
            tbxRehabilitationDataRectangle2TotalSurfaceArea.Text = rectangle2TotalSurfaceAreaDistance.ToStringInEng3();

            tbxRehabilitationDataRectangularManholeRugs.Text = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();

            // ... ... Totals
            tbxRehabilitationDataRectangularTotalDepth.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId));
            lblRectangularTotalDepthLabel.Text = tbxRehabilitationDataRectangularTotalDepth.Text;
            tbxRehabilitationDataRectangularTotalSurfaceArea.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId));
            lblRectangularTotalSurfaceAreaLabel.Text = tbxRehabilitationDataRectangularTotalSurfaceArea.Text;
        }
 private void LoadManholeOtherShape(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway)
 {
     // ... Other shape
     tbxRehabilitationDataOtherStructure.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId));
 }
        private void LoadManholeMixShape(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway)
        {
            // ... Mix Shape
            // ... ... Top
            tbxRehabilitationDataRoundDiameter.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopDiameter(assetId));
            lblDataRoundDiameterLabel.Text = tbxRehabilitationDataRoundDiameter.Text;
            tbxRehabilitationDataRoundDepth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopDepth(assetId));
            lblDataRoundDepthLabel.Text = tbxRehabilitationDataRoundDepth.Text;

            ckbxRehabilitationDataRoundFloor.Checked = false;
            tbxRehabilitationDataRoundFloor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId) != "")
            {
                ckbxRehabilitationDataRoundFloor.Checked = true;
                tbxRehabilitationDataRoundFloor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopFloor(assetId));
            }

            ckbxRehabilitationDataRoundCeiling.Checked = false;
            tbxRehabilitationDataRoundCeiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId) != "")
            {
                ckbxRehabilitationDataRoundCeiling.Checked = true;
                tbxRehabilitationDataRoundCeiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopCeiling(assetId));
                lblDataRoundCeilingLabel.Text = tbxRehabilitationDataRoundCeiling.Text;
            }

            ckbxRehabilitationDataRoundBenching.Checked = false;
            tbxRehabilitationDataRoundBenching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId) != "")
            {
                ckbxRehabilitationDataRoundBenching.Checked = true;
                tbxRehabilitationDataRoundBenching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopBenching(assetId));
            }

            tbxRehabilitationDataRoundSurfaceArea.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetTopSurfaceArea(assetId));
            lblDataRoundSurfaceAreaLabel.Text = tbxRehabilitationDataRoundSurfaceArea.Text;

            // Recalculate Top total surface area
            decimal roundSurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataRoundSurfaceArea.Text);
            decimal roundFloor = GetValueValidForCalculations(tbxRehabilitationDataRoundFloor.Text);
            decimal roundCeiling = GetValueValidForCalculations(tbxRehabilitationDataRoundCeiling.Text);
            decimal roundBenching = GetValueValidForCalculations(tbxRehabilitationDataRoundBenching.Text);

            decimal roundTotalSurfaceArea = decimal.Round(roundSurfaceArea + roundFloor + roundCeiling + roundBenching, 2);
            Distance roundTotalSurfaceAreaDistance = new Distance(roundTotalSurfaceArea.ToString());
            tbxRehabilitationDataMixedRoundTotalSurfaceArea.Text = roundTotalSurfaceAreaDistance.ToStringInEng3();

            // ... ... Down
            tbxRehabilitationDataRectangleLongSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle2LongSide(assetId));
            lblRectangleLongSideLabel.Text = tbxRehabilitationDataRectangleLongSide.Text;
            tbxRehabilitationDataRectangleShortSide.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetRectangle2ShortSide(assetId));
            lblRectangleShortSideLabel.Text = tbxRehabilitationDataRectangleShortSide.Text;
            tbxRehabilitationDataRectangleDepth.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownDepth(assetId));
            lblRectangleDepthLabel.Text = tbxRehabilitationDataRectangleDepth.Text;

            ckbxRehabilitationDataRectangleFloor.Checked = false;
            tbxRehabilitationDataRectangleFloor.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId) != "")
            {
                ckbxRehabilitationDataRectangleFloor.Checked = true;
                tbxRehabilitationDataRectangleFloor.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownFloor(assetId));
            }

            ckbxRehabilitationDataRectangleCeiling.Checked = false;
            tbxRehabilitationDataRectangleCeiling.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId) != "")
            {
                ckbxRehabilitationDataRectangleCeiling.Checked = true;
                tbxRehabilitationDataRectangleCeiling.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownCeiling(assetId));
                lblRectangleCeilingLabel.Text = tbxRehabilitationDataRectangleCeiling.Text;
            }

            ckbxRehabilitationDataBenching.Checked = false;
            tbxRehabilitationDataBenching.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId) != "")
            {
                ckbxRehabilitationDataBenching.Checked = true;
                tbxRehabilitationDataBenching.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownBenching(assetId));
            }

            tbxRehabilitationDataRectangularSufaceArea.Text = GetValueValidForCalculationsInString(manholeRehabilitationManholeDetailsGateway.GetDownSurfaceArea(assetId));
            lblRectangleSurfaceAreaLabel.Text = tbxRehabilitationDataRectangularSufaceArea.Text;

            // Recalculate Top total surface area
            decimal mixesRectangleSurfaceArea = GetValueValidForCalculations(tbxRehabilitationDataRectangularSufaceArea.Text);
            decimal mixesRectangleFloor = GetValueValidForCalculations(tbxRehabilitationDataRectangleFloor.Text);
            decimal mixesRectangleCeiling = GetValueValidForCalculations(tbxRehabilitationDataRectangleCeiling.Text);
            decimal mixesRectangleBenching = GetValueValidForCalculations(tbxRehabilitationDataBenching.Text);

            decimal mixesRectangleTotalSurfaceArea = decimal.Round(mixesRectangleSurfaceArea + mixesRectangleFloor + mixesRectangleCeiling + mixesRectangleBenching, 2);
            Distance mixesRectangleTotalSurfaceAreaDistance = new Distance(mixesRectangleTotalSurfaceArea.ToString());
            tbxRehabilitationDataMixedRectangleTotalSurfaceArea.Text = mixesRectangleTotalSurfaceAreaDistance.ToStringInEng3();

            tbxRehabilitationDataManholeRugs.Text = manholeRehabilitationManholeDetailsGateway.GetManholeRugs(assetId).ToString();

            // ... ... Totals
            tbxRehabilitationDataTotalDepth.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalDepth(assetId));
            lblMixedTotalDepthLabel.Text = tbxRehabilitationDataTotalDepth.Text;
            tbxRehabilitationDataTotalSurfaceArea.Text = GetValueValidForCalculationsInStringWithoutDecimals(manholeRehabilitationManholeDetailsGateway.GetTotalSurfaceArea(assetId));
            lblTotalMixedSurfaceAreaLabel.Text = tbxRehabilitationDataTotalSurfaceArea.Text;
        }
        private void LoadManholeGeneralDetailDate(int assetId, ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway)
        {
            // Load Manhole Details for header
            tbxManholeNumber.Text = manholeRehabilitationManholeDetailsGateway.GetMHID(assetId);

            tbxStreet.Text = manholeRehabilitationManholeDetailsGateway.GetAddress(assetId);
            tbxLongitude.Text = manholeRehabilitationManholeDetailsGateway.GetLongitude(assetId);
            tbxLatitude.Text = manholeRehabilitationManholeDetailsGateway.GetLatitud(assetId);
            tbxShape.Text = manholeRehabilitationManholeDetailsGateway.GetManholeShape(assetId);
            if (manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId).HasValue)
            {
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int? materialId = manholeRehabilitationManholeDetailsGateway.GetMaterialID(assetId);
                AssetSewerMHMaterialTypeGateway assetSewerMHMaterialTypeGateway = new AssetSewerMHMaterialTypeGateway();
                assetSewerMHMaterialTypeGateway.LoadByMaterialId((int)materialId, companyId);

                tbxMaterial.Text = assetSewerMHMaterialTypeGateway.GetMaterialType((int)materialId);
            }
            else
            {
                tbxMaterial.Text = "";
            }

            tbxLocation.Text = manholeRehabilitationManholeDetailsGateway.GetLocation(assetId);
            tbxConditioningRating.Text = "";
            if (manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).HasValue)
            {
                tbxConditioningRating.Text = manholeRehabilitationManholeDetailsGateway.GetConditionRating(assetId).ToString();
            }
        }
        private void LoadManholeData(int assetId)
        {
            ManholeRehabilitationManholeDetailsGateway manholeRehabilitationManholeDetailsGateway = new ManholeRehabilitationManholeDetailsGateway(manholeRehabilitationTDS);

            if (manholeRehabilitationManholeDetailsGateway.Table.Rows.Count > 0)
            {
                LoadManholeGeneralDetailDate(assetId, manholeRehabilitationManholeDetailsGateway);

                LoadManholeRoundShape(assetId, manholeRehabilitationManholeDetailsGateway);

                LoadManholeRectangularShape(assetId, manholeRehabilitationManholeDetailsGateway);

                LoadManholeMixShape(assetId, manholeRehabilitationManholeDetailsGateway);

                LoadManholeOtherShape(assetId, manholeRehabilitationManholeDetailsGateway);
            }
        }