private void Match_records <TThirdPartyType>(TThirdPartyType source, ICSVRecord match) where TThirdPartyType : ICSVRecord, new()
 {
     match.Matched = true;
     (source as ICSVRecord).Matched = true;
     match.Match = source;
     (source as ICSVRecord).Match = match;
 }
Пример #2
0
        private string Get_description_without_specific_qualifier(ICSVRecord match)
        {
            string new_description = match.Description;

            var qualifier_index_with_space_at_end = match.Description.IndexOf($"{_match_description_qualifier} ", StringComparison.CurrentCultureIgnoreCase);

            if (qualifier_index_with_space_at_end >= 0)
            {
                new_description = match.Description.Remove(qualifier_index_with_space_at_end, _match_description_qualifier.Length + 1);
            }
            else
            {
                var qualifier_index_with_space_at_start = match.Description.IndexOf($" {_match_description_qualifier}", StringComparison.CurrentCultureIgnoreCase);
                if (qualifier_index_with_space_at_start >= 0)
                {
                    new_description = match.Description.Remove(qualifier_index_with_space_at_start, _match_description_qualifier.Length + 1);
                }
                else
                {
                    var qualifier_index_no_space = match.Description.IndexOf(_match_description_qualifier, StringComparison.CurrentCultureIgnoreCase);
                    if (qualifier_index_no_space >= 0)
                    {
                        new_description = match.Description.Remove(qualifier_index_no_space, _match_description_qualifier.Length);
                    }
                }
            }


            new_description = $"{new_description} {match.Main_amount().To_csv_string(true)}";
            return(new_description);
        }
Пример #3
0
 private void Match_records(CredCard2Record source, ICSVRecord match)
 {
     match.Matched  = true;
     source.Matched = true;
     match.Match    = source;
     source.Match   = match;
 }
Пример #4
0
        public void Copy_from(ICSVRecord source)
        {
            if (source.GetType() == typeof(ExpectedIncomeRecord))
            {
                ExpectedIncomeRecord typed_source = source as ExpectedIncomeRecord;

                Date = typed_source.Date;
                Unreconciled_amount = typed_source.Unreconciled_amount;
                Code = typed_source.Code;
                Reconciled_amount = typed_source.Reconciled_amount;
                Date_paid         = typed_source.Date_paid;
                Total_paid        = typed_source.Total_paid;
                Description       = typed_source.Description;
                SourceLine        = typed_source.SourceLine;
                OutputSourceLine  = typed_source.OutputSourceLine;

                Match   = typed_source.Match;
                Matched = typed_source.Matched;
                Divider = typed_source.Divider;
            }
            else
            {
                throw (new Exception("Trying to copy record but it's not a ExpectedIncomeRecord type."));
            }
        }
            public void Append_csv_record(String sheet_name, ICSVRecord csv_record)
            {
                Open_sheet(sheet_name);
                var new_row_number = Last_row_number(sheet_name) + 1;

                csv_record.Populate_spreadsheet_row(new ExcelRange(_current_worksheet.Cells), new_row_number);

                _workbook.Save();
            }
        public void Create_from_match(DateTime date, double amount, string type, string description, int extra_info, ICSVRecord matched_record)
        {
            Match   = matched_record;
            Matched = true;

            Date        = date;
            Amount      = amount;
            Description = description;
        }
        private ICSVRecord With_correct_days_per_month(ICSVRecord record, int new_year, int new_month)
        {
            int days_in_month = DateTime.DaysInMonth(new_year, new_month);
            int day           = record.Date.Day > days_in_month
                ? days_in_month
                : record.Date.Day;

            return(record.With_date(new DateTime(new_year, new_month, day)));
        }
        public void Create_from_match(DateTime date, double amount, string type, string description, int extra_info, ICSVRecord matched_record)
        {
            Match   = matched_record;
            Matched = true;

            Date = date;
            Unreconciled_amount = amount;
            Type          = type;
            Description   = description;
            Cheque_number = extra_info;
        }
 public void Create_new_expenses_record_to_match_balance(ICSVRecord source_record, double balance)
 {
     if (File.Records != null)
     {
         File.Records.Add(new ExpectedIncomeRecord
         {
             Description         = ReconConsts.UnknownExpense,
             Unreconciled_amount = balance,
             Match      = source_record,
             Matched    = true,
             Date       = source_record.Date,
             Date_paid  = source_record.Date,
             Total_paid = source_record.Main_amount(),
             Code       = Codes.Expenses
         });
     }
 }
        public void Update_expected_income_record_when_matched(ICSVRecord source_record, ICSVRecord match)
        {
            if (File.Records != null)
            {
                var matching_records = File.Records.Where(
                    x => x.Description.Remove_punctuation() == match.Description.Remove_punctuation() &&
                    x.Date == match.Date &&
                    x.Main_amount() == match.Main_amount());

                if (matching_records.Count() == 1)
                {
                    var matching_record = matching_records.ElementAt(0);

                    matching_record.Match      = source_record;
                    matching_record.Matched    = true;
                    matching_record.Date_paid  = source_record.Date;
                    matching_record.Total_paid = source_record.Main_amount();
                }
            }
        }
