private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            WinCacheMaterialAddOrEdit win = new WinCacheMaterialAddOrEdit(null);

            win.ShowDialog();
            Query();
        }
 private void BtnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (DGMain.SelectedItem == null)
     {
         MessageBox.Show("请先选中一条数据!");
         return;
     }
     if (DGMain.SelectedItems.Count > 1)
     {
         MessageBox.Show("每次只能选择一条");
         return;
     }
     else
     {
         StationCache temp             = (StationCache)DGMain.SelectedItem;
         WinCacheMaterialAddOrEdit win = new WinCacheMaterialAddOrEdit(temp.Id);
         win.ShowDialog();
         Query();
     }
 }