lab1 ready

This commit is contained in:
Maxim 2024-11-09 03:06:08 +04:00
parent b0b03748bb
commit c4e6741777
43 changed files with 268 additions and 2301 deletions

View File

@ -1,4 +1,7 @@
namespace ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using System.ComponentModel;
namespace ProjectGSM.Entities;
public class Advocate
{
@ -12,6 +15,7 @@ public class Advocate
public string Email { get; private set; } = string.Empty;
public string PhoneNumber { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public LicenseType LicenseType { get; private set; }
public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
@ -25,7 +29,7 @@ public class Advocate
int rating,
string email,
string phoneNumber,
string address)
string address, LicenseType license)
{
return new Advocate
{
@ -39,6 +43,7 @@ public class Advocate
Email = email ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Address = address ?? string.Empty,
LicenseType = license,
CreatedAt = DateTime.UtcNow
};
}

View File

@ -1,13 +1,14 @@
namespace ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
namespace ProjectGSM.Entities;
public class Case
{
public int Id { get; private set; }
public int TypeAppealId { get; private set; }
public TypeAppeal TypeAppeal { get; private set; }
public bool Payment { get; private set; } = false;
public decimal Price { get; private set; }
public decimal VictoryPrice { get; private set; }
public int StatusId { get; private set; }
public bool Verdict { get; private set; } = false;
public int CourtId { get; private set; }
public int ClientId { get; private set; }
@ -17,11 +18,10 @@ public class Case
// Конструктор для создания сущности
public static Case CreateEntity(
int id,
int typeAppealId,
TypeAppeal typeAppeal,
bool payment,
decimal price,
decimal victoryPrice,
int statusId,
bool verdict,
int courtId,
int clientId,
@ -31,11 +31,10 @@ public class Case
return new Case
{
Id = id,
TypeAppealId = typeAppealId,
TypeAppeal = typeAppeal,
Payment = payment,
Price = price,
VictoryPrice = victoryPrice,
StatusId = statusId,
Verdict = verdict,
CourtId = courtId,
ClientId = clientId,

View File

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

View File

@ -1,21 +0,0 @@
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

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

View File

@ -1,19 +0,0 @@
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

@ -13,7 +13,6 @@
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>
@ -42,10 +41,8 @@
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();
@ -63,7 +60,7 @@
//
// directoriesMenuItem
//
directoriesMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsMenuItem, advocatesMenuItem, casesMenuItem, typeAppealsToolStripMenuItem, courtsToolStripMenuItem });
directoriesMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsMenuItem, advocatesMenuItem, courtsToolStripMenuItem });
directoriesMenuItem.Name = "directoriesMenuItem";
directoriesMenuItem.Size = new Size(94, 20);
directoriesMenuItem.Text = "Справочники";
@ -89,13 +86,6 @@
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";
@ -105,18 +95,11 @@
//
// operationsMenuItem
//
operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { caseAdvocateRepositoryMenuItem, statusHistoryRepositoryMenuItem });
operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { casesMenuItem, 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";
@ -150,7 +133,6 @@
#endregion
private ToolStripMenuItem typeAppealsToolStripMenuItem;
private ToolStripMenuItem courtsToolStripMenuItem;
}
}

View File

@ -52,19 +52,6 @@ throw new ArgumentNullException(nameof(container));
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
@ -78,19 +65,6 @@ throw new ArgumentNullException(nameof(container));
}
}
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

View File

