Пример #1
0
        private void metroTile9_Click(object sender, EventArgs e)
        {
            this.Hide();
            StudentForm st = new StudentForm();

            st.Show();
        }
        /// <summary>
        /// Handles the Student grid's click event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void StudentsGridClicked(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row     = StudentsGrid.Rows[e.RowIndex];
            Student         student = (Student)row.Tag;

            switch (e.ColumnIndex)
            {
            case (int)StudentsGridColumn.Enrollment:
                StudentCoursesForm studentCoursesForm = new StudentCoursesForm(student);
                studentCoursesForm.Show();
                break;

            case (int)StudentsGridColumn.Edit:
                StudentForm studentForm = new StudentForm(student);
                studentForm.Show();
                break;

            case (int)StudentsGridColumn.Delete:
                switch (MessageBox.Show(this, String.Format("Are you sure you want to delete {0}, {1}", student.LastName, student.FirstName),
                                        "Delete Student", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation))
                {
                case DialogResult.OK:
                    student.Delete();
                    break;

                default:
                    break;
                }
                Refresh();
                break;
            }
        }
Пример #3
0
        private void dgvStudents_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int currentRow = e.RowIndex;

            if (currentRow != -1)
            {
                var idStudent   = Convert.ToInt32(dgvStudents.Rows[currentRow].Cells["StudentId"].Value);
                var studentForm = new StudentForm(idStudent, false);
                studentForm.MdiParent = this.MdiParent;
                studentForm.Show();

                Filter(tbLastname.Text, (int?)cbGroups.SelectedValue, dtpDateBegin.Value, dtpDateEnd.Value, (int?)cbTypeGroup.SelectedValue, sortColumn, chbTransfer.Checked, sortOrder);

                if (currentRow != dgvStudents.Rows.Count)
                {
                    dgvStudents.Rows[currentRow].Selected = true;
                    dgvStudents.CurrentCell = dgvStudents.Rows[currentRow].Cells["Lastname"];
                }
                else
                {
                    dgvStudents.Rows[dgvStudents.Rows.Count - 1].Selected = true;
                    dgvStudents.CurrentCell = dgvStudents.Rows[currentRow].Cells["Lastname"];
                }
            }
        }
Пример #4
0
        private void btnHomePageLogin_Click(object sender, EventArgs e)
        {
            switch (cmbxHomePAgeUserType.SelectedItem.ToString())
            {
            case "Teacher":
                //LocalStorage.homePage = this;
                TeacherForm teacher = new TeacherForm();
                teacher.Show();
                //this.Hide();
                break;

            case "Mentor":
                var form3 = new MentorForm();
                form3.Show();
                break;

            case "Student":
                var form4 = new StudentForm();
                form4.Show();
                break;

            case "Admin":
                var form1 = new RegistrationForm();
                form1.Show();
                break;
            }
        }
Пример #5
0
 private void TryLogin()
 {
     if (Core.Server.Integration.Connected())
     {
         Student user  = Core.Server.Integration.ExecuteGetStudent(textBox1.Text);
         Teacher user2 = Core.Server.Integration.ExecuteGetTeacher(textBox1.Text);
         if (user != null)
         {
             // student exists
             // check if password is correct
             if (textBox2.Text == user.Password)
             {
                 if (openForm != null)
                 {
                     openForm.Close();
                 }
                 // password is correct
                 StudentForm form = new StudentForm(user);
                 // open student form
                 form.Show();
                 // minimize login
                 this.WindowState = FormWindowState.Minimized;
             }
             else
             {
                 errorText.Text = "Incorrect Password";
             }
         }
         else if (user2 != null)
         {
             // teacher exists
             // check if password is correct
             if (textBox2.Text == user2.Password)
             {
                 if (openForm != null)
                 {
                     openForm.Close();
                 }
                 // password is correct
                 TeacherForm form = new TeacherForm(user2);
                 // open teacher form
                 form.Show();
                 // minimize login
                 this.WindowState = FormWindowState.Minimized;
             }
             else
             {
                 errorText.Text = "Incorrect Uassword";
             }
         }
         else
         {
             errorText.Text = "Invalid Username";
         }
     }
     else
     {
         errorText.Text = "Check Connection";
     }
 }
