// Load-And-Store-Methods private void _LoadAllGridData(String month) { if (!_firstTimeMonthChanged) { StoreAllCollections(); } try { MyCollectionA = new ObservableCollection <ExcelA>(_manager.LoadCollectionExcelA(month)); MyCollectionB = new ObservableCollection <ExcelB>(_manager.LoadCollectionExcelB()); MyCollectionC = new ObservableCollection <ExcelC>(_manager.LoadCollectionExcelC(month)); } catch (System.IO.IOException e) { var x = MessageBoxService.ShowMessage("Close all the opened excel files and restart the app!", "Error", MessageButton.OK, MessageIcon.Information); if (x.Equals(MessageResult.OK)) { Environment.Exit(0); } return; } MyCollectionBMains = new ObservableCollection <String>(_manager.LoadCollectionBMains(MyCollectionB.ToList())); MyCollectionBForTable = new ObservableCollection <ExcelA>(); }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { ExcelManager _manager = new ExcelManager(); List <ExcelB> listB = _manager.LoadCollectionExcelB(); ExcelA entry = (value as BindingGroup).Items[0] as ExcelA; if (string.IsNullOrEmpty(entry.Val1)) { return(new ValidationResult(false, "Value 1 must not be empty!")); } bool contains = false; foreach (var item in listB) { if (item.Val3Main.Equals(entry.Val3)) { contains = true; } } if (contains) { return(ValidationResult.ValidResult); } else { return(new ValidationResult(false, "Value 3 must exist in ExcelB!")); } }