diff --git a/.gitignore b/.gitignore index b372200..769998c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ Mip/obj/Debug/Mip.pdb Mip/bin/ Mip/obj/ MipInstaller/Debug/ +/.vs/Mip_v1/v16/Server/sqlite3 diff --git a/.vs/Mip_v1/v16/.suo b/.vs/Mip_v1/v16/.suo index e4131e3..cae33a8 100644 Binary files a/.vs/Mip_v1/v16/.suo and b/.vs/Mip_v1/v16/.suo differ diff --git a/Mip/frmEditVyrobok.Designer.cs b/Mip/frmEditVyrobok.Designer.cs index a9fb39e..da2596f 100644 --- a/Mip/frmEditVyrobok.Designer.cs +++ b/Mip/frmEditVyrobok.Designer.cs @@ -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(770, 390); + this.panel1.Size = new System.Drawing.Size(815, 390); 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(229, 100); + this.dataGridView1.Size = new System.Drawing.Size(274, 100); 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); @@ -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(707, 117); + this.button3.Location = new System.Drawing.Point(752, 117); 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(707, 95); + this.button5.Location = new System.Drawing.Point(752, 95); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 23); this.button5.TabIndex = 24; @@ -438,7 +438,7 @@ this.groupBox1.Controls.Add(this.panel1); this.groupBox1.Location = new System.Drawing.Point(2, 145); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(780, 413); + this.groupBox1.Size = new System.Drawing.Size(825, 413); this.groupBox1.TabIndex = 19; this.groupBox1.TabStop = false; this.groupBox1.Text = "Zobraziť výkres"; @@ -471,7 +471,7 @@ this.groupBox4.Controls.Add(this.btnVymazVykres); this.groupBox4.Location = new System.Drawing.Point(474, 2); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(233, 140); + this.groupBox4.Size = new System.Drawing.Size(278, 140); this.groupBox4.TabIndex = 21; this.groupBox4.TabStop = false; this.groupBox4.Text = "Načítané výkresy"; @@ -536,7 +536,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(784, 562); + this.ClientSize = new System.Drawing.Size(829, 562); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.button7); diff --git a/Mip/frmMain.cs b/Mip/frmMain.cs index 291f575..cfc4489 100644 --- a/Mip/frmMain.cs +++ b/Mip/frmMain.cs @@ -3424,7 +3424,8 @@ namespace Mip private void btnEditVyrobok_Click(object sender, EventArgs e) { - Form Add = new frmEditVyrobok(dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString()); + //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()); Add.ShowDialog(); refreshZoznamVyrobkov(); } diff --git a/Mip/frmPridatVyrobok.cs b/Mip/frmPridatVyrobok.cs index 6cfe58e..d78366f 100644 --- a/Mip/frmPridatVyrobok.cs +++ b/Mip/frmPridatVyrobok.cs @@ -22,13 +22,14 @@ namespace Mip Single z=1; int sizeH; int sizeW; - + string IDVyrobok; + DataTable DTVykresy = new DataTable(); - public frmPridatVyrobok(string strZakaznik) + public frmPridatVyrobok(string strZakaznik, string idVyrobok = null) { InitializeComponent(); label2.Text = strZakaznik; - + IDVyrobok = idVyrobok; this.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel); } @@ -60,7 +61,43 @@ namespace Mip pomocnaDT.Columns.Add("Valid", typeof(int)); VypisSpojenyRozmer(); classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov"); - + if (IDVyrobok != null) + { + LoadEditData(); + } + } + + 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(); + + 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(); + + 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) @@ -207,49 +244,52 @@ namespace Mip int fileSize; byte[] fileData; DataRow dRow; + if (pomocnaDT.Rows.Count != 0) + { dRow = pomocnaDT.Rows[index]; - var isPdf = dRow["Typ_suboru"].ToString() == "pdf"; - var isValid = dRow["Valid"].ToString() == "1"; + var isPdf = dRow["Typ_suboru"].ToString() == "pdf"; + var isValid = dRow["Valid"].ToString() == "1"; - if(isValid) - { - if (isPdf) + if(isValid) { - FileStream pdfFileStream = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read); - pictureBox1.Visible = false; - pdfDocumentView1.Visible = true; - pdfDocumentView1.Load(pdfFileStream); - pdfDocumentView1.ZoomMode = Syncfusion.Windows.Forms.PdfViewer.ZoomMode.FitWidth; - pdfDocumentView1.Dock = DockStyle.Fill; + if (isPdf) + { + FileStream pdfFileStream = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read); + pictureBox1.Visible = false; + pdfDocumentView1.Visible = true; + pdfDocumentView1.Load(pdfFileStream); + pdfDocumentView1.ZoomMode = Syncfusion.Windows.Forms.PdfViewer.ZoomMode.FitWidth; + pdfDocumentView1.Dock = DockStyle.Fill; + } + else + { + 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.Visible = true; + pictureBox1.Image = obrazok; + pictureBox1.Height = obrazok.Height; + pictureBox1.Width = obrazok.Width; + sizeH = pictureBox1.Image.Size.Height; + sizeW = pictureBox1.Image.Size.Width; + pdfDocumentView1.Visible = false; + } } else { - 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.Visible = true; - pictureBox1.Image = obrazok; - pictureBox1.Height = obrazok.Height; - pictureBox1.Width = obrazok.Width; - sizeH = pictureBox1.Image.Size.Height; - sizeW = pictureBox1.Image.Size.Width; + pictureBox1.Visible = false; pdfDocumentView1.Visible = false; } + + z = 1; } - else - { - pictureBox1.Visible = false; - pdfDocumentView1.Visible = false; - } - - z = 1; } diff --git a/Mip/obj/Debug/Mip.csproj.ResolveComReference.cache b/Mip/obj/Debug/Mip.csproj.ResolveComReference.cache index 32834ea..d1758eb 100644 Binary files a/Mip/obj/Debug/Mip.csproj.ResolveComReference.cache and b/Mip/obj/Debug/Mip.csproj.ResolveComReference.cache differ