public static List <Student> getAllStudent(string student)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var students = (from t in _context.Students.AsEnumerable()
                         where t.S_name.Contains(student)
                         select new
         {
             S_ID = t.S_ID,
             S_name = t.S_name,
             S_fullname = t.S_fullname,
             S_major = t.S_major,
             S_gender = t.S_gender,
             S_birthday = t.S_birthday,
             S_phone = t.S_phone,
             S_email = t.S_email,
         }).Select(x => new Student
         {
             S_ID       = x.S_ID,
             S_name     = x.S_name,
             S_fullname = x.S_fullname,
             S_major    = x.S_major,
             S_gender   = x.S_gender,
             S_birthday = x.S_birthday,
             S_phone    = x.S_phone,
             S_email    = x.S_email,
         });
         return(students.ToList());
     }
 }
 public static Student findStudentbySID(string idStudent)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         return(_context.Students.SingleOrDefault(s => s.S_ID == idStudent));
     }
 }
Example #3
0
 public static List <Project> getAllProject()
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var project = (from t in _context.Projects.AsEnumerable()
                        select new
         {
             P_ID = t.P_ID,
             P_title = t.P_title,
             P_description = t.P_description,
             P_fromtime = t.P_fromtime,
             P_totime = t.P_totime,
             P_point = t.P_point,
             //Students = t.Students,
             L_ID = t.L_ID,
             Lecture = t.Lecture
         }).Select(x => new Project
         {
             P_ID          = x.P_ID,
             P_title       = x.P_title,
             P_description = x.P_description,
             P_fromtime    = x.P_fromtime,
             P_totime      = x.P_totime,
             P_point       = x.P_point,
             //Students = x.Students,
             L_ID    = x.L_ID,
             Lecture = x.Lecture
         });
         return(project.ToList());
     }
 }
Example #4
0
 public static List <Progress> getAllProgress()
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var progress = (from t in _context.Progresses.AsEnumerable()
                         select new
         {
             STT = t.STT,
             P_ID = t.P_ID,
             S_ID = t.S_ID,
             ProgressName = t.ProgressName,
             LinkSource = t.LinkSource,
             Note = t.Note,
         }).Select(x => new Progress
         {
             STT          = x.STT,
             P_ID         = x.P_ID,
             S_ID         = x.S_ID,
             ProgressName = x.ProgressName,
             LinkSource   = x.LinkSource,
             Note         = x.Note,
         });
         return(progress.ToList());
     }
 }
 public static List <Lecture> getAllLecture(string lecture)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var lectures = (from t in _context.Lectures.AsEnumerable()
                         where t.L_name.Contains(lecture)
                         select new
         {
             L_ID = t.L_ID,
             L_name = t.L_name,
             L_fullname = t.L_fullname,
             L_department = t.L_department,
             L_gender = t.L_gender,
             L_birthday = t.L_birthday,
             L_phone = t.L_phone,
             L_email = t.L_email,
         }).Select(x => new Lecture
         {
             L_ID         = x.L_ID,
             L_name       = x.L_name,
             L_fullname   = x.L_fullname,
             L_department = x.L_department,
             L_gender     = x.L_gender,
             L_birthday   = x.L_birthday,
             L_phone      = x.L_phone,
             L_email      = x.L_email,
         });
         return(lectures.ToList());
     }
 }
 public static Student getStudentInfomationAfterLogin(string idLogin)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         return(_context.Students.SingleOrDefault(s => s.IDLogin == idLogin));
     }
 }
Example #7
0
 public static List <Student> getAllStudentbyIDproject(int idproject)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         return(_context.ProjectManagements.Where(pm => pm.P_ID == idproject).Select(s => s.Student).ToList()); //dung List<Student>;
     }
 }
 public static List <Progress> listProgressOfStudent(int P_ID, string S_ID)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var student = _context.Progresses.Where(p => p.P_ID == P_ID && p.S_ID == S_ID).ToList();
         return(student);
     }
 }
 public static List <Student> getStudentDetail()
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var student = _context.Students.ToList();
         return(student);
     }
 }
 public static bool addLecture(Lecture lecture)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         _context.Lectures.Add(lecture);
         _context.SaveChanges();
         return(true);
     }
 }
Example #11
0
 public static bool addProgress(Progress progress)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         _context.Progresses.Add(progress);
         _context.SaveChanges();
         return(true);
     }
 }
 public static bool addStudent(Student student)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         _context.Students.Add(student);
         _context.SaveChanges();
         return(true);
     }
 }
Example #13
0
 public static bool addProjectStudent(ProjectManagement projectM)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         _context.ProjectManagements.Add(projectM);
         _context.SaveChanges();
         return(true);
     }
 }
        public static string getIDfromDB()
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var listid = (from t in _context.Lectures
                              select t.L_ID).ToList();

                //return int.Parse(listid.Max()) + 1;

                return(listid.ToString());
            }
        }
        public static bool DeleteStudent(string idStudent)
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var Student = (from x in _context.Students
                               where x.S_ID == idStudent
                               select x).Single();

                _context.Students.Remove(Student);
                _context.SaveChanges();
                return(true);
            }
        }
