Compare commits

..

6 Commits
main ... lab1

Author SHA1 Message Date
b9b898380c lab 1 ready 100% 2024-11-19 00:13:58 +04:00
e8b8778e62 lab 1 ready 2024-11-19 00:05:49 +04:00
5c229cb2ff lab 1ready 2024-11-18 23:50:05 +04:00
ac3290f085 lab1 ready 2024-11-18 19:32:07 +04:00
c4e6741777 lab1 ready 2024-11-09 03:06:08 +04:00
b0b03748bb lab1 ready 2024-11-05 03:59:13 +04:00
70 changed files with 5173 additions and 77 deletions

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/.idea.ProjectGSM.iml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,50 @@
using ProjectGSM.Entities.Enums;
using System.ComponentModel;
namespace ProjectGSM.Entities;
public class Advocate
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public bool Sex { get; private set; }
public DateTime DateOfBirth { get; private set; }
public int Experience { get; private set; }
public int CompletedTasks { get; private set; }
public int Rating { get; private set; }
public string Email { get; private set; } = string.Empty;
public string PhoneNumber { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public LicenseType LicenseType { get; private set; }
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static Advocate CreateEntity(
int id,
string name,
bool sex,
DateTime dateOfBirth,
int experience,
int completedTasks,
int rating,
string email,
string phoneNumber,
string address, LicenseType license)
{
return new Advocate
{
Id = id,
Name = name ?? string.Empty,
Sex = sex,
DateOfBirth = dateOfBirth,
Experience = experience,
CompletedTasks = completedTasks,
Rating = rating,
Email = email ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Address = address ?? string.Empty,
LicenseType = license,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,46 @@
using System.Text.Json.Serialization;
using ProjectGSM.Entities.Enums;
namespace ProjectGSM.Entities;
public class Case
{
public int Id { get; private set; }
public TypeAppeal TypeAppeal { get; private set; }
public bool Payment { get; private set; } = false;
public decimal Price { get; private set; }
public decimal VictoryPrice { get; private set; }
public bool Verdict { get; private set; } = false;
public int CourtId { get; private set; }
public int ClientId { get; private set; }
public string Description { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
[JsonIgnore]public List<CaseAdvocate> Advocates { get; set; }
// Конструктор для создания сущности
public static Case CreateEntity(
int id,
TypeAppeal typeAppeal,
bool payment,
decimal price,
decimal victoryPrice,
bool verdict,
int courtId,
int clientId,
string description
)
{
return new Case
{
Id = id,
TypeAppeal = typeAppeal,
Payment = payment,
Price = price,
VictoryPrice = victoryPrice,
Verdict = verdict,
CourtId = courtId,
ClientId = clientId,
Description = description ?? string.Empty,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,21 @@
namespace ProjectGSM.Entities;
public class CaseAdvocate
{
public int CaseId { get; private set; }
public int AdvocateId { get; private set; }
public string Post { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static CaseAdvocate CreateEntity(int caseId, int advocateId, string post)
{
return new CaseAdvocate
{
CaseId = caseId,
AdvocateId = advocateId,
Post = post,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,36 @@
namespace ProjectGSM.Entities;
public class Client
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public bool Sex { get; private set; }
public DateTime DateOfBirth { get; private set; }
public string Email { get; private set; } = string.Empty;
public string PhoneNumber { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static Client CreateEntity(
int id,
string name,
bool sex,
DateTime dateOfBirth,
string email,
string phoneNumber,
string address)
{
return new Client
{
Id = id,
Name = name ?? string.Empty,
Sex = sex,
DateOfBirth = dateOfBirth,
Email = email ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Address = address ?? string.Empty,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,21 @@
namespace ProjectGSM.Entities;
public class Court
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static Court CreateEntity(int id, string name, string address, DateTime? createdAt = null)
{
return new Court
{
Id = id,
Name = name ?? string.Empty,
Address = address ?? string.Empty,
CreatedAt = createdAt ?? DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGSM.Entities.Enums
{
[Flags]
public enum LicenseType
{
None, Base, Novokek, Pro, Master, Guru
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGSM.Entities.Enums
{
public enum Status
{
Success,
Consideration,
WorkDocumnets,
WorkWithCourt,
Bribe
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGSM.Entities.Enums
{
public enum TypeAppeal
{
Bisness, Immovables, Divorce, Inheritance
}
}

View File

@ -0,0 +1,23 @@
using ProjectGSM.Entities.Enums;
namespace ProjectGSM.Entities;
public class StatusHistory
{
public int CaseId { get; private set; }
public Status Status { get; private set; }
public decimal Price { get; private set; }
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static StatusHistory CreateEntity(int caseId, Status status, decimal price, DateTime? dateTime = null)
{
return new StatusHistory
{
CaseId = caseId,
Status = status,
Price = price,
CreatedAt = dateTime ?? DateTime.UtcNow
};
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectGSM
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace ProjectGSM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

138
ProjectGSM/FormAdvocateApp.Designer.cs generated Normal file
View File

@ -0,0 +1,138 @@
namespace ProjectGSM
{
partial class FormAdvocateApp
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem directoriesMenuItem;
private System.Windows.Forms.ToolStripMenuItem operationsMenuItem;
private System.Windows.Forms.ToolStripMenuItem reportsMenuItem; // Новый пункт "Отчеты"
private System.Windows.Forms.ToolStripMenuItem clientsMenuItem;
private System.Windows.Forms.ToolStripMenuItem advocatesMenuItem;
private System.Windows.Forms.ToolStripMenuItem casesMenuItem;
private System.Windows.Forms.ToolStripMenuItem statusHistoryRepositoryMenuItem;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip = new MenuStrip();
directoriesMenuItem = new ToolStripMenuItem();
clientsMenuItem = new ToolStripMenuItem();
advocatesMenuItem = new ToolStripMenuItem();
casesMenuItem = new ToolStripMenuItem();
courtsToolStripMenuItem = new ToolStripMenuItem();
operationsMenuItem = new ToolStripMenuItem();
statusHistoryRepositoryMenuItem = new ToolStripMenuItem();
reportsMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
// menuStrip
//
menuStrip.Items.AddRange(new ToolStripItem[] { directoriesMenuItem, operationsMenuItem, reportsMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(7, 2, 0, 2);
menuStrip.Size = new Size(933, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip";
//
// directoriesMenuItem
//
directoriesMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsMenuItem, advocatesMenuItem, courtsToolStripMenuItem });
directoriesMenuItem.Name = "directoriesMenuItem";
directoriesMenuItem.Size = new Size(94, 20);
directoriesMenuItem.Text = "Справочники";
//
// clientsMenuItem
//
clientsMenuItem.Name = "clientsMenuItem";
clientsMenuItem.Size = new Size(161, 22);
clientsMenuItem.Text = "Клиенты";
clientsMenuItem.Click += clientsMenuItem_Click_1;
//
// advocatesMenuItem
//
advocatesMenuItem.Name = "advocatesMenuItem";
advocatesMenuItem.Size = new Size(161, 22);
advocatesMenuItem.Text = "Адвокаты";
advocatesMenuItem.Click += advocatesMenuItem_Click;
//
// casesMenuItem
//
casesMenuItem.Name = "casesMenuItem";
casesMenuItem.Size = new Size(161, 22);
casesMenuItem.Text = "Дела";
casesMenuItem.Click += casesMenuItem_Click;
//
// courtsToolStripMenuItem
//
courtsToolStripMenuItem.Name = "courtsToolStripMenuItem";
courtsToolStripMenuItem.Size = new Size(161, 22);
courtsToolStripMenuItem.Text = "Суды";
courtsToolStripMenuItem.Click += courtsToolStripMenuItem_Click;
//
// operationsMenuItem
//
operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { casesMenuItem, statusHistoryRepositoryMenuItem });
operationsMenuItem.Name = "operationsMenuItem";
operationsMenuItem.Size = new Size(75, 20);
operationsMenuItem.Text = "Операции";
//
// statusHistoryRepositoryMenuItem
//
statusHistoryRepositoryMenuItem.Name = "statusHistoryRepositoryMenuItem";
statusHistoryRepositoryMenuItem.Size = new Size(221, 22);
statusHistoryRepositoryMenuItem.Text = "Хронология статусов";
statusHistoryRepositoryMenuItem.Click += statusHistoryRepositoryMenuItem_Click;
//
// reportsMenuItem
//
reportsMenuItem.Name = "reportsMenuItem";
reportsMenuItem.Size = new Size(60, 20);
reportsMenuItem.Text = "Отчеты";
//
// FormAdvocateApp
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.maxresdefault;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(933, 519);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Margin = new Padding(4, 3, 4, 3);
Name = "FormAdvocateApp";
Text = "Шарашкина контора";
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ToolStripMenuItem courtsToolStripMenuItem;
}
}

View File

@ -0,0 +1,81 @@
using ProjectGSM.Forms;
using System.ComponentModel;
using Unity;
namespace ProjectGSM
{
public partial class FormAdvocateApp : Form
{
private readonly IUnityContainer _container;
public FormAdvocateApp(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void clientsMenuItem_Click_1(object sender, EventArgs e)
{
try
{
_container.Resolve<FormClients>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void advocatesMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormAdvocates>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void casesMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCases>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void courtsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCourts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void statusHistoryRepositoryMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStatusesHistory>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

292
ProjectGSM/Forms/FormAdvocate.Designer.cs generated Normal file
View File

@ -0,0 +1,292 @@
namespace ProjectGSM.Forms
{
partial class FormAdvocate
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
nameLabel = new Label();
nameTextBox = new TextBox();
expLabel = new Label();
saveButton = new Button();
cancelButton = new Button();
sex = new Label();
sexCheckBox = new CheckBox();
DateLabel = new Label();
dateTimePicker = new DateTimePicker();
PhoneLabel = new Label();
phoneText = new TextBox();
adressLabel = new Label();
adressBox = new TextBox();
expNumeric = new NumericUpDown();
tasksLabel = new Label();
tasksNumeric = new NumericUpDown();
ratingLabel = new Label();
ratingNumeric = new NumericUpDown();
emailLabel = new Label();
emailTextBox = new TextBox();
licenseLabel = new Label();
checkedListBox = new CheckedListBox();
((System.ComponentModel.ISupportInitialize)expNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)tasksNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)ratingNumeric).BeginInit();
SuspendLayout();
//
// nameLabel
//
nameLabel.Location = new Point(14, 9);
nameLabel.Name = "nameLabel";
nameLabel.Size = new Size(134, 23);
nameLabel.TabIndex = 0;
nameLabel.Text = "Имя адвоката:";
//
// nameTextBox
//
nameTextBox.Location = new Point(148, 5);
nameTextBox.Name = "nameTextBox";
nameTextBox.Size = new Size(116, 31);
nameTextBox.TabIndex = 1;
//
// expLabel
//
expLabel.Location = new Point(10, 90);
expLabel.Name = "expLabel";
expLabel.Size = new Size(100, 23);
expLabel.TabIndex = 2;
expLabel.Text = "Опыт:";
//
// saveButton
//
saveButton.Location = new Point(122, 303);
saveButton.Name = "saveButton";
saveButton.Size = new Size(114, 35);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(255, 309);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(133, 29);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// sex
//
sex.Location = new Point(10, 38);
sex.Name = "sex";
sex.Size = new Size(100, 23);
sex.TabIndex = 0;
sex.Text = "Пол:";
//
// sexCheckBox
//
sexCheckBox.AutoSize = true;
sexCheckBox.Location = new Point(148, 32);
sexCheckBox.Name = "sexCheckBox";
sexCheckBox.Size = new Size(112, 29);
sexCheckBox.TabIndex = 6;
sexCheckBox.Text = "мужчина";
sexCheckBox.UseVisualStyleBackColor = true;
//
// DateLabel
//
DateLabel.Location = new Point(10, 61);
DateLabel.Name = "DateLabel";
DateLabel.Size = new Size(100, 23);
DateLabel.TabIndex = 7;
DateLabel.Text = "Дата рождения:";
//
// dateTimePicker
//
dateTimePicker.Location = new Point(144, 56);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(120, 31);
dateTimePicker.TabIndex = 8;
//
// PhoneLabel
//
PhoneLabel.Location = new Point(10, 217);
PhoneLabel.Name = "PhoneLabel";
PhoneLabel.Size = new Size(111, 23);
PhoneLabel.TabIndex = 9;
PhoneLabel.Text = "Номер телефона:";
//
// phoneText
//
phoneText.Location = new Point(144, 212);
phoneText.Name = "phoneText";
phoneText.Size = new Size(120, 31);
phoneText.TabIndex = 10;
//
// adressLabel
//
adressLabel.Location = new Point(12, 249);
adressLabel.Name = "adressLabel";
adressLabel.Size = new Size(111, 23);
adressLabel.TabIndex = 11;
adressLabel.Text = "Адрес:";
//
// adressBox
//
adressBox.Location = new Point(144, 241);
adressBox.Name = "adressBox";
adressBox.Size = new Size(120, 31);
adressBox.TabIndex = 12;
//
// expNumeric
//
expNumeric.Location = new Point(144, 85);
expNumeric.Name = "expNumeric";
expNumeric.Size = new Size(120, 31);
expNumeric.TabIndex = 13;
//
// tasksLabel
//
tasksLabel.Location = new Point(10, 119);
tasksLabel.Name = "tasksLabel";
tasksLabel.Size = new Size(100, 23);
tasksLabel.TabIndex = 15;
tasksLabel.Text = "Решенные дела:";
//
// tasksNumeric
//
tasksNumeric.Location = new Point(144, 114);
tasksNumeric.Name = "tasksNumeric";
tasksNumeric.Size = new Size(120, 31);
tasksNumeric.TabIndex = 16;
//
// ratingLabel
//
ratingLabel.Location = new Point(10, 154);
ratingLabel.Name = "ratingLabel";
ratingLabel.Size = new Size(100, 23);
ratingLabel.TabIndex = 17;
ratingLabel.Text = "Рейтинг:";
//
// ratingNumeric
//
ratingNumeric.Location = new Point(144, 147);
ratingNumeric.Name = "ratingNumeric";
ratingNumeric.Size = new Size(120, 31);
ratingNumeric.TabIndex = 18;
//
// emailLabel
//
emailLabel.Location = new Point(11, 184);
emailLabel.Name = "emailLabel";
emailLabel.Size = new Size(111, 23);
emailLabel.TabIndex = 19;
emailLabel.Text = "Email:";
//
// emailTextBox
//
emailTextBox.Location = new Point(144, 179);
emailTextBox.Name = "emailTextBox";
emailTextBox.Size = new Size(120, 31);
emailTextBox.TabIndex = 20;
//
// licenseLabel
//
licenseLabel.Location = new Point(298, 9);
licenseLabel.Name = "licenseLabel";
licenseLabel.Size = new Size(100, 23);
licenseLabel.TabIndex = 21;
licenseLabel.Text = "Лицензии:";
//
// checkedListBox
//
checkedListBox.FormattingEnabled = true;
checkedListBox.Location = new Point(298, 56);
checkedListBox.Name = "checkedListBox";
checkedListBox.Size = new Size(304, 228);
checkedListBox.TabIndex = 22;
//
// FormAdvocate
//
ClientSize = new Size(637, 593);
Controls.Add(checkedListBox);
Controls.Add(licenseLabel);
Controls.Add(emailTextBox);
Controls.Add(emailLabel);
Controls.Add(ratingNumeric);
Controls.Add(ratingLabel);
Controls.Add(tasksNumeric);
Controls.Add(tasksLabel);
Controls.Add(expNumeric);
Controls.Add(adressBox);
Controls.Add(adressLabel);
Controls.Add(phoneText);
Controls.Add(PhoneLabel);
Controls.Add(dateTimePicker);
Controls.Add(DateLabel);
Controls.Add(sexCheckBox);
Controls.Add(sex);
Controls.Add(nameLabel);
Controls.Add(nameTextBox);
Controls.Add(expLabel);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormAdvocate";
StartPosition = FormStartPosition.CenterScreen;
Text = "Адвокат";
((System.ComponentModel.ISupportInitialize)expNumeric).EndInit();
((System.ComponentModel.ISupportInitialize)tasksNumeric).EndInit();
((System.ComponentModel.ISupportInitialize)ratingNumeric).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label nameLabel;
private TextBox nameTextBox;
private Label expLabel;
private Button saveButton;
private Button cancelButton;
private Label sex;
private Label tasksLabel;
private CheckBox sexCheckBox;
private Label DateLabel;
private DateTimePicker dateTimePicker;
private Label PhoneLabel;
private TextBox phoneText;
private Label adressLabel;
private TextBox adressBox;
private NumericUpDown expNumeric;
private NumericUpDown tasksNumeric;
private Label ratingLabel;
private NumericUpDown ratingNumeric;
private Label emailLabel;
private TextBox emailTextBox;
private Label licenseLabel;
private CheckedListBox checkedListBox;
}
}

View File

@ -0,0 +1,123 @@
using Microsoft.VisualBasic.FileIO;
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormAdvocate : Form
{
private readonly IAdvocateRepository _advocateRepository;
private int? _advocateId;
public int Id
{
set
{
try
{
var advocate =
_advocateRepository.ReadAdvocateById(value);
if (advocate == null)
{
throw new
InvalidDataException(nameof(advocate));
}
_advocateId = value;
foreach (LicenseType elem in Enum.GetValues(typeof(LicenseType)))
{
if ((elem & advocate.LicenseType) != 0)
{
checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(
elem), true);
}
}
nameTextBox.Text = advocate.Name;
sexCheckBox.Checked= advocate.Sex;
dateTimePicker.Value = new DateTime(advocate.DateOfBirth.Year, advocate.DateOfBirth.Month, advocate.DateOfBirth.Day);
expNumeric.Value = advocate.Experience;
tasksNumeric.Value = advocate.CompletedTasks;
ratingNumeric.Value = advocate.Rating;
emailTextBox.Text = advocate.Email;
phoneText.Text = advocate.PhoneNumber;
adressBox.Text = advocate.Address;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormAdvocate(IAdvocateRepository advocateRepository)
{
InitializeComponent();
_advocateRepository = advocateRepository ??
throw new
ArgumentNullException(nameof(advocateRepository));
foreach (var elem in Enum.GetValues(typeof(LicenseType)))
{
checkedListBox.Items.Add(elem);
}
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(nameTextBox.Text) ||
string.IsNullOrWhiteSpace(emailTextBox.Text) ||
string.IsNullOrWhiteSpace(phoneText.Text) ||
string.IsNullOrWhiteSpace(adressBox.Text) || checkedListBox.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_advocateId.HasValue)
{
_advocateRepository.UpdateAdvocate(CreateAdvocate(_advocateId.Value));
}
else
{
_advocateRepository.CreateAdvocate(CreateAdvocate(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Advocate CreateAdvocate(int id)
{
LicenseType licenseType = LicenseType.None;
foreach (var elem in checkedListBox.CheckedItems)
{
licenseType |= (LicenseType)elem;
}
return Advocate.CreateEntity(id,
nameTextBox.Text,
sexCheckBox.Checked,
dateTimePicker.Value,
Convert.ToInt32(expNumeric.Value),
Convert.ToInt32(tasksNumeric.Value),
Convert.ToInt32(ratingNumeric.Value),
emailTextBox.Text,
phoneText.Text,
adressBox.Text, licenseType);
}
}
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

130
ProjectGSM/Forms/FormAdvocates.Designer.cs generated Normal file
View File

@ -0,0 +1,130 @@
namespace ProjectGSM.Forms
{
partial class FormAdvocates
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
deleteButton = new Button();
editButton = new Button();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(deleteButton);
panel1.Controls.Add(editButton);
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.TabIndex = 0;
//
// deleteButton
//
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
deleteButton.Location = new Point(33, 240);
deleteButton.Name = "deleteButton";
deleteButton.Size = new Size(75, 75);
deleteButton.TabIndex = 2;
deleteButton.Text = " ";
deleteButton.UseVisualStyleBackColor = true;
deleteButton.Click += deleteButton_Click;
//
// editButton
//
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
editButton.BackgroundImageLayout = ImageLayout.Zoom;
editButton.Location = new Point(33, 139);
editButton.Name = "editButton";
editButton.Size = new Size(75, 75);
editButton.TabIndex = 1;
editButton.Text = " ";
editButton.UseVisualStyleBackColor = true;
editButton.Click += editButton_Click;
//
// addButton
//
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
addButton.BackgroundImageLayout = ImageLayout.Zoom;
addButton.Location = new Point(33, 38);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.Info;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.TabIndex = 1;
//
// FormAdvocates
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormAdvocates";
StartPosition = FormStartPosition.CenterScreen;
Text = "Адвокаты";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button deleteButton;
private Button editButton;
private Button addButton;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,123 @@
using ProjectGSM.Repositories;
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;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormAdvocates : Form
{
private readonly IUnityContainer _container;
private readonly IAdvocateRepository _advocateRepository;
public FormAdvocates(IUnityContainer container, IAdvocateRepository advocateRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_advocateRepository = advocateRepository ??
throw new
ArgumentNullException(nameof(advocateRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_advocateRepository.DeleteAdvocate(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void editButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormAdvocate>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormAdvocate>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormClients_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource =
_advocateRepository.ReadAdvocates();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

118
ProjectGSM/Forms/FormBase.Designer.cs generated Normal file
View File

@ -0,0 +1,118 @@
namespace ProjectGSM.Forms
{
partial class FormBase
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
textBox1 = new TextBox();
label1 = new Label();
label2 = new Label();
numericUpDown1 = new NumericUpDown();
button1 = new Button();
button2 = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
SuspendLayout();
//
// textBox1
//
textBox1.Location = new Point(185, 43);
textBox1.Name = "textBox1";
textBox1.Size = new Size(120, 23);
textBox1.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(61, 51);
label1.Name = "label1";
label1.Size = new Size(38, 15);
label1.TabIndex = 1;
label1.Text = "label1";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(61, 106);
label2.Name = "label2";
label2.Size = new Size(38, 15);
label2.TabIndex = 2;
label2.Text = "label2";
//
// numericUpDown1
//
numericUpDown1.Location = new Point(185, 98);
numericUpDown1.Name = "numericUpDown1";
numericUpDown1.Size = new Size(120, 23);
numericUpDown1.TabIndex = 3;
//
// button1
//
button1.Location = new Point(85, 268);
button1.Name = "button1";
button1.Size = new Size(104, 35);
button1.TabIndex = 4;
button1.Text = "Сохранить";
button1.UseVisualStyleBackColor = true;
//
// button2
//
button2.Location = new Point(211, 268);
button2.Name = "button2";
button2.Size = new Size(104, 35);
button2.TabIndex = 5;
button2.Text = "Отмена";
button2.UseVisualStyleBackColor = true;
//
// FormBase
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(385, 336);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(numericUpDown1);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(textBox1);
Name = "FormBase";
StartPosition = FormStartPosition.CenterScreen;
Text = "Клиент";
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox1;
private Label label1;
private Label label2;
private NumericUpDown numericUpDown1;
private Button button1;
private Button button2;
}
}

View File

@ -0,0 +1,20 @@
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 ProjectGSM.Forms
{
public partial class FormBase : Form
{
public FormBase()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

315
ProjectGSM/Forms/FormCase.Designer.cs generated Normal file
View File

@ -0,0 +1,315 @@
namespace ProjectGSM.Forms
{
partial class FormCase
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
typeApealLabel = new Label();
paymentLabel = new Label();
saveButton = new Button();
cancelButton = new Button();
priceLabel = new Label();
verdictLabel = new Label();
typeApellBox = new ComboBox();
paymentCheckBox = new CheckBox();
priceNumeric = new NumericUpDown();
winPriceLabel = new Label();
winPriceNumeric = new NumericUpDown();
verdictCheckBox = new CheckBox();
courtBox = new ComboBox();
courtLabel = new Label();
clientBox = new ComboBox();
clientLabel = new Label();
descriptionLabel = new Label();
textBox1 = new TextBox();
groupBox1 = new GroupBox();
dataGridView1 = new DataGridView();
ColumnAdvocate = new DataGridViewComboBoxColumn();
ColumnPost = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)winPriceNumeric).BeginInit();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// typeApealLabel
//
typeApealLabel.Location = new Point(10, 10);
typeApealLabel.Name = "typeApealLabel";
typeApealLabel.Size = new Size(100, 23);
typeApealLabel.TabIndex = 0;
typeApealLabel.Text = "Тип обращения:";
//
// paymentLabel
//
paymentLabel.Location = new Point(10, 50);
paymentLabel.Name = "paymentLabel";
paymentLabel.Size = new Size(100, 23);
paymentLabel.TabIndex = 2;
paymentLabel.Text = "Оплачено:";
//
// saveButton
//
saveButton.Location = new Point(116, 531);
saveButton.Name = "saveButton";
saveButton.Size = new Size(128, 39);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(283, 531);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(126, 39);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// priceLabel
//
priceLabel.Location = new Point(10, 89);
priceLabel.Name = "priceLabel";
priceLabel.Size = new Size(100, 23);
priceLabel.TabIndex = 0;
priceLabel.Text = "Цена:";
//
// verdictLabel
//
verdictLabel.Location = new Point(10, 176);
verdictLabel.Name = "verdictLabel";
verdictLabel.Size = new Size(111, 23);
verdictLabel.TabIndex = 11;
verdictLabel.Text = "Вердикт:";
//
// typeApellBox
//
typeApellBox.DropDownStyle = ComboBoxStyle.DropDownList;
typeApellBox.FormattingEnabled = true;
typeApellBox.Location = new Point(116, 10);
typeApellBox.Name = "typeApellBox";
typeApellBox.Size = new Size(121, 33);
typeApellBox.TabIndex = 13;
//
// paymentCheckBox
//
paymentCheckBox.AutoSize = true;
paymentCheckBox.Location = new Point(120, 49);
paymentCheckBox.Name = "paymentCheckBox";
paymentCheckBox.Size = new Size(109, 29);
paymentCheckBox.TabIndex = 14;
paymentCheckBox.Text = "успешно";
paymentCheckBox.UseVisualStyleBackColor = true;
//
// priceNumeric
//
priceNumeric.DecimalPlaces = 2;
priceNumeric.Location = new Point(117, 87);
priceNumeric.Name = "priceNumeric";
priceNumeric.Size = new Size(120, 31);
priceNumeric.TabIndex = 15;
//
// winPriceLabel
//
winPriceLabel.Location = new Point(10, 122);
winPriceLabel.Name = "winPriceLabel";
winPriceLabel.Size = new Size(100, 23);
winPriceLabel.TabIndex = 16;
winPriceLabel.Text = "Победная цена:";
//
// winPriceNumeric
//
winPriceNumeric.DecimalPlaces = 2;
winPriceNumeric.Location = new Point(117, 122);
winPriceNumeric.Name = "winPriceNumeric";
winPriceNumeric.Size = new Size(120, 31);
winPriceNumeric.TabIndex = 17;
//
// verdictCheckBox
//
verdictCheckBox.AutoSize = true;
verdictCheckBox.Location = new Point(116, 176);
verdictCheckBox.Name = "verdictCheckBox";
verdictCheckBox.Size = new Size(109, 29);
verdictCheckBox.TabIndex = 19;
verdictCheckBox.Text = "успешно";
verdictCheckBox.UseVisualStyleBackColor = true;
//
// courtBox
//
courtBox.DropDownStyle = ComboBoxStyle.DropDownList;
courtBox.FormattingEnabled = true;
courtBox.Location = new Point(116, 212);
courtBox.Name = "courtBox";
courtBox.Size = new Size(121, 33);
courtBox.TabIndex = 21;
//
// courtLabel
//
courtLabel.Location = new Point(12, 215);
courtLabel.Name = "courtLabel";
courtLabel.Size = new Size(100, 23);
courtLabel.TabIndex = 20;
courtLabel.Text = "Суд:";
//
// clientBox
//
clientBox.DropDownStyle = ComboBoxStyle.DropDownList;
clientBox.FormattingEnabled = true;
clientBox.Location = new Point(116, 262);
clientBox.Name = "clientBox";
clientBox.Size = new Size(121, 33);
clientBox.TabIndex = 23;
//
// clientLabel
//
clientLabel.Location = new Point(10, 262);
clientLabel.Name = "clientLabel";
clientLabel.Size = new Size(100, 23);
clientLabel.TabIndex = 22;
clientLabel.Text = "Клиент:";
//
// descriptionLabel
//
descriptionLabel.Location = new Point(10, 296);
descriptionLabel.Name = "descriptionLabel";
descriptionLabel.Size = new Size(100, 23);
descriptionLabel.TabIndex = 24;
descriptionLabel.Text = "Описание:";
//
// textBox1
//
textBox1.Location = new Point(118, 296);
textBox1.Multiline = true;
textBox1.Name = "textBox1";
textBox1.Size = new Size(154, 73);
textBox1.TabIndex = 25;
//
// groupBox1
//
groupBox1.Controls.Add(dataGridView1);
groupBox1.Location = new Point(327, 30);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(477, 339);
groupBox1.TabIndex = 26;
groupBox1.TabStop = false;
groupBox1.Text = "Прикрепленные адвокаты";
//
// dataGridView1
//
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.ActiveCaption;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnAdvocate, ColumnPost });
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(3, 27);
dataGridView1.Name = "dataGridView1";
dataGridView1.RowHeadersWidth = 62;
dataGridView1.Size = new Size(471, 309);
dataGridView1.TabIndex = 0;
//
// ColumnAdvocate
//
ColumnAdvocate.HeaderText = "Адвокаты";
ColumnAdvocate.MinimumWidth = 8;
ColumnAdvocate.Name = "ColumnAdvocate";
//
// ColumnPost
//
ColumnPost.HeaderText = "Должности";
ColumnPost.MinimumWidth = 8;
ColumnPost.Name = "ColumnPost";
//
// FormCase
//
ClientSize = new Size(845, 582);
Controls.Add(groupBox1);
Controls.Add(textBox1);
Controls.Add(descriptionLabel);
Controls.Add(clientBox);
Controls.Add(clientLabel);
Controls.Add(courtBox);
Controls.Add(courtLabel);
Controls.Add(verdictCheckBox);
Controls.Add(winPriceNumeric);
Controls.Add(winPriceLabel);
Controls.Add(priceNumeric);
Controls.Add(paymentCheckBox);
Controls.Add(typeApellBox);
Controls.Add(verdictLabel);
Controls.Add(priceLabel);
Controls.Add(typeApealLabel);
Controls.Add(paymentLabel);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormCase";
StartPosition = FormStartPosition.CenterScreen;
Text = "Дело";
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
((System.ComponentModel.ISupportInitialize)winPriceNumeric).EndInit();
groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label typeApealLabel;
private Label paymentLabel;
private TextBox emailTextBox;
private Button saveButton;
private Button cancelButton;
private Label priceLabel;
private Label label2;
private CheckBox sexCheckBox;
private Label DateLabel;
private DateTimePicker dateTimePicker;
private TextBox phoneText;
private Label verdictLabel;
private ComboBox typeApellBox;
private CheckBox paymentCheckBox;
private NumericUpDown priceNumeric;
private Label winPriceLabel;
private NumericUpDown winPriceNumeric;
private CheckBox verdictCheckBox;
private ComboBox courtBox;
private Label courtLabel;
private ComboBox clientBox;
private Label clientLabel;
private Label descriptionLabel;
private TextBox textBox1;
private GroupBox groupBox1;
private DataGridView dataGridView1;
private DataGridViewComboBoxColumn ColumnAdvocate;
private DataGridViewTextBoxColumn ColumnPost;
}
}

View File

@ -0,0 +1,89 @@
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormCase : Form
{
private readonly ICaseRepository _caseRepository;
public FormCase(ICaseRepository caseRepository,IClientRepository clientRepository, ICourtRepository courtRepository, IAdvocateRepository advocateRepository)
{
InitializeComponent();
_caseRepository = caseRepository ??
throw new
ArgumentNullException(nameof(caseRepository));
typeApellBox.DataSource = Enum.GetValues(typeof(TypeAppeal));
ColumnAdvocate.DataSource = advocateRepository.ReadAdvocates();
ColumnAdvocate.DisplayMember = "Name";
ColumnAdvocate.ValueMember = "Id";
clientBox.DataSource = clientRepository.ReadClients();
clientBox.DisplayMember = "Name";
clientBox.ValueMember = "Id";
courtBox.DataSource = courtRepository.ReadCourts();
courtBox.DisplayMember = "Name";
courtBox.ValueMember = "Id";
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{if(dataGridView1.RowCount < 1 || typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0
)
{
throw new Exception("Имеются незаполненные поля");
}
Case caseE = CreateCase(0);
caseE.Advocates = CreateListCaseAdvocateFromDataGrid();
_caseRepository.CreateCase(caseE);
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private List<CaseAdvocate> CreateListCaseAdvocateFromDataGrid()
{
var list = new List<CaseAdvocate>();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["ColumnAdvocate"].Value == null ||
row.Cells["ColumnPost"].Value == null)
{
continue;
}
list.Add(CaseAdvocate.CreateEntity(0,
Convert.ToInt32(row.Cells["ColumnAdvocate"].Value),
row.Cells["ColumnPost"].Value.ToString()??string.Empty));
}
return list;
}
private Case CreateCase(int id) => Case.CreateEntity(id,
(TypeAppeal)typeApellBox.SelectedItem!,
paymentCheckBox.Checked,
priceNumeric.Value,
winPriceNumeric.Value,
verdictCheckBox.Checked,
((Court)courtBox.SelectedItem).Id,
((Client)clientBox.SelectedItem).Id,
textBox1.Text);
}
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnAdvocate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnPost.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

115
ProjectGSM/Forms/FormCases.Designer.cs generated Normal file
View File

@ -0,0 +1,115 @@
namespace ProjectGSM.Forms
{
partial class FormCases
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
deleteButton = new Button();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(deleteButton);
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.TabIndex = 0;
//
// deleteButton
//
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
deleteButton.BackgroundImageLayout = ImageLayout.Stretch;
deleteButton.Location = new Point(33, 137);
deleteButton.Margin = new Padding(2, 2, 2, 2);
deleteButton.Name = "deleteButton";
deleteButton.Size = new Size(75, 72);
deleteButton.TabIndex = 0;
deleteButton.Click += deleteButton_Click;
//
// addButton
//
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
addButton.BackgroundImageLayout = ImageLayout.Zoom;
addButton.Location = new Point(33, 38);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.Info;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.TabIndex = 1;
//
// FormCases
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormCases";
StartPosition = FormStartPosition.CenterScreen;
Text = "Дела";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button deleteButton;
private Button addButton;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,102 @@
using ProjectGSM.Repositories;
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;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormCases : Form
{
private readonly IUnityContainer _container;
private readonly ICaseRepository _caseRepository;
public FormCases(IUnityContainer container, ICaseRepository caseRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_caseRepository = caseRepository ??
throw new
ArgumentNullException(nameof(caseRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_caseRepository.DeleteCase(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCase>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormClients_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource =
_caseRepository.ReadCases();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

202
ProjectGSM/Forms/FormClient.Designer.cs generated Normal file
View File

@ -0,0 +1,202 @@
namespace ProjectGSM.Forms
{
partial class FormClient
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
nameLabel = new Label();
nameTextBox = new TextBox();
emailLabel = new Label();
emailTextBox = new TextBox();
saveButton = new Button();
cancelButton = new Button();
sex = new Label();
sexCheckBox = new CheckBox();
DateLabel = new Label();
dateTimePicker = new DateTimePicker();
PhoneLabel = new Label();
phoneText = new TextBox();
adressLabel = new Label();
adressBox = new TextBox();
SuspendLayout();
//
// nameLabel
//
nameLabel.Location = new Point(10, 10);
nameLabel.Name = "nameLabel";
nameLabel.Size = new Size(100, 23);
nameLabel.TabIndex = 0;
nameLabel.Text = "Имя клиента:";
//
// nameTextBox
//
nameTextBox.Location = new Point(120, 10);
nameTextBox.Name = "nameTextBox";
nameTextBox.Size = new Size(108, 23);
nameTextBox.TabIndex = 1;
//
// emailLabel
//
emailLabel.Location = new Point(10, 50);
emailLabel.Name = "emailLabel";
emailLabel.Size = new Size(100, 23);
emailLabel.TabIndex = 2;
emailLabel.Text = "Email:";
//
// emailTextBox
//
emailTextBox.Location = new Point(120, 50);
emailTextBox.Name = "emailTextBox";
emailTextBox.Size = new Size(108, 23);
emailTextBox.TabIndex = 3;
//
// saveButton
//
saveButton.Location = new Point(117, 226);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 226);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// sex
//
sex.Location = new Point(10, 89);
sex.Name = "sex";
sex.Size = new Size(100, 23);
sex.TabIndex = 0;
sex.Text = "Пол:";
//
// sexCheckBox
//
sexCheckBox.AutoSize = true;
sexCheckBox.Location = new Point(120, 88);
sexCheckBox.Name = "sexCheckBox";
sexCheckBox.Size = new Size(77, 19);
sexCheckBox.TabIndex = 6;
sexCheckBox.Text = "мужчина";
sexCheckBox.UseVisualStyleBackColor = true;
//
// DateLabel
//
DateLabel.Location = new Point(10, 121);
DateLabel.Name = "DateLabel";
DateLabel.Size = new Size(100, 23);
DateLabel.TabIndex = 7;
DateLabel.Text = "Дата рождения:";
//
// dateTimePicker
//
dateTimePicker.Location = new Point(116, 115);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(112, 23);
dateTimePicker.TabIndex = 8;
//
// PhoneLabel
//
PhoneLabel.Location = new Point(10, 157);
PhoneLabel.Name = "PhoneLabel";
PhoneLabel.Size = new Size(111, 23);
PhoneLabel.TabIndex = 9;
PhoneLabel.Text = "Номер телефона:";
//
// phoneText
//
phoneText.Location = new Point(120, 155);
phoneText.Name = "phoneText";
phoneText.Size = new Size(108, 23);
phoneText.TabIndex = 10;
//
// adressLabel
//
adressLabel.Location = new Point(10, 191);
adressLabel.Name = "adressLabel";
adressLabel.Size = new Size(111, 23);
adressLabel.TabIndex = 11;
adressLabel.Text = "Адрес:";
//
// adressBox
//
adressBox.Location = new Point(120, 191);
adressBox.Name = "adressBox";
adressBox.Size = new Size(108, 23);
adressBox.TabIndex = 12;
//
// FormClient
//
ClientSize = new Size(284, 261);
Controls.Add(adressBox);
Controls.Add(adressLabel);
Controls.Add(phoneText);
Controls.Add(PhoneLabel);
Controls.Add(dateTimePicker);
Controls.Add(DateLabel);
Controls.Add(sexCheckBox);
Controls.Add(sex);
Controls.Add(nameLabel);
Controls.Add(nameTextBox);
Controls.Add(emailLabel);
Controls.Add(emailTextBox);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormClient";
StartPosition = FormStartPosition.CenterScreen;
Text = "Клиент";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label nameLabel;
private TextBox nameTextBox;
private Label emailLabel;
private TextBox emailTextBox;
private Button saveButton;
private Button cancelButton;
private Label sex;
private Label label2;
private CheckBox sexCheckBox;
private Label DateLabel;
private DateTimePicker dateTimePicker;
private Label PhoneLabel;
private TextBox phoneText;
private Label adressLabel;
private TextBox adressBox;
}
}

View File

@ -0,0 +1,98 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
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 ProjectGSM.Forms
{
public partial class FormClient : Form
{
private readonly IClientRepository _clientRepository;
private int? _clientId;
public int Id
{
set
{
try
{
var client =
_clientRepository.ReadClientById(value);
if (client == null)
{
throw new
InvalidDataException(nameof(client));
}
_clientId = value;
nameTextBox.Text = client.Name;
emailTextBox.Text = client.Email;
sexCheckBox.Checked = client.Sex;
dateTimePicker.Value = client.DateOfBirth;
phoneText.Text = client.PhoneNumber;
adressBox.Text = client.Address;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, $"Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormClient(IClientRepository clientRepository)
{
InitializeComponent();
_clientRepository = clientRepository ??
throw new
ArgumentNullException(nameof(clientRepository));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(emailTextBox.Text) || string.IsNullOrWhiteSpace(phoneText.Text) || string.IsNullOrWhiteSpace(adressBox.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_clientId.HasValue)
{
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
}
else
{
_clientRepository.CreateClient(CreateClient(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, $"Ошибка при сохранении {_clientId}",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Client CreateClient(int id) => Client.CreateEntity(id,
nameTextBox.Text,
sexCheckBox.Checked,
dateTimePicker.Value,
emailTextBox.Text,
phoneText.Text,
adressBox.Text);
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

130
ProjectGSM/Forms/FormClients.Designer.cs generated Normal file
View File

@ -0,0 +1,130 @@
namespace ProjectGSM.Forms
{
partial class FormClients
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
deleteButton = new Button();
editButton = new Button();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(deleteButton);
panel1.Controls.Add(editButton);
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.TabIndex = 0;
//
// deleteButton
//
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
deleteButton.Location = new Point(33, 240);
deleteButton.Name = "deleteButton";
deleteButton.Size = new Size(75, 75);
deleteButton.TabIndex = 2;
deleteButton.Text = " ";
deleteButton.UseVisualStyleBackColor = true;
deleteButton.Click += deleteButton_Click;
//
// editButton
//
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
editButton.BackgroundImageLayout = ImageLayout.Zoom;
editButton.Location = new Point(33, 139);
editButton.Name = "editButton";
editButton.Size = new Size(75, 75);
editButton.TabIndex = 1;
editButton.Text = " ";
editButton.UseVisualStyleBackColor = true;
editButton.Click += editButton_Click;
//
// addButton
//
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
addButton.BackgroundImageLayout = ImageLayout.Zoom;
addButton.Location = new Point(33, 38);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.Info;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.TabIndex = 1;
//
// FormClients
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormClients";
StartPosition = FormStartPosition.CenterScreen;
Text = "Клиенты";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button deleteButton;
private Button editButton;
private Button addButton;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,123 @@
using ProjectGSM.Repositories;
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;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormClients : Form
{
private readonly IUnityContainer _container;
private readonly IClientRepository _clientRepository;
public FormClients(IUnityContainer container, IClientRepository clientRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_clientRepository = clientRepository ??
throw new
ArgumentNullException(nameof(clientRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_clientRepository.DeleteClient(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void editButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormClient>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormClient>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormClients_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource =
_clientRepository.ReadClients();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

113
ProjectGSM/Forms/FormCourt.Designer.cs generated Normal file
View File

@ -0,0 +1,113 @@
namespace ProjectGSM.Forms
{
partial class FormCourt
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
nameLabel = new Label();
nameTextBox = new TextBox();
saveButton = new Button();
cancelButton = new Button();
adressLabel = new Label();
adressBox = new TextBox();
SuspendLayout();
//
// nameLabel
//
nameLabel.Location = new Point(10, 10);
nameLabel.Name = "nameLabel";
nameLabel.Size = new Size(100, 23);
nameLabel.TabIndex = 0;
nameLabel.Text = "Название:";
//
// nameTextBox
//
nameTextBox.Location = new Point(116, 10);
nameTextBox.Name = "nameTextBox";
nameTextBox.Size = new Size(120, 23);
nameTextBox.TabIndex = 1;
//
// saveButton
//
saveButton.Location = new Point(116, 101);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 101);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// adressLabel
//
adressLabel.Location = new Point(10, 50);
adressLabel.Name = "adressLabel";
adressLabel.Size = new Size(111, 23);
adressLabel.TabIndex = 11;
adressLabel.Text = "Адрес:";
//
// adressBox
//
adressBox.Location = new Point(116, 47);
adressBox.Name = "adressBox";
adressBox.Size = new Size(120, 23);
adressBox.TabIndex = 12;
//
// FormCourt
//
ClientSize = new Size(284, 134);
Controls.Add(adressBox);
Controls.Add(adressLabel);
Controls.Add(nameLabel);
Controls.Add(nameTextBox);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormCourt";
StartPosition = FormStartPosition.CenterScreen;
Text = "Суд";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label nameLabel;
private TextBox nameTextBox;
private Button saveButton;
private Button cancelButton;
private Label adressLabel;
private TextBox adressBox;
}
}

View File

@ -0,0 +1,81 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormCourt : Form
{
private readonly ICourtRepository _courtRepository;
private int? _courtId;
public int Id
{
set
{
try
{
var court =
_courtRepository.ReadCourtById(value);
if (court == null)
{
throw new
InvalidDataException(nameof(court));
}
_courtId = value;
nameTextBox.Text = court.Name;
adressBox.Text = court.Address;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormCourt(ICourtRepository courtRepository)
{
InitializeComponent();
_courtRepository = courtRepository ??
throw new
ArgumentNullException(nameof(courtRepository));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(adressBox.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_courtId.HasValue)
{
_courtRepository.UpdateCourt(CreateCourt(_courtId.Value));
}
else
{
_courtRepository.CreateCourt(CreateCourt(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Court CreateCourt(int id) => Court.CreateEntity(id,
nameTextBox.Text,
adressBox.Text);
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

130
ProjectGSM/Forms/FormCourts.Designer.cs generated Normal file
View File

@ -0,0 +1,130 @@
namespace ProjectGSM.Forms
{
partial class FormCourts
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
deleteButton = new Button();
editButton = new Button();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(deleteButton);
panel1.Controls.Add(editButton);
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.TabIndex = 0;
//
// deleteButton
//
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
deleteButton.Location = new Point(33, 240);
deleteButton.Name = "deleteButton";
deleteButton.Size = new Size(75, 75);
deleteButton.TabIndex = 2;
deleteButton.Text = " ";
deleteButton.UseVisualStyleBackColor = true;
deleteButton.Click += deleteButton_Click;
//
// editButton
//
editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com;
editButton.BackgroundImageLayout = ImageLayout.Zoom;
editButton.Location = new Point(33, 139);
editButton.Name = "editButton";
editButton.Size = new Size(75, 75);
editButton.TabIndex = 1;
editButton.Text = " ";
editButton.UseVisualStyleBackColor = true;
editButton.Click += editButton_Click;
//
// addButton
//
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
addButton.BackgroundImageLayout = ImageLayout.Zoom;
addButton.Location = new Point(33, 38);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.Info;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.TabIndex = 1;
//
// FormCourts
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormCourts";
StartPosition = FormStartPosition.CenterScreen;
Text = "Суды";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button deleteButton;
private Button editButton;
private Button addButton;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,123 @@
using ProjectGSM.Repositories;
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;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormCourts : Form
{
private readonly IUnityContainer _container;
private readonly ICourtRepository _courtRepository;
public FormCourts(IUnityContainer container, ICourtRepository courtRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_courtRepository = courtRepository ??
throw new
ArgumentNullException(nameof(courtRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_courtRepository.DeleteCourt(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void editButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormCourt>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCourt>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormClients_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource =
_courtRepository.ReadCourts();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,161 @@
namespace ProjectGSM.Forms
{
partial class FormStatusHistory
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
statusLabel = new Label();
saveButton = new Button();
cancelButton = new Button();
dateLabel = new Label();
dateTimePicker1 = new DateTimePicker();
caseLabel = new Label();
statusBox = new ComboBox();
caseBox = new ComboBox();
priceLabel = new Label();
priceNumeric = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
SuspendLayout();
//
// statusLabel
//
statusLabel.Location = new Point(10, 47);
statusLabel.Name = "statusLabel";
statusLabel.Size = new Size(100, 23);
statusLabel.TabIndex = 0;
statusLabel.Text = "Статус:";
//
// saveButton
//
saveButton.Location = new Point(116, 173);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 38);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 173);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 38);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// dateLabel
//
dateLabel.Location = new Point(10, 137);
dateLabel.Name = "dateLabel";
dateLabel.Size = new Size(111, 23);
dateLabel.TabIndex = 13;
dateLabel.Text = "Дата:";
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(125, 137);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(120, 31);
dateTimePicker1.TabIndex = 14;
//
// caseLabel
//
caseLabel.Location = new Point(10, 7);
caseLabel.Name = "caseLabel";
caseLabel.Size = new Size(100, 23);
caseLabel.TabIndex = 15;
caseLabel.Text = "Дело:";
//
// statusBox
//
statusBox.DropDownStyle = ComboBoxStyle.DropDownList;
statusBox.FormattingEnabled = true;
statusBox.Location = new Point(125, 47);
statusBox.Name = "statusBox";
statusBox.Size = new Size(178, 33);
statusBox.TabIndex = 16;
//
// caseBox
//
caseBox.DropDownStyle = ComboBoxStyle.DropDownList;
caseBox.FormattingEnabled = true;
caseBox.Location = new Point(125, 7);
caseBox.Name = "caseBox";
caseBox.Size = new Size(121, 33);
caseBox.TabIndex = 17;
//
// priceLabel
//
priceLabel.Location = new Point(10, 98);
priceLabel.Name = "priceLabel";
priceLabel.Size = new Size(100, 23);
priceLabel.TabIndex = 18;
priceLabel.Text = "Цена:";
//
// priceNumeric
//
priceNumeric.DecimalPlaces = 2;
priceNumeric.Location = new Point(123, 99);
priceNumeric.Name = "priceNumeric";
priceNumeric.Size = new Size(180, 31);
priceNumeric.TabIndex = 19;
//
// FormStatusHistory
//
ClientSize = new Size(374, 324);
Controls.Add(priceNumeric);
Controls.Add(priceLabel);
Controls.Add(caseBox);
Controls.Add(statusBox);
Controls.Add(caseLabel);
Controls.Add(dateTimePicker1);
Controls.Add(dateLabel);
Controls.Add(statusLabel);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormStatusHistory";
StartPosition = FormStartPosition.CenterScreen;
Text = "Хронология статусов";
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
ResumeLayout(false);
}
#endregion
private Label statusLabel;
private Button saveButton;
private Button cancelButton;
private Label dateLabel;
private DateTimePicker dateTimePicker1;
private Label caseLabel;
private ComboBox statusBox;
private ComboBox caseBox;
private Label priceLabel;
private NumericUpDown priceNumeric;
}
}

View File

@ -0,0 +1,52 @@
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormStatusHistory : Form
{
private readonly IStatusHistoryRepository _statusHistoryRepository;
public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository, ICaseRepository caseRepository)
{
InitializeComponent();
_statusHistoryRepository = statusHistoryRepository ??
throw new
ArgumentNullException(nameof(statusHistoryRepository));
try
{
caseBox.DataSource = caseRepository.ReadCases();
caseBox.DisplayMember = "Description";
caseBox.SelectedIndex = 0;
}
catch (Exception ex) { }
statusBox.DataSource = Enum.GetValues(typeof(Status));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (caseBox.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity((((Case)caseBox.SelectedItem!)!).Id, (Status)statusBox.SelectedIndex!, priceNumeric.Value, dateTimePicker1.Value));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,100 @@
namespace ProjectGSM.Forms
{
partial class FormStatusesHistory
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.TabIndex = 0;
//
// addButton
//
addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com;
addButton.BackgroundImageLayout = ImageLayout.Zoom;
addButton.Location = new Point(33, 38);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.Info;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.TabIndex = 1;
//
// FormStatusesHistory
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormStatusesHistory";
StartPosition = FormStartPosition.CenterScreen;
Text = "Суды";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button addButton;
private DataGridView dataGridView1;
}
}

View File

@ -0,0 +1,68 @@
using ProjectGSM.Repositories;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormStatusesHistory : Form
{
private readonly IUnityContainer _container;
private readonly IStatusHistoryRepository _statusHistoryRepository;
public FormStatusesHistory(IUnityContainer container, IStatusHistoryRepository statusHistoryRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_statusHistoryRepository = statusHistoryRepository ??
throw new
ArgumentNullException(nameof(statusHistoryRepository));
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStatusHistory>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormClients_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource =
_statusHistoryRepository.ReadStatusHistories();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,3 +1,9 @@
using ProjectGSM.Forms;
using ProjectGSM.Repositories;
using ProjectGSM.Repositories.Implementations;
using Unity;
using Unity.Lifetime;
namespace ProjectGSM
{
internal static class Program
@ -11,7 +17,18 @@ namespace ProjectGSM
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run((CreateContainer().Resolve<FormAdvocateApp>()));
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<ICaseAdvocateRepository, CaseAdvocateRepository>(new TransientLifetimeManager());
container.RegisterType<ICaseRepository, CaseRepository>(new TransientLifetimeManager());
container.RegisterType<IClientRepository, ClientRepository>(new TransientLifetimeManager());
container.RegisterType<ICourtRepository, CourtRepository>(new TransientLifetimeManager());
container.RegisterType<IStatusHistoryRepository, StatusHistoryRepository>(new TransientLifetimeManager());
return container;
}
}
}

View File

@ -8,4 +8,59 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="Forms\FormCase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormCases.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatusesHistory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatusHistory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormCourts.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormCourt.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormAdvocate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormClient.cs" />
<Compile Update="Forms\FormAdvocates.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Npgsql" Version="9.0.0" />
<PackageReference Include="Serilog" Version="4.2.0-dev-02328" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10410" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
<PackageReference Include="Unity" Version="5.11.10" />
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
</ItemGroup>
</Project>

25
ProjectGSM/ProjectGSM.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35208.52
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectGSM", "ProjectGSM.csproj", "{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B07CD6F-951C-4BAB-9EE5-BA47030F0A9C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7F60A3F6-8280-4D35-8CD7-39ECA1D7A494}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectGSM.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectGSM.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap circle_plus_svgrepo_com {
get {
object obj = ResourceManager.GetObject("circle-plus-svgrepo-com", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap circle_x_svgrepo_com {
get {
object obj = ResourceManager.GetObject("circle-x-svgrepo-com", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap maxresdefault {
get {
object obj = ResourceManager.GetObject("maxresdefault", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap pencil_svgrepo_com {
get {
object obj = ResourceManager.GetObject("pencil-svgrepo-com", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pencil-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="maxresdefault" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\maxresdefault.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="circle-plus-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\circle-plus-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="circle-x-svgrepo-com" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\circle-x-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface IAdvocateRepository
{
IEnumerable<Advocate> ReadAdvocates();
Advocate ReadAdvocateById(int id);
void CreateAdvocate(Advocate advocate);
void UpdateAdvocate(Advocate advocate);
void DeleteAdvocate(int id);
}

View File

@ -0,0 +1,11 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface ICaseRepository
{
IEnumerable<Case> ReadCases();
Case ReadCaseById(int id);
void CreateCase(Case caseEntity);
void DeleteCase(int id);
}

View File

@ -0,0 +1,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface IClientRepository
{
IEnumerable<Client> ReadClients();
Client ReadClientById(int id);
void CreateClient(Client client);
void UpdateClient(Client client);
void DeleteClient(int id);
}

View File

@ -0,0 +1,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface ICourtRepository
{
IEnumerable<Court> ReadCourts();
Court ReadCourtById(int id);
void CreateCourt(Court court);
void UpdateCourt(Court court);
void DeleteCourt(int id);
}

View File

@ -0,0 +1,11 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface IStatusHistoryRepository
{
IEnumerable<StatusHistory> ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null,
int? caseId = null, int? statusId = null);
void CreateStatusHistory(StatusHistory statusHistory);
void DeleteStatusHistory(int statusId, int caseId);
}

View File

@ -0,0 +1,29 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class AdvocateRepository : IAdvocateRepository
{
public IEnumerable<Advocate> ReadAdvocates()
{
return [];
}
public Advocate ReadAdvocateById(int id)
{
return Advocate.CreateEntity(0, String.Empty, false, DateTime.UtcNow, 0, 0, 0, String.Empty, String.Empty,
String.Empty, Entities.Enums.LicenseType.None);
}
public void CreateAdvocate(Advocate advocate)
{
}
public void UpdateAdvocate(Advocate advocate)
{
}
public void DeleteAdvocate(int id)
{
}
}

View File

@ -0,0 +1,28 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class CaseRepository : ICaseRepository
{
public IEnumerable<Case> ReadCases()
{
return [];
}
public Case ReadCaseById(int id)
{
return Case.CreateEntity(0, 0, false, 0, 0, false, 0, 0, String.Empty);
}
public void CreateCase(Case caseEntity)
{
}
public void UpdateCase(Case caseEntity)
{
}
public void DeleteCase(int id)
{
}
}

View File

@ -0,0 +1,21 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class ClientRepository : IClientRepository
{
public IEnumerable<Client> ReadClients()
{
return [];}
public Client ReadClientById(int id)
{
return Client.CreateEntity(0, String.Empty, false, DateTime.UtcNow, String.Empty, String.Empty, String.Empty);
}
public void CreateClient(Client client) { }
public void UpdateClient(Client client) { }
public void DeleteClient(int id) { }
}

View File

@ -0,0 +1,28 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class CourtRepository : ICourtRepository
{
public IEnumerable<Court> ReadCourts()
{
return [];
}
public Court ReadCourtById(int id)
{
return Court.CreateEntity(0, String.Empty, String.Empty);
}
public void CreateCourt(Court court)
{
}
public void UpdateCourt(Court court)
{
}
public void DeleteCourt(int id)
{
}
}

View File

@ -0,0 +1,20 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class StatusHistoryRepository : IStatusHistoryRepository
{
public IEnumerable<StatusHistory> ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null,
int? caseId = null, int? statusId = null)
{
return [];
}
public void CreateStatusHistory(StatusHistory statusHistory)
{
}
public void DeleteStatusHistory(int statusId, int caseId)
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB