//public ClassSchedules()
        //{
        //    Subjects = new Subjects();
        //    Classes = new Classes();
        //    ClassTimings = new ClassTimings();
        //}

        private static List <ClassSchedules> _GetListOfClassSchedules()
        {
            List <ClassSchedules> classSchedules = new List <ClassSchedules>();

            try
            {
                Command            = @"select * from tblClassSchedules";
                db.cmd.CommandText = Command;
                db.con.Open();

                SqlDataReader rdr = db.cmd.ExecuteReader();
                while (rdr.Read())
                {
                    ClassSchedules singleClassSchedules = new ClassSchedules();
                    singleClassSchedules.Id             = (int)rdr[0];
                    singleClassSchedules.WeekDay        = rdr[1].ToString();
                    singleClassSchedules.SubjectsId     = (int)rdr[2];
                    singleClassSchedules.ClassesId      = (int)rdr[3];
                    singleClassSchedules.ClassTimingsId = (int)rdr[4];

                    var subject = new Subjects();
                    singleClassSchedules.Subjects = Subjects.ListOfSubjects.SingleOrDefault(sub => sub.Id == singleClassSchedules.SubjectsId);
                    var classes = new Classes();
                    singleClassSchedules.Classes = Classes.ListOfClasses.SingleOrDefault(cls => cls.Id == singleClassSchedules.ClassesId);
                    var classtiming = new ClassTimings();
                    singleClassSchedules.ClassTimings = ClassTimings.ListOfClassTimings.SingleOrDefault(ct => ct.Id == singleClassSchedules.ClassTimingsId);

                    classSchedules.Add(singleClassSchedules);
                }
            }
            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.con.Close();
            }

            return(classSchedules);
        }
Ejemplo n.º 2
0
 public Exams()
 {
     Students  = new Students();
     Subjects  = new Subjects();
     ExamTypes = new ExamTypes();
 }
Ejemplo n.º 3
0
 public static void Update(int Id, Subjects subjects, Classes classes)
 {
     subjects.ClassesId = Classes.Add(classes);
     Subjects.Update(Id, subjects);
 }