@ -48,6 +48,8 @@
ratingNumeric = new NumericUpDown();
emailLabel = new Label();
emailTextBox = new TextBox();
licenseLabel = new Label();
checkedListBox = new CheckedListBox();
((System.ComponentModel.ISupportInitialize)expNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)tasksNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)ratingNumeric).BeginInit();
@ -55,17 +57,17 @@
//
// nameLabel
//
nameLabel.Location = new Point(10, 10);
nameLabel.Location = new Point(14, 9);
nameLabel.Name = "nameLabel";
nameLabel.Size = new Size(100, 23);
nameLabel.Size = new Size(134, 23);
nameLabel.TabIndex = 0;
nameLabel.Text = "Имя адвоката:";
//
// nameTextBox
//
nameTextBox.Location = new Point(120, 10);
nameTextBox.Location = new Point(148, 5);
nameTextBox.Name = "nameTextBox";
nameTextBox.Size = new Size(116, 23);
nameTextBox.Size = new Size(116, 31);
nameTextBox.TabIndex = 1;
//
// expLabel
@ -80,16 +82,16 @@
//
saveButton.Location = new Point(122, 303);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.Size = new Size(114, 35);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(203, 303);
cancelButton.Location = new Point(255, 309);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.Size = new Size(133, 29);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
@ -105,9 +107,9 @@
// sexCheckBox
//
sexCheckBox.AutoSize = true;
sexCheckBox.Location = new Point(120, 37);
sexCheckBox.Location = new Point(148, 32);
sexCheckBox.Name = "sexCheckBox";
sexCheckBox.Size = new Size(77, 19);
sexCheckBox.Size = new Size(112, 29);
sexCheckBox.TabIndex = 6;
sexCheckBox.Text = "мужчина";
sexCheckBox.UseVisualStyleBackColor = true;
@ -122,9 +124,9 @@
//
// dateTimePicker
//
dateTimePicker.Location = new Point(116, 61);
dateTimePicker.Location = new Point(144, 56);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(120, 23);
dateTimePicker.Size = new Size(120, 31);
dateTimePicker.TabIndex = 8;
//
// PhoneLabel
@ -137,9 +139,9 @@
//
// phoneText
//
phoneText.Location = new Point(116, 217);
phoneText.Location = new Point(144, 212);
phoneText.Name = "phoneText";
phoneText.Size = new Size(120, 23);
phoneText.Size = new Size(120, 31);
phoneText.TabIndex = 10;
//
// adressLabel
@ -152,16 +154,16 @@
//
// adressBox
//
adressBox.Location = new Point(116, 246);
adressBox.Location = new Point(144, 241);
adressBox.Name = "adressBox";
adressBox.Size = new Size(120, 23);
adressBox.Size = new Size(120, 31);
adressBox.TabIndex = 12;
//
// expNumeric
//
expNumeric.Location = new Point(116, 90);
expNumeric.Location = new Point(144, 85);
expNumeric.Name = "expNumeric";
expNumeric.Size = new Size(120, 23);
expNumeric.Size = new Size(120, 31);
expNumeric.TabIndex = 13;
//
// tasksLabel
@ -174,9 +176,9 @@
//
// tasksNumeric
//
tasksNumeric.Location = new Point(116, 119);
tasksNumeric.Location = new Point(144, 114);
tasksNumeric.Name = "tasksNumeric";
tasksNumeric.Size = new Size(120, 23);
tasksNumeric.Size = new Size(120, 31);
tasksNumeric.TabIndex = 16;
//
// ratingLabel
@ -189,9 +191,9 @@
//
// ratingNumeric
//
ratingNumeric.Location = new Point(116, 152);
ratingNumeric.Location = new Point(144, 147);
ratingNumeric.Name = "ratingNumeric";
ratingNumeric.Size = new Size(120, 23);
ratingNumeric.Size = new Size(120, 31);
ratingNumeric.TabIndex = 18;
//
// emailLabel
@ -204,14 +206,32 @@
//
// emailTextBox
//
emailTextBox.Location = new Point(116, 184);
emailTextBox.Location = new Point(144, 179);
emailTextBox.Name = "emailTextBox";
emailTextBox.Size = new Size(120, 23);
emailTextBox.Size = new Size(120, 31);
emailTextBox.TabIndex = 20;
//
// licenseLabel
//
licenseLabel.Location = new Point(298, 9);
licenseLabel.Name = "licenseLabel";
licenseLabel.Size = new Size(100, 23);
licenseLabel.TabIndex = 21;
licenseLabel.Text = "Лицензии:";
//
// checkedListBox
//
checkedListBox.FormattingEnabled = true;
checkedListBox.Location = new Point(298, 56);
checkedListBox.Name = "checkedListBox";
checkedListBox.Size = new Size(304, 228);
checkedListBox.TabIndex = 22;
//
// FormAdvocate
//
ClientSize = new Size(284, 338);
ClientSize = new Size(637, 593);
Controls.Add(checkedListBox);
Controls.Add(licenseLabel);
Controls.Add(emailTextBox);
Controls.Add(emailLabel);
Controls.Add(ratingNumeric);
@ -266,5 +286,7 @@
private NumericUpDown ratingNumeric;
private Label emailLabel;
private TextBox emailTextBox;
private Label licenseLabel;
private CheckedListBox checkedListBox;
}
}

