public bool MarkSnapshotLicenseComplete(Snapshot_License snapshotLicense) { snapshotLicense.SnapshotComplete = true; var result = _snapshotLicenseRepository.EditSnapshotLicense(snapshotLicense); return(result); }
public bool DeleteSnapshotLicense(Snapshot_License license) { using (var context = new DataContext()) { //var licenseToBeDeleted = context.Snapshot_Licenses // // .Include("LicenseType") // // .Include("LicensePriority") // // .Include("LicenseStatus") // // .Include("LicenseProducts") // // .Include("LicenseMethod") // .FirstOrDefault(sl => sl.CloneLicenseId == licenseId); context.Snapshot_Licenses.Attach(license); context.Snapshot_Licenses.Remove(license); try { context.SaveChanges(); } catch (Exception) { return(false); } } return(true); }
private Snapshot_License CastToLicense(License licenseToBeSnapshotted) { var newLicense = new Snapshot_License(); newLicense.CloneLicenseId = licenseToBeSnapshotted.LicenseId; newLicense.LicenseNumber = licenseToBeSnapshotted.LicenseNumber; newLicense.LicenseName = licenseToBeSnapshotted.LicenseName; newLicense.LicenseStatusId = licenseToBeSnapshotted.LicenseStatusId; newLicense.EffectiveDate = licenseToBeSnapshotted.EffectiveDate; newLicense.SignedDate = licenseToBeSnapshotted.SignedDate; newLicense.ReceivedDate = licenseToBeSnapshotted.ReceivedDate; newLicense.LicenseMethodId = licenseToBeSnapshotted.LicenseMethodId; newLicense.ManagerApprovalDate = licenseToBeSnapshotted.ManagerApprovalDate; newLicense.CountryId = licenseToBeSnapshotted.CountryId; newLicense.LicenseeId = licenseToBeSnapshotted.LicenseeId; newLicense.LicenseeLabelGroupId = licenseToBeSnapshotted.LicenseeLabelGroupId; newLicense.HFARollupLicenseId = licenseToBeSnapshotted.HFARollupLicenseId; newLicense.AssignedToId = licenseToBeSnapshotted.AssignedToId; newLicense.PriorityId = licenseToBeSnapshotted.PriorityId; newLicense.LicenseTypeId = licenseToBeSnapshotted.LicenseTypeId; newLicense.ProductsNo = licenseToBeSnapshotted.ProductsNo; newLicense.LicenseConfigurationRollup = licenseToBeSnapshotted.LicenseConfigurationRollup; newLicense.Label = licenseToBeSnapshotted.Label; newLicense.ArtistRollup = licenseToBeSnapshotted.ArtistRollup; newLicense.ProductRollup = licenseToBeSnapshotted.ProductRollup; // newLicense.ContactId = licenseToBeSnapshotted.ContactId; newLicense.ClaimException = licenseToBeSnapshotted.ClaimException; newLicense.RelatedLicenseId = licenseToBeSnapshotted.RelatedLicenseId; newLicense.amsLegacyPath = licenseToBeSnapshotted.amsLegacyPath; newLicense.StatusReport = licenseToBeSnapshotted.StatusReport; newLicense.StatusesRollup = licenseToBeSnapshotted.StatusesRollup; newLicense.SnapshotComplete = false; return(newLicense); }
public bool EditSnapshotLicense(Snapshot_License license) { using (var context = new DataContext()) { context.Entry(license).State = EntityState.Modified; try { context.SaveChanges(); } catch (Exception) { return(false); } } return(true); }
public Snapshot_License SaveSnapshotLicense(Snapshot_License licenseSnapshot) { using (var context = new DataContext()) { context.Snapshot_Licenses.Add(licenseSnapshot); try { context.SaveChanges(); } catch (Exception e) { Logger.Debug(e.ToString); throw new Exception("Error saving snapshot_licnese: " + e.ToString()); } return(licenseSnapshot); } }
private bool SaveLocalLicenseProductSnapshot(List <LicenseProduct> localLicenseProducts, Snapshot_License savedSnapshotLicense) { try { foreach (var lp in localLicenseProducts) { if (lp != null) { var lpSnapshot = CastToLicenseProductSnapshot(lp); lpSnapshot.SnapshotLicenseId = savedSnapshotLicense.SnapshotLicenseId; _snapshotLicenseProductManager.SaveSnapshotLicenseProduct(lpSnapshot); } } } catch (Exception e) { throw new Exception("Error saving snapshot. Error: " + e.ToString()); } return(true); }
public bool TakeLicenseSnapshot(License licenseToBeSnapshotted, List <LicenseProduct> licenseProducts) { var newLicense = CastToLicense(licenseToBeSnapshotted); var newSnaphotLicense = new Snapshot_License(); //Snapshot here try { var savedLicense = _snapshotLicenseManager.SaveSnapshotLicense(newLicense); //snapshot LicenseProducts SaveLocalLicenseProductSnapshot(licenseProducts, savedLicense); _snapshotLicenseManager.MarkSnapshotLicenseComplete(savedLicense); } catch (Exception exception) { Logger.Debug(exception.ToString); return(false); } return(true); }
private void DeleteLicenseProductAndChildEntities(Snapshot_License license) { //getAllLicenseProducts var licenseProducts = _snapshotLicenseProductRepository.GetAllLicenseProductsForLicenseId(license.CloneLicenseId); //Massive delete foreach (var licenseProduct in licenseProducts) { //Delete All RecsConfiguration and children DeleteSnapshotRecsRecordingandChildren(licenseProduct); //Delete worksRecording and Children DeleteAllWorksRecordingAndChildren(licenseProduct); //Delete Product HEader and children DeleteProductHeaderAndChildren(licenseProduct); //Delete License Product _snapshotLicenseProductRepository.DeleteLicenseProductSnapshot(licenseProduct.SnapshotLicenseProductId); } }
public Snapshot_License SaveSnapshotLicense(Snapshot_License snapshotLicense) { return(_snapshotLicenseRepository.SaveSnapshotLicense(snapshotLicense)); }