public async Task <ActionResult> Login([FromBody] StudentTable student)
        {
            var user = _context.StudentTable.FromSqlInterpolated($"SELECT * FROM dbo.student_table").Where(res => res.Mail == student.Mail).FirstOrDefault();

            //var user = await _context.Utilisateurs.FindAsync(utilisateur.Id);
            if (user != null && user.Password == student.Password && user.Mail == student.Mail)
            {
                return(Ok(new
                {
                    user.StudentId,
                    user.FirstName,
                    user.LastName,
                    user.Mail,
                    user.Password,
                    user.Phonenumber,
                    user.Address,
                    user.Approved,
                    user.Type,
                    user.Image
                }));;
            }
            else
            {
                return(BadRequest(new { message = "Email ou Mot de passe est incorrect" }));
            }
        }
Esempio n. 2
0
        private async void ExceuteLoginCommand(object obj)
        {
            UserService userService = new UserService();
            var         data        = await userService.GetUserByUserName(this.Username, this.Password);

            if (data != null)
            {
                Settings.Role = data.Role.ToLower();

                if (data.Role.ToLower() == "admin")
                {
                    await Application.Current.MainPage.Navigation.PushAsync(new AdminPage());
                }
                else
                {
                    RegistrationService registrationService = new RegistrationService();
                    StudentTable        studentTable        = await registrationService.GetStudentbyUserId(data.UserID);

                    await Application.Current.MainPage.Navigation.PushAsync(new StudentPage(studentTable));
                }
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("Alert", "Invalid Login", "Canel");
            }
        }
Esempio n. 3
0
        private void InitView()
        {
            MY_COURSES_LISTVIEW.Items.Clear();
            AVAIL_COURSES_CB.Items.Clear();
            Student s = StudentTable.SelectOne(idStudent);
            Collection <ZapsanyKurz> signedCourses = ZapsanyKurzTable.SelectCoursesByIdStudent(idStudent);
            Collection <Kurz>        activeCourses = KurzTable.SelectByStudentAndOngoing(idStudent.ToString());

            foreach (var c in activeCourses)
            {
                AVAIL_COURSES_CB.Items.Add(c.Nazev);
            }

            if (signedCourses.Count > 0)
            {
                ZapsanyKurz firstCourse = signedCourses[0];

                foreach (var c in signedCourses)
                {
                    ListViewItem i = new ListViewItem(c.IdRegistrace.ToString());
                    i.SubItems.Add(c.Kurz.Nazev);
                    MY_COURSES_LISTVIEW.Items.Add(i);
                }
                InitCourse(firstCourse);
            }
        }
        public async Task <ActionResult <StudentTable> > PostStudentTable(StudentTable studentTable)
        {
            _context.StudentTable.Add(studentTable);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStudentTable", new { id = studentTable.StudentId }, studentTable));
        }
Esempio n. 5
0
        // PUT api/Student/5
        public IHttpActionResult Putstudent(int id, StudentTable student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != student.id)
            {
                return(BadRequest());
            }


            db.Entry(student).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!studentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        private void UpdateClassStudent()
        {
            App.last_action = "Update";
            //Sync DisplayedProduct's ID with Name
            MyClass cc = (MyClass)ClassTable.SingleOrDefault(c => c.ID == (DisplayedProduct.ClassId ?? 0));

            DisplayedProduct.ClassName   = cc.ClassName;
            DisplayedProduct.StudentName = StudentTable.SingleOrDefault(s => s.ID == (DisplayedProduct.StudentId ?? 0)).FullName;
            //GetClassStudents() has Grouping, DisplayedProduct does the same
            DisplayedProduct.Grouping = cc.ClassName + " " + cc.Semester + " " + cc.Dayofweek + " " + cc.Timeofweek;

            if (!stat.ChkProductForUpdate(DisplayedProduct))
            {
                return;
            }

            if (!App.StoreDB.UpdateProduct(DisplayedProduct))
            {
                stat.Status = App.StoreDB.errorMessage;
                return;
            }
            log.Info("In UpdateClassStudent: " + $"Record updated for  {DisplayedProduct.ClassName} {DisplayedProduct.StudentName}");
            App.Messenger.NotifyColleagues("UpdateProduct", DisplayedProduct);
            MainWindowViewModel.Instance.StatusBar = $"DB Updated for {DisplayedProduct.ClassName} {DisplayedProduct.StudentName}";
        } //UpdateProduct()
Esempio n. 7
0
        //GET: /Detail/Edit/
        public ActionResult Edit(int?id, StudentTable student)
        {
            //student student = null;
            if (id == null)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
            }
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:49336/api/");
                var val = "Student/" + id;
                HttpResponseMessage response = client.GetAsync(val).Result;


                if (response.IsSuccessStatusCode)
                {
                    var v = response.Content.ReadAsStringAsync();
                    //readTask.Wait();


                    student = JsonConvert.DeserializeObject <StudentTable>(v.Result);
                }
            }

            return(View(student));
        }
