Добавьте файлы проекта.

This commit is contained in:
Admin 2025-11-26 15:13:27 +04:00
commit 072e4f97a3
49 changed files with 10278 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

363
.gitignore vendored Normal file
View File

@ -0,0 +1,363 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

387
AddAdmProduct.Designer.cs generated Normal file
View File

@ -0,0 +1,387 @@
namespace demMalyhin
{
partial class AddAdmProduct
{
/// <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.textBoxSale = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxArticle = new System.Windows.Forms.TextBox();
this.btnAdd = new System.Windows.Forms.Button();
this.comboBoxCategory = new System.Windows.Forms.ComboBox();
this.comboBoxManufacturer = new System.Windows.Forms.ComboBox();
this.textBoxQuantity = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.comboBoxSupplier = new System.Windows.Forms.ComboBox();
this.pictureBoxProductImage = new System.Windows.Forms.PictureBox();
this.btnChooseImage = new System.Windows.Forms.Button();
this.openFileDialogImage = new System.Windows.Forms.OpenFileDialog();
this.label11 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxProductImage)).BeginInit();
this.SuspendLayout();
//
// textBoxSale
//
this.textBoxSale.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxSale.Location = new System.Drawing.Point(157, 219);
this.textBoxSale.Name = "textBoxSale";
this.textBoxSale.Size = new System.Drawing.Size(194, 22);
this.textBoxSale.TabIndex = 20;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxUnit.Location = new System.Drawing.Point(157, 243);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.Size = new System.Drawing.Size(194, 22);
this.textBoxUnit.TabIndex = 19;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxPrice.Location = new System.Drawing.Point(157, 112);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.Size = new System.Drawing.Size(194, 22);
this.textBoxPrice.TabIndex = 18;
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxDesc.Location = new System.Drawing.Point(157, 262);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.Size = new System.Drawing.Size(194, 22);
this.textBoxDesc.TabIndex = 17;
//
// textBoxName
//
this.textBoxName.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxName.Location = new System.Drawing.Point(157, 88);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(194, 22);
this.textBoxName.TabIndex = 16;
//
// textBoxArticle
//
this.textBoxArticle.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxArticle.Location = new System.Drawing.Point(157, 65);
this.textBoxArticle.Name = "textBoxArticle";
this.textBoxArticle.Size = new System.Drawing.Size(194, 22);
this.textBoxArticle.TabIndex = 15;
//
// btnAdd
//
this.btnAdd.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnAdd.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.btnAdd.Location = new System.Drawing.Point(212, 486);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 23);
this.btnAdd.TabIndex = 21;
this.btnAdd.Text = "Добавить";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// comboBoxCategory
//
this.comboBoxCategory.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.comboBoxCategory.FormattingEnabled = true;
this.comboBoxCategory.Location = new System.Drawing.Point(195, 190);
this.comboBoxCategory.Name = "comboBoxCategory";
this.comboBoxCategory.Size = new System.Drawing.Size(121, 23);
this.comboBoxCategory.TabIndex = 22;
//
// comboBoxManufacturer
//
this.comboBoxManufacturer.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.comboBoxManufacturer.FormattingEnabled = true;
this.comboBoxManufacturer.Location = new System.Drawing.Point(195, 163);
this.comboBoxManufacturer.Name = "comboBoxManufacturer";
this.comboBoxManufacturer.Size = new System.Drawing.Size(121, 23);
this.comboBoxManufacturer.TabIndex = 24;
//
// textBoxQuantity
//
this.textBoxQuantity.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxQuantity.Location = new System.Drawing.Point(157, 285);
this.textBoxQuantity.Name = "textBoxQuantity";
this.textBoxQuantity.Size = new System.Drawing.Size(194, 22);
this.textBoxQuantity.TabIndex = 25;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(66, 67);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(50, 15);
this.label1.TabIndex = 26;
this.label1.Text = "артикул";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label2.Location = new System.Drawing.Point(54, 93);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(97, 15);
this.label2.TabIndex = 27;
this.label2.Text = "название товара";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label3.Location = new System.Drawing.Point(68, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 15);
this.label3.TabIndex = 28;
this.label3.Text = "цена";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label4.Location = new System.Drawing.Point(68, 142);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(67, 15);
this.label4.TabIndex = 29;
this.label4.Text = "поставщик";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label5.Location = new System.Drawing.Point(66, 169);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(89, 15);
this.label5.TabIndex = 30;
this.label5.Text = "производитель";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label6.Location = new System.Drawing.Point(66, 192);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(62, 15);
this.label6.TabIndex = 31;
this.label6.Text = "категория";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label7.Location = new System.Drawing.Point(66, 217);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(44, 15);
this.label7.TabIndex = 32;
this.label7.Text = "скидка";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label8.Location = new System.Drawing.Point(66, 236);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(85, 15);
this.label8.TabIndex = 33;
this.label8.Text = "ед. измерения";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label9.Location = new System.Drawing.Point(68, 259);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(60, 15);
this.label9.TabIndex = 34;
this.label9.Text = "описание";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label10.Location = new System.Drawing.Point(66, 285);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(69, 15);
this.label10.TabIndex = 35;
this.label10.Text = "количество";
//
// comboBoxSupplier
//
this.comboBoxSupplier.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.comboBoxSupplier.FormattingEnabled = true;
this.comboBoxSupplier.Location = new System.Drawing.Point(195, 136);
this.comboBoxSupplier.Name = "comboBoxSupplier";
this.comboBoxSupplier.Size = new System.Drawing.Size(121, 23);
this.comboBoxSupplier.TabIndex = 23;
//
// pictureBoxProductImage
//
this.pictureBoxProductImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxProductImage.Location = new System.Drawing.Point(85, 327);
this.pictureBoxProductImage.Name = "pictureBoxProductImage";
this.pictureBoxProductImage.Size = new System.Drawing.Size(188, 132);
this.pictureBoxProductImage.TabIndex = 36;
this.pictureBoxProductImage.TabStop = false;
//
// btnChooseImage
//
this.btnChooseImage.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnChooseImage.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.btnChooseImage.Location = new System.Drawing.Point(289, 385);
this.btnChooseImage.Name = "btnChooseImage";
this.btnChooseImage.Size = new System.Drawing.Size(75, 39);
this.btnChooseImage.TabIndex = 37;
this.btnChooseImage.Text = "Выбрать фото";
this.btnChooseImage.UseVisualStyleBackColor = false;
this.btnChooseImage.Click += new System.EventHandler(this.btnChooseImage_Click);
//
// openFileDialogImage
//
this.openFileDialogImage.FileName = "openFileDialogImage";
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(173, 9);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(162, 33);
this.label11.TabIndex = 38;
this.label11.Text = "Добавление";
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(376, 470);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 39;
this.btnBack.Text = "Назад";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(451, 9);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 40;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AddAdmProduct
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(487, 521);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.label11);
this.Controls.Add(this.btnChooseImage);
this.Controls.Add(this.pictureBoxProductImage);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxQuantity);
this.Controls.Add(this.comboBoxManufacturer);
this.Controls.Add(this.comboBoxSupplier);
this.Controls.Add(this.comboBoxCategory);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.textBoxSale);
this.Controls.Add(this.textBoxUnit);
this.Controls.Add(this.textBoxPrice);
this.Controls.Add(this.textBoxDesc);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.textBoxArticle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AddAdmProduct";
this.Text = "AddAdmProduct";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxProductImage)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxSale;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.TextBox textBoxArticle;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.ComboBox comboBoxCategory;
private System.Windows.Forms.ComboBox comboBoxManufacturer;
private System.Windows.Forms.TextBox textBoxQuantity;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.ComboBox comboBoxSupplier;
private System.Windows.Forms.PictureBox pictureBoxProductImage;
private System.Windows.Forms.Button btnChooseImage;
private System.Windows.Forms.OpenFileDialog openFileDialogImage;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

251
AddAdmProduct.cs Normal file
View File

@ -0,0 +1,251 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class AddAdmProduct : Form
{
private byte[] imageData = null;
public AddAdmProduct()
{
InitializeComponent();
LoadCategories();
LoadManufacturers();
LoadSuppliers();
}
private void LoadCategories()
{
DB db = new DB();
DataTable categories = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand("SELECT Category_name FROM Category", db.getConnection());
try
{
db.openConnection();
adapter.SelectCommand = command;
adapter.Fill(categories);
comboBoxCategory.DataSource = categories;
comboBoxCategory.DisplayMember = "Category_name";
comboBoxCategory.ValueMember = "Category_name";
}
catch (Exception ex)
{
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
}
finally
{
db.closeConnection();
}
}
private void LoadSuppliers()
{
DB db = new DB();
DataTable suppliers = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand("SELECT supplier_name FROM Supplier", db.getConnection());
try
{
db.openConnection();
adapter.SelectCommand = command;
adapter.Fill(suppliers);
comboBoxSupplier.DataSource = suppliers;
comboBoxSupplier.DisplayMember = "supplier_name";
comboBoxSupplier.ValueMember = "supplier_name";
}
catch (Exception ex)
{
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
}
finally
{
db.closeConnection();
}
}
private void LoadManufacturers()
{
DB db = new DB();
DataTable Manufacturer = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand("SELECT Manufacturer_name FROM Manufacturer", db.getConnection());
try
{
db.openConnection();
adapter.SelectCommand = command;
adapter.Fill(Manufacturer);
comboBoxManufacturer.DataSource = Manufacturer;
comboBoxManufacturer.DisplayMember = "Manufacturer_name";
comboBoxManufacturer.ValueMember = "Manufacturer_name";
}
catch (Exception ex)
{
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
}
finally
{
db.closeConnection();
}
}
private void btnChooseImage_Click(object sender, EventArgs e)
{
openFileDialogImage.Filter = "Image Files (*.png;*.jpg;*.jpeg)|*.png;*.jpg;*.jpeg";
openFileDialogImage.Title = "Выберите изображение товара";
if (openFileDialogImage.ShowDialog() == DialogResult.OK)
{
try
{
string filePath = openFileDialogImage.FileName;
// Если pictureBoxProductImage еще нет, создайте его в дизайнере
if (pictureBoxProductImage != null)
{
pictureBoxProductImage.Image = Image.FromFile(filePath);
pictureBoxProductImage.SizeMode = PictureBoxSizeMode.Zoom;
}
using (var ms = new MemoryStream())
{
// Загружаем в MemoryStream, чтобы сохранить исходный формат
using (Image originalImage = Image.FromFile(filePath))
{
originalImage.Save(ms, originalImage.RawFormat);
imageData = ms.ToArray();
}
}
// Опционально: можно добавить сообщение пользователю
// MessageBox.Show("Изображение выбрано.");
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
// Сбрасываем при ошибке
if (pictureBoxProductImage != null) pictureBoxProductImage.Image = null;
imageData = null;
}
}
}
private async void btnAdd_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text) || string.IsNullOrEmpty(textBoxArticle.Text) || string.IsNullOrEmpty(textBoxPrice.Text) || string.IsNullOrEmpty(textBoxSale.Text) || string.IsNullOrEmpty(textBoxUnit.Text) || string.IsNullOrEmpty(textBoxDesc.Text) || string.IsNullOrEmpty(textBoxQuantity.Text))
{
MessageBox.Show("Заполните все обязательные поля!");
return;
}
if (!int.TryParse(textBoxQuantity.Text, out int quantity) || quantity <= 0)
{
MessageBox.Show("Пожалуйста, введите корректное значение количества");
return;
}
if (!decimal.TryParse(textBoxPrice.Text, out decimal price) || price <= 0)
{
MessageBox.Show("Пожалуйста введите корректное значение цены");
return;
}
DB db = new DB();
try
{
db.openConnection();
string query = "INSERT INTO products (article_product, product_name, price, supplier_id, manufacturer_id, category_id, sale_percent, unit_type, description, quantity_in_stock, photo)" +
"VALUES (@article, @pr_name, @price, (SELECT id_Supplier FROM Supplier WHERE supplier_name = @sup_name), (SELECT id_Manufacturer FROM Manufacturer WHERE Manufacturer_name = @manu_name), (SELECT id_Category FROM Category WHERE Category_name = @category), @sale, @unit, @desc, @quantity, @product_photo)";
using (MySqlCommand command = new MySqlCommand(query, db.getConnection()))
{
command.Parameters.AddWithValue("@article", textBoxArticle.Text);
command.Parameters.AddWithValue("@pr_name", textBoxName.Text);
command.Parameters.AddWithValue("@price", price);
command.Parameters.AddWithValue("@sup_name", comboBoxSupplier.SelectedValue.ToString());
command.Parameters.AddWithValue("@manu_name", comboBoxManufacturer.SelectedValue.ToString());
command.Parameters.AddWithValue("@category", comboBoxCategory.SelectedValue.ToString());
command.Parameters.AddWithValue("@sale", textBoxSale.Text);
command.Parameters.AddWithValue("@unit", textBoxUnit.Text);
command.Parameters.AddWithValue("@desc", textBoxDesc.Text);
command.Parameters.AddWithValue("@quantity", quantity);
if (imageData != null)
{
// Если изображение было выбрано
command.Parameters.Add(new MySqlParameter("@product_photo", MySqlDbType.MediumBlob) { Value = imageData });
}
else
{
// Если изображение не было выбрано, записываем NULL
command.Parameters.Add(new MySqlParameter("@product_photo", MySqlDbType.MediumBlob) { Value = DBNull.Value });
}
int rowsAffected = await command.ExecuteNonQueryAsync();
if (rowsAffected > 0)
{
MessageBox.Show("Товар успешно добавлен!");
DialogResult = DialogResult.OK;
Close();
}
else
{
MessageBox.Show("Ошибка при добавлении продукта.");
}
}
}
catch (MySqlException ex)
{
if (ex.Number == 1452)
{
MessageBox.Show("Указанная категория не существует. Введите допустимое название категории.");
}
else
{
MessageBox.Show("Ошибка базы данных: " + ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show("Произошла: " + ex.Message);
}
finally
{
db.closeConnection();
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
AdmMainForm amf = new AdmMainForm();
amf.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

123
AddAdmProduct.resx Normal file
View File

@ -0,0 +1,123 @@
<?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>
<metadata name="openFileDialogImage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

230
AdmAddOrder.Designer.cs generated Normal file
View File

@ -0,0 +1,230 @@
namespace demMalyhin
{
partial class AdmAddOrder
{
/// <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.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxUser = new System.Windows.Forms.ComboBox();
this.comboBoxPoint = new System.Windows.Forms.ComboBox();
this.textBoxCode = new System.Windows.Forms.TextBox();
this.textBoxDelivery = new System.Windows.Forms.TextBox();
this.textBoxDate = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label5.Location = new System.Drawing.Point(148, 192);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(84, 15);
this.label5.TabIndex = 42;
this.label5.Text = "Пункт выдачи";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label3.Location = new System.Drawing.Point(70, 154);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(27, 15);
this.label3.TabIndex = 40;
this.label3.Text = "Код";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label2.Location = new System.Drawing.Point(12, 130);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(85, 15);
this.label2.TabIndex = 39;
this.label2.Text = "Дата доставки";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(27, 107);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 15);
this.label1.TabIndex = 38;
this.label1.Text = "Дата заказа";
//
// comboBoxUser
//
this.comboBoxUser.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.comboBoxUser.FormattingEnabled = true;
this.comboBoxUser.Location = new System.Drawing.Point(127, 260);
this.comboBoxUser.Name = "comboBoxUser";
this.comboBoxUser.Size = new System.Drawing.Size(133, 23);
this.comboBoxUser.TabIndex = 37;
//
// comboBoxPoint
//
this.comboBoxPoint.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.comboBoxPoint.FormattingEnabled = true;
this.comboBoxPoint.Location = new System.Drawing.Point(127, 210);
this.comboBoxPoint.Name = "comboBoxPoint";
this.comboBoxPoint.Size = new System.Drawing.Size(133, 23);
this.comboBoxPoint.TabIndex = 36;
//
// textBoxCode
//
this.textBoxCode.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxCode.Location = new System.Drawing.Point(103, 151);
this.textBoxCode.Name = "textBoxCode";
this.textBoxCode.Size = new System.Drawing.Size(194, 22);
this.textBoxCode.TabIndex = 34;
//
// textBoxDelivery
//
this.textBoxDelivery.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxDelivery.Location = new System.Drawing.Point(103, 127);
this.textBoxDelivery.Name = "textBoxDelivery";
this.textBoxDelivery.Size = new System.Drawing.Size(194, 22);
this.textBoxDelivery.TabIndex = 33;
//
// textBoxDate
//
this.textBoxDate.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.textBoxDate.Location = new System.Drawing.Point(103, 104);
this.textBoxDate.Name = "textBoxDate";
this.textBoxDate.Size = new System.Drawing.Size(194, 22);
this.textBoxDate.TabIndex = 32;
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(121, 23);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(162, 33);
this.label11.TabIndex = 44;
this.label11.Text = "Добавление";
//
// btnAdd
//
this.btnAdd.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnAdd.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.btnAdd.Location = new System.Drawing.Point(151, 342);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 23);
this.btnAdd.TabIndex = 45;
this.btnAdd.Text = "Добавить";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Times New Roman", 9.75F);
this.label6.Location = new System.Drawing.Point(124, 242);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(140, 15);
this.label6.TabIndex = 47;
this.label6.Text = "Идентификатор клиента";
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(272, 399);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 48;
this.btnBack.Text = "Назад";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(347, 12);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 49;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AdmAddOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(383, 450);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.label6);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.label11);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.comboBoxUser);
this.Controls.Add(this.comboBoxPoint);
this.Controls.Add(this.textBoxCode);
this.Controls.Add(this.textBoxDelivery);
this.Controls.Add(this.textBoxDate);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AdmAddOrder";
this.Text = "AdmAddOrder";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBoxUser;
private System.Windows.Forms.ComboBox comboBoxPoint;
private System.Windows.Forms.TextBox textBoxCode;
private System.Windows.Forms.TextBox textBoxDelivery;
private System.Windows.Forms.TextBox textBoxDate;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

