public void Add(Model.Model m) { switch (m.Table) { case "Educations": Educations.Add((Education)m); break; case "Students": Students.Add((Student)m); break; case "Exams": Exams.Add((Exam)m); break; case "Attempts": Attempts.Add((Attempt)m); break; } DataRow dr = dao.Data.Tables[m.Table].NewRow(); m.FillRow(dr); dao.Data.Tables[m.Table].Rows.Add(dr); dao.UpdateTable(m.Table); m.Data = dr; m.AfterCreate(); }
public void UpdateLists() { Educations.Clear(); Students.Clear(); Exams.Clear(); Attempts.Clear(); foreach (DataRow dr in dao.Data.Tables["Educations"].Rows) { Education e = new Education(dr); Educations.Add(e); Students.AddRange(e.Students); Exams.AddRange(e.Exams); } foreach (DataRow dr in dao.Data.Tables["Attempts"].Rows) { Student s = (from stud in Students where stud.ID == (int)dr["student_id"] select stud).First(); Exam e = (from ex in Exams where ex.ID == (int)dr["exam_id"] select ex).First(); Attempts.Add(new Attempt(dr, e, s)); } }
public virtual void AddFields(IEnumerable <Field> fields) { if (fields == null) { return; } // Add the fields to their corresponding container. foreach (Field field in fields) { if (field.GetType() == typeof(Data.Fields.Name)) { Names.Add((Data.Fields.Name)field); } else if (field.GetType() == typeof(Address)) { Addresses.Add((Address)field); } else if (field.GetType() == typeof(Phone)) { Phones.Add((Phone)field); } else if (field.GetType() == typeof(Email)) { Emails.Add((Email)field); } else if (field.GetType() == typeof(Job)) { Jobs.Add((Job)field); } else if (field.GetType() == typeof(Education)) { Educations.Add((Education)field); } else if (field.GetType() == typeof(Image)) { Images.Add((Image)field); } else if (field.GetType() == typeof(Username)) { Usernames.Add((Username)field); } else if (field.GetType() == typeof(UserID)) { UserIDs.Add((UserID)field); } else if (field.GetType() == typeof(DOB)) { DOB = (DOB)field; } else if (field.GetType() == typeof(Gender)) { Gender = (Gender)field; } else if (field.GetType() == typeof(Language)) { Languages.Add((Language)field); } else if (field.GetType() == typeof(Ethnicity)) { Ethnicities.Add((Ethnicity)field); } else if (field.GetType() == typeof(OriginCountry)) { OriginCountries.Add((OriginCountry)field); } else if (field.GetType() == typeof(URL)) { Urls.Add((URL)field); } } }
public void AddEducation(Education education) => Educations.Add(education);
private void DefineEducations() { Educations.Add(new Education(1, "3-årig HHX", new DateTime(2004, 6, 30), "Business College Horsens")); Educations.Add(new Education(2, "Datamatiker", new DateTime(2008, 4, 25), "Vejle IT-skole")); Educations.Add(new Education(3, "Tre dages kursus i Avanceret SQL", new DateTime(2012, 2, 1), "Teknologisk Institut Århus")); }
private void AddEducationMethod() { Educations.Add(new Models.UserPageModel.Education()); }