diff --git a/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/.gitignore b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/.gitignore new file mode 100644 index 0000000..7930bcf --- /dev/null +++ b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/modules.xml +/.idea.ProjectGSM.iml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/encodings.xml b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/indexLayout.xml b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/vcs.xml b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ProjectGSM/.idea/.idea.ProjectGSM.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ProjectGSM/Entities/Advocate.cs b/ProjectGSM/Entities/Advocate.cs new file mode 100644 index 0000000..ce2144b --- /dev/null +++ b/ProjectGSM/Entities/Advocate.cs @@ -0,0 +1,45 @@ +namespace ProjectGSM.Entities; + +public class Advocate +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public bool Sex { get; private set; } + public DateTime DateOfBirth { get; private set; } + public int Experience { get; private set; } + public int CompletedTasks { get; private set; } + public int Rating { get; private set; } + public string Email { get; private set; } = string.Empty; + public string PhoneNumber { get; private set; } = string.Empty; + public string Address { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static Advocate CreateEntity( + int id, + string name, + bool sex, + DateTime dateOfBirth, + int experience, + int completedTasks, + int rating, + string email, + string phoneNumber, + string address) + { + return new Advocate + { + Id = id, + Name = name ?? string.Empty, + Sex = sex, + DateOfBirth = dateOfBirth, + Experience = experience, + CompletedTasks = completedTasks, + Rating = rating, + Email = email ?? string.Empty, + PhoneNumber = phoneNumber ?? string.Empty, + Address = address ?? string.Empty, + CreatedAt = DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/Case.cs b/ProjectGSM/Entities/Case.cs new file mode 100644 index 0000000..b28b706 --- /dev/null +++ b/ProjectGSM/Entities/Case.cs @@ -0,0 +1,46 @@ +namespace ProjectGSM.Entities; + +public class Case +{ + public int Id { get; private set; } + public int TypeAppealId { get; private set; } + public bool Payment { get; private set; } = false; + public decimal Price { get; private set; } + public decimal VictoryPrice { get; private set; } + public int StatusId { get; private set; } + public bool Verdict { get; private set; } = false; + public int CourtId { get; private set; } + public int ClientId { get; private set; } + public string Description { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static Case CreateEntity( + int id, + int typeAppealId, + bool payment, + decimal price, + decimal victoryPrice, + int statusId, + bool verdict, + int courtId, + int clientId, + string description + ) + { + return new Case + { + Id = id, + TypeAppealId = typeAppealId, + Payment = payment, + Price = price, + VictoryPrice = victoryPrice, + StatusId = statusId, + Verdict = verdict, + CourtId = courtId, + ClientId = clientId, + Description = description ?? string.Empty, + CreatedAt = DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/CaseAdvocate.cs b/ProjectGSM/Entities/CaseAdvocate.cs new file mode 100644 index 0000000..7d9a309 --- /dev/null +++ b/ProjectGSM/Entities/CaseAdvocate.cs @@ -0,0 +1,19 @@ +namespace ProjectGSM.Entities; + +public class CaseAdvocate +{ + public int CaseId { get; private set; } + public int AdvocateId { get; private set; } + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static CaseAdvocate CreateEntity(int caseId, int advocateId) + { + return new CaseAdvocate + { + CaseId = caseId, + AdvocateId = advocateId, + CreatedAt = DateTime.UtcNow + }; + } +} \ No newline at end of file diff --git a/ProjectGSM/Entities/Client.cs b/ProjectGSM/Entities/Client.cs new file mode 100644 index 0000000..4af304b --- /dev/null +++ b/ProjectGSM/Entities/Client.cs @@ -0,0 +1,36 @@ +namespace ProjectGSM.Entities; + +public class Client +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public bool Sex { get; private set; } + public DateTime DateOfBirth { get; private set; } + public string Email { get; private set; } = string.Empty; + public string PhoneNumber { get; private set; } = string.Empty; + public string Address { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static Client CreateEntity( + int id, + string name, + bool sex, + DateTime dateOfBirth, + string email, + string phoneNumber, + string address) + { + return new Client + { + Id = id, + Name = name ?? string.Empty, + Sex = sex, + DateOfBirth = dateOfBirth, + Email = email ?? string.Empty, + PhoneNumber = phoneNumber ?? string.Empty, + Address = address ?? string.Empty, + CreatedAt = DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/Court.cs b/ProjectGSM/Entities/Court.cs new file mode 100644 index 0000000..8e3dc35 --- /dev/null +++ b/ProjectGSM/Entities/Court.cs @@ -0,0 +1,21 @@ +namespace ProjectGSM.Entities; + +public class Court +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public string Address { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static Court CreateEntity(int id, string name, string address, DateTime? createdAt = null) + { + return new Court + { + Id = id, + Name = name ?? string.Empty, + Address = address ?? string.Empty, + CreatedAt = createdAt ?? DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/Status.cs b/ProjectGSM/Entities/Status.cs new file mode 100644 index 0000000..049f119 --- /dev/null +++ b/ProjectGSM/Entities/Status.cs @@ -0,0 +1,21 @@ +namespace ProjectGSM.Entities; + +public class Status +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + public decimal? Price { get; private set; } + + // Конструктор для создания сущности + public static Status CreateEntity(int id, string name, decimal? price = null, DateTime? dateTime = null) + { + return new Status + { + Id = id, + Name = name ?? string.Empty, + Price = price, + CreatedAt = dateTime ?? DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/StatusHistory.cs b/ProjectGSM/Entities/StatusHistory.cs new file mode 100644 index 0000000..ee4aa33 --- /dev/null +++ b/ProjectGSM/Entities/StatusHistory.cs @@ -0,0 +1,19 @@ +namespace ProjectGSM.Entities; + +public class StatusHistory +{ + public int CaseId { get; private set; } + public int StatusId { get; private set; } + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static StatusHistory CreateEntity(int caseId, int statusId, DateTime? dateTime = null) + { + return new StatusHistory + { + CaseId = caseId, + StatusId = statusId, + CreatedAt = dateTime ?? DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Entities/TypeAppeal.cs b/ProjectGSM/Entities/TypeAppeal.cs new file mode 100644 index 0000000..4b0dd6d --- /dev/null +++ b/ProjectGSM/Entities/TypeAppeal.cs @@ -0,0 +1,19 @@ +namespace ProjectGSM.Entities; + +public class TypeAppeal +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; + + // Конструктор для создания сущности + public static TypeAppeal CreateEntity(int id, string name) + { + return new TypeAppeal + { + Id = id, + Name = name ?? string.Empty, + CreatedAt = DateTime.UtcNow + }; + } +} diff --git a/ProjectGSM/Form1.Designer.cs b/ProjectGSM/Form1.Designer.cs deleted file mode 100644 index 78f42e6..0000000 --- a/ProjectGSM/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectGSM -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} diff --git a/ProjectGSM/Form1.cs b/ProjectGSM/Form1.cs deleted file mode 100644 index 07e9ed7..0000000 --- a/ProjectGSM/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectGSM -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectGSM/FormAdvocateApp.Designer.cs b/ProjectGSM/FormAdvocateApp.Designer.cs new file mode 100644 index 0000000..1439ed5 --- /dev/null +++ b/ProjectGSM/FormAdvocateApp.Designer.cs @@ -0,0 +1,156 @@ +namespace ProjectGSM +{ + partial class FormAdvocateApp + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.MenuStrip menuStrip; + private System.Windows.Forms.ToolStripMenuItem directoriesMenuItem; + private System.Windows.Forms.ToolStripMenuItem operationsMenuItem; + private System.Windows.Forms.ToolStripMenuItem reportsMenuItem; // Новый пункт "Отчеты" + private System.Windows.Forms.ToolStripMenuItem clientsMenuItem; + private System.Windows.Forms.ToolStripMenuItem advocatesMenuItem; + private System.Windows.Forms.ToolStripMenuItem casesMenuItem; + private System.Windows.Forms.ToolStripMenuItem caseAdvocateRepositoryMenuItem; + private System.Windows.Forms.ToolStripMenuItem statusHistoryRepositoryMenuItem; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + menuStrip = new MenuStrip(); + directoriesMenuItem = new ToolStripMenuItem(); + clientsMenuItem = new ToolStripMenuItem(); + advocatesMenuItem = new ToolStripMenuItem(); + casesMenuItem = new ToolStripMenuItem(); + typeAppealsToolStripMenuItem = new ToolStripMenuItem(); + courtsToolStripMenuItem = new ToolStripMenuItem(); + operationsMenuItem = new ToolStripMenuItem(); + caseAdvocateRepositoryMenuItem = new ToolStripMenuItem(); + statusHistoryRepositoryMenuItem = new ToolStripMenuItem(); + reportsMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { directoriesMenuItem, operationsMenuItem, reportsMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Padding = new Padding(7, 2, 0, 2); + menuStrip.Size = new Size(933, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip"; + // + // directoriesMenuItem + // + directoriesMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsMenuItem, advocatesMenuItem, casesMenuItem, typeAppealsToolStripMenuItem, courtsToolStripMenuItem }); + directoriesMenuItem.Name = "directoriesMenuItem"; + directoriesMenuItem.Size = new Size(94, 20); + directoriesMenuItem.Text = "Справочники"; + // + // clientsMenuItem + // + clientsMenuItem.Name = "clientsMenuItem"; + clientsMenuItem.Size = new Size(161, 22); + clientsMenuItem.Text = "Клиенты"; + clientsMenuItem.Click += clientsMenuItem_Click_1; + // + // advocatesMenuItem + // + advocatesMenuItem.Name = "advocatesMenuItem"; + advocatesMenuItem.Size = new Size(161, 22); + advocatesMenuItem.Text = "Адвокаты"; + advocatesMenuItem.Click += advocatesMenuItem_Click; + // + // casesMenuItem + // + casesMenuItem.Name = "casesMenuItem"; + casesMenuItem.Size = new Size(161, 22); + casesMenuItem.Text = "Дела"; + casesMenuItem.Click += casesMenuItem_Click; + // + // typeAppealsToolStripMenuItem + // + typeAppealsToolStripMenuItem.Name = "typeAppealsToolStripMenuItem"; + typeAppealsToolStripMenuItem.Size = new Size(161, 22); + typeAppealsToolStripMenuItem.Text = "Тип обращения"; + typeAppealsToolStripMenuItem.Click += typeAppealsToolStripMenuItem_Click; + // + // courtsToolStripMenuItem + // + courtsToolStripMenuItem.Name = "courtsToolStripMenuItem"; + courtsToolStripMenuItem.Size = new Size(161, 22); + courtsToolStripMenuItem.Text = "Суды"; + courtsToolStripMenuItem.Click += courtsToolStripMenuItem_Click; + // + // operationsMenuItem + // + operationsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { caseAdvocateRepositoryMenuItem, statusHistoryRepositoryMenuItem }); + operationsMenuItem.Name = "operationsMenuItem"; + operationsMenuItem.Size = new Size(75, 20); + operationsMenuItem.Text = "Операции"; + // + // caseAdvocateRepositoryMenuItem + // + caseAdvocateRepositoryMenuItem.Name = "caseAdvocateRepositoryMenuItem"; + caseAdvocateRepositoryMenuItem.Size = new Size(221, 22); + caseAdvocateRepositoryMenuItem.Text = "Привязка адвокатов к делу"; + caseAdvocateRepositoryMenuItem.Click += caseAdvocateRepositoryMenuItem_Click; + // + // statusHistoryRepositoryMenuItem + // + statusHistoryRepositoryMenuItem.Name = "statusHistoryRepositoryMenuItem"; + statusHistoryRepositoryMenuItem.Size = new Size(221, 22); + statusHistoryRepositoryMenuItem.Text = "Хронология статусов"; + statusHistoryRepositoryMenuItem.Click += statusHistoryRepositoryMenuItem_Click; + // + // reportsMenuItem + // + reportsMenuItem.Name = "reportsMenuItem"; + reportsMenuItem.Size = new Size(60, 20); + reportsMenuItem.Text = "Отчеты"; + // + // FormAdvocateApp + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.maxresdefault; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(933, 519); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Margin = new Padding(4, 3, 4, 3); + Name = "FormAdvocateApp"; + Text = "Шарашкина контора"; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ToolStripMenuItem typeAppealsToolStripMenuItem; + private ToolStripMenuItem courtsToolStripMenuItem; + } +} diff --git a/ProjectGSM/FormAdvocateApp.cs b/ProjectGSM/FormAdvocateApp.cs new file mode 100644 index 0000000..a70a98b --- /dev/null +++ b/ProjectGSM/FormAdvocateApp.cs @@ -0,0 +1,107 @@ +using ProjectGSM.Forms; +using System.ComponentModel; +using Unity; + +namespace ProjectGSM +{ + public partial class FormAdvocateApp : Form + { + private readonly IUnityContainer _container; + public FormAdvocateApp(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? +throw new ArgumentNullException(nameof(container)); + } + private void clientsMenuItem_Click_1(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void advocatesMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void casesMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void typeAppealsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void courtsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void caseAdvocateRepositoryMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void statusHistoryRepositoryMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/ProjectGSM/FormAdvocateApp.resx b/ProjectGSM/FormAdvocateApp.resx new file mode 100644 index 0000000..31084d5 --- /dev/null +++ b/ProjectGSM/FormAdvocateApp.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormAdvocate.Designer.cs b/ProjectGSM/Forms/FormAdvocate.Designer.cs new file mode 100644 index 0000000..cd57418 --- /dev/null +++ b/ProjectGSM/Forms/FormAdvocate.Designer.cs @@ -0,0 +1,270 @@ +namespace ProjectGSM.Forms +{ + partial class FormAdvocate + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + nameLabel = new Label(); + nameTextBox = new TextBox(); + expLabel = new Label(); + saveButton = new Button(); + cancelButton = new Button(); + sex = new Label(); + sexCheckBox = new CheckBox(); + DateLabel = new Label(); + dateTimePicker = new DateTimePicker(); + PhoneLabel = new Label(); + phoneText = new TextBox(); + adressLabel = new Label(); + adressBox = new TextBox(); + expNumeric = new NumericUpDown(); + tasksLabel = new Label(); + tasksNumeric = new NumericUpDown(); + ratingLabel = new Label(); + ratingNumeric = new NumericUpDown(); + emailLabel = new Label(); + emailTextBox = new TextBox(); + ((System.ComponentModel.ISupportInitialize)expNumeric).BeginInit(); + ((System.ComponentModel.ISupportInitialize)tasksNumeric).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ratingNumeric).BeginInit(); + SuspendLayout(); + // + // nameLabel + // + nameLabel.Location = new Point(10, 10); + nameLabel.Name = "nameLabel"; + nameLabel.Size = new Size(100, 23); + nameLabel.TabIndex = 0; + nameLabel.Text = "Имя адвоката:"; + // + // nameTextBox + // + nameTextBox.Location = new Point(120, 10); + nameTextBox.Name = "nameTextBox"; + nameTextBox.Size = new Size(116, 23); + nameTextBox.TabIndex = 1; + // + // expLabel + // + expLabel.Location = new Point(10, 90); + expLabel.Name = "expLabel"; + expLabel.Size = new Size(100, 23); + expLabel.TabIndex = 2; + expLabel.Text = "Опыт:"; + // + // saveButton + // + saveButton.Location = new Point(122, 303); + saveButton.Name = "saveButton"; + saveButton.Size = new Size(75, 23); + saveButton.TabIndex = 4; + saveButton.Text = "Сохранить"; + saveButton.Click += saveButton_Click; + // + // cancelButton + // + cancelButton.Location = new Point(203, 303); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new Size(75, 23); + cancelButton.TabIndex = 5; + cancelButton.Text = "Отмена"; + cancelButton.Click += cancelButton_Click; + // + // sex + // + sex.Location = new Point(10, 38); + sex.Name = "sex"; + sex.Size = new Size(100, 23); + sex.TabIndex = 0; + sex.Text = "Пол:"; + // + // sexCheckBox + // + sexCheckBox.AutoSize = true; + sexCheckBox.Location = new Point(120, 37); + sexCheckBox.Name = "sexCheckBox"; + sexCheckBox.Size = new Size(77, 19); + sexCheckBox.TabIndex = 6; + sexCheckBox.Text = "мужчина"; + sexCheckBox.UseVisualStyleBackColor = true; + // + // DateLabel + // + DateLabel.Location = new Point(10, 61); + DateLabel.Name = "DateLabel"; + DateLabel.Size = new Size(100, 23); + DateLabel.TabIndex = 7; + DateLabel.Text = "Дата рождения:"; + // + // dateTimePicker + // + dateTimePicker.Location = new Point(116, 61); + dateTimePicker.Name = "dateTimePicker"; + dateTimePicker.Size = new Size(120, 23); + dateTimePicker.TabIndex = 8; + // + // PhoneLabel + // + PhoneLabel.Location = new Point(10, 217); + PhoneLabel.Name = "PhoneLabel"; + PhoneLabel.Size = new Size(111, 23); + PhoneLabel.TabIndex = 9; + PhoneLabel.Text = "Номер телефона:"; + // + // phoneText + // + phoneText.Location = new Point(116, 217); + phoneText.Name = "phoneText"; + phoneText.Size = new Size(120, 23); + phoneText.TabIndex = 10; + // + // adressLabel + // + adressLabel.Location = new Point(12, 249); + adressLabel.Name = "adressLabel"; + adressLabel.Size = new Size(111, 23); + adressLabel.TabIndex = 11; + adressLabel.Text = "Адрес:"; + // + // adressBox + // + adressBox.Location = new Point(116, 246); + adressBox.Name = "adressBox"; + adressBox.Size = new Size(120, 23); + adressBox.TabIndex = 12; + // + // expNumeric + // + expNumeric.Location = new Point(116, 90); + expNumeric.Name = "expNumeric"; + expNumeric.Size = new Size(120, 23); + expNumeric.TabIndex = 13; + // + // tasksLabel + // + tasksLabel.Location = new Point(10, 119); + tasksLabel.Name = "tasksLabel"; + tasksLabel.Size = new Size(100, 23); + tasksLabel.TabIndex = 15; + tasksLabel.Text = "Решенные дела:"; + // + // tasksNumeric + // + tasksNumeric.Location = new Point(116, 119); + tasksNumeric.Name = "tasksNumeric"; + tasksNumeric.Size = new Size(120, 23); + tasksNumeric.TabIndex = 16; + // + // ratingLabel + // + ratingLabel.Location = new Point(10, 154); + ratingLabel.Name = "ratingLabel"; + ratingLabel.Size = new Size(100, 23); + ratingLabel.TabIndex = 17; + ratingLabel.Text = "Рейтинг:"; + // + // ratingNumeric + // + ratingNumeric.Location = new Point(116, 152); + ratingNumeric.Name = "ratingNumeric"; + ratingNumeric.Size = new Size(120, 23); + ratingNumeric.TabIndex = 18; + // + // emailLabel + // + emailLabel.Location = new Point(11, 184); + emailLabel.Name = "emailLabel"; + emailLabel.Size = new Size(111, 23); + emailLabel.TabIndex = 19; + emailLabel.Text = "Email:"; + // + // emailTextBox + // + emailTextBox.Location = new Point(116, 184); + emailTextBox.Name = "emailTextBox"; + emailTextBox.Size = new Size(120, 23); + emailTextBox.TabIndex = 20; + // + // FormAdvocate + // + ClientSize = new Size(284, 338); + Controls.Add(emailTextBox); + Controls.Add(emailLabel); + Controls.Add(ratingNumeric); + Controls.Add(ratingLabel); + Controls.Add(tasksNumeric); + Controls.Add(tasksLabel); + Controls.Add(expNumeric); + Controls.Add(adressBox); + Controls.Add(adressLabel); + Controls.Add(phoneText); + Controls.Add(PhoneLabel); + Controls.Add(dateTimePicker); + Controls.Add(DateLabel); + Controls.Add(sexCheckBox); + Controls.Add(sex); + Controls.Add(nameLabel); + Controls.Add(nameTextBox); + Controls.Add(expLabel); + Controls.Add(saveButton); + Controls.Add(cancelButton); + Name = "FormAdvocate"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Адвокат"; + ((System.ComponentModel.ISupportInitialize)expNumeric).EndInit(); + ((System.ComponentModel.ISupportInitialize)tasksNumeric).EndInit(); + ((System.ComponentModel.ISupportInitialize)ratingNumeric).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label nameLabel; + private TextBox nameTextBox; + + private Label expLabel; + + private Button saveButton; + private Button cancelButton; + private Label sex; + private Label tasksLabel; + private CheckBox sexCheckBox; + private Label DateLabel; + private DateTimePicker dateTimePicker; + private Label PhoneLabel; + private TextBox phoneText; + private Label adressLabel; + private TextBox adressBox; + private NumericUpDown expNumeric; + private NumericUpDown tasksNumeric; + private Label ratingLabel; + private NumericUpDown ratingNumeric; + private Label emailLabel; + private TextBox emailTextBox; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormAdvocate.cs b/ProjectGSM/Forms/FormAdvocate.cs new file mode 100644 index 0000000..3fccacd --- /dev/null +++ b/ProjectGSM/Forms/FormAdvocate.cs @@ -0,0 +1,96 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; + +namespace ProjectGSM.Forms +{ + + public partial class FormAdvocate : Form + { + private readonly IAdvocateRepository _advocateRepository; + + private int? _advocateId; + + public int Id + { + set + { + try + { + var advocate = + _advocateRepository.ReadAdvocateById(value); + if (advocate == null) + { + throw new + InvalidDataException(nameof(advocate)); + } + nameTextBox.Text = advocate.Name; + sexCheckBox.Checked= advocate.Sex; + dateTimePicker.Value = new DateTime(advocate.DateOfBirth.Year, advocate.DateOfBirth.Month, advocate.DateOfBirth.Day); + expNumeric.Value = advocate.Experience; + tasksNumeric.Value = advocate.CompletedTasks; + ratingNumeric.Value = advocate.Rating; + emailTextBox.Text = advocate.Email; + phoneText.Text = advocate.PhoneNumber; + adressBox.Text = advocate.Address; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormAdvocate(IAdvocateRepository advocateRepository) + { + InitializeComponent(); + _advocateRepository = advocateRepository ?? + throw new + ArgumentNullException(nameof(advocateRepository)); + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(nameTextBox.Text) || + string.IsNullOrWhiteSpace(emailTextBox.Text) || + string.IsNullOrWhiteSpace(phoneText.Text) || + string.IsNullOrWhiteSpace(adressBox.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_advocateId.HasValue) + { + _advocateRepository.UpdateAdvocate(CreateAdvocate(_advocateId.Value)); + } + else + { + _advocateRepository.UpdateAdvocate(CreateAdvocate(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private Advocate CreateAdvocate(int id) => Advocate.CreateEntity(id, + nameTextBox.Text, + sexCheckBox.Checked, + dateTimePicker.Value, + Convert.ToInt32(expNumeric.Value), + Convert.ToInt32(tasksNumeric.Value), + Convert.ToInt32(ratingNumeric.Value), + emailTextBox.Text, + phoneText.Text, + adressBox.Text); + + } +} diff --git a/ProjectGSM/Form1.resx b/ProjectGSM/Forms/FormAdvocate.resx similarity index 92% rename from ProjectGSM/Form1.resx rename to ProjectGSM/Forms/FormAdvocate.resx index 1af7de1..8b2ff64 100644 --- a/ProjectGSM/Form1.resx +++ b/ProjectGSM/Forms/FormAdvocate.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectGSM/Forms/FormAdvocates.Designer.cs b/ProjectGSM/Forms/FormAdvocates.Designer.cs new file mode 100644 index 0000000..d4f88e5 --- /dev/null +++ b/ProjectGSM/Forms/FormAdvocates.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormAdvocates + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panel1 = new Panel(); + deleteButton = new Button(); + editButton = new Button(); + addButton = new Button(); + dataGridView1 = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(deleteButton); + panel1.Controls.Add(editButton); + panel1.Controls.Add(addButton); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(142, 450); + panel1.TabIndex = 0; + // + // deleteButton + // + deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com; + deleteButton.BackgroundImageLayout = ImageLayout.Zoom; + deleteButton.Location = new Point(33, 240); + deleteButton.Name = "deleteButton"; + deleteButton.Size = new Size(75, 75); + deleteButton.TabIndex = 2; + deleteButton.Text = " "; + deleteButton.UseVisualStyleBackColor = true; + deleteButton.Click += deleteButton_Click; + // + // editButton + // + editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com; + editButton.BackgroundImageLayout = ImageLayout.Zoom; + editButton.Location = new Point(33, 139); + editButton.Name = "editButton"; + editButton.Size = new Size(75, 75); + editButton.TabIndex = 1; + editButton.Text = " "; + editButton.UseVisualStyleBackColor = true; + editButton.Click += editButton_Click; + // + // addButton + // + addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com; + addButton.BackgroundImageLayout = ImageLayout.Zoom; + addButton.Location = new Point(33, 38); + addButton.Name = "addButton"; + addButton.Size = new Size(75, 75); + addButton.TabIndex = 0; + addButton.Text = " "; + addButton.UseVisualStyleBackColor = true; + addButton.Click += addButton_Click; + // + // dataGridView1 + // + dataGridView1.AllowUserToAddRows = false; + dataGridView1.AllowUserToDeleteRows = false; + dataGridView1.AllowUserToResizeColumns = false; + dataGridView1.AllowUserToResizeRows = false; + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView1.BackgroundColor = SystemColors.Info; + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Dock = DockStyle.Fill; + dataGridView1.Location = new Point(0, 0); + dataGridView1.MultiSelect = false; + dataGridView1.Name = "dataGridView1"; + dataGridView1.ReadOnly = true; + dataGridView1.RowHeadersVisible = false; + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.Size = new Size(604, 450); + dataGridView1.TabIndex = 1; + // + // FormAdvocates + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(746, 450); + Controls.Add(dataGridView1); + Controls.Add(panel1); + Name = "FormAdvocates"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Адвокаты"; + Load += FormClients_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button deleteButton; + private Button editButton; + private Button addButton; + private DataGridView dataGridView1; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormAdvocates.cs b/ProjectGSM/Forms/FormAdvocates.cs new file mode 100644 index 0000000..00a8683 --- /dev/null +++ b/ProjectGSM/Forms/FormAdvocates.cs @@ -0,0 +1,123 @@ +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormAdvocates : Form + { + private readonly IUnityContainer _container; + + private readonly IAdvocateRepository _advocateRepository; + public FormAdvocates(IUnityContainer container, IAdvocateRepository advocateRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _advocateRepository = advocateRepository ?? + throw new + ArgumentNullException(nameof(advocateRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _advocateRepository.DeleteAdvocate(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void FormClients_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void LoadList() => dataGridView1.DataSource = +_advocateRepository.ReadAdvocates(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView1.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + return true; + } + + } +} diff --git a/ProjectGSM/Forms/FormAdvocates.resx b/ProjectGSM/Forms/FormAdvocates.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormAdvocates.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormBase.Designer.cs b/ProjectGSM/Forms/FormBase.Designer.cs new file mode 100644 index 0000000..e874d26 --- /dev/null +++ b/ProjectGSM/Forms/FormBase.Designer.cs @@ -0,0 +1,118 @@ +namespace ProjectGSM.Forms +{ + partial class FormBase + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + textBox1 = new TextBox(); + label1 = new Label(); + label2 = new Label(); + numericUpDown1 = new NumericUpDown(); + button1 = new Button(); + button2 = new Button(); + ((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit(); + SuspendLayout(); + // + // textBox1 + // + textBox1.Location = new Point(185, 43); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(120, 23); + textBox1.TabIndex = 0; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(61, 51); + label1.Name = "label1"; + label1.Size = new Size(38, 15); + label1.TabIndex = 1; + label1.Text = "label1"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(61, 106); + label2.Name = "label2"; + label2.Size = new Size(38, 15); + label2.TabIndex = 2; + label2.Text = "label2"; + // + // numericUpDown1 + // + numericUpDown1.Location = new Point(185, 98); + numericUpDown1.Name = "numericUpDown1"; + numericUpDown1.Size = new Size(120, 23); + numericUpDown1.TabIndex = 3; + // + // button1 + // + button1.Location = new Point(85, 268); + button1.Name = "button1"; + button1.Size = new Size(104, 35); + button1.TabIndex = 4; + button1.Text = "Сохранить"; + button1.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(211, 268); + button2.Name = "button2"; + button2.Size = new Size(104, 35); + button2.TabIndex = 5; + button2.Text = "Отмена"; + button2.UseVisualStyleBackColor = true; + // + // FormBase + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(385, 336); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(numericUpDown1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(textBox1); + Name = "FormBase"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиент"; + ((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox textBox1; + private Label label1; + private Label label2; + private NumericUpDown numericUpDown1; + private Button button1; + private Button button2; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormBase.cs b/ProjectGSM/Forms/FormBase.cs new file mode 100644 index 0000000..6d60bbf --- /dev/null +++ b/ProjectGSM/Forms/FormBase.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectGSM.Forms +{ + public partial class FormBase : Form + { + public FormBase() + { + InitializeComponent(); + } + } +} diff --git a/ProjectGSM/Forms/FormBase.resx b/ProjectGSM/Forms/FormBase.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormBase.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCase.Designer.cs b/ProjectGSM/Forms/FormCase.Designer.cs new file mode 100644 index 0000000..7b43630 --- /dev/null +++ b/ProjectGSM/Forms/FormCase.Designer.cs @@ -0,0 +1,288 @@ +namespace ProjectGSM.Forms +{ + partial class FormCase + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + typeApealLabel = new Label(); + paymentLabel = new Label(); + saveButton = new Button(); + cancelButton = new Button(); + priceLabel = new Label(); + StatusLabel = new Label(); + verdictLabel = new Label(); + typeApellBox = new ComboBox(); + paymentCheckBox = new CheckBox(); + priceNumeric = new NumericUpDown(); + winPriceLabel = new Label(); + winPriceNumeric = new NumericUpDown(); + statusBox = new ComboBox(); + verdictCheckBox = new CheckBox(); + courtBox = new ComboBox(); + courtLabel = new Label(); + clientBox = new ComboBox(); + clientLabel = new Label(); + descriptionLabel = new Label(); + textBox1 = new TextBox(); + ((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit(); + ((System.ComponentModel.ISupportInitialize)winPriceNumeric).BeginInit(); + SuspendLayout(); + // + // typeApealLabel + // + typeApealLabel.Location = new Point(10, 10); + typeApealLabel.Name = "typeApealLabel"; + typeApealLabel.Size = new Size(100, 23); + typeApealLabel.TabIndex = 0; + typeApealLabel.Text = "Тип обращения:"; + // + // paymentLabel + // + paymentLabel.Location = new Point(10, 50); + paymentLabel.Name = "paymentLabel"; + paymentLabel.Size = new Size(100, 23); + paymentLabel.TabIndex = 2; + paymentLabel.Text = "Оплачено:"; + // + // saveButton + // + saveButton.Location = new Point(118, 375); + saveButton.Name = "saveButton"; + saveButton.Size = new Size(75, 23); + saveButton.TabIndex = 4; + saveButton.Text = "Сохранить"; + saveButton.Click += saveButton_Click; + // + // cancelButton + // + cancelButton.Location = new Point(197, 375); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new Size(75, 23); + cancelButton.TabIndex = 5; + cancelButton.Text = "Отмена"; + cancelButton.Click += cancelButton_Click; + // + // priceLabel + // + priceLabel.Location = new Point(10, 89); + priceLabel.Name = "priceLabel"; + priceLabel.Size = new Size(100, 23); + priceLabel.TabIndex = 0; + priceLabel.Text = "Цена:"; + // + // StatusLabel + // + StatusLabel.Location = new Point(10, 157); + StatusLabel.Name = "StatusLabel"; + StatusLabel.Size = new Size(111, 23); + StatusLabel.TabIndex = 9; + StatusLabel.Text = "Текущий статус:"; + // + // verdictLabel + // + verdictLabel.Location = new Point(10, 191); + verdictLabel.Name = "verdictLabel"; + verdictLabel.Size = new Size(111, 23); + verdictLabel.TabIndex = 11; + verdictLabel.Text = "Вердикт:"; + // + // typeApellBox + // + typeApellBox.DropDownStyle = ComboBoxStyle.DropDownList; + typeApellBox.FormattingEnabled = true; + typeApellBox.Location = new Point(116, 10); + typeApellBox.Name = "typeApellBox"; + typeApellBox.Size = new Size(121, 23); + typeApellBox.TabIndex = 13; + // + // paymentCheckBox + // + paymentCheckBox.AutoSize = true; + paymentCheckBox.Location = new Point(120, 49); + paymentCheckBox.Name = "paymentCheckBox"; + paymentCheckBox.Size = new Size(76, 19); + paymentCheckBox.TabIndex = 14; + paymentCheckBox.Text = "успешно"; + paymentCheckBox.UseVisualStyleBackColor = true; + // + // priceNumeric + // + priceNumeric.DecimalPlaces = 2; + priceNumeric.Location = new Point(117, 87); + priceNumeric.Name = "priceNumeric"; + priceNumeric.Size = new Size(120, 23); + priceNumeric.TabIndex = 15; + // + // winPriceLabel + // + winPriceLabel.Location = new Point(10, 122); + winPriceLabel.Name = "winPriceLabel"; + winPriceLabel.Size = new Size(100, 23); + winPriceLabel.TabIndex = 16; + winPriceLabel.Text = "Победная цена:"; + // + // winPriceNumeric + // + winPriceNumeric.DecimalPlaces = 2; + winPriceNumeric.Location = new Point(117, 122); + winPriceNumeric.Name = "winPriceNumeric"; + winPriceNumeric.Size = new Size(120, 23); + winPriceNumeric.TabIndex = 17; + // + // statusBox + // + statusBox.DropDownStyle = ComboBoxStyle.DropDownList; + statusBox.FormattingEnabled = true; + statusBox.Location = new Point(116, 157); + statusBox.Name = "statusBox"; + statusBox.Size = new Size(121, 23); + statusBox.TabIndex = 18; + // + // verdictCheckBox + // + verdictCheckBox.AutoSize = true; + verdictCheckBox.Location = new Point(117, 191); + verdictCheckBox.Name = "verdictCheckBox"; + verdictCheckBox.Size = new Size(76, 19); + verdictCheckBox.TabIndex = 19; + verdictCheckBox.Text = "успешно"; + verdictCheckBox.UseVisualStyleBackColor = true; + // + // courtBox + // + courtBox.DropDownStyle = ComboBoxStyle.DropDownList; + courtBox.FormattingEnabled = true; + courtBox.Location = new Point(116, 224); + courtBox.Name = "courtBox"; + courtBox.Size = new Size(121, 23); + courtBox.TabIndex = 21; + // + // courtLabel + // + courtLabel.Location = new Point(10, 224); + courtLabel.Name = "courtLabel"; + courtLabel.Size = new Size(100, 23); + courtLabel.TabIndex = 20; + courtLabel.Text = "Суд:"; + // + // clientBox + // + clientBox.DropDownStyle = ComboBoxStyle.DropDownList; + clientBox.FormattingEnabled = true; + clientBox.Location = new Point(116, 262); + clientBox.Name = "clientBox"; + clientBox.Size = new Size(121, 23); + clientBox.TabIndex = 23; + // + // clientLabel + // + clientLabel.Location = new Point(10, 262); + clientLabel.Name = "clientLabel"; + clientLabel.Size = new Size(100, 23); + clientLabel.TabIndex = 22; + clientLabel.Text = "Клиент:"; + // + // descriptionLabel + // + descriptionLabel.Location = new Point(10, 296); + descriptionLabel.Name = "descriptionLabel"; + descriptionLabel.Size = new Size(100, 23); + descriptionLabel.TabIndex = 24; + descriptionLabel.Text = "Описание:"; + // + // textBox1 + // + textBox1.Location = new Point(118, 296); + textBox1.Multiline = true; + textBox1.Name = "textBox1"; + textBox1.Size = new Size(154, 73); + textBox1.TabIndex = 25; + // + // FormCase + // + ClientSize = new Size(284, 407); + Controls.Add(textBox1); + Controls.Add(descriptionLabel); + Controls.Add(clientBox); + Controls.Add(clientLabel); + Controls.Add(courtBox); + Controls.Add(courtLabel); + Controls.Add(verdictCheckBox); + Controls.Add(statusBox); + Controls.Add(winPriceNumeric); + Controls.Add(winPriceLabel); + Controls.Add(priceNumeric); + Controls.Add(paymentCheckBox); + Controls.Add(typeApellBox); + Controls.Add(verdictLabel); + Controls.Add(StatusLabel); + Controls.Add(priceLabel); + Controls.Add(typeApealLabel); + Controls.Add(paymentLabel); + Controls.Add(saveButton); + Controls.Add(cancelButton); + Name = "FormCase"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Дело"; + ((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit(); + ((System.ComponentModel.ISupportInitialize)winPriceNumeric).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label typeApealLabel; + + private Label paymentLabel; + private TextBox emailTextBox; + + private Button saveButton; + private Button cancelButton; + private Label priceLabel; + private Label label2; + private CheckBox sexCheckBox; + private Label DateLabel; + private DateTimePicker dateTimePicker; + private Label StatusLabel; + private TextBox phoneText; + private Label verdictLabel; + private ComboBox typeApellBox; + private CheckBox paymentCheckBox; + private NumericUpDown priceNumeric; + private Label winPriceLabel; + private NumericUpDown winPriceNumeric; + private ComboBox statusBox; + private CheckBox verdictCheckBox; + private ComboBox courtBox; + private Label courtLabel; + private ComboBox clientBox; + private Label clientLabel; + private Label descriptionLabel; + private TextBox textBox1; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCase.cs b/ProjectGSM/Forms/FormCase.cs new file mode 100644 index 0000000..98ed0ef --- /dev/null +++ b/ProjectGSM/Forms/FormCase.cs @@ -0,0 +1,118 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectGSM.Forms +{ + + public partial class FormCase : Form + { + private readonly ICaseRepository _caseRepository; + + private int? _caseId; + + public int Id + { + set + { + try + { + var caseE = + _caseRepository.ReadCaseById(value); + if (caseE == null) + { + throw new + InvalidDataException(nameof(caseE)); + } + typeApellBox.SelectedIndex = caseE.TypeAppealId; + clientBox.SelectedIndex = caseE.ClientId; + courtBox.SelectedIndex = caseE.CourtId; + statusBox.SelectedIndex = caseE.StatusId; + paymentCheckBox.Checked = caseE.Payment; + priceNumeric.Value = caseE.Price; + winPriceNumeric.Value = caseE.VictoryPrice; + verdictCheckBox.Checked= caseE.Verdict; + textBox1.Text = caseE.Description; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormCase(ICaseRepository caseRepository, IClientRepository clientRepository, ICourtRepository courtRepository, IStatusRepository statusRepository) + { + InitializeComponent(); + _caseRepository = caseRepository ?? + throw new + ArgumentNullException(nameof(caseRepository)); + + typeApellBox.DataSource = caseRepository.ReadCases(); + typeApellBox.DisplayMember = "Name"; + typeApellBox.ValueMember = "Id"; + + clientBox.DataSource = clientRepository.ReadClients(); + clientBox.DisplayMember = "Name"; + clientBox.ValueMember = "Id"; + + statusBox.DataSource = statusRepository.ReadStatuses(); + statusBox.DisplayMember = "Name"; + statusBox.ValueMember = "Id"; + + courtBox.DataSource = courtRepository.ReadCourts(); + courtBox.DisplayMember = "Name"; + courtBox.ValueMember = "Id"; + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + {if(typeApellBox.SelectedIndex < 0 || clientBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0 || courtBox.SelectedIndex < 0 + + ) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_caseId.HasValue) + { + _caseRepository.UpdateCase(CreateCase(_caseId.Value)); + } + else + { + _caseRepository.UpdateCase(CreateCase(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private Case CreateCase(int id) => Case.CreateEntity(id, + typeApellBox.SelectedIndex, + paymentCheckBox.Checked, + priceNumeric.Value, + winPriceNumeric.Value, + statusBox.SelectedIndex, + verdictCheckBox.Checked, + courtBox.SelectedIndex, + clientBox.SelectedIndex, + textBox1.Text); + } +} diff --git a/ProjectGSM/Forms/FormCase.resx b/ProjectGSM/Forms/FormCase.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCase.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCaseAdvocates.Designer.cs b/ProjectGSM/Forms/FormCaseAdvocates.Designer.cs new file mode 100644 index 0000000..198b534 --- /dev/null +++ b/ProjectGSM/Forms/FormCaseAdvocates.Designer.cs @@ -0,0 +1,116 @@ +namespace ProjectGSM.Forms +{ + partial class FormCaseAdvocates + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCaseAdvocates.cs b/ProjectGSM/Forms/FormCaseAdvocates.cs new file mode 100644 index 0000000..b5606c3 --- /dev/null +++ b/ProjectGSM/Forms/FormCaseAdvocates.cs @@ -0,0 +1,64 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; +using ProjectGSM.Repositories.Implementations; + +namespace ProjectGSM.Forms +{ + + public partial class FormCaseAdvocates : Form + { + private readonly ICaseAdvocateRepository _caseAdvocateRepository; + + + public FormCaseAdvocates(ICaseAdvocateRepository caseAdvocateRepository, + ICaseRepository caseRepository, IAdvocateRepository advocateRepository) + { + InitializeComponent(); + _caseAdvocateRepository = caseAdvocateRepository ?? + throw new + ArgumentNullException(nameof(caseAdvocateRepository)); + + + try + { + caseBox.DataSource = caseRepository.ReadCases(); + caseBox.DisplayMember = "Name"; + caseBox.SelectedIndex = 0; + } + catch (Exception ex) + { + } + try + { + advocateBox.DataSource = advocateRepository.ReadAdvocates(); + advocateBox.DisplayMember = "Name"; + advocateBox.SelectedIndex = 0; + } + catch (Exception ex) { } + + + + + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (caseBox.SelectedIndex < 0 || advocateBox.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + _caseAdvocateRepository.CreateCaseAdvocate(CaseAdvocate.CreateEntity(caseBox.SelectedIndex, advocateBox.SelectedIndex)); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + private void cancelButton_Click(object sender, EventArgs e) => Close(); + } +} diff --git a/ProjectGSM/Forms/FormCaseAdvocates.resx b/ProjectGSM/Forms/FormCaseAdvocates.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCaseAdvocates.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCases.Designer.cs b/ProjectGSM/Forms/FormCases.Designer.cs new file mode 100644 index 0000000..c6401a7 --- /dev/null +++ b/ProjectGSM/Forms/FormCases.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormCases + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panel1 = new Panel(); + deleteButton = new Button(); + editButton = new Button(); + addButton = new Button(); + dataGridView1 = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(deleteButton); + panel1.Controls.Add(editButton); + panel1.Controls.Add(addButton); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(142, 450); + panel1.TabIndex = 0; + // + // deleteButton + // + deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com; + deleteButton.BackgroundImageLayout = ImageLayout.Zoom; + deleteButton.Location = new Point(33, 240); + deleteButton.Name = "deleteButton"; + deleteButton.Size = new Size(75, 75); + deleteButton.TabIndex = 2; + deleteButton.Text = " "; + deleteButton.UseVisualStyleBackColor = true; + deleteButton.Click += deleteButton_Click; + // + // editButton + // + editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com; + editButton.BackgroundImageLayout = ImageLayout.Zoom; + editButton.Location = new Point(33, 139); + editButton.Name = "editButton"; + editButton.Size = new Size(75, 75); + editButton.TabIndex = 1; + editButton.Text = " "; + editButton.UseVisualStyleBackColor = true; + editButton.Click += editButton_Click; + // + // addButton + // + addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com; + addButton.BackgroundImageLayout = ImageLayout.Zoom; + addButton.Location = new Point(33, 38); + addButton.Name = "addButton"; + addButton.Size = new Size(75, 75); + addButton.TabIndex = 0; + addButton.Text = " "; + addButton.UseVisualStyleBackColor = true; + addButton.Click += addButton_Click; + // + // dataGridView1 + // + dataGridView1.AllowUserToAddRows = false; + dataGridView1.AllowUserToDeleteRows = false; + dataGridView1.AllowUserToResizeColumns = false; + dataGridView1.AllowUserToResizeRows = false; + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView1.BackgroundColor = SystemColors.Info; + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Dock = DockStyle.Fill; + dataGridView1.Location = new Point(0, 0); + dataGridView1.MultiSelect = false; + dataGridView1.Name = "dataGridView1"; + dataGridView1.ReadOnly = true; + dataGridView1.RowHeadersVisible = false; + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.Size = new Size(604, 450); + dataGridView1.TabIndex = 1; + // + // FormCases + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(746, 450); + Controls.Add(dataGridView1); + Controls.Add(panel1); + Name = "FormCases"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Дела"; + Load += FormClients_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button deleteButton; + private Button editButton; + private Button addButton; + private DataGridView dataGridView1; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCases.cs b/ProjectGSM/Forms/FormCases.cs new file mode 100644 index 0000000..3adba5c --- /dev/null +++ b/ProjectGSM/Forms/FormCases.cs @@ -0,0 +1,123 @@ +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormCases : Form + { + private readonly IUnityContainer _container; + + private readonly ICaseRepository _caseRepository; + public FormCases(IUnityContainer container, ICaseRepository caseRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _caseRepository = caseRepository ?? + throw new + ArgumentNullException(nameof(caseRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _caseRepository.DeleteCase(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void FormClients_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void LoadList() => dataGridView1.DataSource = +_caseRepository.ReadCases(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView1.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + return true; + } + + } +} diff --git a/ProjectGSM/Forms/FormCases.resx b/ProjectGSM/Forms/FormCases.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCases.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCasesAdvocates.Designer.cs b/ProjectGSM/Forms/FormCasesAdvocates.Designer.cs new file mode 100644 index 0000000..ad879a6 --- /dev/null +++ b/ProjectGSM/Forms/FormCasesAdvocates.Designer.cs @@ -0,0 +1,101 @@ +namespace ProjectGSM.Forms +{ + partial class FormCasesAdvocates + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCasesAdvocates.cs b/ProjectGSM/Forms/FormCasesAdvocates.cs new file mode 100644 index 0000000..079c6ed --- /dev/null +++ b/ProjectGSM/Forms/FormCasesAdvocates.cs @@ -0,0 +1,68 @@ +using ProjectGSM.Repositories; +using ProjectGSM.Repositories.Implementations; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormCasesAdvocates : Form + { + private readonly IUnityContainer _container; + + private readonly ICaseAdvocateRepository _caseAdvocateRepository; + public FormCasesAdvocates(IUnityContainer container, ICaseAdvocateRepository caseAdvocateRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _caseAdvocateRepository = caseAdvocateRepository ?? + throw new + ArgumentNullException(nameof(caseAdvocateRepository)); + + } + private void addButton_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().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; + } + } +} diff --git a/ProjectGSM/Forms/FormCasesAdvocates.resx b/ProjectGSM/Forms/FormCasesAdvocates.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCasesAdvocates.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormClient.Designer.cs b/ProjectGSM/Forms/FormClient.Designer.cs new file mode 100644 index 0000000..02c9cd1 --- /dev/null +++ b/ProjectGSM/Forms/FormClient.Designer.cs @@ -0,0 +1,202 @@ +namespace ProjectGSM.Forms +{ + partial class FormClient + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + nameLabel = new Label(); + nameTextBox = new TextBox(); + emailLabel = new Label(); + emailTextBox = new TextBox(); + saveButton = new Button(); + cancelButton = new Button(); + sex = new Label(); + sexCheckBox = new CheckBox(); + DateLabel = new Label(); + dateTimePicker = new DateTimePicker(); + PhoneLabel = new Label(); + phoneText = new TextBox(); + adressLabel = new Label(); + adressBox = new TextBox(); + SuspendLayout(); + // + // nameLabel + // + nameLabel.Location = new Point(10, 10); + nameLabel.Name = "nameLabel"; + nameLabel.Size = new Size(100, 23); + nameLabel.TabIndex = 0; + nameLabel.Text = "Имя клиента:"; + // + // nameTextBox + // + nameTextBox.Location = new Point(120, 10); + nameTextBox.Name = "nameTextBox"; + nameTextBox.Size = new Size(108, 23); + nameTextBox.TabIndex = 1; + // + // emailLabel + // + emailLabel.Location = new Point(10, 50); + emailLabel.Name = "emailLabel"; + emailLabel.Size = new Size(100, 23); + emailLabel.TabIndex = 2; + emailLabel.Text = "Email:"; + // + // emailTextBox + // + emailTextBox.Location = new Point(120, 50); + emailTextBox.Name = "emailTextBox"; + emailTextBox.Size = new Size(108, 23); + emailTextBox.TabIndex = 3; + // + // saveButton + // + saveButton.Location = new Point(117, 226); + saveButton.Name = "saveButton"; + saveButton.Size = new Size(75, 23); + saveButton.TabIndex = 4; + saveButton.Text = "Сохранить"; + saveButton.Click += saveButton_Click; + // + // cancelButton + // + cancelButton.Location = new Point(197, 226); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new Size(75, 23); + cancelButton.TabIndex = 5; + cancelButton.Text = "Отмена"; + cancelButton.Click += cancelButton_Click; + // + // sex + // + sex.Location = new Point(10, 89); + sex.Name = "sex"; + sex.Size = new Size(100, 23); + sex.TabIndex = 0; + sex.Text = "Пол:"; + // + // sexCheckBox + // + sexCheckBox.AutoSize = true; + sexCheckBox.Location = new Point(120, 88); + sexCheckBox.Name = "sexCheckBox"; + sexCheckBox.Size = new Size(77, 19); + sexCheckBox.TabIndex = 6; + sexCheckBox.Text = "мужчина"; + sexCheckBox.UseVisualStyleBackColor = true; + // + // DateLabel + // + DateLabel.Location = new Point(10, 121); + DateLabel.Name = "DateLabel"; + DateLabel.Size = new Size(100, 23); + DateLabel.TabIndex = 7; + DateLabel.Text = "Дата рождения:"; + // + // dateTimePicker + // + dateTimePicker.Location = new Point(116, 115); + dateTimePicker.Name = "dateTimePicker"; + dateTimePicker.Size = new Size(112, 23); + dateTimePicker.TabIndex = 8; + // + // PhoneLabel + // + PhoneLabel.Location = new Point(10, 157); + PhoneLabel.Name = "PhoneLabel"; + PhoneLabel.Size = new Size(111, 23); + PhoneLabel.TabIndex = 9; + PhoneLabel.Text = "Номер телефона:"; + // + // phoneText + // + phoneText.Location = new Point(120, 155); + phoneText.Name = "phoneText"; + phoneText.Size = new Size(108, 23); + phoneText.TabIndex = 10; + // + // adressLabel + // + adressLabel.Location = new Point(10, 191); + adressLabel.Name = "adressLabel"; + adressLabel.Size = new Size(111, 23); + adressLabel.TabIndex = 11; + adressLabel.Text = "Адрес:"; + // + // adressBox + // + adressBox.Location = new Point(120, 191); + adressBox.Name = "adressBox"; + adressBox.Size = new Size(108, 23); + adressBox.TabIndex = 12; + // + // FormClient + // + ClientSize = new Size(284, 261); + Controls.Add(adressBox); + Controls.Add(adressLabel); + Controls.Add(phoneText); + Controls.Add(PhoneLabel); + Controls.Add(dateTimePicker); + Controls.Add(DateLabel); + Controls.Add(sexCheckBox); + Controls.Add(sex); + Controls.Add(nameLabel); + Controls.Add(nameTextBox); + Controls.Add(emailLabel); + Controls.Add(emailTextBox); + Controls.Add(saveButton); + Controls.Add(cancelButton); + Name = "FormClient"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиент"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label nameLabel; + private TextBox nameTextBox; + + private Label emailLabel; + private TextBox emailTextBox; + + private Button saveButton; + private Button cancelButton; + private Label sex; + private Label label2; + private CheckBox sexCheckBox; + private Label DateLabel; + private DateTimePicker dateTimePicker; + private Label PhoneLabel; + private TextBox phoneText; + private Label adressLabel; + private TextBox adressBox; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormClient.cs b/ProjectGSM/Forms/FormClient.cs new file mode 100644 index 0000000..8971889 --- /dev/null +++ b/ProjectGSM/Forms/FormClient.cs @@ -0,0 +1,95 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectGSM.Forms +{ + + public partial class FormClient : Form + { + private readonly IClientRepository _clientRepository; + + private int? _clientId; + + public int Id + { + set + { + try + { + var client = + _clientRepository.ReadClientById(value); + if (client == null) + { + throw new + InvalidDataException(nameof(client)); + } + nameTextBox.Text = client.Name; + emailTextBox.Text = client.Email; + sexCheckBox.Checked = client.Sex; + dateTimePicker.Value = new DateTime(client.DateOfBirth.Year, client.DateOfBirth.Month, client.DateOfBirth.Day); + phoneText.Text = client.PhoneNumber; + adressBox.Text = client.Address; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormClient(IClientRepository clientRepository) + { + InitializeComponent(); + _clientRepository = clientRepository ?? +throw new +ArgumentNullException(nameof(clientRepository)); + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(emailTextBox.Text) || string.IsNullOrWhiteSpace(phoneText.Text) || string.IsNullOrWhiteSpace(adressBox.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_clientId.HasValue) + { + _clientRepository.UpdateClient(CreateClient(_clientId.Value)); + } + else + { + _clientRepository.UpdateClient(CreateClient(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private Client CreateClient(int id) => Client.CreateEntity(id, + nameTextBox.Text, + sexCheckBox.Checked, + dateTimePicker.Value, + emailTextBox.Text, + phoneText.Text, + adressBox.Text); + } +} diff --git a/ProjectGSM/Forms/FormClient.resx b/ProjectGSM/Forms/FormClient.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormClient.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormClients.Designer.cs b/ProjectGSM/Forms/FormClients.Designer.cs new file mode 100644 index 0000000..446c517 --- /dev/null +++ b/ProjectGSM/Forms/FormClients.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormClients + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panel1 = new Panel(); + deleteButton = new Button(); + editButton = new Button(); + addButton = new Button(); + dataGridView1 = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(deleteButton); + panel1.Controls.Add(editButton); + panel1.Controls.Add(addButton); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(142, 450); + panel1.TabIndex = 0; + // + // deleteButton + // + deleteButton.BackgroundImage = Properties.Resources.circle_x_svgrepo_com; + deleteButton.BackgroundImageLayout = ImageLayout.Zoom; + deleteButton.Location = new Point(33, 240); + deleteButton.Name = "deleteButton"; + deleteButton.Size = new Size(75, 75); + deleteButton.TabIndex = 2; + deleteButton.Text = " "; + deleteButton.UseVisualStyleBackColor = true; + deleteButton.Click += deleteButton_Click; + // + // editButton + // + editButton.BackgroundImage = Properties.Resources.pencil_svgrepo_com; + editButton.BackgroundImageLayout = ImageLayout.Zoom; + editButton.Location = new Point(33, 139); + editButton.Name = "editButton"; + editButton.Size = new Size(75, 75); + editButton.TabIndex = 1; + editButton.Text = " "; + editButton.UseVisualStyleBackColor = true; + editButton.Click += editButton_Click; + // + // addButton + // + addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com; + addButton.BackgroundImageLayout = ImageLayout.Zoom; + addButton.Location = new Point(33, 38); + addButton.Name = "addButton"; + addButton.Size = new Size(75, 75); + addButton.TabIndex = 0; + addButton.Text = " "; + addButton.UseVisualStyleBackColor = true; + addButton.Click += addButton_Click; + // + // dataGridView1 + // + dataGridView1.AllowUserToAddRows = false; + dataGridView1.AllowUserToDeleteRows = false; + dataGridView1.AllowUserToResizeColumns = false; + dataGridView1.AllowUserToResizeRows = false; + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView1.BackgroundColor = SystemColors.Info; + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Dock = DockStyle.Fill; + dataGridView1.Location = new Point(0, 0); + dataGridView1.MultiSelect = false; + dataGridView1.Name = "dataGridView1"; + dataGridView1.ReadOnly = true; + dataGridView1.RowHeadersVisible = false; + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.Size = new Size(604, 450); + dataGridView1.TabIndex = 1; + // + // FormClients + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(746, 450); + Controls.Add(dataGridView1); + Controls.Add(panel1); + Name = "FormClients"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиенты"; + Load += FormClients_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button deleteButton; + private Button editButton; + private Button addButton; + private DataGridView dataGridView1; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormClients.cs b/ProjectGSM/Forms/FormClients.cs new file mode 100644 index 0000000..eab944f --- /dev/null +++ b/ProjectGSM/Forms/FormClients.cs @@ -0,0 +1,123 @@ +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormClients : Form + { + private readonly IUnityContainer _container; + + private readonly IClientRepository _clientRepository; + public FormClients(IUnityContainer container, IClientRepository clientRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _clientRepository = clientRepository ?? + throw new + ArgumentNullException(nameof(clientRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _clientRepository.DeleteClient(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void FormClients_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void LoadList() => dataGridView1.DataSource = +_clientRepository.ReadClients(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView1.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + return true; + } + + } +} diff --git a/ProjectGSM/Forms/FormClients.resx b/ProjectGSM/Forms/FormClients.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormClients.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCourt.Designer.cs b/ProjectGSM/Forms/FormCourt.Designer.cs new file mode 100644 index 0000000..27eebd1 --- /dev/null +++ b/ProjectGSM/Forms/FormCourt.Designer.cs @@ -0,0 +1,113 @@ +namespace ProjectGSM.Forms +{ + partial class FormCourt + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + nameLabel = new Label(); + nameTextBox = new TextBox(); + saveButton = new Button(); + cancelButton = new Button(); + adressLabel = new Label(); + adressBox = new TextBox(); + SuspendLayout(); + // + // nameLabel + // + nameLabel.Location = new Point(10, 10); + nameLabel.Name = "nameLabel"; + nameLabel.Size = new Size(100, 23); + nameLabel.TabIndex = 0; + nameLabel.Text = "Название:"; + // + // nameTextBox + // + nameTextBox.Location = new Point(116, 10); + nameTextBox.Name = "nameTextBox"; + nameTextBox.Size = new Size(120, 23); + nameTextBox.TabIndex = 1; + // + // saveButton + // + saveButton.Location = new Point(116, 101); + saveButton.Name = "saveButton"; + saveButton.Size = new Size(75, 23); + saveButton.TabIndex = 4; + saveButton.Text = "Сохранить"; + saveButton.Click += saveButton_Click; + // + // cancelButton + // + cancelButton.Location = new Point(197, 101); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new Size(75, 23); + cancelButton.TabIndex = 5; + cancelButton.Text = "Отмена"; + cancelButton.Click += cancelButton_Click; + // + // adressLabel + // + adressLabel.Location = new Point(10, 50); + adressLabel.Name = "adressLabel"; + adressLabel.Size = new Size(111, 23); + adressLabel.TabIndex = 11; + adressLabel.Text = "Адрес:"; + // + // adressBox + // + adressBox.Location = new Point(116, 47); + adressBox.Name = "adressBox"; + adressBox.Size = new Size(120, 23); + adressBox.TabIndex = 12; + // + // FormCourt + // + ClientSize = new Size(284, 134); + Controls.Add(adressBox); + Controls.Add(adressLabel); + Controls.Add(nameLabel); + Controls.Add(nameTextBox); + Controls.Add(saveButton); + Controls.Add(cancelButton); + Name = "FormCourt"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Суд"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label nameLabel; + private TextBox nameTextBox; + + private Button saveButton; + private Button cancelButton; + private Label adressLabel; + private TextBox adressBox; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCourt.cs b/ProjectGSM/Forms/FormCourt.cs new file mode 100644 index 0000000..cc6ef76 --- /dev/null +++ b/ProjectGSM/Forms/FormCourt.cs @@ -0,0 +1,79 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; + +namespace ProjectGSM.Forms +{ + + public partial class FormCourt : Form + { + private readonly ICourtRepository _courtRepository; + + private int? _courtId; + + public int Id + { + set + { + try + { + var court = + _courtRepository.ReadCourtById(value); + if (court == null) + { + throw new + InvalidDataException(nameof(court)); + } + nameTextBox.Text = court.Name; + adressBox.Text = court.Address; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormCourt(ICourtRepository courtRepository) + { + InitializeComponent(); + _courtRepository = courtRepository ?? + throw new + ArgumentNullException(nameof(courtRepository)); + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(nameTextBox.Text) || string.IsNullOrWhiteSpace(adressBox.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_courtId.HasValue) + { + _courtRepository.UpdateCourt(CreateCourt(_courtId.Value)); + } + else + { + _courtRepository.CreateCourt(CreateCourt(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private Court CreateCourt(int id) => Court.CreateEntity(id, + nameTextBox.Text, + adressBox.Text); + + } +} diff --git a/ProjectGSM/Forms/FormCourt.resx b/ProjectGSM/Forms/FormCourt.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCourt.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCourts.Designer.cs b/ProjectGSM/Forms/FormCourts.Designer.cs new file mode 100644 index 0000000..5c140b8 --- /dev/null +++ b/ProjectGSM/Forms/FormCourts.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormCourts + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormCourts.cs b/ProjectGSM/Forms/FormCourts.cs new file mode 100644 index 0000000..3f9c21c --- /dev/null +++ b/ProjectGSM/Forms/FormCourts.cs @@ -0,0 +1,123 @@ +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormCourts : Form + { + private readonly IUnityContainer _container; + + private readonly ICourtRepository _courtRepository; + public FormCourts(IUnityContainer container, ICourtRepository courtRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _courtRepository = courtRepository ?? + throw new + ArgumentNullException(nameof(courtRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _courtRepository.DeleteCourt(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void FormClients_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void LoadList() => dataGridView1.DataSource = +_courtRepository.ReadCourts(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView1.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + return true; + } + + } +} diff --git a/ProjectGSM/Forms/FormCourts.resx b/ProjectGSM/Forms/FormCourts.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormCourts.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatus.Designer.cs b/ProjectGSM/Forms/FormStatus.Designer.cs new file mode 100644 index 0000000..680cd69 --- /dev/null +++ b/ProjectGSM/Forms/FormStatus.Designer.cs @@ -0,0 +1,136 @@ +namespace ProjectGSM.Forms +{ + partial class FormStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatus.cs b/ProjectGSM/Forms/FormStatus.cs new file mode 100644 index 0000000..042c5b4 --- /dev/null +++ b/ProjectGSM/Forms/FormStatus.cs @@ -0,0 +1,78 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; + +namespace ProjectGSM.Forms +{ + + public partial class FormStatus : Form + { + private readonly IStatusRepository _statusRepository; + + private int? _statusId; + + public int Id + { + set + { + try + { + var status = + _statusRepository.ReadStatusById(value); + if (status == null) + { + throw new + InvalidDataException(nameof(status)); + } + nameTextBox.Text = status.Name; + priceNumeric.Value = status.Price ?? 0; + dateTimePicker1.Value = new DateTime(status.CreatedAt.Year, status.CreatedAt.Month, status.CreatedAt.Day); ; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormStatus(IStatusRepository statusRepository) + { + InitializeComponent(); + _statusRepository = statusRepository ?? + throw new + ArgumentNullException(nameof(statusRepository)); + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(nameTextBox.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_statusId.HasValue) + { + _statusRepository.UpdateStatus(CreateStatus(_statusId.Value)); + } + else + { + _statusRepository.UpdateStatus(CreateStatus(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private Status CreateStatus(int id) => Status.CreateEntity(id, + nameTextBox.Text, Convert.ToDecimal(priceNumeric.Value), dateTimePicker1.Value); + } +} diff --git a/ProjectGSM/Forms/FormStatus.resx b/ProjectGSM/Forms/FormStatus.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatusHistory.Designer.cs b/ProjectGSM/Forms/FormStatusHistory.Designer.cs new file mode 100644 index 0000000..d997c92 --- /dev/null +++ b/ProjectGSM/Forms/FormStatusHistory.Designer.cs @@ -0,0 +1,137 @@ +namespace ProjectGSM.Forms +{ + partial class FormStatusHistory + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + statusLabel = new Label(); + saveButton = new Button(); + cancelButton = new Button(); + dateLabel = new Label(); + dateTimePicker1 = new DateTimePicker(); + caseLabel = new Label(); + statusBox = new ComboBox(); + caseBox = new ComboBox(); + SuspendLayout(); + // + // statusLabel + // + statusLabel.Location = new Point(10, 47); + statusLabel.Name = "statusLabel"; + statusLabel.Size = new Size(100, 23); + statusLabel.TabIndex = 0; + statusLabel.Text = "Статус:"; + // + // saveButton + // + saveButton.Location = new Point(116, 128); + saveButton.Name = "saveButton"; + saveButton.Size = new Size(75, 23); + saveButton.TabIndex = 4; + saveButton.Text = "Сохранить"; + saveButton.Click += saveButton_Click; + // + // cancelButton + // + cancelButton.Location = new Point(197, 128); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new Size(75, 23); + cancelButton.TabIndex = 5; + cancelButton.Text = "Отмена"; + cancelButton.Click += cancelButton_Click; + // + // dateLabel + // + dateLabel.Location = new Point(10, 92); + dateLabel.Name = "dateLabel"; + dateLabel.Size = new Size(111, 23); + dateLabel.TabIndex = 13; + dateLabel.Text = "Дата:"; + // + // dateTimePicker1 + // + dateTimePicker1.Location = new Point(125, 92); + dateTimePicker1.Name = "dateTimePicker1"; + dateTimePicker1.Size = new Size(120, 23); + dateTimePicker1.TabIndex = 14; + // + // caseLabel + // + caseLabel.Location = new Point(10, 7); + caseLabel.Name = "caseLabel"; + caseLabel.Size = new Size(100, 23); + caseLabel.TabIndex = 15; + caseLabel.Text = "Дело:"; + // + // statusBox + // + statusBox.DropDownStyle = ComboBoxStyle.DropDownList; + statusBox.FormattingEnabled = true; + statusBox.Location = new Point(125, 47); + statusBox.Name = "statusBox"; + statusBox.Size = new Size(121, 23); + statusBox.TabIndex = 16; + // + // caseBox + // + caseBox.DropDownStyle = ComboBoxStyle.DropDownList; + caseBox.FormattingEnabled = true; + caseBox.Location = new Point(125, 7); + caseBox.Name = "caseBox"; + caseBox.Size = new Size(121, 23); + caseBox.TabIndex = 17; + // + // FormStatusHistory + // + ClientSize = new Size(284, 163); + Controls.Add(caseBox); + Controls.Add(statusBox); + Controls.Add(caseLabel); + Controls.Add(dateTimePicker1); + Controls.Add(dateLabel); + Controls.Add(statusLabel); + Controls.Add(saveButton); + Controls.Add(cancelButton); + Name = "FormStatusHistory"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Хронология статусов"; + ResumeLayout(false); + } + + #endregion + + private Label statusLabel; + + private Button saveButton; + private Button cancelButton; + private Label dateLabel; + private DateTimePicker dateTimePicker1; + private Label caseLabel; + private ComboBox statusBox; + private ComboBox caseBox; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatusHistory.cs b/ProjectGSM/Forms/FormStatusHistory.cs new file mode 100644 index 0000000..3f225a0 --- /dev/null +++ b/ProjectGSM/Forms/FormStatusHistory.cs @@ -0,0 +1,58 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; + +namespace ProjectGSM.Forms +{ + + public partial class FormStatusHistory : Form + { + private readonly IStatusHistoryRepository _statusHistoryRepository; + + + public FormStatusHistory(IStatusHistoryRepository statusHistoryRepository, + IStatusRepository statusRepository, ICaseRepository caseRepository) + { + InitializeComponent(); + _statusHistoryRepository = statusHistoryRepository ?? + throw new + ArgumentNullException(nameof(statusHistoryRepository)); + + try + { + caseBox.DataSource = caseRepository.ReadCases(); + caseBox.DisplayMember = "Name"; + caseBox.SelectedIndex = 0; + } + catch (Exception ex) { } + + try + { + statusBox.DataSource = statusRepository.ReadStatuses(); + statusBox.DisplayMember = "Name"; + statusBox.SelectedIndex = 0; + } + catch (Exception ex) { } + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (caseBox.SelectedIndex < 0 || statusBox.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + _statusHistoryRepository.CreateStatusHistory(StatusHistory.CreateEntity(caseBox.SelectedIndex, statusBox.SelectedIndex, dateTimePicker1.Value)); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + } +} diff --git a/ProjectGSM/Forms/FormStatusHistory.resx b/ProjectGSM/Forms/FormStatusHistory.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormStatusHistory.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatuses.Designer.cs b/ProjectGSM/Forms/FormStatuses.Designer.cs new file mode 100644 index 0000000..4536b20 --- /dev/null +++ b/ProjectGSM/Forms/FormStatuses.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormStatuses + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatuses.cs b/ProjectGSM/Forms/FormStatuses.cs new file mode 100644 index 0000000..3f5afed --- /dev/null +++ b/ProjectGSM/Forms/FormStatuses.cs @@ -0,0 +1,114 @@ +using ProjectGSM.Repositories; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormStatuses : Form + { + private readonly IUnityContainer _container; + + private readonly IStatusRepository _statusRepository; + public FormStatuses(IUnityContainer container, IStatusRepository statusRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _statusRepository = statusRepository ?? + throw new + ArgumentNullException(nameof(statusRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _statusRepository.DeleteStatus(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().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; + } + + } +} diff --git a/ProjectGSM/Forms/FormStatuses.resx b/ProjectGSM/Forms/FormStatuses.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormStatuses.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatusesHistory.Designer.cs b/ProjectGSM/Forms/FormStatusesHistory.Designer.cs new file mode 100644 index 0000000..f0443a3 --- /dev/null +++ b/ProjectGSM/Forms/FormStatusesHistory.Designer.cs @@ -0,0 +1,100 @@ +namespace ProjectGSM.Forms +{ + partial class FormStatusesHistory + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panel1 = new Panel(); + addButton = new Button(); + dataGridView1 = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(addButton); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(142, 450); + panel1.TabIndex = 0; + // + // addButton + // + addButton.BackgroundImage = Properties.Resources.circle_plus_svgrepo_com; + addButton.BackgroundImageLayout = ImageLayout.Zoom; + addButton.Location = new Point(33, 38); + addButton.Name = "addButton"; + addButton.Size = new Size(75, 75); + addButton.TabIndex = 0; + addButton.Text = " "; + addButton.UseVisualStyleBackColor = true; + addButton.Click += addButton_Click; + // + // dataGridView1 + // + dataGridView1.AllowUserToAddRows = false; + dataGridView1.AllowUserToDeleteRows = false; + dataGridView1.AllowUserToResizeColumns = false; + dataGridView1.AllowUserToResizeRows = false; + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView1.BackgroundColor = SystemColors.Info; + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Dock = DockStyle.Fill; + dataGridView1.Location = new Point(0, 0); + dataGridView1.MultiSelect = false; + dataGridView1.Name = "dataGridView1"; + dataGridView1.ReadOnly = true; + dataGridView1.RowHeadersVisible = false; + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.Size = new Size(604, 450); + dataGridView1.TabIndex = 1; + // + // FormStatusesHistory + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(746, 450); + Controls.Add(dataGridView1); + Controls.Add(panel1); + Name = "FormStatusesHistory"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Суды"; + Load += FormClients_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button addButton; + private DataGridView dataGridView1; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormStatusesHistory.cs b/ProjectGSM/Forms/FormStatusesHistory.cs new file mode 100644 index 0000000..f2cb80f --- /dev/null +++ b/ProjectGSM/Forms/FormStatusesHistory.cs @@ -0,0 +1,68 @@ +using ProjectGSM.Repositories; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormStatusesHistory : Form + { + private readonly IUnityContainer _container; + + private readonly IStatusHistoryRepository _statusHistoryRepository; + public FormStatusesHistory(IUnityContainer container, IStatusHistoryRepository statusHistoryRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _statusHistoryRepository = statusHistoryRepository ?? + throw new + ArgumentNullException(nameof(statusHistoryRepository)); + + } + private void addButton_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void FormClients_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void LoadList() => dataGridView1.DataSource = +_statusHistoryRepository.ReadStatusHistories(); + + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView1.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = + Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + return true; + } + + } +} diff --git a/ProjectGSM/Forms/FormStatusesHistory.resx b/ProjectGSM/Forms/FormStatusesHistory.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormStatusesHistory.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormTypeApeal.Designer.cs b/ProjectGSM/Forms/FormTypeApeal.Designer.cs new file mode 100644 index 0000000..2cc7c3a --- /dev/null +++ b/ProjectGSM/Forms/FormTypeApeal.Designer.cs @@ -0,0 +1,92 @@ +namespace ProjectGSM.Forms +{ + partial class FormTypeApeal + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormTypeApeal.cs b/ProjectGSM/Forms/FormTypeApeal.cs new file mode 100644 index 0000000..61a23d5 --- /dev/null +++ b/ProjectGSM/Forms/FormTypeApeal.cs @@ -0,0 +1,77 @@ +using ProjectGSM.Entities; +using ProjectGSM.Repositories; + +namespace ProjectGSM.Forms +{ + + public partial class FormTypeApeal : Form + { + private readonly ITypeAppealRepository _typeAppealRepository; + + private int? _appealId; + + public int Id + { + set + { + try + { + var appeal = + _typeAppealRepository.ReadTypeAppealById(value); + if (appeal == null) + { + throw new + InvalidDataException(nameof(appeal)); + } + nameTextBox.Text = appeal.Name; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormTypeApeal(ITypeAppealRepository typeAppealRepository) + { + InitializeComponent(); + _typeAppealRepository = typeAppealRepository ?? + throw new + ArgumentNullException(nameof(typeAppealRepository)); + } + + private void saveButton_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(nameTextBox.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_appealId.HasValue) + { + _typeAppealRepository.UpdateTypeAppeal(CreateTypeAppeal(_appealId.Value)); + } + else + { + _typeAppealRepository.UpdateTypeAppeal(CreateTypeAppeal(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void cancelButton_Click(object sender, EventArgs e) => Close(); + + private TypeAppeal CreateTypeAppeal(int id) => TypeAppeal.CreateEntity(id, + nameTextBox.Text); + + } +} diff --git a/ProjectGSM/Forms/FormTypeApeal.resx b/ProjectGSM/Forms/FormTypeApeal.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormTypeApeal.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Forms/FormTypeAppeals.Designer.cs b/ProjectGSM/Forms/FormTypeAppeals.Designer.cs new file mode 100644 index 0000000..1f08700 --- /dev/null +++ b/ProjectGSM/Forms/FormTypeAppeals.Designer.cs @@ -0,0 +1,130 @@ +namespace ProjectGSM.Forms +{ + partial class FormTypeAppeals + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ProjectGSM/Forms/FormTypeAppeals.cs b/ProjectGSM/Forms/FormTypeAppeals.cs new file mode 100644 index 0000000..c592c8b --- /dev/null +++ b/ProjectGSM/Forms/FormTypeAppeals.cs @@ -0,0 +1,123 @@ +using ProjectGSM.Repositories; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Unity; + +namespace ProjectGSM.Forms +{ + public partial class FormTypeAppeals : Form + { + private readonly IUnityContainer _container; + + private readonly ITypeAppealRepository _typeAppealRepository; + public FormTypeAppeals(IUnityContainer container, ITypeAppealRepository typeAppealRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _typeAppealRepository = typeAppealRepository ?? + throw new + ArgumentNullException(nameof(typeAppealRepository)); + + } + + private void deleteButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _typeAppealRepository.DeleteTypeAppeal(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void editButton_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + 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().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; + } + + } +} diff --git a/ProjectGSM/Forms/FormTypeAppeals.resx b/ProjectGSM/Forms/FormTypeAppeals.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectGSM/Forms/FormTypeAppeals.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectGSM/Program.cs b/ProjectGSM/Program.cs index cea8648..7e70864 100644 --- a/ProjectGSM/Program.cs +++ b/ProjectGSM/Program.cs @@ -1,3 +1,9 @@ +using ProjectGSM.Forms; +using ProjectGSM.Repositories; +using ProjectGSM.Repositories.Implementations; +using Unity; +using Unity.Lifetime; + namespace ProjectGSM { internal static class Program @@ -11,7 +17,21 @@ namespace ProjectGSM // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run((CreateContainer().Resolve())); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + return container; } } } \ No newline at end of file diff --git a/ProjectGSM/ProjectGSM.csproj b/ProjectGSM/ProjectGSM.csproj index 663fdb8..a31e0ba 100644 --- a/ProjectGSM/ProjectGSM.csproj +++ b/ProjectGSM/ProjectGSM.csproj @@ -8,4 +8,70 @@ enable + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + + Form + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + \ No newline at end of file diff --git a/ProjectGSM/Properties/Resources.Designer.cs b/ProjectGSM/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3a80843 --- /dev/null +++ b/ProjectGSM/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectGSM.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectGSM.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap circle_plus_svgrepo_com { + get { + object obj = ResourceManager.GetObject("circle-plus-svgrepo-com", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap circle_x_svgrepo_com { + get { + object obj = ResourceManager.GetObject("circle-x-svgrepo-com", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap maxresdefault { + get { + object obj = ResourceManager.GetObject("maxresdefault", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap pencil_svgrepo_com { + get { + object obj = ResourceManager.GetObject("pencil-svgrepo-com", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectGSM/Properties/Resources.resx b/ProjectGSM/Properties/Resources.resx new file mode 100644 index 0000000..2b1a20e --- /dev/null +++ b/ProjectGSM/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\pencil-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\maxresdefault.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\circle-plus-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\circle-x-svgrepo-com.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectGSM/Repositories/IAdvocateRepository.cs b/ProjectGSM/Repositories/IAdvocateRepository.cs new file mode 100644 index 0000000..2f315c6 --- /dev/null +++ b/ProjectGSM/Repositories/IAdvocateRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface IAdvocateRepository +{ + IEnumerable ReadAdvocates(); + Advocate ReadAdvocateById(int id); + void CreateAdvocate(Advocate advocate); + void UpdateAdvocate(Advocate advocate); + void DeleteAdvocate(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/ICaseAdvocateRepository.cs b/ProjectGSM/Repositories/ICaseAdvocateRepository.cs new file mode 100644 index 0000000..cf35edb --- /dev/null +++ b/ProjectGSM/Repositories/ICaseAdvocateRepository.cs @@ -0,0 +1,11 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface ICaseAdvocateRepository +{ + IEnumerable ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null, int? caseId = null, + int? advocateId = null); + void CreateCaseAdvocate(CaseAdvocate caseAdvocate); + void DeleteCaseAdvocate(int caseId, int advocateId); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/ICaseRepository.cs b/ProjectGSM/Repositories/ICaseRepository.cs new file mode 100644 index 0000000..8f3d8ab --- /dev/null +++ b/ProjectGSM/Repositories/ICaseRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface ICaseRepository +{ + IEnumerable ReadCases(); + Case ReadCaseById(int id); + void CreateCase(Case caseEntity); + void UpdateCase(Case caseEntity); + void DeleteCase(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/IClientRepository.cs b/ProjectGSM/Repositories/IClientRepository.cs new file mode 100644 index 0000000..0447c79 --- /dev/null +++ b/ProjectGSM/Repositories/IClientRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface IClientRepository +{ + IEnumerable ReadClients(); + Client ReadClientById(int id); + void CreateClient(Client client); + void UpdateClient(Client client); + void DeleteClient(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/ICourtRepository.cs b/ProjectGSM/Repositories/ICourtRepository.cs new file mode 100644 index 0000000..4cbfba3 --- /dev/null +++ b/ProjectGSM/Repositories/ICourtRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface ICourtRepository +{ + IEnumerable ReadCourts(); + Court ReadCourtById(int id); + void CreateCourt(Court court); + void UpdateCourt(Court court); + void DeleteCourt(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/IStatusHistoryRepository.cs b/ProjectGSM/Repositories/IStatusHistoryRepository.cs new file mode 100644 index 0000000..da00b97 --- /dev/null +++ b/ProjectGSM/Repositories/IStatusHistoryRepository.cs @@ -0,0 +1,11 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface IStatusHistoryRepository +{ + IEnumerable ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null, + int? caseId = null, int? statusId = null); + void CreateStatusHistory(StatusHistory statusHistory); + void DeleteStatusHistory(int statusId, int caseId); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/IStatusRepository.cs b/ProjectGSM/Repositories/IStatusRepository.cs new file mode 100644 index 0000000..478b5dd --- /dev/null +++ b/ProjectGSM/Repositories/IStatusRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface IStatusRepository +{ + IEnumerable ReadStatuses(); + Status ReadStatusById(int id); + void CreateStatus(Status status); + void UpdateStatus(Status status); + void DeleteStatus(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/ITypeAppealRepository.cs b/ProjectGSM/Repositories/ITypeAppealRepository.cs new file mode 100644 index 0000000..3f70d06 --- /dev/null +++ b/ProjectGSM/Repositories/ITypeAppealRepository.cs @@ -0,0 +1,12 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories; + +public interface ITypeAppealRepository +{ + IEnumerable ReadTypeAppeals(); + TypeAppeal ReadTypeAppealById(int id); + void CreateTypeAppeal(TypeAppeal typeAppeal); + void UpdateTypeAppeal(TypeAppeal typeAppeal); + void DeleteTypeAppeal(int id); +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/AdvocateRepository.cs b/ProjectGSM/Repositories/Implementations/AdvocateRepository.cs new file mode 100644 index 0000000..7fe34ae --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/AdvocateRepository.cs @@ -0,0 +1,29 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class AdvocateRepository : IAdvocateRepository +{ + public IEnumerable ReadAdvocates() + { + return []; + } + + public Advocate ReadAdvocateById(int id) + { + return Advocate.CreateEntity(0, String.Empty, false, DateTime.UtcNow, 0, 0, 0, String.Empty, String.Empty, + String.Empty); + } + + public void CreateAdvocate(Advocate advocate) + { + } + + public void UpdateAdvocate(Advocate advocate) + { + } + + public void DeleteAdvocate(int id) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/CaseAdvocateRepository.cs b/ProjectGSM/Repositories/Implementations/CaseAdvocateRepository.cs new file mode 100644 index 0000000..488549a --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/CaseAdvocateRepository.cs @@ -0,0 +1,16 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class CaseAdvocateRepository : ICaseAdvocateRepository +{ + public IEnumerable ReadCaseAdvocates(DateTime? dateForm = null, DateTime? dateTo = null, + int? caseId = null, int? advocateId = null) + { + return []; + } + + public void CreateCaseAdvocate(CaseAdvocate caseAdvocate) { } + + public void DeleteCaseAdvocate(int caseId, int advocateId) { } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/CaseRepository.cs b/ProjectGSM/Repositories/Implementations/CaseRepository.cs new file mode 100644 index 0000000..f68e1a8 --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/CaseRepository.cs @@ -0,0 +1,28 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class CaseRepository : ICaseRepository +{ + public IEnumerable ReadCases() + { + return []; + } + + public Case ReadCaseById(int id) + { + return Case.CreateEntity(0, 0, false, 0, 0, 0, false, 0, 0, String.Empty); + } + + public void CreateCase(Case caseEntity) + { + } + + public void UpdateCase(Case caseEntity) + { + } + + public void DeleteCase(int id) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/ClientRepository.cs b/ProjectGSM/Repositories/Implementations/ClientRepository.cs new file mode 100644 index 0000000..9e478e0 --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/ClientRepository.cs @@ -0,0 +1,21 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class ClientRepository : IClientRepository +{ + public IEnumerable ReadClients() + { + return [];} + + public Client ReadClientById(int id) + { + return Client.CreateEntity(0, String.Empty, false, DateTime.UtcNow, String.Empty, String.Empty, String.Empty); + } + + public void CreateClient(Client client) { } + + public void UpdateClient(Client client) { } + + public void DeleteClient(int id) { } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/CourtRepository.cs b/ProjectGSM/Repositories/Implementations/CourtRepository.cs new file mode 100644 index 0000000..4183b02 --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/CourtRepository.cs @@ -0,0 +1,28 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class CourtRepository : ICourtRepository +{ + public IEnumerable ReadCourts() + { + return []; + } + + public Court ReadCourtById(int id) + { + return Court.CreateEntity(0, String.Empty, String.Empty); + } + + public void CreateCourt(Court court) + { + } + + public void UpdateCourt(Court court) + { + } + + public void DeleteCourt(int id) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/StatusHistoryRepository.cs b/ProjectGSM/Repositories/Implementations/StatusHistoryRepository.cs new file mode 100644 index 0000000..6401d8e --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/StatusHistoryRepository.cs @@ -0,0 +1,20 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class StatusHistoryRepository : IStatusHistoryRepository +{ + public IEnumerable ReadStatusHistories(DateTime? dateForm = null, DateTime? dateTo = null, + int? caseId = null, int? statusId = null) + { + return []; + } + + public void CreateStatusHistory(StatusHistory statusHistory) + { + } + + public void DeleteStatusHistory(int statusId, int caseId) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/StatusRepository.cs b/ProjectGSM/Repositories/Implementations/StatusRepository.cs new file mode 100644 index 0000000..a3b23fa --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/StatusRepository.cs @@ -0,0 +1,28 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class StatusRepository : IStatusRepository +{ + public IEnumerable 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) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Repositories/Implementations/TypeAppealRepository.cs b/ProjectGSM/Repositories/Implementations/TypeAppealRepository.cs new file mode 100644 index 0000000..dc64b32 --- /dev/null +++ b/ProjectGSM/Repositories/Implementations/TypeAppealRepository.cs @@ -0,0 +1,28 @@ +using ProjectGSM.Entities; + +namespace ProjectGSM.Repositories.Implementations; + +public class TypeAppealRepository : ITypeAppealRepository +{ + public IEnumerable 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) + { + } +} \ No newline at end of file diff --git a/ProjectGSM/Resources/circle-plus-svgrepo-com.png b/ProjectGSM/Resources/circle-plus-svgrepo-com.png new file mode 100644 index 0000000..2c99667 Binary files /dev/null and b/ProjectGSM/Resources/circle-plus-svgrepo-com.png differ diff --git a/ProjectGSM/Resources/circle-x-svgrepo-com.png b/ProjectGSM/Resources/circle-x-svgrepo-com.png new file mode 100644 index 0000000..012165f Binary files /dev/null and b/ProjectGSM/Resources/circle-x-svgrepo-com.png differ diff --git a/ProjectGSM/Resources/maxresdefault.jpg b/ProjectGSM/Resources/maxresdefault.jpg new file mode 100644 index 0000000..66cb510 Binary files /dev/null and b/ProjectGSM/Resources/maxresdefault.jpg differ diff --git a/ProjectGSM/Resources/pencil-svgrepo-com.png b/ProjectGSM/Resources/pencil-svgrepo-com.png new file mode 100644 index 0000000..27b28c4 Binary files /dev/null and b/ProjectGSM/Resources/pencil-svgrepo-com.png differ