private void ExecuteDelete(object parameter) { IMessageBoxService msg = new MessageBoxService(); string title = "Deleting Business Unit"; string confirmtxt = "Do you want to delete the selected item"; if (BUs.Where(x => x.IsChecked).Count() > 1) { title = title + "s"; confirmtxt = confirmtxt + "s"; } if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK)) { foreach (ModelBaseVM si in BUs) { if (si.IsChecked) { if (si.ID > 0) { DeleteBusinessUnit(si.ID); } deleteditems.Add(si); } } foreach (ModelBaseVM pm in deleteditems) { BUs.Remove(pm); } deleteditems.Clear(); CheckValidation(); } msg = null; }
private void BUs_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e) { if (e.PropertyName != "IsChecked") { CheckValidation(); isdirty = true; } IsSelected = BUs.Where(x => x.IsChecked).Count() > 0; }
private bool BUNameMissing() { int nummissing = BUs.Where(x => string.IsNullOrEmpty(x.Name.Trim())).Count(); return(nummissing > 0); }