Пример #1
0
        private void CompanyGrid_CurrentCellChanged(object sender, EventArgs e)
        {
            TB_COMPANY temp = CompanyGrid.CurrentItem as TB_COMPANY;

            if (!temp.Equals(null))
            {
                var tb_users = from item in db.TB_USERS
                               where item.CL_IdCOMPANY == temp.CL_ID
                               select item;
                if (!tb_users.Equals(null))
                {
                    UsersGrid.ItemsSource = tb_users.ToList();
                }
            }
        }
Пример #2
0
 private void Remove_Click(object sender, RoutedEventArgs e)
 {
     if (CompanyGrid.SelectedItems.Count > 0)
     {
         for (int i = 0; i < CompanyGrid.SelectedItems.Count; i++)
         {
             TB_COMPANY temp = (TB_COMPANY)CompanyGrid.SelectedItems[i];
             db.TB_COMPANY.Remove(temp);
         }
     }
     else if (UsersGrid.SelectedItems.Count > 0)
     {
         for (int i = 0; i < UsersGrid.SelectedItems.Count; i++)
         {
             TB_USERS temp = (TB_USERS)UsersGrid.SelectedItems[i];
             db.TB_USERS.Remove(temp);
         }
     }
     db.SaveChanges();
     UpdateTables();
 }