Ну ща попрут ошибки 101%
This commit is contained in:
parent
3ad12b46fd
commit
e2dd2aaf7b
@ -28,12 +28,35 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
buttonStartTransfer = new Button();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
SuspendLayout();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
//
|
||||||
this.Text = "FormTransferData";
|
// buttonStartTransfer
|
||||||
|
//
|
||||||
|
buttonStartTransfer.BackColor = Color.Red;
|
||||||
|
buttonStartTransfer.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonStartTransfer.Font = new Font("Snap ITC", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
buttonStartTransfer.Location = new Point(102, 12);
|
||||||
|
buttonStartTransfer.Name = "buttonStartTransfer";
|
||||||
|
buttonStartTransfer.Size = new Size(213, 36);
|
||||||
|
buttonStartTransfer.TabIndex = 0;
|
||||||
|
buttonStartTransfer.Text = "НУ ЧЁ, ПОГНАЛИ";
|
||||||
|
buttonStartTransfer.UseVisualStyleBackColor = false;
|
||||||
|
buttonStartTransfer.Click += ButtonStartTransfer_Click;
|
||||||
|
//
|
||||||
|
// FormTransferData
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(415, 60);
|
||||||
|
Controls.Add(buttonStartTransfer);
|
||||||
|
Name = "FormTransferData";
|
||||||
|
Text = "Передача данных";
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonStartTransfer;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,17 +4,67 @@ using System.ComponentModel;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Media;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TransportCompanyBusinessLogic.BusinessLogic;
|
||||||
|
using TransportCompanyContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
namespace TransportCompany
|
namespace TransportCompany
|
||||||
{
|
{
|
||||||
|
//форма для перегона данных в MongoDB
|
||||||
public partial class FormTransferData : Form
|
public partial class FormTransferData : Form
|
||||||
{
|
{
|
||||||
public FormTransferData()
|
private ICargoLogic _cargoLogic;
|
||||||
|
|
||||||
|
private ITruckingLogic _truckingLogic;
|
||||||
|
|
||||||
|
private ITransportLogic _transportLogic;
|
||||||
|
|
||||||
|
private IClientLogic _clientLogic;
|
||||||
|
|
||||||
|
public FormTransferData(ICargoLogic cargoLogic, ITruckingLogic truckingLogic, IClientLogic clientLogic, ITransportLogic transportLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
_cargoLogic = cargoLogic;
|
||||||
|
_truckingLogic = truckingLogic;
|
||||||
|
_clientLogic = clientLogic;
|
||||||
|
_transportLogic = transportLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonStartTransfer_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
/*using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav"))
|
||||||
|
{
|
||||||
|
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Program.ConnectPostgres();
|
||||||
|
|
||||||
|
_cargoLogic = Program.ServiceProvider.GetService(typeof(ICargoLogic)) as CargoLogic;
|
||||||
|
_clientLogic = Program.ServiceProvider.GetService(typeof(IClientLogic)) as ClientLogic;
|
||||||
|
_truckingLogic = Program.ServiceProvider.GetService(typeof(ITruckingLogic)) as TruckingLogic;
|
||||||
|
_transportLogic = Program.ServiceProvider.GetService(typeof(ITransportLogic)) as TransportLogic;
|
||||||
|
|
||||||
|
var cargolist = _cargoLogic.ReadList(null);
|
||||||
|
var clientlist = _clientLogic.ReadList(null);
|
||||||
|
var truckinglist = _truckingLogic.ReadList(null);
|
||||||
|
var transportlist = _transportLogic.ReadList(null);
|
||||||
|
|
||||||
|
Program.ConnectMongo();
|
||||||
|
|
||||||
|
_cargoLogic = Program.ServiceProvider.GetService(typeof(ICargoLogic)) as CargoLogic;
|
||||||
|
_clientLogic = Program.ServiceProvider.GetService(typeof(IClientLogic)) as ClientLogic;
|
||||||
|
_truckingLogic = Program.ServiceProvider.GetService(typeof(ITruckingLogic)) as TruckingLogic;
|
||||||
|
_transportLogic = Program.ServiceProvider.GetService(typeof(ITransportLogic)) as TransportLogic;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
Program.ConnectPostgres();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -145,5 +145,10 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
|
|||||||
throw new InvalidOperationException("Такой тип груза уже есть");
|
throw new InvalidOperationException("Такой тип груза уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TransferData(List<CargoViewModel> model)
|
||||||
|
{
|
||||||
|
return _cargoStorage.InsertFromPostgres(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,5 +182,10 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
|
|||||||
throw new InvalidOperationException("Клиент с такой почтой уже есть");
|
throw new InvalidOperationException("Клиент с такой почтой уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TransferData(List<ClientViewModel> model)
|
||||||
|
{
|
||||||
|
return _clientStorage.InsertFromPostgres(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,5 +144,10 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
|
|||||||
throw new InvalidOperationException("Такое транспортное средство уже есть");
|
throw new InvalidOperationException("Такое транспортное средство уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TransferData(List<TransportViewModel> model)
|
||||||
|
{
|
||||||
|
return _transportStorage.InsertFromPostgres(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,5 +175,10 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
|
|||||||
"TransportationId:{TransportationId}. DateStart:{DateStart}. DateEnd:{DateEnd}. Id:{Id}",
|
"TransportationId:{TransportationId}. DateStart:{DateStart}. DateEnd:{DateEnd}. Id:{Id}",
|
||||||
model.ClientId, model.CargoId, model.TransportId, model.TransportationId, model.DateStart, model.DateEnd, model.Id);
|
model.ClientId, model.CargoId, model.TransportId, model.TransportationId, model.DateStart, model.DateEnd, model.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TransferData(List<TruckingViewModel> model)
|
||||||
|
{
|
||||||
|
return _truckingStorage.InsertFromPostgres(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,7 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
|
|||||||
bool Update(CargoBindingModel model);
|
bool Update(CargoBindingModel model);
|
||||||
|
|
||||||
bool Delete(CargoBindingModel model);
|
bool Delete(CargoBindingModel model);
|
||||||
|
|
||||||
|
bool TransferData(List<CargoViewModel> model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,7 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
|
|||||||
bool Update(ClientBindingModel model);
|
bool Update(ClientBindingModel model);
|
||||||
|
|
||||||
bool Delete(ClientBindingModel model);
|
bool Delete(ClientBindingModel model);
|
||||||
|
|
||||||
|
bool TransferData(List<ClientViewModel> model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,7 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
|
|||||||
bool Update(TransportBindingModel model);
|
bool Update(TransportBindingModel model);
|
||||||
|
|
||||||
bool Delete(TransportBindingModel model);
|
bool Delete(TransportBindingModel model);
|
||||||
|
|
||||||
|
bool TransferData(List<TransportViewModel> model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,7 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
|
|||||||
bool Update(TruckingBindingModel model);
|
bool Update(TruckingBindingModel model);
|
||||||
|
|
||||||
bool Delete(TruckingBindingModel model);
|
bool Delete(TruckingBindingModel model);
|
||||||
|
|
||||||
|
bool TransferData(List<TruckingViewModel> model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user