View File

@ -1,4 +1,6 @@
using ProjectGSM.Entities;
using Microsoft.VisualBasic.FileIO;
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
@ -23,6 +25,15 @@ namespace ProjectGSM.Forms
throw new
InvalidDataException(nameof(advocate));
}
foreach (LicenseType elem in Enum.GetValues(typeof(LicenseType)))
{
if ((elem & advocate.LicenseType) != 0)
{
checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(
elem), true);
}
}
nameTextBox.Text = advocate.Name;
sexCheckBox.Checked= advocate.Sex;
dateTimePicker.Value = new DateTime(advocate.DateOfBirth.Year, advocate.DateOfBirth.Month, advocate.DateOfBirth.Day);
@ -48,6 +59,12 @@ namespace ProjectGSM.Forms
_advocateRepository = advocateRepository ??
throw new
ArgumentNullException(nameof(advocateRepository));
foreach (var elem in Enum.GetValues(typeof(LicenseType)))
{
checkedListBox.Items.Add(elem);
}
}
private void saveButton_Click(object sender, EventArgs e)
@ -57,7 +74,7 @@ namespace ProjectGSM.Forms
if (string.IsNullOrWhiteSpace(nameTextBox.Text) ||
string.IsNullOrWhiteSpace(emailTextBox.Text) ||
string.IsNullOrWhiteSpace(phoneText.Text) ||
string.IsNullOrWhiteSpace(adressBox.Text))
string.IsNullOrWhiteSpace(adressBox.Text) || checkedListBox.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
@ -81,7 +98,14 @@ namespace ProjectGSM.Forms
private void cancelButton_Click(object sender, EventArgs e) => Close();
private Advocate CreateAdvocate(int id) => Advocate.CreateEntity(id,
private Advocate CreateAdvocate(int id)
{
LicenseType licenseType = LicenseType.None;
foreach (var elem in checkedListBox.CheckedItems)
{
licenseType |= (LicenseType)elem;
}
return Advocate.CreateEntity(id,
nameTextBox.Text,
sexCheckBox.Checked,
dateTimePicker.Value,
@ -90,7 +114,8 @@ namespace ProjectGSM.Forms
Convert.ToInt32(ratingNumeric.Value),
emailTextBox.Text,
phoneText.Text,
adressBox.Text);
adressBox.Text, licenseType);
}
}
}

View File

@ -33,14 +33,12 @@
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();
@ -48,8 +46,14 @@
clientLabel = new Label();
descriptionLabel = new Label();
textBox1 = new TextBox();
groupBox1 = new GroupBox();
dataGridView1 = new DataGridView();
ColumnAdvocate = new DataGridViewComboBoxColumn();
ColumnPost = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
((System.ComponentModel.ISupportInitialize)winPriceNumeric).BeginInit();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
SuspendLayout();
//
// typeApealLabel
@ -70,18 +74,18 @@
//
// saveButton
//
saveButton.Location = new Point(118, 375);
saveButton.Location = new Point(116, 531);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.Size = new Size(128, 39);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 375);
cancelButton.Location = new Point(283, 531);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.Size = new Size(126, 39);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
@ -94,17 +98,9 @@
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.Location = new Point(10, 176);
verdictLabel.Name = "verdictLabel";
verdictLabel.Size = new Size(111, 23);
verdictLabel.TabIndex = 11;
@ -116,7 +112,7 @@
typeApellBox.FormattingEnabled = true;
typeApellBox.Location = new Point(116, 10);
typeApellBox.Name = "typeApellBox";
typeApellBox.Size = new Size(121, 23);
typeApellBox.Size = new Size(121, 33);
typeApellBox.TabIndex = 13;
//
// paymentCheckBox
@ -124,7 +120,7 @@
paymentCheckBox.AutoSize = true;
paymentCheckBox.Location = new Point(120, 49);
paymentCheckBox.Name = "paymentCheckBox";
paymentCheckBox.Size = new Size(76, 19);
paymentCheckBox.Size = new Size(109, 29);
paymentCheckBox.TabIndex = 14;
paymentCheckBox.Text = "успешно";
paymentCheckBox.UseVisualStyleBackColor = true;
@ -134,7 +130,7 @@
priceNumeric.DecimalPlaces = 2;
priceNumeric.Location = new Point(117, 87);
priceNumeric.Name = "priceNumeric";
priceNumeric.Size = new Size(120, 23);
priceNumeric.Size = new Size(120, 31);
priceNumeric.TabIndex = 15;
//
// winPriceLabel
@ -150,24 +146,15 @@
winPriceNumeric.DecimalPlaces = 2;
winPriceNumeric.Location = new Point(117, 122);
winPriceNumeric.Name = "winPriceNumeric";
winPriceNumeric.Size = new Size(120, 23);
winPriceNumeric.Size = new Size(120, 31);
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.Location = new Point(116, 176);
verdictCheckBox.Name = "verdictCheckBox";
verdictCheckBox.Size = new Size(76, 19);
verdictCheckBox.Size = new Size(109, 29);
verdictCheckBox.TabIndex = 19;
verdictCheckBox.Text = "успешно";
verdictCheckBox.UseVisualStyleBackColor = true;
@ -176,14 +163,14 @@
//
courtBox.DropDownStyle = ComboBoxStyle.DropDownList;
courtBox.FormattingEnabled = true;
courtBox.Location = new Point(116, 224);
courtBox.Location = new Point(116, 212);
courtBox.Name = "courtBox";
courtBox.Size = new Size(121, 23);
courtBox.Size = new Size(121, 33);
courtBox.TabIndex = 21;
//
// courtLabel
//
courtLabel.Location = new Point(10, 224);
courtLabel.Location = new Point(12, 215);
courtLabel.Name = "courtLabel";
courtLabel.Size = new Size(100, 23);
courtLabel.TabIndex = 20;
@ -195,7 +182,7 @@
clientBox.FormattingEnabled = true;
clientBox.Location = new Point(116, 262);
clientBox.Name = "clientBox";
clientBox.Size = new Size(121, 23);
clientBox.Size = new Size(121, 33);
clientBox.TabIndex = 23;
//
// clientLabel
@ -222,9 +209,47 @@
textBox1.Size = new Size(154, 73);
textBox1.TabIndex = 25;
//
// groupBox1
//
groupBox1.Controls.Add(dataGridView1);
groupBox1.Location = new Point(327, 30);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(477, 339);
groupBox1.TabIndex = 26;
groupBox1.TabStop = false;
groupBox1.Text = "Прикрепленные адвокаты";
//
// dataGridView1
//
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AllowUserToResizeRows = false;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.BackgroundColor = SystemColors.ActiveCaption;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnAdvocate, ColumnPost });
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(3, 27);
dataGridView1.Name = "dataGridView1";
dataGridView1.RowHeadersWidth = 62;
dataGridView1.Size = new Size(471, 309);
dataGridView1.TabIndex = 0;
//
// ColumnAdvocate
//
ColumnAdvocate.HeaderText = "Адвокаты";
ColumnAdvocate.MinimumWidth = 8;
ColumnAdvocate.Name = "ColumnAdvocate";
//
// ColumnPost
//
ColumnPost.HeaderText = "Должности";
ColumnPost.MinimumWidth = 8;
ColumnPost.Name = "ColumnPost";
//
// FormCase
//
ClientSize = new Size(284, 407);
ClientSize = new Size(845, 582);
Controls.Add(groupBox1);
Controls.Add(textBox1);
Controls.Add(descriptionLabel);
Controls.Add(clientBox);
@ -232,14 +257,12 @@
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);
@ -250,6 +273,8 @@
Text = "Дело";
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
((System.ComponentModel.ISupportInitialize)winPriceNumeric).EndInit();
groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -268,7 +293,6 @@
private CheckBox sexCheckBox;
private Label DateLabel;
private DateTimePicker dateTimePicker;
private Label StatusLabel;
private TextBox phoneText;
private Label verdictLabel;
private ComboBox typeApellBox;
@ -276,7 +300,6 @@
private NumericUpDown priceNumeric;
private Label winPriceLabel;
private NumericUpDown winPriceNumeric;
private ComboBox statusBox;
private CheckBox verdictCheckBox;
private ComboBox courtBox;
private Label courtLabel;
@ -284,5 +307,9 @@
private Label clientLabel;
private Label descriptionLabel;
private TextBox textBox1;
private GroupBox groupBox1;
private DataGridView dataGridView1;
private DataGridViewComboBoxColumn ColumnAdvocate;
private DataGridViewTextBoxColumn ColumnPost;
}
}