Пример #6
0
        private void dgvStudents_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            currentRow = e.RowIndex;
            if (currentRow != -1)
            {
                var idStudent   = Convert.ToInt32(dgvStudents.Rows[currentRow].Cells["StudentId"].Value);
                var studentForm = new StudentForm(idStudent, true);
                studentForm.MdiParent = this.MdiParent;
                studentForm.Show();

                //Filter((int?)cbGroups.SelectedValue, (int?)cbTypeGroup.SelectedValue, tbLastname.Text, (int?)cbStatuses.SelectedValue, (int?)cbSchools.SelectedValue, (int?)cbClasses.SelectedValue,
                //cbShifts.SelectedItem, cbActivityGroup.Text, sortColumn, sortOrder);

                if (currentRow != dgvStudents.Rows.Count)
                {
                    if (dgvStudents.Rows.Count != 0)
                    {
                        dgvStudents.Rows[currentRow].Selected = true;
                        dgvStudents.CurrentCell = dgvStudents.Rows[currentRow].Cells["Lastname"];
                    }
                }
                else
                {
                    dgvStudents.Rows[dgvStudents.Rows.Count - 1].Selected = true;
                    dgvStudents.CurrentCell = dgvStudents.Rows[currentRow].Cells["Lastname"];
                }
            }
        }
Пример #7
0
 public static void Auth(Label label, string login, string password, Form form)
 {
     if (CheckAgainstInjection.Check(login, password) == true)
     {
         string hashPassword = MD5HashPassword.GetHash(password);
         if (AuthAdminStudentTeacher.Auth(login, hashPassword) == 1)
         {
             Form1 form1 = new Form1();
             form1.Show();
             form.Hide();
         }
         else if (AuthAdminStudentTeacher.Auth(login, hashPassword) == 2)
         {
             StudentForm studentForm = new StudentForm();
             studentForm.Show();
             form.Hide();
         }
         else if (AuthAdminStudentTeacher.Auth(login, hashPassword) == 3)
         {
         }
         else if (AuthAdminStudentTeacher.Auth(login, hashPassword) == 0)
         {
             label.Text = "Неправильный логин или пароль";
         }
     }
     else
     {
         label.Text = "Логин или пароль не может содержать пробелы";
     }
 }
        private void addbutton_Click(object sender, EventArgs e)
        {
            DireccionGestor.setorigen("buscador");
            StudentForm studentaddobject = new StudentForm();

            studentaddobject.WindowState = FormWindowState.Maximized;
            studentaddobject.Show();
            this.Close();
        }
Пример #9
0
        private void добавитьСлушателяToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var studentForm = new StudentForm(0, true);

            studentForm.MdiParent = this;
            //studentForm.addStudent = true;
            studentForm.Show();
            studentForm.Location    = new Point(20, 10);
            studentForm.WindowState = FormWindowState.Maximized;
        }
Пример #10
0
        private void btnStudentM_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            StudentForm st = new StudentForm();

            panelMain.Controls.Clear();
            st.TopLevel = false;
            st.Dock     = DockStyle.Fill;
            panelMain.Controls.Add(st);
            st.Show();
        }
Пример #11
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            LoginClass create = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            create.CreateStudentTable(UserAccessForm.getusername());
            origen = "inicio";
            StudentForm studentaddobject = new StudentForm();

            studentaddobject.WindowState = FormWindowState.Maximized;
            studentaddobject.Show();
            this.Close();
        }
