2022-02-18 Fixed CsvImportProcess wasn't used, Changed Member banktransferregex -> Contains
This commit is contained in:
parent
4d16e11b6e
commit
64ae7f6c4b
|
@ -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
|
||||
|
|
|
@ -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<BankTransfer> tmpList = new List<BankTransfer>();
|
||||
List<string> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue