Ejemplo n.º 1
0
        /// <summary>
        /// UpdateCommentsHistoryForSummaryEdit
        /// </summary>
        /// <param name="jlWorkId">jlWorkId</param>
        /// <param name="workType">workType</param>
        /// <param name="companyId">companyId</param>
        /// <returns>comments</returns>
        public void UpdateCommentsHistoryForSummaryEdit(int jlWorkId, string workType, int companyId)
        {
            foreach (FlatSectionJlTDS.FlatSectionJlRow row in (FlatSectionJlTDS.FlatSectionJlDataTable)Table)
            {
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByWorkId(jlWorkId, companyId);
                int assetId = workGateway.GetAssetId(jlWorkId);
                int projectId = workGateway.GetProjectId(jlWorkId);

                if (row.AssetID == assetId)
                {
                    // Update Comments
                    // ... Get raWorkId
                    int raWorkId = 0;
                    WorkGateway raWorkGateway = new WorkGateway();
                    raWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Rehab Assessment", companyId);
                    if (raWorkGateway.Table.Rows.Count > 0)
                    {
                        raWorkId = raWorkGateway.GetWorkId(row.Section_, "Rehab Assessment", projectId);
                    }

                    // ... Get flWorkId
                    int flWorkId = 0;
                    WorkGateway flWorkGateway = new WorkGateway();
                    flWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Full Length Lining", companyId);
                    if (flWorkGateway.Table.Rows.Count > 0)
                    {
                        flWorkId = flWorkGateway.GetWorkId(row.Section_, "Full Length Lining", projectId);
                    }

                    // ... Load All Comments
                    FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments();
                    flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                    row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n");

                    // Add M1 comments
                    WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway();
                    workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(flWorkId, row.AssetID, companyId);
                    if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0)
                    {
                        string m1LateralComments = workFullLengthLiningM1LateralGateway.GetComments(flWorkId, row.AssetID);
                        if (m1LateralComments != "")
                        {
                            row.Comments = row.Comments + "\n\nType: M1 Lateral Comments\nComment: " + m1LateralComments;
                        }
                    }

                    WorkFullLengthLiningM1Gateway workFullLengthLiningM1Gateway = new WorkFullLengthLiningM1Gateway();
                    workFullLengthLiningM1Gateway.LoadByWorkId(flWorkId, companyId);
                    if (workFullLengthLiningM1Gateway.Table.Rows.Count > 0)
                    {
                        string trafficControlDetails = workFullLengthLiningM1Gateway.GetTrafficControlDetails(flWorkId);
                        if (trafficControlDetails != "")
                        {
                            row.Comments = row.Comments + "\n\nType: Traffic Control Details\nComment: " + trafficControlDetails ;
                        }

                        string standardByPassComments = workFullLengthLiningM1Gateway.GetStandardBypassComments(flWorkId);
                        if (standardByPassComments != "")
                        {
                            row.Comments = row.Comments + "\n\nType: Standard Bypass Comments\nComment: " + standardByPassComments ;
                        }
                    }

                    if (!row.IsCommentsNull())
                    {
                        row.Comments = row.Comments.Replace("<br>", "\n");
                    }

                    // Update History
                    FlatSectionJLAllHistory flatSectionJLAllHistory = new FlatSectionJLAllHistory();
                    flatSectionJLAllHistory.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                    row.History = flatSectionJLAllHistory.GetJLOrFLOrRAHistory(companyId, flatSectionJLAllHistory.Table.Rows.Count, "\n");

                    if (!row.IsHistoryNull())
                    {
                        row.History = row.History.Replace("<br>", "\n");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// UpdateFieldsForSections
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="companyId">companyId</param>
        private void UpdateFieldsForSections(int projectId, int companyId)
        {
            foreach (FlatSectionJlTDS.FlatSectionJlRow row in (FlatSectionJlTDS.FlatSectionJlDataTable)Table)
            {
                int jlWorkId = row.WorkID;

                // ... Get raWorkId
                int raWorkId = 0;
                WorkGateway raWorkGateway = new WorkGateway();
                raWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Rehab Assessment", companyId);
                if (raWorkGateway.Table.Rows.Count > 0)
                {
                    raWorkId = raWorkGateway.GetWorkId(row.Section_, "Rehab Assessment", projectId);
                }

                // ... Get flWorkId
                int flWorkId = 0;
                WorkGateway flWorkGateway = new WorkGateway();
                flWorkGateway.LoadByProjectIdAssetIdWorkType(projectId, row.Section_, "Full Length Lining", companyId);
                if (flWorkGateway.Table.Rows.Count > 0)
                {
                    flWorkId = flWorkGateway.GetWorkId(row.Section_, "Full Length Lining", projectId);
                }

                // ... Load All Comments
                FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments();
                flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n");

                // Add M1 comments
                WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway();
                workFullLengthLiningM1LateralGateway.LoadByWorkIdLateral(flWorkId, row.AssetID, companyId);
                if (workFullLengthLiningM1LateralGateway.Table.Rows.Count > 0)
                {
                    string m1LateralComments = workFullLengthLiningM1LateralGateway.GetComments(flWorkId, row.AssetID);
                    if (m1LateralComments != "")
                    {
                        row.Comments = row.Comments + "\n\nType: M1 Lateral Comments\nComment: " + m1LateralComments ;
                    }
                }

                WorkFullLengthLiningM1Gateway workFullLengthLiningM1Gateway = new WorkFullLengthLiningM1Gateway();
                workFullLengthLiningM1Gateway.LoadByWorkId(flWorkId, companyId);
                if (workFullLengthLiningM1Gateway.Table.Rows.Count > 0)
                {
                    string trafficControlDetails = workFullLengthLiningM1Gateway.GetTrafficControlDetails(flWorkId);
                    if (trafficControlDetails != "")
                    {
                        row.Comments = row.Comments + "\n\nType: Traffic Control Details\nComment: " + trafficControlDetails;
                    }

                    string standardByPassComments = workFullLengthLiningM1Gateway.GetStandardBypassComments(flWorkId);
                    if (standardByPassComments != "")
                    {
                        row.Comments = row.Comments + "\n\nType: Standard Bypass Comments\nComment: " + standardByPassComments ;
                    }

                    string measurementFromMH = "USMH"; if (workFullLengthLiningM1Gateway.GetMeasurementFromMh(flWorkId) != "") measurementFromMH = workFullLengthLiningM1Gateway.GetMeasurementFromMh(flWorkId);

                    if (measurementFromMH == "DSMH")
                    {
                        string auxDistanceFromUSMH = row.DistanceFromUSMH;
                        row.DistanceFromUSMH = row.DistanceFromDSMH;
                        row.DistanceFromDSMH = auxDistanceFromUSMH;
                    }
                }

                if (!row.IsCommentsNull())
                {
                    row.Comments = row.Comments.Replace("<br>", "\n");
                }

                // Update History
                FlatSectionJLAllHistory flatSectionJLAllHistory = new FlatSectionJLAllHistory();
                flatSectionJLAllHistory.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                row.History = flatSectionJLAllHistory.GetJLOrFLOrRAHistory(companyId, flatSectionJLAllHistory.Table.Rows.Count, "\n");

                if (!row.IsHistoryNull())
                {
                    row.History = row.History.Replace("<br>", "\n");
                }

                // Update FlowOrderID
                if (!row.IsFlowOrderIDNull())
                {
                    row.LateralID = row.FlowOrderID + "-JL-" + row.LateralID;
                }
                else
                {
                    row.LateralID = "JL-" + row.LateralID;
                }

                // Update MainSize
                if (!row.IsMainSizeNull())
                {
                    try
                    {
                        if (Distance.IsValidDistance(row.MainSize))
                        {
                            Distance distance = new Distance(row.MainSize);

                            switch (distance.DistanceType)
                            {
                                case 2:
                                    row.MainSize = distance.ToStringInEng1();
                                    break;
                                case 3:
                                    if (Convert.ToDouble(row.MainSize) > 99)
                                    {
                                        double newMainSize = 0;
                                        newMainSize = Convert.ToDouble(row.MainSize) * 0.03937;
                                        row.MainSize = Convert.ToString(Math.Ceiling(newMainSize)) + "\"";
                                    }
                                    else
                                    {
                                        row.MainSize = row.MainSize + "\"";
                                    }
                                    break;
                                case 4:
                                    row.MainSize = distance.ToStringInEng1();
                                    break;
                                case 5:
                                    row.MainSize = distance.ToStringInEng1();
                                    break;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// UpdateComments
        /// </summary>
        /// <param name="jlWorkId">workIdjlWorkIdparam>
        /// <param name="workType">workType</param>
        /// <param name="companyId">companyId</param>
        public void UpdateComments(int jlWorkId, string workType, int companyId)
        {
            foreach (JlNavigatorTDS.JlNavigatorRow row in (JlNavigatorTDS.JlNavigatorDataTable)Table)
            {
                WorkGateway workGateway = new WorkGateway();
                workGateway.LoadByWorkId(jlWorkId, companyId);
                int assetId = workGateway.GetAssetId(jlWorkId);
                int projectId = workGateway.GetProjectId(jlWorkId);

                if (row.AssetID_ == assetId)
                {
                    // Update Comments
                    // ... Get raWorkId
                    int raWorkId = 0;

                    // ... Get raWorkId
                    int flWorkId = 0;

                    // ... Load All Comments
                    FlatSectionJLAllComments flatSectionJLAllComments = new FlatSectionJLAllComments();
                    flatSectionJLAllComments.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                    row.Comments = flatSectionJLAllComments.GetJLOrFLOrRAComments(companyId, flatSectionJLAllComments.Table.Rows.Count, "\n");

                    if (!row.IsHistoryNull())
                    {
                        row.Comments = row.Comments.Replace("<br>", "\n");
                    }

                    // Update History
                    FlatSectionJLAllHistory flatSectionJLAllHistory = new FlatSectionJLAllHistory();
                    flatSectionJLAllHistory.LoadAllByJlWorkIdFlWorkIdRaWorkId(jlWorkId, flWorkId, raWorkId, companyId);

                    row.History = flatSectionJLAllHistory.GetJLOrFLOrRAHistory(companyId, flatSectionJLAllHistory.Table.Rows.Count, "\n");

                    if (!row.IsHistoryNull())
                    {
                        row.History = row.History.Replace("<br>", "\n");
                    }

                    // Save work
                    // ... Get original variables
                    workGateway.LoadByWorkId(jlWorkId, companyId);

                    string originalWorkType = workGateway.GetWorkTypeOriginal(jlWorkId);
                    int? originalLibraryCategoriesId = workGateway.GetLibraryCategoriesIdOriginal(jlWorkId);
                    string originalComment = workGateway.GetCommentsOriginal(jlWorkId);
                    string originalHistory = workGateway.GetHistoryOriginal(jlWorkId);

                    Work work = new Work(null);
                    work.UpdateDirect(jlWorkId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, originalComment, originalHistory, jlWorkId, projectId, assetId, originalWorkType, originalLibraryCategoriesId, false, companyId, row.Comments, row.History);
                }
            }
        }