コード例 #1
0
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void Delete(int workId, int companyId)
        {
            WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway();
            workPointRepairsRepairGateway.LoadByWorkId(workId, companyId);

            foreach (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRRow row in (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRDataTable)workPointRepairsRepairGateway.Table)
            {
                workPointRepairsRepairGateway.Delete(workId, row.RepairPointID, companyId);
            }
        }
コード例 #2
0
        /// <summary>
        /// Save a Previous PR work
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="section_assetId">section_assetId</param>
        /// <param name="companyId">companyId</param>
        private void SavePreviousPRWork(int projectId, int section_assetId, int companyId)
        {
            // Load Previous work - Point Repairs data (last sections work)
            string workType = "Point Repairs";
            WorkPointRepairsGateway workPointRepairsGateway = new WorkPointRepairsGateway();
            workPointRepairsGateway.LoadTop1ByProjectIdAssetIdWorkType(projectId, section_assetId, workType, companyId);

            int workId = workPointRepairsGateway.GetWorkIdTop1();
            string clientId = ""; if (workPointRepairsGateway.GetClientId(workId) != "") clientId = workPointRepairsGateway.GetClientId(workId);
            string measurementTakenBy = ""; if (workPointRepairsGateway.GetMeasurementTakenBy(workId) != "") measurementTakenBy = workPointRepairsGateway.GetMeasurementTakenBy(workId);
            DateTime? repairConfirmationDate = null; if (workPointRepairsGateway.GetRepairConfirmationDate(workId).HasValue) repairConfirmationDate = workPointRepairsGateway.GetRepairConfirmationDate(workId);
            bool bypassRequired = workPointRepairsGateway.GetBypassRequired(workId);
            string roboticDistances = ""; if (workPointRepairsGateway.GetRoboticDistances(workId) != "") roboticDistances = workPointRepairsGateway.GetRoboticDistances(workId);
            DateTime? proposedLiningDate = null; if (workPointRepairsGateway.GetProposedLiningDate(workId).HasValue) proposedLiningDate = workPointRepairsGateway.GetProposedLiningDate(workId);
            DateTime? deadlineLiningDate = null; if (workPointRepairsGateway.GetDeadlineLiningDate(workId).HasValue) deadlineLiningDate = workPointRepairsGateway.GetDeadlineLiningDate(workId);
            DateTime? finalVideoDate = null; if (workPointRepairsGateway.GetFinalVideoDate(workId).HasValue) finalVideoDate = workPointRepairsGateway.GetFinalVideoDate(workId);
            int? estimatedJoints = null; if (workPointRepairsGateway.GetEstimatedJoints(workId).HasValue) estimatedJoints = workPointRepairsGateway.GetEstimatedJoints(workId);
            int? jointsTestSealed = null; if (workPointRepairsGateway.GetJointsTestSealed(workId).HasValue) jointsTestSealed = workPointRepairsGateway.GetJointsTestSealed(workId);
            bool issueIdentified = workPointRepairsGateway.GetIssueIdentified(workId);
            bool issueLfs = workPointRepairsGateway.GetIssueLFS(workId);
            bool issueClient = workPointRepairsGateway.GetIssueClient(workId);
            bool issueSales = workPointRepairsGateway.GetIssueSales(workId);
            bool issueGivenToClient = workPointRepairsGateway.GetIssueGivenToClient(workId);
            bool issueResolved = workPointRepairsGateway.GetIssueResolved(workId);
            bool issueInvestigation = workPointRepairsGateway.GetIssueInvestigation(workId);
            string repairId = ""; if (workPointRepairsGateway.GetRepairID(workId) != "") repairId = workPointRepairsGateway.GetRepairID(workId);

            // Load Previous work - General work data
            WorkGateway workGateway = new WorkGateway();
            workGateway.LoadByWorkId(workId, companyId);

            int? libraryCategoriesId = null; if (workGateway.GetLibraryCategoriesId(workId).HasValue) libraryCategoriesId = workGateway.GetLibraryCategoriesId(workId);
            string comments = workGateway.GetComments(workId);
            string history = workGateway.GetHistory(workId);

            // Save new work
            WorkPointRepairs workPointRepairs = new WorkPointRepairs(null);
            int newSectionWorkId = workPointRepairs.InsertDirect(projectId, section_assetId, libraryCategoriesId, clientId, measurementTakenBy, repairConfirmationDate, bypassRequired, roboticDistances, proposedLiningDate, deadlineLiningDate, finalVideoDate, estimatedJoints, jointsTestSealed, issueIdentified, issueLfs, issueClient, issueSales, issueGivenToClient, issueResolved, issueInvestigation, repairId, false, companyId, comments, history);

            // Load Previous work  -  Save pr repair
            WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway();
            workPointRepairsRepairGateway.LoadByWorkId(workId, companyId);

            foreach (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRRow row in (WorkTDS.LFS_WORK_POINT_REPAIRS_REPAIRDataTable)workPointRepairsRepairGateway.Table)
            {
                string repairPointId = row.RepairPointID;
                string type = ""; if (!row.IsTypeNull()) type = row.Type;
                string reamDistance = ""; if (!row.IsReamDistanceNull()) reamDistance = row.ReamDistance;
                DateTime? reamDate = null; if (!row.IsReamDateNull()) reamDate = row.ReamDate;
                string linerDistance = ""; if (!row.IsLinerDistanceNull()) linerDistance = row.LinerDistance;
                string direction = ""; if (!row.IsDirectionNull()) direction = row.Direction;
                int? reinstates = null; if (!row.IsReinstatesNull()) reinstates = row.Reinstates;
                string ltmh = ""; if (!row.IsLTMHNull()) ltmh = row.LTMH;
                string vtmh = ""; if (!row.IsVTMHNull()) vtmh = row.VTMH;
                string distance = ""; if (!row.IsDistanceNull()) distance = row.Distance;
                string size_ = ""; if (!row.IsSize_Null()) size_ = row.Size_;
                DateTime? installDate = null; if (!row.IsInstallDateNull()) installDate = row.InstallDate;
                string mhShot = ""; if (!row.IsMHShotNull()) mhShot = row.MHShot;
                string groutDistance = ""; if (!row.IsGroutDistanceNull()) groutDistance = row.GroutDistance;
                DateTime? groutDate = null; if (!row.IsGroutDateNull()) groutDate = row.GroutDate;
                string approval = ""; if (!row.IsApprovalNull()) approval = row.Approval;
                bool extraRepair = row.ExtraRepair;
                bool cancelled = row.Cancelled;
                string commentsRepair = ""; if (!row.IsCommentsNull()) commentsRepair = row.Comments;
                string defectQualifier = ""; if (!row.IsDefectQualifierNull()) defectQualifier = row.DefectQualifier;
                string defecDetails = ""; if (!row.IsDefectDetailsNull()) defecDetails = row.DefectDetails;
                string length = ""; if (!row.IsLengthNull()) length = row.Length;
                DateTime? reinstateDate = null; if (!row.IsReinstateDateNull()) reinstateDate = row.ReinstateDate;

                WorkPointRepairsRepair workPointRepairsRepair = new WorkPointRepairsRepair();
                workPointRepairsRepair.InsertDirect(newSectionWorkId, repairPointId, type, reamDistance, reamDate, linerDistance, direction, reinstates, ltmh, vtmh, distance, size_, installDate, mhShot, groutDistance, groutDate, approval, extraRepair, cancelled, commentsRepair, false, companyId, defectQualifier, defectQualifier, length, reinstateDate);
            }

            // Load Previous work  - Comments and History
            SavePreviousComments(workId, workType, companyId, newSectionWorkId);
            SavePreviousHistory(workId, workType, companyId, newSectionWorkId);
        }
