public AuthorsVMClass(string str) { AuthorsRecords = new ObservableCollection <AuthorsRecord>(); AuthorsRecord = new AuthorsRecord(); RuleOrderLine = new RuleOrderLine(""); DefaultDataLoad(); AllAuthorsCall(); PropertyChanged += ChangeProperty; }
private void AllAuthorsCall() { using (StudentuConteiner db = new StudentuConteiner()) { try { var result = db.Authors. Include("Subject") .Include("Direction") .Include("Persone") .Include("AuthorStatus").ToList(); AuthorsRecord record; int count = result.Count(); for (int i = 1; i < count; i++) { record = new AuthorsRecord { Author = result[i], Persone = result[i].Persone, Contacts = result[i].Persone.Contacts }; AuthorsRecords.Add(record); } } catch (ArgumentNullException ex) { dialogService.ShowMessage(ex.Message); } catch (OverflowException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.SqlClient.SqlException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.Entity.Core.EntityCommandExecutionException ex) { dialogService.ShowMessage(ex.Message); } catch (System.Data.Entity.Core.EntityException ex) { dialogService.ShowMessage(ex.Message); } } }