public void LookInfo(HumanEnt ent) { EditViewModel vm = new EditViewModel(ent, 3); var view = ViewLocator.LocateForModel(vm, null, null) as Window; if (view != null) { ViewModelBinder.Bind(vm, view, null); view.Owner = Application.Current.MainWindow; view.WindowStartupLocation = WindowStartupLocation.CenterOwner; view.ShowDialog(); } }
public void DeleteInfo(HumanEnt ent) { if (MessageBox.Show("确定删除人员" + ent.Name + "?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { if (HumanService.DeleteHuman(ent.ID)) { MessageBox.Show("删除成功", "提示"); HumanList.Remove(ent); } else { MessageBox.Show("删除失败", "提示"); } } }
public EditViewModel(HumanEnt ent, int isAdd) { _isAdd = isAdd; IsEdit = true; if (isAdd == 1) { Title = "添加"; } else if (isAdd == 2) { Title = "编辑"; } else { Title = "查看"; IsEdit = false; } if (ent != null) { Human = ent; SelSex = SexList[Human.Sex - 1]; } }