View File

@ -1,5 +1,7 @@
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
using ProjectGSM.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -17,6 +19,8 @@ namespace ProjectGSM.Forms
{
private readonly ICaseRepository _caseRepository;
private readonly ICaseAdvocateRepository _caseAdvocateRepository;
private int? _caseId;
public int Id
@ -32,10 +36,11 @@ namespace ProjectGSM.Forms
throw new
InvalidDataException(nameof(caseE));
}
typeApellBox.SelectedIndex = caseE.TypeAppealId;
typeApellBox.SelectedItem = caseE.TypeAppeal;
clientBox.SelectedIndex = caseE.ClientId;
courtBox.SelectedIndex = caseE.CourtId;
statusBox.SelectedIndex = caseE.StatusId;
paymentCheckBox.Checked = caseE.Payment;
priceNumeric.Value = caseE.Price;
winPriceNumeric.Value = caseE.VictoryPrice;
@ -51,25 +56,24 @@ namespace ProjectGSM.Forms
}
public FormCase(ICaseRepository caseRepository, IClientRepository clientRepository, ICourtRepository courtRepository, IStatusRepository statusRepository)
public FormCase(ICaseRepository caseRepository, ICaseAdvocateRepository caseAdvocateRepository,IClientRepository clientRepository, ICourtRepository courtRepository, IAdvocateRepository advocateRepository)
{
InitializeComponent();
_caseRepository = caseRepository ??
throw new
ArgumentNullException(nameof(caseRepository));
_caseAdvocateRepository = caseAdvocateRepository ?? throw new ArgumentNullException(nameof(caseAdvocateRepository));
typeApellBox.DataSource = Enum.GetValues(typeof(TypeAppeal));
typeApellBox.DataSource = caseRepository.ReadCases();
typeApellBox.DisplayMember = "Name";
typeApellBox.ValueMember = "Id";
ColumnAdvocate.DataSource = advocateRepository.ReadAdvocates();
ColumnAdvocate.DisplayMember = "Name";
ColumnAdvocate.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";
@ -78,7 +82,7 @@ namespace ProjectGSM.Forms
private void saveButton_Click(object sender, EventArgs e)
{
try
{if(typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0
{if(dataGridView1.RowCount < 1 || typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0
)
{
@ -92,6 +96,10 @@ namespace ProjectGSM.Forms
{
_caseRepository.UpdateCase(CreateCase(0));
}
foreach (CaseAdvocate row in CreateListCaseAdvocateFromDataGrid())
{
_caseAdvocateRepository.CreateCaseAdvocate(CaseAdvocate.CreateEntity(row.CaseId, row.AdvocateId, row.Post));
}
Close();
}
catch (Exception ex)
@ -104,12 +112,30 @@ namespace ProjectGSM.Forms
private void cancelButton_Click(object sender, EventArgs e) => Close();
private List<CaseAdvocate> CreateListCaseAdvocateFromDataGrid()
{
var list = new List<CaseAdvocate>();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["ColumnAdvocates"].Value == null ||
row.Cells["ColumnPost"].Value == null)
{
continue;
}
list.Add(CaseAdvocate.CreateEntity(0,
Convert.ToInt32(row.Cells["ColumnAdvocates"].Value),
row.Cells["ColumnPost"].Value.ToString()??string.Empty));
}
return list;
}
private Case CreateCase(int id) => Case.CreateEntity(id,
typeApellBox.SelectedIndex,
(TypeAppeal)typeApellBox.SelectedItem!,
paymentCheckBox.Checked,
priceNumeric.Value,
winPriceNumeric.Value,
statusBox.SelectedIndex,
verdictCheckBox.Checked,
courtBox.SelectedIndex,
clientBox.SelectedIndex,

View File

@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnAdvocate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnPost.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -1,116 +0,0 @@
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

@ -1,64 +0,0 @@
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

@ -1,120 +0,0 @@
<?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

@ -30,7 +30,6 @@
{
panel1 = new Panel();
deleteButton = new Button();
editButton = new Button();
addButton = new Button();
dataGridView1 = new DataGridView();
panel1.SuspendLayout();
@ -40,45 +39,35 @@
// panel1
//
panel1.Controls.Add(deleteButton);
panel1.Controls.Add(editButton);
panel1.Controls.Add(addButton);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(604, 0);
panel1.Location = new Point(863, 0);
panel1.Margin = new Padding(4, 5, 4, 5);
panel1.Name = "panel1";
panel1.Size = new Size(142, 450);
panel1.Size = new Size(203, 750);
panel1.TabIndex = 0;
//
// deleteButton
//
deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com;
deleteButton.BackgroundImageLayout = ImageLayout.Zoom;
deleteButton.Location = new Point(33, 240);
deleteButton.Location = new Point(47, 400);
deleteButton.Margin = new Padding(4, 5, 4, 5);
deleteButton.Name = "deleteButton";
deleteButton.Size = new Size(75, 75);
deleteButton.Size = new Size(107, 125);
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.Location = new Point(47, 63);
addButton.Margin = new Padding(4, 5, 4, 5);
addButton.Name = "addButton";
addButton.Size = new Size(75, 75);
addButton.Size = new Size(107, 125);
addButton.TabIndex = 0;
addButton.Text = " ";
addButton.UseVisualStyleBackColor = true;
@ -95,21 +84,24 @@
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.Margin = new Padding(4, 5, 4, 5);
dataGridView1.MultiSelect = false;
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
dataGridView1.RowHeadersWidth = 62;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Size = new Size(604, 450);
dataGridView1.Size = new Size(863, 750);
dataGridView1.TabIndex = 1;
//
// FormCases
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(746, 450);
ClientSize = new Size(1066, 750);
Controls.Add(dataGridView1);
Controls.Add(panel1);
Margin = new Padding(4, 5, 4, 5);
Name = "FormCases";
StartPosition = FormStartPosition.CenterScreen;
Text = "Дела";
@ -123,7 +115,6 @@
private Panel panel1;
private Button deleteButton;
private Button editButton;
private Button addButton;
private DataGridView dataGridView1;
}

View File

@ -52,27 +52,6 @@ namespace ProjectGSM.Forms
}
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

View File

@ -1,101 +0,0 @@
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

@ -1,68 +0,0 @@
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

@ -1,120 +0,0 @@
<?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,136 +0,0 @@
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

@ -1,78 +0,0 @@
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

@ -1,120 +0,0 @@
<?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

@ -36,6 +36,9 @@
caseLabel = new Label();
statusBox = new ComboBox();
caseBox = new ComboBox();
priceLabel = new Label();
priceNumeric = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit();
SuspendLayout();
//
// statusLabel
@ -48,25 +51,25 @@
//
// saveButton
//
saveButton.Location = new Point(116, 128);
saveButton.Location = new Point(116, 173);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 23);
saveButton.Size = new Size(75, 38);
saveButton.TabIndex = 4;
saveButton.Text = "Сохранить";
saveButton.Click += saveButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(197, 128);
cancelButton.Location = new Point(197, 173);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(75, 23);
cancelButton.Size = new Size(75, 38);
cancelButton.TabIndex = 5;
cancelButton.Text = "Отмена";
cancelButton.Click += cancelButton_Click;
//
// dateLabel
//
dateLabel.Location = new Point(10, 92);
dateLabel.Location = new Point(10, 137);
dateLabel.Name = "dateLabel";
dateLabel.Size = new Size(111, 23);
dateLabel.TabIndex = 13;
@ -74,9 +77,9 @@
//
// dateTimePicker1
//
dateTimePicker1.Location = new Point(125, 92);
dateTimePicker1.Location = new Point(125, 137);
dateTimePicker1.Name = "dateTimePicker1";
dateTimePicker1.Size = new Size(120, 23);
dateTimePicker1.Size = new Size(120, 31);
dateTimePicker1.TabIndex = 14;
//
// caseLabel
@ -93,7 +96,7 @@
statusBox.FormattingEnabled = true;
statusBox.Location = new Point(125, 47);
statusBox.Name = "statusBox";
statusBox.Size = new Size(121, 23);
statusBox.Size = new Size(178, 33);
statusBox.TabIndex = 16;
//
// caseBox
@ -102,12 +105,30 @@
caseBox.FormattingEnabled = true;
caseBox.Location = new Point(125, 7);
caseBox.Name = "caseBox";
caseBox.Size = new Size(121, 23);
caseBox.Size = new Size(121, 33);
caseBox.TabIndex = 17;
//
// priceLabel
//
priceLabel.Location = new Point(10, 98);
priceLabel.Name = "priceLabel";
priceLabel.Size = new Size(100, 23);
priceLabel.TabIndex = 18;
priceLabel.Text = "Цена:";
//
// priceNumeric
//
priceNumeric.DecimalPlaces = 2;
priceNumeric.Location = new Point(123, 99);
priceNumeric.Name = "priceNumeric";
priceNumeric.Size = new Size(180, 31);
priceNumeric.TabIndex = 19;
//
// FormStatusHistory
//
ClientSize = new Size(284, 163);
ClientSize = new Size(374, 324);
Controls.Add(priceNumeric);
Controls.Add(priceLabel);
Controls.Add(caseBox);
Controls.Add(statusBox);
Controls.Add(caseLabel);
@ -119,6 +140,7 @@
Name = "FormStatusHistory";
StartPosition = FormStartPosition.CenterScreen;
Text = "Хронология статусов";
((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit();
ResumeLayout(false);
}
@ -133,5 +155,7 @@
private Label caseLabel;
private ComboBox statusBox;
private ComboBox caseBox;
private Label priceLabel;
private NumericUpDown priceNumeric;
}
}

View File

@ -1,4 +1,5 @@
using ProjectGSM.Entities;
using ProjectGSM.Entities.Enums;
using ProjectGSM.Repositories;
namespace ProjectGSM.Forms
@ -9,8 +10,7 @@ namespace ProjectGSM.Forms
private readonly IStatusHistoryRepository _statusHistoryRepository;
public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository,
IStatusRepository statusRepository, ICaseRepository caseRepository)
public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository, ICaseRepository caseRepository)
{
InitializeComponent();
_statusHistoryRepository = statusHistoryRepository ??
@ -25,24 +25,18 @@ namespace ProjectGSM.Forms
}
catch (Exception ex) { }
try
{
statusBox.DataSource = statusRepository.ReadStatuses();
statusBox.DisplayMember = "Name";
statusBox.SelectedIndex = 0;
}
catch (Exception ex) { }
statusBox.DataSource = Enum.GetValues(typeof(Status));
}
private void saveButton_Click(object sender, EventArgs e)
{
try
{
if (caseBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0)
if (caseBox.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity(caseBox.SelectedIndex, statusBox.SelectedIndex, dateTimePicker1.Value));
_statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity(caseBox.SelectedIndex, (Status)statusBox.SelectedIndex!, priceNumeric.Value, dateTimePicker1.Value));
Close();
}
catch (Exception ex)

