остались формочки и чуть чуть продумать идею со связью truck и driver

This commit is contained in:
Baryshev Dmitry 2024-11-05 23:39:22 +04:00
parent 41a5baa1eb
commit f0f3d6dc0e
35 changed files with 2576 additions and 42 deletions

View File

@ -0,0 +1,33 @@
using ProjectGarage.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class Driver
{
public int Id { get;private set; }
public string First_name { get;private set; } = string.Empty;
public string Last_name { get;private set; } = string.Empty;
public string Phone_Number { get;private set; } = string.Empty;
public int TruckID { get; set; }
public static Driver CreateDriver(int id, string fname, string lname ,string phone_num, int truck_id)
{
return new Driver
{
Id = id,
First_name = fname,
Last_name = lname,
Phone_Number = phone_num ?? string.Empty,
TruckID = truck_id
};
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities.Enums;
[Flags]
public enum FuelType
{
None = 0,
Petrol_92 = 1,
Petrol_95 = 2,
Petrol_98 = 4,
Petrol_100 = 8,
Diesel_Summer = 16,
Diesel_Winter = 32
}

View File

@ -0,0 +1,31 @@
using ProjectGarage.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class Fuel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public FuelType Type { get; set; }
public int Price { get; set; }
public static Fuel CreateFuel(int id, string name, FuelType type, int price)
{
return new Fuel
{
Id = id,
Name = name,
Type = type,
Price = price
};
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class FuelFuelReplenishment
{
public int Id { get; private set; }
public int FuelId { get; private set; }
public int Amount { get; private set; }
public static FuelFuelReplenishment CreateElement(int id, int fuelId, int amount)
{
return new FuelFuelReplenishment
{
Id = id,
FuelId = fuelId,
Amount = amount
};
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class FuelReplenishment
{
public int Id { get; private set; }
public int DriverId { get; private set; }
public DateTime Date { get; private set; }
public IEnumerable<FuelFuelReplenishment> FuelFuelReplenishments { get; private set;} = [];
public static FuelReplenishment CreateOpeartion(int id, int driverId, IEnumerable<FuelFuelReplenishment> fuelFuelReplenishments)
{
return new FuelReplenishment
{
Id = id,
DriverId = driverId,
Date = DateTime.Now,
FuelFuelReplenishments = fuelFuelReplenishments
};
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class Route
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string StartPoint { get; set; } = string.Empty;
public string FinalPoint { get; set; } = string.Empty;
public int Length { get; set; }
public static Route CreateRoute(int id, string startp, string finalp, int len)
{
return new Route() {
Id = id,
Name = startp + " - " + finalp,
StartPoint = startp,
FinalPoint = finalp,
Length = len
};
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class Transportation
{
public int Id { get; set; }
public int FuelId { get; set; }
public int RouteId { get; set; }
public int DriverId { get; set; }
public int Amount { get; set; }
public DateTime TransportationDate { get; set; }
public Transportation CreateTransportation(int id, int fuel_id, int route_id, int driver_id, int amount)
{
return new Transportation
{
Id = id,
FuelId = fuel_id,
RouteId = route_id,
DriverId = driver_id,
Amount = amount,
TransportationDate = DateTime.Now
};
}
}

View File

@ -0,0 +1,36 @@
using ProjectGarage.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Entities;
public class Truck
{
public int Id { get; private set; }
public string Numbers { get; private set; } = string.Empty;
public string Brand { get; private set; } = string.Empty;
public string Model { get; private set; } = string.Empty;
public int MaxFuel { get; private set; }
public bool HasDriver { get; private set; }
public static Truck CreateTruck(int id,string numbers, string brand, string model, int maxFuel)
{
return new Truck()
{
Id = id,
Numbers = numbers,
Brand = brand,
Model = model,
MaxFuel = maxFuel,
HasDriver = false
};
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectGarage
{
partial class Form1
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

141
ProjectGarage/FormGarage.Designer.cs generated Normal file
View File

@ -0,0 +1,141 @@
namespace ProjectGarage
{
partial class FormGarage
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormGarage));
menuStripGarage = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
водителиToolStripMenuItem = new ToolStripMenuItem();
фурыToolStripMenuItem = new ToolStripMenuItem();
маршрутыToolStripMenuItem = new ToolStripMenuItem();
топливоToolStripMenuItem = new ToolStripMenuItem();
отправкаТопливаToolStripMenuItem = new ToolStripMenuItem();
получениеТопливаToolStripMenuItem = new ToolStripMenuItem();
menuStripGarage.SuspendLayout();
SuspendLayout();
//
// menuStripGarage
//
menuStripGarage.ImageScalingSize = new Size(20, 20);
menuStripGarage.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStripGarage.Location = new Point(0, 0);
menuStripGarage.Name = "menuStripGarage";
menuStripGarage.Size = new Size(612, 28);
menuStripGarage.TabIndex = 0;
menuStripGarage.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { водителиToolStripMenuItem, фурыToolStripMenuItem, маршрутыToolStripMenuItem, топливоToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { отправкаТопливаToolStripMenuItem, получениеТопливаToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции";
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// водителиToolStripMenuItem
//
водителиToolStripMenuItem.Name = одителиToolStripMenuItem";
водителиToolStripMenuItem.Size = new Size(224, 26);
водителиToolStripMenuItem.Text = "Водители";
//
// фурыToolStripMenuItem
//
фурыToolStripMenuItem.Name = урыToolStripMenuItem";
фурыToolStripMenuItem.Size = new Size(224, 26);
фурыToolStripMenuItem.Text = "Фуры";
//
// маршрутыToolStripMenuItem
//
маршрутыToolStripMenuItem.Name = аршрутыToolStripMenuItem";
маршрутыToolStripMenuItem.Size = new Size(224, 26);
маршрутыToolStripMenuItem.Text = "Маршруты";
//
// топливоToolStripMenuItem
//
топливоToolStripMenuItem.Name = опливоToolStripMenuItem";
топливоToolStripMenuItem.Size = new Size(224, 26);
топливоToolStripMenuItem.Text = "Топливо";
//
// отправкаТопливаToolStripMenuItem
//
отправкаТопливаToolStripMenuItem.Name = "отправкаТопливаToolStripMenuItem";
отправкаТопливаToolStripMenuItem.Size = new Size(230, 26);
отправкаТопливаToolStripMenuItem.Text = "Отправка топлива";
//
// получениеТопливаToolStripMenuItem
//
получениеТопливаToolStripMenuItem.Name = "получениеТопливаToolStripMenuItem";
получениеТопливаToolStripMenuItem.Size = new Size(230, 26);
получениеТопливаToolStripMenuItem.Text = "Получение топлива";
//
// FormGarage
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(612, 399);
Controls.Add(menuStripGarage);
Name = "FormGarage";
StartPosition = FormStartPosition.CenterScreen;
Text = "Гараж";
menuStripGarage.ResumeLayout(false);
menuStripGarage.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStripGarage;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem водителиToolStripMenuItem;
private ToolStripMenuItem фурыToolStripMenuItem;
private ToolStripMenuItem маршрутыToolStripMenuItem;
private ToolStripMenuItem топливоToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem отправкаТопливаToolStripMenuItem;
private ToolStripMenuItem получениеТопливаToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
}
}

View File

@ -1,8 +1,8 @@
namespace ProjectGarage
{
public partial class Form1 : Form
public partial class FormGarage : Form
{
public Form1()
public FormGarage()
{
InitializeComponent();
}

File diff suppressed because it is too large Load Diff

161
ProjectGarage/Forms/FormDriver.Designer.cs generated Normal file
View File

@ -0,0 +1,161 @@
namespace ProjectGarage.Forms
{
partial class FormDriver
{
/// <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()
{
labelFirstName = new Label();
textBoxFirstName = new TextBox();
textBoxLastName = new TextBox();
labelLastName = new Label();
textBoxPhoneNum = new TextBox();
labelPhoneNum = new Label();
labelTruckID = new Label();
textBoxTruckID = new TextBox();
buttonSaveDriver = new Button();
buttonCancelDriver = new Button();
SuspendLayout();
//
// labelFirstName
//
labelFirstName.AutoSize = true;
labelFirstName.Location = new Point(34, 24);
labelFirstName.Name = "labelFirstName";
labelFirstName.Size = new Size(39, 20);
labelFirstName.TabIndex = 0;
labelFirstName.Text = "Имя";
//
// textBoxFirstName
//
textBoxFirstName.Location = new Point(120, 24);
textBoxFirstName.Name = "textBoxFirstName";
textBoxFirstName.Size = new Size(183, 27);
textBoxFirstName.TabIndex = 1;
//
// textBoxLastName
//
textBoxLastName.Location = new Point(120, 70);
textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(183, 27);
textBoxLastName.TabIndex = 3;
//
// labelLastName
//
labelLastName.AutoSize = true;
labelLastName.Location = new Point(20, 73);
labelLastName.Name = "labelLastName";
labelLastName.Size = new Size(73, 20);
labelLastName.TabIndex = 2;
labelLastName.Text = "Фамилия";
//
// textBoxPhoneNum
//
textBoxPhoneNum.Location = new Point(120, 115);
textBoxPhoneNum.Name = "textBoxPhoneNum";
textBoxPhoneNum.Size = new Size(183, 27);
textBoxPhoneNum.TabIndex = 5;
textBoxPhoneNum.Text = "+7";
//
// labelPhoneNum
//
labelPhoneNum.AutoSize = true;
labelPhoneNum.Location = new Point(20, 118);
labelPhoneNum.Name = "labelPhoneNum";
labelPhoneNum.Size = new Size(69, 20);
labelPhoneNum.TabIndex = 4;
labelPhoneNum.Text = "Телефон";
//
// labelTruckID
//
labelTruckID.AutoSize = true;
labelTruckID.Location = new Point(34, 164);
labelTruckID.Name = "labelTruckID";
labelTruckID.Size = new Size(44, 20);
labelTruckID.TabIndex = 6;
labelTruckID.Text = "Фура";
//
// textBoxTruckID
//
textBoxTruckID.Location = new Point(120, 164);
textBoxTruckID.Name = "textBoxTruckID";
textBoxTruckID.Size = new Size(183, 27);
textBoxTruckID.TabIndex = 7;
//
// buttonSaveDriver
//
buttonSaveDriver.Location = new Point(20, 231);
buttonSaveDriver.Name = "buttonSaveDriver";
buttonSaveDriver.Size = new Size(128, 39);
buttonSaveDriver.TabIndex = 8;
buttonSaveDriver.Text = "Сохранить";
buttonSaveDriver.UseVisualStyleBackColor = true;
//
// buttonCancelDriver
//
buttonCancelDriver.Location = new Point(175, 231);
buttonCancelDriver.Name = "buttonCancelDriver";
buttonCancelDriver.Size = new Size(128, 39);
buttonCancelDriver.TabIndex = 9;
buttonCancelDriver.Text = "Отмена";
buttonCancelDriver.UseVisualStyleBackColor = true;
//
// FormDriver
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(333, 302);
Controls.Add(buttonCancelDriver);
Controls.Add(buttonSaveDriver);
Controls.Add(textBoxTruckID);
Controls.Add(labelTruckID);
Controls.Add(textBoxPhoneNum);
Controls.Add(labelPhoneNum);
Controls.Add(textBoxLastName);
Controls.Add(labelLastName);
Controls.Add(textBoxFirstName);
Controls.Add(labelFirstName);
Name = "FormDriver";
StartPosition = FormStartPosition.CenterParent;
Text = "Водитель";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelFirstName;
private TextBox textBoxFirstName;
private TextBox textBoxLastName;
private Label labelLastName;
private TextBox textBoxPhoneNum;
private Label labelPhoneNum;
private Label labelTruckID;
private TextBox textBoxTruckID;
private Button buttonSaveDriver;
private Button buttonCancelDriver;
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProjectGarage.Forms
{
public partial class FormDriver : Form
{
public FormDriver()
{
InitializeComponent();
}
}
}

View 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>

164
ProjectGarage/Forms/FormTruck.Designer.cs generated Normal file
View File

@ -0,0 +1,164 @@
namespace ProjectGarage.Forms
{
partial class FormTruck
{
/// <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()
{
textBoxTruckModel = new TextBox();
labelTruckModel = new Label();
textBoxTruckBrand = new TextBox();
labelTruckBrand = new Label();
textBoxTruckNumbers = new TextBox();
labelTruckNumbers = new Label();
labelMaxFuel = new Label();
numericUpDownMaxFuel = new NumericUpDown();
buttonTruckSave = new Button();
buttonTruckCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownMaxFuel).BeginInit();
SuspendLayout();
//
// textBoxTruckModel
//
textBoxTruckModel.Location = new Point(158, 114);
textBoxTruckModel.Name = "textBoxTruckModel";
textBoxTruckModel.Size = new Size(183, 27);
textBoxTruckModel.TabIndex = 13;
//
// labelTruckModel
//
labelTruckModel.AutoSize = true;
labelTruckModel.Location = new Point(43, 121);
labelTruckModel.Name = "labelTruckModel";
labelTruckModel.Size = new Size(63, 20);
labelTruckModel.TabIndex = 12;
labelTruckModel.Text = "Модель";
//
// textBoxTruckBrand
//
textBoxTruckBrand.Location = new Point(158, 73);
textBoxTruckBrand.Name = "textBoxTruckBrand";
textBoxTruckBrand.Size = new Size(183, 27);
textBoxTruckBrand.TabIndex = 11;
//
// labelTruckBrand
//
labelTruckBrand.AutoSize = true;
labelTruckBrand.Location = new Point(43, 76);
labelTruckBrand.Name = "labelTruckBrand";
labelTruckBrand.Size = new Size(54, 20);
labelTruckBrand.TabIndex = 10;
labelTruckBrand.Text = "Марка";
//
// textBoxTruckNumbers
//
textBoxTruckNumbers.Location = new Point(158, 30);
textBoxTruckNumbers.Name = "textBoxTruckNumbers";
textBoxTruckNumbers.Size = new Size(183, 27);
textBoxTruckNumbers.TabIndex = 9;
//
// labelTruckNumbers
//
labelTruckNumbers.AutoSize = true;
labelTruckNumbers.Location = new Point(26, 30);
labelTruckNumbers.Name = "labelTruckNumbers";
labelTruckNumbers.Size = new Size(106, 20);
labelTruckNumbers.TabIndex = 8;
labelTruckNumbers.Text = "Номера фуры";
//
// labelMaxFuel
//
labelMaxFuel.AutoSize = true;
labelMaxFuel.Location = new Point(12, 163);
labelMaxFuel.Name = "labelMaxFuel";
labelMaxFuel.Size = new Size(129, 20);
labelMaxFuel.TabIndex = 14;
labelMaxFuel.Text = "Объем цистерны";
//
// numericUpDownMaxFuel
//
numericUpDownMaxFuel.Location = new Point(158, 156);
numericUpDownMaxFuel.Name = "numericUpDownMaxFuel";
numericUpDownMaxFuel.Size = new Size(117, 27);
numericUpDownMaxFuel.TabIndex = 15;
//
// buttonTruckSave
//
buttonTruckSave.Location = new Point(12, 211);
buttonTruckSave.Name = "buttonTruckSave";
buttonTruckSave.Size = new Size(156, 37);
buttonTruckSave.TabIndex = 16;
buttonTruckSave.Text = "Сохранить";
buttonTruckSave.UseVisualStyleBackColor = true;
buttonTruckSave.Click += buttonTruckSave_Click;
//
// buttonTruckCancel
//
buttonTruckCancel.Location = new Point(196, 211);
buttonTruckCancel.Name = "buttonTruckCancel";
buttonTruckCancel.Size = new Size(156, 37);
buttonTruckCancel.TabIndex = 17;
buttonTruckCancel.Text = "Отмена";
buttonTruckCancel.UseVisualStyleBackColor = true;
buttonTruckCancel.Click += buttonTruckCancel_Click;
//
// FormTruck
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(364, 260);
Controls.Add(buttonTruckCancel);
Controls.Add(buttonTruckSave);
Controls.Add(numericUpDownMaxFuel);
Controls.Add(labelMaxFuel);
Controls.Add(textBoxTruckModel);
Controls.Add(labelTruckModel);
Controls.Add(textBoxTruckBrand);
Controls.Add(labelTruckBrand);
Controls.Add(textBoxTruckNumbers);
Controls.Add(labelTruckNumbers);
Name = "FormTruck";
StartPosition = FormStartPosition.CenterParent;
Text = "Фура";
((System.ComponentModel.ISupportInitialize)numericUpDownMaxFuel).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxTruckModel;
private Label labelTruckModel;
private TextBox textBoxTruckBrand;
private Label labelTruckBrand;
private TextBox textBoxTruckNumbers;
private Label labelTruckNumbers;
private Label labelMaxFuel;
private NumericUpDown numericUpDownMaxFuel;
private Button buttonTruckSave;
private Button buttonTruckCancel;
}
}

View File

@ -0,0 +1,61 @@
using ProjectGarage.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 ProjectGarage.Forms
{
public partial class FormTruck : Form
{
private readonly ITruckRepository _truckRepository;
private int? _truckId;
public int Id
{
set
{
try
{
var truck = _truckRepository.ReadTruckByID(value);
if (truck == null)
{
throw new InvalidDataException(nameof(truck));
}
textBoxTruckNumbers.Text = truck.Numbers;
textBoxTruckBrand.Text = truck.Brand;
textBoxTruckModel.Text = truck.Model;
numericUpDownMaxFuel.Value = truck.MaxFuel;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormTruck(ITruckRepository truckRepository)
{
InitializeComponent();
_truckRepository = truckRepository ??
throw new ArgumentNullException(nameof(truckRepository));
}
private void buttonTruckSave_Click(object sender, EventArgs e)
{
}
private void buttonTruckCancel_Click(object sender, EventArgs e)
{
}
}
}

View 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>

View File

@ -1,3 +1,7 @@
using ProjectGarage.Repositories;
using ProjectGarage.Repositories.Implementations;
using Unity;
namespace ProjectGarage
{
internal static class Program
@ -11,7 +15,22 @@ namespace ProjectGarage
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormGarage>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<ITruckRepository, TruckRepository>();
container.RegisterType<IFuelRepository, FuelRepository>();
container.RegisterType<IRouteRepository, RouteRepository>();
container.RegisterType<IDriverRepository, DriverRepository>();
container.RegisterType<ITransportationRepository, TransportationRepository>();
container.RegisterType<IFuelReplishmentRepository, FuelReplishmentRepository>();
return container;
}
}
}

View File

@ -8,4 +8,23 @@
<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>

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectGarage.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("ProjectGarage.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;
}
}
}
}

View File

@ -0,0 +1,21 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface IDriverRepository
{
IEnumerable<Driver> ReadDrivers();
Driver ReadDriverByID(int id);
void CreateDriver(Driver driver);
void UpdateDriver(Driver driver);
void DeleteDriver(int id);
}

View File

@ -0,0 +1,17 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface IFuelReplishmentRepository
{
IEnumerable<FuelReplenishment> ReadFuelReplenishment(DateTime? dateForm = null, DateTime? dateTo = null, int? fuelId = null,
int? driverId = null, int? routeId = null);
void CreateFuelReplenishment(FuelReplenishment fuelReplenishment);
void DeleteFuelReplenishment(int id);
}

View File

@ -0,0 +1,21 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface IFuelRepository
{
IEnumerable<Fuel> ReadFuels();
Fuel ReadFuelByID(int id);
void CreateFuel(Fuel fuel);
void UpdateFuel(Fuel fuel);
void DeleteFuel(int id);
}

View File

@ -0,0 +1,21 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface IRouteRepository
{
IEnumerable<Route> ReadRoute(string? startPoint = null,string? finalPoint = null);
void ReadRouteByID(int id);
void CreateRoute(Route route);
void UpdateRoute(Route route);
void DeleteRoute(int id);
}

View File

@ -0,0 +1,15 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface ITransportationRepository
{
IEnumerable<Transportation> ReadTransportation(DateTime? dateForm = null, DateTime? dateTo = null, int? fuelId = null,
int? driverId = null, int? routeId = null);
void CreateTransportation(Transportation transportation);
}

View File

@ -0,0 +1,21 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories;
public interface ITruckRepository
{
IEnumerable<Truck> ReadTrucks();
Truck ReadTruckByID(int id);
void CreateTruck(Truck truck);
void UpdateTruck(Truck truck);
void DeleteTruck(int id);
}

View File

@ -0,0 +1,27 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class DriverRepository : IDriverRepository
{
public void CreateDriver(Driver driver)
{
}
public void DeleteDriver(int id)
{
}
public Driver ReadDriverByID(int id) => Driver.CreateDriver(0, string.Empty, string.Empty, string.Empty, 0);
public IEnumerable<Driver> ReadDrivers() => [];
public void UpdateDriver(Driver driver)
{
}
}

View File

@ -0,0 +1,24 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class FuelReplishmentRepository : IFuelReplishmentRepository
{
public void CreateFuelReplenishment(FuelReplenishment fuelReplenishment)
{
}
public void DeleteFuelReplenishment(int id)
{
}
public IEnumerable<FuelReplenishment> ReadFuelReplenishment(DateTime? dateForm = null, DateTime? dateTo = null, int? fuelId = null, int? driverId = null, int? routeId = null)
{
return [];
}
}

View File

@ -0,0 +1,28 @@
using ProjectGarage.Entities;
using ProjectGarage.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class FuelRepository : IFuelRepository
{
public void CreateFuel(Fuel fuel)
{
}
public void DeleteFuel(int id)
{
}
public Fuel ReadFuelByID(int id) => Fuel.CreateFuel(0, string.Empty, FuelType.None, 0);
public IEnumerable<Fuel> ReadFuels() => [];
public void UpdateFuel(Fuel fuel)
{
}
}

View File

@ -0,0 +1,34 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class RouteRepository : IRouteRepository
{
public void CreateFuelReplenishment(FuelReplenishment fuelReplenishment)
{
}
public void CreateRoute(Route route)
{
}
public void DeleteRoute(int id)
{
}
public void ReadRouteByID(int id) => Route.CreateRoute(0, string.Empty, string.Empty, 0);
public IEnumerable<Route> ReadRoute(string? startPoint = null, string? finalPoint = null)
{
return [];
}
public void UpdateRoute(Route route)
{
}
}

View File

@ -0,0 +1,20 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class TransportationRepository : ITransportationRepository
{
public void CreateTransportation(Transportation transportation)
{
}
public IEnumerable<Transportation> ReadTransportation(DateTime? dateForm = null, DateTime? dateTo = null, int? fuelId = null, int? driverId = null, int? routeId = null)
{
return [];
}
}

View File

@ -0,0 +1,27 @@
using ProjectGarage.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectGarage.Repositories.Implementations;
public class TruckRepository : ITruckRepository
{
public void CreateTruck(Truck truck)
{
}
public void DeleteTruck(int id)
{
}
public Truck ReadTruckByID(int id) => Truck.CreateTruck(0, string.Empty, string.Empty, string.Empty, 0);
public IEnumerable<Truck> ReadTrucks() => [];
public void UpdateTruck(Truck truck)
{
}
}

BIN
филмор1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB