Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OracleCommand cmd = new OracleCommand();

            cmd.Connection = conn;
            //cmd.Parameters.Add("id", (textBox1.Text.ToString()));
            if (radioButton1.Checked)
            {
                cmd.CommandText = "select Doc_ID from Doctor where SID=:id ";
                cmd.Parameters.Add("id", textBox1.Text.ToString());
                cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    Doctor d = new Doctor();
                    d.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Credentials");
                }
                dr.Close();
            }
            else if (radioButton2.Checked)
            {
                cmd.CommandText = "select pat_id from patient where SSN = :id ";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("id", textBox1.Text.ToString());
                //cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                //  MessageBox.Show(textBox1.Text.ToString());
                if (dr.Read())
                {
                    //MessageBox.Show(textBox1.Text.ToString());
                    Patient p = new Patient(int.Parse(textBox1.Text));
                    p.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Credentials");
                }
                dr.Close();
            }
            else if (radioButton3.Checked)
            {
                cmd.CommandText = "select N_ID from nurse where SID = :id";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("id", textBox1.Text.ToString());
                OracleDataReader dr = cmd.ExecuteReader();

                //  MessageBox.Show( textBox1.Text.ToString());
                if (dr.Read())
                {
                    Nurse n = new Nurse();
                    n.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Credentials");
                }
                dr.Close();
            }
        }