Пример #12
0
        //Checks user info
        private void CheckUserInfo(object sender, EventArgs e)
        {
            if (cbxLoginUserType.Text == "Teacher")
            {
                UserType = 1;
            }
            else if (cbxLoginUserType.Text == "Student")
            {
                UserType = 2;
            }
            else if (cbxLoginUserType.Text == "Mentor")
            {
                UserType = 3;
            }

            if (db.Logins.ToList().Any(t => t.LoginEmail == tbxLoginEmail.Text && t.LoginPassword == tbxLoginPassword.Text && t.UserTypeId == UserType))
            {
                //holds user email
                UserEmail = tbxLoginEmail.Text;

                //Disables th ebutton
                btnSignIn.Enabled = false;

                if (UserType == 1)
                {
                    TeacherForm teacher = new TeacherForm();
                    teacher.Show();
                    teacher.FillTeacherInfo(tbxLoginEmail.Text);
                }
                else if (UserType == 2)
                {
                    StudentForm student = new StudentForm();
                    student.Show();
                    student.FillStudentInfo(tbxLoginEmail.Text);
                }
                else if (UserType == 3)
                {
                    MentorForm mentor = new MentorForm();
                    mentor.Show();
                    mentor.FillMentorInfo(tbxLoginEmail.Text);
                }
            }
            else
            {
                MessageBox.Show("Wrong data was provided.");
            }
        }
Пример #13
0
        //If user is not registerd in database, builder returns null
        public void LoadUser(string userName, string password, string userType)
        {
            User user = DataManager.ReturnUser(userName, password, userType);

            if (userType.Equals("student"))
            {
                StudentForm studentForm = new StudentForm((Student)user);
                studentForm.Show();
                CloseMainForm();
            }
            else if (userType.Equals("teacher"))
            {
                TeacherForm teacherForm = new TeacherForm((Teacher)user);
                teacherForm.Show();
                CloseMainForm();
            }
        }
        private void editbutton_Click(object sender, EventArgs e)
        {
            DireccionGestor.setsombrestatic(namelabel.Text);

            DireccionGestor.setotrostatic(gradelabel.Text);
            string        userDataName = UserAccessForm.getusername() + "_student_table";
            StudentsClass student      = new StudentsClass();
            string        orden        = "select * from " + userDataName + " where `NOMBRE COMPLETO` = '" + namelabel.Text + "' and CURSO= '" + gradelabel.Text + "';";

            DireccionGestor.setorigen("editor");
            DireccionGestor.setordensql(orden);

            StudentForm studentaddobject = new StudentForm();

            studentaddobject.WindowState = FormWindowState.Maximized;
            studentaddobject.Show();
            this.Close();
        }
        private void editbutton_Click(object sender, EventArgs e)
        {
            if (gradebox.Text == "" || edadbox.Text == "" || namebox.Text == "")
            {
                MessageBox.Show("Hay datos importantes faltantes.");

                if (gradebox.Text == "")
                {
                    gradebox.BackColor = Color.Red;
                }
                if (edadbox.Text == "")
                {
                    edadbox.BackColor = Color.Red;
                }
                if (namebox.Text == "")
                {
                    namebox.BackColor = Color.Red;
                }
            }
            else
            {
                DireccionGestor.setsombrestatic(namebox.Text);
                DireccionGestor.setedadstatic(int.Parse(edadbox.Text));
                DireccionGestor.setotrostatic(gradebox.Text);
                string        userDataName = UserAccessForm.getusername() + "_student_table";
                StudentsClass student      = new StudentsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                string        orden        = "select * from " + userDataName + " where `NOMBRE COMPLETO` = '" + namebox.Text + "' and EDAD = '" + edadbox.Text + "' and CURSO= '" + gradebox.Text + "';";
                if (student.fillcombos(namebox, edadbox, gradebox, orden) == true)
                {
                    DireccionGestor.setorigen("editor");
                    DireccionGestor.setordensql(orden);

                    StudentForm studentaddobject = new StudentForm();
                    studentaddobject.WindowState = FormWindowState.Maximized;
                    studentaddobject.Show();
                    this.Close();
                }
            }
        }
Пример #16
0
        private void button2_Click(object sender, EventArgs e)
        {
            StudentForm newForm = new StudentForm();

            newForm.Show();
        }
        /// <summary>
        /// Handles the Add New Student button's click event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void AddNewStudentButton_Click(object sender, EventArgs e)
        {
            StudentForm studentForm = new StudentForm();

            studentForm.Show();
        }