trakker/Services/MainCtrl.cs

33 lines
959 B
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using trakker.Models;
using trakker.Interfaces;
namespace trakker.Services
{
internal class MainCtrl
{
private readonly string _connectionString;
private readonly IMainForm _view;
public MainCtrl(IMainForm view, string? connectionString)
{
_view = view ?? throw new ArgumentNullException(nameof(view));
_connectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
LoadClients();
}
internal void LoadClients()
{
// Implement logic to load clients from the database using _connectionString
var dbo = new Data.ClientData(_connectionString);
var clients = dbo.Get();
_view.InitDataGridViewClients(clients);
}
}
}