public clsATM(string number, string company, string location, string status, clsListClient clients, decimal balance) { vNumber = number; vCompany = company; vLocation = location; vStatus = status; vClients = clients; vBalance = balance; }
private void frmATM_Load(object sender, EventArgs e) { txtDeposit.Visible = false; lblDeposit.Visible = false; txtWithdraw.Visible = false; lblWithdraw.Visible = false; this.Height = 175; // initialization of the ATM with the content of the datasource clsListClient allClients = clsDataSource.getAllClients(); myBank = new clsATM("111", "TD", "CLasalle", "active", allClients, 200000); }
// we declare static class to store global variables or functions for the project public static clsListClient getAllClients() { //// --- TEXTFILES VERSION ------- //clsListClient allclients = new clsListClient(); //StreamReader myfile = new StreamReader("Clients.txt"); //while(myfile.EndOfStream == false) //{ // string num = myfile.ReadLine(); // string nam = myfile.ReadLine(); // string pin = myfile.ReadLine(); // string stat = myfile.ReadLine(); // clsClient aclient = new clsClient(num, nam, pin, stat); // allclients.Add(aclient); //} //myfile.Close(); //return allclients; //// ----- DATABASE VERSION ------- clsListClient allclients = new clsListClient(); OleDbConnection mycon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\15148\source\repos\2020\group07478\prjWinCsReviewOOP\prjWinCsReviewOOP\databases\DBBank2003.mdb"); mycon.Open(); string sql = "SELECT [Number], ClientName, Pin, Status FROM Clients"; OleDbCommand mycmd = new OleDbCommand(sql, mycon); OleDbDataReader myRder = mycmd.ExecuteReader(); while (myRder.Read()) { string num = myRder["Number"].ToString(); string nam = myRder["ClientName"].ToString(); string pin = myRder["Pin"].ToString(); string stat = myRder["Status"].ToString(); clsClient aclient = new clsClient(num, nam, pin, stat); allclients.Add(aclient); } myRder.Close(); mycon.Close(); return(allclients); }
public clsATM() { vNumber = vCompany = vLocation = vStatus = "not defined"; vClients = new clsListClient(); vBalance = -1; }