Esempio n. 1
0
        private void SetPostDate(string columnValue, FinanceData.FinanceDataItem financeData)
        {
            double   excellTransDate = double.Parse(columnValue);
            DateTime postDate        = DateTime.FromOADate(excellTransDate);

            financeData.PostDate = postDate;
        }
Esempio n. 2
0
        private void SetAmount(string columnValue, FinanceData.FinanceDataItem financeData)
        {
            decimal excellAmount;

            Decimal.TryParse(columnValue, out excellAmount);

            financeData.Amount = excellAmount;
        }
Esempio n. 3
0
        private void PopulateChaseData(Excel.Worksheet workSheet)
        {
            bool readData = false;

            foreach (Excel.Range row in workSheet.UsedRange.Rows)
            {
                int whichColumn = 1;

                if (!readData) // Skipping the first row which is just the column headers
                {
                    readData = true;
                    continue;
                }

                FinanceData.FinanceDataItem financeData = new FinanceData.FinanceDataItem();

                foreach (Excel.Range column in row.Columns)
                {
                    string columnValue = (column.Value2 != null) ? column.Value2.ToString() : String.Empty;

                    switch (whichColumn)
                    {
                    case 1:     // Type
                        financeData.Type = EnumHelper.ParseEnum <FinanceType>(columnValue);;
                        break;

                    case 2:     // Trans Date
                        double   excellTransDate = double.Parse(columnValue);
                        DateTime transDate       = DateTime.FromOADate(excellTransDate);

                        financeData.TransDate = transDate;
                        break;

                    case 3:     // Post Date
                        SetPostDate(columnValue, financeData);
                        break;

                    case 4:     // Description
                        SetDescription(columnValue, financeData);
                        break;

                    case 5:     // Amount
                        SetAmount(columnValue, financeData);
                        break;
                    }

                    whichColumn++;
                }

                financeData.SetCategory();
                _chaseFinanceData.AddFinanceDataItem(financeData);
            }
        }
Esempio n. 4
0
        private void PopulateCyprusData(Excel.Worksheet workSheet)
        {
            bool readData = false;

            foreach (Excel.Range row in workSheet.UsedRange.Rows)
            {
                int whichColumn = 1;

                if (!readData) // Skipping the first row which is just the column headers
                {
                    readData = true;
                    continue;
                }

                FinanceData.FinanceDataItem financeData = new FinanceData.FinanceDataItem();

                foreach (Excel.Range column in row.Columns)
                {
                    string columnValue = (column.Value2 != null) ? column.Value2.ToString() : String.Empty;

                    switch (whichColumn)
                    {
                    case 1:     //Account Number
                        break;

                    case 2:     //Post Date
                        SetPostDate(columnValue, financeData);
                        break;

                    case 3:     //Check Number
                        break;

                    case 4:     // Description
                        SetDescription(columnValue, financeData);
                        break;

                    case 5:     // Debit
                        if (columnValue.Trim() != String.Empty)
                        {
                            SetAmount("-" + columnValue, financeData);
                        }
                        break;

                    case 6:     // Credit
                        if (columnValue.Trim() != String.Empty)
                        {
                            SetAmount(columnValue, financeData);
                        }
                        break;

                    case 7:     // Status
                        break;

                    case 8:     // Balance
                        break;
                    }

                    whichColumn++;
                }

                financeData.SetCategory();
                _cyprusFinanceData.AddFinanceDataItem(financeData);
            }
        }
Esempio n. 5
0
 private void SetDescription(string columnValue, FinanceData.FinanceDataItem financeData)
 {
     financeData.Description = columnValue;
 }