/// <summary>
        /// UpdateForProcess
        /// </summary>
        /// <param name="companyId">companyId</param>
        public void UpdateForReport(int companyId)
        {
            SectionGateway sectionGateway = new SectionGateway();
            JlinerGateway jlinerGateway = new JlinerGateway(sectionGateway.Data);
            Jliner jliner = new Jliner(sectionGateway.Data);

            sectionGateway.ClearBeforeFill = false;
            jlinerGateway.ClearBeforeFill = false;

            SectionTDS.LFS_JUNCTION_LINER2Row lfsJunctionLiner2Row;

            foreach (JlinertoBuildReportTDS.JLinersToBuildRow jLinersToBuildRow in ((JlinertoBuildReportTDS.JLinersToBuildDataTable)Table))
            {
                // Load sections
                try
                {
                    sectionGateway.GetRow(jLinersToBuildRow.ID);
                }
                catch
                {
                    sectionGateway.LoadById(jLinersToBuildRow.ID, companyId);
                }

                // Load laterals
                try
                {
                    lfsJunctionLiner2Row = (SectionTDS.LFS_JUNCTION_LINER2Row) jlinerGateway.GetRow(jLinersToBuildRow.ID, jLinersToBuildRow.RefID);
                }
                catch
                {
                    jlinerGateway.LoadByIdCompanyId(jLinersToBuildRow.ID, companyId);
                    lfsJunctionLiner2Row = (SectionTDS.LFS_JUNCTION_LINER2Row) jlinerGateway.GetRow(jLinersToBuildRow.ID, jLinersToBuildRow.RefID);
                }

                // Update InProcess
                lfsJunctionLiner2Row.InProcess = DateTime.Now;
                lfsJunctionLiner2Row.BuildRebuild++;
            }

            //Update
            try
            {
                sectionGateway.Update();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// Save all sections & works to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>
        public void Save(int companyId)
        {
            FlatSectionJlinerTDS jlinerChanges = (FlatSectionJlinerTDS)Data.GetChanges();

            if (jlinerChanges.FlatSectionJliner.Rows.Count > 0)
            {
                FlatSectionJlinerGateway flatSectionJlinerGateway = new FlatSectionJlinerGateway(jlinerChanges);

                foreach (FlatSectionJlinerTDS.FlatSectionJlinerRow row in (FlatSectionJlinerTDS.FlatSectionJlinerDataTable)jlinerChanges.FlatSectionJliner)
                {
                    // Update comments and history
                    if (!row.Deleted)
                    {
                        Guid id = row.ID;
                        int refId = row.RefID;

                        // original values
                        string originalDetailId = flatSectionJlinerGateway.GetDetailIDOriginal(id, refId, companyId);
                        string originalAddress = flatSectionJlinerGateway.GetAddressOriginal(id, refId, companyId);
                        DateTime? originalPipeLocated = flatSectionJlinerGateway.GetPipeLocatedOriginal(id, refId, companyId);
                        DateTime? originalServicesLocated = flatSectionJlinerGateway.GetServicesLocatedOriginal(id, refId, companyId);
                        DateTime? originalCoInstalled = flatSectionJlinerGateway.GetCoInstalledOriginal(id, refId, companyId);
                        DateTime? originalBackfilledConcrete = flatSectionJlinerGateway.GetBackfilledConcreteOriginal(id, refId, companyId);
                        DateTime? originalBackfilledSoil = flatSectionJlinerGateway.GetBackfilledSoilOriginal(id, refId, companyId);
                        DateTime? originalGrouted = flatSectionJlinerGateway.GetGroutedOriginal(id, refId, companyId);
                        DateTime? originalCored = flatSectionJlinerGateway.GetCoredOriginal(id, refId, companyId);
                        DateTime? originalPrepped = flatSectionJlinerGateway.GetPreppedOriginal(id, refId, companyId);
                        DateTime? originalMeasured = flatSectionJlinerGateway.GetMeasuredOriginal(id, refId, companyId);
                        string originalLinerSize = flatSectionJlinerGateway.GetLinerSizeOriginal(id, refId, companyId);
                        DateTime? originalInProcess = flatSectionJlinerGateway.GetInProcessOriginal(id, refId, companyId);
                        DateTime? originalInStock = flatSectionJlinerGateway.GetInStockOriginal(id, refId, companyId);
                        DateTime? originalDelivered = flatSectionJlinerGateway.GetDeliveredOriginal(id, refId, companyId);
                        int? originalBuildRebuild = flatSectionJlinerGateway.GetBuildRebuildOriginal(id, refId, companyId);
                        DateTime? originalPreVideo = flatSectionJlinerGateway.GetPreVideoOriginal(id, refId, companyId);
                        DateTime? originalLinerInstalled = flatSectionJlinerGateway.GetLinerInstalledOriginal(id, refId, companyId);
                        DateTime? originalFinalVideo = flatSectionJlinerGateway.GetFinalVideoOriginal(id, refId, companyId);
                        double? originalDistanceFromUSMH = flatSectionJlinerGateway.GetDistanceFromUSMHOriginal(id, refId, companyId);
                        double? originalDistanceFromDSMH = flatSectionJlinerGateway.GetDistanceFromDSMHOriginal(id, refId, companyId);
                        string originalMap = flatSectionJlinerGateway.GetMapOriginal(id, refId, companyId);
                        string originalIssue = flatSectionJlinerGateway.GetIssueOriginal(id, refId, companyId);
                        decimal? originalCost = flatSectionJlinerGateway.GetCostOriginal(id, refId, companyId);
                        DateTime? originalVideoInspection = flatSectionJlinerGateway.GetVideoInspectionOriginal(id, refId, companyId);
                        bool originalCoRequired = flatSectionJlinerGateway.GetCoRequiredOriginal(id, refId, companyId);
                        bool originalPitRequired = flatSectionJlinerGateway.GetPitRequiredOriginal(id, refId, companyId);
                        string originalCoPitLocation = flatSectionJlinerGateway.GetCoPitLocationOriginal(id, refId, companyId);
                        bool originalPostContractDigRequired = flatSectionJlinerGateway.GetPostContractDigRequiredOriginal(id, refId, companyId);
                        string originalComments = flatSectionJlinerGateway.GetCommentsOriginal(id, refId, companyId);
                        string originalHistory = flatSectionJlinerGateway.GetHistoryOriginal(id, refId, companyId);
                        DateTime? originalCoCutDown = flatSectionJlinerGateway.GetCoCutDownOriginal(id, refId, companyId);
                        DateTime? originalFinalRestoration = flatSectionJlinerGateway.GetFinalRestorationOriginal(id, refId, companyId);
                        string originalClientLateralID = flatSectionJlinerGateway.GetClientLateralIDOriginal(id, refId, companyId);
                        string originalVideoLengthToPropertyLine = flatSectionJlinerGateway.GetVideoLengthToPropertyLineOriginal(id, refId, companyId);
                        bool originalLiningThruCo = flatSectionJlinerGateway.GetLiningThruCoOriginal(id, refId, companyId);
                        string originalHamiltonInspectionNumber = flatSectionJlinerGateway.GetHamiltonInspectionNumberOriginal(id, refId, companyId);
                        DateTime? originalNoticeDelivered = flatSectionJlinerGateway.GetNoticeDeliveredOriginal(id, refId, companyId);

                        // new values
                        string newComments = flatSectionJlinerGateway.GetComments(id, refId, companyId);
                        string newHistory = flatSectionJlinerGateway.GetHistory(id, refId, companyId);

                        Jliner jliner = new Jliner(null);
                        jliner.UpdateDirect(row.ID, row.RefID, row.COMPANY_ID, originalDetailId, originalAddress, originalPipeLocated, originalServicesLocated, originalCoInstalled, originalBackfilledConcrete, originalBackfilledSoil, originalGrouted, originalCored, originalPrepped, originalMeasured, originalLinerSize, originalInProcess, originalInStock, originalDelivered, originalBuildRebuild, originalPreVideo, originalLinerInstalled, originalFinalVideo, originalDistanceFromUSMH, originalDistanceFromDSMH, originalMap, originalIssue, originalCost, false, originalVideoInspection, originalCoRequired, originalPitRequired, originalCoPitLocation, originalPostContractDigRequired, originalComments, originalHistory, originalCoCutDown, originalFinalRestoration, originalClientLateralID, originalVideoLengthToPropertyLine, originalLiningThruCo, originalHamiltonInspectionNumber, originalNoticeDelivered, row.ID, row.RefID, row.COMPANY_ID, originalDetailId, originalAddress, originalPipeLocated, originalServicesLocated, originalCoInstalled, originalBackfilledConcrete, originalBackfilledSoil, originalGrouted, originalCored, originalPrepped, originalMeasured, originalLinerSize, originalInProcess, originalInStock, originalDelivered, originalBuildRebuild, originalPreVideo, originalLinerInstalled, originalFinalVideo, originalDistanceFromUSMH, originalDistanceFromDSMH, originalMap, originalIssue, originalCost, false, originalVideoInspection, originalCoRequired, originalPitRequired, originalCoPitLocation, originalPostContractDigRequired, newComments, newHistory, originalCoCutDown, originalFinalRestoration, originalClientLateralID, originalVideoLengthToPropertyLine, originalLiningThruCo, originalHamiltonInspectionNumber, originalNoticeDelivered);
                    }
                }
            }
        }
        /// <summary>
        /// Save to Section and Jliner rows
        /// </summary>
        /// <param name="sectionTDS">sectionTDS</param>
        public void Save(SectionTDS sectionTDS)
        {
            FlatSectionJlinerTDS flatSectionJlinerChanges = (FlatSectionJlinerTDS)Data.GetChanges();
            if (flatSectionJlinerChanges.FlatSectionJliner.Rows.Count > 0)
            {
                SectionGateway sectionGateway = new SectionGateway(sectionTDS);
                LiquiForce.LFSLive.BL.CWP.Section.Section section = new LiquiForce.LFSLive.BL.CWP.Section.Section(sectionTDS);
                JlinerGateway jlinerGateway = new JlinerGateway(sectionTDS);
                Jliner jliner = new Jliner(sectionTDS);
                JlinerCommentGateway jlinerCommentGateway = new JlinerCommentGateway(sectionTDS);
                JlinerComments jlinerComments = new JlinerComments(jlinerCommentGateway.Data);
                JlinerHistoryGateway jlinerHistoryGateway = new JlinerHistoryGateway(sectionTDS);
                JlinerHistory jlinerHistory = new JlinerHistory(jlinerHistoryGateway.Data);

                sectionGateway.ClearBeforeFill = false;
                jlinerGateway.ClearBeforeFill = false;
                jlinerCommentGateway.ClearBeforeFill = false;
                jlinerHistoryGateway.ClearBeforeFill = false;

                foreach (FlatSectionJlinerTDS.FlatSectionJlinerRow flatSectionJlinerRow in (FlatSectionJlinerTDS.FlatSectionJlinerDataTable)flatSectionJlinerChanges.FlatSectionJliner)
                {
                    // Load section and jliner
                    // ... Load section
                    try
                    {
                        //... Search section row
                        sectionGateway.GetRow(flatSectionJlinerRow.ID);
                    }
                    catch
                    {
                        //... Load section and section's jliners
                        sectionGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID);
                        jlinerGateway.LoadByIdCompanyId(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID);
                        jlinerCommentGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID);
                        jlinerHistoryGateway.LoadById(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID);
                    }

                    // Update

                    // ... Update jliner
                    string address = ""; if (!flatSectionJlinerRow.IsNull("Address")) address = flatSectionJlinerRow.Address;
                    DateTime? pipeLocated = null; if (!flatSectionJlinerRow.IsNull("PipeLocated")) pipeLocated = flatSectionJlinerRow.PipeLocated;
                    DateTime? servicesLocated = null; if (!flatSectionJlinerRow.IsNull("ServicesLocated")) servicesLocated = flatSectionJlinerRow.ServicesLocated;
                    DateTime? coInstalled = null; if (!flatSectionJlinerRow.IsNull("CoInstalled")) coInstalled = flatSectionJlinerRow.CoInstalled;
                    DateTime? backfilledConcrete = null; if (!flatSectionJlinerRow.IsNull("BackfilledConcrete")) backfilledConcrete = flatSectionJlinerRow.BackfilledConcrete;
                    DateTime? backfilledSoil = null; if (!flatSectionJlinerRow.IsNull("BackfilledSoil")) backfilledSoil = flatSectionJlinerRow.BackfilledSoil;
                    DateTime? grouted = null; if (!flatSectionJlinerRow.IsNull("Grouted")) grouted = flatSectionJlinerRow.Grouted;
                    DateTime? cored = null; if (!flatSectionJlinerRow.IsNull("Cored")) cored = flatSectionJlinerRow.Cored;
                    DateTime? prepped = null; if (!flatSectionJlinerRow.IsNull("Prepped")) prepped = flatSectionJlinerRow.Prepped;
                    DateTime? measured = null; if (!flatSectionJlinerRow.IsNull("Measured")) measured = flatSectionJlinerRow.Measured;
                    string linerSize = ""; if (!flatSectionJlinerRow.IsNull("LinerSize")) linerSize = flatSectionJlinerRow.LinerSize;
                    DateTime? inProcess = null; if (!flatSectionJlinerRow.IsNull("Inprocess")) inProcess = flatSectionJlinerRow.InProcess;
                    DateTime? inStock = null; if (!flatSectionJlinerRow.IsNull("InStock")) inStock = flatSectionJlinerRow.InStock;
                    DateTime? delivered = null; if (!flatSectionJlinerRow.IsNull("Delivered")) delivered = flatSectionJlinerRow.Delivered;
                    DateTime? preVideo = null; if (!flatSectionJlinerRow.IsNull("PreVideo")) preVideo = flatSectionJlinerRow.PreVideo;
                    DateTime? linerInstalled = null; if (!flatSectionJlinerRow.IsNull("LinerInstalled")) linerInstalled = flatSectionJlinerRow.LinerInstalled;
                    DateTime? finalVideo = null; if (!flatSectionJlinerRow.IsNull("FinalVideo")) finalVideo = flatSectionJlinerRow.FinalVideo;
                    double? distanceFromUSMH = null; if (!flatSectionJlinerRow.IsNull("DistanceFromUSMH")) distanceFromUSMH = flatSectionJlinerRow.DistanceFromUSMH;
                    double? distanceFromDSMH = null; if (!flatSectionJlinerRow.IsNull("DistanceFromDSMH")) distanceFromDSMH = flatSectionJlinerRow.DistanceFromDSMH;
                    string history = ""; if (!flatSectionJlinerRow.IsNull("History")) history = flatSectionJlinerRow.History;
                    string map = "";
                    string issue = flatSectionJlinerRow.Issue;
                    decimal? cost = null; if (!flatSectionJlinerRow.IsNull("Cost")) cost = flatSectionJlinerRow.Cost;
                    bool deleted = flatSectionJlinerRow.Deleted;

                    // ... Delete all comments and history for a jliner
                    if (deleted)
                    {
                        jlinerComments.DeleteAllCommentsForAJliner(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID);
                        jlinerHistory.DeleteAllHistoryForAJliner(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID);
                    }

                    DateTime? videoInspection = null; if (!flatSectionJlinerRow.IsNull("VideoInspection")) videoInspection = flatSectionJlinerRow.VideoInspection;
                    bool coRequired = flatSectionJlinerRow.CoRequired;
                    bool pitRequired = flatSectionJlinerRow.PitRequired;
                    string coPitLocation = ""; if (!flatSectionJlinerRow.IsNull("CoPitLocation")) coPitLocation = flatSectionJlinerRow.CoPitLocation;
                    bool postContractDigRequired = flatSectionJlinerRow.PostContractDigRequired;
                    DateTime? coCutDown = null; if (!flatSectionJlinerRow.IsNull("CoCutDown")) coCutDown = flatSectionJlinerRow.CoCutDown;
                    DateTime? finalRestoration = null; if (!flatSectionJlinerRow.IsNull("FinalRestoration")) finalRestoration = flatSectionJlinerRow.FinalRestoration;
                    string clientLateralId = ""; if (!flatSectionJlinerRow.IsNull("ClientLateralID")) clientLateralId = flatSectionJlinerRow.ClientLateralID;
                    string videoLengthToPropertyLine = ""; if (!flatSectionJlinerRow.IsNull("VideoLengthToPropertyLine")) videoLengthToPropertyLine = flatSectionJlinerRow.VideoLengthToPropertyLine;
                    bool liningThruCo = flatSectionJlinerRow.LiningThruCo;
                    string hamiltonInspectionNumber = ""; if (!flatSectionJlinerRow.IsNull("HamiltonInspectionNumber")) hamiltonInspectionNumber = flatSectionJlinerRow.HamiltonInspectionNumber;
                    DateTime? noticeDelivered = null; if (!flatSectionJlinerRow.IsNull("NoticeDelivered")) noticeDelivered = flatSectionJlinerRow.NoticeDelivered;

                    jliner.Update(flatSectionJlinerRow.ID, flatSectionJlinerRow.RefID, flatSectionJlinerRow.COMPANY_ID, flatSectionJlinerRow.DetailID, address, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, preVideo, linerInstalled, finalVideo, distanceFromUSMH, distanceFromDSMH,map, issue, cost, deleted, videoInspection, coRequired, pitRequired, coPitLocation, postContractDigRequired, coCutDown, finalRestoration, clientLateralId, videoLengthToPropertyLine, liningThruCo, hamiltonInspectionNumber, noticeDelivered);

                    // ... Update section
                    section.UpdateJliners(flatSectionJlinerRow.ID, flatSectionJlinerRow.COMPANY_ID);
                }
            }
        }
        /// <summary>
        /// Save all sections & works to database (direct)
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="companyId">companyId</param>
        public void Save(Guid id, int companyId)
        {
            JlinerAddTDS jlinerAddChanges = (JlinerAddTDS)Data.GetChanges();

            if (jlinerAddChanges.JunctionLiner2.Rows.Count > 0)
            {
                JlinerAddJunctionLiner2Gateway jlinerAddJunctionLiner2Gateway  = new JlinerAddJunctionLiner2Gateway(jlinerAddChanges);

                foreach (JlinerAddTDS.JunctionLiner2Row row in (JlinerAddTDS.JunctionLiner2DataTable)jlinerAddChanges.JunctionLiner2)
                {
                    // Insert new laterals
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        string detailId = ""; if (!row.IsDetailIDNull()) detailId = row.DetailID;
                        string address = ""; if (!row.IsAddressNull()) address = row.Address;
                        DateTime? pipeLocated = null; if (!row.IsPipeLocatedNull()) pipeLocated = row.PipeLocated;
                        DateTime? servicesLocated = null; if (!row.IsServicesLocatedNull()) servicesLocated = row.ServicesLocated;
                        DateTime? coInstalled = null; if (!row.IsCoInstalledNull()) coInstalled = row.CoInstalled;
                        DateTime? backfilledConcrete = null; if (!row.IsBackfilledConcreteNull()) backfilledConcrete = row.BackfilledConcrete;
                        DateTime? backfilledSoil = null; if (!row.IsBackfilledSoilNull()) backfilledSoil = row.BackfilledSoil;
                        DateTime? grouted = null; if (!row.IsGroutedNull()) grouted = row.Grouted;
                        DateTime? cored = null; if (!row.IsCoredNull()) cored = row.Cored;
                        DateTime? prepped = null; if (!row.IsPreppedNull()) prepped = row.Prepped;
                        DateTime? measured = null; if (!row.IsMeasuredNull()) measured = row.Measured;
                        string linerSize = ""; if (!row.IsLinerSizeNull()) linerSize = row.LinerSize;
                        DateTime? inProcess = null; if (!row.IsInProcessNull()) inProcess = row.InProcess;
                        DateTime? inStock = null; if (!row.IsInStockNull()) inStock = row.InStock;
                        DateTime? delivered = null; if (!row.IsDeliveredNull()) delivered = row.Delivered;
                        int? buildRebuild = null; if (!row.IsBuildRebuildNull()) buildRebuild = row.BuildRebuild;
                        DateTime? preVideo = null; if (!row.IsPreVideoNull()) preVideo = row.PreVideo;
                        DateTime? linerInstalled = null; if (!row.IsLinerInstalledNull()) linerInstalled = row.LinerInstalled;
                        DateTime? finalVideo = null; if (!row.IsFinalVideoNull()) finalVideo = row.FinalVideo;
                        double? distanceFromUSMH = null; if (!row.IsDistanceFromUSMHNull()) distanceFromUSMH = row.DistanceFromUSMH;
                        double? distanceFromDSMH = null; if (!row.IsDistanceFromDSMHNull()) distanceFromDSMH = row.DistanceFromDSMH;
                        string map = ""; if (!row.IsMapNull()) map = row.Map;
                        string issue = row.Issue;
                        decimal? cost = null; if (!row.IsCostNull()) cost = row.Cost;
                        bool deleted = row.Deleted;
                        DateTime? videoInspections = null; if (!row.IsVideoInspectionNull()) videoInspections = row.VideoInspection;
                        bool coRequired = row.CoRequired;
                        bool pitRequired = row.PitRequired;
                        string coPitLocation = ""; if (!row.IsCoPitLocationNull()) coPitLocation = row.CoPitLocation;
                        bool postContractDigRequired = row.PostContractDigRequired;
                        string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments;
                        string history = ""; if (!row.IsHistoryNull()) history = row.History;
                        DateTime? coCutDown = null; if (!row.IsCoCutDownNull()) coCutDown = row.CoCutDown;
                        DateTime? finalRestoration = null; if (!row.IsFinalRestorationNull()) finalRestoration = row.FinalRestoration;
                        string clientLateralID = ""; if (!row.IsClientLateralIDNull()) clientLateralID = row.ClientLateralID;
                        string videoLengthToPropertyLine = ""; if  (!row.IsVideoLengthToPropertyLineNull()) videoLengthToPropertyLine = row.VideoLengthToPropertyLine;
                        bool liningThruCo = row.LiningThruCo;
                        string hamiltonInspectionNumber = ""; if (!row.IsHamiltonInspectionNumberNull()) hamiltonInspectionNumber = row.HamiltonInspectionNumber;
                        DateTime? noticeDelivered = null; if (!row.IsNoticeDeliveredNull()) noticeDelivered = row.NoticeDelivered;

                        Jliner jliner = new Jliner(null);
                        jliner.InsertDirect(row.ID, row.RefID, row.COMPANY_ID, detailId, address, pipeLocated, servicesLocated, coInstalled, backfilledConcrete, backfilledSoil, grouted, cored, prepped, measured, linerSize, inProcess, inStock, delivered, buildRebuild, preVideo, linerInstalled, finalVideo, distanceFromUSMH, distanceFromDSMH, map, issue, cost, deleted, videoInspections, coRequired, pitRequired, coPitLocation, postContractDigRequired, comments, history, coCutDown, finalRestoration, clientLateralID, videoLengthToPropertyLine, liningThruCo, hamiltonInspectionNumber, noticeDelivered);
                    }

                    // Update laterals
                    if ((!row.Deleted) && (row.InDatabase))
                    {
                        int refId = row.RefID;

                        // original values
                        string originalDetailId = jlinerAddJunctionLiner2Gateway.GetDetailIDOriginal(id, refId, companyId);
                        string originalAddress = jlinerAddJunctionLiner2Gateway.GetAddressOriginal(id, refId, companyId);
                        DateTime? originalPipeLocated = jlinerAddJunctionLiner2Gateway.GetPipeLocatedOriginal(id, refId, companyId);
                        DateTime? originalServicesLocated = jlinerAddJunctionLiner2Gateway.GetServicesLocatedOriginal(id, refId, companyId);
                        DateTime? originalCoInstalled = jlinerAddJunctionLiner2Gateway.GetCoInstalledOriginal(id, refId, companyId);
                        DateTime? originalBackfilledConcrete = jlinerAddJunctionLiner2Gateway.GetBackfilledConcreteOriginal(id, refId, companyId);
                        DateTime? originalBackfilledSoil = jlinerAddJunctionLiner2Gateway.GetBackfilledSoilOriginal (id, refId, companyId);
                        DateTime? originalGrouted = jlinerAddJunctionLiner2Gateway.GetGroutedOriginal(id, refId, companyId);
                        DateTime? originalCored = jlinerAddJunctionLiner2Gateway.GetCoredOriginal(id, refId, companyId);
                        DateTime? originalPrepped = jlinerAddJunctionLiner2Gateway.GetPreppedOriginal(id, refId, companyId);
                        DateTime? originalMeasured = jlinerAddJunctionLiner2Gateway.GetMeasuredOriginal (id, refId, companyId);
                        string originalLinerSize = jlinerAddJunctionLiner2Gateway.GetLinerSizeOriginal(id, refId, companyId);
                        DateTime? originalInProcess = jlinerAddJunctionLiner2Gateway.GetInProcessOriginal(id, refId, companyId);
                        DateTime? originalInStock = jlinerAddJunctionLiner2Gateway.GetInStockOriginal(id, refId, companyId);
                        DateTime? originalDelivered = jlinerAddJunctionLiner2Gateway.GetDeliveredOriginal(id, refId, companyId);
                        int? originalBuildRebuild = jlinerAddJunctionLiner2Gateway.GetBuildRebuildOriginal(id, refId, companyId);
                        DateTime? originalPreVideo = jlinerAddJunctionLiner2Gateway.GetPreVideoOriginal(id, refId, companyId);
                        DateTime? originalLinerInstalled = jlinerAddJunctionLiner2Gateway.GetLinerInstalledOriginal(id, refId, companyId);
                        DateTime? originalFinalVideo = jlinerAddJunctionLiner2Gateway.GetFinalVideoOriginal(id, refId, companyId);
                        double? originalDistanceFromUSMH = jlinerAddJunctionLiner2Gateway.GetDistanceFromUSMHOriginal(id, refId, companyId);
                        double? originalDistanceFromDSMH = jlinerAddJunctionLiner2Gateway.GetDistanceFromDSMHOriginal(id, refId, companyId);
                        string originalMap = jlinerAddJunctionLiner2Gateway.GetMapOriginal(id, refId, companyId);
                        string originalIssue = jlinerAddJunctionLiner2Gateway.GetIssueOriginal(id, refId, companyId);
                        decimal? originalCost = jlinerAddJunctionLiner2Gateway.GetCostOriginal(id, refId, companyId);
                        DateTime? originalVideoInspection = jlinerAddJunctionLiner2Gateway.GetVideoInspectionOriginal(id, refId, companyId);
                        bool originalCoRequired =jlinerAddJunctionLiner2Gateway.GetCoRequiredOriginal(id, refId, companyId);
                        bool originalPitRequired = jlinerAddJunctionLiner2Gateway.GetPitRequiredOriginal(id, refId, companyId);
                        string originalCoPitLocation = jlinerAddJunctionLiner2Gateway.GetCoPitLocationOriginal(id, refId, companyId);
                        bool originalPostContractDigRequired =jlinerAddJunctionLiner2Gateway.GetPostContractDigRequiredOriginal(id, refId, companyId);
                        string originalComments = jlinerAddJunctionLiner2Gateway.GetCommentsOriginal(id, refId, companyId);
                        string originalHistory = jlinerAddJunctionLiner2Gateway.GetHistoryOriginal(id, refId, companyId);
                        DateTime? originalCoCutDown = jlinerAddJunctionLiner2Gateway.GetCoCutDownOriginal(id, refId, companyId);
                        DateTime? originalFinalRestoration = jlinerAddJunctionLiner2Gateway.GetFinalRestorationOriginal(id, refId, companyId);
                        string originalClientLateralID = jlinerAddJunctionLiner2Gateway.GetClientLateralIDOriginal(id, refId, companyId);
                        string originalVideoLengthToPropertyLine = jlinerAddJunctionLiner2Gateway.GetVideoLengthToPropertyLineOriginal(id, refId, companyId);
                        bool originalLiningThruCo = jlinerAddJunctionLiner2Gateway.GetLiningThruCoOriginal(id, refId, companyId);
                        string originalHamiltonInspectionNumber = jlinerAddJunctionLiner2Gateway.GetHamiltonInspectionNumberOriginal(id, refId, companyId);
                        DateTime? originalNoticeDelivered = jlinerAddJunctionLiner2Gateway.GetNoticeDeliveredOriginal(id, refId, companyId);

                        // new values
                        string newDetailId = jlinerAddJunctionLiner2Gateway.GetDetailID(id, refId, companyId);
                        string newAddress = jlinerAddJunctionLiner2Gateway.GetAddress(id, refId, companyId);
                        DateTime? newPipeLocated = jlinerAddJunctionLiner2Gateway.GetPipeLocated(id, refId, companyId);
                        DateTime? newServicesLocated = jlinerAddJunctionLiner2Gateway.GetServicesLocated(id, refId, companyId);
                        DateTime? newCoInstalled = jlinerAddJunctionLiner2Gateway.GetCoInstalled(id, refId, companyId);
                        DateTime? newBackfilledConcrete = jlinerAddJunctionLiner2Gateway.GetBackfilledConcrete(id, refId, companyId);
                        DateTime? newBackfilledSoil = jlinerAddJunctionLiner2Gateway.GetBackfilledSoil(id, refId, companyId);
                        DateTime? newGrouted = jlinerAddJunctionLiner2Gateway.GetGrouted(id, refId, companyId);
                        DateTime? newCored = jlinerAddJunctionLiner2Gateway.GetCored(id, refId, companyId);
                        DateTime? newPrepped = jlinerAddJunctionLiner2Gateway.GetPrepped(id, refId, companyId);
                        DateTime? newMeasured = jlinerAddJunctionLiner2Gateway.GetMeasured(id, refId, companyId);
                        string newLinerSize = jlinerAddJunctionLiner2Gateway.GetLinerSize(id, refId, companyId);
                        DateTime? newInProcess = jlinerAddJunctionLiner2Gateway.GetInProcess(id, refId, companyId);
                        DateTime? newInStock = jlinerAddJunctionLiner2Gateway.GetInStock(id, refId, companyId);
                        DateTime? newDelivered = jlinerAddJunctionLiner2Gateway.GetDelivered(id, refId, companyId);
                        int? newBuildRebuild = jlinerAddJunctionLiner2Gateway.GetBuildRebuild(id, refId, companyId);
                        DateTime? newPreVideo = jlinerAddJunctionLiner2Gateway.GetPreVideo(id, refId, companyId);
                        DateTime? newLinerInstalled = jlinerAddJunctionLiner2Gateway.GetLinerInstalled(id, refId, companyId);
                        DateTime? newFinalVideo = jlinerAddJunctionLiner2Gateway.GetFinalVideo(id, refId, companyId);
                        double? newDistanceFromUSMH = jlinerAddJunctionLiner2Gateway.GetDistanceFromUSMH(id, refId, companyId);
                        double? newDistanceFromDSMH = jlinerAddJunctionLiner2Gateway.GetDistanceFromDSMH(id, refId, companyId);
                        string newMap = jlinerAddJunctionLiner2Gateway.GetMap(id, refId, companyId);
                        string newIssue = jlinerAddJunctionLiner2Gateway.GetIssue(id, refId, companyId);
                        decimal? newCost = jlinerAddJunctionLiner2Gateway.GetCost(id, refId, companyId);
                        DateTime? newVideoInspection = jlinerAddJunctionLiner2Gateway.GetVideoInspection(id, refId, companyId);
                        bool newCoRequired = jlinerAddJunctionLiner2Gateway.GetCoRequired(id, refId, companyId);
                        bool newPitRequired = jlinerAddJunctionLiner2Gateway.GetPitRequired(id, refId, companyId);
                        string newCoPitLocation = jlinerAddJunctionLiner2Gateway.GetCoPitLocation(id, refId, companyId);
                        bool newPostContractDigRequired = jlinerAddJunctionLiner2Gateway.GetPostContractDigRequired(id, refId, companyId);
                        string newComments = jlinerAddJunctionLiner2Gateway.GetComments(id, refId, companyId);
                        string newHistory = jlinerAddJunctionLiner2Gateway.GetHistory(id, refId, companyId);
                        DateTime? newCoCutDown = jlinerAddJunctionLiner2Gateway.GetCoCutDown(id, refId, companyId);
                        DateTime? newFinalRestoration = jlinerAddJunctionLiner2Gateway.GetFinalRestoration(id, refId, companyId);
                        string newClientLateralID = jlinerAddJunctionLiner2Gateway.GetClientLateralID(id, refId, companyId);
                        string newVideoLengthToPropertyLine = jlinerAddJunctionLiner2Gateway.GetVideoLengthToPropertyLine(id, refId, companyId);
                        bool newLiningThruCo = jlinerAddJunctionLiner2Gateway.GetLiningThruCo(id, refId, companyId);
                        string newHamiltonInspectionNumber = jlinerAddJunctionLiner2Gateway.GetHamiltonInspectionNumber(id, refId, companyId);
                        DateTime? newNoticeDelivered = jlinerAddJunctionLiner2Gateway.GetNoticeDelivered(id, refId, companyId);

                        Jliner jliner = new Jliner(null);
                        jliner.UpdateDirect(row.ID, row.RefID, row.COMPANY_ID, originalDetailId, originalAddress, originalPipeLocated, originalServicesLocated, originalCoInstalled, originalBackfilledConcrete, originalBackfilledSoil, originalGrouted, originalCored, originalPrepped, originalMeasured, originalLinerSize, originalInProcess, originalInStock, originalDelivered, originalBuildRebuild, originalPreVideo, originalLinerInstalled, originalFinalVideo, originalDistanceFromUSMH, originalDistanceFromDSMH, originalMap, originalIssue, originalCost, false, originalVideoInspection, originalCoRequired, originalPitRequired, originalCoPitLocation, originalPostContractDigRequired, originalComments, originalHistory, originalCoCutDown, originalFinalRestoration, originalClientLateralID, originalVideoLengthToPropertyLine, originalLiningThruCo, originalHamiltonInspectionNumber, originalNoticeDelivered, row.ID, row.RefID, row.COMPANY_ID, newDetailId, newAddress, newPipeLocated, newServicesLocated, newCoInstalled, newBackfilledConcrete, newBackfilledSoil, newGrouted, newCored, newPrepped, newMeasured, newLinerSize, newInProcess, newInStock, newDelivered, newBuildRebuild, newPreVideo, newLinerInstalled, newFinalVideo, newDistanceFromUSMH, newDistanceFromDSMH, newMap, newIssue, newCost, false, newVideoInspection, newCoRequired, newPitRequired, newCoPitLocation, newPostContractDigRequired, newComments, newHistory, newCoCutDown, newFinalRestoration, newClientLateralID, newVideoLengthToPropertyLine, newLiningThruCo, newHamiltonInspectionNumber, newNoticeDelivered);
                    }
                }
            }
        }