Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            HomeDoctor obj6 = new HomeDoctor();

            obj6.ShowDialog();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                if (textBox1.Text == "Tahmid147570" || textBox2.Text == "aurorasiaadele")
                {
                    MessageBox.Show("You are logged in successfully..");
                    this.Visible = false;
                    HomeAdmin obj1 = new HomeAdmin();
                    obj1.ShowDialog(this);


                    textBox1.Text  = "";
                    textBox2.Text  = "";
                    comboBox1.Text = "--Select--";
                }
                else
                {
                    MessageBox.Show("Invalid Username Or Password.");
                }
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\User\Source\Repos\TIS147570\doctorappointmentsol1\doctorappointment\appnt.mdf; Integrated Security = True");
                con.Open();
                string        str = "SELECT id FROM doctor WHERE name = '" + textBox1.Text + "' and pass = '******'";
                SqlCommand    cmd = new SqlCommand(str, con);
                SqlDataReader dr;
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    this.Visible = false;
                    HomeDoctor obj2 = new HomeDoctor();
                    obj2.ShowDialog();
                    textBox1.Text  = "";
                    textBox2.Text  = "";
                    comboBox1.Text = "--Select--";
                }
                else
                {
                    MessageBox.Show("Invalid username and Password.");
                }
            }
            else if (comboBox1.SelectedIndex == 2)
            {
                SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\User\Source\Repos\TIS147570\doctorappointmentsol1\doctorappointment\appnt.mdf; Integrated Security = True");
                con.Open();
                string        str = "SELECT id FROM user1 WHERE name = '" + textBox1.Text + "' and pass = '******'";
                SqlCommand    cmd = new SqlCommand(str, con);
                SqlDataReader dr;
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    this.Visible = false;
                    HomeUser obj2 = new HomeUser();
                    obj2.ShowDialog();
                    textBox1.Text  = "";
                    textBox2.Text  = "";
                    comboBox1.Text = "--Select--";
                }
                else
                {
                    MessageBox.Show("Invalid username and Password.");
                }
            }
            else
            {
                MessageBox.Show("Select User Please");
            }
        }