Пример #1
0
 private void detailgrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         PersonalundBerechtigung selectedEintrag = (PersonalundBerechtigung)detailgrid.SelectedItem;
         detailedview            Detailview      = new detailedview(selectedEintrag, conn);
         Detailview.ShowDialog();
         if (Detailview.DialogResult == true)
         {
             string       SQLCommand1 = string.Format("UPDATE Personal SET Geschlecht='{0}',GeburtsDatum='{1}',PVorname='{2}',PNachname='{3}',PersID='{4}',VerNr='{5}',PAdresse='{6}',PTelNr='{7}',Rolle='{8}' WHERE PersID='{9}'", Detailview.ComboGeschlecht.Text, Detailview.TextBoxGeburtsdatum.Text, Detailview.TextBoxVorname.Text, Detailview.TextBoxNachname.Text, Detailview.TextBoxID.Text, Detailview.TextBoxVerNr.Text, Detailview.TextBoxAdresse.Text, Detailview.TextBoxTel.Text, Detailview.ComboRolle.Text, selectedEintrag.PersID);
             MySqlCommand cmd1        = new MySqlCommand(SQLCommand1, conn);
             cmd1.ExecuteNonQuery();
             string       SQLCommand2 = string.Format("UPDATE Berechtigung SET BID='{0}',darfarbeitenin='{1}',Ausbildung='{2}' WHERE BID='{3}'", Detailview.TextBoxBID.Text, Detailview.Combodai.Text, Detailview.TextBoxAusbildung.Text, selectedEintrag.BID);
             MySqlCommand cmd2        = new MySqlCommand(SQLCommand2, conn);
             cmd2.ExecuteNonQuery();
             laden();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorry something crashed: \r\n" + ex.Message);
     }
 }
Пример #2
0
        private void Menu_Insert_Click(object sender, RoutedEventArgs e)
        {
            detailedview Detailview = new detailedview();

            Detailview.ShowDialog();
            if (Detailview.DialogResult == true)
            {
                try
                {
                    string       SQLCommand3 = string.Format("INSERT INTO Personal VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", Detailview.ComboGeschlecht.Text, Detailview.TextBoxGeburtsdatum.Text, Detailview.TextBoxVorname.Text, Detailview.TextBoxNachname.Text, Detailview.TextBoxID.Text, Detailview.TextBoxVerNr.Text, Detailview.TextBoxAdresse.Text, Detailview.TextBoxTel.Text, Detailview.ComboRolle.Text);
                    MySqlCommand cmd3        = new MySqlCommand(SQLCommand3, conn);
                    cmd3.ExecuteNonQuery();

                    string       SQLCommand4 = string.Format("INSERT INTO Berechtigung VALUES('{0}','{1}','{2}','{3}')", Detailview.TextBoxID.Text, Detailview.TextBoxBID.Text, Detailview.Combodai.Text, Detailview.TextBoxAusbildung.Text);
                    MySqlCommand cmd4        = new MySqlCommand(SQLCommand4, conn);
                    cmd4.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("An Error occured:\r\n" + ex.Message);
                }
                laden();
            }
        }