public Boolean SaveWSREDipTestsRecords( DAL.WSREDipTest record, WSREDiptestModel item) { ////////////////////////////////// // WSREDipTests table record.Measurement = item.Measurement; // ConditionId record.ConditionId = item.ConditionId; // Comment record.Comment = item.Comment; // Recommendation record.Recommendation = item.Recommendation; // Number record.Number = item.Number; // INSERT _WSREDipTests.Add(record); _context.SaveChanges(); _arrDipTestId.Add(record.Id); ////////////////////////////////// // WSREDipTestImages table foreach (var img in item.Images) { DAL.WSREDipTestImage recordImg = new DAL.WSREDipTestImage(); recordImg.DipTestId = record.Id; byte[] imageData = GetUploadImageData(img.Data); recordImg.Data = imageData; recordImg.Title = img.ImageTitle; recordImg.Comment = img.ImageComment; recordImg.IncludeInReport = true; recordImg.Deleted = false; // INSERT _WSREDipTestImages.Add(recordImg); } return(true); }
public Boolean SaveWSREInfo(WRESSyncModel equip) { try { BLL.Core.Domain.TTDevUser user = new BLL.Core.Domain.TTDevUser(new DAL.SharedContext(), 0); //////////////////// //// WSREs table //DAL.WSRE WSREsRecord = new DAL.WSRE(); //WSREsRecord.Date = DateTime.Now; //WSREsRecord.SystemId = equip.SystemId; //WSREsRecord.JobsiteId = equip.JobsiteId; //WSREsRecord.InspectorId = user.GetUserAutoById(equip.InspectorId); //WSREsRecord.JobNumber = equip.JobNumber; //WSREsRecord.OldTagNumber = equip.OldTagNumber; //WSREsRecord.OverallComment = equip.OverallComment; //WSREsRecord.OverallRecommendation = equip.OverallRecommendation; //WSREsRecord.StatusId = 1; //WSREsRecord.CustomerReference = equip.CustomerReference; //WSREsRecord.SystemLife = new BLL.Core.Domain.UCSystem(new DAL.UndercarriageContext(), (int)WSREsRecord.SystemId).GetSystemLife(DateTime.Now); //_WSREs.Add(WSREsRecord); //// COMMIT //_context.SaveChanges(); //_WSREId = WSREsRecord.Id; _WSREId = equip.serverInspectionId; ///////////////////////////// // WSREInitialImages table foreach (var item in equip.InitialImages) { DAL.WSREInitialImage record = new DAL.WSREInitialImage(); record.WSREId = _WSREId; SaveWSREInitialImages(record, item); } ////////////////////////////////// // WSREComponentRecords table foreach (var item in equip.ComponentRecords) { DAL.WSREComponentRecord record = new DAL.WSREComponentRecord(); record.WSREId = _WSREId; SaveWSREComponentRecords(record, item); } ////////////////////////////////// // WSRECrackTest table DAL.WSRECrackTest recordCrack = new DAL.WSRECrackTest(); recordCrack.WSREId = _WSREId; SaveWSRECrackTestsRecords(recordCrack, equip); ////////////////////////////// // DipTests tables foreach (var item in equip.DipTestRecords) { DAL.WSREDipTest recordDipTest = new DAL.WSREDipTest(); recordDipTest.WSREId = _WSREId; SaveWSREDipTestsRecords(recordDipTest, item); } // COMMIT _context.SaveChanges(); ///////////////////////// // Update "OverallEval" UpdateOverallEval(); } catch (Exception e) { // Sync failed, roll back RollbackWSREInfo(); return(false); } return(true); }