Initial commit
This commit is contained in:
483
Mip/frmPridatEditovatNastroj.cs
Normal file
483
Mip/frmPridatEditovatNastroj.cs
Normal file
@@ -0,0 +1,483 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mip
|
||||
{
|
||||
public partial class frmPridatEditovatNastroj : Form
|
||||
{
|
||||
DataTable tabSpecifikacie = new DataTable();
|
||||
DataTable specMariaDB;
|
||||
|
||||
private AutoCompleteStringCollection acscKategogia = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscVyrobneCislo = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscNazovSpecifikacie = new AutoCompleteStringCollection();
|
||||
private AutoCompleteStringCollection acscDataSpecifikacie = new AutoCompleteStringCollection();
|
||||
|
||||
public frmPridatEditovatNastroj(DataGridViewRow _dgvr)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Int32 IDN;
|
||||
|
||||
tabSpecifikacie.Columns.Add("IDSpec", typeof(System.Int32));
|
||||
tabSpecifikacie.Columns.Add("Názov špecifikácie", typeof(System.String));
|
||||
tabSpecifikacie.Columns.Add("Dáta špecifikácie", typeof(System.String));
|
||||
tabSpecifikacie.Columns.Add("Brúsiteľný", typeof(System.Boolean));
|
||||
tabSpecifikacie.Columns.Add("Vymazaný", typeof(System.Boolean));
|
||||
|
||||
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBox1.AutoCompleteCustomSource = acscKategogia;
|
||||
textBox2.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBox2.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBox2.AutoCompleteCustomSource = acscVyrobneCislo;
|
||||
//tabSpecifikacie.Columns.Add("Počet kusov", typeof());
|
||||
|
||||
DataTable tab;
|
||||
string cmdACSC = "SELECT `Kategória`, `Výrobné číslo` FROM `tabnastroje-zoznam`";
|
||||
classSQL.SQL(cmdACSC, out tab);
|
||||
foreach (DataRow dr in tab.Rows)
|
||||
{
|
||||
acscKategogia.Add(dr["Kategória"].ToString());
|
||||
acscVyrobneCislo.Add(dr["Výrobné číslo"].ToString());
|
||||
}
|
||||
|
||||
cmdACSC = "SELECT `Názov špecifikácie`, `Dáta špecifikácie` FROM `tabnastroje-spec`";
|
||||
classSQL.SQL(cmdACSC, out tab);
|
||||
foreach (DataRow dr in tab.Rows)
|
||||
{
|
||||
acscNazovSpecifikacie.Add(dr["Názov špecifikácie"].ToString());
|
||||
acscDataSpecifikacie.Add(dr["Dáta špecifikácie"].ToString());
|
||||
}
|
||||
|
||||
if (_dgvr==null)
|
||||
{
|
||||
|
||||
this.Text = "Pridať nástroj...";
|
||||
label90.Text = Convert.ToDateTime(DateTime.Now.Date).ToString("yyyy.MM.dd");
|
||||
label82.Text = "-";
|
||||
label92.Text = "0";
|
||||
label94.Text = "0";
|
||||
label88.Text = "Na sklade";
|
||||
label98.Text = "-";
|
||||
label96.Text = "-";
|
||||
label66.Text = "Nový";
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text = "Editovať nástroj...";
|
||||
IDN = Convert.ToInt32(_dgvr.Cells["IDNástroj"].Value);
|
||||
label66.Text = IDN.ToString();
|
||||
label90.Text = Convert.ToDateTime(_dgvr.Cells["Dátum zaradenia"].Value).ToString("yyyy.MM.dd");
|
||||
label82.Text = _dgvr.Cells["Poradové číslo"].Value.ToString();
|
||||
if (_dgvr.Cells["Dátum vyradenia"].Value.ToString() != "") label98.Text = Convert.ToDateTime(_dgvr.Cells["Dátum vyradenia"].Value).ToString("yyyy.MM.dd");
|
||||
label96.Text = _dgvr.Cells["Dôvod vyradenia"].Value.ToString();
|
||||
label92.Text = _dgvr.Cells["Počet brúsení"].Value.ToString();
|
||||
label94.Text = _dgvr.Cells["Počet použití"].Value.ToString();
|
||||
label88.Text = _dgvr.Cells["Status"].Value.ToString();
|
||||
textBox1.Text = _dgvr.Cells["Kategória"].Value.ToString();
|
||||
textBox2.Text = _dgvr.Cells["Výrobné číslo"].Value.ToString();
|
||||
textBox3.Text = _dgvr.Cells["Poznámka"].Value.ToString();
|
||||
|
||||
string pocet;
|
||||
string cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = 'png' or `Typ súboru` = 'jpg');";
|
||||
classSQL.SQL(cmd,out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label1.BackColor = Color.PaleGreen;
|
||||
cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = '3Dpdf');";
|
||||
classSQL.SQL(cmd, out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label2.BackColor = Color.PaleGreen;
|
||||
cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = 'pdf');";
|
||||
classSQL.SQL(cmd, out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label5.BackColor = Color.PaleGreen;
|
||||
cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = 'amd');";
|
||||
classSQL.SQL(cmd, out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label6.BackColor = Color.PaleGreen;
|
||||
cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = 'rar' or `Typ súboru` = 'zip' or `Typ súboru` = 'ipt');";
|
||||
classSQL.SQL(cmd, out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label3.BackColor = Color.PaleGreen;
|
||||
cmd = "select count(`Typ súboru`) as `Počet nákresov` from `pohladnastroje-subory` where `pohladnastroje-subory`.`IDNástroj` = " + label66.Text + " and (`Typ súboru` = 'dwg');";
|
||||
classSQL.SQL(cmd, out pocet);
|
||||
if (Convert.ToInt32(pocet) > 0) label4.BackColor = Color.PaleGreen;
|
||||
|
||||
cmd = "select * from `tabnastroje-spec` where `IDNástrojSpec` = " + IDN.ToString() + ";";
|
||||
classSQL.SQL(cmd, out specMariaDB);
|
||||
|
||||
foreach(DataRow dtr in specMariaDB.Rows)
|
||||
{
|
||||
//MessageBox.Show(dtr.Field<Int32>("Brúsiteľný").ToString());
|
||||
|
||||
specifikacia(dtr.Field<Int32>("IDSpec"), dtr.Field<string>("Názov špecifikácie"), dtr.Field<string>("Dáta špecifikácie"), Convert.ToBoolean(dtr.Field<Int32>("Brúsiteľný")));
|
||||
DataRow dr = tabSpecifikacie.NewRow();
|
||||
dr["IDSpec"] = dtr.Field<Int32>("IDSpec");
|
||||
dr["Názov špecifikácie"] = dtr.Field<string>("Názov špecifikácie");
|
||||
dr["Dáta špecifikácie"] = dtr.Field<string>("Dáta špecifikácie");
|
||||
dr["Brúsiteľný"] = Convert.ToBoolean(dtr.Field<Int32>("Brúsiteľný"));
|
||||
dr["Vymazaný"] = false;
|
||||
tabSpecifikacie.Rows.Add(dr);
|
||||
}
|
||||
|
||||
}
|
||||
dataGridView1.DataSource = tabSpecifikacie;
|
||||
}
|
||||
|
||||
private void frmPridatEditovatNastroj_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (label88.Text)
|
||||
{
|
||||
case "Na sklade":
|
||||
label88.Text = "Vo výrobe";
|
||||
break;
|
||||
case "Vo výrobe":
|
||||
label88.Text = "Na brúsení";
|
||||
break;
|
||||
case "Na brúsení":
|
||||
label88.Text = "Vyradený";
|
||||
break;
|
||||
case "Vyradený":
|
||||
label88.Text = "Zapožičaný";
|
||||
break;
|
||||
case "Zapožičaný":
|
||||
label88.Text = "Ručné brúsenie";
|
||||
break;
|
||||
case "Ručné brúsenie":
|
||||
label88.Text = "Na sklade";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void button10_Click(object sender, EventArgs e)
|
||||
{
|
||||
specifikacia("number");
|
||||
}
|
||||
|
||||
/*
|
||||
const int width = 100;
|
||||
private void textBox4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Font font = new Font(textBox4.Font.Name, textBox4.Font.Size);
|
||||
|
||||
Size s = TextRenderer.MeasureText(textBox4.Text, font);
|
||||
if (s.Width > width)
|
||||
{
|
||||
textBox4.Width = s.Width;
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void specifikacia(Int32 _IDSpec, string _NazovSpec, string _DataSpec, bool _Brusitelny)
|
||||
{
|
||||
FlowLayoutPanel panelSpecifikacia = new FlowLayoutPanel();
|
||||
panelSpecifikacia.Name = tabSpecifikacie.Rows.Count.ToString();
|
||||
panelSpecifikacia.Tag = _IDSpec.ToString();
|
||||
panelSpecifikacia.Size = new System.Drawing.Size(20, 12);
|
||||
panelSpecifikacia.BorderStyle = BorderStyle.FixedSingle;
|
||||
panelSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
panelSpecifikacia.AutoSize = true;
|
||||
|
||||
CustomControls.AdaptiveSizeTextBox textBSpecifikacia = new CustomControls.AdaptiveSizeTextBox();
|
||||
textBSpecifikacia.Size = new Size(20, 12);
|
||||
textBSpecifikacia.Name = "Názov špecifikácie";
|
||||
textBSpecifikacia.Text = _NazovSpec;
|
||||
textBSpecifikacia.Tag = _NazovSpec;
|
||||
textBSpecifikacia.TextAlign = HorizontalAlignment.Center;
|
||||
textBSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
textBSpecifikacia.TextChanged += new EventHandler(setUpdateMariaDB);
|
||||
textBSpecifikacia.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBSpecifikacia.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBSpecifikacia.AutoCompleteCustomSource = acscNazovSpecifikacie;
|
||||
panelSpecifikacia.Controls.Add(textBSpecifikacia);
|
||||
|
||||
bool bStringIsNumber = _DataSpec.All(char.IsDigit);
|
||||
if (bStringIsNumber == true)
|
||||
{
|
||||
NumericUpDown nudSpecifikacia = new NumericUpDown();
|
||||
nudSpecifikacia.AutoSize = true;
|
||||
nudSpecifikacia.DecimalPlaces = 3;
|
||||
nudSpecifikacia.Name = "Dáta špecifikácie";
|
||||
nudSpecifikacia.Value = Convert.ToInt32(_DataSpec);
|
||||
nudSpecifikacia.Tag = Convert.ToInt32(_DataSpec);
|
||||
nudSpecifikacia.Maximum = 9999;
|
||||
nudSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
nudSpecifikacia.ValueChanged += new EventHandler(setUpdateMariaDB);
|
||||
panelSpecifikacia.Controls.Add(nudSpecifikacia);
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomControls.AdaptiveSizeTextBox textBSpecifikacia2 = new CustomControls.AdaptiveSizeTextBox();
|
||||
textBSpecifikacia2.Size = new Size(20, 12);
|
||||
textBSpecifikacia2.Name = "Dáta špecifikácie";
|
||||
textBSpecifikacia2.Text = _DataSpec;
|
||||
textBSpecifikacia2.Tag = _DataSpec;
|
||||
textBSpecifikacia2.TextAlign = HorizontalAlignment.Center;
|
||||
textBSpecifikacia2.Margin = new Padding(1, 1, 1, 1);
|
||||
textBSpecifikacia2.TextChanged += new EventHandler(setUpdateMariaDB);
|
||||
textBSpecifikacia2.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBSpecifikacia2.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBSpecifikacia2.AutoCompleteCustomSource = acscDataSpecifikacie;
|
||||
panelSpecifikacia.Controls.Add(textBSpecifikacia2);
|
||||
}
|
||||
|
||||
|
||||
CheckBox checkBSpecifikacia = new CheckBox();
|
||||
checkBSpecifikacia.Checked = false;
|
||||
if(bStringIsNumber == true) checkBSpecifikacia.Enabled = true;
|
||||
else checkBSpecifikacia.Enabled = false;
|
||||
checkBSpecifikacia.AutoSize = true;
|
||||
checkBSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
checkBSpecifikacia.Name = "Brúsiteľný";
|
||||
if (_Brusitelny == true) checkBSpecifikacia.Checked = true;
|
||||
panelSpecifikacia.Controls.Add(checkBSpecifikacia);
|
||||
checkBSpecifikacia.CheckedChanged += new EventHandler(setUpdateMariaDB);
|
||||
|
||||
Label labelDelete = new Label();
|
||||
labelDelete.Image = global::Mip.Properties.Resources.delete2;
|
||||
labelDelete.Margin = new Padding(1, 1, 1, 1);
|
||||
labelDelete.Size = new System.Drawing.Size(20, 20);
|
||||
labelDelete.TabIndex = 6;
|
||||
labelDelete.Click += new EventHandler(DeleteSpecifikacia);
|
||||
panelSpecifikacia.Controls.Add(labelDelete);
|
||||
|
||||
flowLayoutPanel1.Controls.Add(panelSpecifikacia);
|
||||
}
|
||||
|
||||
public void specifikacia(string _typ)
|
||||
{
|
||||
|
||||
FlowLayoutPanel panelSpecifikacia = new FlowLayoutPanel();
|
||||
panelSpecifikacia.Name = tabSpecifikacie.Rows.Count.ToString();
|
||||
panelSpecifikacia.Tag = "insert";
|
||||
panelSpecifikacia.Size = new System.Drawing.Size(20, 12);
|
||||
panelSpecifikacia.BorderStyle = BorderStyle.FixedSingle;
|
||||
panelSpecifikacia.BackColor = Color.Coral;
|
||||
panelSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
panelSpecifikacia.AutoSize = true;
|
||||
|
||||
CustomControls.AdaptiveSizeTextBox textBSpecifikacia = new CustomControls.AdaptiveSizeTextBox();
|
||||
textBSpecifikacia.Size = new Size(20, 12);
|
||||
textBSpecifikacia.Text = "";
|
||||
textBSpecifikacia.TextAlign = HorizontalAlignment.Center;
|
||||
textBSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
textBSpecifikacia.Name = "Názov špecifikácie";
|
||||
textBSpecifikacia.TextChanged += new EventHandler(setUpdateNew);
|
||||
textBSpecifikacia.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBSpecifikacia.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBSpecifikacia.AutoCompleteCustomSource = acscNazovSpecifikacie;
|
||||
|
||||
CustomControls.AdaptiveSizeTextBox textBSpecifikacia2 = new CustomControls.AdaptiveSizeTextBox();
|
||||
NumericUpDown nudSpecifikacia = new NumericUpDown();
|
||||
if (_typ == "Text")
|
||||
{
|
||||
textBSpecifikacia2.Size = new Size(20, 12);
|
||||
textBSpecifikacia2.Name = "Dáta špecifikácie";
|
||||
textBSpecifikacia2.Text = "";
|
||||
textBSpecifikacia2.TextAlign = HorizontalAlignment.Center;
|
||||
textBSpecifikacia2.Margin = new Padding(1, 1, 1, 1);
|
||||
textBSpecifikacia2.TextChanged += new EventHandler(setUpdateNew);
|
||||
textBSpecifikacia2.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
textBSpecifikacia2.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
textBSpecifikacia2.AutoCompleteCustomSource = acscDataSpecifikacie;
|
||||
}
|
||||
else
|
||||
{
|
||||
nudSpecifikacia.AutoSize = true;
|
||||
nudSpecifikacia.DecimalPlaces = 3;
|
||||
nudSpecifikacia.Value = 0;
|
||||
nudSpecifikacia.Maximum = 9999;
|
||||
nudSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
nudSpecifikacia.Name = "Dáta špecifikácie";
|
||||
nudSpecifikacia.ValueChanged += new EventHandler(setUpdateNew);
|
||||
}
|
||||
|
||||
CheckBox checkBSpecifikacia = new CheckBox();
|
||||
checkBSpecifikacia.Checked = false;
|
||||
checkBSpecifikacia.AutoSize = true;
|
||||
checkBSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
||||
checkBSpecifikacia.Name = "Brúsiteľný";
|
||||
checkBSpecifikacia.CheckedChanged += new EventHandler(setUpdateNew);
|
||||
|
||||
Label labelDelete = new Label();
|
||||
labelDelete.Image = global::Mip.Properties.Resources.delete2;
|
||||
labelDelete.Margin = new Padding(1, 1, 1, 1);
|
||||
labelDelete.Size = new System.Drawing.Size(20, 20);
|
||||
labelDelete.TabIndex = 6;
|
||||
labelDelete.Click += new EventHandler(DeleteSpecifikacia);
|
||||
|
||||
panelSpecifikacia.Controls.Add(textBSpecifikacia);
|
||||
if (_typ == "Text")
|
||||
{
|
||||
panelSpecifikacia.Controls.Add(textBSpecifikacia2);
|
||||
checkBSpecifikacia.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
panelSpecifikacia.Controls.Add(nudSpecifikacia);
|
||||
checkBSpecifikacia.Enabled = true;
|
||||
}
|
||||
|
||||
panelSpecifikacia.Controls.Add(checkBSpecifikacia);
|
||||
panelSpecifikacia.Controls.Add(labelDelete);
|
||||
|
||||
DataRow dr = tabSpecifikacie.NewRow();
|
||||
dr["IDSpec"] = 0;
|
||||
dr["Názov špecifikácie"] = "";
|
||||
dr["Dáta špecifikácie"] = "";
|
||||
dr["Brúsiteľný"] = false;
|
||||
tabSpecifikacie.Rows.Add(dr);
|
||||
|
||||
dataGridView1.Refresh();
|
||||
|
||||
flowLayoutPanel1.Controls.Add(panelSpecifikacia);
|
||||
}
|
||||
|
||||
void setUpdateMariaDB(object sender, EventArgs e)
|
||||
{
|
||||
Control c = sender as Control;
|
||||
bool bUpdate = false;
|
||||
|
||||
foreach(Control parentItem in c.Parent.Controls)
|
||||
{
|
||||
if (parentItem is TextBox) if(parentItem.Text != parentItem.Tag.ToString()) bUpdate = true;
|
||||
if (parentItem is NumericUpDown)
|
||||
{
|
||||
NumericUpDown nud = parentItem as NumericUpDown;
|
||||
if (nud.Value != Convert.ToDecimal(nud.Tag)) bUpdate = true;
|
||||
}
|
||||
if (parentItem is CheckBox) //if(c.Parent.Controls.Find("Dáta špecifikácie", true)[0].Text.All(char.IsDigit) == true)
|
||||
{
|
||||
CheckBox chb2 = parentItem as CheckBox;
|
||||
tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, chb2.CheckState);
|
||||
}
|
||||
|
||||
}
|
||||
if (bUpdate == true) c.Parent.BackColor = Color.PaleGreen;
|
||||
else c.Parent.BackColor = Color.Empty;
|
||||
|
||||
//MessageBox.Show(c.Parent.Controls.Find("Názov špecifikácie", true)[0].Text);
|
||||
|
||||
NumericUpDown nud2 = new NumericUpDown();
|
||||
CheckBox chb = new CheckBox();
|
||||
|
||||
if (c is NumericUpDown) nud2 = c as NumericUpDown;
|
||||
if (c is CheckBox) chb = c as CheckBox;
|
||||
|
||||
if (c.Name == "Názov špecifikácie") tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, c.Text);
|
||||
if (c.Name == "Dáta špecifikácie" & c is TextBox)
|
||||
{
|
||||
tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, c.Text);
|
||||
if (c.Parent.Controls.Find("Dáta špecifikácie", true)[0].Text.All(char.IsDigit) == true) c.Parent.Controls.Find("Brúsiteľný", true)[0].Enabled = true;
|
||||
else c.Parent.Controls.Find("Brúsiteľný", true)[0].Enabled = false;
|
||||
}
|
||||
if (c.Name == "Dáta špecifikácie" & c is NumericUpDown) tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, nud2.Value);
|
||||
if (c.Name == "Brúsiteľný") tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, chb.CheckState);
|
||||
dataGridView1.Refresh();
|
||||
|
||||
}
|
||||
|
||||
void setUpdateNew(object sender, EventArgs e)
|
||||
{
|
||||
Control c = sender as Control;
|
||||
CheckBox chb = new CheckBox();
|
||||
NumericUpDown nud = new NumericUpDown();
|
||||
|
||||
if (c is NumericUpDown) nud = c as NumericUpDown;
|
||||
if (c is CheckBox) chb = c as CheckBox;
|
||||
|
||||
if (c.Name == "Názov špecifikácie") tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, c.Text);
|
||||
if (c.Name == "Dáta špecifikácie" & c is NumericUpDown) tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, nud.Value);
|
||||
if (c.Name == "Dáta špecifikácie" & c is TextBox) tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, c.Text);
|
||||
if (c.Name == "Brúsiteľný") tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField(c.Name, chb.CheckState);
|
||||
dataGridView1.Refresh();
|
||||
}
|
||||
|
||||
void DeleteSpecifikacia(object sender, EventArgs e)
|
||||
{
|
||||
if(MessageBox.Show("Naozaj vymazať špecifikáciu?","Upozornenie!",MessageBoxButtons.OKCancel) == DialogResult.OK)
|
||||
using (Control c = sender as Control)
|
||||
{
|
||||
c.Parent.Parent.Controls.Remove(c.Parent);
|
||||
tabSpecifikacie.Rows[Convert.ToInt32(c.Parent.Name.ToString())].SetField("Vymazaný", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void button11_Click(object sender, EventArgs e)
|
||||
{
|
||||
specifikacia("Text");
|
||||
}
|
||||
|
||||
private void button12_Click(object sender, EventArgs e)
|
||||
{
|
||||
Form frmEditBrusenia2 = new frmEditBrusenia(0);
|
||||
frmEditBrusenia2.ShowDialog();
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool IsFile3Dpdf(string _path)
|
||||
{
|
||||
return File.ReadAllText(_path).Contains("Subtype/U3D") ? true : false;
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Multiselect = false;
|
||||
ofd.Filter = "JPEG Files (*.jpeg)|*.jpeg|JPG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png";
|
||||
|
||||
FileStream fs;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
fs = readFile(ofd.FileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private FileStream readFile(string _filename)
|
||||
{
|
||||
int FileSize;
|
||||
byte[] FileData;
|
||||
FileStream fs;
|
||||
|
||||
fs = new FileStream(_filename, FileMode.Open, FileAccess.Read);
|
||||
FileSize = (int)fs.Length;
|
||||
|
||||
FileData = new byte[FileSize];
|
||||
fs.Read(FileData, 0, FileSize);
|
||||
fs.Close();
|
||||
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user