示例#1
0
 /// <summary>
 /// Get the date when pilot class was achieved
 /// </summary>
 /// <param name="classid"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public static DateTime WhenAchieved(Guid classid, String user)
 {
     using (DBClassesDataContext dbc = new DBClassesDataContext())
     {
         PilotClass ach = (from u in dbc.PilotClasses
                           where u.PilotEmail == user && u.PilotClassID == classid
                           select u).SingleOrDefault();
         if (ach != null)
         {
             return(ach.DateCompleted);
         }
     }
     return(DateTime.MinValue);
 }
示例#2
0
 internal static void saveClasses(DBClassesDataContext dc, string email, List <Guid> classes)
 {
     foreach (Guid cls in classes)
     {
         PilotClass pcls = (from u in dc.PilotClasses
                            where u.PilotEmail == email && u.PilotClassID == cls
                            select u).SingleOrDefault();
         if (pcls == null)
         {
             pcls = new PilotClass();
             pcls.PilotClassID  = cls;
             pcls.PilotEmail    = email;
             pcls.DateCompleted = DateTime.Now;
             dc.PilotClasses.InsertOnSubmit(pcls);
         }
     }
 }