Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            admin f = new admin();

            f.Show();
        }
        private void login_Click(object sender, EventArgs e)
        {
            try  {
                if ((textBox1.Text == "admin") && (textBox2.Text == "admin"))
                {
                    this.Hide();
                    admin f = new admin();
                    f.Show();
                }

                if ((textBox1.Text != "admin"))
                {
                    con.Open();

                    SqlCommand    cmd1   = new SqlCommand("Select Name,Password  from Recipient where Name='" + textBox1.Text + "' and Password='******'", con);
                    SqlDataReader dr1    = cmd1.ExecuteReader();
                    int           count1 = 0;



                    while (dr1.Read())
                    {
                        count1++;
                    }
                    if (count1 == 1)
                    {
                        recipientaccount f = new recipientaccount();
                        this.Hide();
                        f.Show();
                    }


                    con.Close();
                }

                if ((textBox1.Text != "admin"))

                {
                    con.Open();

                    SqlCommand    cmd   = new SqlCommand("Select   Mail ,Password from Donor where Mail='" + textBox1.Text + "' and Password='******'", con);
                    SqlDataReader dr    = cmd.ExecuteReader();
                    int           count = 0;
                    while (dr.Read())
                    {
                        count += 1;
                    }
                    if (count == 1)
                    {
                        donoraccount f = new donoraccount();
                        this.Hide();
                        f.Show();
                    }
                }


                con.Close();
            }
            catch {
                MessageBox.Show("Error");
            }
        }