/// <summary> /// szállitoeszköz adatainak bejügytése egy objectumba és annak átadása az adatbázisnak /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_Hozza_add(object sender, RoutedEventArgs e) { try { data = new MysqlDevice(); newDevice = new Device();; newDevice.tipus = tbSzallito_tipus.Text; newDevice.member_id = TbDevice_tulaj.ID; newDevice.max_suly = int.Parse(tbSzallito_teherb.Text); newDevice.max_hossz = tbSzallito_hossz.Text; newDevice.id = data.MysqlAddDevice(newDevice); if (newDevice.id != 0) { ///Visszajelzés ha sikeres volt a hozzáadás AddYachtLog("ID: " + newDevice.id + " Szállitóeszköz Hozzáadva!"); Globals.log = "Hozzáadás Sikeres! <Szállitóeszköz>"; } else { Globals.log = "Hozzáadás Sikertelen! <Szállitóeszköz>"; } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "valami", MessageBoxButton.OK); Globals.log = "Hozzáadás Sikertelen! <Szállitóeszköz>"; } finally { ///Az egyes usercontrolhoz való log hozzáadás Globals.Main.logAdd(true); } }
private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int id = int.Parse(((Label)sender).Uid.Split(':')[0]); string name = ((Label)sender).Uid.Split(':')[1]; switch (name) { case "Yach.": MysqlYacht yachtDat = new MysqlYacht(); Globals.selectedYacht = yachtDat.MysqlYachtSelect(id); Globals.Main.ccWindow_Main.Content = new ucYacht(id); yachtDat = null; break; case "Száll.": MysqlDevice deviceDat = new MysqlDevice(); Globals.selectedDevice = deviceDat.MysqlDeviceSelect(id); Globals.Main.ccWindow_Main.Content = new ucSzallito(id); deviceDat = null; break; } }
public void Loading() { data = new MysqlDevice(); Devices = data.MysqlDevices(Globals.User.member_id); Style MessageStackMiniLabel = Application.Current.FindResource("MessageStackMiniLabel") as Style; Style ListStackPanel = Application.Current.FindResource("ListStackPanel") as Style; for (int i = 0; i < Devices.Count; i++) { StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; panel.Margin = new Thickness(0, 0, 0, 1); panel.Height = 29; panel.Width = 396.5; panel.MouseDown += dpMouse_Click; panel.Uid = i.ToString(); Label nev = new Label(); nev.Content = "ID: " + Devices[i].id; nev.Style = MessageStackMiniLabel; nev.Width = 206.5; StackPanel panel3 = new StackPanel(); panel3.Width = 240; panel3.Height = 55; Label tipus = new Label(); tipus.Content = "Típus: " + Devices[i].tipus; tipus.Style = MessageStackMiniLabel; panel.Children.Add(nev); panel.Children.Add(tipus); panel.Style = ListStackPanel; spList.Children.Add(panel); } }