public void emptyConsultation() { SelectedConsultation = null; Act1 = null; CtDate1 = DateTime.Today; Cost1 = 0; RaisePropertyChanged("SelectedConsultation1"); }
public void NewConsultation() { ConsultationSet cts = new ConsultationSet(); if (Act1 != null && CtDate1 != null && Cost1 != 0 && SelectedFile1 != null) { cts.actNature = Act1; cts.cost = Cost1; cts.date = CtDate1; cts.FileSet = SelectedFile1; try { ctx.ConsultationSets.Add(cts); ctx.SaveChanges(); this.X = true; searching(); this.X = false; MessageBox.Show("Consultation Added" + Files.Count); RaisePropertyChanged("Files"); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } } else { MessageBox.Show("Entries can not be empty"); } }