diff --git a/ITServiceManager/ITServiceManager/Entities/Appointment.cs b/ITServiceManager/ITServiceManager/Entities/Appointment.cs new file mode 100644 index 0000000..281c7e0 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Appointment.cs @@ -0,0 +1,22 @@ +namespace ITServiceManager.Entities; + +public class Appointment +{ + public int Id { get; private set; } + public int EmployeeId { get; private set; } + public int OrderId { get; private set; } + public DateTime StartDate { get; private set; } + public DateTime? EndDate { get; private set; } + + public static Appointment CreateOperation(int id, int orderId, int employeeId, DateTime appointmentStartDate, DateTime appointmentEndDate) + { + return new Appointment + { + Id = id, + EmployeeId = employeeId, + OrderId = orderId, + StartDate = appointmentStartDate, + EndDate = appointmentEndDate + }; + } +} diff --git a/ITServiceManager/ITServiceManager/Entities/Company.cs b/ITServiceManager/ITServiceManager/Entities/Company.cs new file mode 100644 index 0000000..3f56494 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Company.cs @@ -0,0 +1,16 @@ +namespace ITServiceManager.Entities; + +public class Company +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + + public static Company CreateEntity(int id, string companyName) + { + return new Company + { + Id = id, + Name = companyName + }; + } +} diff --git a/ITServiceManager/ITServiceManager/Entities/Employee.cs b/ITServiceManager/ITServiceManager/Entities/Employee.cs new file mode 100644 index 0000000..98290e6 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Employee.cs @@ -0,0 +1,22 @@ +using ITServiceManager.Entities.Enums; + +namespace ITServiceManager.Entities; + +public class Employee +{ + public int Id { get; private set; } + public string FirstName { get; private set; } = string.Empty; + public string LastName { get; private set; } = string.Empty; + public EmployeePost? Position { get; private set; } + + public static Employee CreateEntity(int id, string employeeFirstName, string employeeLastName, EmployeePost employeePosition) + { + return new Employee + { + Id = id, + FirstName = employeeFirstName, + LastName = employeeLastName, + Position = employeePosition + }; + } +} diff --git a/ITServiceManager/ITServiceManager/Entities/Enums/EmployeePost.cs b/ITServiceManager/ITServiceManager/Entities/Enums/EmployeePost.cs new file mode 100644 index 0000000..462647b --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Enums/EmployeePost.cs @@ -0,0 +1,12 @@ +namespace ITServiceManager.Entities.Enums; + +public enum EmployeePost +{ + None = 0, + Junior = 1, + Middle = 2, + Senior = 3, + Lead = 4, + Manager = 5, + Director = 6 +} diff --git a/ITServiceManager/ITServiceManager/Entities/Order.cs b/ITServiceManager/ITServiceManager/Entities/Order.cs new file mode 100644 index 0000000..2fee510 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Order.cs @@ -0,0 +1,26 @@ +namespace ITServiceManager.Entities; + +public class Order +{ + public int Id { get; private set; } + public int CompanyId { get; private set; } + public DateTime OrderDate { get; private set; } + public decimal OrderPrice { get; private set; } + + public IEnumerable OrderService { get; private set; } = []; + public IEnumerable Appointments { get; private set; } = []; + + public static Order CreateOperation(int id, int companyId, decimal orderPrice, IEnumerable orderService, + IEnumerable appointments) + { + return new Order + { + Id = id, + CompanyId = companyId, + OrderDate = DateTime.Now, + OrderPrice = orderPrice, + OrderService = orderService, + Appointments = appointments + }; + } +} diff --git a/ITServiceManager/ITServiceManager/Entities/OrderService.cs b/ITServiceManager/ITServiceManager/Entities/OrderService.cs new file mode 100644 index 0000000..f2ef394 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/OrderService.cs @@ -0,0 +1,21 @@ +namespace ITServiceManager.Entities; + +public class OrderService +{ + public int Id { get; private set; } + public int OrderId { get; private set; } + public int ServiceId { get; private set; } + public int Quantity { get; private set; } + public DateTime ExecutionDate { get; private set; } + + public static OrderService CreateOperation(int id, int orderId, int serviceId, int serviceQuantity, DateTime executionDate) + { + return new OrderService + { + Id = id, + OrderId = orderId, + ServiceId = serviceId, + ExecutionDate = executionDate + }; + } +} diff --git a/ITServiceManager/ITServiceManager/Entities/Service.cs b/ITServiceManager/ITServiceManager/Entities/Service.cs new file mode 100644 index 0000000..b1fcbf7 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Entities/Service.cs @@ -0,0 +1,19 @@ +namespace ITServiceManager.Entities; + +public class Service +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + + public IEnumerable OrderService { get; private set; } = []; + + public static Service CreateEntity(int id, string serviceName, IEnumerable orderService) + { + return new Service + { + Id = id, + Name = serviceName, + OrderService = orderService + }; + } +} diff --git a/ITServiceManager/ITServiceManager/FormItCompany.Designer.cs b/ITServiceManager/ITServiceManager/FormItCompany.Designer.cs new file mode 100644 index 0000000..1555d98 --- /dev/null +++ b/ITServiceManager/ITServiceManager/FormItCompany.Designer.cs @@ -0,0 +1,132 @@ +namespace ITServiceManager +{ + partial class FormItCompany + { + /// + /// 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() + { + menuStrip1 = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + компанииToolStripMenuItem = new ToolStripMenuItem(); + сотрудникиToolStripMenuItem = new ToolStripMenuItem(); + услугиToolStripMenuItem = new ToolStripMenuItem(); + заказыToolStripMenuItem = new ToolStripMenuItem(); + назначениеСотрудниковToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(784, 24); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компанииToolStripMenuItem, сотрудникиToolStripMenuItem, услугиToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(94, 20); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заказыToolStripMenuItem, назначениеСотрудниковToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(75, 20); + операцииToolStripMenuItem.Text = "Операции"; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(60, 20); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // компанииToolStripMenuItem + // + компанииToolStripMenuItem.Name = "компанииToolStripMenuItem"; + компанииToolStripMenuItem.Size = new Size(180, 22); + компанииToolStripMenuItem.Text = "Компании"; + // + // сотрудникиToolStripMenuItem + // + сотрудникиToolStripMenuItem.Name = "сотрудникиToolStripMenuItem"; + сотрудникиToolStripMenuItem.Size = new Size(180, 22); + сотрудникиToolStripMenuItem.Text = "Сотрудники"; + // + // услугиToolStripMenuItem + // + услугиToolStripMenuItem.Name = "услугиToolStripMenuItem"; + услугиToolStripMenuItem.Size = new Size(180, 22); + услугиToolStripMenuItem.Text = "Услуги"; + // + // заказыToolStripMenuItem + // + заказыToolStripMenuItem.Name = "заказыToolStripMenuItem"; + заказыToolStripMenuItem.Size = new Size(213, 22); + заказыToolStripMenuItem.Text = "Заказы"; + // + // назначениеСотрудниковToolStripMenuItem + // + назначениеСотрудниковToolStripMenuItem.Name = "назначениеСотрудниковToolStripMenuItem"; + назначениеСотрудниковToolStripMenuItem.Size = new Size(213, 22); + назначениеСотрудниковToolStripMenuItem.Text = "Назначение сотрудников"; + // + // FormItCompany + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.company; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(784, 411); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormItCompany"; + StartPosition = FormStartPosition.CenterScreen; + Text = "IT компания"; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem компанииToolStripMenuItem; + private ToolStripMenuItem сотрудникиToolStripMenuItem; + private ToolStripMenuItem услугиToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem заказыToolStripMenuItem; + private ToolStripMenuItem назначениеСотрудниковToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + } +} diff --git a/ITServiceManager/ITServiceManager/Form1.cs b/ITServiceManager/ITServiceManager/FormItCompany.cs similarity index 56% rename from ITServiceManager/ITServiceManager/Form1.cs rename to ITServiceManager/ITServiceManager/FormItCompany.cs index 98dc9ff..2a82df0 100644 --- a/ITServiceManager/ITServiceManager/Form1.cs +++ b/ITServiceManager/ITServiceManager/FormItCompany.cs @@ -1,8 +1,8 @@ namespace ITServiceManager { - public partial class Form1 : Form + public partial class FormItCompany : Form { - public Form1() + public FormItCompany() { InitializeComponent(); } diff --git a/ITServiceManager/ITServiceManager/FormItCompany.resx b/ITServiceManager/ITServiceManager/FormItCompany.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/ITServiceManager/ITServiceManager/FormItCompany.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/ITServiceManager/ITServiceManager/Forms/FormAppointment.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormAppointment.Designer.cs new file mode 100644 index 0000000..221c805 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormAppointment.Designer.cs @@ -0,0 +1,39 @@ +namespace ITServiceManager.Forms +{ + partial class FormAppointment + { + /// + /// 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 = "FormAppointment"; + } + + #endregion + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormAppointment.cs b/ITServiceManager/ITServiceManager/Forms/FormAppointment.cs new file mode 100644 index 0000000..6b7bf54 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormAppointment.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 ITServiceManager.Forms +{ + public partial class FormAppointment : Form + { + public FormAppointment() + { + InitializeComponent(); + } + } +} diff --git a/ITServiceManager/ITServiceManager/Form1.resx b/ITServiceManager/ITServiceManager/Forms/FormAppointment.resx similarity index 100% rename from ITServiceManager/ITServiceManager/Form1.resx rename to ITServiceManager/ITServiceManager/Forms/FormAppointment.resx diff --git a/ITServiceManager/ITServiceManager/Forms/FormCompanies.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormCompanies.Designer.cs new file mode 100644 index 0000000..89c2785 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompanies.Designer.cs @@ -0,0 +1,126 @@ +namespace ITServiceManager.Forms +{ + partial class FormCompanies + { + /// + /// 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() + { + panel = new Panel(); + buttonUpdate = new Button(); + buttonRemove = new Button(); + buttonAdd = new Button(); + dataGridView = new DataGridView(); + panel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel + // + panel.Controls.Add(buttonUpdate); + panel.Controls.Add(buttonRemove); + panel.Controls.Add(buttonAdd); + panel.Dock = DockStyle.Right; + panel.Location = new Point(652, 0); + panel.Name = "panel"; + panel.Size = new Size(148, 450); + panel.TabIndex = 1; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources.edit; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(36, 249); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(78, 80); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // buttonRemove + // + buttonRemove.BackgroundImage = Properties.Resources.minus; + buttonRemove.BackgroundImageLayout = ImageLayout.Stretch; + buttonRemove.Location = new Point(36, 141); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(75, 76); + buttonRemove.TabIndex = 1; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += ButtonRemove_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources.plus; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(33, 43); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(81, 71); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowTemplate.Height = 25; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(652, 450); + dataGridView.TabIndex = 1; + // + // FormCompanies + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel); + Name = "FormCompanies"; + StartPosition = FormStartPosition.CenterParent; + Text = "Компании"; + Load += FormCompanies_Load; + panel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel; + private Button buttonRemove; + private Button buttonAdd; + private Button buttonUpdate; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormCompanies.cs b/ITServiceManager/ITServiceManager/Forms/FormCompanies.cs new file mode 100644 index 0000000..8af650a --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompanies.cs @@ -0,0 +1,101 @@ +using ITServiceManager.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 ITServiceManager.Forms +{ + public partial class FormCompanies : Form + { + private readonly IUnityContainer _container; + private readonly ICompanyRepository _companyRepository; + + public FormCompanies(IUnityContainer container, ICompanyRepository companyRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _companyRepository = companyRepository ?? throw new ArgumentNullException(nameof(companyRepository)); + } + private void FormCompanies_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonRemove_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _companyRepository.DeleteCompany(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonUpdate_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 LoadList() => dataGridView.DataSource = _companyRepository.ReadCompanies(); + private bool TryGetIdentifierFromSelectedRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormCompanies.resx b/ITServiceManager/ITServiceManager/Forms/FormCompanies.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompanies.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/ITServiceManager/ITServiceManager/Forms/FormCompany.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormCompany.Designer.cs new file mode 100644 index 0000000..d75bc86 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompany.Designer.cs @@ -0,0 +1,96 @@ +namespace ITServiceManager.Forms +{ + partial class FormCompany + { + /// + /// 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() + { + labelName = new Label(); + textBoxName = new TextBox(); + buttonAdd = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(89, 101); + labelName.Name = "labelName"; + labelName.Size = new Size(118, 15); + labelName.TabIndex = 0; + labelName.Text = "Название компании"; + // + // textBoxName + // + textBoxName.Location = new Point(268, 98); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(176, 23); + textBoxName.TabIndex = 1; + // + // buttonAdd + // + buttonAdd.Location = new Point(95, 238); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(112, 28); + buttonAdd.TabIndex = 2; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(321, 238); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(112, 28); + buttonCancel.TabIndex = 3; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormCompany + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(536, 306); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(textBoxName); + Controls.Add(labelName); + Name = "FormCompany"; + StartPosition = FormStartPosition.CenterParent; + Text = "Компания"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelName; + private TextBox textBoxName; + private Button buttonAdd; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormCompany.cs b/ITServiceManager/ITServiceManager/Forms/FormCompany.cs new file mode 100644 index 0000000..2deb280 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompany.cs @@ -0,0 +1,73 @@ +using ITServiceManager.Entities; +using ITServiceManager.Repositories; +using ITServiceManager.Repositories.Implementations; +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 ITServiceManager.Forms +{ + public partial class FormCompany : Form + { + private readonly ICompanyRepository _companyRepository; + private int? _companyId; + public int Id + { + set + { + try + { + var company = _companyRepository.ReadCompanyById(value); + if (company == null) + { + throw new InvalidDataException(nameof(company)); + } + textBoxName.Text = company.Name; + _companyId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormCompany(ICompanyRepository companyRepository) + { + InitializeComponent(); + _companyRepository = companyRepository ?? throw new ArgumentNullException(nameof(companyRepository)); + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_companyId.HasValue) + { + _companyRepository.UpdateCompany(CreateCompany(_companyId.Value)); + } + else + { + _companyRepository.CreateCompany(CreateCompany(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + private Company CreateCompany(int id) => Company.CreateEntity(id, textBoxName.Text); + } +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormCompany.resx b/ITServiceManager/ITServiceManager/Forms/FormCompany.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormCompany.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/ITServiceManager/ITServiceManager/Forms/FormEmployee.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormEmployee.Designer.cs new file mode 100644 index 0000000..2898a3c --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormEmployee.Designer.cs @@ -0,0 +1,141 @@ +namespace ITServiceManager.Forms +{ + partial class FormEmployee + { + /// + /// 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() + { + buttonCancel = new Button(); + buttonAdd = new Button(); + textBoxFirstName = new TextBox(); + labelFirstName = new Label(); + comboBoxPost = new ComboBox(); + labelLastName = new Label(); + textBoxLastName = new TextBox(); + labelPosition = new Label(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(320, 247); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(112, 28); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // buttonAdd + // + buttonAdd.Location = new Point(86, 247); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(112, 28); + buttonAdd.TabIndex = 6; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // textBoxFirstName + // + textBoxFirstName.Location = new Point(265, 59); + textBoxFirstName.Name = "textBoxFirstName"; + textBoxFirstName.Size = new Size(176, 23); + textBoxFirstName.TabIndex = 5; + // + // labelFirstName + // + labelFirstName.AutoSize = true; + labelFirstName.Location = new Point(86, 62); + labelFirstName.Name = "labelFirstName"; + labelFirstName.Size = new Size(97, 15); + labelFirstName.TabIndex = 4; + labelFirstName.Text = "Имя сотрудника"; + // + // comboBoxPost + // + comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPost.FormattingEnabled = true; + comboBoxPost.Location = new Point(265, 168); + comboBoxPost.Name = "comboBoxPost"; + comboBoxPost.Size = new Size(176, 23); + comboBoxPost.TabIndex = 8; + // + // labelLastName + // + labelLastName.AutoSize = true; + labelLastName.Location = new Point(86, 115); + labelLastName.Name = "labelLastName"; + labelLastName.Size = new Size(124, 15); + labelLastName.TabIndex = 9; + labelLastName.Text = "Фамилия сотрудника"; + // + // textBoxLastName + // + textBoxLastName.Location = new Point(265, 115); + textBoxLastName.Name = "textBoxLastName"; + textBoxLastName.Size = new Size(176, 23); + textBoxLastName.TabIndex = 10; + // + // labelPosition + // + labelPosition.AutoSize = true; + labelPosition.Location = new Point(86, 171); + labelPosition.Name = "labelPosition"; + labelPosition.Size = new Size(135, 15); + labelPosition.TabIndex = 11; + labelPosition.Text = "Должность сотрудника"; + // + // FormEmployee + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(526, 287); + Controls.Add(labelPosition); + Controls.Add(textBoxLastName); + Controls.Add(labelLastName); + Controls.Add(comboBoxPost); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(textBoxFirstName); + Controls.Add(labelFirstName); + Name = "FormEmployee"; + StartPosition = FormStartPosition.CenterScreen; + Text = "FormEmployee"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonAdd; + private TextBox textBoxFirstName; + private Label labelFirstName; + private ComboBox comboBoxPost; + private Label labelLastName; + private TextBox textBoxLastName; + private Label labelPosition; + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormEmployee.cs b/ITServiceManager/ITServiceManager/Forms/FormEmployee.cs new file mode 100644 index 0000000..bae3410 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormEmployee.cs @@ -0,0 +1,86 @@ +using ITServiceManager.Entities; +using ITServiceManager.Entities.Enums; +using ITServiceManager.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 ITServiceManager.Forms +{ + public partial class FormEmployee : Form + { + private readonly IEmployeeRepository _employeeRepository; + private int? _employeeId; + public int Id + { + set + { + try + { + var employee = + _employeeRepository.ReadEmployeeById(value); + if (employee == null) + { + throw new + InvalidDataException(nameof(employee)); + } + textBoxFirstName.Text = employee.FirstName; + textBoxLastName.Text = employee.LastName; + comboBoxPost.SelectedItem = + employee.Position; + _employeeId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormEmployee(IEmployeeRepository employeeRepository) + { + InitializeComponent(); + _employeeRepository = employeeRepository ?? + throw new + ArgumentNullException(nameof(employeeRepository)); + comboBoxPost.DataSource = + Enum.GetValues(typeof(EmployeePost)); + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || + string.IsNullOrWhiteSpace(textBoxLastName.Text) + || + comboBoxPost.SelectedIndex < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_employeeId.HasValue) + { + _employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value)); + } + else + { + _employeeRepository.CreateEmployee(CreateEmployee(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + private Employee CreateEmployee(int id) => Employee.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text, (EmployeePost)comboBoxPost.SelectedItem!); + } + +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormEmployee.resx b/ITServiceManager/ITServiceManager/Forms/FormEmployee.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormEmployee.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/ITServiceManager/ITServiceManager/Form1.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormOrder.Designer.cs similarity index 74% rename from ITServiceManager/ITServiceManager/Form1.Designer.cs rename to ITServiceManager/ITServiceManager/Forms/FormOrder.Designer.cs index 70770e6..0f3cbed 100644 --- a/ITServiceManager/ITServiceManager/Form1.Designer.cs +++ b/ITServiceManager/ITServiceManager/Forms/FormOrder.Designer.cs @@ -1,14 +1,14 @@ -namespace ITServiceManager +namespace ITServiceManager.Forms { - partial class Form1 + partial class FormOrder { /// - /// Required designer variable. + /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// - /// Clean up any resources being used. + /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) @@ -23,17 +23,17 @@ #region Windows Form Designer generated code /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. + /// 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"; + this.Text = "FormOrder"; } #endregion } -} +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormOrder.cs b/ITServiceManager/ITServiceManager/Forms/FormOrder.cs new file mode 100644 index 0000000..5a47428 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormOrder.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 ITServiceManager.Forms +{ + public partial class FormOrder : Form + { + public FormOrder() + { + InitializeComponent(); + } + } +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormOrder.resx b/ITServiceManager/ITServiceManager/Forms/FormOrder.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormOrder.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/ITServiceManager/ITServiceManager/Forms/FormOrderService.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormOrderService.Designer.cs new file mode 100644 index 0000000..e690af9 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormOrderService.Designer.cs @@ -0,0 +1,39 @@ +namespace ITServiceManager.Forms +{ + partial class FormOrderService + { + /// + /// 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 = "FormOrderService"; + } + + #endregion + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormOrderService.cs b/ITServiceManager/ITServiceManager/Forms/FormOrderService.cs new file mode 100644 index 0000000..939d671 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormOrderService.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 ITServiceManager.Forms +{ + public partial class FormOrderService : Form + { + public FormOrderService() + { + InitializeComponent(); + } + } +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormOrderService.resx b/ITServiceManager/ITServiceManager/Forms/FormOrderService.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormOrderService.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/ITServiceManager/ITServiceManager/Forms/FormService.Designer.cs b/ITServiceManager/ITServiceManager/Forms/FormService.Designer.cs new file mode 100644 index 0000000..479ef30 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormService.Designer.cs @@ -0,0 +1,39 @@ +namespace ITServiceManager.Forms +{ + partial class FormService + { + /// + /// 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 = "FormService"; + } + + #endregion + } +} \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Forms/FormService.cs b/ITServiceManager/ITServiceManager/Forms/FormService.cs new file mode 100644 index 0000000..beb78ce --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormService.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 ITServiceManager.Forms +{ + public partial class FormService : Form + { + public FormService() + { + InitializeComponent(); + } + } +} diff --git a/ITServiceManager/ITServiceManager/Forms/FormService.resx b/ITServiceManager/ITServiceManager/Forms/FormService.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Forms/FormService.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/ITServiceManager/ITServiceManager/ITServiceManager.csproj b/ITServiceManager/ITServiceManager/ITServiceManager.csproj index b57c89e..f3520fa 100644 --- a/ITServiceManager/ITServiceManager/ITServiceManager.csproj +++ b/ITServiceManager/ITServiceManager/ITServiceManager.csproj @@ -6,6 +6,30 @@ enable true enable + preview + + + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Program.cs b/ITServiceManager/ITServiceManager/Program.cs index 0e5c502..096ef39 100644 --- a/ITServiceManager/ITServiceManager/Program.cs +++ b/ITServiceManager/ITServiceManager/Program.cs @@ -1,3 +1,7 @@ +using ITServiceManager.Repositories.Implementations; +using ITServiceManager.Repositories; +using Unity; + namespace ITServiceManager { internal static class Program @@ -11,7 +15,21 @@ namespace ITServiceManager // 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(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; } } } \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Properties/Resources.Designer.cs b/ITServiceManager/ITServiceManager/Properties/Resources.Designer.cs new file mode 100644 index 0000000..37fc7f8 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Properties/Resources.Designer.cs @@ -0,0 +1,113 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ITServiceManager.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("ITServiceManager.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 company { + get { + object obj = ResourceManager.GetObject("company", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap edit { + get { + object obj = ResourceManager.GetObject("edit", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap edit1 { + get { + object obj = ResourceManager.GetObject("edit1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap minus { + get { + object obj = ResourceManager.GetObject("minus", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap plus { + get { + object obj = ResourceManager.GetObject("plus", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ITServiceManager/ITServiceManager/Properties/Resources.resx b/ITServiceManager/ITServiceManager/Properties/Resources.resx new file mode 100644 index 0000000..edbe07a --- /dev/null +++ b/ITServiceManager/ITServiceManager/Properties/Resources.resx @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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\company.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\plus.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\minus.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ITServiceManager/ITServiceManager/Repositories/IAppointmentRepository.cs b/ITServiceManager/ITServiceManager/Repositories/IAppointmentRepository.cs new file mode 100644 index 0000000..71d2109 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/IAppointmentRepository.cs @@ -0,0 +1,11 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; + +public interface IAppointmentRepository +{ + IEnumerable ReadAppointments(); + Appointment ReadAppointmentById(int id); + void CreateAppointment(Appointment appointment); + void UpdateAppointment(Appointment appointment); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/ICompanyRepository.cs b/ITServiceManager/ITServiceManager/Repositories/ICompanyRepository.cs new file mode 100644 index 0000000..f2f42ba --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/ICompanyRepository.cs @@ -0,0 +1,12 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; + +public interface ICompanyRepository +{ + IEnumerable ReadCompanies(); + Company ReadCompanyById(int id); + void CreateCompany(Company company); + void UpdateCompany(Company company); + void DeleteCompany(int id); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/IEmployeeRepository.cs b/ITServiceManager/ITServiceManager/Repositories/IEmployeeRepository.cs new file mode 100644 index 0000000..cc0fbbc --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/IEmployeeRepository.cs @@ -0,0 +1,11 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; +public interface IEmployeeRepository +{ + IEnumerable ReadEmployees(); + Employee ReadEmployeeById(int id); + void CreateEmployee(Employee employee); + void UpdateEmployee(Employee employee); + void DeleteEmployee(int id); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/IOrderRepository.cs b/ITServiceManager/ITServiceManager/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..d4632c4 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/IOrderRepository.cs @@ -0,0 +1,11 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; + +public interface IOrderRepository +{ + IEnumerable ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderId = null, int? companyId = null); + Order ReadOrderById(int orderId); + void CreateOrder(Order order); + void DeleteOrder(int id); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/IOrderServiceRepository.cs b/ITServiceManager/ITServiceManager/Repositories/IOrderServiceRepository.cs new file mode 100644 index 0000000..d64b861 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/IOrderServiceRepository.cs @@ -0,0 +1,10 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; + +public interface IOrderServiceRepository +{ + IEnumerable ReadServicesConsumption(); + OrderService ReadServiceConsumptionById(int id); + void CreateServiceConsumption(OrderService serviceConsumption); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/IServiceRepository.cs b/ITServiceManager/ITServiceManager/Repositories/IServiceRepository.cs new file mode 100644 index 0000000..39a360e --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/IServiceRepository.cs @@ -0,0 +1,12 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories; + +public interface IServiceRepository +{ + IEnumerable ReadServices(); + Service ReadServiceById(int id); + void CreateService(Service service); + void UpdateService(Service service); + void DeleteService(int id); +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/AppointmentRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/AppointmentRepository.cs new file mode 100644 index 0000000..0127623 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/AppointmentRepository.cs @@ -0,0 +1,23 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class AppointmentRepository : IAppointmentRepository +{ + public IEnumerable ReadAppointments() + { + return []; + } + public Appointment ReadAppointmentById(int id) + { + return null; + } + public void CreateAppointment(Appointment appointment) + { + + } + public void UpdateAppointment(Appointment appointment) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/CompanyRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/CompanyRepository.cs new file mode 100644 index 0000000..df2e94b --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/CompanyRepository.cs @@ -0,0 +1,27 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class CompanyRepository : ICompanyRepository +{ + public IEnumerable ReadCompanies() + { + return []; + } + public Company ReadCompanyById(int id) + { + return null; + } + public void CreateCompany(Company company) + { + + } + public void UpdateCompany(Company company) + { + + } + public void DeleteCompany(int id) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/EmployeeRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/EmployeeRepository.cs new file mode 100644 index 0000000..3cc552d --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/EmployeeRepository.cs @@ -0,0 +1,27 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class EmployeeRepository : IEmployeeRepository +{ + public IEnumerable ReadEmployees() + { + return []; + } + public Employee ReadEmployeeById(int id) + { + return null; + } + public void CreateEmployee(Employee employee) + { + + } + public void UpdateEmployee(Employee employee) + { + + } + public void DeleteEmployee(int id) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderRepository.cs new file mode 100644 index 0000000..66dd2f7 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderRepository.cs @@ -0,0 +1,23 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class OrderRepository : IOrderRepository +{ + public IEnumerable ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderId = null, int? companyId = null) + { + return []; + } + public Order ReadOrderById(int orderId) + { + return null; + } + public void CreateOrder(Order order) + { + + } + public void DeleteOrder(int id) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderServiceRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderServiceRepository.cs new file mode 100644 index 0000000..c0f9232 --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/OrderServiceRepository.cs @@ -0,0 +1,19 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class OrderServiceRepository : IOrderServiceRepository +{ + public IEnumerable ReadServicesConsumption() + { + return []; + } + public OrderService ReadServiceConsumptionById(int id) + { + return null; + } + public void CreateServiceConsumption(OrderService serviceConsumption) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Repositories/Implementations/ServiceRepository.cs b/ITServiceManager/ITServiceManager/Repositories/Implementations/ServiceRepository.cs new file mode 100644 index 0000000..296eabf --- /dev/null +++ b/ITServiceManager/ITServiceManager/Repositories/Implementations/ServiceRepository.cs @@ -0,0 +1,27 @@ +using ITServiceManager.Entities; + +namespace ITServiceManager.Repositories.Implementations; + +public class ServiceRepository : IServiceRepository +{ + public IEnumerable ReadServices() + { + return []; + } + public Service ReadServiceById(int id) + { + return null; + } + public void CreateService(Service service) + { + + } + public void UpdateService(Service service) + { + + } + public void DeleteService(int id) + { + + } +} diff --git a/ITServiceManager/ITServiceManager/Resources/company.jpg b/ITServiceManager/ITServiceManager/Resources/company.jpg new file mode 100644 index 0000000..a51256f Binary files /dev/null and b/ITServiceManager/ITServiceManager/Resources/company.jpg differ diff --git a/ITServiceManager/ITServiceManager/Resources/edit.png b/ITServiceManager/ITServiceManager/Resources/edit.png new file mode 100644 index 0000000..769aabd Binary files /dev/null and b/ITServiceManager/ITServiceManager/Resources/edit.png differ diff --git a/ITServiceManager/ITServiceManager/Resources/minus.jpg b/ITServiceManager/ITServiceManager/Resources/minus.jpg new file mode 100644 index 0000000..1a42e9c Binary files /dev/null and b/ITServiceManager/ITServiceManager/Resources/minus.jpg differ diff --git a/ITServiceManager/ITServiceManager/Resources/plus.jpg b/ITServiceManager/ITServiceManager/Resources/plus.jpg new file mode 100644 index 0000000..b766719 Binary files /dev/null and b/ITServiceManager/ITServiceManager/Resources/plus.jpg differ