Example #1
0
        // Sign In
        public _Student Signin()
        {
            User = User.Signin();
            if (User != null)
            {
                using (var db = new TESDataContext())
                {
                    var log = (from s in db.Student_Informations
                               where s.user_id == User.UserId
                               select new _Student
                    {
                        StudentId = (int)s.student_id,
                        RegistrationNo = s.student_reg_no,
                        Semester = s.student_smester,
                        User = User,
                    }).FirstOrDefault();

                    if (log != null)
                    {
                        return(log);
                    }
                }
            }
            return(null);
        }
Example #2
0
        public void Edit()
        {
            using (var db = new TESDataContext())
            {
                // Update Thesis
                var log = (from t in db.Thesis
                           where t.thesis_id == this.ThesisID
                           select t).FirstOrDefault();

                log.thesis_title       = this.Title;
                log.thesis_domain      = this.Domain;
                log.thesis_discription = this.Discription;
                log.thesis_status      = this.Status;
                log.student_id         = this.Student.StudentId;
                log.supervisor_id      = this.Supervisor.SupervisorId;

                // Assign thesis
                //var AssignStu = (from t in db.Student_Thesis_Supervisors
                //                 where t.thesis_id == this.ThesisID
                //                 select t).FirstOrDefault();

                //AssignStu.thesis_id = this.ThesisID;
                //AssignStu.supervisor_id = this.Supervisor.SupervisorId;
                //AssignStu.student_id = this.Student.StudentId;


                db.SubmitChanges();
            }
        }
Example #3
0
        public void SetData()
        {
            using (var db = new TESDataContext())
            {
                var log = (from ed in db.Event_Dates select ed).FirstOrDefault();

                if (log != null)
                {
                    log.event_date0 = txtEventDate0.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date1 = txtEventDate1.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date2 = txtEventDate2.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date3 = txtEventDate3.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date4 = txtEventDate4.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date5 = txtEventDate5.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date6 = txtEventDate6.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date7 = txtEventDate7.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.event_date8 = txtEventDate8.Text; //DateTime.Now.ToString("yyyy-MM-dd");
                    log.spring_date = txtspringDate.Text;
                    log.fall_date   = txtFallDate.Text;
                    log.header_date = txtHeader_Date.Text;
                }
                db.SubmitChanges();
            }
            Session.Add("success", true);
            // Send email
            var users = user.GetAll();

            foreach (var u in users)
            {
                mail.Subject = "New Event calender";
                mail.Reciver = u.Email;
                mail.Message = "Please check you event calender";
                mail.Send();
            }
        }
Example #4
0
        public List <_Thesis> GetAllGTCAssigned()
        {
            using (var db = new TESDataContext())
            {
                var logs = (from f in db.Thesis_Files
                            join t in db.Thesis on f.thesis_id equals t.thesis_id
                            join gr in db.GTC_Reviews on t.thesis_id equals gr.thesis_id
                            where gr.gtc_id == this.Supervisor.SupervisorId
                            select new _Thesis
                {
                    ThesisID = t.thesis_id,
                    Title = t.thesis_title,
                    Domain = t.thesis_domain,
                    Discription = t.thesis_discription,
                    Status = t.thesis_status,

                    FileID = f.file_Id,
                    FilePath = f.file_path,
                    FileName = f.file_name,
                    Review = f.review
                }).ToList();

                if (logs != null)
                {
                    return(logs);
                }
                return(null);
            }
        }
Example #5
0
        public bool ForgetPassword_Email(string email)
        {
            var user     = CheckEmailExists(email);
            var recovery = GenerateKey();

            if (user != null)
            {
                // Sending Email
                _Mail mail = new _Mail();
                mail.Reciver = email;
                mail.Subject = "Password Recovery";
                mail.Message = "Use the following link to recover <br/>" +
                               "Link: http://localhost:52189/UpdatePassword/" + recovery;
                mail.Send();

                // Database Entry
                using (var db = new TESDataContext())
                {
                    var log = (from u in db.User_Informations
                               where u.user_id == user.UserId
                               select u).FirstOrDefault();
                    log.password_recovery = recovery;
                    db.SubmitChanges();
                }
                return(true);
            }
            return(false);
        }
