Ejemplo n.º 1
0
 private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
 {
     if (mydatagridVolunteerService_group.SelectedItem != null)
     {
         SG = mydatagridVolunteerService_group.SelectedItem as Service_group_list;
         Str_group_name.Remove(SG.務類別名稱);
         foreach (var b in ListIWantShow1)
         {
             if (SG == b)
             {
                 b.Checked = false;
             }
         }
         delete_str1.Add(SG.務類別名稱);
     }
 }
Ejemplo n.º 2
0
        public VolunteerService_group(int _volunteerNo)
        {
            InitializeComponent();
            VolunteerEntities entities = new VolunteerEntities();


            var q2 = from e2 in entities.Service_Group1
                     where e2.Volunteer_no == _volunteerNo
                     select new { group_name = e2.Service_group.Group_name };

            var q = from n in entities.Service_group
                    select new
            {
                group_name = n.Group_name
            };



            //foreach(var e in q)
            //{
            //    Service_group_list a1 = new Service_group_list();
            //    a1.服務類別名稱 = e.Group_name;
            //    ListIWantShow1.Add(a1);
            //}
            //mydatagridVolunteerService_group.ItemsSource = ListIWantShow1;
            foreach (var row1 in q)
            {
                Service_group_list service_group_list = new Service_group_list();
                foreach (var row2 in q2)
                {
                    if (row1.group_name == row2.group_name)
                    {
                        service_group_list.Checked = true;
                    }
                }
                service_group_list.務類別名稱 = row1.group_name;
                ListIWantShow1.Add(service_group_list);
            }
            mydatagridVolunteerService_group.ItemsSource = ListIWantShow1;
        }