using MySql.Data.MySqlClient; using PaymentLogs.Domain; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PaymentLogs.Repositories { internal class StudentRepo : Repo { public override void Load() { DataBase db = new DataBase(); db.openConnection(); _data.Clear(); string sql = " SELECT * FROM students "; MySqlCommand cmd = new MySqlCommand(sql, db.getConnection()); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Student student = new Student() { Id = reader.GetInt32("id"), FCs = reader.GetString("fcs"), dateOfBirth = DateTime.ParseExact(reader.GetString("date_of_birth"), "yyyy-MM-dd",null), Address = reader.GetString("address"), CourseId = reader.GetInt32("course_id"), Paid = reader.GetInt32("paid") }; _data[student.Id] = student; } db.closeConnection(); } public override void Save() { throw new NotImplementedException(); } } }