160
AdmAddOrder.cs Normal file
View File

@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class AdmAddOrder : Form
{
public AdmAddOrder()
{
InitializeComponent();
LoadPickup();
LoadUser();
}
private void LoadPickup()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT idpickup_points, pickup_points.index FROM pickup_points";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable categoryTable = new DataTable();
categoryTable.Load(reader);
comboBoxPoint.DataSource = categoryTable;
comboBoxPoint.DisplayMember = "index";
comboBoxPoint.ValueMember = "idpickup_points";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void LoadUser()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_users FROM users";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable userTable = new DataTable();
userTable.Load(reader);
comboBoxUser.DataSource = userTable;
comboBoxUser.DisplayMember = "id_users";
comboBoxUser.ValueMember = "id_users";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private async void btnAdd_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxDate.Text) || string.IsNullOrEmpty(textBoxDelivery.Text) || string.IsNullOrEmpty(textBoxCode.Text))
{
MessageBox.Show("Заполните все обязательные поля!");
return;
}
DB db = new DB();
try
{
db.openConnection();
string query = "INSERT INTO Orders (order_date, delivery_date, pickup_point_id, user_initials_id, Orders.code, orderstatus_id)" +
"VALUES (@od, @dd, @pp, (SELECT id_users FROM users WHERE id_users = @user), @code, 1)";
using (MySqlCommand command = new MySqlCommand(query, db.getConnection()))
{
command.Parameters.AddWithValue("@od", textBoxDate.Text);
command.Parameters.AddWithValue("@pp", comboBoxPoint.SelectedValue.ToString());
command.Parameters.AddWithValue("@user", comboBoxUser.SelectedValue.ToString());
command.Parameters.AddWithValue("@dd", textBoxDelivery.Text);
command.Parameters.AddWithValue("@code", textBoxCode.Text);
int rowsAffected = await command.ExecuteNonQueryAsync();
if (rowsAffected > 0)
{
MessageBox.Show("Заказ успешно добавлен!");
DialogResult = DialogResult.OK;
this.Close();
AdmOrder ado = new AdmOrder();
ado.Show();
}
else
{
MessageBox.Show("Ошибка при добавлении заказа.");
}
}
}
catch (MySqlException ex)
{
if (ex.Number == 1452)
{
MessageBox.Show("Указанная категория не существует. Введите допустимое название категории.");
}
else
{
MessageBox.Show("Ошибка базы данных: " + ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show("Произошла: " + ex.Message);
}
finally
{
db.closeConnection();
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Hide();
AdmOrder ador = new AdmOrder();
ador.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

120
AdmAddOrder.resx Normal file
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>

175
AdmEditOrder.Designer.cs generated Normal file
View File

@ -0,0 +1,175 @@
namespace demMalyhin
{
partial class AdmEditOrder
{
/// <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.textBoxId = new System.Windows.Forms.TextBox();
this.textBoxDelivery = new System.Windows.Forms.TextBox();
this.textBoxDate = new System.Windows.Forms.TextBox();
this.comboBoxStatus = new System.Windows.Forms.ComboBox();
this.comboBoxPoint = new System.Windows.Forms.ComboBox();
this.button3 = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.textBoxCode = new System.Windows.Forms.TextBox();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxId
//
this.textBoxId.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxId.Location = new System.Drawing.Point(94, 116);
this.textBoxId.Name = "textBoxId";
this.textBoxId.ReadOnly = true;
this.textBoxId.Size = new System.Drawing.Size(194, 20);
this.textBoxId.TabIndex = 43;
//
// textBoxDelivery
//
this.textBoxDelivery.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDelivery.Location = new System.Drawing.Point(94, 168);
this.textBoxDelivery.Name = "textBoxDelivery";
this.textBoxDelivery.Size = new System.Drawing.Size(194, 20);
this.textBoxDelivery.TabIndex = 42;
//
// textBoxDate
//
this.textBoxDate.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDate.Location = new System.Drawing.Point(94, 142);
this.textBoxDate.Name = "textBoxDate";
this.textBoxDate.Size = new System.Drawing.Size(194, 20);
this.textBoxDate.TabIndex = 41;
//
// comboBoxStatus
//
this.comboBoxStatus.FormattingEnabled = true;
this.comboBoxStatus.Location = new System.Drawing.Point(134, 247);
this.comboBoxStatus.Name = "comboBoxStatus";
this.comboBoxStatus.Size = new System.Drawing.Size(121, 21);
this.comboBoxStatus.TabIndex = 39;
//
// comboBoxPoint
//
this.comboBoxPoint.FormattingEnabled = true;
this.comboBoxPoint.Location = new System.Drawing.Point(134, 220);
this.comboBoxPoint.Name = "comboBoxPoint";
this.comboBoxPoint.Size = new System.Drawing.Size(121, 21);
this.comboBoxPoint.TabIndex = 38;
//
// button3
//
this.button3.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button3.Location = new System.Drawing.Point(153, 286);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 44;
this.button3.Text = "Сохранить";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(88, 46);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(213, 33);
this.label11.TabIndex = 45;
this.label11.Text = "Редактирование";
//
// textBoxCode
//
this.textBoxCode.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxCode.Location = new System.Drawing.Point(94, 194);
this.textBoxCode.Name = "textBoxCode";
this.textBoxCode.Size = new System.Drawing.Size(194, 20);
this.textBoxCode.TabIndex = 46;
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(273, 399);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 47;
this.btnBack.Text = "Назад";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(348, 12);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 48;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AdmEditOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(395, 450);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.textBoxCode);
this.Controls.Add(this.label11);
this.Controls.Add(this.button3);
this.Controls.Add(this.textBoxId);
this.Controls.Add(this.textBoxDelivery);
this.Controls.Add(this.textBoxDate);
this.Controls.Add(this.comboBoxStatus);
this.Controls.Add(this.comboBoxPoint);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AdmEditOrder";
this.Text = "AdmEditOrder";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxId;
private System.Windows.Forms.TextBox textBoxDelivery;
private System.Windows.Forms.TextBox textBoxDate;
private System.Windows.Forms.ComboBox comboBoxStatus;
private System.Windows.Forms.ComboBox comboBoxPoint;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBoxCode;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

179
AdmEditOrder.cs Normal file
View File

@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class AdmEditOrder : Form
{
private string productId;
public AdmEditOrder(string productId)
{
InitializeComponent();
LoadProductData(productId);
LoadPickup();
LoadStatus();
}
private void LoadProductData(string productId)
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT order_date, delivery_date, pickup_point_id, user_initials_id, code, orderstatus_id FROM Orders WHERE id_Orders = @id";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@id", productId);
using (MySqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
textBoxId.Text = productId;
textBoxDate.Text = reader["order_date"].ToString();
textBoxDelivery.Text = reader["delivery_date"].ToString();
comboBoxPoint.Text = reader["pickup_point_id"].ToString();
textBoxCode.Text = reader["code"].ToString();
comboBoxStatus.Text = reader["orderstatus_id"].ToString();
}
else
{
MessageBox.Show("Продукт с указанным ID не найден.");
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке данных продукта: " + ex.Message);
}
}
private void LoadPickup()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT idpickup_points, pickup_points.index FROM pickup_points";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable categoryTable = new DataTable();
categoryTable.Load(reader);
comboBoxPoint.DataSource = categoryTable;
comboBoxPoint.DisplayMember = "index";
comboBoxPoint.ValueMember = "idpickup_points";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void LoadStatus()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_OrderStatus, status_name FROM OrderStatus";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable statusTable = new DataTable();
statusTable.Load(reader);
comboBoxStatus.DataSource = statusTable;
comboBoxStatus.DisplayMember = "status_name";
comboBoxStatus.ValueMember = "id_OrderStatus";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
try
{
object supplierId = comboBoxStatus.SelectedValue;
object manufacturerId = comboBoxPoint.SelectedValue;
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "UPDATE Orders SET order_date = @od, delivery_date = @dd, pickup_point_id = @point, orderstatus_id = @status, Orders.code = @code WHERE id_Orders = @id";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@id", textBoxId.Text);
command.Parameters.AddWithValue("@od", textBoxDate.Text);
command.Parameters.AddWithValue("@dd", textBoxDelivery.Text);
command.Parameters.AddWithValue("@code", textBoxCode.Text);
command.Parameters.AddWithValue("@status", supplierId);
command.Parameters.AddWithValue("@point", manufacturerId);
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected > 0)
{
MessageBox.Show("Данные продукта успешно обновлены.");
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show("Не удалось обновить данные продукта.");
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при сохранении данных продукта: " + ex.Message);
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
AdmOrder admeo = new AdmOrder();
admeo.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

120
AdmEditOrder.resx Normal file
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>

268
AdmEditProduct.Designer.cs generated Normal file
View File

@ -0,0 +1,268 @@
namespace demMalyhin
{
partial class AdmEditProduct
{
/// <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.comboBoxSupplier = new System.Windows.Forms.ComboBox();
this.comboBoxCategory = new System.Windows.Forms.ComboBox();
this.comboBoxManufacturer = new System.Windows.Forms.ComboBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxName = new System.Windows.Forms.TextBox();
this.pictureBoxEditProduct = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.openFileDialogImage = new System.Windows.Forms.OpenFileDialog();
this.button3 = new System.Windows.Forms.Button();
this.textBoxArticle = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxQuantity = new System.Windows.Forms.TextBox();
this.textBoxSale = new System.Windows.Forms.TextBox();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxEditProduct)).BeginInit();
this.SuspendLayout();
//
// comboBoxSupplier
//
this.comboBoxSupplier.FormattingEnabled = true;
this.comboBoxSupplier.Location = new System.Drawing.Point(193, 151);
this.comboBoxSupplier.Name = "comboBoxSupplier";
this.comboBoxSupplier.Size = new System.Drawing.Size(121, 21);
this.comboBoxSupplier.TabIndex = 0;
//
// comboBoxCategory
//
this.comboBoxCategory.FormattingEnabled = true;
this.comboBoxCategory.Location = new System.Drawing.Point(193, 205);
this.comboBoxCategory.Name = "comboBoxCategory";
this.comboBoxCategory.Size = new System.Drawing.Size(121, 21);
this.comboBoxCategory.TabIndex = 1;
//
// comboBoxManufacturer
//
this.comboBoxManufacturer.FormattingEnabled = true;
this.comboBoxManufacturer.Location = new System.Drawing.Point(193, 178);
this.comboBoxManufacturer.Name = "comboBoxManufacturer";
this.comboBoxManufacturer.Size = new System.Drawing.Size(121, 21);
this.comboBoxManufacturer.TabIndex = 2;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxPrice.Location = new System.Drawing.Point(153, 125);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.Size = new System.Drawing.Size(194, 20);
this.textBoxPrice.TabIndex = 29;
//
// textBoxName
//
this.textBoxName.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxName.Location = new System.Drawing.Point(153, 99);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(194, 20);
this.textBoxName.TabIndex = 27;
//
// pictureBoxEditProduct
//
this.pictureBoxEditProduct.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxEditProduct.Location = new System.Drawing.Point(113, 347);
this.pictureBoxEditProduct.Name = "pictureBoxEditProduct";
this.pictureBoxEditProduct.Size = new System.Drawing.Size(162, 111);
this.pictureBoxEditProduct.TabIndex = 33;
this.pictureBoxEditProduct.TabStop = false;
//
// button1
//
this.button1.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button1.Location = new System.Drawing.Point(281, 347);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 37);
this.button1.TabIndex = 34;
this.button1.Text = "Удалить фото";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.btnEditRemoveImage_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button2.Location = new System.Drawing.Point(281, 390);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 47);
this.button2.TabIndex = 35;
this.button2.Text = "Изменить фото";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.btnEditChooseImage_Click);
//
// openFileDialogImage
//
this.openFileDialogImage.FileName = "openFileDialog1";
//
// button3
//
this.button3.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button3.Location = new System.Drawing.Point(227, 468);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 36;
this.button3.Text = "Сохранить";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.btnSave_Click);
//
// textBoxArticle
//
this.textBoxArticle.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxArticle.Location = new System.Drawing.Point(153, 73);
this.textBoxArticle.Name = "textBoxArticle";
this.textBoxArticle.ReadOnly = true;
this.textBoxArticle.Size = new System.Drawing.Size(194, 20);
this.textBoxArticle.TabIndex = 37;
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(143, 9);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(213, 33);
this.label11.TabIndex = 39;
this.label11.Text = "Редактирование";
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDesc.Location = new System.Drawing.Point(153, 285);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.Size = new System.Drawing.Size(194, 20);
this.textBoxDesc.TabIndex = 28;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxUnit.Location = new System.Drawing.Point(153, 262);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.Size = new System.Drawing.Size(194, 20);
this.textBoxUnit.TabIndex = 30;
//
// textBoxQuantity
//
this.textBoxQuantity.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxQuantity.Location = new System.Drawing.Point(153, 311);
this.textBoxQuantity.Name = "textBoxQuantity";
this.textBoxQuantity.Size = new System.Drawing.Size(194, 20);
this.textBoxQuantity.TabIndex = 32;
//
// textBoxSale
//
this.textBoxSale.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxSale.Location = new System.Drawing.Point(153, 243);
this.textBoxSale.Name = "textBoxSale";
this.textBoxSale.Size = new System.Drawing.Size(194, 20);
this.textBoxSale.TabIndex = 31;
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(391, 461);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 40;
this.btnBack.Text = "Назад";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(466, 12);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 41;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AdmEditProduct
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(502, 510);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.label11);
this.Controls.Add(this.textBoxArticle);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBoxEditProduct);
this.Controls.Add(this.textBoxQuantity);
this.Controls.Add(this.textBoxSale);
this.Controls.Add(this.textBoxUnit);
this.Controls.Add(this.textBoxPrice);
this.Controls.Add(this.textBoxDesc);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.comboBoxManufacturer);
this.Controls.Add(this.comboBoxCategory);
this.Controls.Add(this.comboBoxSupplier);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AdmEditProduct";
this.Text = "AdmEditProduct";
this.Load += new System.EventHandler(this.AdmEditProduct_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxEditProduct)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox comboBoxSupplier;
private System.Windows.Forms.ComboBox comboBoxCategory;
private System.Windows.Forms.ComboBox comboBoxManufacturer;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.PictureBox pictureBoxEditProduct;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.OpenFileDialog openFileDialogImage;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBoxArticle;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxQuantity;
private System.Windows.Forms.TextBox textBoxSale;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

