Editácia výrovku s pdf
This commit is contained in:
Binary file not shown.
@@ -1,15 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Excel = Microsoft.Office.Interop.Excel;
|
||||
|
||||
@@ -514,7 +507,8 @@ namespace Mip
|
||||
else
|
||||
{
|
||||
|
||||
IPaddress = "127.0.0.1";
|
||||
//IPaddress = "127.0.0.1";
|
||||
IPaddress = "192.168.1.11";
|
||||
pingReply = pingIP.Send(IPaddress);
|
||||
if (pingReply.Status.ToString() == "Success")
|
||||
{
|
||||
|
||||
66
Mip/frmEditVyrobok.Designer.cs
generated
66
Mip/frmEditVyrobok.Designer.cs
generated
@@ -98,9 +98,9 @@
|
||||
this.groupBox3.Controls.Add(this.label4);
|
||||
this.groupBox3.Controls.Add(this.numericUpDown1);
|
||||
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.Size = new System.Drawing.Size(239, 140);
|
||||
this.groupBox3.Size = new System.Drawing.Size(251, 146);
|
||||
this.groupBox3.TabIndex = 18;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Tvar a rozmery výrobku";
|
||||
@@ -109,7 +109,7 @@
|
||||
// label1
|
||||
//
|
||||
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.Size = new System.Drawing.Size(93, 13);
|
||||
this.label1.TabIndex = 15;
|
||||
@@ -117,7 +117,7 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(25, 20);
|
||||
this.textBox7.TabIndex = 16;
|
||||
@@ -144,7 +144,7 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(60, 20);
|
||||
this.textBox4.TabIndex = 13;
|
||||
@@ -153,14 +153,14 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(83, 20);
|
||||
this.textBox5.TabIndex = 3;
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(60, 20);
|
||||
this.textBox3.TabIndex = 12;
|
||||
@@ -169,7 +169,7 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(60, 20);
|
||||
this.textBox2.TabIndex = 11;
|
||||
@@ -180,7 +180,7 @@
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(3, 94);
|
||||
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.TextAlignChanged += new System.EventHandler(this.textBox1_TextAlignChanged);
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
@@ -207,7 +207,7 @@
|
||||
// label6
|
||||
//
|
||||
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.Size = new System.Drawing.Size(35, 13);
|
||||
this.label6.TabIndex = 4;
|
||||
@@ -217,7 +217,7 @@
|
||||
// label5
|
||||
//
|
||||
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.Size = new System.Drawing.Size(31, 13);
|
||||
this.label5.TabIndex = 3;
|
||||
@@ -227,7 +227,7 @@
|
||||
// label4
|
||||
//
|
||||
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.Size = new System.Drawing.Size(34, 13);
|
||||
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.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.Size = new System.Drawing.Size(58, 23);
|
||||
this.btnVymazVykres.TabIndex = 8;
|
||||
@@ -346,7 +346,7 @@
|
||||
this.panel1.Controls.Add(this.pictureBox1);
|
||||
this.panel1.Location = new System.Drawing.Point(3, 17);
|
||||
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;
|
||||
//
|
||||
// pictureBox1
|
||||
@@ -378,7 +378,7 @@
|
||||
this.dataGridView1.ShowCellToolTips = false;
|
||||
this.dataGridView1.ShowEditingIcon = 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.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
|
||||
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
|
||||
@@ -388,7 +388,7 @@
|
||||
// btnAddVykres
|
||||
//
|
||||
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.Size = new System.Drawing.Size(58, 23);
|
||||
this.btnAddVykres.TabIndex = 5;
|
||||
@@ -399,9 +399,9 @@
|
||||
// button7
|
||||
//
|
||||
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.Size = new System.Drawing.Size(51, 34);
|
||||
this.button7.Size = new System.Drawing.Size(51, 28);
|
||||
this.button7.TabIndex = 26;
|
||||
this.button7.Text = "Zoom -";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
@@ -410,7 +410,7 @@
|
||||
// button3
|
||||
//
|
||||
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.Size = new System.Drawing.Size(75, 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.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.Size = new System.Drawing.Size(75, 23);
|
||||
this.button5.TabIndex = 24;
|
||||
@@ -436,13 +436,12 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
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.Size = new System.Drawing.Size(825, 413);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1180, 425);
|
||||
this.groupBox1.TabIndex = 19;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Zobraziť výkres";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
@@ -454,7 +453,7 @@
|
||||
this.groupBox5.Controls.Add(this.label7);
|
||||
this.groupBox5.Location = new System.Drawing.Point(1, 44);
|
||||
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.TabStop = false;
|
||||
this.groupBox5.Text = "Názov výrobku";
|
||||
@@ -469,9 +468,9 @@
|
||||
this.groupBox4.Controls.Add(this.dataGridView1);
|
||||
this.groupBox4.Controls.Add(this.btnAddVykres);
|
||||
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.Size = new System.Drawing.Size(278, 140);
|
||||
this.groupBox4.Size = new System.Drawing.Size(603, 148);
|
||||
this.groupBox4.TabIndex = 21;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "Načítané výkresy";
|
||||
@@ -479,7 +478,7 @@
|
||||
// btnAktualVykres
|
||||
//
|
||||
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.Size = new System.Drawing.Size(72, 23);
|
||||
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.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.Size = new System.Drawing.Size(23, 23);
|
||||
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.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.Size = new System.Drawing.Size(23, 23);
|
||||
this.btnIndexUp.TabIndex = 28;
|
||||
@@ -514,7 +513,7 @@
|
||||
// groupBox2
|
||||
//
|
||||
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.Size = new System.Drawing.Size(232, 41);
|
||||
this.groupBox2.TabIndex = 20;
|
||||
@@ -524,9 +523,9 @@
|
||||
// button6
|
||||
//
|
||||
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.Size = new System.Drawing.Size(51, 34);
|
||||
this.button6.Size = new System.Drawing.Size(51, 28);
|
||||
this.button6.TabIndex = 25;
|
||||
this.button6.Text = "Zoom +";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
@@ -536,7 +535,8 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
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.groupBox3);
|
||||
this.Controls.Add(this.button7);
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
//using Syncfusion.Pdf.Parsing;
|
||||
using Syncfusion.Pdf.Parsing;
|
||||
//using System.Windows.Media.Imaging;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mip
|
||||
{
|
||||
@@ -159,6 +157,8 @@ namespace Mip
|
||||
DataRow[] foundRows;
|
||||
openFileDialog1.Multiselect = false;
|
||||
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.ShowDialog();
|
||||
int _index = 0;
|
||||
@@ -202,30 +202,16 @@ namespace Mip
|
||||
dataGridView1.DataSource = DTVykresy;
|
||||
dataGridView1.AutoResizeColumns();
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
|
||||
|
||||
|
||||
DataTable pomocDTable = new DataTable();
|
||||
pomocDTable = DTVykresy.Copy();
|
||||
/*foreach (DataRow DT in DTVykresy.Rows)
|
||||
{
|
||||
DataRow pomocDT = DT;
|
||||
pomocDTable.ImportRow(pomocDT);
|
||||
}
|
||||
*/
|
||||
dataGridView1.DataSource = pomocDTable;
|
||||
|
||||
foundRows = pomocDTable.Select("", "IndexVykresu");
|
||||
@@ -243,9 +229,6 @@ namespace Mip
|
||||
DataRow DT;
|
||||
DT = DTVykresy.Rows[p1];
|
||||
if (Convert.ToInt32(DT["IndexVykresu"].ToString()) == _index) a = p1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
dataGridView1.Rows[a].Selected = true;
|
||||
@@ -253,52 +236,19 @@ namespace Mip
|
||||
|
||||
pictureBox1.Visible = true;
|
||||
btnIndexDwn.Enabled = false; btnAktualVykres.Enabled = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//dataGridView1_SelectionChanged(sender,e);
|
||||
}//
|
||||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
int indexvSQL = 0;
|
||||
string typ = "";
|
||||
|
||||
dRow = DTVykresy.Rows[_index];
|
||||
dRow = DTVykresy.Rows[index];
|
||||
typ = dRow["Názov"].ToString();
|
||||
|
||||
if (typ == "Z databázy SQL")
|
||||
@@ -313,7 +263,6 @@ namespace Mip
|
||||
sizeH = pictureBox1.Image.Size.Height;
|
||||
sizeW = pictureBox1.Image.Size.Width;
|
||||
z = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -322,19 +271,34 @@ namespace Mip
|
||||
FileStream fs;
|
||||
int fileSize;
|
||||
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);//
|
||||
fileSize = (int)fs.Length;
|
||||
fileData = new byte[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();
|
||||
|
||||
Bitmap obrazok;
|
||||
//using (MemoryStream stream = new MemoryStream(fileData)) obrazok = new Bitmap(stream);
|
||||
MemoryStream stream = new MemoryStream(fileData);
|
||||
obrazok = new Bitmap(stream);
|
||||
MemoryStream stream = new MemoryStream(fileToShow);
|
||||
var obrazok = new Bitmap(stream);
|
||||
pictureBox1.Image = obrazok;
|
||||
pictureBox1.Height = obrazok.Height;
|
||||
pictureBox1.Width = obrazok.Width;
|
||||
@@ -344,6 +308,18 @@ 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)
|
||||
{
|
||||
if (dataGridView1.DataSource != null && dataGridView1.SelectedRows.Count > 0 && deleteRow != true)
|
||||
@@ -440,12 +416,6 @@ namespace Mip
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -458,7 +428,6 @@ namespace Mip
|
||||
{
|
||||
|
||||
DataGridViewRow Row;
|
||||
//Row = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
|
||||
Row = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index];
|
||||
|
||||
//Pre aktuálne výkresy nastav NEAKTUÁLNY
|
||||
@@ -492,30 +461,13 @@ namespace Mip
|
||||
DTVykresy.Rows[dataGridView1.SelectedRows[0].Index]["IndexVykresu"] = indexLastActiv + 1;
|
||||
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)
|
||||
{
|
||||
int oldindexvykresu;
|
||||
|
||||
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 - 1]["IndexVykresu"] = oldindexvykresu;
|
||||
@@ -526,10 +478,7 @@ namespace Mip
|
||||
private void btnIndexDwn_Click(object sender, EventArgs e)
|
||||
{
|
||||
int oldindexvykresu;
|
||||
|
||||
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 + 1]["IndexVykresu"] = oldindexvykresu;
|
||||
@@ -561,31 +510,8 @@ namespace Mip
|
||||
{
|
||||
string cmd;
|
||||
DataTable dtbl;
|
||||
|
||||
|
||||
|
||||
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
|
||||
/* 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
|
||||
|
||||
|
||||
dtbl=classSQL.commandSQL(cmd,1);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
cmd = @"UPDATE `mip`.`tabvyrobok` SET "
|
||||
+ "`NazovVyrobku`='" + textBox6.Text.ToString() + "'," //NazovVyrobku*
|
||||
@@ -604,36 +530,11 @@ namespace Mip
|
||||
|
||||
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;
|
||||
DataRow dtrw;
|
||||
|
||||
intIDVyrobok = Convert.ToInt32(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];
|
||||
*/
|
||||
|
||||
|
||||
for (int p1 = 0; p1 < DTVykresy.Rows.Count; p1++)
|
||||
{
|
||||
FileStream fs;
|
||||
@@ -655,7 +556,6 @@ namespace Mip
|
||||
classSQL.SQL(cmd, out dtbl);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -663,13 +563,27 @@ namespace Mip
|
||||
fileSize = (int)fs.Length;
|
||||
VykresData = new byte[fileSize];
|
||||
fs.Read(VykresData, 0, fileSize);
|
||||
fs.Close();
|
||||
classSQL.SaveVykresToSQL(intIDVyrobok, Convert.ToInt32(dtrw["IndexVykresu"].ToString()), VykresData);
|
||||
|
||||
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();
|
||||
classSQL.SaveVykresToSQL(intIDVyrobok, Convert.ToInt32(dtrw["IndexVykresu"].ToString()), fileToShow);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show("Výrobok úspešne aktualizovaný!");
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
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 Excel = Microsoft.Office.Interop.Excel;
|
||||
using System.Globalization;
|
||||
using MonthCalendar;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Drawing.Printing;
|
||||
using System.Diagnostics;
|
||||
using GMap.NET;
|
||||
using GMap.NET;
|
||||
using GMap.NET.MapProviders;
|
||||
using GMap.NET.WindowsForms;
|
||||
using GMap.NET.WindowsForms.Markers;
|
||||
using GMap.NET.WindowsForms.ToolTips;
|
||||
using System.Windows.Documents;
|
||||
using MonthCalendar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Configuration;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Windows.Forms;
|
||||
using Excel = Microsoft.Office.Interop.Excel;
|
||||
|
||||
namespace Mip
|
||||
{
|
||||
@@ -3424,8 +3415,7 @@ namespace Mip
|
||||
private void btnEditVyrobok_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//Form Add = new frmEditVyrobok(dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString());
|
||||
Form Add = new frmPridatVyrobok(dGVZoznamVyrobkov.CurrentRow.Cells["Zakaznik"].Value.ToString(), dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString());
|
||||
Form Add = new frmEditVyrobok(dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString());
|
||||
Add.ShowDialog();
|
||||
refreshZoznamVyrobkov();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Syncfusion.Pdf.Parsing;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using Syncfusion.Pdf.Parsing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Mip
|
||||
@@ -25,13 +19,13 @@ namespace Mip
|
||||
string IDVyrobok;
|
||||
DataTable DTVykresy = new DataTable();
|
||||
|
||||
|
||||
public frmPridatVyrobok(string strZakaznik, string idVyrobok = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
label2.Text = strZakaznik;
|
||||
IDVyrobok = idVyrobok;
|
||||
this.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
|
||||
|
||||
}
|
||||
|
||||
private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
|
||||
@@ -61,44 +55,44 @@ namespace Mip
|
||||
pomocnaDT.Columns.Add("Valid", typeof(int));
|
||||
VypisSpojenyRozmer();
|
||||
classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov");
|
||||
if (IDVyrobok != null)
|
||||
{
|
||||
LoadEditData();
|
||||
}
|
||||
//if (IDVyrobok != null)
|
||||
//{
|
||||
// LoadEditData();
|
||||
//}
|
||||
}
|
||||
|
||||
private void LoadEditData()
|
||||
{
|
||||
DataTable DTEditVyrobok = new DataTable();
|
||||
//dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString()
|
||||
//private void LoadEditData()
|
||||
//{
|
||||
// DataTable DTEditVyrobok = new DataTable();
|
||||
// //dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString()
|
||||
|
||||
classSQL.SQL("SELECT * FROM tabvyrobok WHERE `IDVyrobok` = " + IDVyrobok + ";", out DTEditVyrobok);
|
||||
label2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Zakaznik"].Ordinal].ToString();
|
||||
textBox6.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["NazovVyrobku"].Ordinal].ToString();
|
||||
comboBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["InyNazov"].Ordinal].ToString();
|
||||
// classSQL.SQL("SELECT * FROM tabvyrobok WHERE `IDVyrobok` = " + IDVyrobok + ";", out DTEditVyrobok);
|
||||
// label2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Zakaznik"].Ordinal].ToString();
|
||||
// textBox6.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["NazovVyrobku"].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;
|
||||
else numericUpDown1.Value = 1;
|
||||
textBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer1"].Ordinal].ToString();
|
||||
textBox3.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer2"].Ordinal].ToString();
|
||||
textBox4.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer3"].Ordinal].ToString();
|
||||
// if (DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozmerTvar"].Ordinal].ToString() == "Ø") numericUpDown1.Value = 0;
|
||||
// else numericUpDown1.Value = 1;
|
||||
// textBox2.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer1"].Ordinal].ToString();
|
||||
// textBox3.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer2"].Ordinal].ToString();
|
||||
// textBox4.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Rozmer3"].Ordinal].ToString();
|
||||
|
||||
textBox1.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozlisZnakKonecnaOp"].Ordinal].ToString();
|
||||
textBox5.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Alias"].Ordinal].ToString();
|
||||
textBox7.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["PocetSegmentov"].Ordinal].ToString();
|
||||
VypisSpojenyRozmer();
|
||||
// textBox1.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["RozlisZnakKonecnaOp"].Ordinal].ToString();
|
||||
// textBox5.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["Alias"].Ordinal].ToString();
|
||||
// textBox7.Text = DTEditVyrobok.Rows[0].ItemArray[DTEditVyrobok.Columns["PocetSegmentov"].Ordinal].ToString();
|
||||
// VypisSpojenyRozmer();
|
||||
|
||||
string cmd = @"SELECT `IDVyrobok`,
|
||||
`IndexVykresu`,
|
||||
`IndexVykresu` AS `OldIndexVykresu`,
|
||||
'Z databázy SQL' AS `Názov`,
|
||||
'-' AS `Cesta`,
|
||||
`IDVykres`,
|
||||
IF (`IndexVykresu` < 100, 'Aktuálny','Neaktuálny') AS `StatusVykresu`
|
||||
FROM `mip`.`tabvykres` WHERE `IDVyrobok` = " + IDVyrobok + " ORDER BY `IndexVykresu` ;";
|
||||
classSQL.SQL(cmd, out DTVykresy);
|
||||
dataGridView1.DataSource = DTVykresy;
|
||||
}
|
||||
// string cmd = @"SELECT `IDVyrobok`,
|
||||
// `IndexVykresu`,
|
||||
// `IndexVykresu` AS `OldIndexVykresu`,
|
||||
// 'Z databázy SQL' AS `Názov`,
|
||||
// '-' AS `Cesta`,
|
||||
// `IDVykres`,
|
||||
// IF (`IndexVykresu` < 100, 'Aktuálny','Neaktuálny') AS `StatusVykresu`
|
||||
// FROM `mip`.`tabvykres` WHERE `IDVyrobok` = " + IDVyrobok + " ORDER BY `IndexVykresu` ;";
|
||||
// classSQL.SQL(cmd, out DTVykresy);
|
||||
// dataGridView1.DataSource = DTVykresy;
|
||||
//}
|
||||
|
||||
private void btnAddVykres_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user