Example #6
0
        public _Thesis GetByStudentId()
        {
            using (var db = new TESDataContext())
            {
                var log = (from t in db.Thesis
                           where t.student_id == this.Student.StudentId
                           select new _Thesis
                {
                    ThesisID = t.thesis_id,
                    Title = t.thesis_title,
                    Domain = t.thesis_domain,
                    Discription = t.thesis_discription,
                    Status = t.thesis_status,
                    Supervisor = Supervisor.GetById(t.supervisor_id),
                    Student = Student.GetById(t.student_id),
                }).FirstOrDefault();


                if (log != null)
                {
                    log.GTCReviews = (from gr in db.GTC_Reviews select gr).ToList();
                    var files = (from f in db.Thesis_Files
                                 where f.thesis_id == log.ThesisID
                                 select f).ToList();

                    if (files.Count != 0)
                    {
                        log.GTCReview = files[files.Count - 1].gtc_review;
                    }
                    return(log);
                }
                return(null);
            }
        }
Example #7
0
 public _Thesis GetGTCSubmissionById(long?id)
 {
     using (var db = new TESDataContext())
     {
         var log = (from f in db.GTC_Reviews
                    join t in db.Thesis on f.thesis_id equals t.thesis_id
                    where t.thesis_id == id
                    select new _Thesis
         {
             ThesisID = t.thesis_id,
             Title = t.thesis_title,
             Domain = t.thesis_domain,
             Discription = t.thesis_discription,
             Status = t.thesis_status,
         }).FirstOrDefault();
         if (log != null)
         {
             log.GTCReviews = (from gr in db.GTC_Reviews
                               where gr.thesis_id == id
                               select gr).ToList();
             return(log);
         }
         return(null);
     }
 }
Example #8
0
        public _Thesis GetSubmissionById(long?id)
        {
            using (var db = new TESDataContext())
            {
                var log = (from f in db.Thesis_Files
                           join t in db.Thesis on f.thesis_id equals t.thesis_id
                           where f.file_Id == id
                           select new _Thesis
                {
                    ThesisID = t.thesis_id,
                    Title = t.thesis_title,
                    Domain = t.thesis_domain,
                    Discription = t.thesis_discription,
                    Status = t.thesis_status,

                    FileID = f.file_Id,
                    FilePath = f.file_path,
                    FileName = f.file_name,
                    Review = f.review,
                }).FirstOrDefault();
                if (log != null)
                {
                    return(log);
                }
                return(null);
            }
        }
Example #9
0
        public List <_Presentation> GetAll()
        {
            using (var db = new TESDataContext())
            {
                var logs = (from p in db.Presentation_Schedules
                            select new _Presentation
                {
                    PresentationID = p.presentation_schedule_Id,
                    DateTime = p.date_time,
                    Thesis = Thesis.GetById(p.thesis_id),
                }).ToList();

                if (logs != null)
                {
                    int i = 0;
                    foreach (var log in logs)
                    {
                        if (i == 14)
                        {
                            i = 0;
                        }
                        log.PresentationTime = PresentationTimeSet[i];
                        i++;
                    }

                    return(logs);
                }
                return(null);
            }
        }
Example #10
0
        public _Supervisor Signin()
        {
            User = User.Signin();
            if (User != null)
            {
                using (var db = new TESDataContext())
                {
                    var log = (from t in db.Supervisor_Informations
                               where t.user_id == User.UserId
                               select new _Supervisor
                    {
                        GTC = t.supervisor_gtc_member,
                        Title = t.supervisor_job_title,
                        SupervisorId = (int)t.supervisor_id,
                        User = User,
                    }).FirstOrDefault();

                    if (log != null)
                    {
                        return(log);
                    }
                }
            }
            return(null);
        }
