コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Strelec = client.GetStrelec(Item);

            textBoxIme.Text         = Strelec.Ime;
            textBoxPriimek.Text     = Strelec.Priimek;
            textBoxLetoRojstva.Text = Strelec.LetoRojstva.ToString();

            var klubi        = client.ReturnStrelecVKlubus();
            var strelecKlubi = klubi.Where(a => a.Strelec.StrelecID == Strelec.StrelecID).ToList();

            strelecKlubi.Where(a => a.Do == null).ToList().ForEach(a => a.Klub.Naziv = a.Klub.Naziv + " **");

            var cStrelecKlubi = (from a in strelecKlubi
                                 select new
            {
                Naziv = a.Klub.Naziv,
                StrelecKlubID = a.StrelecKlubID
            }).ToList();

            listBox.ItemsSource       = null;
            listBox.DisplayMemberPath = "Naziv";
            listBox.SelectedValuePath = "StrelecKlubID";
            listBox.ItemsSource       = cStrelecKlubi;


            List <ServiceReferenceSZ.Klub> vsiKlubi = new List <ServiceReferenceSZ.Klub>();

            vsiKlubi                   = client.ReturnKlubi().ToList();
            listBox1.ItemsSource       = null;
            listBox1.DisplayMemberPath = "Naziv";
            listBox1.SelectedValuePath = "KlubID";
            listBox1.ItemsSource       = vsiKlubi;
        }
コード例 #2
0
 private void buttonSave_Click(object sender, RoutedEventArgs e)
 {
     if (int.TryParse(textBoxLetoRojstva.Text, out int letoRojstva))
     {
         ServiceReferenceSZ.Strelec newStrelec = new ServiceReferenceSZ.Strelec
         {
             StrelecID   = Strelec.StrelecID,
             Ime         = textBoxIme.Text,
             Priimek     = textBoxPriimek.Text,
             LetoRojstva = letoRojstva
         };
         if (client.UpdateStrelec(newStrelec))
         {
             Strelec           = newStrelec;
             this.DialogResult = true;
         }
         else
         {
             MessageBox.Show("napaka pri posodabljanju podatkovne baze");
         }
     }
     else
     {
         MessageBox.Show("leto rojstva mora biti stevilo!");
     }
 }
コード例 #3
0
 private void buttonSave_Click(object sender, RoutedEventArgs e)
 {
     if (Tip == 0)
     {
         if (int.TryParse(textBoxLrLu.Text, out int lr))
         {
             ServiceReferenceSZ.Strelec s = new ServiceReferenceSZ.Strelec
             {
                 Ime         = textBoxIme.Text,
                 Priimek     = textBoxPriimek.Text,
                 LetoRojstva = lr
             };
             client.AddStrelec(s, out int id);
             this.DialogResult = true;
         }
         else
         {
             MessageBox.Show("Leto rojstva mora biti stevilo");
         }
     }
     else
     {
         if (int.TryParse(textBoxLrLu.Text, out int lr))
         {
             ServiceReferenceSZ.Klub k = new ServiceReferenceSZ.Klub
             {
                 Naziv           = textBoxIme.Text,
                 Naslov          = textBoxPriimek.Text,
                 LetoUstanovitve = lr
             };
             client.AddKlub(k);
             this.DialogResult = true;
         }
         else
         {
             MessageBox.Show("Leto ustanovitve mora biti stevilo");
         }
     }
 }