//COMPANY_ID
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="sectionId">sectionId</param>
        /// <param name="companyId">companyId</param>
        public void Delete(int projectId, int assetId, int companyId)
        {
            WorkRehabAssessmentGateway workRehabAssessmentGateway = new WorkRehabAssessmentGateway();
            WorkRehabAssessment workRehabAssessment = new WorkRehabAssessment(workRehabAssessmentGateway.Data);

            WorkFullLengthLiningGateway workFullLengthLiningGateway = new WorkFullLengthLiningGateway();
            WorkFullLengthLining workFullLengthLining = new WorkFullLengthLining(workFullLengthLiningGateway.Data);

            WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway();
            WorkJunctionLiningSection workJunctionLiningSection = new WorkJunctionLiningSection(workJunctionLiningSectionGateway.Data);

            int workIdRA = GetWorkId(projectId, assetId, "Rehab Assessment", companyId);
            if (workIdRA != 0) workRehabAssessment.DeleteDirect(workIdRA, companyId);

            int workIdFL = GetWorkId(projectId, assetId, "Full Length Lining", companyId);
            if (workIdFL != 0) workFullLengthLining.DeleteDirect(workIdFL, companyId);

            int workIdJL = GetWorkId(projectId, assetId, "Junction Lining Section", companyId);
            if (workIdJL != 0) workJunctionLiningSection.DeleteDirect(workIdJL, companyId);

            LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway();
            lfsAssetSewerSectionGateway.LoadByAssetId(assetId, companyId);
            LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(lfsAssetSewerSectionGateway.Data);

            // Update lfs asset
            lfsAssetSewerSection.DeleteDirect(assetId, companyId);
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// InsertDirect
        /// </summary>
        /// <param name="countryId">countryId</param>
        /// <param name="provinceId">provinceId</param>
        /// <param name="countyId">countyId</param>
        /// <param name="cityId">cityId</param>
        /// <param name="sectionId">sectionId</param>
        /// <param name="street">street</param>
        /// <param name="subArea">subArea</param>
        /// <param name="usmh">usmh</param>
        /// <param name="dsmh">dsmh</param>
        /// <param name="mapSize">mapSize</param>
        /// <param name="size_">size_</param>
        /// <param name="mapLength">mapLength</param>
        /// <param name="length">length</param>
        /// <param name="laterals">laterals</param>
        /// <param name="liveLaterals">liveLaterals</param>
        /// <param name="flowDirection">flowDirection</param>
        /// <param name="usmhDepth">usmhDepth</param>
        /// <param name="dsmhDepth">dsmhDepth</param>
        /// <param name="usmhAddress">usmhAddress</param>
        /// <param name="dsmhAddress">dsmhAddress</param>
        /// <param name="steelTapeThroughSewer">steelTapeThroughSewer</param>
        /// <param name="usmhMouth12">usmhMouth12</param>
        /// <param name="usmhMouth1">usmhMouth1</param>
        /// <param name="usmhMouth2">usmhMouth2</param>
        /// <param name="usmhMouth3">usmhMouth3</param>
        /// <param name="usmhMouth4">usmhMouth4</param>
        /// <param name="usmhMouth5">usmhMouth5</param>
        /// <param name="dsmhMouth12">dsmhMouth12</param>
        /// <param name="dsmhMouth1">dsmhMouth1</param>
        /// <param name="dsmhMouth2">dsmhMouth2</param>
        /// <param name="dsmhMouth3">dsmhMouth3</param>
        /// <param name="dsmhMouth4">dsmhMouth4</param>
        /// <param name="dsmhMouth5">dsmhMouth5</param>
        /// <param name="deleted">deleted</param>
        /// <param name="companyId">companyId</param>
        /// <param name="subArea">subArea</param>
        /// <param name="thickness">thickness</param>
        /// <param name="sectionMaterialRefId">sectionMaterialRefId</param>
        /// <param name="sectionMaterial">sectionMaterial</param>
        /// <param name="sectionMaterialDate">sectionMaterialDate</param>
        /// <returns></returns>
        public int InsertDirect(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, string sectionId, string street, int? usmh, int? dsmh, string mapSize, string size_, string mapLength, string length, int? laterals, int? liveLaterals, string flowDirection, string usmhDepth, string dsmhDepth, string usmhAddress, string dsmhAddress, string steelTapeThroughSewer, string usmhMouth12, string usmhMouth1, string usmhMouth2, string usmhMouth3, string usmhMouth4, string usmhMouth5, string dsmhMouth12, string dsmhMouth1, string dsmhMouth2, string dsmhMouth3, string dsmhMouth4, string dsmhMouth5, bool deleted, int companyId, string subArea, string thickness, int sectionMaterialRefId, string sectionMaterial, DateTime sectionMaterialDate)
        {
            string newSectionId = "";
            string newFlowOrderId = "";

            // Verify sectionId
            string[] secuentialPart = sectionId.Split('-');
            if (secuentialPart.Length > 2)
            {
                // ... Intermediate section Id
                newSectionId = sectionId;
                newFlowOrderId = newSectionId.Substring(newSectionId.Length - 6, 6);
            }
            else
            {
                if (secuentialPart.Length == 2)
                {
                    // ... Existent section Id
                    newSectionId = sectionId;
                    newFlowOrderId = secuentialPart[1];
                }
                else
                {
                    // ... New Section Id
                    newSectionId = GetSectionNextId(countryId, provinceId, countyId, cityId, companyId);
                    newFlowOrderId = newSectionId.Substring(newSectionId.Length - 6, 6);
                }
            }

            // insert section, materials and MHs in AM tables (only if not exists)
            AssetSewerSection assetSewerSection = new AssetSewerSection(new DataSet());
            int section_assetId = assetSewerSection.InsertDirect(countryId, provinceId, countyId, cityId, newSectionId, street, usmh, dsmh, mapSize, size_, mapLength, length, laterals, liveLaterals, flowDirection, usmhDepth, dsmhDepth, usmhAddress, dsmhAddress, deleted, companyId, newFlowOrderId);

            if (sectionMaterial != "" )
            {
                new AssetSewerMaterial(new DataSet()).InsertDirect(section_assetId, sectionMaterialRefId, sectionMaterial, sectionMaterialDate, deleted, companyId);
            }

            // verify if section exists in LFS tables for insertion
            LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway();
            lfsAssetSewerSectionGateway.LoadByAssetId(section_assetId, companyId);
            if (lfsAssetSewerSectionGateway.Table.Rows.Count == 0)
            {
                new LfsAsset(new DataSet()).InsertDirect(section_assetId, deleted, companyId);
                new LfsAssetSewer(new DataSet()).InsertDirect(section_assetId, deleted, companyId);
                lfsAssetSewerSectionGateway.Insert(section_assetId, steelTapeThroughSewer, usmhMouth12, usmhMouth1, usmhMouth2, usmhMouth3, usmhMouth4, usmhMouth5, dsmhMouth12, dsmhMouth1, dsmhMouth2, dsmhMouth3, dsmhMouth4, dsmhMouth5, deleted, companyId, subArea, thickness);
            }

            return section_assetId;
        }
        /// <summary>
        /// UpdateSection
        /// </summary>
        /// <param name="countryId">countryId</param>
        /// <param name="provinceId">provinceId</param>
        /// <param name="countyId">countyId</param>
        /// <param name="cityId">cityId</param>
        /// <param name="assetId">assetId</param>
        /// <param name="sectionId">sectionId</param>
        /// <param name="originalStreet">originalStreet</param>
        /// <param name="originalUsmh">originalUsmh</param>
        /// <param name="originalDsmh">originalDsmh</param>
        /// <param name="originalSize_">originalSize_</param>
        /// <param name="originalLength">originalLength</param>
        /// <param name="originalSubArea">originalSubArea</param>
        /// <param name="newStreet">newStreet</param>
        /// <param name="newUsmh">newUsmh</param>
        /// <param name="newDsmh">newDsmh</param>
        /// <param name="newSize_">newSize_</param>
        /// <param name="newLength">newLength</param>
        /// <param name="newSubArea">newSubArea</param>
        /// <param name="companyId">companyId</param>
        /// <param name="projectId">projectId</param>
        /// <param name="workId">workId</param>
        private void UpdateSection(Int64? countryId, Int64? provinceId, Int64? countyId, Int64? cityId, int assetId, string sectionId, string originalStreet, int? originalUsmh, int? originalDsmh, string originalSize_, string originalLength, string originalSubArea, string newStreet, int? newUsmh, int? newDsmh, string newSize_, string newLength, string newSubArea, int companyId, int projectId, int workId)
        {
            // Load data
            AssetSewerSectionGateway assetSewerSectionGateway = new AssetSewerSectionGateway();
            assetSewerSectionGateway.LoadByAssetId(assetId, companyId);

            LfsAssetSewerSectionGateway lfsAssetSewerSectionGateway = new LfsAssetSewerSectionGateway(assetSewerSectionGateway.Data);
            lfsAssetSewerSectionGateway.LoadByAssetId(assetId, companyId);

            // Get unchanged data
            // ... section
            string mapSize_ = assetSewerSectionGateway.GetMapSize(assetId);
            string mapLength = assetSewerSectionGateway.GetMapLength(assetId);
            int? laterals = assetSewerSectionGateway.GetLaterals(assetId);
            int? liveLaterals = assetSewerSectionGateway.GetLiveLaterals(assetId);
            string flowDirection = assetSewerSectionGateway.GetFlowDirection(assetId);
            string usmhDepth = assetSewerSectionGateway.GetUSMHDepth(assetId);
            string dsmhDepth = assetSewerSectionGateway.GetDSMHDepth(assetId);

            // ... lfs section
            string steelTapeTroughSewer = lfsAssetSewerSectionGateway.GetSteelTapeThroughSewer(assetId);
            string usmhMouth12 = lfsAssetSewerSectionGateway.GetUSMHMouth12(assetId);
            string usmhMouth1 = lfsAssetSewerSectionGateway.GetUSMHMouth1(assetId);
            string usmhMouth2 = lfsAssetSewerSectionGateway.GetUSMHMouth2(assetId);
            string usmhMouth3 = lfsAssetSewerSectionGateway.GetUSMHMouth3(assetId);
            string usmhMouth4 = lfsAssetSewerSectionGateway.GetUSMHMouth4(assetId);
            string usmhMouth5 = lfsAssetSewerSectionGateway.GetUSMHMouth5(assetId);
            string dsmhMouth12 = lfsAssetSewerSectionGateway.GetDSMHMouth12(assetId);
            string dsmhMouth1 = lfsAssetSewerSectionGateway.GetDSMHMouth1(assetId);
            string dsmhMouth2 = lfsAssetSewerSectionGateway.GetDSMHMouth2(assetId);
            string dsmhMouth3 = lfsAssetSewerSectionGateway.GetDSMHMouth3(assetId);
            string dsmhMouth4 = lfsAssetSewerSectionGateway.GetDSMHMouth4(assetId);
            string dsmhMouth5 = lfsAssetSewerSectionGateway.GetDSMHMouth5(assetId);
            string thickness = lfsAssetSewerSectionGateway.GetThickness(assetId);

            //Update Full Length Lining work
            if (originalLength != newLength)
            {
                steelTapeTroughSewer = newLength;
            }
            // Update
            LfsAssetSewerSection lfsAssetSewerSection = new LfsAssetSewerSection(null);
            lfsAssetSewerSection.UpdateDirect(assetId, sectionId, originalStreet, originalUsmh, originalDsmh, mapSize_, originalSize_, mapLength, originalLength, laterals, liveLaterals, flowDirection, usmhDepth, dsmhDepth, steelTapeTroughSewer, usmhMouth12, usmhMouth1, usmhMouth2, usmhMouth3, usmhMouth4, usmhMouth5, dsmhMouth12, dsmhMouth1, dsmhMouth2, dsmhMouth3, dsmhMouth4, dsmhMouth5, false, companyId, originalSubArea, thickness, assetId, sectionId, newStreet, newUsmh, newDsmh, mapSize_, newSize_, mapLength, newLength, laterals, liveLaterals, flowDirection, usmhDepth, dsmhDepth, steelTapeTroughSewer, usmhMouth12, usmhMouth1, usmhMouth2, usmhMouth3, usmhMouth4, usmhMouth5, dsmhMouth12, dsmhMouth1, dsmhMouth2, dsmhMouth3, dsmhMouth4, dsmhMouth5, false, companyId, newSubArea, thickness);
        }