/// <summary>
        /// Save all PR to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="newId">newId</param>
        public void Save(int companyId, Guid newId)
        {
            AddRecordTDS pointRepairsChanges = (AddRecordTDS)Data.GetChanges();

            if (pointRepairsChanges != null)
            {
                if (pointRepairsChanges.PointRepairs.Rows.Count > 0)
                {
                    AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(pointRepairsChanges);

                    foreach (AddRecordTDS.PointRepairsRow row in (AddRecordTDS.PointRepairsDataTable)pointRepairsChanges.PointRepairs)
                    {
                        // Insert new Notes
                        if ((!row.Deleted) && (!row.InDatabase))
                        {
                            string repairSize = ""; if (!row.IsRepairSizeNull()) repairSize = row.RepairSize;
                            DateTime? installDate = null; if (!row.IsInstallDateNull()) installDate = row.InstallDate;
                            string distance = ""; if (!row.IsDistanceNull()) distance = row.Distance;
                            decimal? cost = null; if (!row.IsCostNull()) cost = row.Cost;
                            int? reinstates = null; if (!row.IsReinstatesNull()) reinstates = row.Reinstates;
                            string ltatMh = ""; if (!row.IsLTAtMHNull()) ltatMh = row.LTAtMH;
                            string vtatMh = ""; if (!row.IsVTAtMHNull()) vtatMh = row.VTAtMH;
                            string linerDistance = ""; if (!row.IsLinerDistanceNull()) linerDistance = row.LinerDistance;
                            string direction = ""; if (!row.IsDirectionNull()) direction = row.Direction;
                            string mhShot = ""; if (!row.IsMHShotNull()) mhShot = row.MHShot;
                            string comments = ""; if (!row.IsCommentsNull()) comments = row.Comments;

                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.InsertDirect(newId, row.RefID, row.COMPANY_ID, row.DetailID, repairSize, installDate, distance, cost, reinstates, ltatMh, vtatMh, linerDistance, direction, mhShot, comments, row.Deleted, row.ExtraRepair, row.Cancelled, row.Approved, row.NotApproved, row.Archived);
                        }

                        // Update Notes
                        if ((!row.Deleted) && (row.InDatabase))
                        {
                            Guid id = row.ID;
                            int refId = row.RefID;

                            // original values
                            string originalDetailId = addRecordPointRepairsGateway.GetDetailIDOriginal(id, refId, companyId);
                            string originalRepairSize = addRecordPointRepairsGateway.GetRepairSizeOriginal(id, refId, companyId);
                            DateTime? originalInstallDate = addRecordPointRepairsGateway.GetInstallDateOriginal(id, refId, companyId);
                            string originalDistance = addRecordPointRepairsGateway.GetDistanceOriginal(id, refId, companyId);
                            decimal? originalCost = addRecordPointRepairsGateway.GetCostOriginal(id, refId, companyId);
                            int? originalReinstates = addRecordPointRepairsGateway.GetReinstatesOriginal(id, refId, companyId);
                            string originalLTAtMH = addRecordPointRepairsGateway.GetLTAtMHOriginal(id, refId, companyId);
                            string originalVTAtMH = addRecordPointRepairsGateway.GetVTAtMHOriginal(id, refId, companyId);
                            string originalLinerDistance = addRecordPointRepairsGateway.GetLinerDistanceOriginal(id, refId, companyId);
                            string originalDirection = addRecordPointRepairsGateway.GetDirectionOriginal(id, refId, companyId);
                            string originalMhShot = addRecordPointRepairsGateway.GetMHShotOriginal(id, refId, companyId);
                            string originalComments = addRecordPointRepairsGateway.GetCommentsOriginal(id, refId, companyId);
                            bool originalDeleted = false;
                            bool originalExtraRepair = addRecordPointRepairsGateway.GetExtraRepairOriginal(id, refId, companyId);
                            bool originalCancelled = addRecordPointRepairsGateway.GetCancelledOriginal(id, refId, companyId);
                            bool originalApproved = addRecordPointRepairsGateway.GetApprovedOriginal(id, refId, companyId);
                            bool originalNotApproved = addRecordPointRepairsGateway.GetNotApprovedOriginal(id, refId, companyId);
                            bool originalArchived = addRecordPointRepairsGateway.GetArchivedOriginal(id, refId, companyId);

                            // new values
                            string newDetailId = addRecordPointRepairsGateway.GetDetailID(id, refId, companyId);
                            string newRepairSize = addRecordPointRepairsGateway.GetRepairSize(id, refId, companyId);
                            DateTime? newInstallDate = addRecordPointRepairsGateway.GetInstallDate(id, refId, companyId);
                            string newDistance = addRecordPointRepairsGateway.GetDistance(id, refId, companyId);
                            decimal? newCost = addRecordPointRepairsGateway.GetCost(id, refId, companyId);
                            int? newReinstates = addRecordPointRepairsGateway.GetReinstates(id, refId, companyId);
                            string newLTAtMH = addRecordPointRepairsGateway.GetLTAtMH(id, refId, companyId);
                            string newVTAtMH = addRecordPointRepairsGateway.GetVTAtMH(id, refId, companyId);
                            string newLinerDistance = addRecordPointRepairsGateway.GetLinerDistance(id, refId, companyId);
                            string newDirection = addRecordPointRepairsGateway.GetDirection(id, refId, companyId);
                            string newMhShot = addRecordPointRepairsGateway.GetMHShot(id, refId, companyId);
                            string newComments = addRecordPointRepairsGateway.GetComments(id, refId, companyId);
                            bool newDeleted = false;
                            bool newExtraRepair = addRecordPointRepairsGateway.GetExtraRepair(id, refId, companyId);
                            bool newCancelled = addRecordPointRepairsGateway.GetCancelled(id, refId, companyId);
                            bool newApproved = addRecordPointRepairsGateway.GetApproved(id, refId, companyId);
                            bool newNotApproved = addRecordPointRepairsGateway.GetNotApproved(id, refId, companyId);
                            bool newArchived = addRecordPointRepairsGateway.GetArchived(id, refId, companyId);

                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.UpdateDirect(id, refId, companyId, originalDetailId, originalRepairSize, originalInstallDate, originalDistance, originalCost, originalReinstates, originalLTAtMH, originalVTAtMH, originalLinerDistance, originalDirection, originalMhShot, originalComments, originalDeleted, originalExtraRepair, originalCancelled, originalApproved, originalNotApproved, originalArchived, id, refId, companyId, newDetailId, newRepairSize, newInstallDate, newDistance, newCost, newReinstates, newLTAtMH, newVTAtMH, newLinerDistance, newDirection, newMhShot, newComments, newDeleted, newExtraRepair, newCancelled, newApproved, newNotApproved, newArchived);
                        }

                        // Deleted notes
                        if ((row.Deleted) && (row.InDatabase))
                        {
                            LFSRecordPointRepairs lfsRecordPointRepairs = new LFSRecordPointRepairs(null);
                            lfsRecordPointRepairs.DeleteDirect(row.ID, row.RefID, row.COMPANY_ID);
                        }
                    }
                }
            }
        }