291
AdmEditProduct.cs Normal file
View File

@ -0,0 +1,291 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class AdmEditProduct : Form
{
private string productId;
private byte[] imageData = null;
public AdmEditProduct(string productId)
{
InitializeComponent();
LoadSuppliers();
LoadCategories();
LoadManufacturers();
LoadProductData(productId);
}
private void LoadProductData(string productId)
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT product_name, category_id, supplier_id, manufacturer_id, price, quantity_in_stock, description, unit_type, sale_percent, photo FROM products WHERE article_product = @id";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@id", productId);
using (MySqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
textBoxArticle.Text = productId;
textBoxName.Text = reader["product_name"].ToString();
comboBoxCategory.Text = reader["category_id"].ToString();
comboBoxSupplier.Text = reader["supplier_id"].ToString();
comboBoxManufacturer.Text = reader["manufacturer_id"].ToString();
textBoxPrice.Text = reader["price"].ToString();
textBoxQuantity.Text = reader["quantity_in_stock"].ToString();
textBoxDesc.Text = reader["description"].ToString();
textBoxUnit.Text = reader["unit_type"].ToString();
textBoxSale.Text = reader["sale_percent"].ToString();
}
else
{
MessageBox.Show("Продукт с указанным ID не найден.");
this.DialogResult = DialogResult.Cancel;
this.Close();
}
if (reader["photo"] != DBNull.Value)
{
// Загружаем данные изображения из базы данных в класс-уровневую переменную imageData
this.imageData = (byte[])reader["photo"];
using (MemoryStream ms = new MemoryStream(this.imageData))
{
pictureBoxEditProduct.Image = Image.FromStream(ms);
pictureBoxEditProduct.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
this.imageData = null; // Убеждаемся, что imageData обнуляется, если фото нет
pictureBoxEditProduct.Image = null; // Или устанавливаем стандартную заглушку
// pictureBoxEditProduct.Image = Properties.Resources.picture;
}
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке данных продукта: " + ex.Message);
}
}
private void btnEditChooseImage_Click(object sender, EventArgs e)
{
openFileDialogImage.Filter = "Image Files (*.png;*.jpg;*.jpeg)|*.png;*.jpg;*.jpeg";
openFileDialogImage.Title = "Выберите новое изображение товара";
if (openFileDialogImage.ShowDialog() == DialogResult.OK)
{
try
{
string filePath = openFileDialogImage.FileName;
pictureBoxEditProduct.Image = Image.FromFile(filePath);
pictureBoxEditProduct.SizeMode = PictureBoxSizeMode.Zoom;
using (var ms = new MemoryStream())
{
using (Image originalImage = Image.FromFile(filePath))
{
originalImage.Save(ms, originalImage.RawFormat);
imageData = ms.ToArray();
}
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
pictureBoxEditProduct.Image = null;
imageData = null;
}
}
}
private void btnEditRemoveImage_Click(object sender, EventArgs e)
{
pictureBoxEditProduct.Image = null;
imageData = null;
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
object supplierId = comboBoxSupplier.SelectedValue;
object manufacturerId = comboBoxManufacturer.SelectedValue;
object categoryId = comboBoxCategory.SelectedValue;
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "UPDATE products SET product_name = @pr_name, category_id = @category_id, manufacturer_id = @manufacturer_id, unit_type = @unit, quantity_in_stock = @quantity, price = @price, supplier_id = @supplier_id, description = @desc, photo = @product_photo, sale_percent = @sale WHERE article_product = @id";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@id", textBoxArticle.Text);
command.Parameters.AddWithValue("@pr_name", textBoxName.Text);
command.Parameters.AddWithValue("@desc", textBoxDesc.Text);
command.Parameters.AddWithValue("@sale", textBoxSale.Text);
command.Parameters.AddWithValue("@unit", textBoxUnit.Text);
command.Parameters.AddWithValue("@quantity", textBoxQuantity.Text);
command.Parameters.AddWithValue("@price", Convert.ToDecimal(textBoxPrice.Text));
command.Parameters.AddWithValue("@supplier_id", supplierId);
command.Parameters.AddWithValue("@manufacturer_id", manufacturerId);
command.Parameters.AddWithValue("@category_id", categoryId);
if (imageData != null)
{
// Если изображение было выбрано или изменено
command.Parameters.Add(new MySqlParameter("@product_photo", MySqlDbType.MediumBlob) { Value = imageData });
}
else
{
// Если изображение удалено или не было выбрано
command.Parameters.Add(new MySqlParameter("@product_photo", MySqlDbType.MediumBlob) { Value = imageData });
}
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected > 0)
{
MessageBox.Show("Данные продукта успешно обновлены.");
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show("Не удалось обновить данные продукта.");
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при сохранении данных продукта: " + ex.Message);
}
}
private void LoadCategories()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_Category, Category_name FROM Category";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable categoryTable = new DataTable();
categoryTable.Load(reader);
comboBoxCategory.DataSource = categoryTable;
comboBoxCategory.DisplayMember = "Category_name";
comboBoxCategory.ValueMember = "id_Category";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void LoadSuppliers()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_Supplier, supplier_name FROM Supplier";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable suppTable = new DataTable();
suppTable.Load(reader);
comboBoxSupplier.DataSource = suppTable;
comboBoxSupplier.DisplayMember = "supplier_name";
comboBoxSupplier.ValueMember = "id_Supplier";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void LoadManufacturers()
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_Manufacturer, Manufacturer_name FROM Manufacturer";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable manuTable = new DataTable();
manuTable.Load(reader);
comboBoxManufacturer.DataSource = manuTable;
comboBoxManufacturer.DisplayMember = "Manufacturer_name";
comboBoxManufacturer.ValueMember = "id_Manufacturer";
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при загрузке категорий: " + ex.Message);
}
}
private void AdmEditProduct_Load(object sender, EventArgs e)
{
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
AdmMainForm amf = new AdmMainForm();
amf.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

123
AdmEditProduct.resx Normal file
View File

@ -0,0 +1,123 @@
<?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>
<metadata name="openFileDialogImage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

531
AdmMainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,531 @@
namespace demMalyhin
{
partial class AdmMainForm
{
/// <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.label1 = new System.Windows.Forms.Label();
this.labelFIO = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.SaleLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.textBoxFP = new System.Windows.Forms.TextBox();
this.textBoxStock = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxSup = new System.Windows.Forms.TextBox();
this.textBoxManuf = new System.Windows.Forms.TextBox();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.StockLabel = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.PriceLabel = new System.Windows.Forms.Label();
this.SupplierLabel = new System.Windows.Forms.Label();
this.ManufacturerLabel = new System.Windows.Forms.Label();
this.DescriptionLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.CategoryLabel = new System.Windows.Forms.Label();
this.pictureBoxPhoto = new System.Windows.Forms.PictureBox();
this.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.comboBoxSort = new System.Windows.Forms.ComboBox();
this.comboBoxFilter = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.OrdersBtn = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Chartreuse;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(586, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(90, 15);
this.label1.TabIndex = 0;
this.label1.Text = "ФИО Клиента -";
//
// labelFIO
//
this.labelFIO.AutoSize = true;
this.labelFIO.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.labelFIO.Location = new System.Drawing.Point(676, 9);
this.labelFIO.Name = "labelFIO";
this.labelFIO.Size = new System.Drawing.Size(0, 15);
this.labelFIO.TabIndex = 1;
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(28, 538);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 3;
this.btnBack.Text = "Главное меню";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Chartreuse;
this.label2.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(258, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(313, 33);
this.label2.TabIndex = 4;
this.label2.Text = "Каталог администратора";
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.pictureBoxPhoto);
this.panel1.Location = new System.Drawing.Point(28, 314);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(789, 218);
this.panel1.TabIndex = 5;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.SaleLabel);
this.panel3.Location = new System.Drawing.Point(623, 14);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(142, 189);
this.panel3.TabIndex = 2;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label4.Location = new System.Drawing.Point(29, 51);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(73, 28);
this.label4.TabIndex = 4;
this.label4.Text = "Действующая\r\nскидка";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// SaleLabel
//
this.SaleLabel.AutoSize = true;
this.SaleLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SaleLabel.Location = new System.Drawing.Point(53, 87);
this.SaleLabel.Name = "SaleLabel";
this.SaleLabel.Size = new System.Drawing.Size(0, 14);
this.SaleLabel.TabIndex = 2;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.textBoxFP);
this.panel2.Controls.Add(this.textBoxStock);
this.panel2.Controls.Add(this.textBoxUnit);
this.panel2.Controls.Add(this.textBoxPrice);
this.panel2.Controls.Add(this.textBoxSup);
this.panel2.Controls.Add(this.textBoxManuf);
this.panel2.Controls.Add(this.textBoxDesc);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.StockLabel);
this.panel2.Controls.Add(this.label9);
this.panel2.Controls.Add(this.PriceLabel);
this.panel2.Controls.Add(this.SupplierLabel);
this.panel2.Controls.Add(this.ManufacturerLabel);
this.panel2.Controls.Add(this.DescriptionLabel);
this.panel2.Controls.Add(this.NameLabel);
this.panel2.Controls.Add(this.CategoryLabel);
this.panel2.Location = new System.Drawing.Point(212, 14);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(395, 189);
this.panel2.TabIndex = 1;
//
// textBoxFP
//
this.textBoxFP.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxFP.Location = new System.Drawing.Point(247, 113);
this.textBoxFP.Name = "textBoxFP";
this.textBoxFP.ReadOnly = true;
this.textBoxFP.Size = new System.Drawing.Size(95, 20);
this.textBoxFP.TabIndex = 15;
//
// textBoxStock
//
this.textBoxStock.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxStock.Location = new System.Drawing.Point(148, 158);
this.textBoxStock.Name = "textBoxStock";
this.textBoxStock.ReadOnly = true;
this.textBoxStock.Size = new System.Drawing.Size(194, 20);
this.textBoxStock.TabIndex = 14;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxUnit.Location = new System.Drawing.Point(148, 135);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.ReadOnly = true;
this.textBoxUnit.Size = new System.Drawing.Size(194, 20);
this.textBoxUnit.TabIndex = 13;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxPrice.Location = new System.Drawing.Point(148, 113);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.ReadOnly = true;
this.textBoxPrice.Size = new System.Drawing.Size(95, 20);
this.textBoxPrice.TabIndex = 12;
//
// textBoxSup
//
this.textBoxSup.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxSup.Location = new System.Drawing.Point(148, 87);
this.textBoxSup.Name = "textBoxSup";
this.textBoxSup.ReadOnly = true;
this.textBoxSup.Size = new System.Drawing.Size(194, 20);
this.textBoxSup.TabIndex = 11;
//
// textBoxManuf
//
this.textBoxManuf.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxManuf.Location = new System.Drawing.Point(148, 64);
this.textBoxManuf.Name = "textBoxManuf";
this.textBoxManuf.ReadOnly = true;
this.textBoxManuf.Size = new System.Drawing.Size(194, 20);
this.textBoxManuf.TabIndex = 10;
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDesc.Location = new System.Drawing.Point(148, 41);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.ReadOnly = true;
this.textBoxDesc.Size = new System.Drawing.Size(194, 20);
this.textBoxDesc.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label3.Location = new System.Drawing.Point(131, 14);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(11, 15);
this.label3.TabIndex = 8;
this.label3.Text = "I";
//
// StockLabel
//
this.StockLabel.AutoSize = true;
this.StockLabel.BackColor = System.Drawing.Color.Chartreuse;
this.StockLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.StockLabel.Location = new System.Drawing.Point(14, 158);
this.StockLabel.Name = "StockLabel";
this.StockLabel.Size = new System.Drawing.Size(112, 14);
this.StockLabel.TabIndex = 7;
this.StockLabel.Text = "Количество на складе:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.Color.Chartreuse;
this.label9.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label9.Location = new System.Drawing.Point(21, 135);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(104, 14);
this.label9.TabIndex = 6;
this.label9.Text = "Единица измерения:";
//
// PriceLabel
//
this.PriceLabel.AutoSize = true;
this.PriceLabel.BackColor = System.Drawing.Color.Chartreuse;
this.PriceLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.PriceLabel.Location = new System.Drawing.Point(57, 113);
this.PriceLabel.Name = "PriceLabel";
this.PriceLabel.Size = new System.Drawing.Size(69, 14);
this.PriceLabel.TabIndex = 5;
this.PriceLabel.Text = "Цена товара:";
//
// SupplierLabel
//
this.SupplierLabel.AutoSize = true;
this.SupplierLabel.BackColor = System.Drawing.Color.Chartreuse;
this.SupplierLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SupplierLabel.Location = new System.Drawing.Point(63, 90);
this.SupplierLabel.Name = "SupplierLabel";
this.SupplierLabel.Size = new System.Drawing.Size(63, 14);
this.SupplierLabel.TabIndex = 4;
this.SupplierLabel.Text = "Поставщик:";
//
// ManufacturerLabel
//
this.ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.BackColor = System.Drawing.Color.Chartreuse;
this.ManufacturerLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ManufacturerLabel.Location = new System.Drawing.Point(44, 67);
this.ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.Size = new System.Drawing.Size(82, 14);
this.ManufacturerLabel.TabIndex = 3;
this.ManufacturerLabel.Text = "Производитель:";
//
// DescriptionLabel
//
this.DescriptionLabel.AutoSize = true;
this.DescriptionLabel.BackColor = System.Drawing.Color.Chartreuse;
this.DescriptionLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.DescriptionLabel.Location = new System.Drawing.Point(34, 44);
this.DescriptionLabel.Name = "DescriptionLabel";
this.DescriptionLabel.Size = new System.Drawing.Size(92, 14);
this.DescriptionLabel.TabIndex = 2;
this.DescriptionLabel.Text = "Описание товара:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.BackColor = System.Drawing.Color.Chartreuse;
this.NameLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.NameLabel.Location = new System.Drawing.Point(157, 16);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(112, 14);
this.NameLabel.TabIndex = 1;
this.NameLabel.Text = "Наименование товара";
//
// CategoryLabel
//
this.CategoryLabel.AutoSize = true;
this.CategoryLabel.BackColor = System.Drawing.Color.Chartreuse;
this.CategoryLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.CategoryLabel.Location = new System.Drawing.Point(19, 16);
this.CategoryLabel.Name = "CategoryLabel";
this.CategoryLabel.Size = new System.Drawing.Size(92, 14);
this.CategoryLabel.TabIndex = 0;
this.CategoryLabel.Text = "Категория товара";
//
// pictureBoxPhoto
//
this.pictureBoxPhoto.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxPhoto.Location = new System.Drawing.Point(17, 14);
this.pictureBoxPhoto.Name = "pictureBoxPhoto";
this.pictureBoxPhoto.Size = new System.Drawing.Size(174, 189);
this.pictureBoxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxPhoto.TabIndex = 0;
this.pictureBoxPhoto.TabStop = false;
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(70, 85);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(691, 223);
this.DataGridViewProduct.TabIndex = 6;
this.DataGridViewProduct.Click += new System.EventHandler(this.dataGridViewProd_Click);
//
// textBoxSearch
//
this.textBoxSearch.BackColor = System.Drawing.Color.MediumSpringGreen;
this.textBoxSearch.Location = new System.Drawing.Point(28, 59);
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.Size = new System.Drawing.Size(455, 20);
this.textBoxSearch.TabIndex = 7;
this.textBoxSearch.TextChanged += new System.EventHandler(this.textBoxSearch_TextChanged);
//
// comboBoxSort
//
this.comboBoxSort.BackColor = System.Drawing.Color.MediumSpringGreen;
this.comboBoxSort.FormattingEnabled = true;
this.comboBoxSort.Location = new System.Drawing.Point(489, 59);
this.comboBoxSort.Name = "comboBoxSort";
this.comboBoxSort.Size = new System.Drawing.Size(160, 21);
this.comboBoxSort.TabIndex = 8;
this.comboBoxSort.SelectedIndexChanged += new System.EventHandler(this.comboBoxSort_SelectedIndexChanged);
//
// comboBoxFilter
//
this.comboBoxFilter.BackColor = System.Drawing.Color.MediumSpringGreen;
this.comboBoxFilter.FormattingEnabled = true;
this.comboBoxFilter.Location = new System.Drawing.Point(657, 59);
this.comboBoxFilter.Name = "comboBoxFilter";
this.comboBoxFilter.Size = new System.Drawing.Size(160, 21);
this.comboBoxFilter.TabIndex = 9;
this.comboBoxFilter.SelectedIndexChanged += new System.EventHandler(this.comboBoxFilter_SelectedIndexChanged);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button1.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button1.Location = new System.Drawing.Point(241, 537);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(99, 39);
this.button1.TabIndex = 10;
this.button1.Text = "Добавить";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button2.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button2.Location = new System.Drawing.Point(370, 537);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(141, 39);
this.button2.TabIndex = 11;
this.button2.Text = "Редактировать";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// btnDelete
//
this.btnDelete.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnDelete.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnDelete.Location = new System.Drawing.Point(537, 538);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(99, 39);
this.btnDelete.TabIndex = 12;
this.btnDelete.Text = "Удалить";
this.btnDelete.UseVisualStyleBackColor = false;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// OrdersBtn
//
this.OrdersBtn.BackColor = System.Drawing.Color.MediumSpringGreen;
this.OrdersBtn.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.OrdersBtn.Location = new System.Drawing.Point(718, 538);
this.OrdersBtn.Name = "OrdersBtn";
this.OrdersBtn.Size = new System.Drawing.Size(99, 39);
this.OrdersBtn.TabIndex = 13;
this.OrdersBtn.Text = "Заказы";
this.OrdersBtn.UseVisualStyleBackColor = false;
this.OrdersBtn.Click += new System.EventHandler(this.OrdersBtn_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(12, 5);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 14;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AdmMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(840, 589);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.OrdersBtn);
this.Controls.Add(this.btnDelete);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.comboBoxFilter);
this.Controls.Add(this.comboBoxSort);
this.Controls.Add(this.textBoxSearch);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.labelFIO);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AdmMainForm";
this.Text = "6";
this.Load += new System.EventHandler(this.AdmMainForm_Load);
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label labelFIO;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.PictureBox pictureBoxPhoto;
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Label StockLabel;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label PriceLabel;
private System.Windows.Forms.Label SupplierLabel;
private System.Windows.Forms.Label ManufacturerLabel;
private System.Windows.Forms.Label DescriptionLabel;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Label CategoryLabel;
private System.Windows.Forms.TextBox textBoxStock;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxSup;
private System.Windows.Forms.TextBox textBoxManuf;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label SaleLabel;
private System.Windows.Forms.TextBox textBoxFP;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBoxSearch;
private System.Windows.Forms.ComboBox comboBoxSort;
private System.Windows.Forms.ComboBox comboBoxFilter;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button OrdersBtn;
private System.Windows.Forms.Button btnExit;
}
}

