コード例 #1
0
ファイル: ucYacht.xaml.cs プロジェクト: jacjozs/Yacht-club
        public ucYacht(int id)
        {
            // label tömb létrehozása, adatokkal való feltöltése

            InitializeComponent();
            data = new MysqlYacht();
            if (Globals.selectedYacht != null && id == Globals.selectedYacht.id)
            {
                Yacht = Globals.selectedYacht;
            }
            else
            {
                Yacht = data.MysqlYachtSelect(id);
            }
            lbAdatok = new Label[]
            {
                lbNev, lbMerul, lbHossz, lbFoglalt, lbAr, lbBerelheto, lbSeb, lbUlesek, lbHely, lbSzel, lbGyarto
            };
            Port_name();
            YachtImgLoad(false);
            LabelFeltolt();
            lbId.Content = Yacht.id.ToString();

            //Felhasználó id és yacht id összehasonlítása

            if (Globals.User.member_id == Yacht.member_id || Globals.User.login.admin)
            {
                btModosit.Visibility = Visibility.Visible;
                btBerles.Visibility  = Visibility.Hidden;
            }
            Globals.UpdateHistory();
        }
コード例 #2
0
 /// <summary>
 /// A beírt adatok eltárolása és á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 MysqlYacht();
         newYacht           = new Yacht();
         newYacht.nev       = tbYacht_nev.Text;
         newYacht.gyarto    = tbYacht_gyarto.Text;
         newYacht.member_id = TbYacht_tulaj.ID;
         newYacht.ferohely  = int.Parse(tbYacht_ferohely.Text);
         newYacht.sebesseg  = int.Parse(tbYacht_sebesseg.Text);
         newYacht.szeles    = (float)Convert.ToDouble(tbYacht_szeles.Text);
         newYacht.hossz     = (float)Convert.ToDouble(tbYacht_hossz.Text);
         newYacht.merules   = (float)Convert.ToDouble(tbYacht_merules.Text);
         ///Sikeres adatbeirás után visszajelzés az egyes usercontrolban valamint a hozzáadások táblában
         if (data.MysqlAddYacht(newYacht))
         {
             AddYachtLog(newYacht.nev + " Hozzáadva!");
             Globals.log = "Hozzáadás Sikeres! <Yacht>";
         }
         else
         {
             Globals.log = "Hozzáadás Sikertelen! <Yacht>";
         }
     }
     catch (Exception)
     {
         Globals.log = "Hozzáadás Sikertelen! <Yacht>";
     }
     finally
     {
         ///textboxok leüritése
         tbYacht_nev.Text      = "";
         tbYacht_gyarto.Text   = "";
         tbYacht_ferohely.Text = "";
         tbYacht_sebesseg.Text = "";
         tbYacht_szeles.Text   = "";
         tbYacht_hossz.Text    = "";
         tbYacht_merules.Text  = "";
     }
     Globals.Main.logAdd(true);
 }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        public void Loading()
        {
            data   = new MysqlYacht();
            Yachts = data.MysqlYachts(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 < Yachts.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 = "Név: " + Yachts[i].nev;
                nev.Style   = MessageStackMiniLabel;
                nev.Width   = 206.5;

                StackPanel panel3 = new StackPanel();
                panel3.Width  = 240;
                panel3.Height = 55;

                Label tipus = new Label();
                tipus.Content = "Gyártó: " + Yachts[i].gyarto;
                tipus.Style   = MessageStackMiniLabel;

                panel.Children.Add(nev);
                panel.Children.Add(tipus);

                panel.Style = ListStackPanel;

                spList.Children.Add(panel);
            }
        }
コード例 #5
0
ファイル: ucYachtok.xaml.cs プロジェクト: jacjozs/Yacht-club
        public void Loading()
        {
            data   = new Database.MysqlYacht();
            Yachts = data.MysqlYachts(Globals.User.member_id);
            Style MenuStackLabel = Application.Current.FindResource("MenuStackLabel") as Style;
            Style ListStackPanel = Application.Current.FindResource("ListStackPanel") as Style;

            for (int i = 0; i < Yachts.Count; i++)
            {
                StackPanel panel = new StackPanel();
                panel.Orientation = Orientation.Horizontal;
                panel.Margin      = new Thickness(0, 0, 0, 2);
                panel.Height      = 53;
                panel.Width       = 793;
                panel.MouseDown  += new MouseButtonEventHandler(dpMouse_Click);
                panel.Uid         = i.ToString();

                StackPanel panel2 = new StackPanel();
                panel2.Width  = 175;
                panel2.Height = 55;

                Label ID = new Label();
                ID.Content = "ID: " + Yachts[i].id;
                ID.Style   = MenuStackLabel;

                Label nev = new Label();
                nev.Content = "Név: " + Yachts[i].nev;
                nev.Style   = MenuStackLabel;

                panel2.Children.Add(ID);
                panel2.Children.Add(nev);

                StackPanel panel3 = new StackPanel();
                panel3.Width  = 240;
                panel3.Height = 55;

                Label tipus = new Label();
                tipus.Content = "Gyártó: " + Yachts[i].gyarto;
                tipus.Style   = MenuStackLabel;

                Label Tulaj = new Label();
                Tulaj.Content = "Tulajdonos: " + Yachts[i].full_name;
                Tulaj.Style   = MenuStackLabel;

                panel3.Children.Add(tipus);
                panel3.Children.Add(Tulaj);

                StackPanel panel4 = new StackPanel();
                panel4.Width  = 160;
                panel4.Height = 55;

                Label ferohely = new Label();
                ferohely.Content = "Férőhely: " + Yachts[i].ferohely;
                ferohely.Style   = MenuStackLabel;

                Label Napiar = new Label();
                Napiar.Content = "Napi ár: " + Yachts[i].napi_ar;
                Napiar.Style   = MenuStackLabel;

                panel4.Children.Add(Napiar);
                panel4.Children.Add(ferohely);

                StackPanel panel5 = new StackPanel();
                panel5.Width  = 218;
                panel5.Height = 55;
                panel5.HorizontalAlignment = HorizontalAlignment.Left;

                Label kikoto = new Label();
                kikoto.Content = "Kikötő: " + Yachts[i].kikoto;
                kikoto.Style   = MenuStackLabel;

                panel5.Children.Add(kikoto);

                panel.Children.Add(panel2);
                panel.Children.Add(panel3);
                panel.Children.Add(panel4);
                panel.Children.Add(panel5);

                panel.Style = ListStackPanel;

                spList.Children.Add(panel);
            }
        }