Пример #1
0
        // if the user exists and is valid, return the user, else return null
        internal static PilotClassDefinition getPilotClassDefinition(Guid defid)
        {
            using (DBClassesDataContext dbc = new DBClassesDataContext())
            {
                PilotClassDefinition ach = (from u in dbc.PilotClassDefinitions
                                            where u.PilotClassID == defid
                                            select u).SingleOrDefault();

                return(ach);
            }
        }
Пример #2
0
 internal static void delete(Guid achID)
 {
     using (DBClassesDataContext dbc = new DBClassesDataContext())
     {
         PilotClassDefinition ach = (from u in dbc.PilotClassDefinitions
                                     where u.PilotClassID == achID
                                     select u).SingleOrDefault();
         if (ach != null)
         {
             dbc.PilotClassDefinitions.DeleteOnSubmit(ach);
             dbc.SubmitChanges();
         }
     }
 }
Пример #3
0
        // if the user exists and is valid, return the user, else return null
        public static ArrayList getPilotClassesForPilot(String pilotid)
        {
            ArrayList classes = new ArrayList();

            using (DBClassesDataContext dbc = new DBClassesDataContext())
            {
                IEnumerable <PilotClass> ach = (from u in dbc.PilotClasses
                                                where u.PilotEmail == pilotid
                                                select u);
                foreach (PilotClass pc in ach)
                {
                    PilotClassDefinition pcd = PilotClassDefinition.getPilotClassDefinition(pc.PilotClassID);
                    if (pcd != null)
                    {
                        classes.Add(pcd);
                    }
                }
            }
            return(classes);
        }