コード例 #3
0
 /// <summary>
 /// DeleteDirect
 /// </summary>
 /// <param name="workId">workId</param>
 /// <param name="repairPointId">repairPointId</param>
 /// <param name="companyId">companyId</param>
 public void DeleteDirect(int workId, string repairPointId, int companyId)
 {
     WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway(null);
     workPointRepairsRepairGateway.Delete(workId, repairPointId, companyId);
 }
コード例 #4
0
 /// <summary>
 /// Updatedirect
 /// </summary>
 /// <param name="originalWorkId">originalWorkId</param>
 /// <param name="originalRepairPointId">originalRepairPointId</param>
 /// <param name="originalType">originalType</param>
 /// <param name="originalReamDistance">originalReamDistance</param>
 /// <param name="originalReamDate">originalReamDate</param>
 /// <param name="originalLinerDistance">originalLinerDistance</param>
 /// <param name="originalDirection">originalDirection</param>
 /// <param name="originalReinstates">originalReinstates</param>
 /// <param name="originalLtmh">originalLtmh</param>
 /// <param name="originalVtmh">originalVtmh</param>
 /// <param name="originalDistance">originalDistance</param>
 /// <param name="originalSize_">originalSize_</param>
 /// <param name="originalInstallDate">originalInstallDate</param>
 /// <param name="originalMhShot">originalMhShot</param>
 /// <param name="originalGroutDistance">originalGroutDistance</param>
 /// <param name="originalGroutDate">originalGroutDate</param>
 /// <param name="originalApproval">originalApproval</param>
 /// <param name="originalExtraRepair">originalExtraRepair</param>
 /// <param name="originalCancelled">originalCancelled</param>
 /// <param name="originalComments">originalComments</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="originalDefectQualifier">originalDefectQualifier</param>
 /// <param name="originalDefectDetails">originalDefetDetails</param>
 /// <param name="originalLength">originalLength</param>
 /// 
 /// <param name="newWorkId">newWorkId</param>
 /// <param name="newRepairPointId">newRepairPointId</param>
 /// <param name="newType">newType</param>
 /// <param name="newReamDistance">newReamDistance</param>
 /// <param name="newReamDate">newReamDate</param>
 /// <param name="newLinerDistance">newLinerDistance</param>
 /// <param name="newDirection">newDirection</param>
 /// <param name="newReinstates">newReinstates</param>
 /// <param name="newLtmh">newLtmh</param>
 /// <param name="newVtmh">newVtmh</param>
 /// <param name="newDistance">newDistance</param>
 /// <param name="newSize_">newSize_</param>
 /// <param name="newInstallDate">newInstallDate</param>
 /// <param name="newMhShot">newMhShot</param>
 /// <param name="newGroutDistance">newGroutDistance</param>
 /// <param name="newGroutDate">newGroutDate</param>
 /// <param name="newApproval">newApproval</param>
 /// <param name="newExtraRepair">newExtraRepair</param>
 /// <param name="newCancelled">newCancelled</param>
 /// <param name="newComments">newComments</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 /// <param name="newDefectQualifierf">newDefectQualifier</param>
 /// <param name="newDefectDetails">newDefectDetails</param>
 /// <param name="newLength">newLength</param>
 public void Updatedirect(int originalWorkId, string originalRepairPointId, string originalType, string originalReamDistance, DateTime? originalReamDate, string originalLinerDistance, string originalDirection, int? originalReinstates, string originalLtmh, string originalVtmh, string originalDistance, string originalSize_, DateTime? originalInstallDate, string originalMhShot, string originalGroutDistance, DateTime? originalGroutDate, string originalApproval, bool originalExtraRepair, bool originalCancelled, string originalComments, bool originalDeleted, int originalCompanyId, string originalDefectQualifier, string originalDefectDetails, string originalLength, int newWorkId, string newRepairPointId, string newType, string newReamDistance, DateTime? newReamDate, string newLinerDistance, string newDirection, int? newReinstates, string newLtmh, string newVtmh, string newDistance, string newSize_, DateTime? newInstallDate, string newMhShot, string newGroutDistance, DateTime? newGroutDate, string newApproval, bool newExtraRepair, bool newCancelled, string newComments, bool newDeleted, int newCompanyId, string newDefectQualifierf, string newDefectDetails, string newLength, DateTime? originalReinstateDate, DateTime? newReinstateDate)
 {
     WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway(Data);
     workPointRepairsRepairGateway.Update(originalWorkId, originalRepairPointId, originalType, originalReamDistance, originalReamDate, originalLinerDistance, originalDirection, originalReinstates, originalLtmh, originalVtmh, originalDistance, originalSize_, originalInstallDate, originalMhShot, originalGroutDistance, originalGroutDate, originalApproval, originalExtraRepair, originalCancelled, originalComments, originalDeleted, originalCompanyId, originalDefectQualifier, originalDefectDetails, originalLength, newWorkId, newRepairPointId, newType, newReamDistance, newReamDate, newLinerDistance, newDirection, newReinstates, newLtmh, newVtmh, newDistance, newSize_, newInstallDate, newMhShot, newGroutDistance, newGroutDate, newApproval, newExtraRepair, newCancelled, newComments, newDeleted, newCompanyId, newDefectQualifierf, newDefectDetails, newLength, originalReinstateDate, newReinstateDate);
 }
