Hi Friends,
I have a csv file and need to parse it for the specific portion. Since my csv file is not properly structured difficult to read into memory and identify rows and columns.
My requirement is, Here Two accounts are given and need to parsed based upon the class structure
ASSTROLLUPSTRT
TOTALACCTS , Total Accounts : 2
ACCTHDR , Account Details
ACCTHDR , Key Account ID, Account Type, Value, Portfolio Type, Portfolio ID, Owner ID
ACCTDTLS , 2002-01-20-12.04.20.445297, RothIRA, 6280496.23, TaxExemptIRA, 1, 2423
ACCTALLOHDR, Account Allocations
ACCTALLOHDR, Key Account ID, Type , AssetClass, Value
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, E, 0.11
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, E, 0
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, EA, 0.11
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, EA, 0
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, A, 2.92
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, A, 123328.9
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, AH, 2.92
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, AH, 123328.9
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, O, 56.72
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, O, 0
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, OO, 56.72
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, OO, 0
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, L, 40.25
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, L, 2528022.3
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Allocation, LC, 40.25
ACCTALLODTLS , 2002-01-20-12.04.20.445297, Cost Basis, LC, 2528022.3
ACCTDTLS , 2016-09-28 13:01:20:9473, Taxable, 0, Taxable, 2, 2423
ACCTALLOHDR, Account Allocations
ACCTALLOHDR, Key Account ID, Type , AssetClass, Value
ACCTALLODTLS , 2016-09-28 13:01:20:9473, Allocation, LC, 100
ACCTALLODTLS , 2016-09-28 13:01:20:9473, Cost Basis, LC, 0
ACCTALLODTLS , 2016-09-28 13:01:20:9473, Allocation, L, 100
ACCTALLODTLS , 2016-09-28 13:01:20:9473, Cost Basis, L, 0
What I have tried:
Below is the class i defined by looking at the csv file. for easy parsing if changes are required we can modify the class structure.
Please help me to achieve this..Please shed some lights how to proceed further
public class CSVparsing
{
public List AccountDetails<Item> { get; set; }
}
public class AccountDetails
{
public string KeyAccountID { get; set; }
public string AccountType { get; set; }
public double Value { get; set; }
public string PortfolioType { get; set; }
public double EarningsRate { get; set; }
public int PortfolioID { get; set; }
public int OwnerID { get; set; }
public Allocation AllocDetails { get; set; }
}
public class Allocation
{
public string AssetClassCode { get; set; }
public double Amount { get; set; }
public double CostBasis { get; set; }
}