Example #1
0
        public void ScheduleExam(string Name, string First, string Second, string Final)
        {
            ComputerEngineering co = c.ComputerEngineering.Single(x => x.CourseName == Name);

            co.FinalExam = Final; co.FirstExam = First; co.SecondExam = Second;
            c.SaveChanges();
        }
 public void RegisterCourse(int CourseID, string Course, string Hall, string Time, string Day, string Ins, int StudentID, string Student)
 {
     ce = (ComputerEngineering)(c.ComputerEngineering.Single(x => x.ID == CourseID));
     ce.RegisteredStudents++;
     if (ce.RegisteredStudents == ce.Max)
     {
         ce.Statue = "Closed";
     }
     r.CourseID = CourseID; r.Course = Course; r.Hall = Hall; r.Day = Day; r.Instructer = Ins; r.StudentID = StudentID; r.Student = Student; r.Time = Time;
     c.Registration.Add(r);
     c.SaveChanges();
 }
 public void RegisterClosed(string CRS, string Time, string Ins, int ID, string Name)
 {
     ce = (ComputerEngineering)(c.ComputerEngineering.Single(x => x.CourseName == CRS));
     ce.RegisteredStudents++;
     if (ce.RegisteredStudents == ce.Max)
     {
         ce.Statue = "Closed";
     }
     r.CourseID = ce.ID; r.Course = CRS; r.Hall = ce.Hall; r.Day = ce.Day; r.Instructer = Ins; r.StudentID = ID; r.Student = Name; r.Time = Time;
     c.Registration.Add(r);
     c.SaveChanges();
 }
Example #4
0
        public List <ComputerEngineering> GetExams(int ID)
        {
            List <ComputerEngineering> li = new List <ComputerEngineering>();
            var v = from i in c.ComputerEngineering where i.Instructer == ID select new { i.CourseName, i.FirstExam, i.SecondExam, i.FinalExam };

            foreach (var i in v)
            {
                ComputerEngineering co = new ComputerEngineering();
                co.CourseName = i.CourseName; co.FirstExam = i.FirstExam; co.SecondExam = i.SecondExam; co.FinalExam = i.FinalExam;
                li.Add(co);
            }
            return(li);
        }
        public bool CheckClose(int CourseID, int StudentID)
        {
            bool x = false;

            ce = (ComputerEngineering)(c.ComputerEngineering.Single(y => y.ID == CourseID));
            if (ce.RegisteredStudents < ce.Max)
            {
                ce.Statue = "Open"; c.SaveChanges(); return(x = true);
            }
            else
            {
                ce.Statue = "Closed"; c.SaveChanges(); return(x);
            }
        }
 public void DeleteCourse(int CourseID, int StudentID)
 {
     foreach (var i in c.Registration)
     {
         if (i.CourseID == CourseID && i.StudentID == StudentID)
         {
             c.Registration.Remove(i);
         }
     }
     if (ce.RegisteredStudents < ce.Max)
     {
         ce.Statue = "Open";
     }
     ce = (ComputerEngineering)(c.ComputerEngineering.Single(x => x.ID == CourseID));
     ce.RegisteredStudents--;
     c.SaveChanges();
 }
 public RegLogic()
 {
     c = new Context(); RS = new REG_STD(); cl = new Closed();
     r = new Registration(); ce = new ComputerEngineering();
 }