2023-12-01 01:01:22 +04:00
|
|
|
|
using AccountContracts.BusinessLogicsContracts;
|
|
|
|
|
using ControlsLibraryNet60.Core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace AccountsView
|
|
|
|
|
{
|
|
|
|
|
public partial class FormMain : Form
|
|
|
|
|
{
|
|
|
|
|
private IAccountLogic _logic;
|
|
|
|
|
|
|
|
|
|
public FormMain(IAccountLogic logic)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_logic = logic;
|
2023-12-01 01:17:26 +04:00
|
|
|
|
abazovTreeView.setHierarchy(new List<(string, bool)> { ("RoleName", false), ("Rating", false), ("Id", true), ("Login", true) });
|
2023-12-01 01:01:22 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ролиToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoles));
|
|
|
|
|
if (service is FormRoles form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FormMain_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadData()
|
|
|
|
|
{
|
|
|
|
|
abazovTreeView.clear();
|
|
|
|
|
var accounts = _logic.ReadList(null);
|
|
|
|
|
if (accounts != null)
|
|
|
|
|
{
|
2023-12-01 01:17:26 +04:00
|
|
|
|
foreach (var account in accounts)
|
|
|
|
|
{
|
|
|
|
|
if (!account.Rating.HasValue)
|
|
|
|
|
{
|
|
|
|
|
account.Rating = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-01 01:01:22 +04:00
|
|
|
|
abazovTreeView.addItems(accounts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormAccount));
|
|
|
|
|
if (service is FormAccount form)
|
|
|
|
|
{
|
|
|
|
|
if (form.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|