// ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// LoadByWorkId
        /// </summary>
        /// <param name="workId">workId</param>              
        /// <param name="companyId">companyId</param>
        public void LoadByWorkId(int workId, int companyId)
        {
            FullLengthLiningSectionDetailsGateway fullLengthLiningSectionDetailsGateway = new FullLengthLiningSectionDetailsGateway(Data);
            fullLengthLiningSectionDetailsGateway.LoadByWorkId(workId, companyId);

            // Update some fields before to show
            UpdateFieldsForSections();
        }
        private void LoadSectionData(int workId)
        {
            FullLengthLiningSectionDetailsGateway fullLengthLiningSectionDetailsGateway = new FullLengthLiningSectionDetailsGateway(fullLengthLiningTDS);
            if (fullLengthLiningSectionDetailsGateway.Table.Rows.Count > 0)
            {
                // Load Section Details
                tbxFlowSectionId.Text = fullLengthLiningSectionDetailsGateway.GetFlowOrderId(workId);
                hdfFlowOrderId.Value = fullLengthLiningSectionDetailsGateway.GetFlowOrderId(workId);
                hdfSectionId.Value = fullLengthLiningSectionDetailsGateway.GetSectionId(workId);
                tbxOldCwpId.Text = fullLengthLiningSectionDetailsGateway.GetOriginalSectionId(workId);
                tbxStreet.Text = fullLengthLiningSectionDetailsGateway.GetStreet(workId);
                tbxUSMH.Text = fullLengthLiningSectionDetailsGateway.GetUsmhDescription(workId);
                tbxDSMH.Text = fullLengthLiningSectionDetailsGateway.GetDsmhDescription(workId);
                tbxMapSize.Text = fullLengthLiningSectionDetailsGateway.GetMapSize(workId);
                tbxConfirmedSize.Text = fullLengthLiningSectionDetailsGateway.GetSize_(workId);
                ddlThickness.SelectedValue = fullLengthLiningSectionDetailsGateway.GetThickness(workId);
                tbxMapLength.Text = fullLengthLiningSectionDetailsGateway.GetMapLength(workId);
                tbxSteelTapeLength.Text = fullLengthLiningSectionDetailsGateway.GetLength(workId);
                tbxLaterals.Text = "0"; if (fullLengthLiningSectionDetailsGateway.GetLaterals(workId).HasValue) tbxLaterals.Text = fullLengthLiningSectionDetailsGateway.GetLaterals(workId).ToString().Trim();
                tbxLiveLaterals.Text = "0"; if (fullLengthLiningSectionDetailsGateway.GetLiveLaterals(workId).HasValue) tbxLiveLaterals.Text = fullLengthLiningSectionDetailsGateway.GetLiveLaterals(workId).ToString().Trim();

                // For m1 data
                // ... for depths
                tbxM1DataUsmhDepth.Text = fullLengthLiningSectionDetailsGateway.GetUsmhDepth(workId);
                tbxM1DataDsmhDepth.Text = fullLengthLiningSectionDetailsGateway.GetDsmhDepth(workId);

                // ... for address
                tbxM1DataUsmhAddress.Text = fullLengthLiningSectionDetailsGateway.GetUsmhAddress(workId);
                tbxM1DataDsmhAddress.Text = fullLengthLiningSectionDetailsGateway.GetDsmhAddress(workId);

                // ... Get lfs asset sewer data
                tbxM1DataSteelTapeThroughSewer.Text = fullLengthLiningSectionDetailsGateway.GetSteelTapeThroughSewer(workId);
                tbxM1DataUsmhMouth12.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth12(workId);
                tbxM1DataUsmhMouth1.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth1(workId);
                tbxM1DataUsmhMouth2.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth2(workId);
                tbxM1DataUsmhMouth3.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth3(workId);
                tbxM1DataUsmhMouth4.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth4(workId);
                tbxM1DataUsmhMouth5.Text = fullLengthLiningSectionDetailsGateway.GetUsmhMouth5(workId);
                tbxM1DataDsmhMouth12.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth12(workId);
                tbxM1DataDsmhMouth1.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth1(workId);
                tbxM1DataDsmhMouth2.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth2(workId);
                tbxM1DataDsmhMouth3.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth3(workId);
                tbxM1DataDsmhMouth4.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth4(workId);
                tbxM1DataDsmhMouth5.Text = fullLengthLiningSectionDetailsGateway.GetDsmhMouth5(workId);
                tbxGeneralSubArea.Text = fullLengthLiningSectionDetailsGateway.GetSubArea(workId);
            }
        }
        /// <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
            FullLengthLiningTDS fullLengthLiningChanges = (FullLengthLiningTDS)Data.GetChanges();

            if (fullLengthLiningChanges.SectionDetails.Rows.Count > 0)
            {
                FullLengthLiningSectionDetailsGateway fullLengthLiningSectionDetailsGateway = new FullLengthLiningSectionDetailsGateway(fullLengthLiningChanges);

                // Update sections
                foreach (FullLengthLiningTDS.SectionDetailsRow sectionDetailsRow in (FullLengthLiningTDS.SectionDetailsDataTable)fullLengthLiningChanges.SectionDetails)
                {
                    // Unchanged values
                    int workId = sectionDetailsRow.WorkID;
                    int assetId = sectionDetailsRow.AssetID;
                    string sectionId = sectionDetailsRow.SectionID;

                    // Original values
                    string originalStreet = fullLengthLiningSectionDetailsGateway.GetStreetOriginal(workId);
                    int? originalUsmh = fullLengthLiningSectionDetailsGateway.GetUsmh(workId);
                    string originalUsmhId = fullLengthLiningSectionDetailsGateway.GetUsmhDescriptionOriginal(workId);
                    int? originalDsmh = fullLengthLiningSectionDetailsGateway.GetDsmh(workId);
                    string originalDsmhId = fullLengthLiningSectionDetailsGateway.GetDsmhDescriptionOriginal(workId);
                    string originalMapSize = fullLengthLiningSectionDetailsGateway.GetMapSizeOriginal(workId);
                    string originalSize = fullLengthLiningSectionDetailsGateway.GetSizeOriginal(workId);
                    string originalMapLength = fullLengthLiningSectionDetailsGateway.GetMapLengthOriginal(workId);
                    string originalLength = fullLengthLiningSectionDetailsGateway.GetLengthOriginal(workId);
                    int? originalLaterals = fullLengthLiningSectionDetailsGateway.GetLateralsOriginal(workId);
                    int? originalLiveLaterals = fullLengthLiningSectionDetailsGateway.GetLiveLateralsOriginal(workId);
                    string originalUsmhDepth = fullLengthLiningSectionDetailsGateway.GetUsmhDepthOriginal(workId);
                    string originalDsmhDepth = fullLengthLiningSectionDetailsGateway.GetDsmhDepthOriginal(workId);
                    string originalSteelTapeThroughSewer = fullLengthLiningSectionDetailsGateway.GetSteelTapeThroughSewerOriginal(workId);
                    string originalUsmhMouth12 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth12Original(workId);
                    string originalUsmhMouth1 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth1Original(workId);
                    string originalUsmhMouth2 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth2Original(workId);
                    string originalUsmhMouth3 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth3Original(workId);
                    string originalUsmhMouth4 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth4Original(workId);
                    string originalUsmhMouth5 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth5Original(workId);
                    string originalDsmhMouth12 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth12Original(workId);
                    string originalDsmhMouth1 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth1Original(workId);
                    string originalDsmhMouth2 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth2Original(workId);
                    string originalDsmhMouth3 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth3Original(workId);
                    string originalDsmhMouth4 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth4Original(workId);
                    string originalDsmhMouth5 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth5Original(workId);
                    string originalUsmhAddress = fullLengthLiningSectionDetailsGateway.GetUsmhAddressOriginal(workId);
                    string originalDsmhAddress = fullLengthLiningSectionDetailsGateway.GetDsmhAddressOriginal(workId);
                    string originalSubArea = fullLengthLiningSectionDetailsGateway.GetSubAreaOriginal(workId);
                    string originalThickness = fullLengthLiningSectionDetailsGateway.GetThicknessOriginal(workId);

                    // New variables
                    string newStreet = fullLengthLiningSectionDetailsGateway.GetStreet(workId);
                    string newUsmh = fullLengthLiningSectionDetailsGateway.GetUsmhDescription(workId);
                    string newDsmh = fullLengthLiningSectionDetailsGateway.GetDsmhDescription(workId);
                    string newMapSize = fullLengthLiningSectionDetailsGateway.GetMapSize(workId);
                    string newSize = fullLengthLiningSectionDetailsGateway.GetSize_(workId);
                    string newMapLength = fullLengthLiningSectionDetailsGateway.GetMapLength(workId);
                    string newLength = fullLengthLiningSectionDetailsGateway.GetLength(workId);
                    int? newLaterals = fullLengthLiningSectionDetailsGateway.GetLaterals(workId);
                    int? newLiveLaterals = fullLengthLiningSectionDetailsGateway.GetLiveLaterals(workId);
                    string newUsmhDepth = fullLengthLiningSectionDetailsGateway.GetUsmhDepth(workId);
                    string newDsmhDepth = fullLengthLiningSectionDetailsGateway.GetDsmhDepth(workId);
                    string newSteelTapeThroughSewer = fullLengthLiningSectionDetailsGateway.GetSteelTapeThroughSewer(workId);
                    string newUsmhMouth12 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth12(workId);
                    string newUsmhMouth1 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth1(workId);
                    string newUsmhMouth2 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth2(workId);
                    string newUsmhMouth3 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth3(workId);
                    string newUsmhMouth4 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth4(workId);
                    string newUsmhMouth5 = fullLengthLiningSectionDetailsGateway.GetUsmhMouth5(workId);
                    string newDsmhMouth12 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth12(workId);
                    string newDsmhMouth1 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth1(workId);
                    string newDsmhMouth2 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth2(workId);
                    string newDsmhMouth3 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth3(workId);
                    string newDsmhMouth4 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth4(workId);
                    string newDsmhMouth5 = fullLengthLiningSectionDetailsGateway.GetDsmhMouth5(workId);
                    string newUsmhAddress = fullLengthLiningSectionDetailsGateway.GetUsmhAddress(workId);
                    string newDsmhAddress = fullLengthLiningSectionDetailsGateway.GetDsmhAddress(workId);
                    string newSubArea = fullLengthLiningSectionDetailsGateway.GetSubArea(workId);
                    string newThickness = fullLengthLiningSectionDetailsGateway.GetThickness(workId);

                    // Update
                    Update(projectId, countryId, provinceId, countyId, cityId, workId, assetId, sectionId, originalStreet, originalUsmh, originalUsmhId, originalDsmh, originalDsmhId, originalMapSize, originalSize, originalMapLength, originalLength, originalLaterals, originalLiveLaterals, originalUsmhDepth, originalDsmhDepth, originalSteelTapeThroughSewer, originalSubArea, originalUsmhMouth12, originalUsmhMouth1, originalUsmhMouth2, originalUsmhMouth3, originalUsmhMouth4, originalUsmhMouth5, originalDsmhMouth12, originalDsmhMouth1, originalDsmhMouth2, originalDsmhMouth3, originalDsmhMouth4, originalDsmhMouth5,  false, companyId, originalUsmhAddress, originalDsmhAddress, originalThickness, workId, assetId, sectionId, newStreet, newUsmh, newDsmh, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newUsmhDepth, newDsmhDepth, newSteelTapeThroughSewer, newSubArea, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, false, companyId, newUsmhAddress, newDsmhAddress, newThickness);
                }
            }
        }