first commit

This commit is contained in:
redtea committed 2024-05-23 23:21:24 +03:00
1 parent a9f02f8595
commit 1f6634add4
83 files changed
+28739

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
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<int, Student>
{
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();
}
}
}