// 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); }
private void btnNextNumber_Click(object sender, EventArgs e) { string number = txtNumber.Text.Trim(); currentClient = myBank.Clients.Find(number); if (currentClient == null) { MessageBox.Show("Client Number Not Found, Try again.", "TD: Identification Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtNumber.Focus(); return; } else { this.Height = 273; lblWelcome.Text = "Welcome " + currentClient.Name; txtPin.Focus(); } }