private void Login_Button_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
     {
         MessageBox.Show("Please fill in all the required information");
     }
     else if (textBox2.Text.ToString() != textBox3.Text.ToString())
     {
         MessageBox.Show("Password Mismatch , please write down them again");
         textBox2.Text = null;
         textBox3.Text = null;
     }
     else
     {
         int r = controllerObj.DoctorChangePassword(textBox1.Text.ToString(), textBox2.Text.ToString());
         if (r != 0)
         {
             object c = controllerObj.GetDoctorNameByUsername(textBox1.Text.ToString());
             MessageBox.Show("Password changed succesfully, Enjoy!");
             Doctor_Interface_Beg S = new Doctor_Interface_Beg();
             S.YourName_Label.Text = c.ToString();
             S.Show();
         }
         else
         {
             MessageBox.Show("Something went wrong while changing your password, please re-enter your info");
         }
     }
 }
Esempio n. 2
0
 private void Login_Button_Click(object sender, EventArgs e)
 {
     controllerObj = new Controller();
     if (textBox1.Text == "" || textBox2.Text == "")
     {
         MessageBox.Show(" Please write your username and password");
     }
     else
     {
         object r = controllerObj.CheckDoctorLogIn(textBox1.Text.ToString(), textBox2.Text.ToString());
         if (r != null)
         {
             Doctor_Interface_Beg D = new Doctor_Interface_Beg();
             object dt2             = controllerObj.GetDoctorNameByUsername(textBox1.Text.ToString());
             D.YourName_Label.Text = dt2.ToString();
             D.Show();
         }
         else
         {
             MessageBox.Show("Incorrect Password or username, please try again");
         }
     }
 }
Esempio n. 3
0
        private void Register_Button_Click(object sender, EventArgs e)
        {
            if (Login_Name_TextBox.Text == "" || Login_Username_Button.Text == "" || Login_Email_Textbox.Text == "" || Login_Password_Button.Text == "")
            {
                MessageBox.Show("Please fill in all the required info");
            }
            else if (SignUpAs_ComboBox1.SelectedItem == null)
            {
                MessageBox.Show("Please fill in all the required info");
            }

            else if (SignUpAs_ComboBox1.SelectedItem.ToString() == "Student")
            {
                int c      = int.Parse(controllerObj.GetCountOfStudent().ToString());
                int StudNo = c + 1 + 1170000;
                int r      = controllerObj.AddStudent(StudNo, Login_Name_TextBox.Text.ToString(), Login_Username_Button.Text.ToString(), Login_Password_Button.Text.ToString(), Login_Email_Textbox.Text.ToString());
                if (r != 0)
                {
                    Student_Interface_Beg S = new Student_Interface_Beg();
                    MessageBox.Show("Your account is added succesfully, enjoy!");
                    S.Show();
                }
                else
                {
                    MessageBox.Show("Something went wrong while adding your account , please try again");
                }
            }
            else if (SignUpAs_ComboBox1.SelectedItem.ToString() == "Doctor")
            {
                int c      = int.Parse(controllerObj.GetCountOfDoctors().ToString());
                int StudNo = c + 1 + 1170000;
                int r      = controllerObj.AddDoctors(StudNo, Login_Name_TextBox.Text.ToString(), Login_Username_Button.Text.ToString(), Login_Password_Button.Text.ToString(), Login_Email_Textbox.Text.ToString());
                if (r != 0)
                {
                    MessageBox.Show("Your account is added succesfully, enjoy!");
                    Doctor_Interface_Beg D = new Doctor_Interface_Beg();
                    D.Show();
                }
                else
                {
                    MessageBox.Show("Something went wrong while adding your account , please try again");
                }
            }
            else if (SignUpAs_ComboBox1.SelectedItem.ToString() == "Sponsor")
            {
                int c      = int.Parse(controllerObj.GetCountOfSponsors().ToString());
                int StudNo = c + 1 + 97000;
                int r      = controllerObj.AddSponsors(StudNo, Login_Name_TextBox.Text.ToString(), Login_Username_Button.Text.ToString(), Login_Password_Button.Text.ToString(), Login_Email_Textbox.Text.ToString());
                if (r != 0)
                {
                    MessageBox.Show("Your account is added succesfully, enjoy!");
                    Sponsor_Interface_Beg S = new Sponsor_Interface_Beg();
                    S.Show();
                }


                else
                {
                    MessageBox.Show("Something went wrong while adding your account , please try again");
                }
            }
        }