public bool DeleteLicenseSnapshot(int licenseId, DataHarmonizationQueue queueItem)
 {
     _dataHarmonizationQueueService.MarkAsInProcess(queueItem);
     try
     {
         if (_snapshotManager.DoesLicenseSnapshotExist(licenseId))
         {
             _snapshotManager.DeleteLicenseSnapshot(licenseId);
         }
         else
         {
             throw new Exception(
                       "Error Deleting License Snapshot.  License Snapshot cannot be found for license Id: " +
                       licenseId + ". ");
         }
     }
     catch (Exception e)
     {
         _dataHarmonizationQueueService.MarkAsError(queueItem);
         _logManager.LogErrors(e);
         throw new Exception("Error Deleting License Snapshot.  License Snapshot cannot be found for license Id: " +
                             licenseId + ".  Error: " + e.ToString());
     }
     finally
     {
         _dataHarmonizationQueueService.DeleteMarkAsComplete(queueItem);
     }
     return(true);
 }
Ejemplo n.º 2
0
        //Mark item as in process
        public DataHarmonizationQueue MarkAsInProcess(DataHarmonizationQueue dataHarmonizationQueueItem)
        {
            dataHarmonizationQueueItem.DataProcessorStatusId = 2;
            EditQueueItem(dataHarmonizationQueueItem);

            return(dataHarmonizationQueueItem);
        }
        public bool CreateLicenseSnapshot(int licenseId, DataHarmonizationQueue queueItem)
        {
            _dataHarmonizationQueueService.MarkAsInProcess(queueItem);

            try
            {
                //get local license, save local license as licenseSnapshot
                var localLicense = _licenseRepository.GetLicenseById(licenseId);

                //get licenseProducts from 'GetProductsNew'
                var licenseProducts = _licenseProductService.GetProductsNew(localLicense.LicenseId);

                var test     = licenseProducts[0].ProductHeader.Label;
                var testPass = test;
                //save localLicense Snapshot and licenseProducts as snapshot
                _snapshotManager.TakeLicenseSnapshot(localLicense, licenseProducts);
            }
            catch (Exception e)
            {
                _dataHarmonizationQueueService.MarkAsError(queueItem);
                _logManager.LogErrors(e);
                throw new Exception("Error Creating License Snapshot.  Error: " + e.ToString());
            }
            finally
            {
                _dataHarmonizationQueueService.CreateMarkAsComplete(queueItem);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public DataHarmonizationQueue CreateDataHarmonizationRequest(DataHarmonizationQueue dataHarmonizationQueueItem)
 {
     using (var context = new DataContext())
     {
         context.DataHarmonizationQueues.Add(dataHarmonizationQueueItem);
         context.SaveChanges();
         return(dataHarmonizationQueueItem);
     }
 }
Ejemplo n.º 5
0
 public DataHarmonizationQueue EditDataHarmonizationQueue(DataHarmonizationQueue dataHarmonizationQueue)
 {
     using (var context = new DataContext())
     {
         context.Entry(dataHarmonizationQueue).State = EntityState.Modified;
         context.SaveChanges();
         return(dataHarmonizationQueue);
     }
 }
Ejemplo n.º 6
0
 private void EditQueueItem(DataHarmonizationQueue item)
 {
     try
     {
         _dataHarmonizationQueueRepository.EditDataHarmonizationQueue(item);
     }
     catch (Exception e)
     {
         _logManager.LogErrors(e);
         throw new Exception("Error Updating DataHarmonizationQueue Item");
     }
 }
Ejemplo n.º 7
0
        public DataHarmonizationQueue DeleteMarkAsComplete(DataHarmonizationQueue dataHarmonizationQueueItem)
        {
            //check if snapshot exists, it shouldnt
            var exists = _snapshotLicenseRepository.DoesLicenseSnapshotExist(dataHarmonizationQueueItem.LicenseId);

            if (!exists)
            {
                dataHarmonizationQueueItem.Deleted = DateTime.Now;
                dataHarmonizationQueueItem.DataProcessorStatusId = 3;
                EditQueueItem(dataHarmonizationQueueItem);
            }
            else
            {
                dataHarmonizationQueueItem.DataProcessorStatusId = 4;
                EditQueueItem(dataHarmonizationQueueItem);
            }
            return(dataHarmonizationQueueItem);
        }
Ejemplo n.º 8
0
 //get actionType
 public LU_ActionType GetActionType(DataHarmonizationQueue dataHarmonizationQueueItem)
 {
     return(dataHarmonizationQueueItem.ActionType);
 }