Esempio n. 1
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            bool canProceed = false;

            foreach (DataRow row in Form_Mainwindow.Data.Tables[2].Rows)
            {
                if (row[2].ToString() == textBox_Model.Text)
                {
                    MessageBox.Show("Pro přidání nového zařízení se nesmí shodovat Model s jiným záznamem.", "Nesprávné údaje", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    canProceed = false;
                    break;
                }
                else
                {
                    canProceed = true;
                }
            }

            if (canProceed && textBox_Model.Text != "" && textBox_Vyrobce.Text != "")
            {
                DataRow row = Form_Mainwindow.Data.Tables[2].NewRow();
                row[0] = textBox_Vyrobce.Text;
                row[1] = textBox_Typ_zarizeni.Text;
                row[2] = textBox_Model.Text;
                Form_Mainwindow.Data.Tables[2].Rows.Add(row);
                Form_Mainwindow.Update_to_database();
                MessageBox.Show("Přidáno.", "Přidáno", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                MessageBox.Show("Pro přidání nového zařízení musíte vyplnit tyto pole: Model a Výrobce.", "Nedostatek údajů", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 2
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            bool found = false;

            foreach (DataRow row in Form_Mainwindow.Data.Tables[2].Rows)
            {
                if (row[2].ToString() == textBox_Model.Text)
                {
                    row.Delete();
                    Form_Mainwindow.Update_to_database();
                    Clear_form();
                    comboBox1.Text = "";
                    found          = true;
                    break;
                }
            }
            if (!found)
            {
                MessageBox.Show("Zařízení: " + textBox_Model.Text + " nebylo nalezeno.", "Zařízení nebylo nalezeno.", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 3
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            bool canProceed = false;

            foreach (DataRow row in Form_Mainwindow.Data.Tables[1].Rows)
            {
                if (row[1].ToString() == textBox_Spolecnost.Text || row[9].ToString() == textBox_ICO.Text || (row[2].ToString() == textBox_Jmeno.Text && row[3].ToString() == textBox_Prijmeni.Text))
                {
                    MessageBox.Show("Pro přidání nového zákazníka se nesmí shodovat tyto pole: Společnost nebo IČO nebo Jméno a příjmení s jiným záznamem.", "Nesprávné údaje", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    canProceed = false;
                    break;
                }
                else
                {
                    canProceed = true;
                }
            }

            if (canProceed && textBox_Spolecnost.Text != "" && textBox_ICO.Text != "" && textBox_DIC.Text != "" && (textBox_email.Text != "" || textBox_Tel.Text != ""))
            {
                DataRow row = Form_Mainwindow.Data.Tables[1].NewRow();
                row[1]  = textBox_Spolecnost.Text;
                row[2]  = textBox_Jmeno.Text;
                row[3]  = textBox_Prijmeni.Text;
                row[4]  = textBox_Ulice.Text;
                row[5]  = textBox_Mesto.Text;
                row[6]  = textBox_PSC.Text;
                row[7]  = textBox_Tel.Text;
                row[8]  = textBox_email.Text;
                row[9]  = textBox_ICO.Text;
                row[10] = textBox_DIC.Text;
                Form_Mainwindow.Data.Tables[1].Rows.Add(row);
                Form_Mainwindow.Update_to_database();
                MessageBox.Show("Přidáno.", "Přidáno", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                MessageBox.Show("Pro přidání nového zákazníka musíte vyplnit tyto pole: Společnost, IČO, DIČ + telefon nebo email ", "Nedostatek údajů", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 4
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            bool canProceed = false;

            foreach (DataRow row in Form_Mainwindow.Data.Tables[0].Rows)
            {
                if (row[0].ToString() == comboBox_Search_field.Text)
                {
                    MessageBox.Show("Pro přidání nové zakázky se nesmí shodovat číslo zakázky s jiným záznamem.", "Nesprávné údaje", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    canProceed = false;
                    break;
                }
                else
                {
                    canProceed = true;
                }
            }

            if (canProceed && textBox_Spolecnost.Text != "" && textBox_ICO.Text != "" && textBox_DIC.Text != "" && (textBox_email.Text != "" || textBox_Tel.Text != ""))
            {
                int ID_zakaznik = 0;
                foreach (DataRow row1 in Form_Mainwindow.Data.Tables[1].Rows)
                {
                    if (row1[1].ToString() == textBox_Spolecnost.Text || row1[9].ToString() == textBox_ICO.Text || (row1[2].ToString() == textBox_Jmeno.Text && row1[3].ToString() == textBox_Prijmeni.Text))
                    {
                        ID_zakaznik = int.Parse(row1[0].ToString());
                        break;
                    }
                }

                DataRow row = Form_Mainwindow.Data.Tables[0].NewRow();
                row[0] = comboBox_Search_field.Text;
                row[1] = textBox_Cizi_cislo_zakazky.Text;
                row[2] = comboBox_Status.Text;
                row[3] = textBox_Model.Text;
                row[4] = ID_zakaznik;
                row[5] = textBox_Vizualni_stav.Text;
                row[6] = textBox_Popis_zavady.Text;
                row[7] = textBox_Cenovy_limit.Text;

                if (textBox_Reklamace.Text != "")
                {
                    row[8] = textBox_Reklamace.Text;
                }
                else
                {
                    row[8] = DateTime.MinValue;
                }

                if (textBox_Prijem.Text != "")
                {
                    row[9] = textBox_Prijem.Text;
                }
                else
                {
                    row[9] = DateTime.MinValue;
                }

                row[10] = textBox_Diagnostika.Text;
                row[11] = textBox_Vyjadreni_k_oprave.Text;

                if (textBox_Ukonceni.Text != "")
                {
                    row[12] = textBox_Ukonceni.Text;
                }
                else
                {
                    row[12] = DateTime.MinValue;
                }

                if (textBox_Expedice.Text != "")
                {
                    row[13] = textBox_Expedice.Text;
                }
                else
                {
                    row[13] = DateTime.MinValue;
                }

                if (textBox_Oprava.Text != "")
                {
                    row[14] = textBox_Oprava.Text;
                }
                else
                {
                    row[14] = DateTime.MinValue;
                }

                if (textBox_Diagnostika_datum.Text != "")
                {
                    row[15] = textBox_Diagnostika_datum.Text;
                }
                else
                {
                    row[15] = DateTime.MinValue;
                }

                row[16] = textBox_Dalsi_identifikace.Text;
                row[17] = textBox_SN.Text;

                Form_Mainwindow.Data.Tables[0].Rows.Add(row);
                Form_Mainwindow.Update_to_database();
                MessageBox.Show("Přidáno.", "Přidáno", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                MessageBox.Show("Pro přidání nové zakázky musí být splněny následující požadavky: Vybraný zákazník, vybrané zařízeni a vyplněné pole: příjem.", "Nedostatek údajů", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }