// 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); }
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(); } }
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(); } }
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); } }
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); }
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); } }
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); } }
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); } }
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); } }
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); }
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(); } } } } }
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(); } }
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); } }
// 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); } }
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); } }
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); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
// 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); } }
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(); } }
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(); } }
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); } }
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(); } }
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); } }
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); } }
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(); } }
// 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(); } }