Пример #11
0
        public void Copy_from(ICSVRecord source)
        {
            if (source.GetType() == typeof(CredCard2Record))
            {
                CredCard2Record typed_source = source as CredCard2Record;

                Date             = typed_source.Date;
                Description      = typed_source.Description;
                Amount           = typed_source.Amount;
                SourceLine       = typed_source.SourceLine;
                OutputSourceLine = typed_source.OutputSourceLine;

                Match   = typed_source.Match;
                Matched = typed_source.Matched;
                Divider = typed_source.Divider;
            }
            else
            {
                throw (new Exception("Trying to copy record but it's not a CredCard2Record type."));
            }
        }
Пример #12
0
        public void Copy_from(ICSVRecord source)
        {
            if (source.GetType() == typeof(ActualBankRecord))
            {
                ActualBankRecord typed_source = source as ActualBankRecord;

                Date                  = typed_source.Date;
                Type                  = typed_source.Type;
                Description           = typed_source.Description;
                Amount                = typed_source.Amount;
                Balance               = typed_source.Balance;
                LastTransactionMarker = typed_source.LastTransactionMarker;
                SourceLine            = typed_source.SourceLine;
                OutputSourceLine      = typed_source.OutputSourceLine;

                Match   = typed_source.Match;
                Matched = typed_source.Matched;
                Divider = typed_source.Divider;
            }
            else
            {
                throw (new Exception("Trying to copy record but it's not a ActualBankRecord type."));
            }
        }
Пример #13
0
        public void Copy_from(ICSVRecord source)
        {
            if (source.GetType() == typeof(BankRecord))
            {
                BankRecord typed_source = source as BankRecord;

                Date = typed_source.Date;
                Unreconciled_amount = typed_source.Unreconciled_amount;
                Type              = typed_source.Type;
                Description       = typed_source.Description;
                Reconciled_amount = typed_source.Reconciled_amount;
                Cheque_number     = typed_source.Cheque_number;
                SourceLine        = typed_source.SourceLine;
                OutputSourceLine  = typed_source.OutputSourceLine;

                Match   = typed_source.Match;
                Matched = typed_source.Matched;
                Divider = typed_source.Divider;
            }
            else
            {
                throw (new Exception("Trying to copy record but it's not a BankRecord type."));
            }
        }
 public String Read_last_row_as_csv(String sheet_name, ICSVRecord csv_record)
 {
     return(_spreadsheet_io.Read_last_row_as_csv(sheet_name, csv_record));
 }
Пример #15
0
 public void Copy_from(ICSVRecord source)
 {
     throw new NotImplementedException();
 }
 public String Read_last_row_as_csv(String sheet_name, ICSVRecord csv_record)
 {
     csv_record.Read_from_spreadsheet_row(Read_last_row(sheet_name));
     return(csv_record.To_csv());
 }
 public void Append_csv_record(String sheet_name, ICSVRecord csv_record)
 {
     Inner_spreadsheet.Append_csv_record(sheet_name, csv_record);
 }
 public string Read_last_row_as_csv(string sheet_name, ICSVRecord csv_record)
 {
     return(Inner_spreadsheet.Read_last_row_as_csv(sheet_name, csv_record));
 }
 public void Create_from_match(DateTime date, double amount, string type, string description, int extra_info,
                               ICSVRecord matched_record)
 {
     throw new NotImplementedException();
 }
        /// ///////////////////////////////////////////////////////////////////////////////
        /// /// ///////////////////////////////////////////////////////////////////////////////
        /// /// ///////////////////////////////////////////////////////////////////////////////
        /// /// ///////////////////////////////////////////////////////////////////////////////

        public void Append_csv_record(string sheet_name, ICSVRecord csv_record)
        {
        }
 public void Create_new_expenses_record_to_match_balance(ICSVRecord source_record, double balance)
 {
     _expected_income_file.Create_new_expenses_record_to_match_balance(source_record, balance);
 }
 public String Read_specified_row_as_csv(String sheet_name, int row_number, ICSVRecord csv_record)
 {
     csv_record.Read_from_spreadsheet_row(_spreadsheet_io.Read_specified_row(sheet_name, row_number));
     return(csv_record.To_csv());
 }
Пример #23
0
 public void Create_from_match(DateTime date, double amount, string type, string description, int extra_info,
                               ICSVRecord matched_record)
 {
 }
 public string Read_last_row_as_csv(string sheet_name, ICSVRecord csv_record)
 {
     _debug_log.Append_to_file_as_source_line($"{Get_method_name()}: sheetName {sheet_name}");
     return("");
 }
 public void Update_expected_income_record_when_matched(ICSVRecord source_record, ICSVRecord matched_record)
 {
     _expected_income_file.Update_expected_income_record_when_matched(source_record, matched_record);
 }