Beispiel #1
0
 public void Save(DimRecord record)
 {
     if(record.Id == 0)
         this.database.DimFiles.Insert(record);
     else
         this.database.DimFiles.Update(record);
 }
Beispiel #2
0
        public static void ExecuteFile(DimFile file, bool dryRun, Action successCallback = null, Action<string> failureCallback = null)
        {
            Exception exception = null;

            if(!dryRun)
            {
                try
                {
                    DatabaseProvider.Manager.Execute(GetFileContent(file));
                }
                catch (Exception ex)
                {
                    exception = ex;
                }

                if(exception == null)
                {
                    var record = DatabaseProvider.RecordRepository.FindByFileName(file.FileName);

                    if(record == null)
                        record = new DimRecord();

                    record.FileName = file.FileName;
                    record.FileHash = GetFileHash(file);
                    record.Executed =DateTime.Now;
                    DatabaseProvider.RecordRepository.Save(record);
                }
            }

            if(successCallback != null && exception == null)
                successCallback();

            if(failureCallback != null && exception != null)
                failureCallback(exception.Message);
        }
Beispiel #3
0
        public static void ExecuteFile(DimFile file, bool dryRun, Action successCallback = null, Action <string> failureCallback = null)
        {
            Exception exception = null;

            if (!dryRun)
            {
                try
                {
                    DatabaseProvider.Manager.Execute(GetFileContent(file));
                }
                catch (Exception ex)
                {
                    exception = ex;
                }

                if (exception == null)
                {
                    var record = DatabaseProvider.RecordRepository.FindByFileName(file.FileName);

                    if (record == null)
                    {
                        record = new DimRecord();
                    }

                    record.FileName = file.FileName;
                    record.FileHash = GetFileHash(file);
                    record.Executed = DateTime.Now;
                    DatabaseProvider.RecordRepository.Save(record);
                }
            }

            if (successCallback != null && exception == null)
            {
                successCallback();
            }

            if (failureCallback != null && exception != null)
            {
                failureCallback(exception.Message);
            }
        }