Ejemplo n.º 1
0
        /// <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);
                    }
                }
            }
        }