private void BtnEinkommen_Click(object sender, RoutedEventArgs e) { DatePicker dp = stckZeileEinkommen.Children[0] as DatePicker; TextBox tb = stckZeileEinkommen.Children[1] as TextBox; Nummernfeld num = stckZeileEinkommen.Children[2] as Nummernfeld; ComboBox cmb = stckZeileEinkommen.Children[3] as ComboBox; if (tb.Text.Length > 0 && num.Text.Length > 0) { string sql = "insert into einkommen (datum,bezeichnung,betrag,person) values('" + string.Format("yyyy-MM-dd", dp.SelectedDate) + "',@bez,@betr," + ((Person)cmb.SelectedItem).id + ")"; MySqlParameter par_bez = new MySqlParameter("@bez", MySqlDbType.VarChar); MySqlCommand command = new MySqlCommand(sql); command.Parameters.Add(par_bez); MySqlParameter par_betr = new MySqlParameter("@betr", MySqlDbType.Double); command.Parameters.Add(par_betr); int?result = InsertEinkommen?.Invoke(command); if (result > 0) { TextBox[] t = { tb, num.txtBox }; Clear(t); } } else { MessageBox.Show("Bitte alle Felder ausfüllen"); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\MainWindow.xaml" ((Haushaltsbuch.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.Fenster = ((System.Windows.Controls.DockPanel)(target)); return; case 3: #line 12 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Uebersicht_Click); #line default #line hidden return; case 4: #line 13 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Eintrag_Click); #line default #line hidden return; case 5: #line 18 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Einkommen_Click); #line default #line hidden return; case 6: #line 19 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Suchen_CLick); #line default #line hidden return; case 7: this.miVerbinden = ((System.Windows.Controls.MenuItem)(target)); #line 20 "..\..\MainWindow.xaml" this.miVerbinden.Click += new System.Windows.RoutedEventHandler(this.Verbinden_Click); #line default #line hidden return; case 8: this.uebersicht = ((System.Windows.Controls.TabControl)(target)); return; case 9: this.thisWeek = ((System.Windows.Controls.TabItem)(target)); #line 24 "..\..\MainWindow.xaml" this.thisWeek.GotFocus += new System.Windows.RoutedEventHandler(this.tabItem_GotFocus); #line default #line hidden return; case 10: this.lastWeek = ((System.Windows.Controls.TabItem)(target)); #line 28 "..\..\MainWindow.xaml" this.lastWeek.GotFocus += new System.Windows.RoutedEventHandler(this.tabItem_GotFocus); #line default #line hidden return; case 11: this.thisMonth = ((System.Windows.Controls.TabItem)(target)); #line 29 "..\..\MainWindow.xaml" this.thisMonth.GotFocus += new System.Windows.RoutedEventHandler(this.tabItem_GotFocus); #line default #line hidden return; case 12: this.lastMonth = ((System.Windows.Controls.TabItem)(target)); #line 30 "..\..\MainWindow.xaml" this.lastMonth.GotFocus += new System.Windows.RoutedEventHandler(this.tabItem_GotFocus); #line default #line hidden return; case 13: this.grdEinkommen = ((System.Windows.Controls.ScrollViewer)(target)); return; case 14: this.stckEinkommen = ((System.Windows.Controls.StackPanel)(target)); return; case 15: this.tbcEintrag = ((System.Windows.Controls.TabControl)(target)); return; case 16: this.tbiRechnung = ((System.Windows.Controls.TabItem)(target)); return; case 17: this.tbiShop = ((System.Windows.Controls.TabItem)(target)); return; case 18: this.tbiProdgr = ((System.Windows.Controls.TabItem)(target)); return; case 19: this.tbiEinkommen = ((System.Windows.Controls.TabItem)(target)); return; case 20: this.grdSuchen = ((System.Windows.Controls.Grid)(target)); return; case 21: this.txtBezeichnung = ((System.Windows.Controls.TextBox)(target)); return; case 22: this.cmbLaden = ((System.Windows.Controls.ComboBox)(target)); return; case 23: this.cmbKategorie = ((System.Windows.Controls.ComboBox)(target)); return; case 24: this.stckPreisSuchen = ((System.Windows.Controls.StackPanel)(target)); return; case 25: this.rHigher = ((System.Windows.Controls.RadioButton)(target)); return; case 26: this.rLower = ((System.Windows.Controls.RadioButton)(target)); return; case 27: this.rEquals = ((System.Windows.Controls.RadioButton)(target)); return; case 28: this.numPreis = ((Haushaltsbuch.Nummernfeld)(target)); return; case 29: this.dpDatum = ((System.Windows.Controls.DatePicker)(target)); return; case 30: this.rVor = ((System.Windows.Controls.RadioButton)(target)); return; case 31: this.rAm = ((System.Windows.Controls.RadioButton)(target)); return; case 32: this.rNach = ((System.Windows.Controls.RadioButton)(target)); return; case 33: this.rZwischen = ((System.Windows.Controls.RadioButton)(target)); return; case 34: this.dpDatum2 = ((System.Windows.Controls.DatePicker)(target)); return; case 35: this.rEinmal = ((System.Windows.Controls.RadioButton)(target)); return; case 36: this.rFest = ((System.Windows.Controls.RadioButton)(target)); return; case 37: this.rBeide = ((System.Windows.Controls.RadioButton)(target)); return; case 38: this.btnSuchenStarten = ((System.Windows.Controls.Button)(target)); #line 94 "..\..\MainWindow.xaml" this.btnSuchenStarten.Click += new System.Windows.RoutedEventHandler(this.btnSuchenStarten_Click); #line default #line hidden return; case 39: this.lstSuchResultat = ((System.Windows.Controls.ListView)(target)); return; case 40: this.bearbeiten = ((System.Windows.Controls.MenuItem)(target)); #line 108 "..\..\MainWindow.xaml" this.bearbeiten.Click += new System.Windows.RoutedEventHandler(this.bearbeiten_Click); #line default #line hidden return; case 41: this.txtAnz = ((System.Windows.Controls.TextBlock)(target)); return; case 42: this.lblSumme = ((System.Windows.Controls.Label)(target)); return; case 43: this.lblAvg = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }