diff --git a/core/Cronjob.cs b/core/Cronjob.cs index e222631..5f93f54 100644 --- a/core/Cronjob.cs +++ b/core/Cronjob.cs @@ -261,6 +261,12 @@ namespace dezentrale.core TimeSpan tsLastMail = ProgramStartTime.Subtract(m.LastCronjobBalanceMail); bool skipInsufficientNotify = ((DateTime.Now.Day < 8) || (tsLastMail.TotalDays < 14)); + if(m.Number == 37) + { + //Sixtus detected + Console.WriteLine("Sixtus detected"); + } + int currentDebtLevel = 0; //no payments missed //Account balance is capped to -2 monthly fees diff --git a/core/CsvImportProcess.cs b/core/CsvImportProcess.cs index 666be2c..cd3fbcb 100644 --- a/core/CsvImportProcess.cs +++ b/core/CsvImportProcess.cs @@ -9,18 +9,16 @@ namespace dezentrale.core { public class CsvImportProcess : BackgroundProcess { - private string fileName = ""; - public CsvImportProcess(string fileName) + public string FileName { get; set; } = ""; + public CsvImportProcess() { - this.fileName = fileName; - Caption = "Import CSV Money Transfers"; - Steps = 3; + Steps = 5; } protected override bool Run() { uint step = 0; - LogTarget.LogLine($"Importing from {fileName}", LogEvent.ELogLevel.Info, "CsvImportProcess"); + LogTarget.LogLine($"Importing from {FileName}", LogEvent.ELogLevel.Info, "CsvImportProcess"); List tmpList = new List(); List headlineFields = null; @@ -32,7 +30,7 @@ namespace dezentrale.core LogTarget.StepStarted(++step, "Reading file..."); try { - csv.ReadFile(fileName); + csv.ReadFile(FileName); LogTarget.StepCompleted(step, "Done reading file.", true); } catch(Exception ex) { @@ -59,7 +57,7 @@ namespace dezentrale.core continue; } - BankTransfer bt = new BankTransfer(headlineFields, l, fileName, csvLine); + BankTransfer bt = new BankTransfer(headlineFields, l, FileName, csvLine); MoneyTransfer duplicate = Program.MoneyTransfers.FindEqualEntry(bt); if (duplicate != null) { @@ -116,7 +114,7 @@ namespace dezentrale.core } catch (Exception ex) { - LogTarget.LogLine($"Error while processing csv file \"{fileName}\": {ex.Message}", LogEvent.ELogLevel.Error, "CsvImportProcess"); + LogTarget.LogLine($"Error while processing csv file \"{FileName}\": {ex.Message}", LogEvent.ELogLevel.Error, "CsvImportProcess"); return false; } } diff --git a/model/Member.cs b/model/Member.cs index 4e90676..e394a5a 100644 --- a/model/Member.cs +++ b/model/Member.cs @@ -180,9 +180,10 @@ namespace dezentrale.model try { if (!string.IsNullOrEmpty(BankTransferRegEx)) - { - if (Regex.IsMatch(t.TransferReason, BankTransferRegEx)) - return true; + { + if(!t.TransferReason.ToLower().Contains(BankTransferRegEx.ToLower())) + return false; + //if (Regex.IsMatch(t.TransferReason, BankTransferRegEx)) return true; } } catch (Exception ex) diff --git a/view/frmMain.cs b/view/frmMain.cs index e163d04..f048ab8 100644 --- a/view/frmMain.cs +++ b/view/frmMain.cs @@ -465,7 +465,14 @@ namespace dezentrale.view if (dr == DialogResult.OK) { lstMembers.SuspendLayout(); - ProcessCsv.ProcessCSV(ofd.FileName); + + CsvImportProcess csvImport = new CsvImportProcess() + { + FileName = ofd.FileName, + }; + frmProcessWithLog frmCsvImport = new frmProcessWithLog(csvImport, true); + dr = frmCsvImport.ShowDialog(); + foreach (Member m in Program.members.Entries) lstMembers.UpdateEntry(m); if (Program.MoneyTransfersLoaded)