Исправил полностью БД, коммит сразу после занятия
This commit is contained in:
parent
243eaee2b8
commit
59b1054873
28
project/ProjectTourAgency/Enities/AddMoney.cs
Normal file
28
project/ProjectTourAgency/Enities/AddMoney.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities
|
||||
{
|
||||
public class AddMoney
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int MoneyAmount{ get; private set; }
|
||||
|
||||
public static AddMoney CreateEntity(int id,int cId,
|
||||
DateTime date, int money)
|
||||
{
|
||||
return new AddMoney
|
||||
{
|
||||
Id = id,
|
||||
ClientId = cId,
|
||||
Date = date,
|
||||
MoneyAmount = money
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -13,10 +13,10 @@ public class Client
|
||||
public string FullName { get; private set; } = string.Empty;
|
||||
public DateTime BirthDate { get; private set; }
|
||||
public string PhoneNumber { get; private set; } = string.Empty;
|
||||
public ClientSocialStatus ClientSocialStatus { get; private set; }
|
||||
public int Money { get; private set; }
|
||||
|
||||
public static Client CreateEntity(int id, string fullName,
|
||||
DateTime birthDate, string phoneNumber, ClientSocialStatus clientSocialStatus)
|
||||
DateTime birthDate, string phoneNumber, int money)
|
||||
{
|
||||
return new Client
|
||||
{
|
||||
@ -24,7 +24,7 @@ public class Client
|
||||
FullName = fullName,
|
||||
BirthDate = birthDate,
|
||||
PhoneNumber = phoneNumber,
|
||||
ClientSocialStatus = clientSocialStatus
|
||||
Money = money
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Discount
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public decimal DiscountPercent { get; private set; }
|
||||
public ClientSocialStatus ClientSocialStatus { get; private set; }
|
||||
public static Discount CreateEntity(int id,
|
||||
ClientSocialStatus clientSocialStatus,decimal discountPercent)
|
||||
{
|
||||
return new Discount
|
||||
{
|
||||
Id = id,
|
||||
ClientSocialStatus = clientSocialStatus,
|
||||
DiscountPercent = discountPercent
|
||||
};
|
||||
}
|
||||
}
|
28
project/ProjectTourAgency/Enities/Employee.cs
Normal file
28
project/ProjectTourAgency/Enities/Employee.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string FullName { get; private set; } = string.Empty;
|
||||
|
||||
public EmpoyeeJob EmployeeJob { get; private set; }
|
||||
|
||||
public static Employee CreateEntity(int id, string fullName,
|
||||
EmpoyeeJob job)
|
||||
{
|
||||
return new Employee
|
||||
{
|
||||
Id = id,
|
||||
FullName = fullName,
|
||||
EmployeeJob = job
|
||||
|
||||
};
|
||||
}
|
||||
}
|
@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities.Enums;
|
||||
|
||||
public enum ClientSocialStatus
|
||||
public enum EmpoyeeJob
|
||||
{
|
||||
None = 0,
|
||||
Student = 1,
|
||||
Veteran = 2,
|
||||
aged = 3
|
||||
Driver = 1,
|
||||
Archeologist = 2,
|
||||
ETC = 3
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Receipt
|
||||
{
|
||||
public int ClientId { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
|
||||
public int DiscountId { get; private set; }
|
||||
public decimal FinalCost { get; private set; }
|
||||
|
||||
public static Receipt CreateEntity(int clientId, int tourId,int discountId, decimal finalCost)
|
||||
{
|
||||
return new Receipt
|
||||
{
|
||||
ClientId = clientId,
|
||||
TourId = tourId,
|
||||
DiscountId = discountId,
|
||||
Date = DateTime.Now,
|
||||
FinalCost = finalCost
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
29
project/ProjectTourAgency/Enities/Route.cs
Normal file
29
project/ProjectTourAgency/Enities/Route.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Route
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
public string Destination { get; private set; } = string.Empty;
|
||||
public string Departure { get; private set; } = string.Empty;
|
||||
public int Duration { get; private set; }
|
||||
public static Route CreateEntity(int id, int TourId, string destination,
|
||||
string departure, int duration)
|
||||
{
|
||||
return new Route
|
||||
{
|
||||
Id = id,
|
||||
TourId = TourId,
|
||||
Destination = destination,
|
||||
Departure = departure,
|
||||
Duration = duration
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -10,22 +10,16 @@ namespace ProjectTourAgency.Enities;
|
||||
public class Tour
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Destination { get; private set; } = string.Empty;
|
||||
public string Departure { get; private set; } = string.Empty;
|
||||
public DateTime DepartureDate { get; private set; }
|
||||
public int Duration { get; private set; }
|
||||
public int Cost { get; private set; }
|
||||
public static Tour CreateEntity(int id, string destination,
|
||||
DateTime date, string departure, int cost, int duration)
|
||||
public static Tour CreateEntity(int id,
|
||||
DateTime date,int cost)
|
||||
{
|
||||
return new Tour
|
||||
{
|
||||
Id = id,
|
||||
Destination = destination,
|
||||
Departure = departure,
|
||||
DepartureDate = date,
|
||||
Cost = cost,
|
||||
Duration = duration
|
||||
Cost = cost
|
||||
};
|
||||
}
|
||||
}
|
||||
|
65
project/ProjectTourAgency/FormTourAgency.Designer.cs
generated
65
project/ProjectTourAgency/FormTourAgency.Designer.cs
generated
@ -31,11 +31,11 @@
|
||||
menuStrip1 = new MenuStrip();
|
||||
MenuToolStripMenuItem = new ToolStripMenuItem();
|
||||
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ToursToolStripMenuItem = new ToolStripMenuItem();
|
||||
ReceiptsToolStripMenuItem = new ToolStripMenuItem();
|
||||
DiscountsToolStripMenuItem = new ToolStripMenuItem();
|
||||
RotesToolStripMenuItem = new ToolStripMenuItem();
|
||||
EmployeesToolStripMenuItem = new ToolStripMenuItem();
|
||||
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||
CLientTourToolStripMenuItem = new ToolStripMenuItem();
|
||||
пополнитьБалансПользователяToolStripMenuItem = new ToolStripMenuItem();
|
||||
турToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
@ -51,7 +51,7 @@
|
||||
//
|
||||
// MenuToolStripMenuItem
|
||||
//
|
||||
MenuToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ClientsToolStripMenuItem, ToursToolStripMenuItem, ReceiptsToolStripMenuItem, DiscountsToolStripMenuItem });
|
||||
MenuToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ClientsToolStripMenuItem, RotesToolStripMenuItem, EmployeesToolStripMenuItem });
|
||||
MenuToolStripMenuItem.Name = "MenuToolStripMenuItem";
|
||||
MenuToolStripMenuItem.Size = new Size(94, 20);
|
||||
MenuToolStripMenuItem.Text = "Справочники";
|
||||
@ -59,44 +59,43 @@
|
||||
// ClientsToolStripMenuItem
|
||||
//
|
||||
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||
ClientsToolStripMenuItem.Size = new Size(217, 22);
|
||||
ClientsToolStripMenuItem.Size = new Size(140, 22);
|
||||
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||
//
|
||||
// ToursToolStripMenuItem
|
||||
// RotesToolStripMenuItem
|
||||
//
|
||||
ToursToolStripMenuItem.Name = "ToursToolStripMenuItem";
|
||||
ToursToolStripMenuItem.Size = new Size(217, 22);
|
||||
ToursToolStripMenuItem.Text = "Туры";
|
||||
ToursToolStripMenuItem.Click += ToursToolStripMenuItem_Click;
|
||||
RotesToolStripMenuItem.Name = "RotesToolStripMenuItem";
|
||||
RotesToolStripMenuItem.Size = new Size(140, 22);
|
||||
RotesToolStripMenuItem.Text = "маршруты";
|
||||
RotesToolStripMenuItem.Click += RotesToolStripMenuItem_Click;
|
||||
//
|
||||
// ReceiptsToolStripMenuItem
|
||||
// EmployeesToolStripMenuItem
|
||||
//
|
||||
ReceiptsToolStripMenuItem.Name = "ReceiptsToolStripMenuItem";
|
||||
ReceiptsToolStripMenuItem.Size = new Size(217, 22);
|
||||
ReceiptsToolStripMenuItem.Text = "Чеки";
|
||||
ReceiptsToolStripMenuItem.Click += ReceiptsToolStripMenuItem_Click;
|
||||
//
|
||||
// DiscountsToolStripMenuItem
|
||||
//
|
||||
DiscountsToolStripMenuItem.Name = "DiscountsToolStripMenuItem";
|
||||
DiscountsToolStripMenuItem.Size = new Size(217, 22);
|
||||
DiscountsToolStripMenuItem.Text = "Предостовляемые скидки";
|
||||
DiscountsToolStripMenuItem.Click += DiscountsToolStripMenuItem_Click;
|
||||
EmployeesToolStripMenuItem.Name = "EmployeesToolStripMenuItem";
|
||||
EmployeesToolStripMenuItem.Size = new Size(140, 22);
|
||||
EmployeesToolStripMenuItem.Text = "Сотрудники";
|
||||
EmployeesToolStripMenuItem.Click += EmployeesToolStripMenuItem_Click;
|
||||
//
|
||||
// OperationsToolStripMenuItem
|
||||
//
|
||||
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CLientTourToolStripMenuItem });
|
||||
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { пополнитьБалансПользователяToolStripMenuItem, турToolStripMenuItem });
|
||||
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||
OperationsToolStripMenuItem.Size = new Size(75, 20);
|
||||
OperationsToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// CLientTourToolStripMenuItem
|
||||
// пополнитьБалансПользователяToolStripMenuItem
|
||||
//
|
||||
CLientTourToolStripMenuItem.Name = "CLientTourToolStripMenuItem";
|
||||
CLientTourToolStripMenuItem.Size = new Size(180, 22);
|
||||
CLientTourToolStripMenuItem.Text = "Оформит поездку";
|
||||
CLientTourToolStripMenuItem.Click += CLientTourToolStripMenuItem_Click;
|
||||
пополнитьБалансПользователяToolStripMenuItem.Name = "пополнитьБалансПользователяToolStripMenuItem";
|
||||
пополнитьБалансПользователяToolStripMenuItem.Size = new Size(256, 22);
|
||||
пополнитьБалансПользователяToolStripMenuItem.Text = "Пополнить баланс пользователя";
|
||||
пополнитьБалансПользователяToolStripMenuItem.Click += пополнитьБалансПользователяToolStripMenuItem_Click;
|
||||
//
|
||||
// турToolStripMenuItem
|
||||
//
|
||||
турToolStripMenuItem.Name = "турToolStripMenuItem";
|
||||
турToolStripMenuItem.Size = new Size(256, 22);
|
||||
турToolStripMenuItem.Text = "Тур";
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
@ -130,9 +129,9 @@
|
||||
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||
private ToolStripMenuItem ToursToolStripMenuItem;
|
||||
private ToolStripMenuItem ReceiptsToolStripMenuItem;
|
||||
private ToolStripMenuItem DiscountsToolStripMenuItem;
|
||||
private ToolStripMenuItem CLientTourToolStripMenuItem;
|
||||
private ToolStripMenuItem RotesToolStripMenuItem;
|
||||
private ToolStripMenuItem EmployeesToolStripMenuItem;
|
||||
private ToolStripMenuItem пополнитьБалансПользователяToolStripMenuItem;
|
||||
private ToolStripMenuItem турToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,12 @@ public partial class FormTourAgency : Form
|
||||
}
|
||||
}
|
||||
|
||||
private void ToursToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
private void RotesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormTours>().ShowDialog();
|
||||
_container.Resolve<FormRoutes>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -37,11 +38,11 @@ public partial class FormTourAgency : Form
|
||||
}
|
||||
}
|
||||
|
||||
private void ReceiptsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void EmployeesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormReceipts>().ShowDialog();
|
||||
_container.Resolve<FormEmployees>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -49,23 +50,11 @@ public partial class FormTourAgency : Form
|
||||
}
|
||||
}
|
||||
|
||||
private void DiscountsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void ïîïîëíèòüÁàëàíñÏîëüçîâàòåëÿToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDiscounts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CLientTourToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormClientTour>().ShowDialog();
|
||||
_container.Resolve<FormAddMoney>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
118
project/ProjectTourAgency/Forms/FormAddMoney.Designer.cs
generated
Normal file
118
project/ProjectTourAgency/Forms/FormAddMoney.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormAddMoney
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelClient = new Label();
|
||||
labelMoney = new Label();
|
||||
comboBoxClientId = new ComboBox();
|
||||
textBoxMoney = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
labelClient.AutoSize = true;
|
||||
labelClient.Location = new Point(32, 28);
|
||||
labelClient.Name = "labelClient";
|
||||
labelClient.Size = new Size(66, 15);
|
||||
labelClient.TabIndex = 0;
|
||||
labelClient.Text = "ID Клиента";
|
||||
//
|
||||
// labelMoney
|
||||
//
|
||||
labelMoney.AutoSize = true;
|
||||
labelMoney.Location = new Point(32, 79);
|
||||
labelMoney.Name = "labelMoney";
|
||||
labelMoney.Size = new Size(173, 15);
|
||||
labelMoney.TabIndex = 1;
|
||||
labelMoney.Text = "на сколько пополнить баланс";
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(231, 28);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(121, 23);
|
||||
comboBoxClientId.TabIndex = 2;
|
||||
//
|
||||
// textBoxMoney
|
||||
//
|
||||
textBoxMoney.Location = new Point(231, 71);
|
||||
textBoxMoney.Name = "textBoxMoney";
|
||||
textBoxMoney.Size = new Size(126, 23);
|
||||
textBoxMoney.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(32, 128);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Пополнить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(242, 128);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(89, 26);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмнить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormAddMoney
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(386, 184);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxMoney);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(labelMoney);
|
||||
Controls.Add(labelClient);
|
||||
Name = "FormAddMoney";
|
||||
Text = "FormAddMoney";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelClient;
|
||||
private Label labelMoney;
|
||||
private ComboBox comboBoxClientId;
|
||||
private TextBox textBoxMoney;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
48
project/ProjectTourAgency/Forms/FormAddMoney.cs
Normal file
48
project/ProjectTourAgency/Forms/FormAddMoney.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormAddMoney : Form
|
||||
{
|
||||
private readonly IAddMoneyRepository _addMoneyRepository;
|
||||
public FormAddMoney(IAddMoneyRepository addMoneyRepository, IClientRepository clientRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_addMoneyRepository = addMoneyRepository ??
|
||||
throw new ArgumentNullException(nameof(addMoneyRepository));
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "Name";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxClientId.SelectedIndex < 0 || String.IsNullOrWhiteSpace(textBoxMoney.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_addMoneyRepository.CreateAddMoney(AddMoney.CreateEntity(0, (int)comboBoxClientId.SelectedValue!, DateTime.Now, Convert.ToInt32(textBoxMoney.Text)));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
134
project/ProjectTourAgency/Forms/FormClient.Designer.cs
generated
134
project/ProjectTourAgency/Forms/FormClient.Designer.cs
generated
@ -29,15 +29,15 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelName = new Label();
|
||||
textBoxName = new TextBox();
|
||||
labelBirthDate = new Label();
|
||||
textBoxNumber = new TextBox();
|
||||
labelDate = new Label();
|
||||
labelNumber = new Label();
|
||||
dateTimePickerBirth = new DateTimePicker();
|
||||
labelSocialStatus = new Label();
|
||||
labelMoney = new Label();
|
||||
textBoxName = new TextBox();
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
textBoxNumber = new TextBox();
|
||||
textBoxMoney = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxSocialStatus = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
@ -49,102 +49,98 @@
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Полное имя";
|
||||
//
|
||||
// textBoxName
|
||||
// labelDate
|
||||
//
|
||||
textBoxName.Location = new Point(156, 6);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// labelBirthDate
|
||||
//
|
||||
labelBirthDate.AutoSize = true;
|
||||
labelBirthDate.Location = new Point(12, 64);
|
||||
labelBirthDate.Name = "labelBirthDate";
|
||||
labelBirthDate.Size = new Size(90, 15);
|
||||
labelBirthDate.TabIndex = 2;
|
||||
labelBirthDate.Text = "Дата рождения";
|
||||
//
|
||||
// textBoxNumber
|
||||
//
|
||||
textBoxNumber.Location = new Point(156, 116);
|
||||
textBoxNumber.Name = "textBoxNumber";
|
||||
textBoxNumber.Size = new Size(100, 23);
|
||||
textBoxNumber.TabIndex = 5;
|
||||
textBoxNumber.Text = "+7";
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(12, 45);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(90, 15);
|
||||
labelDate.TabIndex = 1;
|
||||
labelDate.Text = "Дата рождения";
|
||||
//
|
||||
// labelNumber
|
||||
//
|
||||
labelNumber.AutoSize = true;
|
||||
labelNumber.Location = new Point(12, 119);
|
||||
labelNumber.Location = new Point(12, 88);
|
||||
labelNumber.Name = "labelNumber";
|
||||
labelNumber.Size = new Size(101, 15);
|
||||
labelNumber.TabIndex = 4;
|
||||
labelNumber.TabIndex = 2;
|
||||
labelNumber.Text = "Номер телефона";
|
||||
//
|
||||
// dateTimePickerBirth
|
||||
// labelMoney
|
||||
//
|
||||
dateTimePickerBirth.Location = new Point(156, 58);
|
||||
dateTimePickerBirth.Name = "dateTimePickerBirth";
|
||||
dateTimePickerBirth.Size = new Size(200, 23);
|
||||
dateTimePickerBirth.TabIndex = 6;
|
||||
labelMoney.AutoSize = true;
|
||||
labelMoney.Location = new Point(12, 128);
|
||||
labelMoney.Name = "labelMoney";
|
||||
labelMoney.Size = new Size(46, 15);
|
||||
labelMoney.TabIndex = 3;
|
||||
labelMoney.Text = "Баланс";
|
||||
//
|
||||
// labelSocialStatus
|
||||
// textBoxName
|
||||
//
|
||||
labelSocialStatus.AutoSize = true;
|
||||
labelSocialStatus.Location = new Point(12, 187);
|
||||
labelSocialStatus.Name = "labelSocialStatus";
|
||||
labelSocialStatus.Size = new Size(131, 15);
|
||||
labelSocialStatus.TabIndex = 7;
|
||||
labelSocialStatus.Text = "Основания для скидки";
|
||||
textBoxName.Location = new Point(131, 9);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Location = new Point(131, 45);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(200, 23);
|
||||
dateTimePickerDate.TabIndex = 5;
|
||||
//
|
||||
// textBoxNumber
|
||||
//
|
||||
textBoxNumber.Location = new Point(131, 85);
|
||||
textBoxNumber.Name = "textBoxNumber";
|
||||
textBoxNumber.Size = new Size(100, 23);
|
||||
textBoxNumber.TabIndex = 6;
|
||||
//
|
||||
// textBoxMoney
|
||||
//
|
||||
textBoxMoney.Location = new Point(131, 125);
|
||||
textBoxMoney.Name = "textBoxMoney";
|
||||
textBoxMoney.Size = new Size(100, 23);
|
||||
textBoxMoney.TabIndex = 7;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(38, 272);
|
||||
buttonSave.Location = new Point(49, 198);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 9;
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(201, 272);
|
||||
buttonCancel.Location = new Point(173, 198);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// comboBoxSocialStatus
|
||||
//
|
||||
comboBoxSocialStatus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSocialStatus.FormattingEnabled = true;
|
||||
comboBoxSocialStatus.Location = new Point(156, 179);
|
||||
comboBoxSocialStatus.Name = "comboBoxSocialStatus";
|
||||
comboBoxSocialStatus.Size = new Size(121, 23);
|
||||
comboBoxSocialStatus.TabIndex = 11;
|
||||
//
|
||||
// FormClient
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(369, 314);
|
||||
Controls.Add(comboBoxSocialStatus);
|
||||
ClientSize = new Size(389, 251);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelSocialStatus);
|
||||
Controls.Add(dateTimePickerBirth);
|
||||
Controls.Add(textBoxMoney);
|
||||
Controls.Add(textBoxNumber);
|
||||
Controls.Add(labelNumber);
|
||||
Controls.Add(labelBirthDate);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelMoney);
|
||||
Controls.Add(labelNumber);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormClient";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Клиенты";
|
||||
Text = "FormClient";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -152,14 +148,14 @@
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Label labelBirthDate;
|
||||
private TextBox textBoxNumber;
|
||||
private Label labelDate;
|
||||
private Label labelNumber;
|
||||
private DateTimePicker dateTimePickerBirth;
|
||||
private Label labelSocialStatus;
|
||||
private Label labelMoney;
|
||||
private TextBox textBoxName;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private TextBox textBoxNumber;
|
||||
private TextBox textBoxMoney;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxSocialStatus;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,75 +13,76 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms;
|
||||
|
||||
public partial class FormClient : Form
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
private readonly IClientRepository _clientRepository;
|
||||
|
||||
private int? _clientId;
|
||||
|
||||
public int Id
|
||||
public partial class FormClient : Form
|
||||
{
|
||||
set
|
||||
private readonly IClientRepository _clientRepository;
|
||||
|
||||
private int? _clientId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = _clientRepository.ReadClientById(value);
|
||||
if (client == null)
|
||||
{
|
||||
throw new InvalidOperationException(nameof(client));
|
||||
}
|
||||
textBoxName.Text = client.FullName;
|
||||
textBoxNumber.Text = client.PhoneNumber;
|
||||
textBoxMoney.Text = client.Money.ToString();
|
||||
dateTimePickerDate.Value = client.BirthDate;
|
||||
|
||||
}
|
||||
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 buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = _clientRepository.ReadClientById(value);
|
||||
if (client == null)
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxNumber.Text)
|
||||
|| string.IsNullOrWhiteSpace(textBoxMoney.Text) || string.IsNullOrWhiteSpace(dateTimePickerDate.Text))
|
||||
{
|
||||
throw new InvalidDataException(nameof(client));
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
textBoxName.Text = client.FullName;
|
||||
textBoxNumber.Text = client.PhoneNumber;
|
||||
comboBoxSocialStatus.SelectedItem = client.ClientSocialStatus;
|
||||
dateTimePickerBirth.Value = client.BirthDate;
|
||||
|
||||
if (_clientId.HasValue)
|
||||
{
|
||||
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_clientRepository.CreateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text, dateTimePickerDate.Value,textBoxNumber.Text, Convert.ToInt32(textBoxMoney.Text));
|
||||
}
|
||||
public FormClient(IClientRepository clientRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_clientRepository = clientRepository ??
|
||||
throw new ArgumentNullException(nameof(clientRepository));
|
||||
comboBoxSocialStatus.DataSource = Enum.GetValues(typeof(ClientSocialStatus));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxNumber.Text) || comboBoxSocialStatus.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if(_clientId.HasValue)
|
||||
{
|
||||
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_clientRepository.CreateClient(CreateClient(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message,"Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text,
|
||||
dateTimePickerBirth.Value, textBoxNumber.Text, (ClientSocialStatus)comboBoxSocialStatus.SelectedItem!);
|
||||
}
|
||||
|
@ -1,150 +0,0 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormClientTour
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxClientId = new ComboBox();
|
||||
labelCLientId = new Label();
|
||||
groupBox1 = new GroupBox();
|
||||
dataGridViewReceipts = new DataGridView();
|
||||
ColumnTour = new DataGridViewComboBoxColumn();
|
||||
ColumnReceipt = new DataGridViewTextBoxColumn();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewReceipts).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(208, 9);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(164, 23);
|
||||
comboBoxClientId.TabIndex = 7;
|
||||
//
|
||||
// labelCLientId
|
||||
//
|
||||
labelCLientId.AutoSize = true;
|
||||
labelCLientId.Location = new Point(37, 12);
|
||||
labelCLientId.Name = "labelCLientId";
|
||||
labelCLientId.Size = new Size(142, 15);
|
||||
labelCLientId.TabIndex = 6;
|
||||
labelCLientId.Text = "Идентификатор Клиента";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBox1.Controls.Add(dataGridViewReceipts);
|
||||
groupBox1.Location = new Point(37, 38);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(326, 337);
|
||||
groupBox1.TabIndex = 8;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "groupBox1";
|
||||
//
|
||||
// dataGridViewReceipts
|
||||
//
|
||||
dataGridViewReceipts.AllowUserToResizeColumns = false;
|
||||
dataGridViewReceipts.AllowUserToResizeRows = false;
|
||||
dataGridViewReceipts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewReceipts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewReceipts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewReceipts.Columns.AddRange(new DataGridViewColumn[] { ColumnTour, ColumnReceipt });
|
||||
dataGridViewReceipts.Location = new Point(6, 22);
|
||||
dataGridViewReceipts.MultiSelect = false;
|
||||
dataGridViewReceipts.Name = "dataGridViewReceipts";
|
||||
dataGridViewReceipts.RowHeadersVisible = false;
|
||||
dataGridViewReceipts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewReceipts.Size = new Size(314, 309);
|
||||
dataGridViewReceipts.TabIndex = 9;
|
||||
//
|
||||
// ColumnTour
|
||||
//
|
||||
ColumnTour.HeaderText = "Туры";
|
||||
ColumnTour.Name = "ColumnTour";
|
||||
//
|
||||
// ColumnReceipt
|
||||
//
|
||||
ColumnReceipt.HeaderText = "Ид Чека";
|
||||
ColumnReceipt.Name = "ColumnReceipt";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(285, 397);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(43, 397);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 11;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormClientTour
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(398, 432);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(labelCLientId);
|
||||
Name = "FormClientTour";
|
||||
Text = "FormClientTour";
|
||||
groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewReceipts).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxClientId;
|
||||
private Label labelCLientId;
|
||||
private GroupBox groupBox1;
|
||||
private DataGridView dataGridViewReceipts;
|
||||
private DataGridViewCheckBoxColumn Column1;
|
||||
private Button button1;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewComboBoxColumn ColumnTour;
|
||||
private DataGridViewTextBoxColumn ColumnReceipt;
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormClientTour : Form
|
||||
{
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
public FormClientTour(IReceiptRepository receiptRepository,
|
||||
IClientRepository clientRepository, ITourRepository tourRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_receiptRepository = receiptRepository ??
|
||||
throw new ArgumentNullException(nameof(receiptRepository));
|
||||
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "FullName";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
|
||||
ColumnTour.DataSource = tourRepository.ReadTours();
|
||||
ColumnTour.DisplayMember = "Departure";
|
||||
ColumnTour.ValueMember = "Id";
|
||||
|
||||
|
||||
}
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewReceipts.RowCount < 1 ||
|
||||
comboBoxClientId.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_receiptRepository.CreateReceipt(Receipt.CreateEntity((int)comboBoxClientId.SelectedValue!, Convert.ToInt32(ColumnTour.ValueMember), 0, 0));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Receipt> CreateListClientTourFromDataGrid()
|
||||
{
|
||||
var list = new List<Receipt>();
|
||||
foreach (DataGridViewRow row in dataGridViewReceipts.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnTour"].Value == null || row.Cells["ColumnReceipt"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
list.Add(Receipt.CreateEntity((int)comboBoxClientId.SelectedValue!, Convert.ToInt32(ColumnTour.ValueMember), 0, 0));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
122
project/ProjectTourAgency/Forms/FormDiscount.Designer.cs
generated
122
project/ProjectTourAgency/Forms/FormDiscount.Designer.cs
generated
@ -1,122 +0,0 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormDiscount
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelDiscount = new Label();
|
||||
comboBoxSocialStatus = new ComboBox();
|
||||
labelSocialStatus = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
numericUpDownDiscount = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownDiscount).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelDiscount
|
||||
//
|
||||
labelDiscount.AutoSize = true;
|
||||
labelDiscount.Location = new Point(25, 82);
|
||||
labelDiscount.Name = "labelDiscount";
|
||||
labelDiscount.Size = new Size(88, 15);
|
||||
labelDiscount.TabIndex = 0;
|
||||
labelDiscount.Text = "Размер скидки";
|
||||
//
|
||||
// comboBoxSocialStatus
|
||||
//
|
||||
comboBoxSocialStatus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSocialStatus.FormattingEnabled = true;
|
||||
comboBoxSocialStatus.Location = new Point(182, 33);
|
||||
comboBoxSocialStatus.Name = "comboBoxSocialStatus";
|
||||
comboBoxSocialStatus.Size = new Size(121, 23);
|
||||
comboBoxSocialStatus.TabIndex = 13;
|
||||
//
|
||||
// labelSocialStatus
|
||||
//
|
||||
labelSocialStatus.AutoSize = true;
|
||||
labelSocialStatus.Location = new Point(25, 33);
|
||||
labelSocialStatus.Name = "labelSocialStatus";
|
||||
labelSocialStatus.Size = new Size(131, 15);
|
||||
labelSocialStatus.TabIndex = 12;
|
||||
labelSocialStatus.Text = "Основания для скидки";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(228, 139);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 15;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(65, 139);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 14;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownDiscount
|
||||
//
|
||||
numericUpDownDiscount.DecimalPlaces = 2;
|
||||
numericUpDownDiscount.Increment = new decimal(new int[] { 1, 0, 0, 131072 });
|
||||
numericUpDownDiscount.Location = new Point(182, 82);
|
||||
numericUpDownDiscount.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
numericUpDownDiscount.Name = "numericUpDownDiscount";
|
||||
numericUpDownDiscount.Size = new Size(121, 23);
|
||||
numericUpDownDiscount.TabIndex = 16;
|
||||
//
|
||||
// FormDiscount
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(383, 174);
|
||||
Controls.Add(numericUpDownDiscount);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxSocialStatus);
|
||||
Controls.Add(labelSocialStatus);
|
||||
Controls.Add(labelDiscount);
|
||||
Name = "FormDiscount";
|
||||
Text = "FormDiscount";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownDiscount).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelDiscount;
|
||||
private ComboBox comboBoxSocialStatus;
|
||||
private Label labelSocialStatus;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private NumericUpDown numericUpDownDiscount;
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms;
|
||||
|
||||
public partial class FormDiscount : Form
|
||||
{
|
||||
private readonly IDiscountRepository _discountRepository;
|
||||
|
||||
private int? _discountId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var discount = _discountRepository.ReadDiscountById(value);
|
||||
if (discount == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(discount));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormDiscount(IDiscountRepository discountRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_discountRepository = discountRepository ??
|
||||
throw new ArgumentNullException(nameof(discountRepository));
|
||||
comboBoxSocialStatus.DataSource = Enum.GetValues(typeof(ClientSocialStatus));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(numericUpDownDiscount.Text)
|
||||
|| comboBoxSocialStatus.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_discountId.HasValue)
|
||||
{
|
||||
_discountRepository.UpdateDiscount(CreateDiscount(_discountId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_discountRepository.CreateDiscount(CreateDiscount(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Discount CreateDiscount(int id) => Discount.CreateEntity(id, (ClientSocialStatus)comboBoxSocialStatus.SelectedItem!,numericUpDownDiscount.Value );
|
||||
}
|
118
project/ProjectTourAgency/Forms/FormEmployee.Designer.cs
generated
Normal file
118
project/ProjectTourAgency/Forms/FormEmployee.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormEmployee
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxJob = new ComboBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxJob
|
||||
//
|
||||
comboBoxJob.FormattingEnabled = true;
|
||||
comboBoxJob.Location = new Point(130, 75);
|
||||
comboBoxJob.Name = "comboBoxJob";
|
||||
comboBoxJob.Size = new Size(121, 23);
|
||||
comboBoxJob.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 75);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(69, 15);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Должность";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 31);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(31, 15);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Имя";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(130, 28);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(42, 148);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(155, 148);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormEmployee
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(338, 224);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxJob);
|
||||
Name = "FormEmployee";
|
||||
Text = "FormEmployee";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxJob;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
87
project/ProjectTourAgency/Forms/FormEmployee.cs
Normal file
87
project/ProjectTourAgency/Forms/FormEmployee.cs
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.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 InvalidOperationException(nameof(employee));
|
||||
}
|
||||
textBoxName.Text = employee.FullName;
|
||||
comboBoxJob.SelectedItem = employee.EmployeeJob;
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении ланных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeRepository = employeeRepository ??
|
||||
throw new ArgumentNullException(nameof(employeeRepository));
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(comboBoxJob.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_employeeId.HasValue)
|
||||
{
|
||||
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_employeeRepository.CreateEmployee(CreateEmployee(_employeeId.Value));
|
||||
}
|
||||
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, textBoxName.Text, (Enities.Enums.EmpoyeeJob)comboBoxJob.SelectedItem!);
|
||||
}
|
||||
}
|
125
project/ProjectTourAgency/Forms/FormEmployees.Designer.cs
generated
Normal file
125
project/ProjectTourAgency/Forms/FormEmployees.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormEmployees
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(783, 450);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(783, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 450);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.free_icon_delete_3807871;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(43, 276);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(61, 59);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.free_icon_edit_8679935;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(43, 142);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(61, 59);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.free_icon_add_button_5974633;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(43, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(61, 59);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormEmployees
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(932, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormEmployees";
|
||||
Text = "FormEmployees";
|
||||
Load += FormEmployees_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
112
project/ProjectTourAgency/Forms/FormEmployees.cs
Normal file
112
project/ProjectTourAgency/Forms/FormEmployees.cs
Normal file
@ -0,0 +1,112 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormEmployees: Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
|
||||
public FormEmployees(IEmployeeRepository employeeRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(_employeeRepository));
|
||||
}
|
||||
|
||||
private void FormEmployees_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<FormClient>().ShowDialog();
|
||||
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<FormEmployee>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_employeeRepository.DeleteEmployee(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _employeeRepository.ReadEmployees();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
167
project/ProjectTourAgency/Forms/FormReceipt.Designer.cs
generated
167
project/ProjectTourAgency/Forms/FormReceipt.Designer.cs
generated
@ -1,167 +0,0 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormReceipt
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelCLientId = new Label();
|
||||
labelTourId = new Label();
|
||||
labelDIscountId = new Label();
|
||||
label1 = new Label();
|
||||
textBoxFinalCost = new TextBox();
|
||||
comboBoxClientId = new ComboBox();
|
||||
comboBoxDIscountId = new ComboBox();
|
||||
comboBoxTourId = new ComboBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCLientId
|
||||
//
|
||||
labelCLientId.AutoSize = true;
|
||||
labelCLientId.Location = new Point(12, 29);
|
||||
labelCLientId.Name = "labelCLientId";
|
||||
labelCLientId.Size = new Size(142, 15);
|
||||
labelCLientId.TabIndex = 0;
|
||||
labelCLientId.Text = "Идентификатор Клиента";
|
||||
//
|
||||
// labelTourId
|
||||
//
|
||||
labelTourId.AutoSize = true;
|
||||
labelTourId.Location = new Point(12, 73);
|
||||
labelTourId.Name = "labelTourId";
|
||||
labelTourId.Size = new Size(122, 15);
|
||||
labelTourId.TabIndex = 1;
|
||||
labelTourId.Text = "Идентификатор Тура";
|
||||
//
|
||||
// labelDIscountId
|
||||
//
|
||||
labelDIscountId.AutoSize = true;
|
||||
labelDIscountId.Location = new Point(12, 118);
|
||||
labelDIscountId.Name = "labelDIscountId";
|
||||
labelDIscountId.Size = new Size(137, 15);
|
||||
labelDIscountId.TabIndex = 2;
|
||||
labelDIscountId.Text = "Идентификатор Скидки";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 156);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(95, 15);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Сумма к опалет";
|
||||
//
|
||||
// textBoxFinalCost
|
||||
//
|
||||
textBoxFinalCost.Location = new Point(160, 153);
|
||||
textBoxFinalCost.Name = "textBoxFinalCost";
|
||||
textBoxFinalCost.Size = new Size(100, 23);
|
||||
textBoxFinalCost.TabIndex = 4;
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(160, 26);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(121, 23);
|
||||
comboBoxClientId.TabIndex = 5;
|
||||
//
|
||||
// comboBoxDIscountId
|
||||
//
|
||||
comboBoxDIscountId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDIscountId.FormattingEnabled = true;
|
||||
comboBoxDIscountId.Location = new Point(160, 110);
|
||||
comboBoxDIscountId.Name = "comboBoxDIscountId";
|
||||
comboBoxDIscountId.Size = new Size(121, 23);
|
||||
comboBoxDIscountId.TabIndex = 6;
|
||||
//
|
||||
// comboBoxTourId
|
||||
//
|
||||
comboBoxTourId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTourId.FormattingEnabled = true;
|
||||
comboBoxTourId.Location = new Point(160, 65);
|
||||
comboBoxTourId.Name = "comboBoxTourId";
|
||||
comboBoxTourId.Size = new Size(121, 23);
|
||||
comboBoxTourId.TabIndex = 7;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(250, 211);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 15;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(57, 211);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 14;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormReceipt
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(361, 254);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxTourId);
|
||||
Controls.Add(comboBoxDIscountId);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(textBoxFinalCost);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(labelDIscountId);
|
||||
Controls.Add(labelTourId);
|
||||
Controls.Add(labelCLientId);
|
||||
Name = "FormReceipt";
|
||||
Text = "FormReceipt";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCLientId;
|
||||
private Label labelTourId;
|
||||
private Label labelDIscountId;
|
||||
private Label label1;
|
||||
private TextBox textBoxFinalCost;
|
||||
private ComboBox comboBoxClientId;
|
||||
private ComboBox comboBoxDIscountId;
|
||||
private ComboBox comboBoxTourId;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms;
|
||||
|
||||
public partial class FormReceipt : Form
|
||||
{
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
public FormReceipt(IReceiptRepository receiptRepository,
|
||||
IClientRepository clientRepository,
|
||||
ITourRepository tourRepository,
|
||||
IDiscountRepository discountRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_receiptRepository = receiptRepository ??
|
||||
throw new ArgumentNullException(nameof(receiptRepository));
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "FullName";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
|
||||
comboBoxTourId.DataSource = tourRepository.ReadTours();
|
||||
comboBoxTourId.DisplayMember = "Destination";
|
||||
comboBoxTourId.ValueMember = "Id";
|
||||
|
||||
comboBoxDIscountId.DataSource = discountRepository.ReadDiscounts();
|
||||
comboBoxDIscountId.DisplayMember = "DiscountPercent";
|
||||
comboBoxDIscountId.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxClientId.SelectedIndex < 0 ||
|
||||
comboBoxDIscountId.SelectedIndex < 0 ||
|
||||
comboBoxTourId.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var selectedTour = (Tour)comboBoxTourId.SelectedItem;
|
||||
var selectedDiscount = (Discount)comboBoxDIscountId.SelectedItem;
|
||||
|
||||
decimal finalCost = selectedTour.Cost - (selectedTour.Cost * (selectedDiscount.DiscountPercent /100));
|
||||
textBoxFinalCost.Text = finalCost.ToString();
|
||||
|
||||
|
||||
_receiptRepository.CreateReceipt(Receipt.CreateEntity( (int)(comboBoxClientId.SelectedValue!), (int)(comboBoxTourId.SelectedValue!), (int)(comboBoxDIscountId.SelectedValue!),Convert.ToDecimal(finalCost)));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormReceipts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
|
||||
public FormReceipts(IReceiptRepository ReceiptRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_receiptRepository = ReceiptRepository ?? throw new ArgumentNullException(nameof(_receiptRepository));
|
||||
}
|
||||
|
||||
private void FormReceipts_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<FormReceipt>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _receiptRepository.ReadReceipts();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormTour
|
||||
partial class FormRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -28,27 +28,18 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dateTimePickerDepartureDate = new DateTimePicker();
|
||||
textBoxDestination = new TextBox();
|
||||
labelDestination = new Label();
|
||||
labelDeparture = new Label();
|
||||
textBoxDuration = new TextBox();
|
||||
labelPrice = new Label();
|
||||
labelTourId = new Label();
|
||||
textBoxDeparture = new TextBox();
|
||||
labelDate = new Label();
|
||||
labelDuration = new Label();
|
||||
textBoxPrice = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxTourId = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePickerDepartureDate
|
||||
//
|
||||
dateTimePickerDepartureDate.Location = new Point(144, 114);
|
||||
dateTimePickerDepartureDate.Name = "dateTimePickerDepartureDate";
|
||||
dateTimePickerDepartureDate.Size = new Size(226, 23);
|
||||
dateTimePickerDepartureDate.TabIndex = 2;
|
||||
//
|
||||
// textBoxDestination
|
||||
//
|
||||
textBoxDestination.Location = new Point(144, 32);
|
||||
@ -76,19 +67,19 @@
|
||||
//
|
||||
// textBoxDuration
|
||||
//
|
||||
textBoxDuration.Location = new Point(144, 162);
|
||||
textBoxDuration.Location = new Point(144, 114);
|
||||
textBoxDuration.Name = "textBoxDuration";
|
||||
textBoxDuration.Size = new Size(226, 23);
|
||||
textBoxDuration.TabIndex = 7;
|
||||
//
|
||||
// labelPrice
|
||||
// labelTourId
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(35, 205);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(94, 15);
|
||||
labelPrice.TabIndex = 6;
|
||||
labelPrice.Text = "Стоимость тура";
|
||||
labelTourId.AutoSize = true;
|
||||
labelTourId.Location = new Point(38, 163);
|
||||
labelTourId.Name = "labelTourId";
|
||||
labelTourId.Size = new Size(94, 15);
|
||||
labelTourId.TabIndex = 6;
|
||||
labelTourId.Text = "Стоимость тура";
|
||||
//
|
||||
// textBoxDeparture
|
||||
//
|
||||
@ -97,31 +88,15 @@
|
||||
textBoxDeparture.Size = new Size(226, 23);
|
||||
textBoxDeparture.TabIndex = 8;
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(38, 120);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(84, 15);
|
||||
labelDate.TabIndex = 9;
|
||||
labelDate.Text = "Дата отбытия";
|
||||
//
|
||||
// labelDuration
|
||||
//
|
||||
labelDuration.AutoSize = true;
|
||||
labelDuration.Location = new Point(38, 162);
|
||||
labelDuration.Location = new Point(45, 117);
|
||||
labelDuration.Name = "labelDuration";
|
||||
labelDuration.Size = new Size(84, 15);
|
||||
labelDuration.TabIndex = 10;
|
||||
labelDuration.Text = "Дата отбытия";
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.Location = new Point(144, 205);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(226, 23);
|
||||
textBoxPrice.TabIndex = 11;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(63, 251);
|
||||
@ -142,24 +117,30 @@
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormTour
|
||||
// comboBoxTourId
|
||||
//
|
||||
comboBoxTourId.FormattingEnabled = true;
|
||||
comboBoxTourId.Location = new Point(144, 163);
|
||||
comboBoxTourId.Name = "comboBoxTourId";
|
||||
comboBoxTourId.Size = new Size(226, 23);
|
||||
comboBoxTourId.TabIndex = 14;
|
||||
//
|
||||
// FormRoute
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(414, 301);
|
||||
ClientSize = new Size(414, 284);
|
||||
Controls.Add(comboBoxTourId);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxPrice);
|
||||
Controls.Add(labelDuration);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(textBoxDeparture);
|
||||
Controls.Add(textBoxDuration);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(labelTourId);
|
||||
Controls.Add(labelDeparture);
|
||||
Controls.Add(textBoxDestination);
|
||||
Controls.Add(labelDestination);
|
||||
Controls.Add(dateTimePickerDepartureDate);
|
||||
Name = "FormTour";
|
||||
Name = "FormRoute";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Тур";
|
||||
ResumeLayout(false);
|
||||
@ -172,12 +153,13 @@
|
||||
private Label labelDestination;
|
||||
private Label labelDeparture;
|
||||
private TextBox textBoxDuration;
|
||||
private Label labelPrice;
|
||||
private Label labelTourId;
|
||||
private TextBox textBoxDeparture;
|
||||
private Label labelDate;
|
||||
private Label labelDuration;
|
||||
private TextBox textBoxPrice;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxTourId;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
@ -13,27 +15,26 @@ using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormTour : Form
|
||||
public partial class FormRoute : Form
|
||||
{
|
||||
private readonly ITourRepository _tourRepository;
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
|
||||
private int? _tourId;
|
||||
private int? _routeId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var tour = _tourRepository.ReadTourById(value);
|
||||
if (tour == null)
|
||||
var route = _routeRepository.ReadRouteById(value);
|
||||
if (route == null)
|
||||
{
|
||||
throw new InvalidOperationException(nameof(tour));
|
||||
throw new InvalidOperationException(nameof(route));
|
||||
}
|
||||
textBoxDestination.Text = tour.Destination;
|
||||
textBoxDeparture.Text = tour.Departure;
|
||||
dateTimePickerDepartureDate.Value = tour.DepartureDate;
|
||||
textBoxDuration.Text = tour.Duration.ToString();
|
||||
textBoxPrice.Text = tour.Cost.ToString();
|
||||
textBoxDestination.Text = route.Destination;
|
||||
textBoxDeparture.Text = route.Departure;
|
||||
textBoxDuration.Text = route.Duration.ToString();
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@ -43,11 +44,14 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public FormTour(ITourRepository tourRepository)
|
||||
public FormRoute(IRouteRepository routeRepository, ITourRepository tourRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_tourRepository = tourRepository ??
|
||||
throw new ArgumentNullException(nameof(tourRepository));
|
||||
_routeRepository = routeRepository ??
|
||||
throw new ArgumentNullException(nameof(routeRepository));
|
||||
comboBoxTourId.DataSource = tourRepository.ReadTours();
|
||||
comboBoxTourId.DisplayMember = "FullName";
|
||||
comboBoxTourId.ValueMember = "Id";
|
||||
|
||||
}
|
||||
|
||||
@ -62,13 +66,13 @@ namespace ProjectTourAgency.Forms
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_tourId.HasValue)
|
||||
if (_routeId.HasValue)
|
||||
{
|
||||
_tourRepository.UpdateTour(CreateTour(_tourId.Value));
|
||||
_routeRepository.UpdateRoute(CreateRoute(_routeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_tourRepository.CreateTour(CreateTour(_tourId.Value));
|
||||
_routeRepository.CreateRoute(CreateRoute(_routeId.Value));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
@ -81,8 +85,7 @@ namespace ProjectTourAgency.Forms
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Tour CreateTour(int id) => Tour.CreateEntity(id, textBoxDestination.Text, dateTimePickerDepartureDate.Value,
|
||||
textBoxDeparture.Text, int.Parse(textBoxPrice.Text),
|
||||
int.Parse(textBoxDuration.Text));
|
||||
private Route CreateRoute(int id) => Route.CreateEntity(id, (int)comboBoxTourId.SelectedValue!, textBoxDestination.Text,
|
||||
textBoxDeparture.Text, int.Parse(textBoxDuration.Text));
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormTours
|
||||
partial class FormRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -108,7 +108,7 @@
|
||||
Controls.Add(panel1);
|
||||
Name = "FormTours";
|
||||
Text = "Туры";
|
||||
Load += FormTours_Load;
|
||||
Load += FormRoutes_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
@ -1,4 +1,5 @@
|
||||
using ProjectTourAgency.Repositories;
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -12,20 +13,20 @@ using Unity;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormTours : Form
|
||||
public partial class FormRoutes : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly ITourRepository _tourRepository;
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
|
||||
public FormTours(ITourRepository tourRepository, IUnityContainer container)
|
||||
public FormRoutes(IRouteRepository routeRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_tourRepository = tourRepository ?? throw new ArgumentNullException(nameof(_tourRepository));
|
||||
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(_routeRepository));
|
||||
}
|
||||
|
||||
private void FormTours_Load(object sender, EventArgs e)
|
||||
private void FormRoutes_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -41,7 +42,7 @@ namespace ProjectTourAgency.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormTour>().ShowDialog();
|
||||
_container.Resolve<FormRoute>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -58,7 +59,7 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormTour>();
|
||||
var form = _container.Resolve<FormRoute>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
@ -84,7 +85,7 @@ namespace ProjectTourAgency.Forms
|
||||
|
||||
try
|
||||
{
|
||||
_tourRepository.DeleteTour(findId);
|
||||
_routeRepository.DeleteRoute(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -93,7 +94,7 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _tourRepository.ReadTours();
|
||||
private void LoadList() => dataGridViewData.DataSource = _routeRepository.ReadRoutes();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
@ -0,0 +1,39 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations
|
||||
{
|
||||
internal class AddMoneyRepository : IAddMoneyRepository
|
||||
|
||||
{
|
||||
public void CreateAddMoney(AddMoney client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteAddMoney(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AddMoney ReadAddMoneyById(int id)
|
||||
{
|
||||
return AddMoney.CreateEntity(0,0,DateTime.Now,0);
|
||||
}
|
||||
|
||||
public IEnumerable<AddMoney> ReadAddMoneys()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateAddMoney(AddMoney client)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class DiscountRepository : IDiscountRepository
|
||||
{
|
||||
public void CreateDiscount(Discount discount)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteDiscount(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Discount ReadDiscountById(int id)
|
||||
{
|
||||
return Discount.CreateEntity(0, 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Discount> ReadDiscounts()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateDiscount(Discount discount)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class EmployeeRepository : IEmployeeRepository
|
||||
{
|
||||
public void CreateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteEmployee(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Employee ReadEmployeeById(int id)
|
||||
{
|
||||
return Employee.CreateEntity(0, string.Empty,0);
|
||||
}
|
||||
|
||||
public IEnumerable<Employee> ReadEmployees()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class ReceiptRepository : IReceiptRepository
|
||||
{
|
||||
public void CreateReceipt(Receipt receipt)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<Receipt> ReadReceipts(DateTime? dateFrom = null, DateTime? dateTo = null, int? clientId = null, int? tourId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
37
project/ProjectTourAgency/Implementations/RouteRepository.cs
Normal file
37
project/ProjectTourAgency/Implementations/RouteRepository.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class RouteRepository : IRouteRepository
|
||||
{
|
||||
public void CreateRoute(Route route)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteRoute(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Route ReadRouteById(int id)
|
||||
{
|
||||
return Route.CreateEntity(0,0, string.Empty,string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Route> ReadRoutes()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateRoute(Route route)
|
||||
{
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ public class TourRepositiry : ITourRepository
|
||||
|
||||
public Tour ReadTourById(int id)
|
||||
{
|
||||
return Tour.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0,0);
|
||||
return Tour.CreateEntity(0,DateTime.Now,0);
|
||||
}
|
||||
|
||||
public IEnumerable<Tour> ReadTours()
|
||||
|
@ -1,3 +1,5 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using Unity;
|
||||
@ -22,9 +24,10 @@ namespace ProjectTourAgency
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IAddMoneyRepository, AddMoneyRepository>();
|
||||
container.RegisterType<IClientRepository, ClientRepository>();
|
||||
container.RegisterType<IDiscountRepository, DiscountRepository>();
|
||||
container.RegisterType<IReceiptRepository, ReceiptRepository>();
|
||||
container.RegisterType<IRouteRepository, RouteRepository>();
|
||||
container.RegisterType<IEmployeeRepository, EmployeeRepository>();
|
||||
container.RegisterType<ITourRepository, TourRepositiry>();
|
||||
|
||||
return container;
|
||||
|
@ -0,0 +1,20 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface IAddMoneyRepository
|
||||
{
|
||||
IEnumerable<AddMoney> ReadAddMoneys();
|
||||
|
||||
AddMoney ReadAddMoneyById(int id);
|
||||
|
||||
void CreateAddMoney(AddMoney client);
|
||||
void UpdateAddMoney(AddMoney client);
|
||||
|
||||
void DeleteAddMoney(int id);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories
|
||||
{
|
||||
public interface IClientTourRepisitory
|
||||
{
|
||||
IEnumerable<ClientTour> ReadClientTours(DateTime? dateFrom = null,
|
||||
DateTime? dateTo = null, int? clientId = null, int? tourId = null);
|
||||
|
||||
|
||||
void CreateReceipt(Receipt receipt);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories
|
||||
{
|
||||
public interface IClientTourRepository
|
||||
{
|
||||
IEnumerable<ClientTour> ReadClientTours(int? clientId = null, int? tourId = null);
|
||||
|
||||
|
||||
void CreateReceipt(ClientTour clientTour);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface IDiscountRepository
|
||||
{
|
||||
IEnumerable<Discount> ReadDiscounts();
|
||||
|
||||
Discount ReadDiscountById(int id);
|
||||
|
||||
void CreateDiscount(Discount discount);
|
||||
void UpdateDiscount(Discount discount);
|
||||
|
||||
void DeleteDiscount(int id);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
|
||||
namespace ProjectEmployeeAgency.Repositories;
|
||||
|
||||
public interface IEmployeeRepository
|
||||
{
|
||||
IEnumerable<Employee> ReadEmployees();
|
||||
|
||||
Employee ReadEmployeeById(int id);
|
||||
|
||||
void CreateEmployee(Employee tour);
|
||||
|
||||
void UpdateEmployee(Employee tour);
|
||||
|
||||
void DeleteEmployee(int id);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface IReceiptRepository
|
||||
{
|
||||
IEnumerable<Receipt> ReadReceipts(DateTime? dateFrom = null,
|
||||
DateTime? dateTo = null, int? clientId = null,int? tourId = null);
|
||||
|
||||
|
||||
void CreateReceipt(Receipt receipt);
|
||||
|
||||
}
|
21
project/ProjectTourAgency/Repositories/IRouteRepository.cs
Normal file
21
project/ProjectTourAgency/Repositories/IRouteRepository.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectRouteAgency.Repositories;
|
||||
|
||||
public interface IRouteRepository
|
||||
{
|
||||
IEnumerable<Route> ReadRoutes();
|
||||
|
||||
Route ReadRouteById(int id);
|
||||
|
||||
void CreateRoute(Route tour);
|
||||
|
||||
void UpdateRoute(Route tour);
|
||||
|
||||
void DeleteRoute(int id);
|
||||
}
|
28
project/newProject/ProjectTourAgency/Enities/AddMoney.cs
Normal file
28
project/newProject/ProjectTourAgency/Enities/AddMoney.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities
|
||||
{
|
||||
public class AddMoney
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int MoneyAmount{ get; private set; }
|
||||
|
||||
public static AddMoney CreateEntity(int id,int cId,
|
||||
DateTime date, int money)
|
||||
{
|
||||
return new AddMoney
|
||||
{
|
||||
Id = id,
|
||||
ClientId = cId,
|
||||
Date = date,
|
||||
MoneyAmount = money
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
31
project/newProject/ProjectTourAgency/Enities/Client.cs
Normal file
31
project/newProject/ProjectTourAgency/Enities/Client.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public int Id { get;private set; }
|
||||
public string FullName { get; private set; } = string.Empty;
|
||||
public DateTime BirthDate { get; private set; }
|
||||
public string PhoneNumber { get; private set; } = string.Empty;
|
||||
public int Money { get; private set; }
|
||||
|
||||
public static Client CreateEntity(int id, string fullName,
|
||||
DateTime birthDate, string phoneNumber, int money)
|
||||
{
|
||||
return new Client
|
||||
{
|
||||
Id = id,
|
||||
FullName = fullName,
|
||||
BirthDate = birthDate,
|
||||
PhoneNumber = phoneNumber,
|
||||
Money = money
|
||||
};
|
||||
}
|
||||
|
||||
}
|
27
project/newProject/ProjectTourAgency/Enities/ClientTour.cs
Normal file
27
project/newProject/ProjectTourAgency/Enities/ClientTour.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class ClientTour
|
||||
{
|
||||
public int ClientId { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static ClientTour CreateEntity(int clientId, int tourId, int count)
|
||||
{
|
||||
return new ClientTour
|
||||
{
|
||||
ClientId = clientId,
|
||||
TourId = tourId,
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
|
||||
}
|
28
project/newProject/ProjectTourAgency/Enities/Employee.cs
Normal file
28
project/newProject/ProjectTourAgency/Enities/Employee.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string FullName { get; private set; } = string.Empty;
|
||||
|
||||
public EmpoyeeJob EmployeeJob { get; private set; }
|
||||
|
||||
public static Employee CreateEntity(int id, string fullName,
|
||||
EmpoyeeJob job)
|
||||
{
|
||||
return new Employee
|
||||
{
|
||||
Id = id,
|
||||
FullName = fullName,
|
||||
EmployeeJob = job
|
||||
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities.Enums;
|
||||
|
||||
public enum EmpoyeeJob
|
||||
{
|
||||
None = 0,
|
||||
Driver = 1,
|
||||
Archeologist = 2,
|
||||
ETC = 3
|
||||
}
|
29
project/newProject/ProjectTourAgency/Enities/Route.cs
Normal file
29
project/newProject/ProjectTourAgency/Enities/Route.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Route
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
public string Destination { get; private set; } = string.Empty;
|
||||
public string Departure { get; private set; } = string.Empty;
|
||||
public int Duration { get; private set; }
|
||||
public static Route CreateEntity(int id, int TourId, string destination,
|
||||
string departure, int duration)
|
||||
{
|
||||
return new Route
|
||||
{
|
||||
Id = id,
|
||||
TourId = TourId,
|
||||
Destination = destination,
|
||||
Departure = departure,
|
||||
Duration = duration
|
||||
};
|
||||
}
|
||||
|
||||
}
|
25
project/newProject/ProjectTourAgency/Enities/Tour.cs
Normal file
25
project/newProject/ProjectTourAgency/Enities/Tour.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Enities;
|
||||
|
||||
public class Tour
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateTime DepartureDate { get; private set; }
|
||||
public int Cost { get; private set; }
|
||||
public static Tour CreateEntity(int id,
|
||||
DateTime date,int cost)
|
||||
{
|
||||
return new Tour
|
||||
{
|
||||
Id = id,
|
||||
DepartureDate = date,
|
||||
Cost = cost
|
||||
};
|
||||
}
|
||||
}
|
137
project/newProject/ProjectTourAgency/FormTourAgency.Designer.cs
generated
Normal file
137
project/newProject/ProjectTourAgency/FormTourAgency.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
||||
namespace ProjectTourAgency
|
||||
{
|
||||
partial class FormTourAgency
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
MenuToolStripMenuItem = new ToolStripMenuItem();
|
||||
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
RotesToolStripMenuItem = new ToolStripMenuItem();
|
||||
EmployeesToolStripMenuItem = new ToolStripMenuItem();
|
||||
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||
пополнитьБалансПользователяToolStripMenuItem = new ToolStripMenuItem();
|
||||
турToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { MenuToolStripMenuItem, OperationsToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(784, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// MenuToolStripMenuItem
|
||||
//
|
||||
MenuToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ClientsToolStripMenuItem, RotesToolStripMenuItem, EmployeesToolStripMenuItem });
|
||||
MenuToolStripMenuItem.Name = "MenuToolStripMenuItem";
|
||||
MenuToolStripMenuItem.Size = new Size(94, 20);
|
||||
MenuToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// ClientsToolStripMenuItem
|
||||
//
|
||||
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||
ClientsToolStripMenuItem.Size = new Size(140, 22);
|
||||
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||
//
|
||||
// RotesToolStripMenuItem
|
||||
//
|
||||
RotesToolStripMenuItem.Name = "RotesToolStripMenuItem";
|
||||
RotesToolStripMenuItem.Size = new Size(140, 22);
|
||||
RotesToolStripMenuItem.Text = "маршруты";
|
||||
RotesToolStripMenuItem.Click += RotesToolStripMenuItem_Click;
|
||||
//
|
||||
// EmployeesToolStripMenuItem
|
||||
//
|
||||
EmployeesToolStripMenuItem.Name = "EmployeesToolStripMenuItem";
|
||||
EmployeesToolStripMenuItem.Size = new Size(140, 22);
|
||||
EmployeesToolStripMenuItem.Text = "Сотрудники";
|
||||
EmployeesToolStripMenuItem.Click += EmployeesToolStripMenuItem_Click;
|
||||
//
|
||||
// OperationsToolStripMenuItem
|
||||
//
|
||||
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { пополнитьБалансПользователяToolStripMenuItem, турToolStripMenuItem });
|
||||
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||
OperationsToolStripMenuItem.Size = new Size(75, 20);
|
||||
OperationsToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// пополнитьБалансПользователяToolStripMenuItem
|
||||
//
|
||||
пополнитьБалансПользователяToolStripMenuItem.Name = "пополнитьБалансПользователяToolStripMenuItem";
|
||||
пополнитьБалансПользователяToolStripMenuItem.Size = new Size(256, 22);
|
||||
пополнитьБалансПользователяToolStripMenuItem.Text = "Пополнить баланс пользователя";
|
||||
пополнитьБалансПользователяToolStripMenuItem.Click += пополнитьБалансПользователяToolStripMenuItem_Click;
|
||||
//
|
||||
// турToolStripMenuItem
|
||||
//
|
||||
турToolStripMenuItem.Name = "турToolStripMenuItem";
|
||||
турToolStripMenuItem.Size = new Size(256, 22);
|
||||
турToolStripMenuItem.Text = "Тур";
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// FormTourAgency
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_08_2139261;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(menuStrip1);
|
||||
DoubleBuffered = true;
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "FormTourAgency";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Тур Агенство";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem MenuToolStripMenuItem;
|
||||
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||
private ToolStripMenuItem RotesToolStripMenuItem;
|
||||
private ToolStripMenuItem EmployeesToolStripMenuItem;
|
||||
private ToolStripMenuItem пополнитьБалансПользователяToolStripMenuItem;
|
||||
private ToolStripMenuItem турToolStripMenuItem;
|
||||
}
|
||||
}
|
64
project/newProject/ProjectTourAgency/FormTourAgency.cs
Normal file
64
project/newProject/ProjectTourAgency/FormTourAgency.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ProjectTourAgency.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectTourAgency;
|
||||
|
||||
public partial class FormTourAgency : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormTourAgency(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormClients>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RotesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRoutes>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void EmployeesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEmployees>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ïîïîëíèòüÁàëàíñÏîëüçîâàòåëÿToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAddMoney>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
123
project/newProject/ProjectTourAgency/FormTourAgency.resx
Normal file
123
project/newProject/ProjectTourAgency/FormTourAgency.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
120
project/newProject/ProjectTourAgency/Forms/.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
118
project/newProject/ProjectTourAgency/Forms/FormAddMoney.Designer.cs
generated
Normal file
118
project/newProject/ProjectTourAgency/Forms/FormAddMoney.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormAddMoney
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelClient = new Label();
|
||||
labelMoney = new Label();
|
||||
comboBoxClientId = new ComboBox();
|
||||
textBoxMoney = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
labelClient.AutoSize = true;
|
||||
labelClient.Location = new Point(32, 28);
|
||||
labelClient.Name = "labelClient";
|
||||
labelClient.Size = new Size(66, 15);
|
||||
labelClient.TabIndex = 0;
|
||||
labelClient.Text = "ID Клиента";
|
||||
//
|
||||
// labelMoney
|
||||
//
|
||||
labelMoney.AutoSize = true;
|
||||
labelMoney.Location = new Point(32, 79);
|
||||
labelMoney.Name = "labelMoney";
|
||||
labelMoney.Size = new Size(173, 15);
|
||||
labelMoney.TabIndex = 1;
|
||||
labelMoney.Text = "на сколько пополнить баланс";
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(231, 28);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(121, 23);
|
||||
comboBoxClientId.TabIndex = 2;
|
||||
//
|
||||
// textBoxMoney
|
||||
//
|
||||
textBoxMoney.Location = new Point(231, 71);
|
||||
textBoxMoney.Name = "textBoxMoney";
|
||||
textBoxMoney.Size = new Size(126, 23);
|
||||
textBoxMoney.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(32, 128);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Пополнить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(242, 128);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(89, 26);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмнить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormAddMoney
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(386, 184);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxMoney);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(labelMoney);
|
||||
Controls.Add(labelClient);
|
||||
Name = "FormAddMoney";
|
||||
Text = "FormAddMoney";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelClient;
|
||||
private Label labelMoney;
|
||||
private ComboBox comboBoxClientId;
|
||||
private TextBox textBoxMoney;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
48
project/newProject/ProjectTourAgency/Forms/FormAddMoney.cs
Normal file
48
project/newProject/ProjectTourAgency/Forms/FormAddMoney.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormAddMoney : Form
|
||||
{
|
||||
private readonly IAddMoneyRepository _addMoneyRepository;
|
||||
public FormAddMoney(IAddMoneyRepository addMoneyRepository, IClientRepository clientRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_addMoneyRepository = addMoneyRepository ??
|
||||
throw new ArgumentNullException(nameof(addMoneyRepository));
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "Name";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxClientId.SelectedIndex < 0 || String.IsNullOrWhiteSpace(textBoxMoney.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_addMoneyRepository.CreateAddMoney(AddMoney.CreateEntity(0, (int)comboBoxClientId.SelectedValue!, DateTime.Now, Convert.ToInt32(textBoxMoney.Text)));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormAddMoney.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormAddMoney.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
161
project/newProject/ProjectTourAgency/Forms/FormClient.Designer.cs
generated
Normal file
161
project/newProject/ProjectTourAgency/Forms/FormClient.Designer.cs
generated
Normal file
@ -0,0 +1,161 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelName = new Label();
|
||||
labelDate = new Label();
|
||||
labelNumber = new Label();
|
||||
labelMoney = new Label();
|
||||
textBoxName = new TextBox();
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
textBoxNumber = new TextBox();
|
||||
textBoxMoney = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(12, 9);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(75, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Полное имя";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(12, 45);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(90, 15);
|
||||
labelDate.TabIndex = 1;
|
||||
labelDate.Text = "Дата рождения";
|
||||
//
|
||||
// labelNumber
|
||||
//
|
||||
labelNumber.AutoSize = true;
|
||||
labelNumber.Location = new Point(12, 88);
|
||||
labelNumber.Name = "labelNumber";
|
||||
labelNumber.Size = new Size(101, 15);
|
||||
labelNumber.TabIndex = 2;
|
||||
labelNumber.Text = "Номер телефона";
|
||||
//
|
||||
// labelMoney
|
||||
//
|
||||
labelMoney.AutoSize = true;
|
||||
labelMoney.Location = new Point(12, 128);
|
||||
labelMoney.Name = "labelMoney";
|
||||
labelMoney.Size = new Size(46, 15);
|
||||
labelMoney.TabIndex = 3;
|
||||
labelMoney.Text = "Баланс";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(131, 9);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Location = new Point(131, 45);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(200, 23);
|
||||
dateTimePickerDate.TabIndex = 5;
|
||||
//
|
||||
// textBoxNumber
|
||||
//
|
||||
textBoxNumber.Location = new Point(131, 85);
|
||||
textBoxNumber.Name = "textBoxNumber";
|
||||
textBoxNumber.Size = new Size(100, 23);
|
||||
textBoxNumber.TabIndex = 6;
|
||||
//
|
||||
// textBoxMoney
|
||||
//
|
||||
textBoxMoney.Location = new Point(131, 125);
|
||||
textBoxMoney.Name = "textBoxMoney";
|
||||
textBoxMoney.Size = new Size(100, 23);
|
||||
textBoxMoney.TabIndex = 7;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(49, 198);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(173, 198);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormClient
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(389, 251);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxMoney);
|
||||
Controls.Add(textBoxNumber);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelMoney);
|
||||
Controls.Add(labelNumber);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormClient";
|
||||
Text = "FormClient";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private Label labelDate;
|
||||
private Label labelNumber;
|
||||
private Label labelMoney;
|
||||
private TextBox textBoxName;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private TextBox textBoxNumber;
|
||||
private TextBox textBoxMoney;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
88
project/newProject/ProjectTourAgency/Forms/FormClient.cs
Normal file
88
project/newProject/ProjectTourAgency/Forms/FormClient.cs
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.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 InvalidOperationException(nameof(client));
|
||||
}
|
||||
textBoxName.Text = client.FullName;
|
||||
textBoxNumber.Text = client.PhoneNumber;
|
||||
textBoxMoney.Text = client.Money.ToString();
|
||||
dateTimePickerDate.Value = client.BirthDate;
|
||||
|
||||
}
|
||||
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 buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxNumber.Text)
|
||||
|| string.IsNullOrWhiteSpace(textBoxMoney.Text) || string.IsNullOrWhiteSpace(dateTimePickerDate.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_clientId.HasValue)
|
||||
{
|
||||
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_clientRepository.CreateClient(CreateClient(_clientId.Value));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text, dateTimePickerDate.Value,textBoxNumber.Text, Convert.ToInt32(textBoxMoney.Text));
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormClient.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormClient.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormReceipts
|
||||
partial class FormClients
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -28,13 +28,59 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(775, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 371);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.free_icon_delete_3807871;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(43, 276);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(61, 59);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.free_icon_edit_8679935;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(43, 142);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(61, 59);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.free_icon_add_button_5974633;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(43, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(61, 59);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
@ -51,47 +97,30 @@
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(775, 371);
|
||||
dataGridViewData.TabIndex = 5;
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(775, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 371);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.free_icon_add_button_5974633;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(43, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(61, 59);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormReceipts
|
||||
// FormClients
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormReceipts";
|
||||
Text = "FormReceipts";
|
||||
Load += FormReceipts_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
Name = "FormClients";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Клиенты";
|
||||
Load += FormClients_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
@ -12,20 +12,20 @@ using Unity;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormDiscounts : Form
|
||||
public partial class FormClients : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IDiscountRepository _discountRepository;
|
||||
private readonly IClientRepository _clientRepository;
|
||||
|
||||
public FormDiscounts(IDiscountRepository discountRepository, IUnityContainer container)
|
||||
public FormClients(IClientRepository clientRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_discountRepository = discountRepository ?? throw new ArgumentNullException(nameof(_discountRepository));
|
||||
_clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(_clientRepository));
|
||||
}
|
||||
|
||||
private void FormDiscounts_Load(object sender, EventArgs e)
|
||||
private void FormClients_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -41,7 +41,7 @@ namespace ProjectTourAgency.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDiscount>().ShowDialog();
|
||||
_container.Resolve<FormClient>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -58,7 +58,7 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormDiscount>();
|
||||
var form = _container.Resolve<FormClient>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
@ -84,7 +84,7 @@ namespace ProjectTourAgency.Forms
|
||||
|
||||
try
|
||||
{
|
||||
_discountRepository.DeleteDiscount(findId);
|
||||
_clientRepository.DeleteClient(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch(Exception ex)
|
||||
@ -93,7 +93,7 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _discountRepository.ReadDiscounts();
|
||||
private void LoadList() => dataGridViewData.DataSource = _clientRepository.ReadClients();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
120
project/newProject/ProjectTourAgency/Forms/FormClients.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormClients.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
118
project/newProject/ProjectTourAgency/Forms/FormEmployee.Designer.cs
generated
Normal file
118
project/newProject/ProjectTourAgency/Forms/FormEmployee.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormEmployee
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxJob = new ComboBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxJob
|
||||
//
|
||||
comboBoxJob.FormattingEnabled = true;
|
||||
comboBoxJob.Location = new Point(130, 75);
|
||||
comboBoxJob.Name = "comboBoxJob";
|
||||
comboBoxJob.Size = new Size(121, 23);
|
||||
comboBoxJob.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 75);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(69, 15);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Должность";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 31);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(31, 15);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Имя";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(130, 28);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(42, 148);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(155, 148);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormEmployee
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(338, 224);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxJob);
|
||||
Name = "FormEmployee";
|
||||
Text = "FormEmployee";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxJob;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
87
project/newProject/ProjectTourAgency/Forms/FormEmployee.cs
Normal file
87
project/newProject/ProjectTourAgency/Forms/FormEmployee.cs
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.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 InvalidOperationException(nameof(employee));
|
||||
}
|
||||
textBoxName.Text = employee.FullName;
|
||||
comboBoxJob.SelectedItem = employee.EmployeeJob;
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении ланных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeRepository = employeeRepository ??
|
||||
throw new ArgumentNullException(nameof(employeeRepository));
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||
string.IsNullOrWhiteSpace(comboBoxJob.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_employeeId.HasValue)
|
||||
{
|
||||
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_employeeRepository.CreateEmployee(CreateEmployee(_employeeId.Value));
|
||||
}
|
||||
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, textBoxName.Text, (Enities.Enums.EmpoyeeJob)comboBoxJob.SelectedItem!);
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormEmployee.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormEmployee.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
125
project/newProject/ProjectTourAgency/Forms/FormEmployees.Designer.cs
generated
Normal file
125
project/newProject/ProjectTourAgency/Forms/FormEmployees.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormEmployees
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(783, 450);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(783, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 450);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.free_icon_delete_3807871;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(43, 276);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(61, 59);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.free_icon_edit_8679935;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(43, 142);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(61, 59);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.free_icon_add_button_5974633;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(43, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(61, 59);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormEmployees
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(932, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormEmployees";
|
||||
Text = "FormEmployees";
|
||||
Load += FormEmployees_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
112
project/newProject/ProjectTourAgency/Forms/FormEmployees.cs
Normal file
112
project/newProject/ProjectTourAgency/Forms/FormEmployees.cs
Normal file
@ -0,0 +1,112 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormEmployees: Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
|
||||
public FormEmployees(IEmployeeRepository employeeRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(_employeeRepository));
|
||||
}
|
||||
|
||||
private void FormEmployees_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<FormClient>().ShowDialog();
|
||||
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<FormEmployee>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_employeeRepository.DeleteEmployee(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _employeeRepository.ReadEmployees();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormEmployees.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormEmployees.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
165
project/newProject/ProjectTourAgency/Forms/FormRoute.Designer.cs
generated
Normal file
165
project/newProject/ProjectTourAgency/Forms/FormRoute.Designer.cs
generated
Normal file
@ -0,0 +1,165 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
textBoxDestination = new TextBox();
|
||||
labelDestination = new Label();
|
||||
labelDeparture = new Label();
|
||||
textBoxDuration = new TextBox();
|
||||
labelTourId = new Label();
|
||||
textBoxDeparture = new TextBox();
|
||||
labelDuration = new Label();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxTourId = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBoxDestination
|
||||
//
|
||||
textBoxDestination.Location = new Point(144, 32);
|
||||
textBoxDestination.Name = "textBoxDestination";
|
||||
textBoxDestination.Size = new Size(226, 23);
|
||||
textBoxDestination.TabIndex = 4;
|
||||
//
|
||||
// labelDestination
|
||||
//
|
||||
labelDestination.AutoSize = true;
|
||||
labelDestination.Location = new Point(38, 32);
|
||||
labelDestination.Name = "labelDestination";
|
||||
labelDestination.Size = new Size(100, 15);
|
||||
labelDestination.TabIndex = 3;
|
||||
labelDestination.Text = "Место прибытия";
|
||||
//
|
||||
// labelDeparture
|
||||
//
|
||||
labelDeparture.AutoSize = true;
|
||||
labelDeparture.Location = new Point(38, 78);
|
||||
labelDeparture.Name = "labelDeparture";
|
||||
labelDeparture.Size = new Size(91, 15);
|
||||
labelDeparture.TabIndex = 5;
|
||||
labelDeparture.Text = "Место отбытия";
|
||||
//
|
||||
// textBoxDuration
|
||||
//
|
||||
textBoxDuration.Location = new Point(144, 114);
|
||||
textBoxDuration.Name = "textBoxDuration";
|
||||
textBoxDuration.Size = new Size(226, 23);
|
||||
textBoxDuration.TabIndex = 7;
|
||||
//
|
||||
// labelTourId
|
||||
//
|
||||
labelTourId.AutoSize = true;
|
||||
labelTourId.Location = new Point(38, 163);
|
||||
labelTourId.Name = "labelTourId";
|
||||
labelTourId.Size = new Size(94, 15);
|
||||
labelTourId.TabIndex = 6;
|
||||
labelTourId.Text = "Стоимость тура";
|
||||
//
|
||||
// textBoxDeparture
|
||||
//
|
||||
textBoxDeparture.Location = new Point(144, 75);
|
||||
textBoxDeparture.Name = "textBoxDeparture";
|
||||
textBoxDeparture.Size = new Size(226, 23);
|
||||
textBoxDeparture.TabIndex = 8;
|
||||
//
|
||||
// labelDuration
|
||||
//
|
||||
labelDuration.AutoSize = true;
|
||||
labelDuration.Location = new Point(45, 117);
|
||||
labelDuration.Name = "labelDuration";
|
||||
labelDuration.Size = new Size(84, 15);
|
||||
labelDuration.TabIndex = 10;
|
||||
labelDuration.Text = "Дата отбытия";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(63, 251);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 12;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(256, 251);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 13;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// comboBoxTourId
|
||||
//
|
||||
comboBoxTourId.FormattingEnabled = true;
|
||||
comboBoxTourId.Location = new Point(144, 163);
|
||||
comboBoxTourId.Name = "comboBoxTourId";
|
||||
comboBoxTourId.Size = new Size(226, 23);
|
||||
comboBoxTourId.TabIndex = 14;
|
||||
//
|
||||
// FormRoute
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(414, 284);
|
||||
Controls.Add(comboBoxTourId);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelDuration);
|
||||
Controls.Add(textBoxDeparture);
|
||||
Controls.Add(textBoxDuration);
|
||||
Controls.Add(labelTourId);
|
||||
Controls.Add(labelDeparture);
|
||||
Controls.Add(textBoxDestination);
|
||||
Controls.Add(labelDestination);
|
||||
Name = "FormRoute";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Тур";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
private DateTimePicker dateTimePickerDepartureDate;
|
||||
private TextBox textBoxDestination;
|
||||
private Label labelDestination;
|
||||
private Label labelDeparture;
|
||||
private TextBox textBoxDuration;
|
||||
private Label labelTourId;
|
||||
private TextBox textBoxDeparture;
|
||||
private Label labelDate;
|
||||
private Label labelDuration;
|
||||
private TextBox textBoxPrice;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxTourId;
|
||||
}
|
||||
}
|
91
project/newProject/ProjectTourAgency/Forms/FormRoute.cs
Normal file
91
project/newProject/ProjectTourAgency/Forms/FormRoute.cs
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormRoute : Form
|
||||
{
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
|
||||
private int? _routeId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var route = _routeRepository.ReadRouteById(value);
|
||||
if (route == null)
|
||||
{
|
||||
throw new InvalidOperationException(nameof(route));
|
||||
}
|
||||
textBoxDestination.Text = route.Destination;
|
||||
textBoxDeparture.Text = route.Departure;
|
||||
textBoxDuration.Text = route.Duration.ToString();
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message,"Ошибка при получении ланных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormRoute(IRouteRepository routeRepository, ITourRepository tourRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_routeRepository = routeRepository ??
|
||||
throw new ArgumentNullException(nameof(routeRepository));
|
||||
comboBoxTourId.DataSource = tourRepository.ReadTours();
|
||||
comboBoxTourId.DisplayMember = "FullName";
|
||||
comboBoxTourId.ValueMember = "Id";
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxDestination.Text) ||
|
||||
string.IsNullOrWhiteSpace(textBoxDeparture.Text) || string.IsNullOrWhiteSpace(textBoxDuration.Text)
|
||||
|| string.IsNullOrWhiteSpace(textBoxPrice.Text) || string.IsNullOrWhiteSpace(dateTimePickerDepartureDate.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_routeId.HasValue)
|
||||
{
|
||||
_routeRepository.UpdateRoute(CreateRoute(_routeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_routeRepository.CreateRoute(CreateRoute(_routeId.Value));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Route CreateRoute(int id) => Route.CreateEntity(id, (int)comboBoxTourId.SelectedValue!, textBoxDestination.Text,
|
||||
textBoxDeparture.Text, int.Parse(textBoxDuration.Text));
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormRoute.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormRoute.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormDiscounts
|
||||
partial class FormRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -99,16 +99,16 @@
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormDiscounts
|
||||
// FormTours
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormDiscounts";
|
||||
Text = "FormDiscounts";
|
||||
Load += FormDiscounts_Load;
|
||||
Name = "FormTours";
|
||||
Text = "Туры";
|
||||
Load += FormRoutes_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
111
project/newProject/ProjectTourAgency/Forms/FormRoutes.cs
Normal file
111
project/newProject/ProjectTourAgency/Forms/FormRoutes.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.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 ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormRoutes : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
|
||||
public FormRoutes(IRouteRepository routeRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(_routeRepository));
|
||||
}
|
||||
|
||||
private void FormRoutes_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<FormRoute>().ShowDialog();
|
||||
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<FormRoute>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_routeRepository.DeleteRoute(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _routeRepository.ReadRoutes();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
project/newProject/ProjectTourAgency/Forms/FormRoutes.resx
Normal file
120
project/newProject/ProjectTourAgency/Forms/FormRoutes.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,39 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations
|
||||
{
|
||||
internal class AddMoneyRepository : IAddMoneyRepository
|
||||
|
||||
{
|
||||
public void CreateAddMoney(AddMoney client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteAddMoney(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AddMoney ReadAddMoneyById(int id)
|
||||
{
|
||||
return AddMoney.CreateEntity(0,0,DateTime.Now,0);
|
||||
}
|
||||
|
||||
public IEnumerable<AddMoney> ReadAddMoneys()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateAddMoney(AddMoney client)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class ClientRepository : IClientRepository
|
||||
{
|
||||
public void CreateClient(Client client)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteClient(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Client ReadClientById(int id)
|
||||
{
|
||||
return Client.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Client> ReadClients()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateClient(Client client)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class EmployeeRepository : IEmployeeRepository
|
||||
{
|
||||
public void CreateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteEmployee(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Employee ReadEmployeeById(int id)
|
||||
{
|
||||
return Employee.CreateEntity(0, string.Empty,0);
|
||||
}
|
||||
|
||||
public IEnumerable<Employee> ReadEmployees()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class RouteRepository : IRouteRepository
|
||||
{
|
||||
public void CreateRoute(Route route)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteRoute(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Route ReadRouteById(int id)
|
||||
{
|
||||
return Route.CreateEntity(0,0, string.Empty,string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Route> ReadRoutes()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateRoute(Route route)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class TourRepositiry : ITourRepository
|
||||
{
|
||||
public void CreateTour(Tour tour)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteTour(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Tour ReadTourById(int id)
|
||||
{
|
||||
return Tour.CreateEntity(0,DateTime.Now,0);
|
||||
}
|
||||
|
||||
public IEnumerable<Tour> ReadTours()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateTour(Tour tour)
|
||||
{
|
||||
}
|
||||
}
|
36
project/newProject/ProjectTourAgency/Program.cs
Normal file
36
project/newProject/ProjectTourAgency/Program.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using ProjectEmployeeAgency.Repositories;
|
||||
using ProjectRouteAgency.Repositories;
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectTourAgency
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(CreateContainer().Resolve<FormTourAgency>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IAddMoneyRepository, AddMoneyRepository>();
|
||||
container.RegisterType<IClientRepository, ClientRepository>();
|
||||
container.RegisterType<IRouteRepository, RouteRepository>();
|
||||
container.RegisterType<IEmployeeRepository, EmployeeRepository>();
|
||||
container.RegisterType<ITourRepository, TourRepositiry>();
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
project/newProject/ProjectTourAgency/ProjectTourAgency.sln
Normal file
25
project/newProject/ProjectTourAgency/ProjectTourAgency.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34525.116
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectTourAgency", "ProjectTourAgency.csproj", "{1DF30EE1-3015-4980-A3F9-153C7A11049F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1DF30EE1-3015-4980-A3F9-153C7A11049F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DF30EE1-3015-4980-A3F9-153C7A11049F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DF30EE1-3015-4980-A3F9-153C7A11049F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DF30EE1-3015-4980-A3F9-153C7A11049F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E81AC68F-76E2-40C7-8F94-77E003A138B0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
113
project/newProject/ProjectTourAgency/Properties/Resources.Designer.cs
generated
Normal file
113
project/newProject/ProjectTourAgency/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectTourAgency.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectTourAgency.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap free_icon_add_button_5974633 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("free-icon-add-button-5974633", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap free_icon_delete_3807871 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("free-icon-delete-3807871", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap free_icon_edit_8679935 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("free-icon-edit-8679935", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Снимок_экрана_2024_11_08_213926 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Снимок экрана 2024-11-08 213926", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Снимок_экрана_2024_11_08_2139261 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Снимок экрана 2024-11-08 2139261", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
@ -117,10 +117,20 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnTour.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnReceipt.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="free-icon-edit-8679935" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\free-icon-edit-8679935.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Снимок экрана 2024-11-08 213926" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Снимок экрана 2024-11-08 213926.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="free-icon-add-button-5974633" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\free-icon-add-button-5974633.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Снимок экрана 2024-11-08 2139261" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Снимок экрана 2024-11-08 2139261.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="free-icon-delete-3807871" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\free-icon-delete-3807871.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -0,0 +1,20 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface IAddMoneyRepository
|
||||
{
|
||||
IEnumerable<AddMoney> ReadAddMoneys();
|
||||
|
||||
AddMoney ReadAddMoneyById(int id);
|
||||
|
||||
void CreateAddMoney(AddMoney client);
|
||||
void UpdateAddMoney(AddMoney client);
|
||||
|
||||
void DeleteAddMoney(int id);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface IClientRepository
|
||||
{
|
||||
IEnumerable<Client> ReadClients();
|
||||
|
||||
Client ReadClientById(int id);
|
||||
|
||||
void CreateClient(Client client);
|
||||
void UpdateClient(Client client);
|
||||
|
||||
void DeleteClient(int id);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories
|
||||
{
|
||||
public interface IClientTourRepository
|
||||
{
|
||||
IEnumerable<ClientTour> ReadClientTours(int? clientId = null, int? tourId = null);
|
||||
|
||||
|
||||
void CreateReceipt(ClientTour clientTour);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
|
||||
namespace ProjectEmployeeAgency.Repositories;
|
||||
|
||||
public interface IEmployeeRepository
|
||||
{
|
||||
IEnumerable<Employee> ReadEmployees();
|
||||
|
||||
Employee ReadEmployeeById(int id);
|
||||
|
||||
void CreateEmployee(Employee tour);
|
||||
|
||||
void UpdateEmployee(Employee tour);
|
||||
|
||||
void DeleteEmployee(int id);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectRouteAgency.Repositories;
|
||||
|
||||
public interface IRouteRepository
|
||||
{
|
||||
IEnumerable<Route> ReadRoutes();
|
||||
|
||||
Route ReadRouteById(int id);
|
||||
|
||||
void CreateRoute(Route tour);
|
||||
|
||||
void UpdateRoute(Route tour);
|
||||
|
||||
void DeleteRoute(int id);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories;
|
||||
|
||||
public interface ITourRepository
|
||||
{
|
||||
IEnumerable<Tour> ReadTours();
|
||||
|
||||
Tour ReadTourById(int id);
|
||||
|
||||
void CreateTour(Tour tour);
|
||||
|
||||
void UpdateTour(Tour tour);
|
||||
|
||||
void DeleteTour(int id);
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user