446
AdmMainForm.cs Normal file
View File

@ -0,0 +1,446 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace demMalyhin
{
public partial class AdmMainForm : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public AdmMainForm()
{
InitializeComponent();
LoadProdData();
LoadSortOptions();
LoadFilterOptions();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT article_product AS `Артикул`, product_name AS `Название товара`, price AS `Цена`, supplier_name AS `Поставщик`, Manufacturer_name AS `Производитель`, Category_name AS `Категория`, sale_percent AS `Скидка`, unit_type AS `Единица измерения`, description AS `описание`, quantity_in_stock AS `Количество на складе`, photo AS `фото` FROM products LEFT JOIN Category ON products.category_id = Category.id_Category JOIN Supplier ON products.supplier_id = Supplier.id_Supplier JOIN Manufacturer ON products.manufacturer_id = Manufacturer.id_Manufacturer";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void dataGridViewProd_Click(object sender, EventArgs e)
{
textBoxDesc.Text = DataGridViewProduct.CurrentRow.Cells[8].Value.ToString();
textBoxManuf.Text = DataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
textBoxSup.Text = DataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
textBoxPrice.Text = DataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
textBoxUnit.Text = DataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
textBoxStock.Text = DataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
NameLabel.Text = DataGridViewProduct.CurrentRow.Cells[1].Value.ToString();
CategoryLabel.Text = DataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
SaleLabel.Text = DataGridViewProduct.CurrentRow.Cells[6].Value.ToString() + "%";
try
{
object photoData = DataGridViewProduct.CurrentRow.Cells[10].Value;
if (photoData != DBNull.Value)
{
byte[] imageData = (byte[])photoData;
if (imageData != null && imageData.Length > 0)
{
using (MemoryStream ms = new MemoryStream(imageData))
{
pictureBoxPhoto.Image = Image.FromStream(ms);
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message);
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
try
{
var currentRow = DataGridViewProduct.CurrentRow;
if (currentRow == null) return;
Color defaultColor = SystemColors.Window;
textBoxPrice.BackColor = defaultColor;
textBoxSup.BackColor = defaultColor;
textBoxManuf.BackColor = defaultColor;
textBoxStock.BackColor = defaultColor;
textBoxPrice.ForeColor = Color.Black;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Regular);
textBoxFP.Text = "";
decimal originalPrice = 0m;
int salePercent = 0;
int quantityInStock = 0;
decimal.TryParse(currentRow.Cells[2].Value?.ToString(), out originalPrice);
int.TryParse(currentRow.Cells[6].Value?.ToString(), out salePercent);
int.TryParse(currentRow.Cells[9].Value?.ToString(), out quantityInStock);
if (salePercent > 15)
{
Color highDiscountColor = ColorTranslator.FromHtml("#2E8B57");
textBoxPrice.BackColor = highDiscountColor;
textBoxSup.BackColor = highDiscountColor;
textBoxManuf.BackColor = highDiscountColor;
textBoxStock.BackColor = highDiscountColor;
textBoxDesc.BackColor = highDiscountColor;
textBoxFP.BackColor = highDiscountColor;
textBoxUnit.BackColor = highDiscountColor;
panel3.BackColor = highDiscountColor;
}
else
{
textBoxPrice.BackColor = Color.White;
textBoxSup.BackColor = Color.White;
textBoxManuf.BackColor = Color.White;
textBoxStock.BackColor = Color.White;
textBoxDesc.BackColor = Color.White;
textBoxFP.BackColor = Color.White;
textBoxUnit.BackColor = Color.White;
panel3.BackColor = Color.White;
}
if (salePercent > 0)
{
decimal finalPrice = originalPrice * (1 - (decimal)salePercent / 100);
textBoxPrice.Text = $"{originalPrice:N2}";
textBoxPrice.ForeColor = Color.Red;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Strikeout);
textBoxFP.Text = $"{finalPrice:N2}";
textBoxFP.ForeColor = Color.Black;
textBoxFP.Font = new Font(textBoxFP.Font, FontStyle.Regular);
}
else
{
textBoxPrice.Text = $"{originalPrice:N2}";
}
if (quantityInStock <= 0)
{
textBoxStock.BackColor = Color.LightBlue;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при обработке данных товара: " + ex.Message);
}
}
private void LoadSortOptions()
{
comboBoxSort.Items.Add("По умолчанию");
comboBoxSort.Items.Add("Название (А-Я)");
comboBoxSort.Items.Add("Название (Я-А)");
comboBoxSort.Items.Add("Цена (возрастающая)");
comboBoxSort.Items.Add("Цена (убывающая)");
comboBoxSort.SelectedIndex = 0;
}
private void comboBoxSort_SelectedIndexChanged(object sender, EventArgs e)
{
string sortOption = comboBoxSort.SelectedItem.ToString();
switch (sortOption)
{
case "По умолчанию":
bindingSource.Sort = "";
break;
case "Название (А-Я)":
bindingSource.Sort = "Название товара ASC";
break;
case "Название (Я-А)":
bindingSource.Sort = "Название товара DESC";
break;
case "Цена (возрастающая)":
bindingSource.Sort = "Цена ASC";
break;
case "Цена (убывающая)":
bindingSource.Sort = "Цена DESC";
break;
}
}
private void LoadFilterOptions()
{
comboBoxFilter.Items.Add("По умолчанию");
comboBoxFilter.Items.Add("Мужская обувь");
comboBoxFilter.Items.Add("Женская обувь");
comboBoxSort.SelectedIndex = 0;
}
private void comboBoxFilter_SelectedIndexChanged(object sender, EventArgs e)
{
string filterOption = comboBoxFilter.SelectedItem.ToString().Trim();
switch (filterOption)
{
case "По умолчанию":
bindingSource.Filter = "";
break;
case "Мужская обувь":
bindingSource.Filter = "[Категория] = 'Мужская обувь'";
break;
case "Женская обувь":
bindingSource.Filter = "[Категория] = 'Женская обувь'";
break;
default:
bindingSource.Filter = "";
break;
}
}
private void textBoxSearch_TextChanged(object sender, EventArgs e)
{
string searchText = textBoxSearch.Text.Trim();
if (string.IsNullOrEmpty(searchText))
{
bindingSource.Filter = "";
}
else
{
string s = searchText.Replace("'", "''");
string pattern = string.Format("%{0}%", s);
bindingSource.Filter = string.Format(
"[Артикул] LIKE '{0}' OR [Название товара] LIKE '{0}' OR [Поставщик] LIKE '{0}' OR [Производитель] LIKE '{0}' OR [Категория] LIKE '{0}' OR [Единица измерения] LIKE '{0}' OR " +
"Convert([Цена], 'System.String') LIKE '{0}' OR Convert([Скидка], 'System.String') LIKE '{0}' OR Convert([Количество на складе], 'System.String') LIKE '{0}'",
pattern);
}
}
private void AdmMainForm_Load(object sender, EventArgs e)
{
labelFIO.Text = LoginForm.ClientSurname + " " + LoginForm.ClientName + " " + LoginForm.ClientPatronymic;
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm log = new LoginForm();
log.Show();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
AddAdmProduct addProductForm = new AddAdmProduct();
DialogResult result = addProductForm.ShowDialog();
if (result == DialogResult.OK)
{
LoadProdData();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (DataGridViewProduct.SelectedRows.Count > 0)
{
string articleToEdit = Convert.ToString(DataGridViewProduct.SelectedRows[0].Cells["Артикул"].Value);
this.Hide();
AdmEditProduct editProductForm = new AdmEditProduct(articleToEdit);
DialogResult result = editProductForm.ShowDialog();
if (result == DialogResult.OK)
{
LoadProdData();
}
}
else
{
MessageBox.Show("Пожалуйста, выберите строку для редактирования.");
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (DataGridViewProduct.SelectedRows.Count > 0)
{
int rowIndex = DataGridViewProduct.SelectedRows[0].Index;
string idToDelete = Convert.ToString(DataGridViewProduct.SelectedRows[0].Cells["Артикул"].Value);
if (IsProductInOrders(idToDelete))
{
MessageBox.Show(
"Невозможно удалить товар, так как он участвует в существующих заказах.",
"Предупреждение",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
return; // Прекращаем выполнение, если товар найден в заказах
}
DialogResult result = MessageBox.Show(
"Вы действительно хотите удалить товар с артикулом '" + idToDelete + "'?",
"Подтверждение удаления",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question // Используем иконку вопроса
);
// Проверяем, нажал ли пользователь "Да"
if (result == DialogResult.Yes)
{
// Если пользователь подтвердил, вызываем метод удаления
DeleteData(idToDelete);
}
}
else
{
MessageBox.Show("Пожалуйста, выберите строку для удаления.");
}
}
private void DeleteData(string idToDelete)
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "DELETE FROM products WHERE article_product = @art";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@art", idToDelete);
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected > 0)
{
MessageBox.Show("Запись успешно удалена.");
LoadProdData();
}
else
{
MessageBox.Show("Не удалось удалить запись.");
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса удаления: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка при удалении: " + ex.Message);
}
}
private bool IsProductInOrders(string productArticle)
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
// Предполагаем, что в таблице orderitems столбец с артикулом товара называется 'product_article'
string query = "SELECT COUNT(*) FROM OrderItems WHERE product_article = @art";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@art", productArticle);
// ExecuteScalar возвращает первый столбец первой строки в результирующем наборе
// или null, если результирующий набор пуст.
// В нашем случае, COUNT(*) всегда вернет число.
long count = (long)command.ExecuteScalar();
return count > 0; // Если count > 0, значит товар участвует в заказах
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при проверке наличия товара в заказах: " + ex.Message, "Ошибка базы данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return true; // Возвращаем true, чтобы предотвратить удаление при ошибке, для безопасности
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка при проверке наличия товара в заказах: " + ex.Message, "Общая ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return true; // Возвращаем true, чтобы предотвратить удаление при ошибке, для безопасности
}
}
private void OrdersBtn_Click(object sender, EventArgs e)
{
this.Hide();
AdmOrder ao = new AdmOrder();
ao.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

120
AdmMainForm.resx Normal file
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>

160
AdmOrder.Designer.cs generated Normal file
View File

@ -0,0 +1,160 @@
namespace demMalyhin
{
partial class AdmOrder
{
/// <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.btnDelete = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.label2 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.SuspendLayout();
//
// btnDelete
//
this.btnDelete.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnDelete.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnDelete.Location = new System.Drawing.Point(501, 483);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(99, 39);
this.btnDelete.TabIndex = 25;
this.btnDelete.Text = "Удалить";
this.btnDelete.UseVisualStyleBackColor = false;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button2.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button2.Location = new System.Drawing.Point(354, 483);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(141, 39);
this.button2.TabIndex = 24;
this.button2.Text = "Редактировать";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.MediumSpringGreen;
this.button1.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button1.Location = new System.Drawing.Point(248, 483);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(99, 39);
this.button1.TabIndex = 23;
this.button1.Text = "Добавить";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.DataGridViewProduct.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(66, 52);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(691, 425);
this.DataGridViewProduct.TabIndex = 19;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Chartreuse;
this.label2.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(254, 4);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(301, 33);
this.label2.TabIndex = 17;
this.label2.Text = "Заказы администратора";
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(86, 483);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 16;
this.btnBack.Text = "Каталог";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(810, 12);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 26;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// AdmOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(846, 532);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnDelete);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnBack);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "AdmOrder";
this.Text = "AdmOrder";
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

175
AdmOrder.cs Normal file
View File

@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class AdmOrder : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public AdmOrder()
{
InitializeComponent();
LoadProdData();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_Orders AS `Идентификатор`, order_date AS `Дата заказа`, delivery_date AS `Дата доставки`, pickup_points.index AS `Почтовый индекс`, pickup_points.street AS `Улица`, pickup_points.city AS `Город`, pickup_points.house_number AS `Номер здания`, users.Surname AS `Фамилия клиента`, users.Name AS `Имя клиента`, users.Patronymic AS `Отчество`, Orders.code AS `Код заказа`, OrderStatus.status_name AS `Статус заказа` FROM Orders LEFT JOIN pickup_points ON Orders.pickup_point_id = pickup_points.idpickup_points JOIN users ON Orders.user_initials_id = users.id_users JOIN OrderStatus ON Orders.orderstatus_id = OrderStatus.id_OrderStatus";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
AdmAddOrder addProductForm = new AdmAddOrder();
DialogResult result = addProductForm.ShowDialog();
if (result == DialogResult.OK)
{
LoadProdData();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (DataGridViewProduct.SelectedRows.Count > 0)
{
string articleToEdit = Convert.ToString(DataGridViewProduct.SelectedRows[0].Cells["Идентификатор"].Value);
this.Close();
AdmEditOrder editProductForm = new AdmEditOrder(articleToEdit);
DialogResult result = editProductForm.ShowDialog();
if (result == DialogResult.OK)
{
LoadProdData();
}
}
else
{
MessageBox.Show("Пожалуйста, выберите строку для редактирования.");
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
AdmMainForm mainForm = new AdmMainForm();
mainForm.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (DataGridViewProduct.SelectedRows.Count > 0)
{
int rowIndex = DataGridViewProduct.SelectedRows[0].Index;
string idToDelete = Convert.ToString(DataGridViewProduct.SelectedRows[0].Cells["Идентификатор"].Value);
DialogResult result = MessageBox.Show(
"Вы действительно хотите удалить заказ с идентификатором '" + idToDelete + "'?",
"Подтверждение удаления",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question // Используем иконку вопроса
);
// Проверяем, нажал ли пользователь "Да"
if (result == DialogResult.Yes)
{
// Если пользователь подтвердил, вызываем метод удаления
DeleteData(idToDelete);
}
}
else
{
MessageBox.Show("Пожалуйста, выберите строку для удаления.");
}
}
private void DeleteData(string idToDelete)
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "DELETE FROM Orders WHERE id_Orders = @id";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@id", idToDelete);
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected > 0)
{
MessageBox.Show("Запись успешно удалена.");
LoadProdData();
}
else
{
MessageBox.Show("Не удалось удалить запись.");
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса удаления: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка при удалении: " + ex.Message);
}
}
}
}

120
AdmOrder.resx Normal file
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>

18
App.config Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

30
DB.cs Normal file
View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
internal class DB
{
MySqlConnection connection = new MySqlConnection("server=cfif31.ru;port=3306;username=ISPr25-21_MalykhinID;password=ISPr25-21_MalykhinID;database=ISPr25-21_MalykhinID_shoestore");
public void openConnection()
{
if (connection.State == System.Data.ConnectionState.Closed)
connection.Open();
}
public void closeConnection()
{
if (connection.State == System.Data.ConnectionState.Open)
connection.Close();
}
public MySqlConnection getConnection()
{
return connection;
}
}
}

406
GuestMainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,406 @@
namespace demMalyhin
{
partial class GuestMainForm
{
/// <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.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.SaleLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.textBoxFP = new System.Windows.Forms.TextBox();
this.textBoxStock = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxSup = new System.Windows.Forms.TextBox();
this.textBoxManuf = new System.Windows.Forms.TextBox();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.StockLabel = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.PriceLabel = new System.Windows.Forms.Label();
this.SupplierLabel = new System.Windows.Forms.Label();
this.ManufacturerLabel = new System.Windows.Forms.Label();
this.DescriptionLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.CategoryLabel = new System.Windows.Forms.Label();
this.pictureBoxPhoto = new System.Windows.Forms.PictureBox();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).BeginInit();
this.SuspendLayout();
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(52, 58);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(748, 223);
this.DataGridViewProduct.TabIndex = 8;
this.DataGridViewProduct.Click += new System.EventHandler(this.dataGridViewProd_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.pictureBoxPhoto);
this.panel1.Location = new System.Drawing.Point(34, 287);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(789, 218);
this.panel1.TabIndex = 7;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.SaleLabel);
this.panel3.Location = new System.Drawing.Point(623, 14);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(142, 189);
this.panel3.TabIndex = 2;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label4.Location = new System.Drawing.Point(29, 51);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(73, 28);
this.label4.TabIndex = 4;
this.label4.Text = "Действующая\r\nскидка";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// SaleLabel
//
this.SaleLabel.AutoSize = true;
this.SaleLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SaleLabel.Location = new System.Drawing.Point(53, 87);
this.SaleLabel.Name = "SaleLabel";
this.SaleLabel.Size = new System.Drawing.Size(0, 14);
this.SaleLabel.TabIndex = 2;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.textBoxFP);
this.panel2.Controls.Add(this.textBoxStock);
this.panel2.Controls.Add(this.textBoxUnit);
this.panel2.Controls.Add(this.textBoxPrice);
this.panel2.Controls.Add(this.textBoxSup);
this.panel2.Controls.Add(this.textBoxManuf);
this.panel2.Controls.Add(this.textBoxDesc);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.StockLabel);
this.panel2.Controls.Add(this.label9);
this.panel2.Controls.Add(this.PriceLabel);
this.panel2.Controls.Add(this.SupplierLabel);
this.panel2.Controls.Add(this.ManufacturerLabel);
this.panel2.Controls.Add(this.DescriptionLabel);
this.panel2.Controls.Add(this.NameLabel);
this.panel2.Controls.Add(this.CategoryLabel);
this.panel2.Location = new System.Drawing.Point(212, 14);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(395, 189);
this.panel2.TabIndex = 1;
//
// textBoxFP
//
this.textBoxFP.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxFP.Location = new System.Drawing.Point(247, 113);
this.textBoxFP.Name = "textBoxFP";
this.textBoxFP.ReadOnly = true;
this.textBoxFP.Size = new System.Drawing.Size(95, 20);
this.textBoxFP.TabIndex = 15;
//
// textBoxStock
//
this.textBoxStock.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxStock.Location = new System.Drawing.Point(148, 158);
this.textBoxStock.Name = "textBoxStock";
this.textBoxStock.ReadOnly = true;
this.textBoxStock.Size = new System.Drawing.Size(194, 20);
this.textBoxStock.TabIndex = 14;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxUnit.Location = new System.Drawing.Point(148, 135);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.ReadOnly = true;
this.textBoxUnit.Size = new System.Drawing.Size(194, 20);
this.textBoxUnit.TabIndex = 13;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxPrice.Location = new System.Drawing.Point(148, 113);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.ReadOnly = true;
this.textBoxPrice.Size = new System.Drawing.Size(95, 20);
this.textBoxPrice.TabIndex = 12;
//
// textBoxSup
//
this.textBoxSup.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxSup.Location = new System.Drawing.Point(148, 87);
this.textBoxSup.Name = "textBoxSup";
this.textBoxSup.ReadOnly = true;
this.textBoxSup.Size = new System.Drawing.Size(194, 20);
this.textBoxSup.TabIndex = 11;
//
// textBoxManuf
//
this.textBoxManuf.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxManuf.Location = new System.Drawing.Point(148, 64);
this.textBoxManuf.Name = "textBoxManuf";
this.textBoxManuf.ReadOnly = true;
this.textBoxManuf.Size = new System.Drawing.Size(194, 20);
this.textBoxManuf.TabIndex = 10;
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDesc.Location = new System.Drawing.Point(148, 41);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.ReadOnly = true;
this.textBoxDesc.Size = new System.Drawing.Size(194, 20);
this.textBoxDesc.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label3.Location = new System.Drawing.Point(131, 14);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(11, 15);
this.label3.TabIndex = 8;
this.label3.Text = "I";
//
// StockLabel
//
this.StockLabel.AutoSize = true;
this.StockLabel.BackColor = System.Drawing.Color.Chartreuse;
this.StockLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.StockLabel.Location = new System.Drawing.Point(14, 158);
this.StockLabel.Name = "StockLabel";
this.StockLabel.Size = new System.Drawing.Size(112, 14);
this.StockLabel.TabIndex = 7;
this.StockLabel.Text = "Количество на складе:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.Color.Chartreuse;
this.label9.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label9.Location = new System.Drawing.Point(21, 135);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(104, 14);
this.label9.TabIndex = 6;
this.label9.Text = "Единица измерения:";
//
// PriceLabel
//
this.PriceLabel.AutoSize = true;
this.PriceLabel.BackColor = System.Drawing.Color.Chartreuse;
this.PriceLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.PriceLabel.Location = new System.Drawing.Point(57, 113);
this.PriceLabel.Name = "PriceLabel";
this.PriceLabel.Size = new System.Drawing.Size(69, 14);
this.PriceLabel.TabIndex = 5;
this.PriceLabel.Text = "Цена товара:";
//
// SupplierLabel
//
this.SupplierLabel.AutoSize = true;
this.SupplierLabel.BackColor = System.Drawing.Color.Chartreuse;
this.SupplierLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SupplierLabel.Location = new System.Drawing.Point(63, 90);
this.SupplierLabel.Name = "SupplierLabel";
this.SupplierLabel.Size = new System.Drawing.Size(63, 14);
this.SupplierLabel.TabIndex = 4;
this.SupplierLabel.Text = "Поставщик:";
//
// ManufacturerLabel
//
this.ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.BackColor = System.Drawing.Color.Chartreuse;
this.ManufacturerLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ManufacturerLabel.Location = new System.Drawing.Point(44, 67);
this.ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.Size = new System.Drawing.Size(82, 14);
this.ManufacturerLabel.TabIndex = 3;
this.ManufacturerLabel.Text = "Производитель:";
//
// DescriptionLabel
//
this.DescriptionLabel.AutoSize = true;
this.DescriptionLabel.BackColor = System.Drawing.Color.Chartreuse;
this.DescriptionLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.DescriptionLabel.Location = new System.Drawing.Point(34, 44);
this.DescriptionLabel.Name = "DescriptionLabel";
this.DescriptionLabel.Size = new System.Drawing.Size(92, 14);
this.DescriptionLabel.TabIndex = 2;
this.DescriptionLabel.Text = "Описание товара:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.BackColor = System.Drawing.Color.Chartreuse;
this.NameLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.NameLabel.Location = new System.Drawing.Point(157, 16);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(112, 14);
this.NameLabel.TabIndex = 1;
this.NameLabel.Text = "Наименование товара";
//
// CategoryLabel
//
this.CategoryLabel.AutoSize = true;
this.CategoryLabel.BackColor = System.Drawing.Color.Chartreuse;
this.CategoryLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.CategoryLabel.Location = new System.Drawing.Point(19, 16);
this.CategoryLabel.Name = "CategoryLabel";
this.CategoryLabel.Size = new System.Drawing.Size(92, 14);
this.CategoryLabel.TabIndex = 0;
this.CategoryLabel.Text = "Категория товара";
//
// pictureBoxPhoto
//
this.pictureBoxPhoto.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxPhoto.Location = new System.Drawing.Point(17, 14);
this.pictureBoxPhoto.Name = "pictureBoxPhoto";
this.pictureBoxPhoto.Size = new System.Drawing.Size(174, 189);
this.pictureBoxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxPhoto.TabIndex = 0;
this.pictureBoxPhoto.TabStop = false;
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(382, 511);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 9;
this.btnBack.Text = "Главное меню";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(843, 2);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 10;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(318, 9);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(245, 33);
this.label11.TabIndex = 39;
this.label11.Text = "Каталог (гостевой)";
//
// GuestMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(870, 563);
this.Controls.Add(this.label11);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "GuestMainForm";
this.Text = "GuestMainForm";
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label SaleLabel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBoxFP;
private System.Windows.Forms.TextBox textBoxStock;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxSup;
private System.Windows.Forms.TextBox textBoxManuf;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label StockLabel;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label PriceLabel;
private System.Windows.Forms.Label SupplierLabel;
private System.Windows.Forms.Label ManufacturerLabel;
private System.Windows.Forms.Label DescriptionLabel;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Label CategoryLabel;
private System.Windows.Forms.PictureBox pictureBoxPhoto;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label label11;
}
}

