private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string query = "INSERT INTO tblinstallatie (ContainerID, DeviceID, Van, Tot, EventID, Omschrijving, VerantwoordelijkeID)";

                string ContainerID         = getContainerID();
                string DeviceID            = getDeviceID();
                string USdateVan           = DateTime.Parse(DatePickerVan.Text).ToString("yyyy-MM-dd HH:mm:ss");
                string USdateTot           = DateTime.Parse(DatePickerTot.Text).ToString("yyyy-MM-dd HH:mm:ss");
                string EventID             = getEventID();
                string Omschrijving        = TextBoxOmschrijving.Text;
                string VerantwoordelijkeID = getVerantwoordelijkeID();

                query += " VALUES ('"
                         + ContainerID + "', '"
                         + DeviceID + "', '"
                         + USdateVan + "', '"
                         + USdateTot + "', '"
                         + EventID + "', '"
                         + Omschrijving + "', '"
                         + VerantwoordelijkeID + "')";

                Data d = new Data(connectionstring);
                d.DataInsert(query);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string query               = "INSERT INTO tblevents (Naam, Locatie, ContactpersoonID, VerantwoordelijkeID)";
                string ContactpersoonID    = getContactpersoonID();
                string VerantwoordelijkeID = getVerantwoordelijkeID();

                if (TextBoxNaam.Text == "")
                {
                    throw new Exception("Vul de naam in.");
                }
                if (TextBoxLocatie.Text == "")
                {
                    throw new Exception("Vul de locatie in.");
                }

                query += " VALUES ('"
                         + TextBoxNaam.Text + "', '"
                         + TextBoxLocatie.Text + "', '"
                         + ContactpersoonID + "', '"
                         + VerantwoordelijkeID + "')";

                Data d = new Data(connectionstring);
                d.DataInsert(query);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (TextBoxPlaats.Text == "")
                {
                    throw new Exception("Plaats nog niet ingegeven");
                }
                string query = "INSERT INTO tblcontainer (Plaats, Van, Tot)";

                string USdateVan = DateTime.Parse(DatePickerVan.Text).ToString("yyyy-MM-dd HH:mm:ss");
                string USdateTot = DateTime.Parse(DatePickerTot.Text).ToString("yyyy-MM-dd HH:mm:ss");

                query += " VALUES ('" +
                         TextBoxPlaats.Text + "', '" +
                         USdateVan + "', '" +
                         USdateTot + "')";

                Data d = new Data(connectionstring);
                d.DataInsert(query);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string query = "INSERT INTO tblpersoon (GSM, Functie, Voornaam, Achternaam)";
                if (TextBoxAchternaam.Text == "")
                {
                    throw new Exception("Je moet de achternaam invullen.");
                }
                if (TextBoxFunctie.Text == "")
                {
                    throw new Exception("Je moet de functie invullen.");
                }
                if (TextBoxGSM.Text == "")
                {
                    throw new Exception("Je moet het gsm nummer invullen");
                }
                if (TextBoxVoornaam.Text == "")
                {
                    throw new Exception("Je moet de voornaam invullen");
                }


                query += " VALUES ('" +
                         TextBoxGSM.Text + "', '" +
                         TextBoxFunctie.Text + "', '" +
                         TextBoxVoornaam.Text + "', '" +
                         TextBoxAchternaam.Text + "')";

                Data d = new Data(connectionstring);
                d.DataInsert(query);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string query = "INSERT INTO tbldevice (Van, Tot)";
                //query += " VALUES (@Van, @Tot)";
                string USdateVan = DateTime.Parse(DatePickerVan.Text).ToString("yyyy-MM-dd HH:mm:ss");
                string USdateTot = DateTime.Parse(DatePickerTot.Text).ToString("yyyy-MM-dd HH:mm:ss");

                query += " VALUES ('" +
                         USdateVan + "', '" +
                         USdateTot + "')";

                Data d = new Data(connectionstring);
                d.DataInsert(query);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }