public ObservableCollection<Model.Person> SelectStudentsMemberInAllCourses()
 {
     using (var db=new EducationCourses())
     {
         return new ObservableCollection<Person>(db.StudentsMemberInAllCourses());
     }
 }
 public System.Collections.ObjectModel.ObservableCollection<Model.Person> SelectStudentsMemberInCoursesThatTeacherGood()
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Person>(db.StudentsMemberInCoursesThatTeacherGood());
     }
 }
 public List<Person> SelectAllStudents()
 {
     using (var db=new EducationCourses())
     {
         return db.Persons.Where(p => p.Type == PersonType.Student).ToList();   
     }
 }
        public void Update(Guid oldPersonID, Person newPerson)
        {
            using (var db = new EducationCourses())
            {
                Person oldPerson = db.Persons.SingleOrDefault(person => person.ID == oldPersonID);
                oldPerson.Name = newPerson.Name;
                oldPerson.Family = newPerson.Family;
                oldPerson.Account = newPerson.Account;
                oldPerson.Address = newPerson.Address;
                oldPerson.BirthDay = newPerson.BirthDay;
                oldPerson.Type = newPerson.Type;
                oldPerson.Tel = newPerson.Tel;
                oldPerson.Cities_ID = newPerson.Cities_ID;
                oldPerson.Tel = newPerson.Tel;
                oldPerson.Gender = newPerson.Gender;
                oldPerson.Level = newPerson.Level;
                oldPerson.Gender = newPerson.Gender;
                oldPerson.NationalCode = newPerson.NationalCode;
                db.SaveChanges();
                if (this.PersonUpdated != null)
                    this.PersonUpdated(this, new CustomEventArgs<Person>(newPerson));
            }


        }
 public List<State> SelectAllStates()
 {
     using (var db = new EducationCourses())
     {
         return db.States.ToList();
     }
 }
 public List<Model.Person> SelectPersons()
 {
     using (var db = new EducationCourses())
     {
         return new List<Person>(db.Persons.ToList());
     }
 }
 public Person SelectByID(Guid id)
 {
     using (var db = new EducationCourses())
     {
         return db.Persons.SingleOrDefault(person => person.ID == id);
     }
 }
 public System.Collections.ObjectModel.ObservableCollection<Model.Person> SelectThreeFirstTeacherWithHighPrice()
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Person>(db.ThreeFirstTeacherWithHighPrice());
     }
 }
 public System.Collections.ObjectModel.ObservableCollection<Model.Person> SelectTeachersThatTeachAllLessons()
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Person>(db.TeachersThatTeachAllLessons());
     }
 }
 public ObservableCollection<Person> SelectTeachers()
  {
      using (var db=new EducationCourses())
      {
          return new ObservableCollection<Person>(db.Persons.Where(p => p.Type == PersonType.Teacher));
      }
  }
 public List<Model.Location> SelectAll()
 {
     using (var db = new EducationCourses())
     {
         return db.Locations.ToList();
     }
 }
Ejemplo n.º 12
0
 public List<Person> SelectStudentsOfCourse(Course course)
 {
     using (var db = new EducationCourses())
     {
         return new List<Person>(db.SelectStudentsByCourseNo(course.ID));
     }
 }
 public ObservableCollection<Model.Course> SelectAll()
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Course>(db.Courses.Include("Location").Include("Person").Include("Lesson").ToList());
     }
 }
 public ObservableCollection<Model.Person> SelectStudentsMemberInCoursesOfSpecialTeacher(Model.Person teacher)
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Person>(db.StudentsMemberInCoursesOfSpecialTeacher(teacher.ID));
     }
 }
 public ObservableCollection<Location> SelectAllLocations()
 {
     using (var db = new EducationCourses())
     {
         return new ObservableCollection<Location>(db.Locations.ToList());
     }
 }