188
GuestMainForm.cs Normal file
View File

@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class GuestMainForm : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public GuestMainForm()
{
InitializeComponent();
LoadProdData();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT article_product AS `Артикул`, product_name AS `Название товара`, price AS `Цена`, supplier_name AS `Поставщик`, Manufacturer_name AS `Производитель`, Category_name AS `Категория`, sale_percent AS `Скидка`, unit_type AS `Единица измерения`, description AS `описание`, quantity_in_stock AS `Количество на складе`, photo AS `фото` FROM products LEFT JOIN Category ON products.category_id = Category.id_Category JOIN Supplier ON products.supplier_id = Supplier.id_Supplier JOIN Manufacturer ON products.manufacturer_id = Manufacturer.id_Manufacturer";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void dataGridViewProd_Click(object sender, EventArgs e)
{
textBoxDesc.Text = DataGridViewProduct.CurrentRow.Cells[8].Value.ToString();
textBoxManuf.Text = DataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
textBoxSup.Text = DataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
textBoxPrice.Text = DataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
textBoxUnit.Text = DataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
textBoxStock.Text = DataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
NameLabel.Text = DataGridViewProduct.CurrentRow.Cells[1].Value.ToString();
CategoryLabel.Text = DataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
SaleLabel.Text = DataGridViewProduct.CurrentRow.Cells[6].Value.ToString() + "%";
try
{
object photoData = DataGridViewProduct.CurrentRow.Cells[10].Value;
if (photoData != DBNull.Value)
{
byte[] imageData = (byte[])photoData;
if (imageData != null && imageData.Length > 0)
{
using (MemoryStream ms = new MemoryStream(imageData))
{
pictureBoxPhoto.Image = Image.FromStream(ms);
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message);
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
try
{
var currentRow = DataGridViewProduct.CurrentRow;
if (currentRow == null) return;
Color defaultColor = SystemColors.Window;
textBoxPrice.BackColor = defaultColor;
textBoxSup.BackColor = defaultColor;
textBoxManuf.BackColor = defaultColor;
textBoxStock.BackColor = defaultColor;
textBoxPrice.ForeColor = Color.Black;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Regular);
textBoxFP.Text = "";
decimal originalPrice = 0m;
int salePercent = 0;
int quantityInStock = 0;
decimal.TryParse(currentRow.Cells[2].Value?.ToString(), out originalPrice);
int.TryParse(currentRow.Cells[6].Value?.ToString(), out salePercent);
int.TryParse(currentRow.Cells[9].Value?.ToString(), out quantityInStock);
if (salePercent > 15)
{
Color highDiscountColor = ColorTranslator.FromHtml("#2E8B57");
textBoxPrice.BackColor = highDiscountColor;
textBoxSup.BackColor = highDiscountColor;
textBoxManuf.BackColor = highDiscountColor;
textBoxStock.BackColor = highDiscountColor;
textBoxDesc.BackColor = highDiscountColor;
textBoxFP.BackColor = highDiscountColor;
textBoxUnit.BackColor = highDiscountColor;
panel3.BackColor = highDiscountColor;
}
else
{
textBoxPrice.BackColor = Color.White;
textBoxSup.BackColor = Color.White;
textBoxManuf.BackColor = Color.White;
textBoxStock.BackColor = Color.White;
textBoxDesc.BackColor = Color.White;
textBoxFP.BackColor = Color.White;
textBoxUnit.BackColor = Color.White;
panel3.BackColor = Color.White;
}
if (salePercent > 0)
{
decimal finalPrice = originalPrice * (1 - (decimal)salePercent / 100);
textBoxPrice.Text = $"{originalPrice:N2}";
textBoxPrice.ForeColor = Color.Red;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Strikeout);
textBoxFP.Text = $"{finalPrice:N2}";
textBoxFP.ForeColor = Color.Black;
textBoxFP.Font = new Font(textBoxFP.Font, FontStyle.Regular);
}
else
{
textBoxPrice.Text = $"{originalPrice:N2}";
}
if (quantityInStock <= 0)
{
textBoxStock.BackColor = Color.LightBlue;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при обработке данных товара: " + ex.Message);
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm log = new LoginForm();
log.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

120
GuestMainForm.resx Normal file
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>

BIN
Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

171
LoginForm.Designer.cs generated Normal file
View File

@ -0,0 +1,171 @@
namespace demMalyhin
{
partial class LoginForm
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginForm));
this.ButtonLogin = new System.Windows.Forms.Button();
this.loginField = new System.Windows.Forms.TextBox();
this.passField = new System.Windows.Forms.TextBox();
this.checkBoxPass = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label2 = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// ButtonLogin
//
this.ButtonLogin.BackColor = System.Drawing.Color.MediumSpringGreen;
this.ButtonLogin.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ButtonLogin.ForeColor = System.Drawing.Color.Black;
this.ButtonLogin.Location = new System.Drawing.Point(121, 364);
this.ButtonLogin.Name = "ButtonLogin";
this.ButtonLogin.Size = new System.Drawing.Size(119, 55);
this.ButtonLogin.TabIndex = 0;
this.ButtonLogin.Text = "Авторизоваться";
this.ButtonLogin.UseVisualStyleBackColor = false;
this.ButtonLogin.Click += new System.EventHandler(this.ButtonLogin_Click);
//
// loginField
//
this.loginField.BackColor = System.Drawing.Color.Chartreuse;
this.loginField.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.loginField.Location = new System.Drawing.Point(109, 176);
this.loginField.Name = "loginField";
this.loginField.Size = new System.Drawing.Size(144, 22);
this.loginField.TabIndex = 1;
//
// passField
//
this.passField.BackColor = System.Drawing.Color.Chartreuse;
this.passField.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.passField.Location = new System.Drawing.Point(109, 236);
this.passField.Name = "passField";
this.passField.Size = new System.Drawing.Size(144, 22);
this.passField.TabIndex = 2;
this.passField.UseSystemPasswordChar = true;
//
// checkBoxPass
//
this.checkBoxPass.AutoSize = true;
this.checkBoxPass.BackColor = System.Drawing.Color.Chartreuse;
this.checkBoxPass.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.checkBoxPass.Location = new System.Drawing.Point(122, 294);
this.checkBoxPass.Name = "checkBoxPass";
this.checkBoxPass.Size = new System.Drawing.Size(118, 19);
this.checkBoxPass.TabIndex = 3;
this.checkBoxPass.Text = "Показать пароль";
this.checkBoxPass.UseVisualStyleBackColor = false;
this.checkBoxPass.CheckedChanged += new System.EventHandler(this.checkBoxPass_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.MediumSpringGreen;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.ForeColor = System.Drawing.Color.Black;
this.label1.Location = new System.Drawing.Point(134, 346);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 15);
this.label1.TabIndex = 4;
this.label1.Text = "Войти как гость";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// pictureBox1
//
this.pictureBox1.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.InitialImage")));
this.pictureBox1.Location = new System.Drawing.Point(132, 96);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(108, 74);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Chartreuse;
this.label2.Font = new System.Drawing.Font("Times New Roman", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(91, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(190, 36);
this.label2.TabIndex = 6;
this.label2.Text = "Авторизация";
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(333, 3);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 8;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// LoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(359, 451);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.label2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.checkBoxPass);
this.Controls.Add(this.passField);
this.Controls.Add(this.loginField);
this.Controls.Add(this.ButtonLogin);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "LoginForm";
this.Text = "Form1";
this.Load += new System.EventHandler(this.LoginForm_Load);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBox_KeyPress_NoSpaces);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button ButtonLogin;
private System.Windows.Forms.TextBox loginField;
private System.Windows.Forms.TextBox passField;
private System.Windows.Forms.CheckBox checkBoxPass;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnExit;
}
}

173
LoginForm.cs Normal file
View File

@ -0,0 +1,173 @@
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using System.Diagnostics.Eventing.Reader;
namespace demMalyhin
{
public partial class LoginForm : Form
{
public static string ClientSurname { get; private set; }
public static string ClientName { get; private set; }
public static string ClientPatronymic { get; private set; }
public LoginForm()
{
InitializeComponent();
loginField.KeyPress += TextBox_KeyPress_NoSpaces;
passField.KeyPress += TextBox_KeyPress_NoSpaces;
}
private void TextBox_KeyPress_NoSpaces(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == ' ')
{
e.Handled = true;
}
}
private void label2_Click(object sender, EventArgs e)
{
}
private void ButtonLogin_Click(object sender, EventArgs e)
{
string loginUser = loginField.Text;
string passUser = passField.Text;
if (string.IsNullOrWhiteSpace(loginField.Text))
{
MessageBox.Show("Введите логин.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrWhiteSpace(passField.Text))
{
MessageBox.Show("Введите пароль.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
DataTable table = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand("SELECT RoleID, login, Surname, Name, Patronymic FROM users WHERE login = @uL AND password = @uP", connection);
command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = loginUser;
command.Parameters.Add("@uP", MySqlDbType.VarChar).Value = passUser;
adapter.SelectCommand = command;
try
{
connection.Open();
adapter.Fill(table);
if (table.Rows.Count == 1)
{
string roleID = table.Rows[0]["RoleID"].ToString();
string userLogin = table.Rows[0]["login"].ToString();
ClientSurname = Convert.ToString(table.Rows[0]["Surname"]);
ClientName = Convert.ToString(table.Rows[0]["Name"]);
ClientPatronymic = Convert.ToString(table.Rows[0]["Patronymic"]);
switch (roleID)
{
case "1":
MessageBox.Show("Вы авторизовались под ролью: Admin. Ваше фио: " + ClientSurname + " " + ClientName + " " + ClientPatronymic);
this.Hide();
AdmMainForm adm = new AdmMainForm();
adm.Show();
break;
case "2":
MessageBox.Show("Авторизация успешна, добро пожаловать! Вы авторизовались под ролью: Manager");
this.Hide();
ManagerMainForm usManager = new ManagerMainForm();
usManager.Show();
break;
case "3":
MessageBox.Show("Авторизация успешна, добро пожаловать! Вы авторизовались под ролью: Authorized Client");
this.Hide();
UserMainForm usClient = new UserMainForm();
usClient.Show();
break;
}
}
else
{
MessageBox.Show("Введен неверный логин или пароль", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка подключения к базе данных или выполнения запроса: " + ex.Message, "Ошибка БД", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
db.closeConnection();
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void regLabel_Click(object sender, EventArgs e)
{
this.Hide();
ManagerMainForm regForm = new ManagerMainForm();
regForm.Show();
}
private void closeBtn_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void checkBoxPass_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxPass.Checked)
{
passField.UseSystemPasswordChar = false;
}
else
{
passField.UseSystemPasswordChar = true;
}
}
private void label1_Click(object sender, EventArgs e)
{
this.Hide();
GuestMainForm guest = new GuestMainForm();
guest.Show();
}
private void LoginForm_Load(object sender, EventArgs e)
{
pictureBox1.Image = Properties.Resources.Icon1;
}
}
}

2192
LoginForm.resx Normal file

File diff suppressed because it is too large Load Diff

486
ManagerMainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,486 @@
namespace demMalyhin
{
partial class ManagerMainForm
{
/// <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.btnExit = new System.Windows.Forms.Button();
this.OrdersBtn = new System.Windows.Forms.Button();
this.comboBoxFilter = new System.Windows.Forms.ComboBox();
this.comboBoxSort = new System.Windows.Forms.ComboBox();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.SaleLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.textBoxFP = new System.Windows.Forms.TextBox();
this.textBoxStock = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxSup = new System.Windows.Forms.TextBox();
this.textBoxManuf = new System.Windows.Forms.TextBox();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.StockLabel = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.PriceLabel = new System.Windows.Forms.Label();
this.SupplierLabel = new System.Windows.Forms.Label();
this.ManufacturerLabel = new System.Windows.Forms.Label();
this.DescriptionLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.CategoryLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.labelFIO = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pictureBoxPhoto = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).BeginInit();
this.SuspendLayout();
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(12, 7);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 28;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// OrdersBtn
//
this.OrdersBtn.BackColor = System.Drawing.Color.MediumSpringGreen;
this.OrdersBtn.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.OrdersBtn.Location = new System.Drawing.Point(720, 540);
this.OrdersBtn.Name = "OrdersBtn";
this.OrdersBtn.Size = new System.Drawing.Size(99, 39);
this.OrdersBtn.TabIndex = 27;
this.OrdersBtn.Text = "Заказы";
this.OrdersBtn.UseVisualStyleBackColor = false;
this.OrdersBtn.Click += new System.EventHandler(this.OrdersBtn_Click);
//
// comboBoxFilter
//
this.comboBoxFilter.BackColor = System.Drawing.Color.MediumSpringGreen;
this.comboBoxFilter.FormattingEnabled = true;
this.comboBoxFilter.Location = new System.Drawing.Point(659, 61);
this.comboBoxFilter.Name = "comboBoxFilter";
this.comboBoxFilter.Size = new System.Drawing.Size(160, 21);
this.comboBoxFilter.TabIndex = 23;
this.comboBoxFilter.SelectedIndexChanged += new System.EventHandler(this.comboBoxFilter_SelectedIndexChanged);
//
// comboBoxSort
//
this.comboBoxSort.BackColor = System.Drawing.Color.MediumSpringGreen;
this.comboBoxSort.FormattingEnabled = true;
this.comboBoxSort.Location = new System.Drawing.Point(491, 61);
this.comboBoxSort.Name = "comboBoxSort";
this.comboBoxSort.Size = new System.Drawing.Size(160, 21);
this.comboBoxSort.TabIndex = 22;
this.comboBoxSort.SelectedIndexChanged += new System.EventHandler(this.comboBoxSort_SelectedIndexChanged);
//
// textBoxSearch
//
this.textBoxSearch.BackColor = System.Drawing.Color.MediumSpringGreen;
this.textBoxSearch.Location = new System.Drawing.Point(30, 61);
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.Size = new System.Drawing.Size(455, 20);
this.textBoxSearch.TabIndex = 21;
this.textBoxSearch.TextChanged += new System.EventHandler(this.textBoxSearch_TextChanged);
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(72, 87);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(691, 223);
this.DataGridViewProduct.TabIndex = 20;
this.DataGridViewProduct.Click += new System.EventHandler(this.dataGridViewProd_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.pictureBoxPhoto);
this.panel1.Location = new System.Drawing.Point(30, 316);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(789, 218);
this.panel1.TabIndex = 19;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.SaleLabel);
this.panel3.Location = new System.Drawing.Point(623, 14);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(142, 189);
this.panel3.TabIndex = 2;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label4.Location = new System.Drawing.Point(29, 51);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(73, 28);
this.label4.TabIndex = 4;
this.label4.Text = "Действующая\r\nскидка";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// SaleLabel
//
this.SaleLabel.AutoSize = true;
this.SaleLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SaleLabel.Location = new System.Drawing.Point(53, 87);
this.SaleLabel.Name = "SaleLabel";
this.SaleLabel.Size = new System.Drawing.Size(0, 14);
this.SaleLabel.TabIndex = 2;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.textBoxFP);
this.panel2.Controls.Add(this.textBoxStock);
this.panel2.Controls.Add(this.textBoxUnit);
this.panel2.Controls.Add(this.textBoxPrice);
this.panel2.Controls.Add(this.textBoxSup);
this.panel2.Controls.Add(this.textBoxManuf);
this.panel2.Controls.Add(this.textBoxDesc);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.StockLabel);
this.panel2.Controls.Add(this.label9);
this.panel2.Controls.Add(this.PriceLabel);
this.panel2.Controls.Add(this.SupplierLabel);
this.panel2.Controls.Add(this.ManufacturerLabel);
this.panel2.Controls.Add(this.DescriptionLabel);
this.panel2.Controls.Add(this.NameLabel);
this.panel2.Controls.Add(this.CategoryLabel);
this.panel2.Location = new System.Drawing.Point(212, 14);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(395, 189);
this.panel2.TabIndex = 1;
//
// textBoxFP
//
this.textBoxFP.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxFP.Location = new System.Drawing.Point(247, 113);
this.textBoxFP.Name = "textBoxFP";
this.textBoxFP.ReadOnly = true;
this.textBoxFP.Size = new System.Drawing.Size(95, 20);
this.textBoxFP.TabIndex = 15;
//
// textBoxStock
//
this.textBoxStock.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxStock.Location = new System.Drawing.Point(148, 158);
this.textBoxStock.Name = "textBoxStock";
this.textBoxStock.ReadOnly = true;
this.textBoxStock.Size = new System.Drawing.Size(194, 20);
this.textBoxStock.TabIndex = 14;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxUnit.Location = new System.Drawing.Point(148, 135);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.ReadOnly = true;
this.textBoxUnit.Size = new System.Drawing.Size(194, 20);
this.textBoxUnit.TabIndex = 13;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxPrice.Location = new System.Drawing.Point(148, 113);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.ReadOnly = true;
this.textBoxPrice.Size = new System.Drawing.Size(95, 20);
this.textBoxPrice.TabIndex = 12;
//
// textBoxSup
//
this.textBoxSup.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxSup.Location = new System.Drawing.Point(148, 87);
this.textBoxSup.Name = "textBoxSup";
this.textBoxSup.ReadOnly = true;
this.textBoxSup.Size = new System.Drawing.Size(194, 20);
this.textBoxSup.TabIndex = 11;
//
// textBoxManuf
//
this.textBoxManuf.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxManuf.Location = new System.Drawing.Point(148, 64);
this.textBoxManuf.Name = "textBoxManuf";
this.textBoxManuf.ReadOnly = true;
this.textBoxManuf.Size = new System.Drawing.Size(194, 20);
this.textBoxManuf.TabIndex = 10;
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDesc.Location = new System.Drawing.Point(148, 41);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.ReadOnly = true;
this.textBoxDesc.Size = new System.Drawing.Size(194, 20);
this.textBoxDesc.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label3.Location = new System.Drawing.Point(131, 14);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(11, 15);
this.label3.TabIndex = 8;
this.label3.Text = "I";
//
// StockLabel
//
this.StockLabel.AutoSize = true;
this.StockLabel.BackColor = System.Drawing.Color.Chartreuse;
this.StockLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.StockLabel.Location = new System.Drawing.Point(14, 158);
this.StockLabel.Name = "StockLabel";
this.StockLabel.Size = new System.Drawing.Size(112, 14);
this.StockLabel.TabIndex = 7;
this.StockLabel.Text = "Количество на складе:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.Color.Chartreuse;
this.label9.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label9.Location = new System.Drawing.Point(21, 135);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(104, 14);
this.label9.TabIndex = 6;
this.label9.Text = "Единица измерения:";
//
// PriceLabel
//
this.PriceLabel.AutoSize = true;
this.PriceLabel.BackColor = System.Drawing.Color.Chartreuse;
this.PriceLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.PriceLabel.Location = new System.Drawing.Point(57, 113);
this.PriceLabel.Name = "PriceLabel";
this.PriceLabel.Size = new System.Drawing.Size(69, 14);
this.PriceLabel.TabIndex = 5;
this.PriceLabel.Text = "Цена товара:";
//
// SupplierLabel
//
this.SupplierLabel.AutoSize = true;
this.SupplierLabel.BackColor = System.Drawing.Color.Chartreuse;
this.SupplierLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SupplierLabel.Location = new System.Drawing.Point(63, 90);
this.SupplierLabel.Name = "SupplierLabel";
this.SupplierLabel.Size = new System.Drawing.Size(63, 14);
this.SupplierLabel.TabIndex = 4;
this.SupplierLabel.Text = "Поставщик:";
//
// ManufacturerLabel
//
this.ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.BackColor = System.Drawing.Color.Chartreuse;
this.ManufacturerLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ManufacturerLabel.Location = new System.Drawing.Point(44, 67);
this.ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.Size = new System.Drawing.Size(82, 14);
this.ManufacturerLabel.TabIndex = 3;
this.ManufacturerLabel.Text = "Производитель:";
//
// DescriptionLabel
//
this.DescriptionLabel.AutoSize = true;
this.DescriptionLabel.BackColor = System.Drawing.Color.Chartreuse;
this.DescriptionLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.DescriptionLabel.Location = new System.Drawing.Point(34, 44);
this.DescriptionLabel.Name = "DescriptionLabel";
this.DescriptionLabel.Size = new System.Drawing.Size(92, 14);
this.DescriptionLabel.TabIndex = 2;
this.DescriptionLabel.Text = "Описание товара:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.BackColor = System.Drawing.Color.Chartreuse;
this.NameLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.NameLabel.Location = new System.Drawing.Point(157, 16);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(112, 14);
this.NameLabel.TabIndex = 1;
this.NameLabel.Text = "Наименование товара";
//
// CategoryLabel
//
this.CategoryLabel.AutoSize = true;
this.CategoryLabel.BackColor = System.Drawing.Color.Chartreuse;
this.CategoryLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.CategoryLabel.Location = new System.Drawing.Point(19, 16);
this.CategoryLabel.Name = "CategoryLabel";
this.CategoryLabel.Size = new System.Drawing.Size(92, 14);
this.CategoryLabel.TabIndex = 0;
this.CategoryLabel.Text = "Категория товара";
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Chartreuse;
this.label2.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(275, 11);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(251, 33);
this.label2.TabIndex = 18;
this.label2.Text = "Каталог менеджера";
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(30, 540);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 17;
this.btnBack.Text = "Главное меню";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// labelFIO
//
this.labelFIO.AutoSize = true;
this.labelFIO.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.labelFIO.Location = new System.Drawing.Point(651, 11);
this.labelFIO.Name = "labelFIO";
this.labelFIO.Size = new System.Drawing.Size(0, 15);
this.labelFIO.TabIndex = 16;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Chartreuse;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(561, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(90, 15);
this.label1.TabIndex = 15;
this.label1.Text = "ФИО Клиента -";
//
// pictureBoxPhoto
//
this.pictureBoxPhoto.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxPhoto.Location = new System.Drawing.Point(17, 14);
this.pictureBoxPhoto.Name = "pictureBoxPhoto";
this.pictureBoxPhoto.Size = new System.Drawing.Size(174, 189);
this.pictureBoxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxPhoto.TabIndex = 0;
this.pictureBoxPhoto.TabStop = false;
//
// ManagerMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(847, 589);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.OrdersBtn);
this.Controls.Add(this.comboBoxFilter);
this.Controls.Add(this.comboBoxSort);
this.Controls.Add(this.textBoxSearch);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.labelFIO);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "ManagerMainForm";
this.Text = "RegForm";
this.Load += new System.EventHandler(this.ManagerMainForm_Load);
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button OrdersBtn;
private System.Windows.Forms.ComboBox comboBoxFilter;
private System.Windows.Forms.ComboBox comboBoxSort;
private System.Windows.Forms.TextBox textBoxSearch;
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label SaleLabel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBoxFP;
private System.Windows.Forms.TextBox textBoxStock;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxSup;
private System.Windows.Forms.TextBox textBoxManuf;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label StockLabel;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label PriceLabel;
private System.Windows.Forms.Label SupplierLabel;
private System.Windows.Forms.Label ManufacturerLabel;
private System.Windows.Forms.Label DescriptionLabel;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Label CategoryLabel;
private System.Windows.Forms.PictureBox pictureBoxPhoto;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Label labelFIO;
private System.Windows.Forms.Label label1;
}
}

296
ManagerMainForm.cs Normal file
View File

@ -0,0 +1,296 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class ManagerMainForm : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public ManagerMainForm()
{
InitializeComponent();
LoadProdData();
LoadSortOptions();
LoadFilterOptions();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT article_product AS `Артикул`, product_name AS `Название товара`, price AS `Цена`, supplier_name AS `Поставщик`, Manufacturer_name AS `Производитель`, Category_name AS `Категория`, sale_percent AS `Скидка`, unit_type AS `Единица измерения`, description AS `описание`, quantity_in_stock AS `Количество на складе`, photo AS `фото` FROM products LEFT JOIN Category ON products.category_id = Category.id_Category JOIN Supplier ON products.supplier_id = Supplier.id_Supplier JOIN Manufacturer ON products.manufacturer_id = Manufacturer.id_Manufacturer";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void dataGridViewProd_Click(object sender, EventArgs e)
{
textBoxDesc.Text = DataGridViewProduct.CurrentRow.Cells[8].Value.ToString();
textBoxManuf.Text = DataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
textBoxSup.Text = DataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
textBoxPrice.Text = DataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
textBoxUnit.Text = DataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
textBoxStock.Text = DataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
NameLabel.Text = DataGridViewProduct.CurrentRow.Cells[1].Value.ToString();
CategoryLabel.Text = DataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
SaleLabel.Text = DataGridViewProduct.CurrentRow.Cells[6].Value.ToString() + "%";
try
{
object photoData = DataGridViewProduct.CurrentRow.Cells[10].Value;
if (photoData != DBNull.Value)
{
byte[] imageData = (byte[])photoData;
if (imageData != null && imageData.Length > 0)
{
using (MemoryStream ms = new MemoryStream(imageData))
{
pictureBoxPhoto.Image = Image.FromStream(ms);
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message);
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
try
{
var currentRow = DataGridViewProduct.CurrentRow;
if (currentRow == null) return;
Color defaultColor = SystemColors.Window;
textBoxPrice.BackColor = defaultColor;
textBoxSup.BackColor = defaultColor;
textBoxManuf.BackColor = defaultColor;
textBoxStock.BackColor = defaultColor;
textBoxPrice.ForeColor = Color.Black;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Regular);
textBoxFP.Text = "";
decimal originalPrice = 0m;
int salePercent = 0;
int quantityInStock = 0;
decimal.TryParse(currentRow.Cells[2].Value?.ToString(), out originalPrice);
int.TryParse(currentRow.Cells[6].Value?.ToString(), out salePercent);
int.TryParse(currentRow.Cells[9].Value?.ToString(), out quantityInStock);
if (salePercent > 15)
{
Color highDiscountColor = ColorTranslator.FromHtml("#2E8B57");
textBoxPrice.BackColor = highDiscountColor;
textBoxSup.BackColor = highDiscountColor;
textBoxManuf.BackColor = highDiscountColor;
textBoxStock.BackColor = highDiscountColor;
textBoxDesc.BackColor = highDiscountColor;
textBoxFP.BackColor = highDiscountColor;
textBoxUnit.BackColor = highDiscountColor;
panel3.BackColor = highDiscountColor;
}
else
{
textBoxPrice.BackColor = Color.White;
textBoxSup.BackColor = Color.White;
textBoxManuf.BackColor = Color.White;
textBoxStock.BackColor = Color.White;
textBoxDesc.BackColor = Color.White;
textBoxFP.BackColor = Color.White;
textBoxUnit.BackColor = Color.White;
panel3.BackColor = Color.White;
}
if (salePercent > 0)
{
decimal finalPrice = originalPrice * (1 - (decimal)salePercent / 100);
textBoxPrice.Text = $"{originalPrice:N2}";
textBoxPrice.ForeColor = Color.Red;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Strikeout);
textBoxFP.Text = $"{finalPrice:N2}";
textBoxFP.ForeColor = Color.Black;
textBoxFP.Font = new Font(textBoxFP.Font, FontStyle.Regular);
}
else
{
textBoxPrice.Text = $"{originalPrice:N2}";
}
if (quantityInStock <= 0)
{
textBoxStock.BackColor = Color.LightBlue;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при обработке данных товара: " + ex.Message);
}
}
private void LoadSortOptions()
{
comboBoxSort.Items.Add("По умолчанию");
comboBoxSort.Items.Add("Название (А-Я)");
comboBoxSort.Items.Add("Название (Я-А)");
comboBoxSort.Items.Add("Цена (возрастающая)");
comboBoxSort.Items.Add("Цена (убывающая)");
comboBoxSort.SelectedIndex = 0;
}
private void comboBoxSort_SelectedIndexChanged(object sender, EventArgs e)
{
string sortOption = comboBoxSort.SelectedItem.ToString();
switch (sortOption)
{
case "По умолчанию":
bindingSource.Sort = "";
break;
case "Название (А-Я)":
bindingSource.Sort = "Название товара ASC";
break;
case "Название (Я-А)":
bindingSource.Sort = "Название товара DESC";
break;
case "Цена (возрастающая)":
bindingSource.Sort = "Цена ASC";
break;
case "Цена (убывающая)":
bindingSource.Sort = "Цена DESC";
break;
}
}
private void LoadFilterOptions()
{
comboBoxFilter.Items.Add("По умолчанию");
comboBoxFilter.Items.Add("Мужская обувь");
comboBoxFilter.Items.Add("Женская обувь");
comboBoxSort.SelectedIndex = 0;
}
private void comboBoxFilter_SelectedIndexChanged(object sender, EventArgs e)
{
string filterOption = comboBoxFilter.SelectedItem.ToString().Trim();
switch (filterOption)
{
case "По умолчанию":
bindingSource.Filter = "";
break;
case "Мужская обувь":
bindingSource.Filter = "[Категория] = 'Мужская обувь'";
break;
case "Женская обувь":
bindingSource.Filter = "[Категория] = 'Женская обувь'";
break;
default:
bindingSource.Filter = "";
break;
}
}
private void textBoxSearch_TextChanged(object sender, EventArgs e)
{
string searchText = textBoxSearch.Text.Trim();
if (string.IsNullOrEmpty(searchText))
{
bindingSource.Filter = "";
}
else
{
string s = searchText.Replace("'", "''");
string pattern = string.Format("%{0}%", s);
bindingSource.Filter = string.Format(
"[Артикул] LIKE '{0}' OR [Название товара] LIKE '{0}' OR [Поставщик] LIKE '{0}' OR [Производитель] LIKE '{0}' OR [Категория] LIKE '{0}' OR [Единица измерения] LIKE '{0}' OR " +
"Convert([Цена], 'System.String') LIKE '{0}' OR Convert([Скидка], 'System.String') LIKE '{0}' OR Convert([Количество на складе], 'System.String') LIKE '{0}'",
pattern);
}
}
private void AdmMainForm_Load(object sender, EventArgs e)
{
labelFIO.Text = LoginForm.ClientSurname + " " + LoginForm.ClientName + " " + LoginForm.ClientPatronymic;
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm log = new LoginForm();
log.Show();
}
private void OrdersBtn_Click(object sender, EventArgs e)
{
this.Hide();
ManagerOrder mo = new ManagerOrder();
mo.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void ManagerMainForm_Load(object sender, EventArgs e)
{
labelFIO.Text = LoginForm.ClientSurname + " " + LoginForm.ClientName + " " + LoginForm.ClientPatronymic;
}
}
}

120
ManagerMainForm.resx Normal file
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>

116
ManagerOrder.Designer.cs generated Normal file
View File

@ -0,0 +1,116 @@
namespace demMalyhin
{
partial class ManagerOrder
{
/// <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.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.label2 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.SuspendLayout();
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.DataGridViewProduct.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(91, 58);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(691, 402);
this.DataGridViewProduct.TabIndex = 21;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Chartreuse;
this.label2.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(319, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(247, 33);
this.label2.TabIndex = 20;
this.label2.Text = "Заказы (менеджер)";
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(380, 470);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 22;
this.btnBack.Text = "Каталог";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(846, 9);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 29;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// ManagerOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(873, 521);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.label2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "ManagerOrder";
this.Text = "ManagerOrder";
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnExit;
}
}

70
ManagerOrder.cs Normal file
View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class ManagerOrder : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public ManagerOrder()
{
InitializeComponent();
LoadProdData();
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
ManagerMainForm mainForm = new ManagerMainForm();
mainForm.Show();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT id_Orders AS `Идентификатор`, order_date AS `Дата заказа`, delivery_date AS `Дата доставки`, pickup_points.index AS `Почтовый индекс`, pickup_points.street AS `Улица`, pickup_points.city AS `Город`, pickup_points.house_number AS `Номер здания`, users.Surname AS `Фамилия клиента`, users.Name AS `Имя клиента`, users.Patronymic AS `Отчество`, Orders.code AS `Код заказа`, OrderStatus.status_name AS `Статус заказа` FROM Orders LEFT JOIN pickup_points ON Orders.pickup_point_id = pickup_points.idpickup_points JOIN users ON Orders.user_initials_id = users.id_users JOIN OrderStatus ON Orders.orderstatus_id = OrderStatus.id_OrderStatus";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

120
ManagerOrder.resx Normal file
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>

22
Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace demMalyhin
{
internal static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LoginForm());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанных со сборкой.
[assembly: AssemblyTitle("demMalyhin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("demMalyhin")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("63e7ffbe-5f99-4f82-b33a-22851eedf6d9")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

103
Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace demMalyhin.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()]
public 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)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demMalyhin.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap Icon {
get {
object obj = ResourceManager.GetObject("Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap Icon1 {
get {
object obj = ResourceManager.GetObject("Icon1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap picture {
get {
object obj = ResourceManager.GetObject("picture", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap picture1 {
get {
object obj = ResourceManager.GetObject("picture1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

133
Properties/Resources.resx Normal file
View File

@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Icon1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="picture" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="picture1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

30
Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace demMalyhin.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

BIN
Resources/Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
Resources/picture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

433
UserMainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,433 @@
namespace demMalyhin
{
partial class UserMainForm
{
/// <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.label11 = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.btnBack = new System.Windows.Forms.Button();
this.DataGridViewProduct = new System.Windows.Forms.DataGridView();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.SaleLabel = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.textBoxFP = new System.Windows.Forms.TextBox();
this.textBoxStock = new System.Windows.Forms.TextBox();
this.textBoxUnit = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.textBoxSup = new System.Windows.Forms.TextBox();
this.textBoxManuf = new System.Windows.Forms.TextBox();
this.textBoxDesc = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.StockLabel = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.PriceLabel = new System.Windows.Forms.Label();
this.SupplierLabel = new System.Windows.Forms.Label();
this.ManufacturerLabel = new System.Windows.Forms.Label();
this.DescriptionLabel = new System.Windows.Forms.Label();
this.NameLabel = new System.Windows.Forms.Label();
this.CategoryLabel = new System.Windows.Forms.Label();
this.pictureBoxPhoto = new System.Windows.Forms.PictureBox();
this.labelFIO = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).BeginInit();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).BeginInit();
this.SuspendLayout();
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Chartreuse;
this.label11.Font = new System.Drawing.Font("Times New Roman", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label11.Location = new System.Drawing.Point(311, 9);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(277, 33);
this.label11.TabIndex = 44;
this.label11.Text = "Каталог пользователя";
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(12, 9);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(24, 23);
this.btnExit.TabIndex = 43;
this.btnExit.Text = "X";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnBack
//
this.btnBack.BackColor = System.Drawing.Color.MediumSpringGreen;
this.btnBack.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnBack.Location = new System.Drawing.Point(404, 527);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(99, 39);
this.btnBack.TabIndex = 42;
this.btnBack.Text = "Главное меню";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// DataGridViewProduct
//
this.DataGridViewProduct.AllowUserToAddRows = false;
this.DataGridViewProduct.AllowUserToDeleteRows = false;
this.DataGridViewProduct.AllowUserToOrderColumns = true;
this.DataGridViewProduct.AllowUserToResizeColumns = false;
this.DataGridViewProduct.AllowUserToResizeRows = false;
this.DataGridViewProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DataGridViewProduct.Location = new System.Drawing.Point(74, 74);
this.DataGridViewProduct.Name = "DataGridViewProduct";
this.DataGridViewProduct.ReadOnly = true;
this.DataGridViewProduct.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.DataGridViewProduct.Size = new System.Drawing.Size(748, 223);
this.DataGridViewProduct.TabIndex = 41;
this.DataGridViewProduct.Click += new System.EventHandler(this.dataGridViewProd_Click);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.pictureBoxPhoto);
this.panel1.Location = new System.Drawing.Point(56, 303);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(789, 218);
this.panel1.TabIndex = 40;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label4);
this.panel3.Controls.Add(this.SaleLabel);
this.panel3.Location = new System.Drawing.Point(623, 14);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(142, 189);
this.panel3.TabIndex = 2;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label4.Location = new System.Drawing.Point(29, 51);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(73, 28);
this.label4.TabIndex = 4;
this.label4.Text = "Действующая\r\nскидка";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// SaleLabel
//
this.SaleLabel.AutoSize = true;
this.SaleLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SaleLabel.Location = new System.Drawing.Point(53, 87);
this.SaleLabel.Name = "SaleLabel";
this.SaleLabel.Size = new System.Drawing.Size(0, 14);
this.SaleLabel.TabIndex = 2;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.textBoxFP);
this.panel2.Controls.Add(this.textBoxStock);
this.panel2.Controls.Add(this.textBoxUnit);
this.panel2.Controls.Add(this.textBoxPrice);
this.panel2.Controls.Add(this.textBoxSup);
this.panel2.Controls.Add(this.textBoxManuf);
this.panel2.Controls.Add(this.textBoxDesc);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.StockLabel);
this.panel2.Controls.Add(this.label9);
this.panel2.Controls.Add(this.PriceLabel);
this.panel2.Controls.Add(this.SupplierLabel);
this.panel2.Controls.Add(this.ManufacturerLabel);
this.panel2.Controls.Add(this.DescriptionLabel);
this.panel2.Controls.Add(this.NameLabel);
this.panel2.Controls.Add(this.CategoryLabel);
this.panel2.Location = new System.Drawing.Point(212, 14);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(395, 189);
this.panel2.TabIndex = 1;
//
// textBoxFP
//
this.textBoxFP.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxFP.Location = new System.Drawing.Point(247, 113);
this.textBoxFP.Name = "textBoxFP";
this.textBoxFP.ReadOnly = true;
this.textBoxFP.Size = new System.Drawing.Size(95, 20);
this.textBoxFP.TabIndex = 15;
//
// textBoxStock
//
this.textBoxStock.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxStock.Location = new System.Drawing.Point(148, 158);
this.textBoxStock.Name = "textBoxStock";
this.textBoxStock.ReadOnly = true;
this.textBoxStock.Size = new System.Drawing.Size(194, 20);
this.textBoxStock.TabIndex = 14;
//
// textBoxUnit
//
this.textBoxUnit.Font = new System.Drawing.Font("Times New Roman", 8.25F);
this.textBoxUnit.Location = new System.Drawing.Point(148, 135);
this.textBoxUnit.Name = "textBoxUnit";
this.textBoxUnit.ReadOnly = true;
this.textBoxUnit.Size = new System.Drawing.Size(194, 20);
this.textBoxUnit.TabIndex = 13;
//
// textBoxPrice
//
this.textBoxPrice.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxPrice.Location = new System.Drawing.Point(148, 113);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.ReadOnly = true;
this.textBoxPrice.Size = new System.Drawing.Size(95, 20);
this.textBoxPrice.TabIndex = 12;
//
// textBoxSup
//
this.textBoxSup.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxSup.Location = new System.Drawing.Point(148, 87);
this.textBoxSup.Name = "textBoxSup";
this.textBoxSup.ReadOnly = true;
this.textBoxSup.Size = new System.Drawing.Size(194, 20);
this.textBoxSup.TabIndex = 11;
//
// textBoxManuf
//
this.textBoxManuf.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxManuf.Location = new System.Drawing.Point(148, 64);
this.textBoxManuf.Name = "textBoxManuf";
this.textBoxManuf.ReadOnly = true;
this.textBoxManuf.Size = new System.Drawing.Size(194, 20);
this.textBoxManuf.TabIndex = 10;
//
// textBoxDesc
//
this.textBoxDesc.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.textBoxDesc.Location = new System.Drawing.Point(148, 41);
this.textBoxDesc.Name = "textBoxDesc";
this.textBoxDesc.ReadOnly = true;
this.textBoxDesc.Size = new System.Drawing.Size(194, 20);
this.textBoxDesc.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label3.Location = new System.Drawing.Point(131, 14);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(11, 15);
this.label3.TabIndex = 8;
this.label3.Text = "I";
//
// StockLabel
//
this.StockLabel.AutoSize = true;
this.StockLabel.BackColor = System.Drawing.Color.Chartreuse;
this.StockLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.StockLabel.Location = new System.Drawing.Point(14, 158);
this.StockLabel.Name = "StockLabel";
this.StockLabel.Size = new System.Drawing.Size(112, 14);
this.StockLabel.TabIndex = 7;
this.StockLabel.Text = "Количество на складе:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.Color.Chartreuse;
this.label9.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label9.Location = new System.Drawing.Point(21, 135);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(104, 14);
this.label9.TabIndex = 6;
this.label9.Text = "Единица измерения:";
//
// PriceLabel
//
this.PriceLabel.AutoSize = true;
this.PriceLabel.BackColor = System.Drawing.Color.Chartreuse;
this.PriceLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.PriceLabel.Location = new System.Drawing.Point(57, 113);
this.PriceLabel.Name = "PriceLabel";
this.PriceLabel.Size = new System.Drawing.Size(69, 14);
this.PriceLabel.TabIndex = 5;
this.PriceLabel.Text = "Цена товара:";
//
// SupplierLabel
//
this.SupplierLabel.AutoSize = true;
this.SupplierLabel.BackColor = System.Drawing.Color.Chartreuse;
this.SupplierLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.SupplierLabel.Location = new System.Drawing.Point(63, 90);
this.SupplierLabel.Name = "SupplierLabel";
this.SupplierLabel.Size = new System.Drawing.Size(63, 14);
this.SupplierLabel.TabIndex = 4;
this.SupplierLabel.Text = "Поставщик:";
//
// ManufacturerLabel
//
this.ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.BackColor = System.Drawing.Color.Chartreuse;
this.ManufacturerLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ManufacturerLabel.Location = new System.Drawing.Point(44, 67);
this.ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.Size = new System.Drawing.Size(82, 14);
this.ManufacturerLabel.TabIndex = 3;
this.ManufacturerLabel.Text = "Производитель:";
//
// DescriptionLabel
//
this.DescriptionLabel.AutoSize = true;
this.DescriptionLabel.BackColor = System.Drawing.Color.Chartreuse;
this.DescriptionLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.DescriptionLabel.Location = new System.Drawing.Point(34, 44);
this.DescriptionLabel.Name = "DescriptionLabel";
this.DescriptionLabel.Size = new System.Drawing.Size(92, 14);
this.DescriptionLabel.TabIndex = 2;
this.DescriptionLabel.Text = "Описание товара:";
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.BackColor = System.Drawing.Color.Chartreuse;
this.NameLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.NameLabel.Location = new System.Drawing.Point(157, 16);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(112, 14);
this.NameLabel.TabIndex = 1;
this.NameLabel.Text = "Наименование товара";
//
// CategoryLabel
//
this.CategoryLabel.AutoSize = true;
this.CategoryLabel.BackColor = System.Drawing.Color.Chartreuse;
this.CategoryLabel.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.CategoryLabel.Location = new System.Drawing.Point(19, 16);
this.CategoryLabel.Name = "CategoryLabel";
this.CategoryLabel.Size = new System.Drawing.Size(92, 14);
this.CategoryLabel.TabIndex = 0;
this.CategoryLabel.Text = "Категория товара";
//
// pictureBoxPhoto
//
this.pictureBoxPhoto.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxPhoto.Location = new System.Drawing.Point(17, 14);
this.pictureBoxPhoto.Name = "pictureBoxPhoto";
this.pictureBoxPhoto.Size = new System.Drawing.Size(174, 189);
this.pictureBoxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxPhoto.TabIndex = 0;
this.pictureBoxPhoto.TabStop = false;
//
// labelFIO
//
this.labelFIO.AutoSize = true;
this.labelFIO.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.labelFIO.Location = new System.Drawing.Point(694, 9);
this.labelFIO.Name = "labelFIO";
this.labelFIO.Size = new System.Drawing.Size(0, 15);
this.labelFIO.TabIndex = 46;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Chartreuse;
this.label1.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(604, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(90, 15);
this.label1.TabIndex = 45;
this.label1.Text = "ФИО Клиента -";
//
// UserMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(892, 574);
this.Controls.Add(this.labelFIO);
this.Controls.Add(this.label1);
this.Controls.Add(this.label11);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.DataGridViewProduct);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "UserMainForm";
this.Text = "UserMainForm";
this.Load += new System.EventHandler(this.UserMainForm_Load);
((System.ComponentModel.ISupportInitialize)(this.DataGridViewProduct)).EndInit();
this.panel1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPhoto)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.DataGridView DataGridViewProduct;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label SaleLabel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBoxFP;
private System.Windows.Forms.TextBox textBoxStock;
private System.Windows.Forms.TextBox textBoxUnit;
private System.Windows.Forms.TextBox textBoxPrice;
private System.Windows.Forms.TextBox textBoxSup;
private System.Windows.Forms.TextBox textBoxManuf;
private System.Windows.Forms.TextBox textBoxDesc;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label StockLabel;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label PriceLabel;
private System.Windows.Forms.Label SupplierLabel;
private System.Windows.Forms.Label ManufacturerLabel;
private System.Windows.Forms.Label DescriptionLabel;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Label CategoryLabel;
private System.Windows.Forms.PictureBox pictureBoxPhoto;
private System.Windows.Forms.Label labelFIO;
private System.Windows.Forms.Label label1;
}
}

193
UserMainForm.cs Normal file
View File

@ -0,0 +1,193 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace demMalyhin
{
public partial class UserMainForm : Form
{
private MySqlDataAdapter dataAdapter;
private DataTable prodTable;
private BindingSource bindingSource = new BindingSource();
public UserMainForm()
{
InitializeComponent();
LoadProdData();
}
private void LoadProdData() // загрузка данных в дгв
{
try
{
DB db = new DB();
using (MySqlConnection connection = db.getConnection())
{
connection.Open();
string query = "SELECT article_product AS `Артикул`, product_name AS `Название товара`, price AS `Цена`, supplier_name AS `Поставщик`, Manufacturer_name AS `Производитель`, Category_name AS `Категория`, sale_percent AS `Скидка`, unit_type AS `Единица измерения`, description AS `описание`, quantity_in_stock AS `Количество на складе`, photo AS `фото` FROM products LEFT JOIN Category ON products.category_id = Category.id_Category JOIN Supplier ON products.supplier_id = Supplier.id_Supplier JOIN Manufacturer ON products.manufacturer_id = Manufacturer.id_Manufacturer";
dataAdapter = new MySqlDataAdapter(query, connection);
prodTable = new DataTable();
dataAdapter.Fill(prodTable);
DataGridViewProduct.RowTemplate.Height = 60;
bindingSource.DataSource = prodTable;
DataGridViewProduct.DataSource = bindingSource;
DataGridViewProduct.AllowUserToAddRows = false;
DataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
DataGridViewProduct.ReadOnly = true; // настройки дгв
}
}
catch (MySqlException ex)
{
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
}
}
private void dataGridViewProd_Click(object sender, EventArgs e)
{
textBoxDesc.Text = DataGridViewProduct.CurrentRow.Cells[8].Value.ToString();
textBoxManuf.Text = DataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
textBoxSup.Text = DataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
textBoxPrice.Text = DataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
textBoxUnit.Text = DataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
textBoxStock.Text = DataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
NameLabel.Text = DataGridViewProduct.CurrentRow.Cells[1].Value.ToString();
CategoryLabel.Text = DataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
SaleLabel.Text = DataGridViewProduct.CurrentRow.Cells[6].Value.ToString() + "%";
try
{
object photoData = DataGridViewProduct.CurrentRow.Cells[10].Value;
if (photoData != DBNull.Value)
{
byte[] imageData = (byte[])photoData;
if (imageData != null && imageData.Length > 0)
{
using (MemoryStream ms = new MemoryStream(imageData))
{
pictureBoxPhoto.Image = Image.FromStream(ms);
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
else
{
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при загрузке изображения: " + ex.Message);
pictureBoxPhoto.Image = Properties.Resources.picture;
pictureBoxPhoto.SizeMode = PictureBoxSizeMode.Zoom;
}
try
{
var currentRow = DataGridViewProduct.CurrentRow;
if (currentRow == null) return;
Color defaultColor = SystemColors.Window;
textBoxPrice.BackColor = defaultColor;
textBoxSup.BackColor = defaultColor;
textBoxManuf.BackColor = defaultColor;
textBoxStock.BackColor = defaultColor;
textBoxPrice.ForeColor = Color.Black;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Regular);
textBoxFP.Text = "";
decimal originalPrice = 0m;
int salePercent = 0;
int quantityInStock = 0;
decimal.TryParse(currentRow.Cells[2].Value?.ToString(), out originalPrice);
int.TryParse(currentRow.Cells[6].Value?.ToString(), out salePercent);
int.TryParse(currentRow.Cells[9].Value?.ToString(), out quantityInStock);
if (salePercent > 15)
{
Color highDiscountColor = ColorTranslator.FromHtml("#2E8B57");
textBoxPrice.BackColor = highDiscountColor;
textBoxSup.BackColor = highDiscountColor;
textBoxManuf.BackColor = highDiscountColor;
textBoxStock.BackColor = highDiscountColor;
textBoxDesc.BackColor = highDiscountColor;
textBoxFP.BackColor = highDiscountColor;
textBoxUnit.BackColor = highDiscountColor;
panel3.BackColor = highDiscountColor;
}
else
{
textBoxPrice.BackColor = Color.White;
textBoxSup.BackColor = Color.White;
textBoxManuf.BackColor = Color.White;
textBoxStock.BackColor = Color.White;
textBoxDesc.BackColor = Color.White;
textBoxFP.BackColor = Color.White;
textBoxUnit.BackColor = Color.White;
panel3.BackColor = Color.White;
}
if (salePercent > 0)
{
decimal finalPrice = originalPrice * (1 - (decimal)salePercent / 100);
textBoxPrice.Text = $"{originalPrice:N2}";
textBoxPrice.ForeColor = Color.Red;
textBoxPrice.Font = new Font(textBoxPrice.Font, FontStyle.Strikeout);
textBoxFP.Text = $"{finalPrice:N2}";
textBoxFP.ForeColor = Color.Black;
textBoxFP.Font = new Font(textBoxFP.Font, FontStyle.Regular);
}
else
{
textBoxPrice.Text = $"{originalPrice:N2}";
}
if (quantityInStock <= 0)
{
textBoxStock.BackColor = Color.LightBlue;
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при обработке данных товара: " + ex.Message);
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm log = new LoginForm();
log.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void UserMainForm_Load(object sender, EventArgs e)
{
labelFIO.Text = LoginForm.ClientSurname + " " + LoginForm.ClientName + " " + LoginForm.ClientPatronymic;
}
}
}

120
UserMainForm.resx Normal file
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>

243
demMalyhin.csproj Normal file
View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>demMalyhin</RootNamespace>
<AssemblyName>demMalyhin</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>packages\BouncyCastle.Cryptography.2.6.2\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.32.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>packages\Google.Protobuf.3.32.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=9.5.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>packages\MySql.Data.9.5.0\lib\net48\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySqlConnector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>packages\MySqlConnector.2.4.0\lib\net48\MySqlConnector.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ZstdSharp, Version=0.8.6.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>packages\ZstdSharp.Port.0.8.6\lib\net462\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AddAdmProduct.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AddAdmProduct.Designer.cs">
<DependentUpon>AddAdmProduct.cs</DependentUpon>
</Compile>
<Compile Include="AdmAddOrder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdmAddOrder.Designer.cs">
<DependentUpon>AdmAddOrder.cs</DependentUpon>
</Compile>
<Compile Include="AdmEditOrder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdmEditOrder.Designer.cs">
<DependentUpon>AdmEditOrder.cs</DependentUpon>
</Compile>
<Compile Include="AdmEditProduct.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdmEditProduct.Designer.cs">
<DependentUpon>AdmEditProduct.cs</DependentUpon>
</Compile>
<Compile Include="AdmMainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdmMainForm.Designer.cs">
<DependentUpon>AdmMainForm.cs</DependentUpon>
</Compile>
<Compile Include="AdmOrder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdmOrder.Designer.cs">
<DependentUpon>AdmOrder.cs</DependentUpon>
</Compile>
<Compile Include="DB.cs" />
<Compile Include="GuestMainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GuestMainForm.Designer.cs">
<DependentUpon>GuestMainForm.cs</DependentUpon>
</Compile>
<Compile Include="LoginForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoginForm.Designer.cs">
<DependentUpon>LoginForm.cs</DependentUpon>
</Compile>
<Compile Include="ManagerOrder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ManagerOrder.Designer.cs">
<DependentUpon>ManagerOrder.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ManagerMainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ManagerMainForm.Designer.cs">
<DependentUpon>ManagerMainForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="UserMainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserMainForm.Designer.cs">
<DependentUpon>UserMainForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AddAdmProduct.resx">
<DependentUpon>AddAdmProduct.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdmAddOrder.resx">
<DependentUpon>AdmAddOrder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdmEditOrder.resx">
<DependentUpon>AdmEditOrder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdmEditProduct.resx">
<DependentUpon>AdmEditProduct.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdmMainForm.resx">
<DependentUpon>AdmMainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdmOrder.resx">
<DependentUpon>AdmOrder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GuestMainForm.resx">
<DependentUpon>GuestMainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LoginForm.resx">
<DependentUpon>LoginForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ManagerMainForm.resx">
<DependentUpon>ManagerMainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ManagerOrder.resx">
<DependentUpon>ManagerOrder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="UserMainForm.resx">
<DependentUpon>UserMainForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icon.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\picture.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
demMalyhin.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demMalyhin", "demMalyhin.csproj", "{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63E7FFBE-5F99-4F82-B33A-22851EEDF6D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0454A56A-E1EB-4CD4-BE95-D80F4C2284E8}
EndGlobalSection
EndGlobal

22
packages.config Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.6.2" targetFramework="net48" />
<package id="Google.Protobuf" version="3.32.0" targetFramework="net48" />
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net48" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net48" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.2" targetFramework="net48" />
<package id="MySql.Data" version="9.5.0" targetFramework="net48" />
<package id="MySqlConnector" version="2.4.0" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net48" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="ZstdSharp.Port" version="0.8.6" targetFramework="net48" />
</packages>