private void SelectAllAndMoveFrozen() { SelectablePersons.FreezeCollectionNotifications(); SelectedPersons.FreezeCollectionNotifications(); SelectAllPersons(); RemoveFromFirstGrid(CopySelectedToSecondGrid()); SelectedPersons.UnfreezeCollectionNotifications(); SelectablePersons.UnfreezeCollectionNotifications(); }
private void ResetGrids() { BusyWork = true; ResetSelectablePersonsCollection(); SelectedPersons.FreezeCollectionNotifications(); SelectedPersons.Clear(); SelectedPersons.UnfreezeCollectionNotifications(); BusyWork = false; }
private List <Shared.Selectables.Person> CopySelectedToSecondGrid() { List <Shared.Selectables.Person> selections = new List <Shared.Selectables.Person>(); foreach (Shared.Selectables.Person p in SelectablePersons) { if (p.Selected) { selections.Add(p); SelectedPersons.Add(p); } } return(selections); }
public void Delete() { if (SelectedPersons.Count == 0) { Status = "请选中要删除的记录"; return; } if (_rentRepo.Query(e => e.Person == SelectedPerson && e.EndDate == DateTime.MinValue).Count > 0) { MessageBoxService.Show(string.Format("[{0}]存在未归还的记录,不允许删除", SelectedPerson.Name), "提示"); return; } if (MessageBoxService.Show(string.Format("确定要删除{0}吗?", SelectedPersons.ToString(e => e.Name)), "提示", MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } int count = 0; foreach (var item in SelectedPersons.ToArray()) { var result = _repo.Delete(item); if (result) { Logger.DebugFormat("删除Person,Id={0}, Name={1}", item.Id, item.Name); count++; SendMsg(new ItemChangedMsg <Person>(ActionMode.Delete, item)); Persons.Remove(item); } } Status = string.Format("删除{0}人!", count); if (count > 0 && Persons.Count > 0) { SelectedPerson = Persons.Last(); } }
private void RemoveSelectedFromSelectedPersons() { Persons.Add(SelectedSelectedPerson); SelectedPersons.Remove(SelectedSelectedPerson); }
private void AddSelectedToSelectedPersons() { SelectedPersons.Add(SelectedListPerson); Persons.Remove(SelectedListPerson); }