Example #11
0
        public void AssignToGTC(long?supervisorId, List <string> assignedThesisName, List <string> unAssignedThesisName)
        {
            using (var db = new TESDataContext())
            {
                var theses       = (from t in db.Thesis select t).ToList();
                var thesesForGTC = (from gr in db.GTC_Reviews
                                    join t in db.Thesis on gr.thesis_id equals t.thesis_id
                                    where gr.gtc_id == supervisorId
                                    select new
                {
                    t.thesis_id,
                    t.thesis_status,
                    t.student_id,
                    t.supervisor_id,
                    t.thesis_discription,
                    t.thesis_domain,
                    t.thesis_title
                }).ToList();

                // Remove unassigned
                foreach (var uatn in unAssignedThesisName)
                {
                    var log = (from gr in db.GTC_Reviews
                               join t in db.Thesis on gr.thesis_id equals t.thesis_id
                               where gr.gtc_id == supervisorId && t.thesis_title == uatn
                               select gr).FirstOrDefault();
                    if (log != null)
                    {
                        db.GTC_Reviews.DeleteOnSubmit(log);
                        db.SubmitChanges();
                    }
                }
                // Add assigned
                foreach (var uatn in assignedThesisName)
                {
                    var log = (from gr in db.GTC_Reviews
                               join t in db.Thesis on gr.thesis_id equals t.thesis_id
                               where gr.gtc_id == supervisorId && t.thesis_title == uatn
                               select gr).FirstOrDefault();
                    //if don't exsists add
                    if (log == null)
                    {
                        var l = (from t in db.Thesis where t.thesis_title == uatn select t).FirstOrDefault();
                        if (l != null)
                        {
                            var val = new GTC_Review
                            {
                                thesis_id   = l.thesis_id,
                                gtc_id      = Convert.ToInt64(supervisorId),
                                gtc_review1 = "",
                            };
                            db.GTC_Reviews.InsertOnSubmit(val);
                            db.SubmitChanges();
                        }
                    }
                }
            }
        }
Example #12
0
 public void DontSupervise(long?id)
 {
     using (var db = new TESDataContext())
     {
         var log = (from s in db.Student_Supervisors where s.student_id == id select s).FirstOrDefault();
         log.supervise = false;
         db.SubmitChanges();
     }
 }
Example #13
0
 public List <Meeting> GetAllMeeting()
 {
     using (var db = new TESDataContext())
     {
         var log = (from m in db.Meetings
                    where m.supervisor_id == this.User.UserId
                    select m).ToList();
         return(log);
     }
 }
Example #14
0
 // Get Supervisor selection status true <for selected> false <for not seleted> null <for await>
 public bool?SupervisorAwaitStatus()
 {
     using (var db = new TESDataContext())
     {
         var log = (from ss in db.Student_Supervisors
                    where ss.student_id == this.StudentId
                    select ss).ToList();
         return(log.Find(x => x.supervise == null) == null ? false : true);
     }
 }
Example #15
0
 public void EditProfile()
 {
     using (var db = new TESDataContext())
     {
         var log = (from a in db.Admin_Informations
                    where a.admin_id == this.AdminID
                    select a).FirstOrDefault();
         User.Edit(log.user_id);
     }
 }
Example #16
0
 public long?GetSupervisorId()
 {
     using (var db = new TESDataContext())
     {
         var log = (from s in db.Student_Supervisors
                    where s.supervise == true
                    select s).FirstOrDefault();
         return(log.supervisor_id);
     }
 }
Example #17
0
 public void AddGTCReview(string msg, long?id)
 {
     using (var db = new TESDataContext())
     {
         var log = (from gr in db.GTC_Reviews
                    where gr.gtc_id == id
                    select gr).FirstOrDefault();
         log.gtc_review1 = msg;
         db.SubmitChanges();
     }
 }
Example #18
0
 public void AddReview(string msg)
 {
     using (var db = new TESDataContext())
     {
         var log = (from f in db.Thesis_Files
                    where f.file_Id == this.FileID
                    select f).FirstOrDefault();
         log.review = msg;
         db.SubmitChanges();
     }
 }
