/// <summary> /// 获取图书馆列表 /// </summary> /// <returns></returns> public static ObservableCollection <ViewModel.ViewModel_Library> GetLibrarys() { try { ObservableCollection <ViewModel.ViewModel_Library> viewModelList = new ObservableCollection <ViewModel.ViewModel_Library>(); List <SeatManage.ClassModel.LibraryInfo> modelList = SeatManage.Bll.T_SM_Library.GetLibraryInfoList(null, null, null); foreach (SeatManage.ClassModel.LibraryInfo model in modelList) { ViewModel.ViewModel_Library viewModel = new ViewModel.ViewModel_Library(); viewModel.LibraryModel = model; viewModelList.Add(viewModel); } return(viewModelList); } catch { throw; } }
/// <summary> /// 删除图书馆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void deletlib_Click(object sender, RoutedEventArgs e) { if (libbox.SelectedIndex < 0) { MessageBox.Show("请先选择一个项目!"); } else { if (MessageBox.Show("是否确认删除?", "删除", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ViewModel.ViewModel_Library vm = libbox.SelectedItem as ViewModel.ViewModel_Library; vm.Delete(); if (vm.ErrorMessage == "") { BindingData(); } else { viewModel.ErrorMessage = vm.ErrorMessage; } } } }