Exemplo n.º 1
0
        private void btnPresent_Click(object sender, RoutedEventArgs e)
        {
            //foreach (agent a in lstAgentInscrits.SelectedItems)
            //{

            //    //gst.inscription.First(inscription => inscription.numAgent == a.idAgent).presence =
            //}
            //foreach(ListItem li in  lstAgentInscrits.Items)
            //{
            //}
            gst.SaveChanges();
        }
Exemplo n.º 2
0
        private void btnInscription_Click(object sender, RoutedEventArgs e)
        {
            inscription newInscriptions = new inscription()
            {
                nbKm         = Convert.ToInt16(txtKM.Text),
                presence     = 0,
                numAgent     = (lstAgentsNonInscrits.SelectedItem as agent).idAgent,
                numFormation = (lstFormations.SelectedItem as formation).idFormation
            };

            gst.inscription.Add(newInscriptions);
            gst.SaveChanges();

            // refresh la list view
            List <agent>       allAgents = gst.agent.ToList();
            List <inscription> allInscriptionsParFormation = gst.inscription.ToList().FindAll(i => i.numFormation == (lstFormations.SelectedItem as formation).idFormation);

            var query_agent_nonInscrits = from ag in allAgents
                                          where !allInscriptionsParFormation.Any(ins => ins.numAgent == ag.idAgent)
                                          select ag;

            lstAgentsNonInscrits.ItemsSource = query_agent_nonInscrits.ToList();
        }