private void ExecuteDelete(object parameter) { IMessageBoxService msg = new MessageBoxService(); string title = "Deleting Industry Segment"; string confirmtxt = "Do you want to delete the selected item"; if (IndustrySegments.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 (IndustrySegmentModel si in IndustrySegments) { if (si.IsChecked) { if (si.ID > 0) { DeleteIndustrySegment(si.ID); } deleteditems.Add(si); } } foreach (IndustrySegmentModel pm in deleteditems) { IndustrySegments.Remove(pm); } deleteditems.Clear(); CheckValidation(); } msg = null; }
private void IndustrySegments_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e) { if (e.PropertyName != "IsChecked") { CheckValidation(); isdirty = true; } IsSelected = IndustrySegments.Where(x => x.IsChecked).Count() > 0; }
private bool IsIndustryMissing() { int nummissing = IndustrySegments.Where(x => x.IndustryID == 0).Count(); return(nummissing > 0); }
private bool IsNameMissing() { int nummissing = IndustrySegments.Where(x => string.IsNullOrEmpty(x.Name.Trim())).Count(); return(nummissing > 0); }