public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName, string folder) { numberOfSupoerPortRecords = 0; logger.Write(" Nykrdit format"); string counterPart = "NY"; if (folder.ToLower().Contains("handelsbanken")) { counterPart = "HA"; } // Removing qoutes if (lines[0].IndexOf("\"") == 0) { for (int k = 1; k < lines.Length; k++) { lines[k] = lines[k].Substring(1, lines[k].Length - 2); } } int ks = 0; int ub = 0; int ud = 0; int an = 0; int db = 0; int kb = 0; int dk = 0; ImpRecord uBImpRecord = null; if (lines.Length > 2) { for (int k = 1; k < lines.Length - 1; k++) { string[] fields = lines[k].Split(';'); if (debugLevel) { logger.WriteFields(fields); } if (lines[k].IndexOf("KS;") == 0) { ks++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 35) { emailBody += Environment.NewLine + "Nykredit KS record " + ks + " has too few fields"; logger.Write(" KS record too few fields"); } else { if (fields[20].CompareTo("ORDRE") == 0) { continue; } impRecord.setTransactionType(fields[10]); // Salg impRecord.setDepotNumber(fields[1]); impRecord.setAccountNumber(fields[2]); impRecord.setIdCode(fields[4].TrimEnd()); // impRecord.setTransactionNumber(fields[5]); use SuperPorts impRecord.setTransactionDate(fields[13]); impRecord.setSettlementDate(fields[14]); if (fields[6][0] == 'P') // PENDING { impRecord.setStatus('O'); } else if (fields[6][0] == 'S') // SETTLED { impRecord.setStatus('N'); } else // CANCELLED { impRecord.setStatus('D'); } if (fields[10] == "S") { impRecord.setTransactionType("K"); } else if (fields[10] == "B") { impRecord.setTransactionType("S"); } else { logger.Write(" KS unknown transaction type" + fields[10]); } impRecord.setCurrenciesCross(fields[11] + "/" + fields[12]); impRecord.setCurrenciesRate(fields[15]); impRecord.setAmount(fields[16]); impRecord.setPrice(fields[17]); impRecord.setCost("-" + fields[22]); impRecord.setKurtage("-" + fields[21]); impRecord.setNota('N'); impRecord.setCounterPart(counterPart); // Nykredit impRecord.setUnknown("000000737632.00000000000"); numberOfSupoerPortRecords++; impRecord.writeKoebSalgAktier(fileName); } } else if (lines[k].IndexOf("UB;") == 0) { ub++; //ImpRecord impRecord = new ImpRecord(logger); if (uBImpRecord == null) { uBImpRecord = new ImpRecord(logger); } else if (uBImpRecord.getDepotNumber().TrimStart().CompareTo(fields[1].TrimEnd()) == 0 && uBImpRecord.getIdCode().TrimStart().CompareTo(fields[23].TrimEnd()) == 0) { // handle extra tax record DecimalNumber yeildTax = new DecimalNumber(12, 7, true, logger); yeildTax.setDecimalNumber("-" + fields[18]); // set if not set if (!uBImpRecord.yieldTaxSet()) { uBImpRecord.setYieldTax("-" + fields[18]); } else { // set if bigger than value if (uBImpRecord.getYieldTax().CompareTo(yeildTax.getDecimalNumber()) < 0) { uBImpRecord.setYieldTax("-" + fields[18]); } } continue; } else { numberOfSupoerPortRecords++; uBImpRecord.writeUdbytteAktier(fileName); uBImpRecord = new ImpRecord(logger); } if (fields.Length < 23) { emailBody += Environment.NewLine + "Nykredit UB record " + ub + " has too few fields"; logger.Write(" UB record too few fields"); } else { uBImpRecord.setDepotNumber(fields[1]); uBImpRecord.setAccountNumber(fields[2]); uBImpRecord.setIdCode(fields[23].TrimEnd()); // impRecord.setTransactionNumber(fields[4].Substring(0, fields[4].Length < 8 ? fields[4].Length : 8)); use SuperPorts if (fields[5][0] == 'N' || fields[5][0] == 'A') // NEW // AMENDED { uBImpRecord.setStatus('N'); } else // CANCELLED { uBImpRecord.setStatus('D'); } if (fields[7] == "A") { uBImpRecord.setTransactionType("U"); } else if (fields[7] == "K") { uBImpRecord.setTransactionType("KR"); } else { logger.Write(" UB unknown transaction type" + fields[10]); } uBImpRecord.setCurrenciesCross(fields[8] + "/" + fields[9]); uBImpRecord.setTransactionDate(fields[11]); // has to be same as valør dato! uBImpRecord.setSettlementDate(fields[11]); uBImpRecord.setCurrenciesRate(fields[12]); //impRecord.setAmount(fields[21]); uBImpRecord.setPrice(fields[15]); uBImpRecord.setCost(fields[19]); uBImpRecord.setNota('N'); /*numberOfSupoerPortRecords++; * uBImpRecord.writeUdbytteAktier(fileName); * uBImpRecord = null;*/ } } else if (lines[1].IndexOf("UD;") == 0) { ud++; } else if (lines[1].IndexOf("AN;") == 0) { an++; } else if (lines[1].IndexOf("DB;") == 0) { db++; } else if (lines[1].IndexOf("KB;") == 0) { kb++; } else if (lines[1].IndexOf("DK;") == 0) { dk++; } else if (lines[k] == String.Empty) { } else { success = false; logger.Write(" Ukendt fil format, " + lines[k]); } } if (uBImpRecord != null) { numberOfSupoerPortRecords++; uBImpRecord.writeUdbytteAktier(fileName); uBImpRecord = null; } if (ks > 0) { logger.Write(" Depotbevægelser : " + ks); } if (ub > 0) { logger.Write(" Udbytte, Aktier og obligationer : " + ub); } if (ud > 0) { logger.Write(" Udtrukne obligationer : " + ud); } if (an > 0) { logger.Write(" Kontobevægelse : " + an); } if (db > 0) { logger.Write(" Depotbeholdninger : " + db); } if (kb > 0) { logger.Write(" Kontantbeholdninger : " + kb); } if (dk > 0) { logger.Write(" Relationer mellem depoter og konti : " + dk); } } else { if (lines.Length == 2 && lines[1].IndexOf("TAIL;") == 0) { logger.Write(" Filen indeholder ingen rcords"); } else { success = false; logger.Write(" Ukendt fil format"); } } return(numberOfSupoerPortRecords); }
public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName) { numberOfSupoerPortRecords = 0; logger.Write(" Nordea format"); int hdlobl = 0; int udbakt = 0; int kntopd = 0; int hdlakt = 0; int rntobl = 0; int rntknt = 0; int gbrtrn = 0; int behold = 0; if (lines.Length > 0) { for (int k = 0; k < lines.Length; k++) { string[] fields = lines[k].Split((char)31); if (debugLevel) { logger.WriteFields(fields); } // skip previous records if (nordeaOldRecords.previousRecord(lines[k])) { logger.Write(" Denne record er allerede bogført"); continue; } // write this to the file of previous records nordeaOldRecords.addRecord(lines[k]); if (lines[k].IndexOf("UDBAKT") == 0) { udbakt++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Nordea UDBAKT record " + udbakt + " has too few fields"; logger.Write(" Udbytte aktier record too few fields"); } else { impRecord.setIdCode(fields[4]); impRecord.setSettlementDate(fields[11]); impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setPrice(fields[17]); // yeield tax should be decucted - hence negativ and the dash infront of the field impRecord.setYieldTax("-" + fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 10); impRecord.setCurrenciesRate(fields[56]); // take last 14 digits // impRecord.setDepotNumber(fields[34], false, 14); string depot = nordeaDepot.getDepot(impRecord.getAccountNumber()); if (depot.Equals(string.Empty)) { success = false; string acc = fields[30]; acc = acc.Trim(); acc = acc.TrimStart('0'); emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n"; } impRecord.setDepotNumber("0000000000" + depot, false, 10); impRecord.setTransactionType("U"); impRecord.setNota('N'); impRecord.blankAmount(); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeUdbytteAktier(fileName); } } else if (lines[k].IndexOf("KNTOPD") == 0) { kntopd++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Nordea KNTOPD record " + kntopd + " has too few fields"; logger.Write(" Konto opdatering record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 10); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("I"); impRecord.setNota('N'); impRecord.setAmount(fields[17]); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeIndsaetHaev(fileName); } } else if (lines[k].IndexOf("HDLAKT") == 0) { hdlakt++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Nordea HDLAKT record " + hdlakt + " has too few fields"; logger.Write(" Handel med aktier record too few fields"); } else { impRecord.setTransactionDate(fields[3]); impRecord.setIdCode(fields[4]); if (fields[17].Length > 0 && fields[17][0] == '-') { impRecord.setTransactionType("S"); // Salg } else { impRecord.setTransactionType("K"); // Køb } impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setAmount(fields[17]); impRecord.setExchangeRate(fields[18]); CultureInfo cultureInfo = new CultureInfo("en-US"); Decimal currencyRate = Convert.ToDecimal(fields[56], cultureInfo); Decimal kurtage = Convert.ToDecimal(fields[21], cultureInfo); Decimal cost = Convert.ToDecimal(fields[20], cultureInfo); impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString()); //impRecord.setKurtage("-" + fields[21]); impRecord.setCurrenciesRate(fields[56]); impRecord.setYieldTax("-" + fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 10); // take last 14 digits string depot = nordeaDepot.getDepot(impRecord.getAccountNumber()); if (depot.Equals(string.Empty)) { success = false; string acc = fields[30]; acc = acc.Trim(); acc = acc.TrimStart('0'); emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n"; } impRecord.setDepotNumber("0000000000" + depot, false, 10); impRecord.setNota('N'); impRecord.setCounterPart("NO"); // Nordea impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeKoebSalgAktier(fileName); } } else if (lines[k].IndexOf("GBRTRN") == 0) { gbrtrn++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Nordea GBRTRN record " + gbrtrn + " has too few fields"; logger.Write(" Konto opdatering record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // take last 10 digits impRecord.setAccountNumber(fields[30], false, 10); /* depot not used for gebyr * string depot = nordeaDepot.getDepot(impRecord.getAccountNumber()); * if (depot.Equals(string.Empty)) * { * success = false; * string acc = fields[30]; * acc = acc.Trim(); * acc = acc.TrimStart('0'); * emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n"; * } * impRecord.setDepotNumber("0000000000" + depot, false, 10);*/ impRecord.setTransactionType("I"); impRecord.setNota('N'); impRecord.setAmount(fields[17]); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeIndsaetHaev(fileName); } } else if (lines[k].Length > 12 && lines[k][10] == 31 && lines[k][11] == 31) { behold++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 6) { emailBody += Environment.NewLine + "Nordea BEHOLD record " + behold + " has too few fields"; logger.Write(" Konto opdatering record too few fields (" + fields.Length + ")"); } else { // TODO } } else if (lines[k].Length > 12 && lines[k][10] == 31) { kntopd++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 9) { emailBody += Environment.NewLine + "Nordea KNTOPD record " + kntopd + " has too few fields"; logger.Write(" Konto opdatering record too few fields (" + fields.Length + ")"); } else { // TODO } } else { // success = false; It is ok with unknown danske bank formats logger.Write(" Ukendt record format, " + lines[k].Split((char)31)[0]); } } if (hdlobl > 0) { logger.Write(" Handel med obligationer og pantebreve : " + hdlobl); } if (udbakt > 0) { logger.Write(" Udbytte aktier : " + udbakt); } if (hdlakt > 0) { logger.Write(" Handel med aktier : " + hdlakt); } if (rntobl > 0) { logger.Write(" Kupon rente for obligationer og pantebreve : " + rntobl); } if (rntknt > 0) { logger.Write(" Rente konto : " + rntknt); } if (gbrtrn > 0) { logger.Write(" Gebyr konto : " + gbrtrn); } if (kntopd > 0) { logger.Write(" Konto opdatering : " + kntopd); } if (behold > 0) { logger.Write(" Konto beholdning : " + behold); } } else { if (lines.Length == 2 && lines[1].IndexOf("TAIL") == 0) { logger.Write(" Filen indeholder ingen rcords"); } else { success = false; logger.Write(" Ukendt fil format"); } } return(numberOfSupoerPortRecords); }
public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName, string folder) { numberOfSupoerPortRecords = 0; logger.Write(" Jyske Bank format"); string counterPart = "JB"; if (folder.ToLower().Contains("sydbank")) { counterPart = "SB"; } if (lines.Length > 1) { int ub = 0; int kr = 0; int ks = 0; int ksAnuls = 0; for (int k = 1; k < lines.Length; k++) { string[] fields = lines[k].Split(';'); if (fields[0].CompareTo("KS") == 0) { if (fields[5].CompareTo("95") == 0) { annuls.Add(fields[6]); } } } for (int k = 1; k < lines.Length; k++) { string[] fields = lines[k].Split(';'); if (debugLevel) { logger.WriteFields(fields); } if (fields[0].CompareTo("UB") == 0) { ImpRecord impRecord = new ImpRecord(logger); impRecord.setTransactionDate(fields[10]); // // not fields[6] as it has to be the same as settlementdate // use the dictionary to get the isin code impRecord.setIdCode(fondCode.getIsin(fields[3])); impRecord.setSettlementDate(fields[10]); // impRecord.setTransactionNumber(fields[4]); use SuperPorts // The file does not contain the original amount so we have to calculate it from the currency rate and the settled amount, in danish number format CultureInfo cultureInfo = new CultureInfo("da-DK"); Decimal currencyRate = Convert.ToDecimal(fields[11], cultureInfo); Decimal settlementAmount = Convert.ToDecimal(fields[14], cultureInfo); impRecord.setPrice(Math.Round(settlementAmount / currencyRate * 100, 2).ToString()); impRecord.setCurrenciesRate(fields[11]); // yeield tax should be decucted - hence negativ and the dash infront of the field Decimal tax = Convert.ToDecimal(fields[15], cultureInfo); impRecord.setYieldTax("-" + Math.Round(tax / currencyRate * 100, 2).ToString()); // take last 14 digits impRecord.setAccountNumber(fields[2], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[1], false, 14); impRecord.setNota('N'); impRecord.blankAmount(); impRecord.blankKurtage(); Decimal cost = Convert.ToDecimal(fields[16], cultureInfo); impRecord.setCost("-" + Math.Round(cost / currencyRate * 100, 2).ToString()); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[8] + "/" + fields[9]); if (fields[7] == "A") { ub++; impRecord.setTransactionType("U"); numberOfSupoerPortRecords++; impRecord.writeUdbytteAktier(fileName); } else if (fields[7] == "K") { kr++; impRecord.setTransactionType("KR"); numberOfSupoerPortRecords++; impRecord.writeRenteKuponer(fileName); } } if (fields[0].CompareTo("KS") == 0) { ImpRecord impRecord = new ImpRecord(logger); impRecord.setTransactionDate(fields[11]); impRecord.setTransactionType(fields[8]); impRecord.setSettlementDate(fields[12]); // impRecord.setTransactionNumber(fields[4]); use SuperPorts impRecord.setAmount(fields[14]); impRecord.setExchangeRate(fields[15]); CultureInfo cultureInfo = new CultureInfo("da-DK"); Decimal currencyRate = Convert.ToDecimal(fields[13], cultureInfo); // Remove negative kurtage, as all kurtage is negative Decimal kurtage = Convert.ToDecimal(fields[17].Replace('-', ' '), cultureInfo); impRecord.setKurtage("-" + Math.Round(kurtage / currencyRate * 100, 2).ToString()); impRecord.setCurrenciesRate(fields[13]); // take last 14 digits impRecord.setAccountNumber(fields[2], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[1], false, 14); impRecord.setNota('N'); impRecord.setCounterPart(counterPart); // Jydske bank impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[9], fields[10]); // use the dictionary to get the isin code string idCode = fondCode.getIsin(fields[3]); if (idCode.Equals(string.Empty)) { success = false; emailBody += "Try to get Isin code " + fields[3] + " but was not found in the fondcode file.\n"; } else { impRecord.setIdCode(idCode); // check for anuls if (isAnul(fields[4])) { ksAnuls++; } else { ks++; numberOfSupoerPortRecords++; impRecord.writeKoebSalgAktier(fileName); } } } } if (ub > 0) { logger.Write(" Udbytte : " + ub); } if (kr > 0) { logger.Write(" Kupon : " + kr); } if (ks > 0) { logger.Write(" Køb Salg : " + ks); } if (ksAnuls > 0) { logger.Write(" Køb Salg, annuleret : " + ksAnuls); } } return(numberOfSupoerPortRecords); }
public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName) { numberOfSupoerPortRecords = 0; logger.Write(" Danske Bank format"); int hdlobl = 0; int udbakt = 0; int kntopd = 0; int hdlakt = 0; int rntobl = 0; int rntknt = 0; int gbrtrn = 0; if (lines.Length > 2) { for (int k = 1; k < lines.Length - 1; k++) { string[] fields = lines[k].Split((char)31); if (debugLevel) { logger.WriteFields(fields); } if (lines[k].IndexOf("HDLOBL") == 0) { hdlobl++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 70) { emailBody += Environment.NewLine + "Danske bank KS record " + hdlobl + " has too few fields"; logger.Write(" Handel med obligationer og pantebreve record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setIdCode(fields[4]); impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setAmount(fields[17]); impRecord.setExchangeRate(fields[18]); CultureInfo cultureInfo = new CultureInfo("en-US"); Decimal currencyRate = Convert.ToDecimal(fields[23], cultureInfo); Decimal kurtage = Convert.ToDecimal(fields[21], cultureInfo); Decimal cost = Convert.ToDecimal(fields[22], cultureInfo); impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString()); //impRecord.setKurtage("-" + fields[21]); impRecord.setCurrenciesCross(fields[55], fields[53]); impRecord.setCurrenciesRate(fields[23]); impRecord.setInterest(fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); //impRecord.setPrice(fields[31]); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); if (fields[17].Length > 0 && fields[17][0] == '-') { impRecord.setTransactionType("S"); // Salg } else { impRecord.setTransactionType("K"); // Køb } impRecord.setStatus('N'); impRecord.setNota('N'); impRecord.setCounterPart("DB"); // Danske bank impRecord.writeKoebSalgObligationer(fileName); } } else if (lines[k].IndexOf("UDBAKT") == 0) { udbakt++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Danske Bank UDBAKT record " + udbakt + " has too few fields"; logger.Write(" Udbytte aktier record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setIdCode(fields[4]); impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // yeield tax should be decucted - hence negativ and the dash infront of the field impRecord.setYieldTax("-" + fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("U"); impRecord.setNota('N'); impRecord.blankAmount(); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeUdbytteAktier(fileName); } } else if (lines[k].IndexOf("KNTOPD") == 0) { kntopd++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Danske Bank KNTOPD record " + kntopd + " has too few fields"; logger.Write(" Konto opdatering record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("I"); impRecord.setNota('N'); impRecord.setAmount(fields[17]); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeIndsaetHaev(fileName); } } else if (lines[k].IndexOf("HDLAKT") == 0) { hdlakt++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 72) { emailBody += Environment.NewLine + "Danske Bank HDLAKT record " + hdlakt + " has too few fields"; logger.Write(" Handel med aktier record too few fields"); } else { impRecord.setTransactionDate(fields[3]); impRecord.setIdCode(fields[4]); if (fields[17].Length > 0 && fields[17][0] == '-') { impRecord.setTransactionType("S"); // Salg } else { impRecord.setTransactionType("K"); // Køb } impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setAmount(fields[17]); impRecord.setExchangeRate(fields[18]); CultureInfo cultureInfo = new CultureInfo("en-US"); Decimal currencyRate = Convert.ToDecimal(fields[23], cultureInfo); Decimal kurtage = Convert.ToDecimal(fields[21], cultureInfo); Decimal cost = Convert.ToDecimal(fields[22], cultureInfo); impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString()); //impRecord.setKurtage("-" + fields[21]); impRecord.setCurrenciesRate(fields[23]); impRecord.setYieldTax(fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setNota('N'); impRecord.setCounterPart("DB"); // Danske bank impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeKoebSalgAktier(fileName); } } else if (lines[k].IndexOf("RNTOBL") == 0) { rntobl++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Danske Bank RNTOBL record " + rntobl + " has too few fields"; logger.Write(" Kupon rente for obligationer og pantebreve record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setIdCode(fields[4]); impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setExchangeRate(fields[17]); impRecord.setKurtage("-" + fields[21]); impRecord.setAmount(fields[32]); impRecord.setCurrenciesRate(fields[23]); impRecord.setYieldTax(fields[24]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("KR"); impRecord.setNota('N'); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeRenteKuponer(fileName); } } else if (lines[k].IndexOf("RNTKNT") == 0) { rntknt++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Danske Bank RNTKNT record " + rntknt + " has too few fields"; logger.Write(" Konto opdatering record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("I"); impRecord.setNota('N'); impRecord.setAmount(fields[17]); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeIndsaetHaev(fileName); } } else if (lines[k].IndexOf("GBRTRN") == 0) { gbrtrn++; ImpRecord impRecord = new ImpRecord(logger); if (fields.Length < 58) { emailBody += Environment.NewLine + "Danske Bank GBRTRN record " + gbrtrn + " has too few fields"; logger.Write(" Konto opdatering record too few fields"); } else { impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate impRecord.setSettlementDate(fields[11]); // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts impRecord.setPrice(fields[17]); impRecord.setCurrenciesRate(fields[23]); // take last 14 digits impRecord.setAccountNumber(fields[30], false, 14); // take last 14 digits impRecord.setDepotNumber(fields[34], false, 14); impRecord.setTransactionType("I"); impRecord.setNota('N'); impRecord.setAmount(fields[17]); impRecord.blankKurtage(); impRecord.setStatus('N'); impRecord.setCurrenciesCross(fields[55], fields[53]); numberOfSupoerPortRecords++; impRecord.writeIndsaetHaev(fileName); } } else { // success = false; It is ok with unknown danske bank formats logger.Write(" Ukendt record format, " + lines[k].Split((char)31)[0]); } } if (hdlobl > 0) { logger.Write(" Handel med obligationer og pantebreve : " + hdlobl); } if (udbakt > 0) { logger.Write(" Udbytte aktier : " + udbakt); } if (hdlakt > 0) { logger.Write(" Handel med aktier : " + hdlakt); } if (rntobl > 0) { logger.Write(" Kupon rente for obligationer og pantebreve : " + rntobl); } if (rntknt > 0) { logger.Write(" Rente konto : " + rntknt); } if (gbrtrn > 0) { logger.Write(" Ren-gebyrte konto : " + gbrtrn); } if (kntopd > 0) { logger.Write(" Konto opdatering : " + kntopd); } } else { if (lines.Length == 2 && lines[1].IndexOf("TAIL") == 0) { logger.Write(" Filen indeholder ingen rcords"); } else { success = false; logger.Write(" Ukendt fil format"); } } return(numberOfSupoerPortRecords); }