Initial commit
This commit is contained in:
757
Mip/frmNovaPoziadavka.cs
Normal file
757
Mip/frmNovaPoziadavka.cs
Normal file
@@ -0,0 +1,757 @@
|
||||
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;
|
||||
|
||||
namespace Mip
|
||||
{
|
||||
public partial class frmNovaPoziadavka : Form
|
||||
{
|
||||
private DataTable tabNoveZiadanky = new DataTable();
|
||||
private DataTable tabZoznamZiadanky;
|
||||
private DataTable tabZoznamFiriem;
|
||||
//private DataTable tabJednotka = new DataTable();
|
||||
|
||||
private AutoCompleteStringCollection acscNazov = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscFirmy = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscTypy = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscPoznamky = new AutoCompleteStringCollection();
|
||||
|
||||
public frmNovaPoziadavka()
|
||||
{
|
||||
InitializeComponent();
|
||||
string cmd = "SELECT * FROM `pohlad-ziadanka`";
|
||||
classSQL.SQL(cmd, out tabZoznamZiadanky);
|
||||
|
||||
tabNoveZiadanky.Columns.Add("Status", typeof(System.Boolean));
|
||||
tabNoveZiadanky.Columns.Add("Názov", typeof(System.String));
|
||||
tabNoveZiadanky.Columns.Add("Typ", typeof(System.String));
|
||||
tabNoveZiadanky.Columns.Add("Firma", typeof(System.String));
|
||||
tabNoveZiadanky.Columns.Add("Poznámka", typeof(System.String));
|
||||
tabNoveZiadanky.Columns.Add("Termín", typeof(System.DateTime));
|
||||
tabNoveZiadanky.Columns.Add("Počet kusov", typeof(System.Int32));
|
||||
tabNoveZiadanky.Columns.Add("Číslo panela", typeof(System.Int32));
|
||||
tabNoveZiadanky.Columns.Add("Súborove Dáta", typeof(System.Byte[]));
|
||||
tabNoveZiadanky.Columns.Add("Množstvo", typeof(System.Decimal));
|
||||
tabNoveZiadanky.Columns.Add("Jednotka", typeof(System.String));
|
||||
tabNoveZiadanky.Columns.Add("Cena", typeof(System.Decimal));
|
||||
|
||||
//cmd = "select `Hodnota` from `tabpomocnychudajov` where `Kategoria` = 'Pridať jednotku';";
|
||||
//classSQL.SQL(cmd, out tabJednotka);
|
||||
|
||||
DataTable tab;
|
||||
cmd = "SELECT Názov, Typ, Poznámka, Cena FROM tabziadanka";
|
||||
classSQL.SQL(cmd, out tab);
|
||||
|
||||
foreach (DataRow dr in tab.Rows)
|
||||
{
|
||||
acscNazov.Add(dr["Názov"].ToString());
|
||||
acscTypy.Add(dr["Typ"].ToString());
|
||||
acscPoznamky.Add(dr["Poznámka"].ToString());
|
||||
|
||||
}
|
||||
|
||||
cmd = "select `IDFirma`, `FirmaMeno`, concat(`FirmaMeno`,' (',`IDFirma`, ')') as FirmaMenoID from `tabfirmy`";
|
||||
classSQL.SQL(cmd, out tabZoznamFiriem);
|
||||
foreach (DataRow dr in tabZoznamFiriem.Rows) { acscFirmy.Add(dr["FirmaMenoID"].ToString()); }
|
||||
}
|
||||
|
||||
private void frmNovaPoziadavka_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataRow dr = tabNoveZiadanky.NewRow();
|
||||
dr["Číslo panela"] = flowLayoutPanel1.Controls.Count + 1;
|
||||
dr["Termín"] = DateTime.Now;
|
||||
tabNoveZiadanky.Rows.Add(dr);
|
||||
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmEditPoziadavka));
|
||||
Panel pnlZiadanka = new System.Windows.Forms.Panel();
|
||||
NumericUpDown nudPocet = new System.Windows.Forms.NumericUpDown();
|
||||
DateTimePicker dtpTermin = new System.Windows.Forms.DateTimePicker();
|
||||
Label lblPoznamka = new System.Windows.Forms.Label();
|
||||
Label lblTermin = new System.Windows.Forms.Label();
|
||||
Button btnJednotka = new System.Windows.Forms.Button();
|
||||
ComboBox cbJednotka = new System.Windows.Forms.ComboBox();
|
||||
TextBox tbPoznamka = new System.Windows.Forms.TextBox();
|
||||
NumericUpDown nudCena = new System.Windows.Forms.NumericUpDown();
|
||||
Label lblCena = new System.Windows.Forms.Label();
|
||||
Label lblPocet = new System.Windows.Forms.Label();
|
||||
Label lblFirma = new System.Windows.Forms.Label();
|
||||
TextBox tbNazov = new System.Windows.Forms.TextBox();
|
||||
Label lblTyp = new System.Windows.Forms.Label();
|
||||
TextBox tbTyp = new System.Windows.Forms.TextBox();
|
||||
Label lblNazov = new System.Windows.Forms.Label();
|
||||
TextBox tbFirma = new System.Windows.Forms.TextBox();
|
||||
Button btnCancel = new System.Windows.Forms.Button();
|
||||
Label lblVykres = new System.Windows.Forms.Label();
|
||||
NumericUpDown nudMnozstvo = new System.Windows.Forms.NumericUpDown();
|
||||
Button btnOK = new System.Windows.Forms.Button();
|
||||
Label lblMnozstvo = new System.Windows.Forms.Label();
|
||||
Label lblJednotka = new System.Windows.Forms.Label();
|
||||
Button btnDeletePicture = new System.Windows.Forms.Button();
|
||||
Button btnAddPicture = new System.Windows.Forms.Button();
|
||||
//
|
||||
// pnlZiadanka
|
||||
//
|
||||
//pnlZiadanka.BackColor = System.Drawing.Color.LightBlue;
|
||||
pnlZiadanka.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
pnlZiadanka.Controls.Add(btnAddPicture);
|
||||
pnlZiadanka.Controls.Add(btnDeletePicture);
|
||||
pnlZiadanka.Controls.Add(lblPocet);
|
||||
pnlZiadanka.Controls.Add(cbJednotka);
|
||||
pnlZiadanka.Controls.Add(nudMnozstvo);
|
||||
pnlZiadanka.Controls.Add(lblJednotka);
|
||||
pnlZiadanka.Controls.Add(lblMnozstvo);
|
||||
pnlZiadanka.Controls.Add(tbPoznamka);
|
||||
pnlZiadanka.Controls.Add(lblCena);
|
||||
pnlZiadanka.Controls.Add(nudCena);
|
||||
pnlZiadanka.Controls.Add(btnJednotka);
|
||||
pnlZiadanka.Controls.Add(btnCancel);
|
||||
pnlZiadanka.Controls.Add(nudPocet);
|
||||
pnlZiadanka.Controls.Add(dtpTermin);
|
||||
pnlZiadanka.Controls.Add(lblPoznamka);
|
||||
pnlZiadanka.Controls.Add(lblTermin);
|
||||
pnlZiadanka.Controls.Add(lblFirma);
|
||||
pnlZiadanka.Controls.Add(tbNazov);
|
||||
pnlZiadanka.Controls.Add(lblTyp);
|
||||
pnlZiadanka.Controls.Add(tbTyp);
|
||||
pnlZiadanka.Controls.Add(lblNazov);
|
||||
pnlZiadanka.Controls.Add(tbFirma);
|
||||
pnlZiadanka.Controls.Add(btnOK);
|
||||
pnlZiadanka.Location = new System.Drawing.Point(0, 0);
|
||||
pnlZiadanka.Margin = new System.Windows.Forms.Padding(1);
|
||||
pnlZiadanka.Name = "pnlZiadanka";
|
||||
pnlZiadanka.Size = new System.Drawing.Size(604, 87);
|
||||
pnlZiadanka.TabIndex = 1;
|
||||
int pocet = flowLayoutPanel1.Controls.Count + 1;
|
||||
pnlZiadanka.Name = pocet.ToString();
|
||||
pnlZiadanka.Enter += new EventHandler(pnlEnter);
|
||||
pnlZiadanka.Leave += new EventHandler(pnlLeave);
|
||||
//
|
||||
// tbPoznamka
|
||||
//
|
||||
tbPoznamka.Location = new System.Drawing.Point(63, 64);
|
||||
tbPoznamka.Name = "tbPoznamka";
|
||||
tbPoznamka.Size = new System.Drawing.Size(354, 20);
|
||||
tbPoznamka.TabIndex = 10;
|
||||
tbPoznamka.Enter += new System.EventHandler(controlEnter);
|
||||
tbPoznamka.Leave += new System.EventHandler(controlLeave);
|
||||
tbPoznamka.TextChanged += new EventHandler(tbPoznamkaChanged);
|
||||
tbPoznamka.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
tbPoznamka.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
tbPoznamka.AutoCompleteCustomSource = acscPoznamky;
|
||||
//
|
||||
// btnJednotka
|
||||
//
|
||||
btnJednotka.Location = new System.Drawing.Point(278, 42);
|
||||
btnJednotka.Name = "btnJednotka";
|
||||
btnJednotka.Size = new System.Drawing.Size(22, 22);
|
||||
btnJednotka.TabIndex = 20;
|
||||
btnJednotka.Text = "+";
|
||||
btnJednotka.UseVisualStyleBackColor = true;
|
||||
btnJednotka.Click += new EventHandler(btnJednotkaClick);
|
||||
//
|
||||
// cbJednotka
|
||||
//
|
||||
cbJednotka.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
cbJednotka.FormattingEnabled = true;
|
||||
cbJednotka.Location = new System.Drawing.Point(197, 43);
|
||||
cbJednotka.Name = "cbJednotka";
|
||||
cbJednotka.Size = new System.Drawing.Size(81, 20);
|
||||
cbJednotka.TabIndex = 19;
|
||||
classGlobal.FillCB(cbJednotka, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať jednotku");
|
||||
//cbJednotka.DataSource = tabJednotka;
|
||||
//cbJednotka.ValueMember = "Hodnota";
|
||||
//cbJednotka.DisplayMember = "Hodnota";
|
||||
cbJednotka.Enter += new System.EventHandler(controlEnter);
|
||||
cbJednotka.Leave += new System.EventHandler(controlLeave);
|
||||
cbJednotka.SelectedValueChanged += new EventHandler(cbJednotkaSelectedValueChanged);
|
||||
//
|
||||
// nudMnozstvo
|
||||
//
|
||||
nudMnozstvo.DecimalPlaces = 2;
|
||||
nudMnozstvo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
nudMnozstvo.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
131072});
|
||||
nudMnozstvo.Location = new System.Drawing.Point(64, 43);
|
||||
nudMnozstvo.Maximum = new decimal(new int[] {
|
||||
10000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
nudMnozstvo.Name = "nudMnozstvo";
|
||||
nudMnozstvo.Value = 0;
|
||||
nudMnozstvo.Size = new System.Drawing.Size(67, 20);
|
||||
nudMnozstvo.TabIndex = 18;
|
||||
nudMnozstvo.Enter += new System.EventHandler(controlEnter);
|
||||
nudMnozstvo.Leave += new System.EventHandler(controlLeave);
|
||||
nudMnozstvo.ValueChanged += new EventHandler(nudMnozstvoChanged);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
btnCancel.Image = global::Mip.Properties.Resources.erase_3D;
|
||||
btnCancel.Location = new System.Drawing.Point(559, 42);
|
||||
btnCancel.Name = "btnCancel";
|
||||
btnCancel.Size = new System.Drawing.Size(43, 43);
|
||||
btnCancel.TabIndex = 17;
|
||||
btnCancel.UseVisualStyleBackColor = true;
|
||||
btnCancel.Click += new System.EventHandler(btnOKCancelClick);
|
||||
//
|
||||
// nudPocet
|
||||
//
|
||||
nudPocet.Location = new System.Drawing.Point(371, 43);
|
||||
nudPocet.Maximum = new decimal(new int[] { 99999, 0, 0, 0});
|
||||
nudPocet.Name = "nudPocet";
|
||||
nudPocet.Value = 0;
|
||||
nudPocet.Size = new System.Drawing.Size(146, 20);
|
||||
nudPocet.TabIndex = 15;
|
||||
nudPocet.Enter += new System.EventHandler(controlEnter);
|
||||
nudPocet.Leave += new System.EventHandler(controlLeave);
|
||||
nudPocet.ValueChanged += new EventHandler(nudPocetChanged);
|
||||
//
|
||||
// dtpTermin
|
||||
//
|
||||
dtpTermin.Format = System.Windows.Forms.DateTimePickerFormat.Short;
|
||||
dtpTermin.Location = new System.Drawing.Point(371, 22);
|
||||
dtpTermin.Name = "dtpTermin";
|
||||
dtpTermin.Size = new System.Drawing.Size(146, 20);
|
||||
dtpTermin.TabIndex = 14;
|
||||
dtpTermin.Enter += new System.EventHandler(controlEnter);
|
||||
dtpTermin.Leave += new System.EventHandler(controlLeave);
|
||||
dtpTermin.ValueChanged += new EventHandler(dtpTerminChanged);
|
||||
//
|
||||
// lblPoznamka
|
||||
//
|
||||
lblPoznamka.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblPoznamka.Location = new System.Drawing.Point(1, 64);
|
||||
lblPoznamka.Name = "lblPoznamka";
|
||||
lblPoznamka.Size = new System.Drawing.Size(61, 20);
|
||||
lblPoznamka.TabIndex = 13;
|
||||
lblPoznamka.Text = "Poznámka";
|
||||
lblPoznamka.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// lblTermin
|
||||
//
|
||||
lblTermin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblTermin.Location = new System.Drawing.Point(300, 22);
|
||||
lblTermin.Name = "lblTermin";
|
||||
lblTermin.Size = new System.Drawing.Size(70, 20);
|
||||
lblTermin.TabIndex = 11;
|
||||
lblTermin.Text = "Termín";
|
||||
lblTermin.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// lblPocet
|
||||
//
|
||||
lblPocet.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblPocet.Location = new System.Drawing.Point(300, 43);
|
||||
lblPocet.Name = "lblPocet";
|
||||
lblPocet.Size = new System.Drawing.Size(70, 20);
|
||||
lblPocet.TabIndex = 8;
|
||||
lblPocet.Text = "Počet kusov";
|
||||
lblPocet.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// lblFirma
|
||||
//
|
||||
lblFirma.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblFirma.Location = new System.Drawing.Point(1, 22);
|
||||
lblFirma.Name = "lblFirma";
|
||||
lblFirma.Size = new System.Drawing.Size(61, 20);
|
||||
lblFirma.TabIndex = 6;
|
||||
lblFirma.Text = "Firma";
|
||||
lblFirma.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// tbNazov
|
||||
//
|
||||
tbNazov.Location = new System.Drawing.Point(63, 1);
|
||||
tbNazov.Name = "tbNazov";
|
||||
tbNazov.Size = new System.Drawing.Size(236, 20);
|
||||
tbNazov.TabIndex = 5;
|
||||
tbNazov.Enter += new System.EventHandler(controlEnter);
|
||||
tbNazov.Leave += new System.EventHandler(controlLeave);
|
||||
tbNazov.TextChanged += new EventHandler(tbNazovChanged);
|
||||
tbNazov.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
tbNazov.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
tbNazov.AutoCompleteCustomSource = acscNazov;
|
||||
//
|
||||
// lblTyp
|
||||
//
|
||||
lblTyp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblTyp.Location = new System.Drawing.Point(300, 1);
|
||||
lblTyp.Name = "lblTyp";
|
||||
lblTyp.Size = new System.Drawing.Size(70, 20);
|
||||
lblTyp.TabIndex = 4;
|
||||
lblTyp.Text = "Typ (Kód)";
|
||||
lblTyp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// tbTyp
|
||||
//
|
||||
tbTyp.Location = new System.Drawing.Point(371, 1);
|
||||
tbTyp.Name = "tbTyp";
|
||||
tbTyp.Size = new System.Drawing.Size(146, 20);
|
||||
tbTyp.TabIndex = 3;
|
||||
tbTyp.Enter += new System.EventHandler(controlEnter);
|
||||
tbTyp.Leave += new System.EventHandler(controlLeave);
|
||||
tbTyp.TextChanged += new EventHandler(tbTypChanged);
|
||||
tbTyp.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
tbTyp.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
tbTyp.AutoCompleteCustomSource = acscTypy;
|
||||
//
|
||||
// lblNazov
|
||||
//
|
||||
lblNazov.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblNazov.Location = new System.Drawing.Point(1, 1);
|
||||
lblNazov.Name = "lblNazov";
|
||||
lblNazov.Size = new System.Drawing.Size(61, 20);
|
||||
lblNazov.TabIndex = 2;
|
||||
lblNazov.Text = "Názov";
|
||||
lblNazov.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// tbFirma
|
||||
//
|
||||
tbFirma.Location = new System.Drawing.Point(63, 22);
|
||||
tbFirma.Name = "tbFirma";
|
||||
tbFirma.Size = new System.Drawing.Size(236, 20);
|
||||
tbFirma.TabIndex = 1;
|
||||
tbFirma.Enter += new System.EventHandler(controlEnter);
|
||||
tbFirma.Leave += new System.EventHandler(controlLeave);
|
||||
tbFirma.TextChanged += new EventHandler(tbFirmaChanged);
|
||||
tbFirma.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
tbFirma.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
tbFirma.AutoCompleteCustomSource = acscFirmy;
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
btnOK.Image = global::Mip.Properties.Resources.OK_3D;
|
||||
btnOK.Location = new System.Drawing.Point(559, 0);
|
||||
btnOK.Name = "btnOK";
|
||||
btnOK.Size = new System.Drawing.Size(43, 43);
|
||||
btnOK.TabIndex = 0;
|
||||
btnOK.UseVisualStyleBackColor = true;
|
||||
btnOK.Click += new System.EventHandler(btnOKCancelClick);
|
||||
//
|
||||
// lblMnozstvo
|
||||
//
|
||||
lblMnozstvo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblMnozstvo.Location = new System.Drawing.Point(1, 43);
|
||||
lblMnozstvo.Name = "lblMnozstvo";
|
||||
lblMnozstvo.Size = new System.Drawing.Size(61, 20);
|
||||
lblMnozstvo.TabIndex = 21;
|
||||
lblMnozstvo.Text = "Množstvo";
|
||||
lblMnozstvo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// lblJednotka
|
||||
//
|
||||
lblJednotka.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblJednotka.Location = new System.Drawing.Point(132, 43);
|
||||
lblJednotka.Name = "lblJednotka";
|
||||
lblJednotka.Size = new System.Drawing.Size(64, 20);
|
||||
lblJednotka.TabIndex = 22;
|
||||
lblJednotka.Text = "Jednotka";
|
||||
lblJednotka.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// btnDeletePicture
|
||||
//
|
||||
btnDeletePicture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
btnDeletePicture.BackColor = System.Drawing.SystemColors.Control;
|
||||
btnDeletePicture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
btnDeletePicture.Enabled = false;
|
||||
btnDeletePicture.Image = global::Mip.Properties.Resources.image_remove_icon;
|
||||
btnDeletePicture.Location = new System.Drawing.Point(517, 42);
|
||||
btnDeletePicture.Name = "btnDeletePicture";
|
||||
btnDeletePicture.Size = new System.Drawing.Size(43, 43);
|
||||
btnDeletePicture.TabIndex = 23;
|
||||
btnDeletePicture.UseVisualStyleBackColor = false;
|
||||
btnDeletePicture.Click += new EventHandler(btnDeletePictureClick);
|
||||
//
|
||||
// btnAddPicture
|
||||
//
|
||||
btnAddPicture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
btnAddPicture.BackColor = System.Drawing.SystemColors.Control;
|
||||
btnAddPicture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
btnAddPicture.ForeColor = System.Drawing.SystemColors.Control;
|
||||
btnAddPicture.Image = global::Mip.Properties.Resources.image_add_icon;
|
||||
btnAddPicture.Location = new System.Drawing.Point(517, 0);
|
||||
btnAddPicture.Name = "btnAddPicture";
|
||||
//btnAddPicture.Tag = "insert";
|
||||
btnAddPicture.Size = new System.Drawing.Size(43, 43);
|
||||
btnAddPicture.TabIndex = 24;
|
||||
btnAddPicture.UseVisualStyleBackColor = false;
|
||||
btnAddPicture.Click += new EventHandler(btnAddPictureClick);
|
||||
//
|
||||
// nudCena
|
||||
//
|
||||
nudCena.Location = new System.Drawing.Point(418, 64);
|
||||
nudCena.Maximum = new decimal(new int[] { 99999, 0, 0, 0 });
|
||||
nudCena.Name = "nudCena";
|
||||
nudCena.Value = 0;
|
||||
nudCena.Increment = (decimal)0.01;
|
||||
nudCena.DecimalPlaces = 2;
|
||||
nudCena.Size = new System.Drawing.Size(65, 20);
|
||||
nudCena.TabIndex = 25;
|
||||
nudCena.Enter += new System.EventHandler(controlEnter);
|
||||
nudCena.Leave += new System.EventHandler(controlLeave);
|
||||
nudCena.ValueChanged += new EventHandler(nudCenaChanged);
|
||||
//
|
||||
// lblCena
|
||||
//
|
||||
lblCena.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
lblCena.Location = new System.Drawing.Point(484, 64);
|
||||
lblCena.Name = "lblCena";
|
||||
lblCena.Size = new System.Drawing.Size(33, 20);
|
||||
lblCena.TabIndex = 26;
|
||||
lblCena.Text = "€/Ks";
|
||||
lblCena.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(pnlZiadanka.Name.ToString()) - 1].SetField("Status", true);
|
||||
foreach (Panel pnl in flowLayoutPanel1.Controls.OfType<Panel>()) pnl.BackColor = Color.Empty;
|
||||
flowLayoutPanel1.Controls.Add(pnlZiadanka);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnJednotkaClick(object sender, EventArgs e)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
ComboBox cb = new ComboBox();
|
||||
|
||||
Form frmAddPomUdaj2 = new frmAddPomUdaje();
|
||||
frmAddPomUdaj2.Text = "Pridať jednotku";
|
||||
DialogResult dr = frmAddPomUdaj2.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
//string cmd = "select `Hodnota` from `tabpomocnychudajov` where `Kategoria` = 'Pridať jednotku';";
|
||||
//classSQL.SQL(cmd, out tabJednotka);
|
||||
|
||||
cb = btn.Parent.Controls.Find("cbJednotka", true)[0] as ComboBox;
|
||||
classGlobal.FillCB(cb, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať jednotku");
|
||||
cb.Text = classGlobal.strNovyPomocnyUdaj;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void controlEnter(object sender, EventArgs e)
|
||||
{
|
||||
Control ctrl = sender as Control;
|
||||
|
||||
switch (ctrl.Name)
|
||||
{
|
||||
case "tbTyp":
|
||||
ctrl.Parent.Controls.Find("lblTyp", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "tbFirma":
|
||||
ctrl.Parent.Controls.Find("lblFirma", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "tbNazov":
|
||||
ctrl.Parent.Controls.Find("lblNazov", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "tbPoznamka":
|
||||
ctrl.Parent.Controls.Find("lblPoznamka", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "dtpTermin":
|
||||
ctrl.Parent.Controls.Find("lblTermin", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "nudPocet":
|
||||
ctrl.Parent.Controls.Find("lblPocet", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "nudMnozstvo":
|
||||
ctrl.Parent.Controls.Find("lblMnozstvo", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
case "cbJednotka":
|
||||
ctrl.Parent.Controls.Find("lblJednotka", true)[0].BackColor = Color.Coral;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void controlLeave(object sender, EventArgs e)
|
||||
{
|
||||
Control ctrl = sender as Control;
|
||||
|
||||
switch (ctrl.Name)
|
||||
{
|
||||
case "tbTyp":
|
||||
ctrl.Parent.Controls.Find("lblTyp", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "tbFirma":
|
||||
ctrl.Parent.Controls.Find("lblFirma", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "tbNazov":
|
||||
ctrl.Parent.Controls.Find("lblNazov", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "tbPoznamka":
|
||||
ctrl.Parent.Controls.Find("lblPoznamka", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "dtpTermin":
|
||||
ctrl.Parent.Controls.Find("lblTermin", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "nudPocet":
|
||||
ctrl.Parent.Controls.Find("lblPocet", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "nudMnozstvo":
|
||||
ctrl.Parent.Controls.Find("lblMnozstvo", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
case "cbJednotka":
|
||||
ctrl.Parent.Controls.Find("lblJednotka", true)[0].BackColor = Color.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cbJednotkaSelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(cb.Parent.Name.ToString()) - 1].SetField("Jednotka", cb.Text);
|
||||
}
|
||||
|
||||
void nudMnozstvoChanged(object sender, EventArgs e)
|
||||
{
|
||||
NumericUpDown nud = sender as NumericUpDown;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(nud.Parent.Name.ToString()) - 1].SetField("Množstvo", nud.Value);
|
||||
}
|
||||
|
||||
void nudPocetChanged(object sender, EventArgs e)
|
||||
{
|
||||
NumericUpDown nud = sender as NumericUpDown;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(nud.Parent.Name.ToString())-1].SetField("Počet kusov", nud.Value);
|
||||
}
|
||||
void nudCenaChanged(object sender, EventArgs e)
|
||||
{
|
||||
NumericUpDown nud = sender as NumericUpDown;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(nud.Parent.Name.ToString()) - 1].SetField("Cena", nud.Value);
|
||||
}
|
||||
void dtpTerminChanged(object sender, EventArgs e)
|
||||
{
|
||||
DateTimePicker dtp = sender as DateTimePicker;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(dtp.Parent.Name.ToString()) - 1].SetField("Termín", dtp.Value);
|
||||
}
|
||||
void tbPoznamkaChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextBox tb = sender as TextBox;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(tb.Parent.Name.ToString()) - 1].SetField("Poznámka", tb.Text);
|
||||
}
|
||||
void tbNazovChanged(object sender, EventArgs e)
|
||||
{
|
||||
string srt1 = "";//tbFirma.Text;
|
||||
string srt2 = "";//tbTyp.Text;
|
||||
string srt3 = "";//tbPoznamka.Text;
|
||||
|
||||
TextBox tb = sender as TextBox;
|
||||
DataView dv = new DataView();
|
||||
dv = tabZoznamZiadanky.DefaultView;
|
||||
dv.RowFilter = "Názov LIKE '%" + tb.Text + "%'";
|
||||
if (dv.Count > 0 && tb.Text != "")
|
||||
{
|
||||
tb.Parent.Controls.Find("tbFirma",true)[0].Text = dv.ToTable().Rows[0].ItemArray[dv.ToTable().Columns["FirmaMenoID"].Ordinal].ToString();
|
||||
tb.Parent.Controls.Find("tbTyp", true)[0].Text = dv.ToTable().Rows[0].ItemArray[dv.ToTable().Columns["Typ"].Ordinal].ToString();
|
||||
tb.Parent.Controls.Find("tbPoznamka", true)[0].Text = dv.ToTable().Rows[0].ItemArray[dv.ToTable().Columns["Poznámka"].Ordinal].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
tb.Parent.Controls.Find("tbFirma", true)[0].Text = srt1;
|
||||
tb.Parent.Controls.Find("tbTyp", true)[0].Text = srt2;
|
||||
tb.Parent.Controls.Find("tbPoznamka", true)[0].Text = srt3;
|
||||
}
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(tb.Parent.Name.ToString()) - 1].SetField("Názov", tb.Text);
|
||||
}
|
||||
void tbTypChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextBox tb = sender as TextBox;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(tb.Parent.Name.ToString()) - 1].SetField("Typ", tb.Text);
|
||||
}
|
||||
void tbFirmaChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextBox tb = sender as TextBox;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(tb.Parent.Name.ToString()) - 1].SetField("Firma", tb.Text);
|
||||
}
|
||||
void pnlEnter(object sender, EventArgs e)
|
||||
{
|
||||
Panel pnl = sender as Panel;
|
||||
pnl.BackColor = Color.LightBlue;
|
||||
}
|
||||
void pnlLeave(object sender, EventArgs e)
|
||||
{
|
||||
Panel pnl = sender as Panel;
|
||||
string status = "False";
|
||||
if (tabNoveZiadanky.Rows[Convert.ToInt32(pnl.Name.ToString()) - 1].ItemArray[tabNoveZiadanky.Columns["Status"].Ordinal].ToString() == null) status = "False";
|
||||
else status = tabNoveZiadanky.Rows[Convert.ToInt32(pnl.Name.ToString()) - 1].ItemArray[tabNoveZiadanky.Columns["Status"].Ordinal].ToString();
|
||||
|
||||
if(status == "True") pnl.BackColor = Color.Empty;
|
||||
}
|
||||
void btnOKCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
|
||||
if (btn.Name == "btnCancel")
|
||||
{
|
||||
foreach (Control cntrl in btn.Parent.Controls) if (!(cntrl is Button)) cntrl.Enabled = false;
|
||||
btn.Parent.Controls.Find("btnAddPicture", true)[0].Enabled = false;
|
||||
btn.Parent.Controls.Find("btnDeletePicture", true)[0].Enabled = false;
|
||||
btn.Parent.BackColor = Color.LightCoral;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(btn.Parent.Name.ToString()) - 1].SetField("Status", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Control cntrl in btn.Parent.Controls) if (!(cntrl is Button)) cntrl.Enabled = true;
|
||||
btn.Parent.Controls.Find("btnAddPicture", true)[0].Enabled = true;
|
||||
if(tabNoveZiadanky.Rows[Convert.ToInt32(btn.Parent.Name.ToString()) - 1].ItemArray[tabNoveZiadanky.Columns["Súborove Dáta"].Ordinal].ToString() != "") btn.Parent.Controls.Find("btnDeletePicture", true)[0].Enabled = true;
|
||||
btn.Parent.BackColor = Color.Empty;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(btn.Parent.Name.ToString()) - 1].SetField("Status", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void btnAddPictureClick(object sender, EventArgs e)
|
||||
{
|
||||
int FileSize;
|
||||
byte[] FileData;
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
FileStream fs;
|
||||
Button ctrl = sender as Button;
|
||||
|
||||
if(tabNoveZiadanky.Rows[Convert.ToInt32(ctrl.Parent.Name.ToString()) - 1].ItemArray[tabNoveZiadanky.Columns["Súborove Dáta"].Ordinal].ToString() == "")
|
||||
{
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read);
|
||||
FileSize = (int)fs.Length;
|
||||
|
||||
FileData = new byte[FileSize];
|
||||
fs.Read(FileData, 0, FileSize);
|
||||
fs.Close();
|
||||
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(ctrl.Parent.Name.ToString()) - 1].SetField("Súborove Dáta", FileData);
|
||||
ctrl.Parent.Controls.Find("btnDeletePicture", true)[0].Enabled = true;
|
||||
ctrl.Image = global::Mip.Properties.Resources.image_icon;
|
||||
}
|
||||
else MessageBox.Show("Obrázok nebol vybraný!");
|
||||
}
|
||||
else
|
||||
{
|
||||
FileData = (byte[])tabNoveZiadanky.Rows[Convert.ToInt32(ctrl.Parent.Name.ToString()) - 1].ItemArray[tabNoveZiadanky.Columns["Súborove Dáta"].Ordinal];
|
||||
|
||||
Form showVykres = new frmShowVykres(FileData);
|
||||
showVykres.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void btnDeletePictureClick(object sender, EventArgs e)
|
||||
{
|
||||
byte[] FileData;
|
||||
Button ctrl = sender as Button;
|
||||
Button ctrl2 = sender as Button;
|
||||
|
||||
FileData = null;
|
||||
tabNoveZiadanky.Rows[Convert.ToInt32(ctrl.Parent.Name.ToString()) - 1].SetField("Súborove Dáta", FileData);
|
||||
ctrl.Enabled = false;
|
||||
ctrl2 = ctrl.Parent.Controls.Find("btnAddPicture", true)[0] as Button;
|
||||
ctrl2.Image = global::Mip.Properties.Resources.image_add_icon;
|
||||
|
||||
}
|
||||
|
||||
void lblVykresHover(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
void lblVykresLeave(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void frmNovaPoziadavka_Shown(object sender, EventArgs e)
|
||||
{
|
||||
//dataGridView1.DataSource = tabNoveZiadanky;
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach(DataRow rw in tabNoveZiadanky.Rows)
|
||||
{
|
||||
if(rw.ItemArray[rw.Table.Columns["Názov"].Ordinal].ToString() != "")
|
||||
{
|
||||
int pocetKusov = 0;
|
||||
if(rw.ItemArray[rw.Table.Columns["Počet kusov"].Ordinal].ToString() != "") pocetKusov = Convert.ToInt32(rw.ItemArray[rw.Table.Columns["Počet kusov"].Ordinal]);
|
||||
decimal mnozstvo = 0;
|
||||
if(rw.ItemArray[rw.Table.Columns["Množstvo"].Ordinal].ToString() != "") mnozstvo = Convert.ToDecimal(rw.ItemArray[rw.Table.Columns["Množstvo"].Ordinal]);
|
||||
decimal cena = 0;
|
||||
if (rw.ItemArray[rw.Table.Columns["Cena"].Ordinal].ToString() != "") cena = Convert.ToDecimal(rw.ItemArray[rw.Table.Columns["Cena"].Ordinal]);
|
||||
|
||||
string IDFirma = "";
|
||||
string filter = "";
|
||||
|
||||
filter = rw.ItemArray[rw.Table.Columns["Firma"].Ordinal].ToString();
|
||||
if(filter != "")
|
||||
{
|
||||
IDFirma = filter.Substring(filter.IndexOf("(") + 1, filter.Length - filter.IndexOf("(") - 2);
|
||||
Int32 n;
|
||||
bool isNumeric = int.TryParse(IDFirma, out n);
|
||||
|
||||
if (isNumeric == false)
|
||||
{
|
||||
Int32 intLastIndex = 0;
|
||||
string insertCMD = "";
|
||||
insertCMD = @"INSERT INTO `mip`.`tabfirmy` (`FirmaMeno`) VALUES ('" + filter + "');";
|
||||
classSQL.SQL(insertCMD, out intLastIndex);
|
||||
IDFirma = intLastIndex.ToString();
|
||||
MessageBox.Show("Nová firma s názvom '" + filter + "' bola pridaná! \nPre doplnenie údajov o firme treba editovať firmu na karte 'Zoznam firiem'.");
|
||||
}
|
||||
}
|
||||
|
||||
int lastIndex = 0;
|
||||
string cmd = "";
|
||||
cmd = @"INSERT INTO `mip`.`tabziadanka` (`Dátum zadania`, `Status žiadanky`, `Status`, `Názov`, `Typ`, `Firma`, `Poznámka`, `Termín`, `Počet kusov`, `IDUser`, `Množstvo`, `Jednotka`, Cena) VALUES ("
|
||||
+ @"DATE(NOW()), "
|
||||
+ "'Prijatá', "
|
||||
+ "'" + rw.ItemArray[rw.Table.Columns["Status"].Ordinal].ToString() + "', "
|
||||
+ "'" + rw.ItemArray[rw.Table.Columns["Názov"].Ordinal].ToString() + "', "
|
||||
+ "'" + rw.ItemArray[rw.Table.Columns["Typ"].Ordinal].ToString() + "', "
|
||||
+ "'" + IDFirma + "', "
|
||||
+ "'" + rw.ItemArray[rw.Table.Columns["Poznámka"].Ordinal].ToString() + "', "
|
||||
+ "'" + Convert.ToDateTime(rw.ItemArray[rw.Table.Columns["Termín"].Ordinal]).ToString("yyyy-MM-dd") + "', "
|
||||
+ pocetKusov.ToString() + ", "
|
||||
+ classUser.ID.ToString() + ", "
|
||||
+ mnozstvo.ToString().Replace(",", ".") + ", "
|
||||
+ "'" + rw.ItemArray[rw.Table.Columns["Jednotka"].Ordinal].ToString() + "', "
|
||||
+ cena.ToString().Replace(",", ".")
|
||||
+ " );";
|
||||
|
||||
if (cmd != "") classSQL.SQL(cmd,out lastIndex);
|
||||
|
||||
|
||||
if (rw.ItemArray[rw.Table.Columns["Súborove Dáta"].Ordinal].ToString() != "")
|
||||
classSQL.SaveNakresToSQL(lastIndex, (byte[])rw.ItemArray[rw.Table.Columns["Súborove Dáta"].Ordinal]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
MessageBox.Show("Žiadanky vložené do systému!");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
Form frmPridatFirmu = new frmAddFirma();
|
||||
frmPridatFirmu.Location = new Point(this.Location.X + this.Size.Width-7, this.Location.Y);
|
||||
frmPridatFirmu.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user