/// <summary> /// Edits the action. /// </summary> /// <param name="model">The model.</param> public void EditAction(T model) { if (model == null) { MessageBox.Show("请选择要编辑的记录", "失败", MessageBoxButton.OK, MessageBoxImage.Error); return; } var w = AppEx.Container.GetInstance <IViewModel>(EditViewModeKey); w.Model = model; BeforeEdit(w, model); if (w.View.ShowDialog() == true) { IBaseDataService <T> service = GetDataService(); ResultMsg resultMsg = service.Edit((T)w.Model); if (resultMsg.IsSuccess) { _Collection.Clear(); if (SearchCommand.CanExecute(null)) { SearchCommand.Execute(null); } } else { MessageBox.Show("修改失败", "失败", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public void UpdateOrg() { var w = AppEx.Container.GetInstance <IViewModel>("OrgViewModel") as OrgAddWindowViewMode; w.GetOrgRefreshStoreOrSection(OPC_OrgInfo.OrgType); w.Model = OPC_OrgInfo; if (w.View.ShowDialog() == true) { IBaseDataService <OPC_OrgInfo> service = GetDataService(); ResultMsg resultMsg = service.Edit((OPC_OrgInfo)w.Model); if (resultMsg.IsSuccess) { Update(w.Model as OPC_OrgInfo); } else { MessageBox.Show("修改失败", "失败", MessageBoxButton.OK, MessageBoxImage.Error); } } }