Beispiel #1
0
        public TaxpayerImport CreateTaxpayerImport(DataRow row)
        {
            var taxpayer = new TaxpayerImport
            {
                Import                              = GetBool(row["Import"].ToString().Trim().ToLower()),
                EntityCode                          = row["EntityCode"].ToString().Trim(),
                TaxNumber                           = row["TaxNumber"].ToString().Trim(),
                TaxpayerOrFirstName                 = row["FirstName"].ToString().Trim(),
                LastName                            = row["LastName"].ToString().Trim(),
                EntityType                          = GetEntityType(row["EntityType"].ToString().Trim().ToLower()),
                DateOfBirth                         = GetDate(row["DateOfBirth"].ToString().Trim()),
                BsbNumber                           = row["BsbNumber"].ToString().Trim(),
                BankAccountNumber                   = row["BankAccountNumber"].ToString().Trim(),
                BalanceAccountName                  = row["BalanceAccountName"].ToString().Trim(),
                BaseRateEntityIndicator             = GetBool(row["BaseRateEntityIndicator"].ToString().Trim().ToLower()),
                NoticesRecipientCorporateName       = row["NoticesRecipientCorporateName"].ToString().Trim(),
                NoticesRecipientCorporateABN        = row["NoticesRecipientCorporateABN"].ToString().Trim(),
                NoticesRecipientIndividualFirstName = row["NoticesRecipientIndividualFirstName"].ToString().Trim(),
                NoticesRecipientIndividualLastName  = row["NoticesRecipientIndividualLastName"].ToString().Trim(),
                FamilyTrustElectionYear             = GetFamilyTrustElectionYear(row["FamilyTrustElectionYear"].ToString().Trim()),
                FamilyTrustElection                 = row["FamilyTrustElection"].ToString().Trim(),
            };

            return(taxpayer);
        }
Beispiel #2
0
        public List <TaxpayerImport> CreateTaxpayerFromExcelAsync(string filename)
        {
            Workbook workbook = new Workbook();

            using System.IO.Stream stream = _resourceFileLoader.LoadStreamResource(str => str.EndsWith(filename));

            workbook.LoadFromStream(stream);

            Worksheet sheet = workbook.Worksheets[0];

            DataTable data = sheet.ExportDataTable();

            List <TaxpayerImport> imports = new List <TaxpayerImport>();

            foreach (DataRow row in data.Rows)
            {
                TaxpayerImport import = CreateTaxpayerImport(row);

                imports.Add(import);
            }
            return(imports);
        }