Example #19
0
 public void Approve(string status)
 {
     using (var db = new TESDataContext())
     {
         var log = (from t in db.Thesis
                    where t.thesis_id == this.ThesisID
                    select t).FirstOrDefault();
         log.thesis_status = status;
         db.SubmitChanges();
     }
 }
Example #20
0
        public void Delete()
        {
            using (var db = new TESDataContext())
            {
                var log = (from t in db.Thesis
                           where t.thesis_id == this.ThesisID
                           select t).FirstOrDefault();

                db.Thesis.DeleteOnSubmit(log);
                db.SubmitChanges();
            }
        }
Example #21
0
        public void ChangePassword()
        {
            using (var db = new TESDataContext())
            {
                var log = (from u in db.User_Informations
                           where u.user_id == this.UserId
                           select u).FirstOrDefault();

                log.user_password = this.Password;

                db.SubmitChanges();
            }
        }
Example #22
0
        // Delete
        public void DeleteProfile(long?id)
        {
            using (var db = new TESDataContext())
            {
                var log = (from s in db.Student_Informations
                           where s.student_id == id
                           select s).FirstOrDefault();

                db.Student_Informations.DeleteOnSubmit(log);
                db.SubmitChanges();
                User.Delete(log.user_id);
            }
        }
Example #23
0
        public void Delete(long?id)
        {
            using (var db = new TESDataContext())
            {
                var log = (from u in db.User_Informations
                           where u.user_id == id
                           select u).FirstOrDefault();


                db.User_Informations.DeleteOnSubmit(log);
                db.SubmitChanges();
            }
        }
Example #24
0
 public void Delete()
 {
     using (var db = new TESDataContext())
     {
         var log = (from m in db.Meetings
                    where m.meeting_id == this.MeetingId
                    select m).FirstOrDefault();
         if (log != null)
         {
             db.Meetings.DeleteOnSubmit(log);
         }
         db.SubmitChanges();
     }
 }
Example #25
0
 public bool IsAssigned()
 {
     using (var db = new TESDataContext())
     {
         var log = (from sts in db.Thesis
                    where sts.student_id == this.Student.StudentId
                    select sts).FirstOrDefault();
         if (log != null)
         {
             return(true);
         }
         return(false);
     }
 }
Example #26
0
 public void AddMeetingMin(string meetingMin)
 {
     using (var db = new TESDataContext())
     {
         var log = (from m in db.Meetings
                    where m.meeting_id == this.MeetingId
                    select m).FirstOrDefault();
         if (log != null)
         {
             log.meeting_min = meetingMin;
         }
         db.SubmitChanges();
     }
 }
Example #27
0
 public bool UserRegExists(string Reg)
 {
     using (var db = new TESDataContext())
     {
         var log = (from s in db.Student_Informations
                    where s.student_reg_no == Reg
                    select s).FirstOrDefault();
         if (log == null)
         {
             return(true);
         }
         return(false);
     }
 }
Example #28
0
 public bool UserExists(string name)
 {
     using (var db = new TESDataContext())
     {
         var log = (from u in db.User_Informations
                    where u.user_name == name
                    select u).FirstOrDefault();
         if (log != null)
         {
             return(true);
         }
         return(false);
     }
 }
Example #29
0
 public void SelectCoSupervisor(long?id)
 {
     using (var db = new TESDataContext())
     {
         var log = (from t in db.Thesis
                    where t.student_id == this.StudentId
                    select t).FirstOrDefault();
         if (log != null)
         {
             log.cosupervisor_id = id;
         }
         db.SubmitChanges();
     }
 }
Example #30
0
 // request for meeting
 public void RequestMeeting(long?stuId, long?supId)
 {
     using (var db = new TESDataContext())
     {
         var log = new Meeting()
         {
             student_id    = stuId,
             supervisor_id = supId,
             meeting_time  = "",
         };
         db.Meetings.InsertOnSubmit(log);
         db.SubmitChanges();
     }
 }