Esempio n. 8
0
        public List <StudentTable> getAll(string user, string userId, int page, string stuName, string Professional, string school, string Phone)
        {
            string sqlStr = "update StudentTable set s_UserName = '******',s_Professional = '" + Professional + "',s_Department = '" + school + "',s_Phone = '" + Phone + "' where s_Id = " + userId;

            StudentTable.delOrUpTable(sqlStr);
            return(StudentTable.getAll(page));
        }
Esempio n. 9
0
        public List <StudentTable> getAll(string user, string userId, int page)
        {
            string sqlStr = "delete StudentTable where s_Id = " + userId;

            StudentTable.delOrUpTable(sqlStr);
            return(StudentTable.getAll(page));
        }
Esempio n. 10
0
 public void ListofRecipients(Mails model)
 {
     using (var context = new MailProEntities())
     {
         int Fac = (int)Session["FacultyID"];
         model.FacultyID = Fac;
         List <int>   fetch = (List <int>)Session["MailTransfer"];
         StudentTable st    = new StudentTable();
         int          i     = 0;
         int          count = 0;
         foreach (var item in fetch)
         {
             st              = context.StudentTable.SingleOrDefault(x => x.StudentNo == item);
             ViewBag.Mailer += st.StudentEmail + ",<br/>";
             i = i + 1;
             if (i <= 2)
             {
                 ViewBag.MailPreview += st.StudentEmail + ',';
             }
             else
             {
                 count++;
             }
         }
         ViewBag.MailPreview += "and " + count + " others";
         model.Sent           = ViewBag.Mailer;
         model.MailPreview    = ViewBag.MailPreview;
     }
 }
        public async Task <IActionResult> PutStudentTable(int id, StudentTable studentTable)
        {
            if (id != studentTable.StudentId)
            {
                return(BadRequest());
            }

            _context.Entry(studentTable).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult Create(StudentTable studentTable)
        {
            if (ModelState.IsValid)
            {
                if (studentTable.LogoFile != null)
                {
                    var folder    = "~/Content/StudentPhoto";
                    var extension = Path.GetExtension(studentTable.LogoFile.FileName);
                    var file      = string.Format("{0}", studentTable.StudentID);
                    var response  = FileHelpers.UploadPhoto(studentTable.LogoFile, folder, file);
                    if (response)
                    {
                        var pic = string.Format("{0}/{1}{2}", folder, file, extension);
                        studentTable.Photo = pic;
                    }
                }
                db.StudentTables.Add(studentTable);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.DepartmentTables, "DepartmentID", "Name", studentTable.DepartmentID);
            ViewBag.ProgrammeID  = new SelectList(db.ProgrammeTables, "ProgrammeID", "Name", studentTable.ProgrammeID);
            ViewBag.SessionID    = new SelectList(db.SessionTables, "SessionID", "Name", studentTable.SessionID);
            return(View(studentTable));
        }
        private void ExecuteAuditCommand(object obj)
        {
            StudentTable studentTable = obj as StudentTable;

            registrationService.UpdateStudent(studentTable);
            this.StudentList = new List <StudentTable>();
            GetStudentData();
        }
Esempio n. 14
0
        public ActionResult DeleteConfirmed(int id)
        {
            StudentTable studentTable = db.StudentTable.Find(id);

            db.StudentTable.Remove(studentTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        protected void LoadDDLYear(object obj, EventArgs e)
        {
            var studentId = new StudentTable(db).GetStudentId(User.Identity.GetUserId());

            ddlYear.DataSource = new StudentYearClassSectionRollTable(db).GetYearByStudentId(studentId);
            ddlYear.DataBind();
            LoadDDLTerm(null, null);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false);
            string           dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3");
            SQLiteConnection db_login     = new SQLiteConnection(dbPath_login);

            StudentTable studentAttributes = db_login.Get <StudentTable>(student_id);

            TextView candidateName   = view.FindViewById <TextView>(Resource.Id.candidateName);
            TextView candidateEmail  = view.FindViewById <TextView>(Resource.Id.candidateEmail);
            TextView candidateSchool = view.FindViewById <TextView>(Resource.Id.schoolText);
            TextView candidateMajor  = view.FindViewById <TextView>(Resource.Id.majorText);
            TextView candidateGT     = view.FindViewById <TextView>(Resource.Id.gradtermText);
            TextView candidateGPA    = view.FindViewById <TextView>(Resource.Id.gpaText);

            notes = view.FindViewById <EditText>(Resource.Id.notes);
            Button nextButton = view.FindViewById <Button>(Resource.Id.nextButton);

            star  = view.FindViewById <ImageView>(Resource.Id.star);
            heart = view.FindViewById <ImageView>(Resource.Id.heart);
            ImageView    backButton   = view.FindViewById <ImageView>(Resource.Id.backButton);
            Button       hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard);
            LinearLayout rootLayout   = view.FindViewById <LinearLayout>(Resource.Id.rootLayout);

            hideKeyboard.Visibility = ViewStates.Invisible;
            hideKeyboard.Click     += (sender, e) =>
            {
                InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(notes.WindowToken, 0);
                rootLayout.RequestFocus();
                hideKeyboard.Visibility = ViewStates.Invisible;
            };
            notes.FocusChange += (sender, e) =>
            {
                hideKeyboard.Visibility = ViewStates.Visible;
            };


            backButton.Click += (sender, e) =>
            {
                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.qs_root_frame, new QsFragment());
                trans.Commit();
            };

            candidateName.Text   = studentAttributes.name;
            candidateEmail.Text  = studentAttributes.email;
            candidateSchool.Text = studentAttributes.school;
            candidateMajor.Text  = studentAttributes.major;
            candidateGT.Text     = studentAttributes.gradterm;
            candidateGPA.Text    = studentAttributes.gpa;

            nextButton.Click += NextButton_Click;
            star.Click       += Star_Click;
            heart.Click      += Heart_Click;

            return(view);
        }
