/// <summary>
        /// DeleteDirect
        /// </summary>
        /// <param name="originalWorkId">originalWorkId</param>
        /// <param name="originalCompanyId">originalCompanyId</param>        
        public void DeleteDirect(int originalWorkId, int originalCompanyId)
        {
            // Delete wet out comments
            WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway(null);
            workFullLengthLiningWetOutCommentsGateway.DeleteAll(originalWorkId, originalCompanyId);

            // Delete wet out catalysts
            WorkFullLengthLiningWetOutCatalystsGateway workFullLengthLiningWetOutCatalystsGateway = new WorkFullLengthLiningWetOutCatalystsGateway(null);
            workFullLengthLiningWetOutCatalystsGateway.DeleteAll(originalWorkId, originalCompanyId);

            // Delete wet out data
            WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway(null);
            workFullLengthLiningWetOutGateway.Delete(originalWorkId, originalCompanyId);
        }
        /// <summary>
        /// UpdateCommentsWetOutForSummaryEdit
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="companyId">companyId</param>
        public void UpdateCommentsWetOutForSummaryEdit(int workId, int companyId)
        {
            WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway();
            WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(workFullLengthLiningWetOutCommentsGateway.Data);
            WorkGateway workGateway = new WorkGateway();

            FullLengthLiningTDS.WorkDetailsRow row = GetRow(workId);

            workGateway.LoadByWorkId(workId, companyId);
            workFullLengthLiningWetOutCommentsGateway.LoadAllByWorkIdWorkType(workId, companyId, "Full Length Lining Wet Out");
            row.CommentsCipp = workFullLengthLiningWetOutComments.GetAllComments(workId, companyId, workFullLengthLiningWetOutCommentsGateway.Table.Rows.Count, "\n");
        }
 /// <summary>
 /// DeleteDirect
 /// </summary>
 /// <param name="workId">workId</param>
 /// <param name="refId">refId</param>
 /// <param name="companyId">companyId</param>
 public void DeleteDirect(int workId, int refId, int companyId)
 {
     WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway(null);
     workFullLengthLiningWetOutCommentsGateway.Delete(workId, refId, companyId);
 }
 /// <summary>
 /// Update direct
 /// </summary>
 /// <param name="originalWorkId">originalWorkId</param>
 /// <param name="originalRefId">originalRefId</param>
 /// <param name="originalType">originalType</param>
 /// <param name="originalSubject">originalSubject</param>
 /// <param name="originalUserId">originalUserId</param>
 /// <param name="originalDateTime">originalDateTime</param>
 /// <param name="originalComment">originalComment</param>
 /// <param name="originalLibraryFilesId">originalLibraryFilesId</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="originalWorkType">originalWorkType</param>
 /// 
 /// <param name="newWorkId">newWorkId</param>
 /// <param name="newRefId">newRefId</param>
 /// <param name="newType">newType</param>
 /// <param name="newSubject">newSubject</param>
 /// <param name="newUserId">newUserId</param>
 /// <param name="newDateTime">newDateTime</param>
 /// <param name="newComment">newComment</param>
 /// <param name="newLibraryFilesId">newLibraryFilesId</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 /// <param name="newWorkType">newWorkType</param>
 public void UpdateDirect(int originalWorkId, int originalRefId, string originalType, string originalSubject, int originalUserId, DateTime? originalDateTime, string originalComment, int? originalLibraryFilesId, bool originalDeleted, int originalCompanyId, string originalWorkType, int newWorkId, int newRefId, string newType, string newSubject, int newUserId, DateTime? newDateTime, string newComment, int? newLibraryFilesId, bool newDeleted, int newCompanyId, string newWorkType)
 {
     WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway();
     workFullLengthLiningWetOutCommentsGateway.Update(originalWorkId, originalRefId, originalType, originalSubject, originalUserId, originalDateTime, originalComment, originalLibraryFilesId, originalDeleted, originalCompanyId, originalWorkType, newWorkId, newRefId, newType, newSubject, newUserId, newDateTime, newComment, newLibraryFilesId, newDeleted, newCompanyId, newWorkType);
 }
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// Insert a new comment (direct to DB)
 /// </summary>
 /// <param name="workId">workId</param>
 /// <param name="refId">refId</param>
 /// <param name="type">type</param>
 /// <param name="subject">subject</param>
 /// <param name="userId">userId</param>
 /// <param name="dateTime_">dateTime_</param>
 /// <param name="comment">comment</param>
 /// <param name="libraryFilesId">libraryFilesId</param>
 /// <param name="deleted">deleted</param>
 /// <param name="companyId">companyId</param>
 /// <param name="workType">workType</param>
 /// <returns></returns>
 public void InsertDirect(int workId, int refId, string type, string subject, int userId, DateTime? dateTime_, string comment, int? libraryFilesId, bool deleted, int companyId, string workType)
 {
     WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway(null);
     workFullLengthLiningWetOutCommentsGateway.Insert(workId, refId, type, subject, userId, dateTime_, comment, libraryFilesId, deleted, companyId, workType);
 }
        private void workUpdate()
        {
            // Get general variables
            int workId = Int32.Parse(hdfWorkId.Value.Trim());
            int assetId = Int32.Parse(hdfAssetId.Value.Trim());
            int originalCompanyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value.Trim();
            bool originalDeleted = false;

            // Get original variables
            FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway();
            fullLengthLiningWorkDetailsGateway.LoadByWorkIdAssetId(workId, assetId, originalCompanyId);

            // ... Verify if work has cipp information
            if (fullLengthLiningWorkDetailsGateway.Table.Rows.Count > 0)
            {
                // Wet Out data original values
                string originalLinerTube = fullLengthLiningWorkDetailsGateway.GetLinerTubeOriginal(workId);
                int originalResinId = fullLengthLiningWorkDetailsGateway.GetResinIdOriginal(workId);
                decimal originalExcessResin = fullLengthLiningWorkDetailsGateway.GetExcessResinOriginal(workId);
                string originalPoundsDrums = fullLengthLiningWorkDetailsGateway.GetPoundsDrumsOriginal(workId);
                decimal originalDrumDiameter = fullLengthLiningWorkDetailsGateway.GetDrumDiameterOriginal(workId);
                decimal originalHoistMaximumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMaximumHeightOriginal(workId);
                decimal originalHoistMinimumHeight = fullLengthLiningWorkDetailsGateway.GetHoistMinimumHeightOriginal(workId);
                decimal originalDownDropTubeLenght = fullLengthLiningWorkDetailsGateway.GetDownDropTubeLenghtOriginal(workId);
                decimal originalPumpHeightAboveGround = fullLengthLiningWorkDetailsGateway.GetPumpHeightAboveGroundOriginal(workId);
                int originalTubeResinToFeltFactor = fullLengthLiningWorkDetailsGateway.GetTubeResinToFeltFactorOriginal(workId);
                DateTime originalDateOfSheet = fullLengthLiningWorkDetailsGateway.GetDateOfSheetOriginal(workId);
                int originalEmployeeId = fullLengthLiningWorkDetailsGateway.GetEmployeeIdOriginal(workId);
                string originalRunDetails = fullLengthLiningWorkDetailsGateway.GetRunDetailsOriginal(workId);
                string originalRunDetails2 = fullLengthLiningWorkDetailsGateway.GetRunDetails2Original(workId);
                DateTime originalWetOutDate = fullLengthLiningWorkDetailsGateway.GetWetOutDateOriginal(workId);
                DateTime? originalWetOutInstallDate = fullLengthLiningWorkDetailsGateway.GetWetOutInstallDateOriginal(workId);
                string originalThickness = fullLengthLiningWorkDetailsGateway.GetInversionThicknessOriginal(workId);
                decimal originalLengthToLine = fullLengthLiningWorkDetailsGateway.GetLengthToLineOriginal(workId);
                decimal originalPlusExtra = fullLengthLiningWorkDetailsGateway.GetPlusExtraOriginal(workId);
                decimal originalForTurnOffset = fullLengthLiningWorkDetailsGateway.GetForTurnOffsetOriginal(workId);
                decimal originalLengthToWetOut = fullLengthLiningWorkDetailsGateway.GetLengthToWetOutOriginal(workId);
                decimal originalTubeMaxColdHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadOriginal(workId);
                decimal originalTubeMaxColdHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxColdHeadPsiOriginal(workId);
                decimal originalTubeMaxHotHead = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadOriginal(workId);
                decimal originalTubeMaxHotHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeMaxHotHeadPsiOriginal(workId);
                decimal originalTubeIdealHead = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadOriginal(workId);
                decimal originalTubeIdealHeadPsi = fullLengthLiningWorkDetailsGateway.GetTubeIdealHeadPsiOriginal(workId);
                decimal originalNetResinForTube = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeOriginal(workId);
                decimal originalNetResinForTubeUsgals = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgalsOriginal(workId);
                string originalNetResinForTubeDrumsIns = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeDrumsInsOriginal(workId);
                decimal originalNetResinForTubeLbsFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeLbsFtOriginal(workId);
                decimal originalNetResinForTubeUsgFt = fullLengthLiningWorkDetailsGateway.GetNetResinForTubeUsgFtOriginal(workId);
                int originalExtraResinForMix = fullLengthLiningWorkDetailsGateway.GetExtraResinForMixOriginal(workId);
                decimal originalExtraLbsForMix = fullLengthLiningWorkDetailsGateway.GetExtraLbsForMixOriginal(workId);
                decimal originalTotalMixQuantity = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityOriginal(workId);
                decimal originalTotalMixQuantityUsgals = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityUsgalsOriginal(workId);
                string originalTotalMixQuantityDrumsIns = fullLengthLiningWorkDetailsGateway.GetTotalMixQuantityDrumsInsOriginal(workId);
                string originalInversionType = fullLengthLiningWorkDetailsGateway.GetInversionTypeOriginal(workId);
                decimal originalDepthOfInversionMH = fullLengthLiningWorkDetailsGateway.GetDepthOfInversionMHOriginal(workId);
                decimal originalTubeForColumn = fullLengthLiningWorkDetailsGateway.GetTubeForColumnOriginal(workId);
                decimal originalTubeForStartDry = fullLengthLiningWorkDetailsGateway.GetTubeForStartDryOriginal(workId);
                decimal originalTotalTube = fullLengthLiningWorkDetailsGateway.GetTotalTubeOriginal(workId);
                string originalDropTubeConnects = fullLengthLiningWorkDetailsGateway.GetDropTubeConnectsOriginal(workId);
                decimal originalAllowsHeadTo = fullLengthLiningWorkDetailsGateway.GetAllowsHeadToOriginal(workId);
                decimal originalRollerGap = fullLengthLiningWorkDetailsGateway.GetRollerGapOriginal(workId);
                decimal originalHeightNeeded = fullLengthLiningWorkDetailsGateway.GetHeightNeededOriginal(workId);
                string originalAvailable = fullLengthLiningWorkDetailsGateway.GetAvailableOriginal(workId);
                string originalHoistHeight = fullLengthLiningWorkDetailsGateway.GetHoistHeightOriginal(workId);
                string originalCommentsCipp = fullLengthLiningWorkDetailsGateway.GetCommentsCippOriginal(workId);
                string originalResinsLabel = fullLengthLiningWorkDetailsGateway.GetResinsLabelOriginal(workId);
                string originalDrumContainsLabel = fullLengthLiningWorkDetailsGateway.GetDrumContainsLabelOriginal(workId);
                string originalLinerTubeLabel = fullLengthLiningWorkDetailsGateway.GetLinerTubeLabelOriginal(workId);
                string originalForLbDrumsLabel = fullLengthLiningWorkDetailsGateway.GetForLbDrumsLabelOriginal(workId);
                string originalNetResinLabel = fullLengthLiningWorkDetailsGateway.GetNetResinLabelOriginal(workId);
                string originalCatalystLabel = fullLengthLiningWorkDetailsGateway.GetCatalystLabelOriginal(workId);

                // Wet Out new data
                // ... Get new comment
                WorkFullLengthLiningWetOutCommentsGateway workFullLengthLiningWetOutCommentsGateway = new WorkFullLengthLiningWetOutCommentsGateway();
                workFullLengthLiningWetOutCommentsGateway.LoadAllByWorkIdWorkType(workId, originalCompanyId, workType);

                WorkFullLengthLiningWetOutComments workFullLengthLiningWetOutComments = new WorkFullLengthLiningWetOutComments(workFullLengthLiningWetOutCommentsGateway.Data);
                string newComments = workFullLengthLiningWetOutComments.GetCommentsSummary(originalCompanyId, workFullLengthLiningWetOutCommentsGateway.Table.Rows.Count, "\n");

                // Update work with cipp information
                WorkFullLengthLiningWetOut workFullLengthLiningWetOut = new WorkFullLengthLiningWetOut(null);
                workFullLengthLiningWetOut.UpdateDirect(workId, originalLinerTube, originalResinId, originalExcessResin, originalPoundsDrums, originalDrumDiameter, originalHoistMaximumHeight, originalHoistMinimumHeight, originalDownDropTubeLenght, originalPumpHeightAboveGround, originalTubeResinToFeltFactor, originalDateOfSheet, originalEmployeeId, originalRunDetails, originalRunDetails2, originalWetOutDate, originalWetOutInstallDate, originalThickness, originalLengthToLine, originalPlusExtra, originalForTurnOffset, originalLengthToWetOut, originalTubeMaxColdHead, originalTubeMaxColdHeadPsi, originalTubeMaxHotHead, originalTubeMaxHotHeadPsi, originalTubeIdealHead, originalTubeIdealHeadPsi, originalNetResinForTube, originalNetResinForTubeUsgals, originalNetResinForTubeDrumsIns, originalNetResinForTubeLbsFt, originalNetResinForTubeUsgFt, originalExtraResinForMix, originalExtraLbsForMix, originalTotalMixQuantity, originalTotalMixQuantityUsgals, originalTotalMixQuantityDrumsIns, originalInversionType, originalDepthOfInversionMH, originalTubeForColumn, originalTubeForStartDry, originalTotalTube, originalDropTubeConnects, originalAllowsHeadTo, originalRollerGap, originalHeightNeeded, originalAvailable, originalHoistHeight, originalCommentsCipp, originalResinsLabel, originalDrumContainsLabel, originalLinerTubeLabel, originalForLbDrumsLabel, originalNetResinLabel, originalCatalystLabel, originalDeleted, originalCompanyId, workId, originalLinerTube, originalResinId, originalExcessResin, originalPoundsDrums, originalDrumDiameter, originalHoistMaximumHeight, originalHoistMinimumHeight, originalDownDropTubeLenght, originalPumpHeightAboveGround, originalTubeResinToFeltFactor, originalDateOfSheet, originalEmployeeId, originalRunDetails, originalRunDetails2, originalWetOutDate, originalWetOutInstallDate, originalThickness, originalLengthToLine, originalPlusExtra, originalForTurnOffset, originalLengthToWetOut, originalTubeMaxColdHead, originalTubeMaxColdHeadPsi, originalTubeMaxHotHead, originalTubeMaxHotHeadPsi, originalTubeIdealHead, originalTubeIdealHeadPsi, originalNetResinForTube, originalNetResinForTubeUsgals, originalNetResinForTubeDrumsIns, originalNetResinForTubeLbsFt, originalNetResinForTubeUsgFt, originalExtraResinForMix, originalExtraLbsForMix, originalTotalMixQuantity, originalTotalMixQuantityUsgals, originalTotalMixQuantityDrumsIns, originalInversionType, originalDepthOfInversionMH, originalTubeForColumn, originalTubeForStartDry, originalTotalTube, originalDropTubeConnects, originalAllowsHeadTo, originalRollerGap, originalHeightNeeded, originalAvailable, originalHoistHeight, newComments, originalResinsLabel, originalDrumContainsLabel, originalLinerTubeLabel, originalForLbDrumsLabel, originalNetResinLabel, originalCatalystLabel, originalDeleted, originalCompanyId);
            }
        }