Example #16
0
        public static bool DeleteProject(int idproject)
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var project = (from x in _context.Projects
                               where x.P_ID == idproject
                               select x).Single();

                _context.Projects.Remove(project);
                _context.SaveChanges();
                return(true);
            }
        }
        public static bool DeleteLecture(string idLecture)
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var lecture = (from x in _context.Lectures
                               where x.L_ID == idLecture
                               select x).Single();

                _context.Lectures.Remove(lecture);
                _context.SaveChanges();
                return(true);
            }
        }
Example #18
0
        public static bool DeleteProjectStudent(int idproject, string idstudent)
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var student = (from x in _context.ProjectManagements
                               where x.S_ID == idstudent && x.P_ID == idproject
                               select x).SingleOrDefault();

                _context.ProjectManagements.Remove(student);
                _context.SaveChanges();
                return(true);
            }
        }
Example #19
0
        public static bool DeleteProgress(string stt)
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var progress = (from x in _context.Progresses
                                where x.STT == stt
                                select x).Single();

                _context.Progresses.Remove(progress);
                _context.SaveChanges();
                return(true);
            }
        }
Example #20
0
 public static bool UpdateProgress(Progress progressadd)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var progress = (from u in _context.Progresses
                         where u.STT == progressadd.STT
                         select u).Single();
         progress.ProgressName = progressadd.ProgressName;
         progress.LinkSource   = progressadd.LinkSource;
         progress.Note         = progressadd.Note;
         //_context.Projects.Add(project);
         _context.SaveChanges();
         return(true);
     }
 }
Example #21
0
        private List <string> getIDLecture()
        {
            List <string> lectures = new List <string>();

            using (var _context = new DBProjectStudentEntities())
            {
                var listid = (from t in _context.Lectures
                              select t.L_ID).ToList();
                foreach (var a in listid)
                {
                    lectures.Add(a);
                }
            }
            return(lectures);
        }
Example #22
0
 public static bool checkUser(string username, string password)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var check = from t in _context.UserLogins
                     where (username == t.ID) && (password == t.Pass)
                     select t.ID;
         foreach (var a in check)
         {
             if (a.Length != 0)
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Example #23
0
 public static bool UpdateProject(Project projectadd)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var project = (from u in _context.Projects
                        where u.P_ID == projectadd.P_ID
                        select u).SingleOrDefault();
         project.P_title       = projectadd.P_title;
         project.P_description = projectadd.P_description;
         project.P_fromtime    = projectadd.P_fromtime;
         project.P_totime      = projectadd.P_totime;
         project.P_point       = projectadd.P_point;
         project.L_ID          = projectadd.L_ID;
         //_context.Projects.Add(project);
         _context.SaveChanges();
         return(true);
     }
 }
Example #24
0
 public static List <ProjectManagement> getAllProjectStudent()
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var project = (from t in _context.ProjectManagements.AsEnumerable()
                        select new
         {
             P_ID = t.P_ID,
             S_ID = t.S_ID,
             Student = t.Student
         }).Select(x => new ProjectManagement
         {
             P_ID    = x.P_ID,
             S_ID    = x.S_ID,
             Student = x.Student
         });
         return(project.ToList());
     }
 }
 public static bool UpdateLecture(Lecture lectureadd)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var lecture = (from l in _context.Lectures
                        where l.L_ID == lectureadd.L_ID
                        select l).SingleOrDefault();
         lecture.L_name       = lectureadd.L_name;
         lecture.L_fullname   = lectureadd.L_fullname;
         lecture.L_department = lectureadd.L_department;
         lecture.L_gender     = lectureadd.L_gender;
         lecture.L_birthday   = lectureadd.L_birthday;
         lecture.L_phone      = lectureadd.L_phone;
         lecture.L_email      = lectureadd.L_email;
         //_context.Users.AddOrUpdate(user);
         _context.SaveChanges();
         return(true);
     }
 }
 public static bool UpdateStudent(Student studentadd)
 {
     using (var _context = new DBProjectStudentEntities())
     {
         var student = (from s in _context.Students
                        where s.S_ID == studentadd.S_ID
                        select s).SingleOrDefault();
         student.S_name     = studentadd.S_name;
         student.S_fullname = studentadd.S_fullname;
         student.S_major    = studentadd.S_major;
         student.S_gender   = studentadd.S_gender;
         student.S_birthday = studentadd.S_birthday;
         student.S_phone    = studentadd.S_phone;
         student.S_email    = studentadd.S_email;
         //_context.Users.AddOrUpdate(user);
         _context.SaveChanges();
         return(true);
     }
 }
        public static int getIDfromDB()
        {
            using (var _context = new DBProjectStudentEntities())
            {
                var listid = (from t in _context.Students
                              select t.S_ID).ToList();

                //return int.Parse(listid.Max()) + 1;

                string maxID = listid.Max() + 1;
                int    i;
                for (i = 1; i < int.Parse(maxID); i++)
                {
                    if (listid.Where(x => x == i.ToString()).Count() <= 0)
                    {
                        return(i);
                    }
                }
                return(i + 1);
            }
        }
Example #28
0
        public static string getROLL(string username, string password)
        {
            string temp1 = "0";
            string temp2 = "1";

            using (var _context = new DBProjectStudentEntities())
            {
                var check = from t in _context.UserLogins
                            where (username == t.ID) && (password == t.Pass)
                            select t;
                foreach (var a in check)
                {
                    if (a.roleuser == "0")
                    {
                        return(temp1);
                    }
                    if (a.roleuser == "1")
                    {
                        return(temp2);
                    }
                }
                return("NOTHING");
            }
        }