private void backButton_Click(object sender, EventArgs e)
 {
     if (_isTutor)
     {
         Tutor tutor = (Tutor)Application.OpenForms["Tutor"];
         this.Hide();
         tutor._searchConsultationModal.Show();
         ClearForm();
     }
     else
     {
         Coordinator.Coordinator coordinator = (SSS_Windows_Forms.Forms.Coordinator.Coordinator)Application.OpenForms["Coordinator"];
         this.Hide();
         coordinator._searchStudentConsultationModal.Show();
         ClearForm();
     }
 }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            UpdateStudentConsultationModal updateConsultationModal = null;

            if (_isTutor)
            {
                updateConsultationModal = new UpdateStudentConsultationModal(_id, _coordinatorId, _tutorId);
                Tutor tutor = (Tutor)Application.OpenForms["Tutor"];
                tutor.SetModal(updateConsultationModal);
            }
            else
            {
                updateConsultationModal = new UpdateStudentConsultationModal(_id, _coordinatorId, null);
                Coordinator.Coordinator coordinator = (Coordinator.Coordinator)Application.OpenForms["Coordinator"];
                coordinator.SetModal(updateConsultationModal);
            }
            this.Hide();
            updateConsultationModal.Show();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var sInput = medUsername.Text;
            var sPassword = medPassword.Text;

            if (sPassword.Equals("HereBeDragons") && (sInput.Equals("Admin") || sInput.Equals("admin") || sInput.Equals("Administrator") || sInput.Equals("administrator")))
            {
                Form adminShow = new Administrator.Administrator();
                adminShow.Owner = this;
                adminShow.Show();
                this.Hide();
            }
            else if (!SSS_Library.DataServices.StringHandler.CheckIfStringANumber(sInput) || !sPassword.Equals("HereBeDragons") && (sInput.Equals("Admin") || sInput.Equals("admin") || sInput.Equals("Administrator") || sInput.Equals("administrator")))
            {
                MessageBox.Show(String.Format("{0}", Resources.IncorrectLoginDetailsMessage));
                medPassword.Clear();
                medUsername.Clear();
                medUsername.Focus();
            }
            else
            {
                _userId = Convert.ToInt32(sInput);

                IS2G10_DBSSSDataSet.USERPROFILERow userProfile = userprofileTableAdapter1.GetData().FindByuser_id(_userId);

                if (userProfile == null)
                {
                    MessageBox.Show(String.Format("{0}", Resources.IncorrectLoginDetailsMessage));
                    medPassword.Clear();
                    medUsername.Clear();
                    medUsername.Focus();
                }
                else
                {
                    if (userProfile.resetPassword)
                    {
                        CreatePassword(userProfile);
                    }
                    else
                    {
                        var doILogin = CheckPassword(userProfile, sPassword);

                        if (doILogin)
                        {
                            //coordinator role = 2
                            if (userProfile.user_roles_id == 2)
                            {
                                Form coordinatorShow = new Coordinator.Coordinator(_userId);
                                coordinatorShow.Owner = this;
                                coordinatorShow.Show();
                                this.Hide();

                            }
                            //student role = 4
                            else if (userProfile.user_roles_id == 4)
                            {
                                Form studentShow = new SSS_Windows_Forms.Student(_userId);
                                studentShow.Owner = this;
                                studentShow.Show();
                                this.Hide();
                            }
                            //tutor role = 3
                            else if (userProfile.user_roles_id == 3)
                            {
                                Form tutorShow = new Tutor.Tutor(_userId);
                                tutorShow.Owner = this;
                                tutorShow.Show();
                                this.Hide();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var sInput    = medUsername.Text;
            var sPassword = medPassword.Text;

            if (sPassword.Equals("HereBeDragons") && (sInput.Equals("Admin") || sInput.Equals("admin") || sInput.Equals("Administrator") || sInput.Equals("administrator")))
            {
                Form adminShow = new Administrator.Administrator();
                adminShow.Owner = this;
                adminShow.Show();
                this.Hide();
            }
            else if (!SSS_Library.DataServices.StringHandler.CheckIfStringANumber(sInput) || !sPassword.Equals("HereBeDragons") && (sInput.Equals("Admin") || sInput.Equals("admin") || sInput.Equals("Administrator") || sInput.Equals("administrator")))
            {
                MessageBox.Show(String.Format("{0}", Resources.IncorrectLoginDetailsMessage));
                medPassword.Clear();
                medUsername.Clear();
                medUsername.Focus();
            }
            else
            {
                _userId = Convert.ToInt32(sInput);

                IS2G10_DBSSSDataSet.USERPROFILERow userProfile = userprofileTableAdapter1.GetData().FindByuser_id(_userId);

                if (userProfile == null)
                {
                    MessageBox.Show(String.Format("{0}", Resources.IncorrectLoginDetailsMessage));
                    medPassword.Clear();
                    medUsername.Clear();
                    medUsername.Focus();
                }
                else
                {
                    if (userProfile.resetPassword)
                    {
                        CreatePassword(userProfile);
                    }
                    else
                    {
                        var doILogin = CheckPassword(userProfile, sPassword);

                        if (doILogin)
                        {
                            //coordinator role = 2
                            if (userProfile.user_roles_id == 2)
                            {
                                Form coordinatorShow = new Coordinator.Coordinator(_userId);
                                coordinatorShow.Owner = this;
                                coordinatorShow.Show();
                                this.Hide();
                            }
                            //student role = 4
                            else if (userProfile.user_roles_id == 4)
                            {
                                Form studentShow = new SSS_Windows_Forms.Student(_userId);
                                studentShow.Owner = this;
                                studentShow.Show();
                                this.Hide();
                            }
                            //tutor role = 3
                            else if (userProfile.user_roles_id == 3)
                            {
                                Form tutorShow = new Tutor.Tutor(_userId);
                                tutorShow.Owner = this;
                                tutorShow.Show();
                                this.Hide();
                            }
                        }
                    }
                }
            }
        }