реализовала список чеков, осталось добавление/редактирование чеков и замеры времени (ну и проверки, конечно же...)
This commit is contained in:
parent
ce5da9b2da
commit
92e75d295e
129
BeautySalon/BeautySalon/FormCheque.Designer.cs
generated
Normal file
129
BeautySalon/BeautySalon/FormCheque.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
||||
namespace BeautySalon
|
||||
{
|
||||
partial class FormCheque
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelPrice = new Label();
|
||||
comboBoxClients = new ComboBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
labelReception = new Label();
|
||||
comboBoxReceptions = new ComboBox();
|
||||
client = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelPrice
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(19, 138);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(99, 20);
|
||||
labelPrice.TabIndex = 21;
|
||||
labelPrice.Text = "Дата приема";
|
||||
//
|
||||
// comboBoxClients
|
||||
//
|
||||
comboBoxClients.FormattingEnabled = true;
|
||||
comboBoxClients.Location = new Point(176, 73);
|
||||
comboBoxClients.Name = "comboBoxClients";
|
||||
comboBoxClients.Size = new Size(290, 28);
|
||||
comboBoxClients.TabIndex = 20;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(327, 202);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(133, 44);
|
||||
buttonCancel.TabIndex = 19;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(19, 202);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(133, 44);
|
||||
buttonSave.TabIndex = 18;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelReception
|
||||
//
|
||||
labelReception.AutoSize = true;
|
||||
labelReception.Location = new Point(25, 23);
|
||||
labelReception.Name = "labelReception";
|
||||
labelReception.Size = new Size(57, 20);
|
||||
labelReception.TabIndex = 17;
|
||||
labelReception.Text = "Прием";
|
||||
//
|
||||
// comboBoxReceptions
|
||||
//
|
||||
comboBoxReceptions.FormattingEnabled = true;
|
||||
comboBoxReceptions.Location = new Point(176, 20);
|
||||
comboBoxReceptions.Name = "comboBoxReceptions";
|
||||
comboBoxReceptions.Size = new Size(290, 28);
|
||||
comboBoxReceptions.TabIndex = 16;
|
||||
//
|
||||
// client
|
||||
//
|
||||
client.AutoSize = true;
|
||||
client.Location = new Point(25, 81);
|
||||
client.Name = "client";
|
||||
client.Size = new Size(58, 20);
|
||||
client.TabIndex = 15;
|
||||
client.Text = "Клиент";
|
||||
//
|
||||
// FormCheque
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(499, 266);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(comboBoxClients);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(labelReception);
|
||||
Controls.Add(comboBoxReceptions);
|
||||
Controls.Add(client);
|
||||
Name = "FormCheque";
|
||||
Text = "Чек";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelPrice;
|
||||
private ComboBox comboBoxClients;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private Label labelReception;
|
||||
private ComboBox comboBoxReceptions;
|
||||
private Label client;
|
||||
}
|
||||
}
|
27
BeautySalon/BeautySalon/FormCheque.cs
Normal file
27
BeautySalon/BeautySalon/FormCheque.cs
Normal file
@ -0,0 +1,27 @@
|
||||
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 BeautySalon
|
||||
{
|
||||
public partial class FormCheque : Form
|
||||
{
|
||||
|
||||
private int? _id;
|
||||
public int Id
|
||||
{
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
public FormCheque()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautySalon/BeautySalon/FormCheque.resx
Normal file
120
BeautySalon/BeautySalon/FormCheque.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>
|
30
BeautySalon/BeautySalon/FormCheques.Designer.cs
generated
30
BeautySalon/BeautySalon/FormCheques.Designer.cs
generated
@ -30,12 +30,14 @@
|
||||
{
|
||||
buttonDelete = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
buttonUpdate = new Button();
|
||||
buttonCreate = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(583, 199);
|
||||
buttonDelete.Location = new Point(576, 352);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(147, 56);
|
||||
buttonDelete.TabIndex = 13;
|
||||
@ -57,11 +59,33 @@
|
||||
dataGridView.Size = new Size(493, 450);
|
||||
dataGridView.TabIndex = 10;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(576, 190);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(147, 56);
|
||||
buttonUpdate.TabIndex = 15;
|
||||
buttonUpdate.Text = "Корректровать";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(576, 43);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(147, 56);
|
||||
buttonCreate.TabIndex = 14;
|
||||
buttonCreate.Text = "Добавить";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// FormCheques
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(801, 450);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormCheques";
|
||||
@ -75,5 +99,7 @@
|
||||
|
||||
private Button buttonDelete;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonCreate;
|
||||
}
|
||||
}
|
@ -44,15 +44,9 @@ namespace BeautySalon
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
/* var list = chequeStorage.GetObjects();
|
||||
if(list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
}*/
|
||||
|
||||
List<Cheque> cheques = chequeStorage.GetObjects();
|
||||
ChequeDatabase cdb = new ChequeDatabase();
|
||||
MasterDatabase mdb = new MasterDatabase();
|
||||
ReceptionDatabase rdb = new ReceptionDatabase();
|
||||
|
||||
dataGridView.Rows.Clear();
|
||||
|
||||
@ -60,21 +54,50 @@ namespace BeautySalon
|
||||
{
|
||||
dataGridView.Columns.Add("ChequeId", "ID");
|
||||
dataGridView.Columns.Add("ClientFIO", "ФИО клиента");
|
||||
dataGridView.Columns.Add("ServiceName", "Название");
|
||||
dataGridView.Columns.Add("ServiceName", "Название услуги");
|
||||
dataGridView.Columns.Add("Price", "Цена");
|
||||
}
|
||||
|
||||
foreach (Cheque cheque in cheques)
|
||||
{
|
||||
string serviceName =
|
||||
}
|
||||
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);
|
||||
|
||||
foreach (Service service in services)
|
||||
{
|
||||
string specialisationName = mdb.GetNameSpecialisation(service);
|
||||
dataGridView.Rows.Add(service.ServiceId, service.ServiceName, specialisationName, service.Price);
|
||||
dataGridView.Rows.Add(cheque.ChequeId, clientFIO, serviceName, servicePrice);
|
||||
}
|
||||
}
|
||||
dataGridView.Columns["ChequeId"].Visible = false;
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCheque));
|
||||
if(service is FormCheque form)
|
||||
{
|
||||
if(form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCheque));
|
||||
if (service is FormCheque form)
|
||||
{
|
||||
int index = dataGridView.CurrentCell.RowIndex;
|
||||
form.Id = (int)dataGridView.Rows[index].Cells["ChequeId"].Value;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,5 +85,20 @@ namespace BeautySalonDBModels.Implements
|
||||
cmd.Parameters.AddWithValue("@Price", cheque.Price);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public string GetClientFIO(Cheque cheque)
|
||||
{
|
||||
ClientDatabase db = new ClientDatabase();
|
||||
|
||||
int clientId = cheque.ClientId;
|
||||
|
||||
List<Client> clients = db.GetObjects();
|
||||
|
||||
foreach (Client c in clients)
|
||||
{
|
||||
if (c.ClientId == clientId) return c.FIO.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,5 +109,19 @@ namespace BeautySalonDBModels.Implements
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user