Merge branch 'main' of https://git.is.ulstu.ru/mfnefd/PIAPS_CW
This commit is contained in:
commit
5119290baa
21
Contracts/StorageContracts/IMediaFileStorage.cs
Normal file
21
Contracts/StorageContracts/IMediaFileStorage.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.SearchModels;
|
||||||
|
using Contracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
public interface IMediaFileStorage
|
||||||
|
{
|
||||||
|
List<MediaFileViewModel> GetFullList();
|
||||||
|
List<MediaFileViewModel> GetFilteredList(MediaFileSearchModel model);
|
||||||
|
MediaFileViewModel? GetElement(MediaFileSearchModel model);
|
||||||
|
MediaFileViewModel? Insert(MediaFileBindingModel model);
|
||||||
|
MediaFileViewModel? Update(MediaFileBindingModel model);
|
||||||
|
MediaFileViewModel? Delete(MediaFileBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ namespace Contracts.ViewModels
|
|||||||
public string Location { get; set; } = string.Empty;
|
public string Location { get; set; } = string.Empty;
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public Guid ProductId { get; set; }
|
public Guid ProductId { get; set; }
|
||||||
|
public string ProductName { get; set; } = string.Empty;
|
||||||
public MediaFileBindingModel GetBindingModel()
|
public MediaFileBindingModel GetBindingModel()
|
||||||
{
|
{
|
||||||
return new MediaFileBindingModel
|
return new MediaFileBindingModel
|
||||||
|
101
DatabaseImplement/Implements/MediaFileStorage.cs
Normal file
101
DatabaseImplement/Implements/MediaFileStorage.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.SearchModels;
|
||||||
|
using Contracts.StorageContracts;
|
||||||
|
using Contracts.ViewModels;
|
||||||
|
using DatabaseImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class MediaFileStorage : IMediaFileStorage
|
||||||
|
{
|
||||||
|
public MediaFileViewModel? Delete(MediaFileBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new Database();
|
||||||
|
var element = context.MediaFiles
|
||||||
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.MediaFiles.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaFileViewModel? GetElement(MediaFileSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new Database();
|
||||||
|
return context.MediaFiles
|
||||||
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaFileViewModel> GetFilteredList(MediaFileSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.ProductId.HasValue && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new Database();
|
||||||
|
if (model.ProductId.HasValue)
|
||||||
|
{
|
||||||
|
return context.MediaFiles.Where(x => x.ProductId == model.ProductId).Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
return context.MediaFiles.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaFileViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new Database();
|
||||||
|
return context.MediaFiles
|
||||||
|
.ToList()
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaFileViewModel? Insert(MediaFileBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new Database();
|
||||||
|
var newProduct = MediaFile.Create(model);
|
||||||
|
if (newProduct == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.MediaFiles.Add(newProduct);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newProduct.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaFileViewModel? Update(MediaFileBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new Database();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var product = context.MediaFiles.FirstOrDefault(rec =>
|
||||||
|
rec.Id == model.Id);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
product.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
transaction.Commit();
|
||||||
|
return product.GetViewModel;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,11 +18,6 @@ namespace DatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new Database();
|
using var context = new Database();
|
||||||
var element = context.Products
|
var element = context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
@ -41,11 +36,6 @@ namespace DatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
using var context = new Database();
|
using var context = new Database();
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +49,6 @@ namespace DatabaseImplement.Implements
|
|||||||
if (model.Price.HasValue)
|
if (model.Price.HasValue)
|
||||||
{
|
{
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.Where(x => x.Price <= model.Price)
|
.Where(x => x.Price <= model.Price)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -72,11 +57,6 @@ namespace DatabaseImplement.Implements
|
|||||||
if (model.Rate.HasValue)
|
if (model.Rate.HasValue)
|
||||||
{
|
{
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.Where(x => x.Rate <= model.Rate)
|
.Where(x => x.Rate <= model.Rate)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -85,22 +65,12 @@ namespace DatabaseImplement.Implements
|
|||||||
if (model.Amount.HasValue && model.IsBeingSold.HasValue)
|
if (model.Amount.HasValue && model.IsBeingSold.HasValue)
|
||||||
{
|
{
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.Where(x => x.IsBeingSold == model.IsBeingSold && x.Amount >= model.Amount)
|
.Where(x => x.IsBeingSold == model.IsBeingSold && x.Amount >= model.Amount)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.Where(x => x.Name == model.Name)
|
.Where(x => x.Name == model.Name)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -111,11 +81,6 @@ namespace DatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new Database();
|
using var context = new Database();
|
||||||
return context.Products
|
return context.Products
|
||||||
//.Include(x => x.Name)
|
|
||||||
//.Include(x => x.Price)
|
|
||||||
//.Include(x => x.IsBeingSold)
|
|
||||||
//.Include(x => x.Rate)
|
|
||||||
//.Include(x => x.Amount)
|
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -21,50 +21,47 @@ namespace DatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public Guid ProductId { get; set; }
|
public Guid ProductId { get; set; }
|
||||||
|
|
||||||
public MediaFileBindingModel GetBindingModel()
|
public virtual Product Product { get; set; }
|
||||||
{
|
|
||||||
return new MediaFileBindingModel
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
Name = Name,
|
|
||||||
Location = Location,
|
|
||||||
ProductId = ProductId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MediaFile ToMediaFileFromView(MediaFileViewModel model, MediaFile mediaFile)
|
public static MediaFile? Create(MediaFileBindingModel? model)
|
||||||
{
|
{
|
||||||
return new MediaFile
|
if (model == null)
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
return null;
|
||||||
Name = model.Name,
|
}
|
||||||
Location = model.Location,
|
return new MediaFile
|
||||||
ProductId = model.ProductId
|
{
|
||||||
};
|
Id = model.Id,
|
||||||
}
|
Name = model.Name,
|
||||||
|
Location = model.Location,
|
||||||
|
ProductId = model.ProductId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static MediaFile ToMediaFileFromBinding(MediaFileBindingModel model, MediaFile mediaFile)
|
public void Update(MediaFileBindingModel? model)
|
||||||
{
|
{
|
||||||
return new MediaFile
|
if (model == null)
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
return;
|
||||||
Name = model.Name,
|
}
|
||||||
Location = model.Location,
|
Location = model.Location;
|
||||||
ProductId = model.ProductId
|
Name = model.Name;
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(MediaFileBindingModel model)
|
public MediaFileViewModel GetViewModel
|
||||||
{
|
{
|
||||||
if (model == null)
|
get
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
var context = new Database();
|
||||||
}
|
return new()
|
||||||
|
{
|
||||||
// Обновление свойств на основе модели привязки
|
Id = Id,
|
||||||
Name = model.Name;
|
Name = Name,
|
||||||
Location = model.Location;
|
Location = Location,
|
||||||
ProductId = model.ProductId;
|
ProductId = ProductId,
|
||||||
}
|
ProductName = context.Products.FirstOrDefault(x => x.Id == ProductId)?.Name ?? string.Empty,
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
58
WinFormsApp/FormMediaFiles.Designer.cs
generated
Normal file
58
WinFormsApp/FormMediaFiles.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
namespace WinFormsApp
|
||||||
|
{
|
||||||
|
partial class FormMediaFiles
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Location = new Point(12, 12);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(271, 434);
|
||||||
|
groupBox1.TabIndex = 0;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "groupBox1";
|
||||||
|
//
|
||||||
|
// FormMediaFiles
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Name = "FormMediaFiles";
|
||||||
|
Text = "FormMediaFiles";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
}
|
||||||
|
}
|
20
WinFormsApp/FormMediaFiles.cs
Normal file
20
WinFormsApp/FormMediaFiles.cs
Normal 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 WinFormsApp
|
||||||
|
{
|
||||||
|
public partial class FormMediaFiles : Form
|
||||||
|
{
|
||||||
|
public FormMediaFiles()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
WinFormsApp/FormMediaFiles.resx
Normal file
120
WinFormsApp/FormMediaFiles.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>
|
@ -24,6 +24,7 @@ namespace WinFormsApp
|
|||||||
private readonly IProductLogic _productLogic;
|
private readonly IProductLogic _productLogic;
|
||||||
private readonly BarcodeLogic _barcodeLogic;
|
private readonly BarcodeLogic _barcodeLogic;
|
||||||
private BarcodeResults? _barcode;
|
private BarcodeResults? _barcode;
|
||||||
|
List<string> _mediaFiles;
|
||||||
public FormProducts(ILogger<FormMain> logger, IProductLogic productLogic)
|
public FormProducts(ILogger<FormMain> logger, IProductLogic productLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -31,6 +32,7 @@ namespace WinFormsApp
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_barcodeLogic = new BarcodeLogic();
|
_barcodeLogic = new BarcodeLogic();
|
||||||
_barcode = null;
|
_barcode = null;
|
||||||
|
_mediaFiles = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormProducts_Load(object sender, EventArgs e)
|
private void FormProducts_Load(object sender, EventArgs e)
|
||||||
@ -217,7 +219,7 @@ namespace WinFormsApp
|
|||||||
});
|
});
|
||||||
groupBoxControls.Hide();
|
groupBoxControls.Hide();
|
||||||
groupBoxCreateProduct.Show();
|
groupBoxCreateProduct.Show();
|
||||||
_logger.LogInformation("Получение товара");
|
_logger.LogInformation("Получение товара по штрихкоду");
|
||||||
textBoxName.Text = product.Name;
|
textBoxName.Text = product.Name;
|
||||||
numericUpDownPrice.Value = Convert.ToDecimal(product.Price);
|
numericUpDownPrice.Value = Convert.ToDecimal(product.Price);
|
||||||
numericUpDownAmount.Value = product.Amount;
|
numericUpDownAmount.Value = product.Amount;
|
||||||
|
@ -38,7 +38,6 @@ namespace WinFormsApp
|
|||||||
//services.AddTransient<ISupplyDocStorage, SupplyDocStorage>();
|
//services.AddTransient<ISupplyDocStorage, SupplyDocStorage>();
|
||||||
services.AddTransient<IProductStorage, ProductStorage>();
|
services.AddTransient<IProductStorage, ProductStorage>();
|
||||||
services.AddTransient<ISupplierStorage, SupplierStorage>();
|
services.AddTransient<ISupplierStorage, SupplierStorage>();
|
||||||
//services.AddTransient<, ImplementerStorage>();
|
|
||||||
|
|
||||||
services.AddTransient<ISupplyLogic, SupplyLogic>();
|
services.AddTransient<ISupplyLogic, SupplyLogic>();
|
||||||
services.AddTransient<ISupplierLogic, SupplierLogic>();
|
services.AddTransient<ISupplierLogic, SupplierLogic>();
|
||||||
@ -51,6 +50,7 @@ namespace WinFormsApp
|
|||||||
services.AddTransient<FormSupply>();
|
services.AddTransient<FormSupply>();
|
||||||
services.AddTransient<FormSupplyProduct>();
|
services.AddTransient<FormSupplyProduct>();
|
||||||
services.AddTransient<FormSupplierProduct>();
|
services.AddTransient<FormSupplierProduct>();
|
||||||
|
services.AddTransient<FormMediaFiles>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user