Ejemplo n.º 16
0
 public List<Course> SelectAllCourses()
 {
     using (var db = new EducationCourses())
     {
         return new List<Course>
             (db.Courses.Include("Person").Include("Lesson").Include("Location").ToList());
     }
 }
 public void Insert(Course course,Person student)
 {
     using (var db=new EducationCourses())
     {
         db.MemberShips.Add(new MemberShip {ID=Guid.NewGuid(), Courses_ID = course.ID, Persons_ID = student.ID, 
             MemberShipDate = PersianDateTime.Now.Date.ToString().Substring(0,10)});
         db.SaveChanges();
     }
 }
        public List<Course> SelectAllCourses()
        {
            using (var db = new EducationCourses())
            {
                //return db.CoursesThatHaveCapacity().ToList();

                return db.Courses.Include("Person").Include("Lesson").Where(c => c.Capacity > db.MemberShips.Where(m => m.Courses_ID == c.ID).Count()).ToList();
            }
            
        }
 public void Insert(Model.Person person)
 {
     using (var db = new EducationCourses())
     {
         db.Persons.Add(person);
         db.SaveChanges();
         if (this.PersonAdded != null)
             this.PersonAdded(this, new CustomEventArgs<Person>(person));
     }
 }
 public void Delete(Person person)
 {
     using (var db=new EducationCourses())
     {
         db.Persons.Remove(db.Persons.SingleOrDefault(p => p.ID == person.ID));
         db.SaveChanges();
         if (this.PersonDeleted != null)
             this.PersonDeleted(this, new CustomEventArgs<Person>(person));
     }
 }
 public void Delete(Model.Course course)
 {
     using (var db = new EducationCourses())
     {
         db.Courses.Attach(course);
         db.Courses.Remove(course);
         db.SaveChanges();
         if (this.CourseDeleted != null)
             this.CourseDeleted(this, new CustomEventArgs<Course>(course));
     }
 }
 public void Insert(string name)
 {
     using (var db=new EducationCourses())
     {
         Lesson lesson = new Lesson { ID = Guid.NewGuid(), Name = name };
         db.Lessons.Add(lesson);
         db.SaveChanges();
         if (this.LessonAdded != null)
             this.LessonAdded(this, new CustomEventArgs<Lesson>(lesson));
     }
 }
 public void Insert(Model.Location location)
 {
     using (var db=new EducationCourses())
     {
         location.ID = Guid.NewGuid();
         db.Locations.Add(location);
         db.SaveChanges();
         if (this.Added != null)
             this.Added(this, new CustomEventArgs<Location>(location));
     }
 }
 public void Delete(Model.Location location)
 {
     using (var db = new EducationCourses())
     {
         db.Locations.Attach(location);
         db.Locations.Remove(location);
         db.SaveChanges();
         if (this.Deleted != null)
             this.Deleted(this, new CustomEventArgs<Location>(location));
     }
 }
 public void Insert(Model.Course course)
 {
     using (var db = new EducationCourses())
     {
         course.Location = null;
         course.Lesson = null;
         course.Person = null;
         db.Courses.Add(course);
         db.SaveChanges();
         if (this.CourseAdded != null)
             this.CourseAdded(this, new CustomEventArgs<Course>(course));
     }
 }
 public void Update(Model.Course course, Guid id)
 {
     using (var db = new EducationCourses())
     {
         Course temp = db.Courses.Find(id);
         temp.LengthClassTime = course.LengthClassTime;
         temp.Lessons_ID = course.Lesson.ID;
         temp.Persons_ID = course.Person.ID;
         temp.StartTime = course.StartTime;
         temp.Duration = course.Duration;
         temp.Locations_ID = course.Location.ID;
         temp.Cost = course.Cost;
         temp.Capacity = course.Capacity;
         temp.LengthClassTime = course.LengthClassTime;
         db.SaveChanges();
         if (this.CourseUpdated != null)
             this.CourseUpdated(this, new CustomEventArgs<Course>(temp));
     }
 }
 public List<Person> SearchPersonByName(string name)
 {
     using (var db = new EducationCourses())
     {
         return new List<Person>(db.Persons.Where(person => person.Name.StartsWith(name)).ToList());
     }
 }
 public List<City> SelectCitiesByState(int stateId)
 {
     using (var db = new EducationCourses())
     {
         return db.Cities.Where(city=>city.States_ID==stateId).Select(c=>c).ToList();
     }
 }