Esempio n. 17
0
 public ActionResult Edit([Bind(Include = "StudentID,FirstName,LastName,Score")] StudentTable studentTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(studentTable));
 }
Esempio n. 18
0
 public async void DeleteStudent(StudentTable studentTable)
 {
     try
     {
         var data = await Connection.DeleteAsync(studentTable);
     }
     catch (Exception e)
     {
     }
 }
Esempio n. 19
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            StudentTable studenti = new StudentTable();

            studenti.GetStudent();
        }
        public void Student_table_test()
        {
            Assert.AreEqual(1.8856, StudentTable.GetStudentValue(2, 0.2));
            Assert.AreEqual(0.6901, StudentTable.GetStudentValue(16, 0.5));

            Assert.AreEqual(3.2614, StudentTable.GetStudentValue(50, 0.002));
            Assert.AreEqual(1.2816, StudentTable.GetStudentValue(502, 0.2));

            Assert.AreEqual(3.3101, StudentTable.GetStudentValue(500, 0.001));
            Assert.AreEqual(2.7638, StudentTable.GetStudentValue(10, 0.02));
        }
Esempio n. 21
0
        public void ReadDataBase(object rowData)
        {
            studentDataTable temp = model.Read();

            StudentTable.Clear();

            foreach (studentRow row in temp)
            {
                StudentTable.ImportRow(row);
            }
        }
Esempio n. 22
0
        public ActionResult Create([Bind(Exclude = "Id")] StudentTable AddStudent)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            obj_student.StudentTables.Add(AddStudent);
            obj_student.SaveChanges();

            return(RedirectToAction("ViewStudent"));
        }
Esempio n. 23
0
        public IHttpActionResult Getstudent(int id)
        {
            StudentTable student = db.StudentTables.Find(id);

            if (student == null)
            {
                return(NotFound());
            }

            return(Ok(student));
        }
Esempio n. 24
0
        public ActionResult Create([Bind(Include = "StudentID,FirstName,LastName,Score")] StudentTable studentTable)
        {
            if (ModelState.IsValid)
            {
                db.StudentTables.Add(studentTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(studentTable));
        }
Esempio n. 25
0
 public ActionResult Edit([Bind(Include = "id,name,age,sex")] StudentTable studentTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id = new SelectList(db.studenthobby, "studentid", "studentname", studentTable.id);
     return(View(studentTable));
 }
Esempio n. 26
0
        public ActionResult Delete(int id, FormCollection fc)
        {
            StudentTable stu = new StudentTable();

            stu.id = id;

            dbcontent.StudentTable.Attach(stu);
            dbcontent.Entry(stu).State = System.Data.Entity.EntityState.Deleted;
            dbcontent.SaveChanges();

            return(RedirectToAction("Index"));
        }
Esempio n. 27
0
        public TakeAttendance()
        {
            InitializeComponent();

            studentTable    = new StudentTable();
            attendanceTable = new AttendanceTable();

            this.Disposed += (s, e) => { qrWebcam.DisposeCamera(); };

            allStudents = studentTable.GetAllStudents();
            markAttendances();
        }
Esempio n. 28
0
        public IHttpActionResult Poststudent(StudentTable student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.StudentTables.Add(student);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = student.id }, student));
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var studentId = new StudentTable(db).GetStudentId(User.Identity.GetUserId());
                ddlYear.DataSource = new StudentYearClassSectionRollTable(db).
                                     GetYearByStudentId(studentId);
                ddlYear.DataBind();

                LoadDDLTerm(null, null);
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            StudentTable studentTable = db.StudentTables.Find(id);

            db.StudentTables.Remove(studentTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }