0

I am creating an application that reads from a .csv file through a 3 tiered architecture. I have made a code that reads and stores the .csv data into a list in the data link layer already. but Im having a problem in the business logic, or I dont even know where to start. heres my code below

using System;    
using System.Collections.Generic;    
using System.IO;

namespace Data_Layer    
{    
    class dataConnection    
    {

        static void Main(string[] args)    
        {

        }

        public class CardsList    
        {    
            public string cardTypeCode { get; set; }    
            public string cardTypeName { get; set; }    
            public string issuingBank { get; set; }    
            public int cardNumber { get; set; }    
            public string cardHoldersName { get; set; }    
            public int cvvCvv2 { get; set; }    
            public DateTime issueDate { get; set; }    
            public DateTime expiryDate { get; set; }    
            public DateTime billingDate { get; set; }    
            public int cardPin { get; set; }    
            public int creditLimit { get; set; }    
        }

        class DataConnection    
        {    
            public List<CardsList> ReadDataFile()
            {    
                List<CardsList> cardRecords = new List<CardsList>();

                string[] path = File.ReadAllLines(@"C:\Users\tevin\Desktop\credit_card_records.csv");

                foreach (string CardsList in path)    
                {    
                    if ((CardsList != "") && !CardsList.EndsWith("Code"))   
                    {  
                        string[] columns = CardsList.Split(',');

                        CardsList holder = new CardsList();

                        holder.cardTypeCode = Convert.ToString(columns[0]);
                        holder.cardTypeName = Convert.ToString(columns[1]);
                        holder.issuingBank = Convert.ToString(columns[2]);
                        holder.cardNumber = Convert.ToInt32(columns[3]);
                        holder.cardHoldersName = Convert.ToString(columns[4]);

                        holder.cvvCvv2 = Convert.ToInt32(columns[5]);    
                        holder.issueDate = DateTime.ParseExact(columns[6], "M/yyyy-dd", null);

                        holder.expiryDate = DateTime.ParseExact(columns[7], "M/yyyy-dd", null);    
                        holder.billingDate = DateTime.ParseExact(columns[8], "M/yyyy-dd", null);
                        holder.cardPin = Convert.ToInt32(columns[9]);
                        holder.creditLimit = Convert.ToInt32(columns[10]);
                        cardRecords.Add(holder);
                    }
                    else { }
                }

                return cardRecords;
            }    
        }    
    }    
}
Hayden
  • 2,902
  • 2
  • 15
  • 29

1 Answers1

0

@johnwu in my busines I want to search for expired card numbers by date, pins that can be easily hacked i.e 1111/1234