Ejemplo n.º 1
0
 // get all attendance
 public static IEnumerable <Attendance> getAttendance()
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Attendances.ToList();
         return(record);
     }
 }
 // find student by course registration Id
 public static RegistrationIds findStudentByRegistrationId(RegistrationIds registration)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.RegistrationIds.SingleOrDefault(x => x.RegistrationId == registration.RegistrationId);
         return(record);
     }
 }
 // find lectuerers by course id
 public static IEnumerable <LecturerCourses> findLectuerersByCourseId(string courseId)
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.LecturerCourses.Where(x => x.CourseId == courseId).ToList();
         return(records);
     }
 }
 // get all issued barcode info
 public static IEnumerable <RegistrationIds> getBarcodes()
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.RegistrationIds.ToList();
         return(records);
     }
 }
 // find last entry
 public static CourseEnrollment findLastEntry(string courseId)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.CourseEnrollments.Where(x => x.CourseId == courseId).OrderByDescending(x => x.Id).FirstOrDefault();
         return(record);
     }
 }
 // get all course enrollment
 public static IEnumerable <CourseEnrollment> getEnrollements()
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.CourseEnrollments.Where(x => x.IsRemoved == false).ToList();
         return(record);
     }
 }
Ejemplo n.º 7
0
 // find lecturer by id
 public static Lecturer findLecturerById(Lecturer lecturer)
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.Lecturers.SingleOrDefault(x => x.LecturerId == lecturer.LecturerId);
         return(records);
     }
 }
 // get all assigned courses
 public static IEnumerable <LecturerCourses> getCourses()
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.LecturerCourses.ToList();
         return(records);
     }
 }
Ejemplo n.º 9
0
 // get all payment deatails
 public static IEnumerable <Payment> getPayment()
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Payments.ToList();
         return(record);
     }
 }
Ejemplo n.º 10
0
 // get list of students by NIC. no
 public static IEnumerable <Student> getStudentsByNic(string nic)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Students.Where(x => x.Nic == nic).ToList();
         return(record);
     }
 }
Ejemplo n.º 11
0
 // get all students
 public static IEnumerable <Student> getSutdents()
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Students.ToList();
         return(record);
     }
 }
Ejemplo n.º 12
0
 // find payment by Invoice Id
 public static Payment findByInvoiceId(string Id)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Payments.SingleOrDefault(x => x.InvoiceNo == Id);
         return(record);
     }
 }
Ejemplo n.º 13
0
 // find student by NIC. no
 public static Student findStudentByNic(string nic)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Students.SingleOrDefault(x => x.Nic == nic);
         return(record);
     }
 }
Ejemplo n.º 14
0
 // find course by id
 public static Course findCourseById(Course course)
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.Courses.SingleOrDefault(x => x.RefNo == course.RefNo);
         return(records);
     }
 }
Ejemplo n.º 15
0
 // find students by id
 public static Student findStudent(Student student)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Students.SingleOrDefault(x => x.RefNo == student.RefNo);
         return(record);
     }
 }
Ejemplo n.º 16
0
 // find student parent info by student id
 public static Student findParentInfo(string studentId)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Students.SingleOrDefault(x => x.RefNo == studentId);
         return(record);
     }
 }
Ejemplo n.º 17
0
 // get all courses
 public static IEnumerable <Course> getCourses()
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Courses.ToList();
         return(record);
     }
 }
 // find course registration date by course id and student id
 public static CourseEnrollment findRegistrationDateByStudentId(string registrationId, string courseId)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.CourseEnrollments.Where(x => x.RegistrationId == registrationId && x.CourseId == courseId).OrderByDescending(x => x.Id).FirstOrDefault();
         return(record);
     }
 }
 // find course by course id
 public static CourseEnrollment findCourseByCourseId(string id)
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.CourseEnrollments.SingleOrDefault(x => x.CourseId == id);
         return(records);
     }
 }
 // find courses by student Id
 public static IEnumerable <CourseEnrollment> findCourseByStudentId(string registrationId)
 {
     using (var db = new NipunaDataContext())
     {
         var records = db.CourseEnrollments.Where(x => x.RegistrationId == registrationId).ToList();
         return(records);
     }
 }
Ejemplo n.º 21
0
 // add new student
 public static bool addStudent(Student student)
 {
     using (var db = new NipunaDataContext())
     {
         db.Students.Add(student);
         db.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 22
0
 // add payment detail
 public static bool addPayment(Payment payment)
 {
     using (var db = new NipunaDataContext())
     {
         db.Payments.Add(payment);
         db.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 23
0
 // get last record for attendance process
 public static Payment checkLastRecord(string registrationId, string courseId)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Payments.Where(x => x.RegistrationId == registrationId && x.CourseId == courseId && x.IsRemoved == false)
                      .OrderByDescending(x => x.Invoicedate).FirstOrDefault();
         return(record);
     }
 }
Ejemplo n.º 24
0
 // add new lecturer
 public static bool addLecturer(Lecturer lecturer)
 {
     using (var db = new NipunaDataContext())
     {
         db.Lecturers.Add(lecturer);
         db.SaveChanges();
         return(true);
     }
 }
 // add course enrollment
 public static bool addEnrollment(CourseEnrollment enrollment)
 {
     using (var db = new NipunaDataContext())
     {
         db.CourseEnrollments.Add(enrollment);
         db.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 26
0
 // mark attendance
 public static bool markAttendance(Attendance attendnace)
 {
     using (var db = new NipunaDataContext())
     {
         db.Attendances.Add(attendnace);
         db.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 27
0
 // filter datagrid view based on search value
 public static IEnumerable <Course> filterCourses(string search)
 {
     using (var db = new NipunaDataContext())
     {
         var record = db.Courses.Where(x => x.RefNo.StartsWith(search) ||
                                       x.Title.StartsWith(search) ||
                                       x.Fee.ToString().StartsWith(search)).ToList();
         return(record);
     }
 }
Ejemplo n.º 28
0
        // add new courses
        public static bool addCourses(Course course)
        {
            using (var db = new NipunaDataContext())
            {
                db.Courses.Add(course);
                db.SaveChanges();

                return(true);
            }
        }
Ejemplo n.º 29
0
        // assign courses to lecturers
        public static bool assignCourse(LecturerCourses assign)
        {
            using (var db = new NipunaDataContext())
            {
                db.LecturerCourses.Add(assign);
                db.SaveChanges();

                return(true);
            }
        }
        // add new record
        public static bool add(RegistrationIds barcodeInfo)
        {
            using (var db = new NipunaDataContext())
            {
                db.RegistrationIds.Add(barcodeInfo);
                db.SaveChanges();

                return(true);
            }
        }