lab1 ready

This commit is contained in:
Maxim 2024-11-05 03:59:13 +04:00
parent 89f298ab20
commit b0b03748bb
92 changed files with 7208 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,45 @@
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 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)
{
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,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,46 @@
namespace ProjectGSM.Entities;
public class Case
{
public int Id { get; private set; }
public int TypeAppealId { get; private set; }
public bool Payment { get; private set; } = false;
public decimal Price { get; private set; }
public decimal VictoryPrice { get; private set; }
public int StatusId { 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;
// Конструктор для создания сущности
public static Case CreateEntity(
int id,
int typeAppealId,
bool payment,
decimal price,
decimal victoryPrice,
int statusId,
bool verdict,
int courtId,
int clientId,
string description
)
{
return new Case
{
Id = id,
TypeAppealId = typeAppealId,
Payment = payment,
Price = price,
VictoryPrice = victoryPrice,
StatusId = statusId,
Verdict = verdict,
CourtId = courtId,
ClientId = clientId,
Description = description ?? string.Empty,
CreatedAt = DateTime.UtcNow
};
}
}

View File

@ -0,0 +1,19 @@
namespace ProjectGSM.Entities;
public class CaseAdvocate
{
public int CaseId { get; private set; }
public int AdvocateId { get; private set; }
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static CaseAdvocate CreateEntity(int caseId, int advocateId)
{
return new CaseAdvocate
{
CaseId = caseId,
AdvocateId = advocateId,
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,21 @@
namespace ProjectGSM.Entities;
public class Status
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
public decimal? Price { get; private set; }
// Конструктор для создания сущности
public static Status CreateEntity(int id, string name, decimal? price = null, DateTime? dateTime = null)
{
return new Status
{
Id = id,
Name = name ?? string.Empty,
Price = price,
CreatedAt = dateTime ?? DateTime.UtcNow
};
}
}

View File

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

View File

@ -0,0 +1,19 @@
namespace ProjectGSM.Entities;
public class TypeAppeal
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static TypeAppeal CreateEntity(int id, string name)
{
return new TypeAppeal
{
Id = id,
Name = name ?? string.Empty,
CreatedAt = 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();
}
}
}

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

@ -0,0 +1,156 @@
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 caseAdvocateRepositoryMenuItem;
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();
typeAppealsToolStripMenuItem = new ToolStripMenuItem();
courtsToolStripMenuItem = new ToolStripMenuItem();
operationsMenuItem = new ToolStripMenuItem();
caseAdvocateRepositoryMenuItem = 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, casesMenuItem, typeAppealsToolStripMenuItem, 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;
//
// typeAppealsToolStripMenuItem
//
typeAppealsToolStripMenuItem.Name = "typeAppealsToolStripMenuItem";
typeAppealsToolStripMenuItem.Size = new Size(161, 22);
typeAppealsToolStripMenuItem.Text = "Тип обращения";
typeAppealsToolStripMenuItem.Click += typeAppealsToolStripMenuItem_Click;
//
// courtsToolStripMenuItem
//
courtsToolStripMenuItem.Name = "courtsToolStripMenuItem";
courtsToolStripMenuItem.Size = new Size(161, 22);
courtsToolStripMenuItem.Text = "Суды";
courtsToolStripMenuItem.Click += courtsToolStripMenuItem_Click;
//
// operationsMenuItem
//
operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { caseAdvocateRepositoryMenuItem, statusHistoryRepositoryMenuItem });
operationsMenuItem.Name = "operationsMenuItem";
operationsMenuItem.Size = new Size(75, 20);
operationsMenuItem.Text = "Операции";
//
// caseAdvocateRepositoryMenuItem
//
caseAdvocateRepositoryMenuItem.Name = "caseAdvocateRepositoryMenuItem";
caseAdvocateRepositoryMenuItem.Size = new Size(221, 22);
caseAdvocateRepositoryMenuItem.Text = "Привязка адвокатов к делу";
caseAdvocateRepositoryMenuItem.Click += caseAdvocateRepositoryMenuItem_Click;
//
// 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 typeAppealsToolStripMenuItem;
private ToolStripMenuItem courtsToolStripMenuItem;
}
}

