ну в принципе почти все, осталось разобраться только с тем, чтобы ФИО мастера и название услуги выводились и добавить подсчет времени
This commit is contained in:
parent
92e75d295e
commit
942fa52827
113
BeautySalon/BeautySalon/FormCheque.Designer.cs
generated
113
BeautySalon/BeautySalon/FormCheque.Designer.cs
generated
@ -32,15 +32,20 @@
|
||||
comboBoxClients = new ComboBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
labelReception = new Label();
|
||||
comboBoxReceptions = new ComboBox();
|
||||
labelService = new Label();
|
||||
comboBoxServices = new ComboBox();
|
||||
client = new Label();
|
||||
labelMaster = new Label();
|
||||
comboBoxMaster = new ComboBox();
|
||||
dateTimePickerDateReception = new DateTimePicker();
|
||||
labelPriceName = new Label();
|
||||
Price = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelPrice
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(19, 138);
|
||||
labelPrice.Location = new Point(25, 254);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(99, 20);
|
||||
labelPrice.TabIndex = 21;
|
||||
@ -48,67 +53,120 @@
|
||||
//
|
||||
// comboBoxClients
|
||||
//
|
||||
comboBoxClients.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxClients.FormattingEnabled = true;
|
||||
comboBoxClients.Location = new Point(176, 73);
|
||||
comboBoxClients.Location = new Point(176, 180);
|
||||
comboBoxClients.Name = "comboBoxClients";
|
||||
comboBoxClients.Size = new Size(290, 28);
|
||||
comboBoxClients.TabIndex = 20;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(327, 202);
|
||||
buttonCancel.Location = new Point(333, 417);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(133, 44);
|
||||
buttonCancel.TabIndex = 19;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(19, 202);
|
||||
buttonSave.Location = new Point(25, 417);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(133, 44);
|
||||
buttonSave.TabIndex = 18;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// labelReception
|
||||
// labelService
|
||||
//
|
||||
labelReception.AutoSize = true;
|
||||
labelReception.Location = new Point(25, 23);
|
||||
labelReception.Name = "labelReception";
|
||||
labelReception.Size = new Size(57, 20);
|
||||
labelReception.TabIndex = 17;
|
||||
labelReception.Text = "Прием";
|
||||
labelService.AutoSize = true;
|
||||
labelService.Location = new Point(25, 23);
|
||||
labelService.Name = "labelService";
|
||||
labelService.Size = new Size(54, 20);
|
||||
labelService.TabIndex = 17;
|
||||
labelService.Text = "Услуга";
|
||||
//
|
||||
// comboBoxReceptions
|
||||
// comboBoxServices
|
||||
//
|
||||
comboBoxReceptions.FormattingEnabled = true;
|
||||
comboBoxReceptions.Location = new Point(176, 20);
|
||||
comboBoxReceptions.Name = "comboBoxReceptions";
|
||||
comboBoxReceptions.Size = new Size(290, 28);
|
||||
comboBoxReceptions.TabIndex = 16;
|
||||
comboBoxServices.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxServices.FormattingEnabled = true;
|
||||
comboBoxServices.Location = new Point(176, 20);
|
||||
comboBoxServices.Name = "comboBoxServices";
|
||||
comboBoxServices.Size = new Size(290, 28);
|
||||
comboBoxServices.TabIndex = 16;
|
||||
comboBoxServices.SelectedIndexChanged += comboBoxServices_SelectedIndexChanged;
|
||||
//
|
||||
// client
|
||||
//
|
||||
client.AutoSize = true;
|
||||
client.Location = new Point(25, 81);
|
||||
client.Location = new Point(25, 188);
|
||||
client.Name = "client";
|
||||
client.Size = new Size(58, 20);
|
||||
client.TabIndex = 15;
|
||||
client.Text = "Клиент";
|
||||
//
|
||||
// labelMaster
|
||||
//
|
||||
labelMaster.AutoSize = true;
|
||||
labelMaster.Location = new Point(25, 103);
|
||||
labelMaster.Name = "labelMaster";
|
||||
labelMaster.Size = new Size(60, 20);
|
||||
labelMaster.TabIndex = 23;
|
||||
labelMaster.Text = "Мастер";
|
||||
//
|
||||
// comboBoxMaster
|
||||
//
|
||||
comboBoxMaster.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxMaster.FormattingEnabled = true;
|
||||
comboBoxMaster.Location = new Point(176, 100);
|
||||
comboBoxMaster.Name = "comboBoxMaster";
|
||||
comboBoxMaster.Size = new Size(290, 28);
|
||||
comboBoxMaster.TabIndex = 22;
|
||||
//
|
||||
// dateTimePickerDateReception
|
||||
//
|
||||
dateTimePickerDateReception.Location = new Point(176, 254);
|
||||
dateTimePickerDateReception.Name = "dateTimePickerDateReception";
|
||||
dateTimePickerDateReception.Size = new Size(290, 27);
|
||||
dateTimePickerDateReception.TabIndex = 24;
|
||||
//
|
||||
// labelPriceName
|
||||
//
|
||||
labelPriceName.AutoSize = true;
|
||||
labelPriceName.Location = new Point(142, 345);
|
||||
labelPriceName.Name = "labelPriceName";
|
||||
labelPriceName.Size = new Size(45, 20);
|
||||
labelPriceName.TabIndex = 25;
|
||||
labelPriceName.Text = "Цена";
|
||||
//
|
||||
// Price
|
||||
//
|
||||
Price.AutoSize = true;
|
||||
Price.Location = new Point(286, 345);
|
||||
Price.Name = "Price";
|
||||
Price.Size = new Size(115, 20);
|
||||
Price.TabIndex = 26;
|
||||
Price.Text = "0,0 тыщ рублей";
|
||||
//
|
||||
// FormCheque
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(499, 266);
|
||||
ClientSize = new Size(499, 482);
|
||||
Controls.Add(Price);
|
||||
Controls.Add(labelPriceName);
|
||||
Controls.Add(dateTimePickerDateReception);
|
||||
Controls.Add(labelMaster);
|
||||
Controls.Add(comboBoxMaster);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(comboBoxClients);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelReception);
|
||||
Controls.Add(comboBoxReceptions);
|
||||
Controls.Add(labelService);
|
||||
Controls.Add(comboBoxServices);
|
||||
Controls.Add(client);
|
||||
Name = "FormCheque";
|
||||
Text = "Чек";
|
||||
@ -122,8 +180,13 @@
|
||||
private ComboBox comboBoxClients;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private Label labelReception;
|
||||
private ComboBox comboBoxReceptions;
|
||||
private Label labelService;
|
||||
private ComboBox comboBoxServices;
|
||||
private Label client;
|
||||
private Label labelMaster;
|
||||
private ComboBox comboBoxMaster;
|
||||
private DateTimePicker dateTimePickerDateReception;
|
||||
private Label labelPriceName;
|
||||
private Label Price;
|
||||
}
|
||||
}
|
@ -1,27 +1,135 @@
|
||||
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 BeautySalonDBModels.Implements;
|
||||
using BeautySalonDBModels.Models;
|
||||
using BeautySalonDBModels;
|
||||
using System;
|
||||
|
||||
namespace BeautySalon
|
||||
{
|
||||
public partial class FormCheque : Form
|
||||
{
|
||||
|
||||
private List<Service> services;
|
||||
private List<Master> masters;
|
||||
private List<Client> clients;
|
||||
private readonly AbstractWorkWithStorage<Client> clientStorage;
|
||||
private readonly AbstractWorkWithStorage<Service> serviceStorage;
|
||||
private readonly AbstractWorkWithStorage<Master> masterStorage;
|
||||
private readonly AbstractWorkWithStorage<Cheque> chequeStorage;
|
||||
|
||||
|
||||
private int? _id;
|
||||
public int Id
|
||||
{
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
public FormCheque()
|
||||
public FormCheque(AbstractWorkWithStorage<Client> clientStorage,
|
||||
AbstractWorkWithStorage<Service> serviceStorage,
|
||||
AbstractWorkWithStorage<Master> masterStorage,
|
||||
AbstractWorkWithStorage<Cheque> chequeStorage)
|
||||
{
|
||||
this.clientStorage = clientStorage;
|
||||
this.serviceStorage = serviceStorage;
|
||||
this.masterStorage = masterStorage;
|
||||
this.chequeStorage = chequeStorage;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
comboBoxMaster.Enabled = false;
|
||||
|
||||
services = serviceStorage.GetObjects();
|
||||
foreach (Service service in services)
|
||||
{
|
||||
comboBoxServices.Items.Add(service).ToString();
|
||||
}
|
||||
|
||||
clients = clientStorage.GetObjects();
|
||||
foreach (Client client in clients)
|
||||
{
|
||||
comboBoxClients.Items.Add(client).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormReception_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var cheque = chequeStorage.GetObject(_id.Value);
|
||||
|
||||
if (cheque != null)
|
||||
{
|
||||
dateTimePickerDateReception.Value = cheque.DateReception;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (_id != null)
|
||||
{
|
||||
var newCheque = new Cheque
|
||||
{
|
||||
ChequeId = _id ?? 0,
|
||||
ServiceId = (comboBoxServices.SelectedItem as Service)!.ServiceId,
|
||||
MasterId = (comboBoxMaster.SelectedItem as Master)!.MasterId,
|
||||
ClientId = (comboBoxClients.SelectedItem as Client)!.ClientId,
|
||||
DateReception = dateTimePickerDateReception.Value,
|
||||
Price = Convert.ToDouble((comboBoxServices.SelectedItem as Service)!.Price.ToString())
|
||||
};
|
||||
chequeStorage.Update(newCheque);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newCheque = new Cheque
|
||||
{
|
||||
ServiceId = (comboBoxServices.SelectedItem as Service)!.ServiceId,
|
||||
MasterId = (comboBoxMaster.SelectedItem as Master)!.MasterId,
|
||||
ClientId = (comboBoxClients.SelectedItem as Client)!.ClientId,
|
||||
DateReception = dateTimePickerDateReception.Value,
|
||||
Price = Convert.ToDouble((comboBoxServices.SelectedItem as Service)!.Price.ToString())
|
||||
};
|
||||
chequeStorage.Add(newCheque);
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel; Close();
|
||||
}
|
||||
|
||||
private void comboBoxServices_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
comboBoxMaster.Items.Clear();
|
||||
if (comboBoxServices.SelectedIndex > -1)
|
||||
{
|
||||
Price.Text = (comboBoxServices.SelectedItem as Service)!.Price.ToString() + " тыщ долларов :)";
|
||||
comboBoxMaster.Enabled = true;
|
||||
int serviceId = (comboBoxServices.SelectedItem as Service)!.ServiceId;
|
||||
ServiceDatabase sdb = new ServiceDatabase();
|
||||
List<Master> mss = sdb.GetFilteredListByService(serviceId);
|
||||
foreach (Master master in mss)
|
||||
{
|
||||
comboBoxMaster.Items.Add(master).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
BeautySalon/BeautySalon/FormCheques.Designer.cs
generated
10
BeautySalon/BeautySalon/FormCheques.Designer.cs
generated
@ -37,7 +37,7 @@
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(576, 352);
|
||||
buttonDelete.Location = new Point(928, 352);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(147, 56);
|
||||
buttonDelete.TabIndex = 13;
|
||||
@ -56,12 +56,12 @@
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(493, 450);
|
||||
dataGridView.Size = new Size(880, 450);
|
||||
dataGridView.TabIndex = 10;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(576, 190);
|
||||
buttonUpdate.Location = new Point(928, 190);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(147, 56);
|
||||
buttonUpdate.TabIndex = 15;
|
||||
@ -71,7 +71,7 @@
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(576, 43);
|
||||
buttonCreate.Location = new Point(928, 43);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(147, 56);
|
||||
buttonCreate.TabIndex = 14;
|
||||
@ -83,7 +83,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(801, 450);
|
||||
ClientSize = new Size(1120, 450);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(buttonDelete);
|
||||
|
@ -46,7 +46,6 @@ namespace BeautySalon
|
||||
{
|
||||
List<Cheque> cheques = chequeStorage.GetObjects();
|
||||
ChequeDatabase cdb = new ChequeDatabase();
|
||||
ReceptionDatabase rdb = new ReceptionDatabase();
|
||||
|
||||
dataGridView.Rows.Clear();
|
||||
|
||||
@ -55,20 +54,20 @@ namespace BeautySalon
|
||||
dataGridView.Columns.Add("ChequeId", "ID");
|
||||
dataGridView.Columns.Add("ClientFIO", "ФИО клиента");
|
||||
dataGridView.Columns.Add("ServiceName", "Название услуги");
|
||||
dataGridView.Columns.Add("MasterFIO", "ФИО мастера");
|
||||
dataGridView.Columns.Add("DateReception", "Дата оказания услуги");
|
||||
dataGridView.Columns.Add("Price", "Цена");
|
||||
}
|
||||
|
||||
foreach (Cheque cheque in cheques)
|
||||
{
|
||||
var reception = rdb.GetObject(cheque.ReceptionId);
|
||||
var client = rdb.GetObject(cheque.ClientId);
|
||||
if (reception != null && client != null)
|
||||
{
|
||||
string serviceName = rdb.GetServiceName(reception);
|
||||
string clientFIO = cdb.GetClientFIO(cheque);
|
||||
double servicePrice = rdb.GetServicePrice(reception);
|
||||
var clientFIO = cdb.GetClientFIO(cheque);
|
||||
var serviceName = cdb.GetServiceName(cheque);
|
||||
var masterFIO = cdb.GetMasterFIO(cheque);
|
||||
|
||||
dataGridView.Rows.Add(cheque.ChequeId, clientFIO, serviceName, servicePrice);
|
||||
if(clientFIO != null && serviceName != null && masterFIO != null)
|
||||
{
|
||||
dataGridView.Rows.Add(cheque.ChequeId, clientFIO, serviceName, masterFIO, cheque.DateReception, cheque.Price);
|
||||
}
|
||||
}
|
||||
dataGridView.Columns["ChequeId"].Visible = false;
|
||||
|
7
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
7
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
@ -76,13 +76,6 @@
|
||||
добавитьToolStripMenuItem1.Text = "Клиенты";
|
||||
добавитьToolStripMenuItem1.Click += добавитьToolStripMenuItem1_Click;
|
||||
//
|
||||
// создатьПриемToolStripMenuItem
|
||||
//
|
||||
создатьПриемToolStripMenuItem.Name = "создатьПриемToolStripMenuItem";
|
||||
создатьПриемToolStripMenuItem.Size = new Size(82, 24);
|
||||
создатьПриемToolStripMenuItem.Text = "Приемы";
|
||||
создатьПриемToolStripMenuItem.Click += создатьПриемToolStripMenuItem_Click;
|
||||
//
|
||||
// посмотретьЧекиToolStripMenuItem
|
||||
//
|
||||
посмотретьЧекиToolStripMenuItem.Name = "посмотретьЧекиToolStripMenuItem";
|
||||
|
@ -67,15 +67,6 @@ namespace BeautySalon
|
||||
}
|
||||
}
|
||||
|
||||
private void создатьПриемToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReceptions));
|
||||
if (service is FormReceptions form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void посмотретьЧекиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCheques));
|
||||
|
143
BeautySalon/BeautySalon/FormReception.Designer.cs
generated
143
BeautySalon/BeautySalon/FormReception.Designer.cs
generated
@ -1,143 +0,0 @@
|
||||
namespace BeautySalon
|
||||
{
|
||||
partial class FormReception
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
labelService = new Label();
|
||||
comboBoxService = new ComboBox();
|
||||
Master = new Label();
|
||||
comboBoxMaster = new ComboBox();
|
||||
labelDateReception = new Label();
|
||||
dateTimePickerDateReception = new DateTimePicker();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(329, 208);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(133, 44);
|
||||
buttonCancel.TabIndex = 11;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(21, 208);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(133, 44);
|
||||
buttonSave.TabIndex = 10;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// labelService
|
||||
//
|
||||
labelService.AutoSize = true;
|
||||
labelService.Location = new Point(27, 29);
|
||||
labelService.Name = "labelService";
|
||||
labelService.Size = new Size(57, 20);
|
||||
labelService.TabIndex = 9;
|
||||
labelService.Text = "Услуга:";
|
||||
//
|
||||
// comboBoxService
|
||||
//
|
||||
comboBoxService.FormattingEnabled = true;
|
||||
comboBoxService.Location = new Point(178, 26);
|
||||
comboBoxService.Name = "comboBoxService";
|
||||
comboBoxService.Size = new Size(290, 28);
|
||||
comboBoxService.TabIndex = 8;
|
||||
comboBoxService.SelectedIndexChanged += comboBoxService_SelectedIndexChanged;
|
||||
//
|
||||
// Master
|
||||
//
|
||||
Master.AutoSize = true;
|
||||
Master.Location = new Point(27, 87);
|
||||
Master.Name = "Master";
|
||||
Master.Size = new Size(63, 20);
|
||||
Master.TabIndex = 7;
|
||||
Master.Text = "Мастер:";
|
||||
//
|
||||
// comboBoxMaster
|
||||
//
|
||||
comboBoxMaster.FormattingEnabled = true;
|
||||
comboBoxMaster.Location = new Point(178, 79);
|
||||
comboBoxMaster.Name = "comboBoxMaster";
|
||||
comboBoxMaster.Size = new Size(290, 28);
|
||||
comboBoxMaster.TabIndex = 12;
|
||||
//
|
||||
// labelDateReception
|
||||
//
|
||||
labelDateReception.AutoSize = true;
|
||||
labelDateReception.Location = new Point(21, 144);
|
||||
labelDateReception.Name = "labelDateReception";
|
||||
labelDateReception.Size = new Size(99, 20);
|
||||
labelDateReception.TabIndex = 13;
|
||||
labelDateReception.Text = "Дата приема";
|
||||
//
|
||||
// dateTimePickerDateReception
|
||||
//
|
||||
dateTimePickerDateReception.Location = new Point(178, 139);
|
||||
dateTimePickerDateReception.Name = "dateTimePickerDateReception";
|
||||
dateTimePickerDateReception.Size = new Size(290, 27);
|
||||
dateTimePickerDateReception.TabIndex = 14;
|
||||
//
|
||||
// FormReception
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(493, 280);
|
||||
Controls.Add(dateTimePickerDateReception);
|
||||
Controls.Add(labelDateReception);
|
||||
Controls.Add(comboBoxMaster);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelService);
|
||||
Controls.Add(comboBoxService);
|
||||
Controls.Add(Master);
|
||||
Name = "FormReception";
|
||||
Text = "Прием";
|
||||
Load += FormReception_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private Label labelService;
|
||||
private ComboBox comboBoxService;
|
||||
private Label Master;
|
||||
private ComboBox comboBoxMaster;
|
||||
private Label labelDateReception;
|
||||
private DateTimePicker dateTimePickerDateReception;
|
||||
}
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
using BeautySalonDBModels;
|
||||
using BeautySalonDBModels.Implements;
|
||||
using BeautySalonDBModels.Models;
|
||||
|
||||
namespace BeautySalon
|
||||
{
|
||||
public partial class FormReception : Form
|
||||
{
|
||||
private List<Service> services;
|
||||
private List<Master> masters;
|
||||
private readonly AbstractWorkWithStorage<Reception> receptionStorage;
|
||||
private readonly AbstractWorkWithStorage<Service> serviceStorage;
|
||||
private readonly AbstractWorkWithStorage<Master> masterStorage;
|
||||
|
||||
|
||||
private int? _id;
|
||||
public int Id
|
||||
{
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
public FormReception(AbstractWorkWithStorage<Reception> receptionStorage,
|
||||
AbstractWorkWithStorage<Service> serviceStorage,
|
||||
AbstractWorkWithStorage<Master> masterStorage)
|
||||
{
|
||||
this.receptionStorage = receptionStorage;
|
||||
this.serviceStorage = serviceStorage;
|
||||
this.masterStorage = masterStorage;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
comboBoxMaster.Enabled = false;
|
||||
|
||||
services = serviceStorage.GetObjects();
|
||||
foreach (Service service in services)
|
||||
{
|
||||
comboBoxService.Items.Add(service).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormReception_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var reception = receptionStorage.GetObject(_id.Value);
|
||||
|
||||
if (reception != null)
|
||||
{
|
||||
dateTimePickerDateReception.Value = reception.DateReception;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (_id != null)
|
||||
{
|
||||
var newReception = new Reception
|
||||
{
|
||||
ReceptionId = _id ?? 0,
|
||||
ServiceId = (comboBoxService.SelectedItem as Service)!.ServiceId,
|
||||
MasterId = (comboBoxMaster.SelectedItem as Master)!.MasterId,
|
||||
DateReception = dateTimePickerDateReception.Value,
|
||||
|
||||
};
|
||||
receptionStorage.Update(newReception);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newReception = new Reception
|
||||
{
|
||||
ServiceId = (comboBoxService.SelectedItem as Service)!.ServiceId,
|
||||
MasterId = (comboBoxMaster.SelectedItem as Master)!.MasterId,
|
||||
DateReception = dateTimePickerDateReception.Value,
|
||||
};
|
||||
receptionStorage.Add(newReception);
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel; Close();
|
||||
}
|
||||
|
||||
private void comboBoxService_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
comboBoxMaster.Items.Clear();
|
||||
if (comboBoxService.SelectedIndex > -1)
|
||||
{
|
||||
comboBoxMaster.Enabled = true;
|
||||
int serviceId = (comboBoxService.SelectedItem as Service)!.ServiceId;
|
||||
ServiceDatabase sdb = new ServiceDatabase();
|
||||
List<Master> mss = sdb.GetFilteredListByService(serviceId);
|
||||
foreach (Master master in mss)
|
||||
{
|
||||
comboBoxMaster.Items.Add(master).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
105
BeautySalon/BeautySalon/FormReceptions.Designer.cs
generated
105
BeautySalon/BeautySalon/FormReceptions.Designer.cs
generated
@ -1,105 +0,0 @@
|
||||
namespace BeautySalon
|
||||
{
|
||||
partial class FormReceptions
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonCreate = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(515, 363);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(147, 56);
|
||||
buttonDelete.TabIndex = 13;
|
||||
buttonDelete.Text = "Уничтожить...";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(515, 193);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(147, 56);
|
||||
buttonUpdate.TabIndex = 12;
|
||||
buttonUpdate.Text = "Корректровать";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(515, 32);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(147, 56);
|
||||
buttonCreate.TabIndex = 11;
|
||||
buttonCreate.Text = "Добавить";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = SystemColors.GradientInactiveCaption;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Left;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(470, 450);
|
||||
dataGridView.TabIndex = 10;
|
||||
//
|
||||
// FormReceptions
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(712, 450);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormReceptions";
|
||||
Text = "Приемы";
|
||||
Load += FormReceptions_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonCreate;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
using BeautySalonDBModels.Models;
|
||||
using BeautySalonDBModels;
|
||||
using BeautySalonDBModels.Implements;
|
||||
|
||||
namespace BeautySalon
|
||||
{
|
||||
public partial class FormReceptions : Form
|
||||
{
|
||||
|
||||
private int? _id;
|
||||
public int Id
|
||||
{
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
private readonly AbstractWorkWithStorage<Reception> receptionStorage;
|
||||
private readonly AbstractWorkWithStorage<Service> serviceStorage;
|
||||
private readonly AbstractWorkWithStorage<Master> masterStorage;
|
||||
|
||||
public FormReceptions(AbstractWorkWithStorage<Reception> receptionStorage,
|
||||
AbstractWorkWithStorage<Service> serviceStorage,
|
||||
AbstractWorkWithStorage<Master> masterStorage)
|
||||
{
|
||||
this.receptionStorage = receptionStorage;
|
||||
this.serviceStorage = serviceStorage;
|
||||
this.masterStorage = masterStorage;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
List<Reception> receptions = receptionStorage.GetObjects();
|
||||
ReceptionDatabase rdb = new ReceptionDatabase();
|
||||
|
||||
dataGridView.Rows.Clear();
|
||||
|
||||
if (dataGridView.ColumnCount == 0)
|
||||
{
|
||||
dataGridView.Columns.Add("ReceptionId", "Id");
|
||||
dataGridView.Columns.Add("Master", "ФИО мастера");
|
||||
dataGridView.Columns.Add("Service", "Услуга");
|
||||
dataGridView.Columns.Add("Date", "Дата приема");
|
||||
}
|
||||
|
||||
foreach (Reception reception in receptions)
|
||||
{
|
||||
string masterFIO = rdb.GetMasterFio(reception);
|
||||
string serviceName = rdb.GetServiceName(reception);
|
||||
dataGridView.Rows.Add(reception.ReceptionId, masterFIO, serviceName, reception.DateReception);
|
||||
}
|
||||
dataGridView.Columns["ReceptionId"].Visible = false;
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReception));
|
||||
if(service is FormReception form)
|
||||
{
|
||||
if(form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReception));
|
||||
if (service is FormReception form)
|
||||
{
|
||||
int rowIndex = dataGridView.CurrentCell.RowIndex;
|
||||
form.Id = (int)dataGridView.Rows[rowIndex].Cells["ReceptionId"].Value;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ReceptionId"].Value);
|
||||
receptionStorage.Remove(id);
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormReceptions_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -42,7 +42,6 @@ namespace BeautySalon
|
||||
services.AddSingleton<AbstractWorkWithStorage<Master>, MasterDatabase>();
|
||||
services.AddSingleton<AbstractWorkWithStorage<Cheque>, ChequeDatabase>();
|
||||
services.AddSingleton<AbstractWorkWithStorage<Client>, ClientDatabase>();
|
||||
services.AddSingleton<AbstractWorkWithStorage<Reception>, ReceptionDatabase>();
|
||||
services.AddSingleton<AbstractWorkWithStorage<Service>, ServiceDatabase>();
|
||||
|
||||
|
||||
@ -59,9 +58,6 @@ namespace BeautySalon
|
||||
services.AddTransient<FormCheques>();
|
||||
services.AddTransient<FormCheque>();
|
||||
|
||||
services.AddTransient<FormReceptions>();
|
||||
services.AddTransient<FormReception>();
|
||||
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<FormClient>();
|
||||
|
||||
|
@ -14,11 +14,13 @@ namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("INSERT INTO cheques (cheque_id, client_id, reception_id, price)" +
|
||||
" VALUES ((nextval('seq_cheque')), @ClientId, @ReceptionId. @Price)", conn);
|
||||
using var cmd = new NpgsqlCommand("INSERT INTO cheques (cheque_id, client_id, master_id, service_id, price, date_reception)" +
|
||||
" VALUES (nextval('seq_cheque'), @ClientId, @master_id, @service_id, @Price, @DateReception)", conn);
|
||||
cmd.Parameters.AddWithValue("@ClientId", cheque.ClientId);
|
||||
cmd.Parameters.AddWithValue("@ReceptionId", cheque.ReceptionId);
|
||||
cmd.Parameters.AddWithValue("@master_id", cheque.MasterId);
|
||||
cmd.Parameters.AddWithValue("@service_id", cheque.ServiceId);
|
||||
cmd.Parameters.AddWithValue("@Price", cheque.Price);
|
||||
cmd.Parameters.AddWithValue("@DateReception", cheque.DateReception);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
@ -35,8 +37,10 @@ namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
ChequeId = reader.GetInt32(0),
|
||||
ClientId = reader.GetInt32(1),
|
||||
ReceptionId = reader.GetInt32(2),
|
||||
Price = reader.GetDouble(3)
|
||||
MasterId = reader.GetInt32(2),
|
||||
ServiceId = reader.GetInt32(3),
|
||||
Price = reader.GetDouble(4),
|
||||
DateReception = reader.GetDateTime(5)
|
||||
};
|
||||
}
|
||||
return null;
|
||||
@ -55,8 +59,10 @@ namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
ChequeId = reader.GetInt32(0),
|
||||
ClientId = reader.GetInt32(1),
|
||||
ReceptionId = reader.GetInt32(2),
|
||||
Price = reader.GetDouble(3)
|
||||
MasterId = reader.GetInt32(2),
|
||||
ServiceId = reader.GetInt32(3),
|
||||
Price = reader.GetDouble(4),
|
||||
DateReception = reader.GetDateTime(5)
|
||||
});
|
||||
}
|
||||
return cheques;
|
||||
@ -78,11 +84,13 @@ namespace BeautySalonDBModels.Implements
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("update cheques set client_id = @ClientId, " +
|
||||
"reception_id = @ReceptionId, price = @Price where cheque_id = @ChequeId", conn);
|
||||
"master_id = @MasterId, service_id = @ServiceId, price = @Price, date_reception = @DateReception where cheque_id = @ChequeId", conn);
|
||||
cmd.Parameters.AddWithValue("@ClientId", cheque.ClientId);
|
||||
cmd.Parameters.AddWithValue("@ReceptionId", cheque.ReceptionId);
|
||||
cmd.Parameters.AddWithValue("@MasterId", cheque.MasterId);
|
||||
cmd.Parameters.AddWithValue("@ServiceId", cheque.ServiceId);
|
||||
cmd.Parameters.AddWithValue("@ChequeId", cheque.ChequeId);
|
||||
cmd.Parameters.AddWithValue("@Price", cheque.Price);
|
||||
cmd.Parameters.AddWithValue("@DateReception", cheque.DateReception);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
@ -100,5 +108,35 @@ namespace BeautySalonDBModels.Implements
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetMasterFIO(Cheque cheque)
|
||||
{
|
||||
MasterDatabase db = new MasterDatabase();
|
||||
|
||||
int masterId = cheque.MasterId;
|
||||
|
||||
List<Master> masters = db.GetObjects();
|
||||
|
||||
foreach (Master c in masters)
|
||||
{
|
||||
if (c.MasterId == masterId) return c.FIO.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetServiceName(Cheque cheque)
|
||||
{
|
||||
ServiceDatabase db = new ServiceDatabase();
|
||||
|
||||
int serviceId = cheque.ServiceId;
|
||||
|
||||
List<Service> service = db.GetObjects();
|
||||
|
||||
foreach (Service s in service)
|
||||
{
|
||||
if (s.ServiceId == serviceId) return s.ServiceName.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,127 +0,0 @@
|
||||
using BeautySalonDBModels.Models;
|
||||
using Npgsql;
|
||||
|
||||
namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
public class ReceptionDatabase : AbstractWorkWithStorage<Reception>
|
||||
{
|
||||
public override void Add(Reception reception)
|
||||
{
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("INSERT INTO receptions (reception_id, master_id, service_id, date_reception) " +
|
||||
"VALUES ((nextval('seq_reception')), @MasterId, @ServiceId, @DateReception)", conn);
|
||||
cmd.Parameters.AddWithValue("@MasterId", reception.MasterId);
|
||||
cmd.Parameters.AddWithValue("@ServiceId", reception.ServiceId);
|
||||
cmd.Parameters.AddWithValue("@DateReception", reception.DateReception);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public override Reception? GetObject(int id)
|
||||
{
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("SELECT * FROM receptions WHERE reception_id = @id", conn);
|
||||
cmd.Parameters.AddWithValue("@id", id);
|
||||
using var reader = cmd.ExecuteReader();
|
||||
if (reader.Read())
|
||||
{
|
||||
return new Reception
|
||||
{
|
||||
ReceptionId = reader.GetInt32(0),
|
||||
MasterId = reader.GetInt32(1),
|
||||
ServiceId = reader.GetInt32(2),
|
||||
DateReception = reader.GetDateTime(3)
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override List<Reception> GetObjects()
|
||||
{
|
||||
var receptions = new List<Reception>();
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("SELECT * FROM receptions order by reception_id", conn);
|
||||
using var reader = cmd.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
receptions.Add(new Reception
|
||||
{
|
||||
ReceptionId = reader.GetInt32(0),
|
||||
MasterId = reader.GetInt32(1),
|
||||
ServiceId = reader.GetInt32(2),
|
||||
DateReception = reader.GetDateTime(3)
|
||||
});
|
||||
}
|
||||
return receptions;
|
||||
}
|
||||
|
||||
public override Reception? Remove(int id)
|
||||
{
|
||||
var reception = GetObject(id);
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("delete from receptions where reception_id = @id", conn);
|
||||
cmd.Parameters.AddWithValue("@id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
return reception;
|
||||
}
|
||||
|
||||
public override void Update(Reception reception)
|
||||
{
|
||||
using var conn = GetConnection();
|
||||
conn.Open();
|
||||
using var cmd = new NpgsqlCommand("update receptions set master_id = @MasterId, " +
|
||||
"service_id = @ServiceId, date_reception = @DateReception where reception_id = @ReceptionId", conn);
|
||||
cmd.Parameters.AddWithValue("@MasterId", reception.MasterId);
|
||||
cmd.Parameters.AddWithValue("@ServiceId", reception.ServiceId);
|
||||
cmd.Parameters.AddWithValue("@DateReception", reception.DateReception);
|
||||
cmd.Parameters.AddWithValue("@ReceptionId", reception.ReceptionId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public string GetMasterFio(Reception reception)
|
||||
{
|
||||
MasterDatabase db = new MasterDatabase();
|
||||
int masterId = reception.MasterId;
|
||||
|
||||
List<Master> masters = db.GetObjects();
|
||||
|
||||
foreach (Master master in masters)
|
||||
{
|
||||
if (master.MasterId == masterId) return master.FIO.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetServiceName(Reception reception)
|
||||
{
|
||||
ServiceDatabase db = new ServiceDatabase();
|
||||
int serviceId = reception.ServiceId;
|
||||
|
||||
List<Service> services = db.GetObjects();
|
||||
|
||||
foreach (Service service in services)
|
||||
{
|
||||
if (service.ServiceId == serviceId) return service.ServiceName.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public double GetServicePrice(Reception reception)
|
||||
{
|
||||
ServiceDatabase db = new ServiceDatabase();
|
||||
int serviceId = reception.ServiceId;
|
||||
|
||||
List<Service> services = db.GetObjects();
|
||||
|
||||
foreach (Service service in services)
|
||||
{
|
||||
if (service.ServiceId == serviceId) return service.Price;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,9 @@
|
||||
{
|
||||
public int ChequeId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int ReceptionId { get; set; }
|
||||
public int ServiceId { get; set; }
|
||||
public int MasterId { get; set; }
|
||||
public DateTime DateReception { get; set; }
|
||||
public double Price { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,5 +5,10 @@
|
||||
public int ClientId { get; set; }
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public int Age { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return FIO.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return FIO;
|
||||
return FIO.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
namespace BeautySalonDBModels.Models
|
||||
{
|
||||
public class Reception
|
||||
{
|
||||
public int ReceptionId { get; set; }
|
||||
public int MasterId { get; set; }
|
||||
public int ServiceId { get; set; }
|
||||
public DateTime DateReception { get; set; }
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ServiceName;
|
||||
return ServiceName.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user