Editácia výrovku s pdf

This commit is contained in:
roman6791
2021-03-30 12:15:29 +02:00
parent 5798fd69a7
commit 3096d0881b
7 changed files with 9407 additions and 9515 deletions

Binary file not shown.

View File

@@ -1,15 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel; using Excel = Microsoft.Office.Interop.Excel;
@@ -137,25 +130,25 @@ namespace Mip
cb.Items.Add(row[strCollumn].ToString()); cb.Items.Add(row[strCollumn].ToString());
} }
} }
/* /*
/// <summary> /// <summary>
/// Naplna comboBox cb udajmi z SQL servera (viac stlpcov a vrati datasource) /// Naplna comboBox cb udajmi z SQL servera (viac stlpcov a vrati datasource)
/// </summary> /// </summary>
/// <param name="cb"> nazov naplnaneho comboBoxu</param> /// <param name="cb"> nazov naplnaneho comboBoxu</param>
/// <param name="strTab"> nazov tabulky z ktorej comboBox naplname</param> /// <param name="strTab"> nazov tabulky z ktorej comboBox naplname</param>
/// <param name="strCollumn"> nazov stlpca (stlpcov) z tabulky z ktorého data naplname do comboBoxu</param> /// <param name="strCollumn"> nazov stlpca (stlpcov) z tabulky z ktorého data naplname do comboBoxu</param>
public static void FillCBMultiColumn(ComboBox cb, string strTab, string strCollumn) public static void FillCBMultiColumn(ComboBox cb, string strTab, string strCollumn)
{ {
DataTable dtbl = new DataTable(); DataTable dtbl = new DataTable();
string c = "SELECT DISTINCT `" + strCollumn string c = "SELECT DISTINCT `" + strCollumn
+ "` FROM `mip`.`" + strTab + "`;"; + "` FROM `mip`.`" + strTab + "`;";
classSQL.SQL(c, out dtbl); classSQL.SQL(c, out dtbl);
cb.Items.Clear(); cb.Items.Clear();
cb.DataSource = dtbl; cb.DataSource = dtbl;
} }
*/ */
/// <summary> /// <summary>
/// Naplna comboBox cb udajmi z SQL servera (Urceny pre comboboxy na vydaj a prijem do skladu vyrobkov, konvertuje nazvy krabic(string na integer)) /// Naplna comboBox cb udajmi z SQL servera (Urceny pre comboboxy na vydaj a prijem do skladu vyrobkov, konvertuje nazvy krabic(string na integer))
@@ -457,7 +450,7 @@ namespace Mip
break; break;
} }
} }
if(_cI>-1) _dgv.Columns[_cI].DefaultCellStyle.BackColor = Color.GreenYellow; if (_cI > -1) _dgv.Columns[_cI].DefaultCellStyle.BackColor = Color.GreenYellow;
break; break;
@@ -486,7 +479,7 @@ namespace Mip
} }
} }
public static void SetServerIP () public static void SetServerIP()
{ {
System.Net.NetworkInformation.Ping pingIP = new System.Net.NetworkInformation.Ping(); System.Net.NetworkInformation.Ping pingIP = new System.Net.NetworkInformation.Ping();
string IPaddress = ""; string IPaddress = "";
@@ -504,7 +497,7 @@ namespace Mip
} }
else else
{ {
IPaddress = Debugger.IsAttached? "192.168.2.13" : "192.168.1.13"; //IP Adresa MariaDB pre VLAN2 IPaddress = Debugger.IsAttached ? "192.168.2.13" : "192.168.1.13"; //IP Adresa MariaDB pre VLAN2
pingReply = pingIP.Send(IPaddress); pingReply = pingIP.Send(IPaddress);
if (pingReply.Status.ToString() == "Success") if (pingReply.Status.ToString() == "Success")
@@ -514,7 +507,8 @@ namespace Mip
else else
{ {
IPaddress = "127.0.0.1"; //IPaddress = "127.0.0.1";
IPaddress = "192.168.1.11";
pingReply = pingIP.Send(IPaddress); pingReply = pingIP.Send(IPaddress);
if (pingReply.Status.ToString() == "Success") if (pingReply.Status.ToString() == "Success")
{ {
@@ -666,7 +660,7 @@ namespace Mip
break; break;
case "Ziadanka-zobrazit vsetky": case "Ziadanka-zobrazit vsetky":
switch(_IDUSER) switch (_IDUSER)
{ {
case 1: case 1:
case 4: case 4:
@@ -724,7 +718,7 @@ namespace Mip
} }
break; break;
default : default:
bReturnValue = false; bReturnValue = false;
break; break;

View File

@@ -98,9 +98,9 @@
this.groupBox3.Controls.Add(this.label4); this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Controls.Add(this.numericUpDown1); this.groupBox3.Controls.Add(this.numericUpDown1);
this.groupBox3.Controls.Add(this.label3); this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Location = new System.Drawing.Point(234, 2); this.groupBox3.Location = new System.Drawing.Point(236, 7);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(239, 140); this.groupBox3.Size = new System.Drawing.Size(251, 146);
this.groupBox3.TabIndex = 18; this.groupBox3.TabIndex = 18;
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "Tvar a rozmery výrobku"; this.groupBox3.Text = "Tvar a rozmery výrobku";
@@ -109,7 +109,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(116, 121); this.label1.Location = new System.Drawing.Point(124, 121);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(93, 13); this.label1.Size = new System.Drawing.Size(93, 13);
this.label1.TabIndex = 15; this.label1.TabIndex = 15;
@@ -117,7 +117,7 @@
// //
// textBox7 // textBox7
// //
this.textBox7.Location = new System.Drawing.Point(212, 118); this.textBox7.Location = new System.Drawing.Point(219, 118);
this.textBox7.Name = "textBox7"; this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(25, 20); this.textBox7.Size = new System.Drawing.Size(25, 20);
this.textBox7.TabIndex = 16; this.textBox7.TabIndex = 16;
@@ -144,7 +144,7 @@
// //
// textBox4 // textBox4
// //
this.textBox4.Location = new System.Drawing.Point(177, 54); this.textBox4.Location = new System.Drawing.Point(181, 54);
this.textBox4.Name = "textBox4"; this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(60, 20); this.textBox4.Size = new System.Drawing.Size(60, 20);
this.textBox4.TabIndex = 13; this.textBox4.TabIndex = 13;
@@ -153,14 +153,14 @@
// //
// textBox5 // textBox5
// //
this.textBox5.Location = new System.Drawing.Point(34, 118); this.textBox5.Location = new System.Drawing.Point(37, 118);
this.textBox5.Name = "textBox5"; this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(83, 20); this.textBox5.Size = new System.Drawing.Size(83, 20);
this.textBox5.TabIndex = 3; this.textBox5.TabIndex = 3;
// //
// textBox3 // textBox3
// //
this.textBox3.Location = new System.Drawing.Point(112, 54); this.textBox3.Location = new System.Drawing.Point(116, 54);
this.textBox3.Name = "textBox3"; this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(60, 20); this.textBox3.Size = new System.Drawing.Size(60, 20);
this.textBox3.TabIndex = 12; this.textBox3.TabIndex = 12;
@@ -169,7 +169,7 @@
// //
// textBox2 // textBox2
// //
this.textBox2.Location = new System.Drawing.Point(47, 54); this.textBox2.Location = new System.Drawing.Point(51, 54);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(60, 20); this.textBox2.Size = new System.Drawing.Size(60, 20);
this.textBox2.TabIndex = 11; this.textBox2.TabIndex = 11;
@@ -180,7 +180,7 @@
// //
this.textBox1.Location = new System.Drawing.Point(3, 94); this.textBox1.Location = new System.Drawing.Point(3, 94);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(234, 20); this.textBox1.Size = new System.Drawing.Size(241, 20);
this.textBox1.TabIndex = 10; this.textBox1.TabIndex = 10;
this.textBox1.TextAlignChanged += new System.EventHandler(this.textBox1_TextAlignChanged); this.textBox1.TextAlignChanged += new System.EventHandler(this.textBox1_TextAlignChanged);
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
@@ -207,7 +207,7 @@
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(189, 38); this.label6.Location = new System.Drawing.Point(193, 38);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(35, 13); this.label6.Size = new System.Drawing.Size(35, 13);
this.label6.TabIndex = 4; this.label6.TabIndex = 4;
@@ -217,7 +217,7 @@
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(126, 38); this.label5.Location = new System.Drawing.Point(130, 38);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(31, 13); this.label5.Size = new System.Drawing.Size(31, 13);
this.label5.TabIndex = 3; this.label5.TabIndex = 3;
@@ -227,7 +227,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(60, 38); this.label4.Location = new System.Drawing.Point(64, 38);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(34, 13); this.label4.Size = new System.Drawing.Size(34, 13);
this.label4.TabIndex = 2; this.label4.TabIndex = 2;
@@ -325,7 +325,7 @@
// //
this.btnVymazVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnVymazVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnVymazVykres.Enabled = false; this.btnVymazVykres.Enabled = false;
this.btnVymazVykres.Location = new System.Drawing.Point(103, 115); this.btnVymazVykres.Location = new System.Drawing.Point(103, 123);
this.btnVymazVykres.Name = "btnVymazVykres"; this.btnVymazVykres.Name = "btnVymazVykres";
this.btnVymazVykres.Size = new System.Drawing.Size(58, 23); this.btnVymazVykres.Size = new System.Drawing.Size(58, 23);
this.btnVymazVykres.TabIndex = 8; this.btnVymazVykres.TabIndex = 8;
@@ -346,7 +346,7 @@
this.panel1.Controls.Add(this.pictureBox1); this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(3, 17); this.panel1.Location = new System.Drawing.Point(3, 17);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(815, 390); this.panel1.Size = new System.Drawing.Size(1170, 402);
this.panel1.TabIndex = 9; this.panel1.TabIndex = 9;
// //
// pictureBox1 // pictureBox1
@@ -378,7 +378,7 @@
this.dataGridView1.ShowCellToolTips = false; this.dataGridView1.ShowCellToolTips = false;
this.dataGridView1.ShowEditingIcon = false; this.dataGridView1.ShowEditingIcon = false;
this.dataGridView1.ShowRowErrors = false; this.dataGridView1.ShowRowErrors = false;
this.dataGridView1.Size = new System.Drawing.Size(274, 100); this.dataGridView1.Size = new System.Drawing.Size(599, 108);
this.dataGridView1.TabIndex = 4; this.dataGridView1.TabIndex = 4;
this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter); this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint); this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
@@ -388,7 +388,7 @@
// btnAddVykres // btnAddVykres
// //
this.btnAddVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnAddVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAddVykres.Location = new System.Drawing.Point(46, 115); this.btnAddVykres.Location = new System.Drawing.Point(46, 123);
this.btnAddVykres.Name = "btnAddVykres"; this.btnAddVykres.Name = "btnAddVykres";
this.btnAddVykres.Size = new System.Drawing.Size(58, 23); this.btnAddVykres.Size = new System.Drawing.Size(58, 23);
this.btnAddVykres.TabIndex = 5; this.btnAddVykres.TabIndex = 5;
@@ -399,9 +399,9 @@
// button7 // button7
// //
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.button7.Location = new System.Drawing.Point(180, 108); this.button7.Location = new System.Drawing.Point(180, 119);
this.button7.Name = "button7"; this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(51, 34); this.button7.Size = new System.Drawing.Size(51, 28);
this.button7.TabIndex = 26; this.button7.TabIndex = 26;
this.button7.Text = "Zoom -"; this.button7.Text = "Zoom -";
this.button7.UseVisualStyleBackColor = true; this.button7.UseVisualStyleBackColor = true;
@@ -410,7 +410,7 @@
// button3 // button3
// //
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button3.Location = new System.Drawing.Point(752, 117); this.button3.Location = new System.Drawing.Point(1100, 128);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23); this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 23; this.button3.TabIndex = 23;
@@ -422,7 +422,7 @@
// //
this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button5.Enabled = false; this.button5.Enabled = false;
this.button5.Location = new System.Drawing.Point(752, 95); this.button5.Location = new System.Drawing.Point(1100, 102);
this.button5.Name = "button5"; this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23); this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 24; this.button5.TabIndex = 24;
@@ -436,13 +436,12 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.panel1); this.groupBox1.Controls.Add(this.panel1);
this.groupBox1.Location = new System.Drawing.Point(2, 145); this.groupBox1.Location = new System.Drawing.Point(2, 151);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(825, 413); this.groupBox1.Size = new System.Drawing.Size(1180, 425);
this.groupBox1.TabIndex = 19; this.groupBox1.TabIndex = 19;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Zobraziť výkres"; this.groupBox1.Text = "Zobraziť výkres";
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
// //
// groupBox5 // groupBox5
// //
@@ -454,7 +453,7 @@
this.groupBox5.Controls.Add(this.label7); this.groupBox5.Controls.Add(this.label7);
this.groupBox5.Location = new System.Drawing.Point(1, 44); this.groupBox5.Location = new System.Drawing.Point(1, 44);
this.groupBox5.Name = "groupBox5"; this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(232, 62); this.groupBox5.Size = new System.Drawing.Size(232, 74);
this.groupBox5.TabIndex = 22; this.groupBox5.TabIndex = 22;
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "Názov výrobku"; this.groupBox5.Text = "Názov výrobku";
@@ -469,9 +468,9 @@
this.groupBox4.Controls.Add(this.dataGridView1); this.groupBox4.Controls.Add(this.dataGridView1);
this.groupBox4.Controls.Add(this.btnAddVykres); this.groupBox4.Controls.Add(this.btnAddVykres);
this.groupBox4.Controls.Add(this.btnVymazVykres); this.groupBox4.Controls.Add(this.btnVymazVykres);
this.groupBox4.Location = new System.Drawing.Point(474, 2); this.groupBox4.Location = new System.Drawing.Point(489, 7);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(278, 140); this.groupBox4.Size = new System.Drawing.Size(603, 148);
this.groupBox4.TabIndex = 21; this.groupBox4.TabIndex = 21;
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
this.groupBox4.Text = "Načítané výkresy"; this.groupBox4.Text = "Načítané výkresy";
@@ -479,7 +478,7 @@
// btnAktualVykres // btnAktualVykres
// //
this.btnAktualVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnAktualVykres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAktualVykres.Location = new System.Drawing.Point(160, 115); this.btnAktualVykres.Location = new System.Drawing.Point(160, 123);
this.btnAktualVykres.Name = "btnAktualVykres"; this.btnAktualVykres.Name = "btnAktualVykres";
this.btnAktualVykres.Size = new System.Drawing.Size(72, 23); this.btnAktualVykres.Size = new System.Drawing.Size(72, 23);
this.btnAktualVykres.TabIndex = 28; this.btnAktualVykres.TabIndex = 28;
@@ -491,7 +490,7 @@
// //
this.btnIndexDwn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnIndexDwn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnIndexDwn.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.btnIndexDwn.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.btnIndexDwn.Location = new System.Drawing.Point(24, 115); this.btnIndexDwn.Location = new System.Drawing.Point(24, 123);
this.btnIndexDwn.Name = "btnIndexDwn"; this.btnIndexDwn.Name = "btnIndexDwn";
this.btnIndexDwn.Size = new System.Drawing.Size(23, 23); this.btnIndexDwn.Size = new System.Drawing.Size(23, 23);
this.btnIndexDwn.TabIndex = 29; this.btnIndexDwn.TabIndex = 29;
@@ -503,7 +502,7 @@
// //
this.btnIndexUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnIndexUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnIndexUp.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.btnIndexUp.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.btnIndexUp.Location = new System.Drawing.Point(2, 115); this.btnIndexUp.Location = new System.Drawing.Point(2, 123);
this.btnIndexUp.Name = "btnIndexUp"; this.btnIndexUp.Name = "btnIndexUp";
this.btnIndexUp.Size = new System.Drawing.Size(23, 23); this.btnIndexUp.Size = new System.Drawing.Size(23, 23);
this.btnIndexUp.TabIndex = 28; this.btnIndexUp.TabIndex = 28;
@@ -514,7 +513,7 @@
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Location = new System.Drawing.Point(1, 2); this.groupBox2.Location = new System.Drawing.Point(2, 7);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(232, 41); this.groupBox2.Size = new System.Drawing.Size(232, 41);
this.groupBox2.TabIndex = 20; this.groupBox2.TabIndex = 20;
@@ -524,9 +523,9 @@
// button6 // button6
// //
this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.button6.Location = new System.Drawing.Point(130, 108); this.button6.Location = new System.Drawing.Point(130, 119);
this.button6.Name = "button6"; this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(51, 34); this.button6.Size = new System.Drawing.Size(51, 28);
this.button6.TabIndex = 25; this.button6.TabIndex = 25;
this.button6.Text = "Zoom +"; this.button6.Text = "Zoom +";
this.button6.UseVisualStyleBackColor = true; this.button6.UseVisualStyleBackColor = true;
@@ -536,7 +535,8 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(829, 562); this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(1184, 574);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
this.Controls.Add(this.button7); this.Controls.Add(this.button7);

View File

@@ -1,13 +1,11 @@
using System; //using Syncfusion.Pdf.Parsing;
using System.Collections.Generic; using Syncfusion.Pdf.Parsing;
using System.ComponentModel; //using System.Windows.Media.Imaging;
using System;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Windows.Forms;
namespace Mip namespace Mip
{ {
@@ -63,19 +61,19 @@ namespace Mip
public void VypisSpojenyRozmer() public void VypisSpojenyRozmer()
{ {
string strSpojeny = ""; string strSpojeny = "";
string strKonZnak =""; string strKonZnak = "";
if (textBox2.Text != "") if (textBox2.Text != "")
{ {
if(textBox1.Text =="") strKonZnak = ""; if (textBox1.Text == "") strKonZnak = "";
else strKonZnak = " -" + textBox1.Text ; else strKonZnak = " -" + textBox1.Text;
if (numericUpDown1.Value == 0) if (numericUpDown1.Value == 0)
{ {
if (textBox3.Text != "" && textBox3.Text != "0") strSpojeny = label10.Text + textBox2.Text + "/" + textBox3.Text + "x" + textBox4.Text + strKonZnak ; if (textBox3.Text != "" && textBox3.Text != "0") strSpojeny = label10.Text + textBox2.Text + "/" + textBox3.Text + "x" + textBox4.Text + strKonZnak;
else strSpojeny = label10.Text + textBox2.Text + "x" + textBox4.Text + strKonZnak ; else strSpojeny = label10.Text + textBox2.Text + "x" + textBox4.Text + strKonZnak;
} }
else strSpojeny = label10.Text + textBox2.Text + "x" + textBox3.Text + "x" + textBox4.Text + strKonZnak ; else strSpojeny = label10.Text + textBox2.Text + "x" + textBox3.Text + "x" + textBox4.Text + strKonZnak;
} }
else strSpojeny = ""; else strSpojeny = "";
label12.Text = strSpojeny; label12.Text = strSpojeny;
@@ -159,9 +157,11 @@ namespace Mip
DataRow[] foundRows; DataRow[] foundRows;
openFileDialog1.Multiselect = false; openFileDialog1.Multiselect = false;
openFileDialog1.DefaultExt = "jpg"; openFileDialog1.DefaultExt = "jpg";
openFileDialog1.Filter = "Obrázky (*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG;*.EXIF;*.TIFF)|*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG;*.EXIF;*.TIFF|" + "Pdf súbory (*.pdf)|*.pdf";
openFileDialog1.FilterIndex = 1;
openFileDialog1.FileName = ""; openFileDialog1.FileName = "";
openFileDialog1.ShowDialog(); openFileDialog1.ShowDialog();
int _index=0; int _index = 0;
if (openFileDialog1.FileNames != null && openFileDialog1.FileName != "") if (openFileDialog1.FileNames != null && openFileDialog1.FileName != "")
{ {
foreach (string FN in openFileDialog1.FileNames) foreach (string FN in openFileDialog1.FileNames)
@@ -187,7 +187,7 @@ namespace Mip
DTVykresy.Select("IndexVykresu<100", "IndexVykresu DESC"); DTVykresy.Select("IndexVykresu<100", "IndexVykresu DESC");
//ŠTVRTOK //ŠTVRTOK
_index=Convert.ToInt16(foundRows[0].ItemArray[1].ToString())+1; _index = Convert.ToInt16(foundRows[0].ItemArray[1].ToString()) + 1;
DTVykresy.Rows.Add(dataGridView1.Rows[0].Cells["IDVyrobok"].Value.ToString(), //IDVyrobok DTVykresy.Rows.Add(dataGridView1.Rows[0].Cells["IDVyrobok"].Value.ToString(), //IDVyrobok
@@ -202,30 +202,16 @@ namespace Mip
dataGridView1.DataSource = DTVykresy; dataGridView1.DataSource = DTVykresy;
dataGridView1.AutoResizeColumns(); dataGridView1.AutoResizeColumns();
dataGridView1.AutoResizeRows(); dataGridView1.AutoResizeRows();
//dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
//obrazok_Refresh(dataGridView1.Rows.Count - 1);
if (dataGridView1.Rows.Count > 4) dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 4; if (dataGridView1.Rows.Count > 4) dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 4;
} }
else else
{ {
MessageBox.Show("Súbor: " + FN + "\n už v zozname figuruje!", "Upozornenie ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("Súbor: " + FN + "\n už v zozname figuruje!", "Upozornenie ...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//MessageBox.Show(
} }
//Zoradiť tabulku po pridani noveho výkresu a nastavenie selectu nan (POZOR môžu tam byť neaktívne výkresy) //Zoradiť tabulku po pridani noveho výkresu a nastavenie selectu nan (POZOR môžu tam byť neaktívne výkresy)
DataTable pomocDTable = new DataTable(); DataTable pomocDTable = new DataTable();
pomocDTable = DTVykresy.Copy(); pomocDTable = DTVykresy.Copy();
/*foreach (DataRow DT in DTVykresy.Rows)
{
DataRow pomocDT = DT;
pomocDTable.ImportRow(pomocDT);
}
*/
dataGridView1.DataSource = pomocDTable; dataGridView1.DataSource = pomocDTable;
foundRows = pomocDTable.Select("", "IndexVykresu"); foundRows = pomocDTable.Select("", "IndexVykresu");
@@ -236,16 +222,13 @@ namespace Mip
dataGridView1.DataSource = DTVykresy; dataGridView1.DataSource = DTVykresy;
//Nastavenie selectu na pridaný rows //Nastavenie selectu na pridaný rows
int a=0; int a = 0;
for (int p1 = 0; p1 < DTVykresy.Rows.Count;p1++ ) for (int p1 = 0; p1 < DTVykresy.Rows.Count; p1++)
{ {
DataRow DT; DataRow DT;
DT = DTVykresy.Rows[p1]; DT = DTVykresy.Rows[p1];
if (Convert.ToInt32(DT["IndexVykresu"].ToString()) == _index) a=p1; if (Convert.ToInt32(DT["IndexVykresu"].ToString()) == _index) a = p1;
} }
dataGridView1.Rows[a].Selected = true; dataGridView1.Rows[a].Selected = true;
@@ -253,52 +236,19 @@ namespace Mip
pictureBox1.Visible = true; pictureBox1.Visible = true;
btnIndexDwn.Enabled = false; btnAktualVykres.Enabled = false; btnIndexDwn.Enabled = false; btnAktualVykres.Enabled = false;
} }
} }
}
//dataGridView1_SelectionChanged(sender,e);
}//
private void obrazok_Refresh(int index) private void obrazok_Refresh(int index)
{ {
obrazok_Refresh2(index);
/*
FileStream fs;
int fileSize;
byte[] fileData;
//DataRow dRow;
//fs = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read);//
fileSize = (int)fs.Length;
fileData = new byte[fileSize];
fs.Read(fileData, 0, fileSize);
fs.Close();
Bitmap obrazok;
//using (MemoryStream stream = new MemoryStream(fileData)) obrazok = new Bitmap(stream);
MemoryStream stream = new MemoryStream(fileData);
obrazok = new Bitmap(stream);
pictureBox1.Image = obrazok;
pictureBox1.Height = obrazok.Height;
pictureBox1.Width = obrazok.Width;
sizeH = pictureBox1.Image.Size.Height;
sizeW = pictureBox1.Image.Size.Width;
z = 1;
* */
}
private void obrazok_Refresh2(int _index)
{
DataRow dRow; DataRow dRow;
int indexvSQL=0; int indexvSQL = 0;
string typ=""; string typ = "";
dRow = DTVykresy.Rows[_index]; dRow = DTVykresy.Rows[index];
typ = dRow["Názov"].ToString(); typ = dRow["Názov"].ToString();
if (typ == "Z databázy SQL") if (typ == "Z databázy SQL")
@@ -313,28 +263,42 @@ namespace Mip
sizeH = pictureBox1.Image.Size.Height; sizeH = pictureBox1.Image.Size.Height;
sizeW = pictureBox1.Image.Size.Width; sizeW = pictureBox1.Image.Size.Width;
z = 1; z = 1;
} }
if (typ != "Z databázy SQL" && typ!="") if (typ != "Z databázy SQL" && typ != "")
{ {
FileStream fs; FileStream fs;
int fileSize; int fileSize;
byte[] fileData; byte[] fileData;
//DataRow dRow;
//dRow = DTVykresy.Rows[_index]; var ExtensionStart = typ.LastIndexOf(".") + 1;
var Extension = typ.Substring(ExtensionStart, typ.Length - ExtensionStart);
fs = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read);// fs = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read);//
fileSize = (int)fs.Length; fileSize = (int)fs.Length;
fileData = new byte[fileSize]; fileData = new byte[fileSize];
fs.Read(fileData, 0, fileSize); fs.Read(fileData, 0, fileSize);
var fileToShow = new byte[fileSize];
if (Extension.ToLower() == "pdf")
{
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileData);
Bitmap pdfToJpeg = loadedDocument.ExportAsImage(0);
loadedDocument.Close(true);
fileToShow = SaveAsJpeg(pdfToJpeg);
}
else
{
fileToShow = fileData;
}
fs.Close(); fs.Close();
Bitmap obrazok; MemoryStream stream = new MemoryStream(fileToShow);
//using (MemoryStream stream = new MemoryStream(fileData)) obrazok = new Bitmap(stream); var obrazok = new Bitmap(stream);
MemoryStream stream = new MemoryStream(fileData);
obrazok = new Bitmap(stream);
pictureBox1.Image = obrazok; pictureBox1.Image = obrazok;
pictureBox1.Height = obrazok.Height; pictureBox1.Height = obrazok.Height;
pictureBox1.Width = obrazok.Width; pictureBox1.Width = obrazok.Width;
@@ -344,9 +308,21 @@ namespace Mip
} }
} }
private byte[] SaveAsJpeg(Bitmap image)
{
byte[] returnImageData;
using (var stream = new MemoryStream())
{
image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
returnImageData = stream.ToArray();
}
return returnImageData;
}
private void dataGridView1_SelectionChanged(object sender, EventArgs e) private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{ {
if (dataGridView1.DataSource != null && dataGridView1.SelectedRows.Count>0 && deleteRow!=true ) if (dataGridView1.DataSource != null && dataGridView1.SelectedRows.Count > 0 && deleteRow != true)
{ {
@@ -434,18 +410,12 @@ namespace Mip
//dataGridView1.DataSource=DTVykresy(); //dataGridView1.DataSource=DTVykresy();
for (int p1 = 0; p1 < DTVykresy.Rows.Count; p1++) for (int p1 = 0; p1 < DTVykresy.Rows.Count; p1++)
{ {
if (Convert.ToInt32( dataGridView1.Rows[p1].Cells["IndexVykresu"].Value.ToString())== indexvykresu) if (Convert.ToInt32(dataGridView1.Rows[p1].Cells["IndexVykresu"].Value.ToString()) == indexvykresu)
{ {
dataGridView1.Rows[p1].Selected=true; dataGridView1.Rows[p1].Selected = true;
break; break;
} }
} }
} }
@@ -458,7 +428,6 @@ namespace Mip
{ {
DataGridViewRow Row; DataGridViewRow Row;
//Row = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
Row = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index]; Row = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index];
//Pre aktuálne výkresy nastav NEAKTUÁLNY //Pre aktuálne výkresy nastav NEAKTUÁLNY
@@ -492,32 +461,15 @@ namespace Mip
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = indexLastActiv + 1; DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = indexLastActiv + 1;
zoradDTGView(); zoradDTGView();
} }
} }
/*
DataRow[] foundRows;
foundRows = DTVykresy.Select("IndexVykresu>100", "IndexVykresu DESC");
if (foundRows.Length == 0) DTVykresy.Rows[dataGridView1.CurrentRow.Index]["IndexVykresu"] = 101;
else DTVykresy.Rows[dataGridView1.CurrentRow.Index]["IndexVykresu"] = Convert.ToInt32(foundRows[0].ItemArray[1].ToString()) + 1;
DTVykresy.Rows[dataGridView1.CurrentRow.Index]["StatusVykresu"] = "NEAKTUÁLNY";
foundRows = DTVykresy.Select("", "IndexVykresu");
*/
} }
private void btnIndexUp_Click(object sender, EventArgs e) private void btnIndexUp_Click(object sender, EventArgs e)
{ {
int oldindexvykresu; int oldindexvykresu;
oldindexvykresu = Convert.ToInt32(dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value); oldindexvykresu = Convert.ToInt32(dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value);
//dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value = dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index) - 1].Value;
//dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index) - 1].Value = oldindexvykresu;
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = DTVykresy.Rows[dataGridView1.SelectedRows[0].Index-1]["IndexVykresu"]; DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = DTVykresy.Rows[dataGridView1.SelectedRows[0].Index - 1]["IndexVykresu"];
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index - 1]["IndexVykresu"] = oldindexvykresu; DTVykresy.Rows[dataGridView1.SelectedRows[0].Index - 1]["IndexVykresu"] = oldindexvykresu;
zoradDTGView(); zoradDTGView();
@@ -526,10 +478,7 @@ namespace Mip
private void btnIndexDwn_Click(object sender, EventArgs e) private void btnIndexDwn_Click(object sender, EventArgs e)
{ {
int oldindexvykresu; int oldindexvykresu;
oldindexvykresu = Convert.ToInt32(dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value); oldindexvykresu = Convert.ToInt32(dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value);
//dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index)].Value = dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index) + 1].Value;
//dataGridView1["IndexVykresu", (dataGridView1.SelectedRows[0].Index) + 1].Value = oldindexvykresu;
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = DTVykresy.Rows[dataGridView1.SelectedRows[0].Index + 1]["IndexVykresu"]; DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = DTVykresy.Rows[dataGridView1.SelectedRows[0].Index + 1]["IndexVykresu"];
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index + 1]["IndexVykresu"] = oldindexvykresu; DTVykresy.Rows[dataGridView1.SelectedRows[0].Index + 1]["IndexVykresu"] = oldindexvykresu;
@@ -561,80 +510,32 @@ namespace Mip
{ {
string cmd; string cmd;
DataTable dtbl; DataTable dtbl;
classGlobal.strNovyPomocnyUdaj = textBox6.Text; //pomocný údaj pre naplnenie comboboxu po zavreti okna classGlobal.strNovyPomocnyUdaj = textBox6.Text; //pomocný údaj pre naplnenie comboboxu po zavreti okna
if (textBox7.Text == "") textBox7.Text = "1"; // Ak je pocet segmentov "" tak potom je 1 if (textBox7.Text == "") textBox7.Text = "1"; // Ak je pocet segmentov "" tak potom je 1
/* MENIME NA UPDATE
cmd = "INSERT INTO `mip`.`tabvyrobok` (`NazovVyrobku`, `RozmerTvar`, `Rozmer1`, `Rozmer2`, `Rozmer3`, `SpojeneRozmery`, `Zakaznik`, `InyNazov`, `RozlisZnakKonecnaOp`, `Alias`,`PocetSegmentov`) VALUES ('"
+ textBox6.Text.ToString() + "', '" //NazovVyrobku*
+ label10.Text.ToString() + "', " //RozmerTvar
+ textBox2.Text.ToString().Replace(",",".") + ", " //rozmer1
+ textBox3.Text.ToString().Replace(",", ".") + "," //rozmer2
+ textBox4.Text.ToString().Replace(",", ".") + ", '" //rozmer3
+ label12.Text.ToString() + "', '" //spojene rozmery*
+ label2.Text.ToString() + "', '" //zakaznik*
+ comboBox2.Text.ToString() + "', '" //Iny nazov*
+ textBox1.Text.ToString() + "', '" //rozlis znak alebo konecna operacia*
+ textBox5.Text.ToString() + "', " //alias*
+ textBox7.Text.ToString() + ");"; //Pocet segmetnov
cmd = @"UPDATE `mip`.`tabvyrobok` SET "
+ "`NazovVyrobku`='" + textBox6.Text.ToString() + "'," //NazovVyrobku*
+ "`RozmerTvar`='" + label10.Text.ToString() + "'," //RozmerTvar
+ "`Rozmer1`=" + textBox2.Text.ToString().Replace(",", ".") + "," //rozmer1
+ "`Rozmer2`=" + textBox3.Text.ToString().Replace(",", ".") + "," //rozmer2
+ "`Rozmer3`=" + textBox4.Text.ToString().Replace(",", ".") + "," //rozmer3
+ "`SpojeneRozmery`='" + label12.Text.ToString() + "'," //Spojené rozmery*
+ "`Zakaznik`='" + label2.Text.ToString() + "'," //zakaznik*
+ "`InyNazov`='" + comboBox2.Text.ToString() + "'," //Iny nazov*
+ "`RozlisZnakKonecnaOp`='" + textBox1.Text.ToString() + "'," //rozlis znak alebo konecna operacia*
+ "`Alias`='" + textBox5.Text.ToString() + "'," //alias*
+ "`PocetSegmentov`=" + textBox7.Text.ToString() //pocet segmentnov
+ " WHERE (`IDVyrobok`="
+ IDVyrobok + ");";
dtbl=classSQL.commandSQL(cmd,1); classSQL.SQL(cmd, out dtbl);
*/
cmd = @"UPDATE `mip`.`tabvyrobok` SET "
+ "`NazovVyrobku`='" + textBox6.Text.ToString() + "'," //NazovVyrobku*
+ "`RozmerTvar`='" + label10.Text.ToString() + "'," //RozmerTvar
+"`Rozmer1`=" + textBox2.Text.ToString().Replace(",", ".") + "," //rozmer1
+"`Rozmer2`=" + textBox3.Text.ToString().Replace(",", ".") + "," //rozmer2
+"`Rozmer3`=" + textBox4.Text.ToString().Replace(",", ".") + "," //rozmer3
+ "`SpojeneRozmery`='" + label12.Text.ToString() + "'," //Spojené rozmery*
+ "`Zakaznik`='" + label2.Text.ToString() + "'," //zakaznik*
+ "`InyNazov`='" + comboBox2.Text.ToString() + "'," //Iny nazov*
+ "`RozlisZnakKonecnaOp`='" + textBox1.Text.ToString() + "'," //rozlis znak alebo konecna operacia*
+ "`Alias`='" + textBox5.Text.ToString() + "'," //alias*
+"`PocetSegmentov`=" + textBox7.Text.ToString() //pocet segmentnov
+ " WHERE (`IDVyrobok`="
+ IDVyrobok+");";
classSQL.SQL(cmd,out dtbl);
//================== Zistuje IDVykresu podla PridatVykres ======================================
/*
// <Pridať výkresovú dokumentáciu do tabvykresy>
int intIDVyrobok;
//classSQL.commandSQL("SELECT `IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text + "';");
// IDVyrobok = (int)classSQL.dTable.Rows[0]["IDVyrobok"];
string ccmmdd = "SELECT `NazovVyrobku`,`IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text
+ "' AND `NazovVyrobku` = '" + textBox6.Text + "';";
dtbl=classSQL.commandSQL(ccmmdd,1);
DataRow dtrw = dtbl.Rows[0];
intIDVyrobok = Convert.ToInt32(dtrw["IDVyrobok"].ToString());
*/
int intIDVyrobok; int intIDVyrobok;
DataRow dtrw; DataRow dtrw;
intIDVyrobok = Convert.ToInt32(IDVyrobok); intIDVyrobok = Convert.ToInt32(IDVyrobok);
/* for (int p1 = 0; p1 < DTVykresy.Rows.Count; p1++)
string ccmmdd = "SELECT `NazovVyrobku`,`IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text
+ "' AND `NazovVyrobku` = '" + textBox6.Text + "';";
dtbl = classSQL.commandSQL(ccmmdd, 1);
DataRow dtrw = dtbl.Rows[0];
*/
for (int p1=0; p1 < DTVykresy.Rows.Count; p1++)
{ {
FileStream fs; FileStream fs;
int fileSize; int fileSize;
@@ -647,15 +548,14 @@ namespace Mip
{ {
if (dtrw["IndexVykresu"].ToString() != dtrw["OldIndexVykresu"].ToString()) if (dtrw["IndexVykresu"].ToString() != dtrw["OldIndexVykresu"].ToString())
{ {
cmd = @"UPDATE `mip`.`tabvykres` SET " cmd = @"UPDATE `mip`.`tabvykres` SET "
+ "`IndexVykresu`=" + Convert.ToInt32(dtrw["IndexVykresu"].ToString()) + "`IndexVykresu`=" + Convert.ToInt32(dtrw["IndexVykresu"].ToString())
+ " WHERE (`IDVykres`=" + " WHERE (`IDVykres`="
+ Convert.ToInt32(dtrw["IDVykres"].ToString()) + ");" ; + Convert.ToInt32(dtrw["IDVykres"].ToString()) + ");";
classSQL.SQL(cmd, out dtbl); classSQL.SQL(cmd, out dtbl);
} }
} }
else else
{ {
@@ -663,20 +563,34 @@ namespace Mip
fileSize = (int)fs.Length; fileSize = (int)fs.Length;
VykresData = new byte[fileSize]; VykresData = new byte[fileSize];
fs.Read(VykresData, 0, fileSize); fs.Read(VykresData, 0, fileSize);
var ExtensionStart = dtrw["Cesta"].ToString().LastIndexOf(".") + 1;
var Extension = dtrw["Cesta"].ToString().Substring(ExtensionStart, dtrw["Cesta"].ToString().Length - ExtensionStart);
var fileToShow = new byte[fileSize];
if (Extension.ToLower() == "pdf")
{
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(VykresData);
Bitmap pdfToJpeg = loadedDocument.ExportAsImage(0);
loadedDocument.Close(true);
fileToShow = SaveAsJpeg(pdfToJpeg);
}
else
{
fileToShow = VykresData;
}
fs.Close(); fs.Close();
classSQL.SaveVykresToSQL(intIDVyrobok, Convert.ToInt32(dtrw["IndexVykresu"].ToString()), VykresData); classSQL.SaveVykresToSQL(intIDVyrobok, Convert.ToInt32(dtrw["IndexVykresu"].ToString()), fileToShow);
} }
} }
MessageBox.Show("Výrobok úspešne aktualizovaný!"); MessageBox.Show("Výrobok úspešne aktualizovaný!");
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();
// </Pridať výkresovú dokumentáciu do tabvykresy> // </Pridať výkresovú dokumentáciu do tabvykresy>
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,9 @@
using System; using Syncfusion.Pdf.Parsing;
using System.Collections.Generic; using System;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO; using System.IO;
using Syncfusion.Pdf.Parsing; using System.Windows.Forms;
using System.Drawing.Imaging;
namespace Mip namespace Mip
@@ -18,25 +12,25 @@ namespace Mip
{ {
DataTable pomocnaDT = new DataTable(); DataTable pomocnaDT = new DataTable();
Point poinPosition; Point poinPosition;
bool deleteRow=false; bool deleteRow = false;
Single z=1; Single z = 1;
int sizeH; int sizeH;
int sizeW; int sizeW;
string IDVyrobok; string IDVyrobok;
DataTable DTVykresy = new DataTable(); DataTable DTVykresy = new DataTable();
public frmPridatVyrobok(string strZakaznik, string idVyrobok = null) public frmPridatVyrobok(string strZakaznik, string idVyrobok = null)
{ {
InitializeComponent(); InitializeComponent();
label2.Text = strZakaznik; label2.Text = strZakaznik;
IDVyrobok = idVyrobok; IDVyrobok = idVyrobok;
this.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel); this.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
} }
private void pictureBox1_MouseWheel(object sender, MouseEventArgs e) private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
{ {
if(pictureBox1.Image != null) if (pictureBox1.Image != null)
{ {
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
z += (Convert.ToSingle(0.1) * (e.Delta / Math.Abs(e.Delta))); z += (Convert.ToSingle(0.1) * (e.Delta / Math.Abs(e.Delta)));
@@ -53,52 +47,52 @@ namespace Mip
private void frmPridatVyrobok_Load(object sender, EventArgs e) private void frmPridatVyrobok_Load(object sender, EventArgs e)
{ {
pomocnaDT.Columns.Add("Nazov_suboru",typeof (string)); pomocnaDT.Columns.Add("Nazov_suboru", typeof(string));
pomocnaDT.Columns.Add("Velkost_suboru",typeof (string)); pomocnaDT.Columns.Add("Velkost_suboru", typeof(string));
pomocnaDT.Columns.Add("Typ_suboru", typeof(string)); pomocnaDT.Columns.Add("Typ_suboru", typeof(string));
pomocnaDT.Columns.Add("Cesta",typeof (string)); pomocnaDT.Columns.Add("Cesta", typeof(string));
pomocnaDT.Columns.Add("Data", typeof(string)); pomocnaDT.Columns.Add("Data", typeof(string));
pomocnaDT.Columns.Add("Valid", typeof(int)); pomocnaDT.Columns.Add("Valid", typeof(int));
VypisSpojenyRozmer(); VypisSpojenyRozmer();
classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov"); classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov");
if (IDVyrobok != null) //if (IDVyrobok != null)
{ //{
LoadEditData(); // LoadEditData();
} //}
} }
private void LoadEditData() //private void LoadEditData()
{ //{
DataTable DTEditVyrobok = new DataTable(); // DataTable DTEditVyrobok = new DataTable();
//dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString() // //dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString()
classSQL.SQL("SELECT * FROM tabvyrobok WHERE `IDVyrobok` = " + IDVyrobok + ";", out DTEditVyrobok); // classSQL.SQL("SELECT * FROM tabvyrobok WHERE `IDVyrobok` = " + IDVyrobok + ";", out DTEditVyrobok);
label2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Zakaznik"].Ordinal].ToString(); // label2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Zakaznik"].Ordinal].ToString();
textBox6.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["NazovVyrobku"].Ordinal].ToString(); // textBox6.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["NazovVyrobku"].Ordinal].ToString();
comboBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["InyNazov"].Ordinal].ToString(); // comboBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["InyNazov"].Ordinal].ToString();
if (DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozmerTvar"].Ordinal].ToString() == "Ø") numericUpDown1.Value = 0; // if (DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozmerTvar"].Ordinal].ToString() == "Ø") numericUpDown1.Value = 0;
else numericUpDown1.Value = 1; // else numericUpDown1.Value = 1;
textBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer1"].Ordinal].ToString(); // textBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer1"].Ordinal].ToString();
textBox3.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer2"].Ordinal].ToString(); // textBox3.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer2"].Ordinal].ToString();
textBox4.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer3"].Ordinal].ToString(); // textBox4.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer3"].Ordinal].ToString();
textBox1.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozlisZnakKonecnaOp"].Ordinal].ToString(); // textBox1.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozlisZnakKonecnaOp"].Ordinal].ToString();
textBox5.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Alias"].Ordinal].ToString(); // textBox5.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Alias"].Ordinal].ToString();
textBox7.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["PocetSegmentov"].Ordinal].ToString(); // textBox7.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["PocetSegmentov"].Ordinal].ToString();
VypisSpojenyRozmer(); // VypisSpojenyRozmer();
string cmd = @"SELECT `IDVyrobok`, // string cmd = @"SELECT `IDVyrobok`,
`IndexVykresu`, // `IndexVykresu`,
`IndexVykresu` AS `OldIndexVykresu`, // `IndexVykresu` AS `OldIndexVykresu`,
'Z databázy SQL' AS `Názov`, // 'Z databázy SQL' AS `Názov`,
'-' AS `Cesta`, // '-' AS `Cesta`,
`IDVykres`, // `IDVykres`,
IF (`IndexVykresu` < 100, 'Aktuálny','Neaktuálny') AS `StatusVykresu` // IF (`IndexVykresu` < 100, 'Aktuálny','Neaktuálny') AS `StatusVykresu`
FROM `mip`.`tabvykres` WHERE `IDVyrobok` = " + IDVyrobok + " ORDER BY `IndexVykresu` ;"; // FROM `mip`.`tabvykres` WHERE `IDVyrobok` = " + IDVyrobok + " ORDER BY `IndexVykresu` ;";
classSQL.SQL(cmd, out DTVykresy); // classSQL.SQL(cmd, out DTVykresy);
dataGridView1.DataSource = DTVykresy; // dataGridView1.DataSource = DTVykresy;
} //}
private void btnAddVykres_Click(object sender, EventArgs e) private void btnAddVykres_Click(object sender, EventArgs e)
{ {
@@ -209,7 +203,7 @@ namespace Mip
obrazok_Refresh(currentRowIndex); obrazok_Refresh(currentRowIndex);
pictureBox1.Visible = true; pictureBox1.Visible = true;
} }
if (textBox6.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && dataGridView1.Rows.Count !=0) button5.Enabled = true; if (textBox6.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && dataGridView1.Rows.Count != 0) button5.Enabled = true;
else button5.Enabled = false; //kontrola naplnenia povinných dát else button5.Enabled = false; //kontrola naplnenia povinných dát
} }
@@ -246,12 +240,12 @@ namespace Mip
DataRow dRow; DataRow dRow;
if (pomocnaDT.Rows.Count != 0) if (pomocnaDT.Rows.Count != 0)
{ {
dRow = pomocnaDT.Rows[index]; dRow = pomocnaDT.Rows[index];
var isPdf = dRow["Typ_suboru"].ToString() == "pdf"; var isPdf = dRow["Typ_suboru"].ToString() == "pdf";
var isValid = dRow["Valid"].ToString() == "1"; var isValid = dRow["Valid"].ToString() == "1";
if(isValid) if (isValid)
{ {
if (isPdf) if (isPdf)
{ {
@@ -316,19 +310,19 @@ namespace Mip
public void VypisSpojenyRozmer() public void VypisSpojenyRozmer()
{ {
string strSpojeny = ""; string strSpojeny = "";
string strKonZnak =""; string strKonZnak = "";
if (textBox2.Text != "") if (textBox2.Text != "")
{ {
if(textBox1.Text =="") strKonZnak = ""; if (textBox1.Text == "") strKonZnak = "";
else strKonZnak = " -" + textBox1.Text ; else strKonZnak = " -" + textBox1.Text;
if (numericUpDown1.Value == 0) if (numericUpDown1.Value == 0)
{ {
if (textBox3.Text != "" && textBox3.Text != "0") strSpojeny = label10.Text + textBox2.Text + "/" + textBox3.Text + "x" + textBox4.Text + strKonZnak ; if (textBox3.Text != "" && textBox3.Text != "0") strSpojeny = label10.Text + textBox2.Text + "/" + textBox3.Text + "x" + textBox4.Text + strKonZnak;
else strSpojeny = label10.Text + textBox2.Text + "x" + textBox4.Text + strKonZnak ; else strSpojeny = label10.Text + textBox2.Text + "x" + textBox4.Text + strKonZnak;
} }
else strSpojeny = label10.Text + textBox2.Text + "x" + textBox3.Text + "x" + textBox4.Text + strKonZnak ; else strSpojeny = label10.Text + textBox2.Text + "x" + textBox3.Text + "x" + textBox4.Text + strKonZnak;
} }
else strSpojeny = ""; else strSpojeny = "";
label12.Text = strSpojeny; label12.Text = strSpojeny;
@@ -464,8 +458,8 @@ namespace Mip
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
Point changePoint = new Point (e.Location.X - poinPosition.X, e.Location.Y - poinPosition.Y); Point changePoint = new Point(e.Location.X - poinPosition.X, e.Location.Y - poinPosition.Y);
panel1.AutoScrollPosition = new Point(-panel1.AutoScrollPosition.X - changePoint.X, -panel1.AutoScrollPosition.Y - changePoint.Y); panel1.AutoScrollPosition = new Point(-panel1.AutoScrollPosition.X - changePoint.X, -panel1.AutoScrollPosition.Y - changePoint.Y);
} }
} }
@@ -533,7 +527,7 @@ namespace Mip
+ "' AND `NazovVyrobku` = '" + textBox6.Text + "';", out dtbl); + "' AND `NazovVyrobku` = '" + textBox6.Text + "';", out dtbl);
if (dtbl.Rows.Count != 0) MessageBox.Show("Výrobok s názvom: \n " + textBox6.Text + "\n v datábáze výrobkov odberateľa " + label2.Text + " už existuje!!!\n Prosím zmeňte názov výrobku", "Pozor ... ", if (dtbl.Rows.Count != 0) MessageBox.Show("Výrobok s názvom: \n " + textBox6.Text + "\n v datábáze výrobkov odberateľa " + label2.Text + " už existuje!!!\n Prosím zmeňte názov výrobku", "Pozor ... ",
MessageBoxButtons.OK,MessageBoxIcon.Warning); //Ak sa výrobok v databaze uz nachádza MessageBoxButtons.OK, MessageBoxIcon.Warning); //Ak sa výrobok v databaze uz nachádza
else // ak sa výrobok v dtbaze nenachádza tak ho pridať else // ak sa výrobok v dtbaze nenachádza tak ho pridať
{ {
classGlobal.strNovyPomocnyUdaj = textBox6.Text; //pomocný údaj pre naplnenie comboboxu po zavreti okna classGlobal.strNovyPomocnyUdaj = textBox6.Text; //pomocný údaj pre naplnenie comboboxu po zavreti okna
@@ -545,7 +539,7 @@ namespace Mip
cmd = "INSERT INTO `mip`.`tabvyrobok` (`NazovVyrobku`, `RozmerTvar`, `Rozmer1`, `Rozmer2`, `Rozmer3`, `SpojeneRozmery`, `Zakaznik`, `InyNazov`, `RozlisZnakKonecnaOp`, `Alias`,`PocetSegmentov`, `Status výrobku`) VALUES ('" cmd = "INSERT INTO `mip`.`tabvyrobok` (`NazovVyrobku`, `RozmerTvar`, `Rozmer1`, `Rozmer2`, `Rozmer3`, `SpojeneRozmery`, `Zakaznik`, `InyNazov`, `RozlisZnakKonecnaOp`, `Alias`,`PocetSegmentov`, `Status výrobku`) VALUES ('"
+ textBox6.Text.ToString() + "', '" //NazovVyrobku + textBox6.Text.ToString() + "', '" //NazovVyrobku
+ label10.Text.ToString() + "', " //RozmerTvar + label10.Text.ToString() + "', " //RozmerTvar
+ textBox2.Text.ToString().Replace(",",".") + ", " //rozmer1 + textBox2.Text.ToString().Replace(",", ".") + ", " //rozmer1
+ textBox3.Text.ToString().Replace(",", ".") + "," //rozmer2 + textBox3.Text.ToString().Replace(",", ".") + "," //rozmer2
+ textBox4.Text.ToString().Replace(",", ".") + ", '" //rozmer3 + textBox4.Text.ToString().Replace(",", ".") + ", '" //rozmer3
+ label12.Text.ToString() + "', '" //spojene rozmery + label12.Text.ToString() + "', '" //spojene rozmery
@@ -562,7 +556,7 @@ namespace Mip
// <Pridať výkresovú dokumentáciu do tabvykresy> // <Pridať výkresovú dokumentáciu do tabvykresy>
int IDVyrobok; int IDVyrobok;
//classSQL.commandSQL("SELECT `IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text + "';"); //classSQL.commandSQL("SELECT `IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text + "';");
// IDVyrobok = (int)classSQL.dTable.Rows[0]["IDVyrobok"]; // IDVyrobok = (int)classSQL.dTable.Rows[0]["IDVyrobok"];
string ccmmdd = "SELECT `NazovVyrobku`,`IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text string ccmmdd = "SELECT `NazovVyrobku`,`IDVyrobok` FROM `mip`.`tabvyrobok` WHERE `Zakaznik`= '" + label2.Text
+ "' AND `NazovVyrobku` = '" + textBox6.Text + "';"; + "' AND `NazovVyrobku` = '" + textBox6.Text + "';";
@@ -573,16 +567,16 @@ namespace Mip
var indexVykresu = 1; var indexVykresu = 1;
for (int p1=0; p1 < pomocnaDT.Rows.Count; p1++) for (int p1 = 0; p1 < pomocnaDT.Rows.Count; p1++)
{ {
FileStream fs; FileStream fs;
int fileSize; int fileSize;
byte[] VykresData; byte[] VykresData;
dtrw=pomocnaDT.Rows[p1]; dtrw = pomocnaDT.Rows[p1];
var isValid = dtrw["Valid"].ToString() == "1"; var isValid = dtrw["Valid"].ToString() == "1";
if(isValid) if (isValid)
{ {
fs = new FileStream(dtrw["Cesta"].ToString(), FileMode.Open, FileAccess.Read); fs = new FileStream(dtrw["Cesta"].ToString(), FileMode.Open, FileAccess.Read);
fileSize = (int)fs.Length; fileSize = (int)fs.Length;
@@ -670,7 +664,7 @@ namespace Mip
*/ */
if((int)e.KeyChar!=8) foreach (char znak in Path.GetInvalidFileNameChars()) if (e.KeyChar == znak) e.KeyChar = '\0'; if ((int)e.KeyChar != 8) foreach (char znak in Path.GetInvalidFileNameChars()) if (e.KeyChar == znak) e.KeyChar = '\0';
} }