View File

@ -0,0 +1,107 @@
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 typeAppealsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTypeAppeals>().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 caseAdvocateRepositoryMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCasesAdvocates>().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>

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

@ -0,0 +1,270 @@
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();
((System.ComponentModel.ISupportInitialize)expNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)tasksNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)ratingNumeric).BeginInit();
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(116, 23);
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(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(203, 303);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
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(120, 37);
sexCheckBox.Name = "sexCheckBox";
sexCheckBox.Size = new Size(77, 19);
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(116, 61);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(120, 23);
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(116, 217);
phoneText.Name = "phoneText";
phoneText.Size = new Size(120, 23);
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(116, 246);
adressBox.Name = "adressBox";
adressBox.Size = new Size(120, 23);
adressBox.TabIndex = 12;
//
// expNumeric
//
expNumeric.Location = new Point(116, 90);
expNumeric.Name = "expNumeric";
expNumeric.Size = new Size(120, 23);
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(116, 119);
tasksNumeric.Name = "tasksNumeric";
tasksNumeric.Size = new Size(120, 23);
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(116, 152);
ratingNumeric.Name = "ratingNumeric";
ratingNumeric.Size = new Size(120, 23);
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(116, 184);
emailTextBox.Name = "emailTextBox";
emailTextBox.Size = new Size(120, 23);
emailTextBox.TabIndex = 20;
//
// FormAdvocate
//
ClientSize = new Size(284, 338);
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;
}
}

View File

@ -0,0 +1,96 @@
using ProjectGSM.Entities;
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));
}
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));
}
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 (_advocateId.HasValue)
{
_advocateRepository.UpdateAdvocate(CreateAdvocate(_advocateId.Value));
}
else
{
_advocateRepository.UpdateAdvocate(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) => 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);
}
}

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>

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

@ -0,0 +1,288 @@
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();
StatusLabel = new Label();
verdictLabel = new Label();
typeApellBox = new ComboBox();
paymentCheckBox = new CheckBox();
priceNumeric = new NumericUpDown();
winPriceLabel = new Label();
winPriceNumeric = new NumericUpDown();
statusBox = new ComboBox();
verdictCheckBox = new CheckBox();
courtBox = new ComboBox();
courtLabel = new Label();
clientBox = new ComboBox();
clientLabel = new Label();
descriptionLabel = new Label();
textBox1 = new TextBox();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)winPriceNumeric).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(118, 375);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 375);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
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 = "Цена:";
//
// StatusLabel
//
StatusLabel.Location = new Point(10, 157);
StatusLabel.Name = "StatusLabel";
StatusLabel.Size = new Size(111, 23);
StatusLabel.TabIndex = 9;
StatusLabel.Text = "Текущий статус:";
//
// verdictLabel
//
verdictLabel.Location = new Point(10, 191);
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, 23);
typeApellBox.TabIndex = 13;
//
// paymentCheckBox
//
paymentCheckBox.AutoSize = true;
paymentCheckBox.Location = new Point(120, 49);
paymentCheckBox.Name = "paymentCheckBox";
paymentCheckBox.Size = new Size(76, 19);
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, 23);
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, 23);
winPriceNumeric.TabIndex = 17;
//
// statusBox
//
statusBox.DropDownStyle = ComboBoxStyle.DropDownList;
statusBox.FormattingEnabled = true;
statusBox.Location = new Point(116, 157);
statusBox.Name = "statusBox";
statusBox.Size = new Size(121, 23);
statusBox.TabIndex = 18;
//
// verdictCheckBox
//
verdictCheckBox.AutoSize = true;
verdictCheckBox.Location = new Point(117, 191);
verdictCheckBox.Name = "verdictCheckBox";
verdictCheckBox.Size = new Size(76, 19);
verdictCheckBox.TabIndex = 19;
verdictCheckBox.Text = "успешно";
verdictCheckBox.UseVisualStyleBackColor = true;
//
// courtBox
//
courtBox.DropDownStyle = ComboBoxStyle.DropDownList;
courtBox.FormattingEnabled = true;
courtBox.Location = new Point(116, 224);
courtBox.Name = "courtBox";
courtBox.Size = new Size(121, 23);
courtBox.TabIndex = 21;
//
// courtLabel
//
courtLabel.Location = new Point(10, 224);
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, 23);
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;
//
// FormCase
//
ClientSize = new Size(284, 407);
Controls.Add(textBox1);
Controls.Add(descriptionLabel);
Controls.Add(clientBox);
Controls.Add(clientLabel);
Controls.Add(courtBox);
Controls.Add(courtLabel);
Controls.Add(verdictCheckBox);
Controls.Add(statusBox);
Controls.Add(winPriceNumeric);
Controls.Add(winPriceLabel);
Controls.Add(priceNumeric);
Controls.Add(paymentCheckBox);
Controls.Add(typeApellBox);
Controls.Add(verdictLabel);
Controls.Add(StatusLabel);
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();
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 Label StatusLabel;
private TextBox phoneText;
private Label verdictLabel;
private ComboBox typeApellBox;
private CheckBox paymentCheckBox;
private NumericUpDown priceNumeric;
private Label winPriceLabel;
private NumericUpDown winPriceNumeric;
private ComboBox statusBox;
private CheckBox verdictCheckBox;
private ComboBox courtBox;
private Label courtLabel;
private ComboBox clientBox;
private Label clientLabel;
private Label descriptionLabel;
private TextBox textBox1;
}
}