コード例 #5
0
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// InsertDirect
 /// </summary>
 /// <param name="workId">workId</param>
 /// <param name="repairPointId">repairPointId</param>
 /// <param name="type">type</param>
 /// <param name="reamDistance">reamDistance</param>
 /// <param name="reamDate">reamDate</param>
 /// <param name="linerDistance">linerDistance</param>
 /// <param name="direction">direction</param>
 /// <param name="reinstates">reinstates</param>
 /// <param name="ltmh">ltmh</param>
 /// <param name="vtmh">vtmh</param>
 /// <param name="distance">distance</param>
 /// <param name="size_">size_</param>
 /// <param name="installDate">installDate</param>
 /// <param name="mhShot">mhShot</param>
 /// <param name="groutDistance">groutDistance</param>
 /// <param name="groutDate">groutDate</param>
 /// <param name="approval">approval</param>
 /// <param name="extraRepair">extraRepair</param>
 /// <param name="cancelled">cancelled</param>
 /// <param name="comments">comments</param>
 /// <param name="deleted">deleted</param>
 /// <param name="companyId">companyId</param>
 /// <param name="defectQualifier">defectQualifer</param>
 /// <param name="defectDetails">defectDetails</param>
 /// <param name="length">length</param>
 public void InsertDirect(int workId, string repairPointId, string type, string reamDistance, DateTime? reamDate, string linerDistance, string direction, int? reinstates, string ltmh, string vtmh, string distance, string size_, DateTime? installDate, string mhShot, string groutDistance, DateTime? groutDate, string approval, bool extraRepair, bool cancelled, string comments, bool deleted, int companyId, string defectQualifier, string defectDetails, string length, DateTime? reinstateDate)
 {
     WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway(Data);
     workPointRepairsRepairGateway.Insert(workId, repairPointId, type, reamDistance, reamDate, linerDistance, direction, reinstates, ltmh, vtmh, distance, size_, installDate, mhShot, groutDistance, groutDate, approval, extraRepair, cancelled, comments, deleted, companyId, defectQualifier, defectDetails, length, reinstateDate);
 }
コード例 #6
0
        /// <summary>
        /// Save all size to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>        
        public void Save(int companyId)
        {
            SizeInformationTDS sizeInformationChanges = (SizeInformationTDS)Data.GetChanges();

            if (sizeInformationChanges != null)
            {
                if (sizeInformationChanges.SizeInformation.Rows.Count > 0)
                {
                    SizeInformationGateway sizeInformationGateway = new SizeInformationGateway(sizeInformationChanges);

                    foreach (SizeInformationTDS.SizeInformationRow row in (SizeInformationTDS.SizeInformationDataTable)sizeInformationChanges.SizeInformation)
                    {
                        // Insert new size
                        if ((!row.Deleted) && (!row.InDatabase))
                        {
                            WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway();
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);

                            workPointRepairsRepairPointSizeGateway.LoadAllBySize_(row.Size_, row.COMPANY_ID);

                            if (workPointRepairsRepairPointSizeGateway.Table.Rows.Count == 0)
                            {
                                workPointRepairsRepairPointSize.InsertDirect(row.Size_, row.COMPANY_ID, row.Deleted);
                            }
                            else
                            {
                                workPointRepairsRepairPointSize.UnDeleteDirect(row.Size_, row.COMPANY_ID);
                            }
                        }

                        // Update size
                        if ((!row.Deleted) && (row.InDatabase))
                        {
                            string originalSize_ = row.NewSize_;
                            string newSize_ = row.Size_;
                            int originalCompanyId = companyId;

                            WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway();
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);

                            workPointRepairsRepairPointSizeGateway.LoadAllBySize_(newSize_, companyId);

                            if (workPointRepairsRepairPointSizeGateway.Table.Rows.Count == 0)
                            {
                                workPointRepairsRepairPointSize.InsertDirect(newSize_, originalCompanyId, false);
                            }
                            else
                            {
                                workPointRepairsRepairPointSize.UnDeleteDirect(newSize_, originalCompanyId);
                            }

                            if (workPointRepairsRepairPointSizeGateway.IsUsedInPointRepair(originalSize_, companyId))
                            {
                                WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway(null);
                                workPointRepairsRepairGateway.UpdateSize(originalSize_, companyId, newSize_, companyId);
                            }

                            workPointRepairsRepairPointSize.DeleteDirect(originalSize_, companyId);
                        }

                        // Delete size
                        if ((row.Deleted) && (row.InDatabase))
                        {
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);
                            workPointRepairsRepairPointSize.DeleteDirect(row.Size_, row.COMPANY_ID);
                        }
                    }
                }
            }
        }