예제 #1
0
 public static SMaPEntities getContext()
 {
     if (applicationDbContext == null)
     {
         applicationDbContext = new SMaPEntities();
     }
     return(applicationDbContext);
 }
예제 #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         int TeamID = (int)value;
         using (var dbcontext = new SMaPEntities())
         {
             return(dbcontext.Team.Single(x => x.ID == TeamID).TeamName);
         }
     }
     return("");
 }
예제 #3
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         return("");
     }
     else
     {
         Student student = (Student)value;
         using (var context = new SMaPEntities())
         {
             Team studentTeam = context.Team.Where(x => x.ID == student.TeamID).FirstOrDefault();
             return(String.Format("{0} ({1})", student.Users.FullName, studentTeam.TeamName));
         }
     }
 }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         return("");
     }
     else
     {
         SessionGroup sessionGroup = (SessionGroup)value;
         Teacher      teacher;
         using (var dbContext = new SMaPEntities())
         {
             teacher = dbContext.Teacher.First(x => x.ID == sessionGroup.TeacherID);
             return(String.Format("{0} ({1} - {2})", sessionGroup.SessionGroupName, sessionGroup.Semester.SemesterName, teacher.Users.FullName));
         }
     }
 }