View File

@ -0,0 +1,118 @@
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 FormCase : Form
{
private readonly ICaseRepository _caseRepository;
private int? _caseId;
public int Id
{
set
{
try
{
var caseE =
_caseRepository.ReadCaseById(value);
if (caseE == null)
{
throw new
InvalidDataException(nameof(caseE));
}
typeApellBox.SelectedIndex = caseE.TypeAppealId;
clientBox.SelectedIndex = caseE.ClientId;
courtBox.SelectedIndex = caseE.CourtId;
statusBox.SelectedIndex = caseE.StatusId;
paymentCheckBox.Checked = caseE.Payment;
priceNumeric.Value = caseE.Price;
winPriceNumeric.Value = caseE.VictoryPrice;
verdictCheckBox.Checked= caseE.Verdict;
textBox1.Text = caseE.Description;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormCase(ICaseRepository caseRepository, IClientRepository clientRepository, ICourtRepository courtRepository, IStatusRepository statusRepository)
{
InitializeComponent();
_caseRepository = caseRepository ??
throw new
ArgumentNullException(nameof(caseRepository));
typeApellBox.DataSource = caseRepository.ReadCases();
typeApellBox.DisplayMember = "Name";
typeApellBox.ValueMember = "Id";
clientBox.DataSource = clientRepository.ReadClients();
clientBox.DisplayMember = "Name";
clientBox.ValueMember = "Id";
statusBox.DataSource = statusRepository.ReadStatuses();
statusBox.DisplayMember = "Name";
statusBox.ValueMember = "Id";
courtBox.DataSource = courtRepository.ReadCourts();
courtBox.DisplayMember = "Name";
courtBox.ValueMember = "Id";
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{if(typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0
)
{
throw new Exception("Имеются незаполненные поля");
}
if (_caseId.HasValue)
{
_caseRepository.UpdateCase(CreateCase(_caseId.Value));
}
else
{
_caseRepository.UpdateCase(CreateCase(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Case CreateCase(int id) => Case.CreateEntity(id,
typeApellBox.SelectedIndex,
paymentCheckBox.Checked,
priceNumeric.Value,
winPriceNumeric.Value,
statusBox.SelectedIndex,
verdictCheckBox.Checked,
courtBox.SelectedIndex,
clientBox.SelectedIndex,
textBox1.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>

View File

@ -0,0 +1,116 @@
namespace ProjectGSM.Forms
{
partial class FormCaseAdvocates
{
/// <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()
{
advocateLabel = new Label();
saveButton = new Button();
cancelButton = new Button();
caseLabel = new Label();
advocateBox = new ComboBox();
caseBox = new ComboBox();
SuspendLayout();
//
// advocateLabel
//
advocateLabel.Location = new Point(10, 47);
advocateLabel.Name = "advocateLabel";
advocateLabel.Size = new Size(100, 23);
advocateLabel.TabIndex = 0;
advocateLabel.Text = "Адвокат:";
//
// saveButton
//
saveButton.Location = new Point(138, 92);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(219, 92);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// caseLabel
//
caseLabel.Location = new Point(10, 7);
caseLabel.Name = "caseLabel";
caseLabel.Size = new Size(100, 23);
caseLabel.TabIndex = 15;
caseLabel.Text = "Дело:";
//
// advocateBox
//
advocateBox.DropDownStyle = ComboBoxStyle.DropDownList;
advocateBox.FormattingEnabled = true;
advocateBox.Location = new Point(125, 47);
advocateBox.Name = "advocateBox";
advocateBox.Size = new Size(169, 23);
advocateBox.TabIndex = 16;
//
// caseBox
//
caseBox.DropDownStyle = ComboBoxStyle.DropDownList;
caseBox.FormattingEnabled = true;
caseBox.Location = new Point(125, 7);
caseBox.Name = "caseBox";
caseBox.Size = new Size(169, 23);
caseBox.TabIndex = 17;
//
// FormCaseAdvocates
//
ClientSize = new Size(306, 117);
Controls.Add(caseBox);
Controls.Add(advocateBox);
Controls.Add(caseLabel);
Controls.Add(advocateLabel);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormCaseAdvocates";
StartPosition = FormStartPosition.CenterScreen;
Text = "Закрепление адвоката за делом";
ResumeLayout(false);
}
#endregion
private Label advocateLabel;
private Button saveButton;
private Button cancelButton;
private Label caseLabel;
private ComboBox advocateBox;
private ComboBox caseBox;
}
}

View File

@ -0,0 +1,64 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
using ProjectGSM.Repositories.Implementations;
namespace ProjectGSM.Forms
{
public partial class FormCaseAdvocates : Form
{
private readonly ICaseAdvocateRepository _caseAdvocateRepository;
public FormCaseAdvocates(ICaseAdvocateRepository caseAdvocateRepository,
ICaseRepository caseRepository, IAdvocateRepository advocateRepository)
{
InitializeComponent();
_caseAdvocateRepository = caseAdvocateRepository ??
throw new
ArgumentNullException(nameof(caseAdvocateRepository));
try
{
caseBox.DataSource = caseRepository.ReadCases();
caseBox.DisplayMember = "Name";
caseBox.SelectedIndex = 0;
}
catch (Exception ex)
{
}
try
{
advocateBox.DataSource = advocateRepository.ReadAdvocates();
advocateBox.DisplayMember = "Name";
advocateBox.SelectedIndex = 0;
}
catch (Exception ex) { }
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (caseBox.SelectedIndex < 0 || advocateBox.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_caseAdvocateRepository.CreateCaseAdvocate(CaseAdvocate.CreateEntity(caseBox.SelectedIndex, advocateBox.SelectedIndex));
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>

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

@ -0,0 +1,130 @@
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();
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;
//
// 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 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 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 editButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormCase>();
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<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>

View File

@ -0,0 +1,101 @@
namespace ProjectGSM.Forms
{
partial class FormCasesAdvocates
{
/// <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;
//
// FormCasesAdvocates
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Name = "FormCasesAdvocates";
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 ProjectGSM.Repositories.Implementations;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormCasesAdvocates : Form
{
private readonly IUnityContainer _container;
private readonly ICaseAdvocateRepository _caseAdvocateRepository;
public FormCasesAdvocates(IUnityContainer container, ICaseAdvocateRepository caseAdvocateRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_caseAdvocateRepository = caseAdvocateRepository ??
throw new
ArgumentNullException(nameof(caseAdvocateRepository));
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCaseAdvocates>().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 =
_caseAdvocateRepository.ReadCaseAdvocates();
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,95 @@
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));
}
nameTextBox.Text = client.Name;
emailTextBox.Text = client.Email;
sexCheckBox.Checked = client.Sex;
dateTimePicker.Value = new DateTime(client.DateOfBirth.Year, client.DateOfBirth.Month, client.DateOfBirth.Day);
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.UpdateClient(CreateClient(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
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,79 @@
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));
}
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>

136
ProjectGSM/Forms/FormStatus.Designer.cs generated Normal file
View File

@ -0,0 +1,136 @@
namespace ProjectGSM.Forms
{
partial class FormStatus
{
/// <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();
priceLabel = new Label();
priceNumeric = new NumericUpDown();
dateLabel = new Label();
dateTimePicker1 = new DateTimePicker();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
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, 134);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 134);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// priceLabel
//
priceLabel.Location = new Point(10, 50);
priceLabel.Name = "priceLabel";
priceLabel.Size = new Size(111, 23);
priceLabel.TabIndex = 11;
priceLabel.Text = "Цена:";
//
// priceNumeric
//
priceNumeric.Location = new Point(116, 50);
priceNumeric.Name = "priceNumeric";
priceNumeric.Size = new Size(120, 23);
priceNumeric.TabIndex = 12;
//
// dateLabel
//
dateLabel.Location = new Point(10, 96);
dateLabel.Name = "dateLabel";
dateLabel.Size = new Size(111, 23);
dateLabel.TabIndex = 13;
dateLabel.Text = "Дата:";
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(116, 96);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(120, 23);
dateTimePicker1.TabIndex = 14;
//
// FornStatus
//
ClientSize = new Size(284, 169);
Controls.Add(dateTimePicker1);
Controls.Add(dateLabel);
Controls.Add(priceNumeric);
Controls.Add(priceLabel);
Controls.Add(nameLabel);
Controls.Add(nameTextBox);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FornStatus";
StartPosition = FormStartPosition.CenterScreen;
Text = "Суд";
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label nameLabel;
private TextBox nameTextBox;
private Button saveButton;
private Button cancelButton;
private Label priceLabel;
private NumericUpDown priceNumeric;
private Label dateLabel;
private DateTimePicker dateTimePicker1;
}
}

View File

@ -0,0 +1,78 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormStatus : Form
{
private readonly IStatusRepository _statusRepository;
private int? _statusId;
public int Id
{
set
{
try
{
var status =
_statusRepository.ReadStatusById(value);
if (status == null)
{
throw new
InvalidDataException(nameof(status));
}
nameTextBox.Text = status.Name;
priceNumeric.Value = status.Price ?? 0;
dateTimePicker1.Value = new DateTime(status.CreatedAt.Year, status.CreatedAt.Month, status.CreatedAt.Day); ;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormStatus(IStatusRepository statusRepository)
{
InitializeComponent();
_statusRepository = statusRepository ??
throw new
ArgumentNullException(nameof(statusRepository));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(nameTextBox.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_statusId.HasValue)
{
_statusRepository.UpdateStatus(CreateStatus(_statusId.Value));
}
else
{
_statusRepository.UpdateStatus(CreateStatus(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Status CreateStatus(int id) => Status.CreateEntity(id,
nameTextBox.Text, Convert.ToDecimal(priceNumeric.Value), dateTimePicker1.Value);
}
}

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,137 @@
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();
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, 128);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 128);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// dateLabel
//
dateLabel.Location = new Point(10, 92);
dateLabel.Name = "dateLabel";
dateLabel.Size = new Size(111, 23);
dateLabel.TabIndex = 13;
dateLabel.Text = "Дата:";
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(125, 92);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(120, 23);
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(121, 23);
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, 23);
caseBox.TabIndex = 17;
//
// FormStatusHistory
//
ClientSize = new Size(284, 163);
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 = "Хронология статусов";
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;
}
}

View File

@ -0,0 +1,58 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormStatusHistory : Form
{
private readonly IStatusHistoryRepository _statusHistoryRepository;
public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository,
IStatusRepository statusRepository, ICaseRepository caseRepository)
{
InitializeComponent();
_statusHistoryRepository = statusHistoryRepository ??
throw new
ArgumentNullException(nameof(statusHistoryRepository));
try
{
caseBox.DataSource = caseRepository.ReadCases();
caseBox.DisplayMember = "Name";
caseBox.SelectedIndex = 0;
}
catch (Exception ex) { }
try
{
statusBox.DataSource = statusRepository.ReadStatuses();
statusBox.DisplayMember = "Name";
statusBox.SelectedIndex = 0;
}
catch (Exception ex) { }
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (caseBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity(caseBox.SelectedIndex, statusBox.SelectedIndex, 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>

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

@ -0,0 +1,130 @@
namespace ProjectGSM.Forms
{
partial class FormStatuses
{
/// <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,114 @@
using ProjectGSM.Repositories;
using Unity;
namespace ProjectGSM.Forms
{
public partial class FormStatuses : Form
{
private readonly IUnityContainer _container;
private readonly IStatusRepository _statusRepository;
public FormStatuses(IUnityContainer container, IStatusRepository statusRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_statusRepository = statusRepository ??
throw new
ArgumentNullException(nameof(statusRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_statusRepository.DeleteStatus(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<FormStatus>();
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<FormStatus>().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 =
_statusRepository.ReadStatuses();
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,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

@ -0,0 +1,92 @@
namespace ProjectGSM.Forms
{
partial class FormTypeApeal
{
/// <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();
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, 53);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 53);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// FormTypeApeal
//
ClientSize = new Size(284, 84);
Controls.Add(nameLabel);
Controls.Add(nameTextBox);
Controls.Add(saveButton);
Controls.Add(cancelButton);
Name = "FormTypeApeal";
StartPosition = FormStartPosition.CenterScreen;
Text = "Тип обращения";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label nameLabel;
private TextBox nameTextBox;
private Button saveButton;
private Button cancelButton;
}
}

View File

@ -0,0 +1,77 @@
using ProjectGSM.Entities;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
{
public partial class FormTypeApeal : Form
{
private readonly ITypeAppealRepository _typeAppealRepository;
private int? _appealId;
public int Id
{
set
{
try
{
var appeal =
_typeAppealRepository.ReadTypeAppealById(value);
if (appeal == null)
{
throw new
InvalidDataException(nameof(appeal));
}
nameTextBox.Text = appeal.Name;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormTypeApeal(ITypeAppealRepository typeAppealRepository)
{
InitializeComponent();
_typeAppealRepository = typeAppealRepository ??
throw new
ArgumentNullException(nameof(typeAppealRepository));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(nameTextBox.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_appealId.HasValue)
{
_typeAppealRepository.UpdateTypeAppeal(CreateTypeAppeal(_appealId.Value));
}
else
{
_typeAppealRepository.UpdateTypeAppeal(CreateTypeAppeal(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cancelButton_Click(object sender, EventArgs e) => Close();
private TypeAppeal CreateTypeAppeal(int id) => TypeAppeal.CreateEntity(id,
nameTextBox.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>

View File

@ -0,0 +1,130 @@
namespace ProjectGSM.Forms
{
partial class FormTypeAppeals
{
/// <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 FormTypeAppeals : Form
{
private readonly IUnityContainer _container;
private readonly ITypeAppealRepository _typeAppealRepository;
public FormTypeAppeals(IUnityContainer container, ITypeAppealRepository typeAppealRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_typeAppealRepository = typeAppealRepository ??
throw new
ArgumentNullException(nameof(typeAppealRepository));
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_typeAppealRepository.DeleteTypeAppeal(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<FormTypeApeal>();
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<FormTypeApeal>().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 =
_typeAppealRepository.ReadTypeAppeals();
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,21 @@ 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<IAdvocateRepository, AdvocateRepository>(new TransientLifetimeManager());
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<IStatusRepository, StatusRepository>(new TransientLifetimeManager());
container.RegisterType<IStatusHistoryRepository, StatusHistoryRepository>(new TransientLifetimeManager());
container.RegisterType<ITypeAppealRepository, TypeAppealRepository>(new TransientLifetimeManager());
return container;
}
}
}

View File

@ -8,4 +8,70 @@
<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\FormCasesAdvocates.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatusesHistory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormCaseAdvocates.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatusHistory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormTypeAppeals.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormTypeApeal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatuses.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormStatus.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>
<Folder Include="Entities\Enums\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
</Project>

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 ICaseAdvocateRepository
{
IEnumerable<CaseAdvocate> ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null, int? caseId = null,
int? advocateId = null);
void CreateCaseAdvocate(CaseAdvocate caseAdvocate);
void DeleteCaseAdvocate(int caseId, int advocateId);
}

View File

@ -0,0 +1,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface ICaseRepository
{
IEnumerable<Case> ReadCases();
Case ReadCaseById(int id);
void CreateCase(Case caseEntity);
void UpdateCase(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,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface IStatusRepository
{
IEnumerable<Status> ReadStatuses();
Status ReadStatusById(int id);
void CreateStatus(Status status);
void UpdateStatus(Status status);
void DeleteStatus(int id);
}

View File

@ -0,0 +1,12 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories;
public interface ITypeAppealRepository
{
IEnumerable<TypeAppeal> ReadTypeAppeals();
TypeAppeal ReadTypeAppealById(int id);
void CreateTypeAppeal(TypeAppeal typeAppeal);
void UpdateTypeAppeal(TypeAppeal typeAppeal);
void DeleteTypeAppeal(int id);
}

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);
}
public void CreateAdvocate(Advocate advocate)
{
}
public void UpdateAdvocate(Advocate advocate)
{
}
public void DeleteAdvocate(int id)
{
}
}

View File

@ -0,0 +1,16 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class CaseAdvocateRepository : ICaseAdvocateRepository
{
public IEnumerable<CaseAdvocate> ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null,
int? caseId = null, int? advocateId = null)
{
return [];
}
public void CreateCaseAdvocate(CaseAdvocate caseAdvocate) { }
public void DeleteCaseAdvocate(int caseId, int advocateId) { }
}

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, 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)
{
}
}

View File

@ -0,0 +1,28 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class StatusRepository : IStatusRepository
{
public IEnumerable<Status> ReadStatuses()
{
return [];
}
public Status ReadStatusById(int id)
{
return Status.CreateEntity(0, String.Empty);
}
public void CreateStatus(Status status)
{
}
public void UpdateStatus(Status status)
{
}
public void DeleteStatus(int id)
{
}
}

View File

@ -0,0 +1,28 @@
using ProjectGSM.Entities;
namespace ProjectGSM.Repositories.Implementations;
public class TypeAppealRepository : ITypeAppealRepository
{
public IEnumerable<TypeAppeal> ReadTypeAppeals()
{
return [];
}
public TypeAppeal ReadTypeAppealById(int id)
{
return TypeAppeal.CreateEntity(0, String.Empty);
}
public void CreateTypeAppeal(TypeAppeal typeAppeal)
{
}
public void UpdateTypeAppeal(TypeAppeal typeAppeal)
{
}
public void DeleteTypeAppeal(int id)
{
}
}

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