private bool IsInvalidValidChars() { char[] chars = { ';', ',' }; int invalid = ProductNames.Where(x => x.Name.IndexOfAny(chars) != -1).Count(); return(invalid > 0); }
private void ExecuteDelete(object parameter) { IMessageBoxService msg = new MessageBoxService(); string title = "Deleting Product Name"; string confirmtxt = "Do you want to delete the selected item"; if (ProductNames.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 ProductNames) { if (si.IsChecked) { if (si.ID > 0) { DeleteProductName(si.ID); } deleteditems.Add(si); } } foreach (ModelBaseVM pm in deleteditems) { ProductNames.Remove(pm); } deleteditems.Clear(); CheckValidation(); } msg = null; }
private void ProductNames_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e) { if (e.PropertyName != "IsChecked") { CheckValidation(); isdirty = true; } IsSelected = ProductNames.Where(x => x.IsChecked).Count() > 0; }
private bool IsNameMissing() { int nummissing = ProductNames.Where(x => string.IsNullOrEmpty(x.Name.Trim())).Count(); return(nummissing > 0); }