View File

@ -1,130 +0,0 @@
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

@ -1,114 +0,0 @@
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

@ -1,120 +0,0 @@
<?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,92 +0,0 @@
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

@ -1,77 +0,0 @@
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

@ -1,120 +0,0 @@
<?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,130 +0,0 @@
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

@ -1,123 +0,0 @@
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

@ -1,120 +0,0 @@
<?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

@ -28,9 +28,7 @@ namespace ProjectGSM
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

@ -15,30 +15,12 @@
<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>
@ -66,10 +48,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Entities\Enums\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>

View File

@ -1,12 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -12,7 +12,7 @@ public class AdvocateRepository : IAdvocateRepository
public Advocate ReadAdvocateById(int id)
{
return Advocate.CreateEntity(0, String.Empty, false, DateTime.UtcNow, 0, 0, 0, String.Empty, String.Empty,
String.Empty);
String.Empty, Entities.Enums.LicenseType.None);
}
public void CreateAdvocate(Advocate advocate)

View File

@ -11,7 +11,7 @@ public class CaseRepository : ICaseRepository
public Case ReadCaseById(int id)
{
return Case.CreateEntity(0, 0, false, 0, 0, 0, false, 0, 0, String.Empty);
return Case.CreateEntity(0, 0, false, 0, 0, false, 0, 0, String.Empty);
}
public void CreateCase(Case caseEntity)

View File

@ -1,28 +0,0 @@
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

@ -1,28 +0,0 @@
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)
{
}
}