// //////////// log in
        private void button3_Click(object sender, EventArgs e)
        {
            if (txt_pass.Text == "" || txt_username.Text == "")
            {
                MessageBox.Show("Please Enter UserName & Password");
                return;
            }

            con.Open();
            cmd = new SqlCommand(" select * from p_login ('" + txt_username.Text + "')", con);

            Rd   = cmd.ExecuteReader();
            find = false;
            while (Rd.Read())
            {
                find = true;
                if (Rd["password"].ToString().Trim() == txt_pass.Text)
                {
                    id = (int)Rd["passenger_id"];

                    ////// id is taken for reserving
                    ////// passenger form
                    if (checkBox1.Checked)
                    {
                        Properties.Settings.Default.rememmber_name     = txt_username.Text;
                        Properties.Settings.Default.rememmber_password = txt_pass.Text;
                        Properties.Settings.Default.Save();
                    }
                    WindowsFormsApplication1.Form3 f = new WindowsFormsApplication1.Form3(id);
                    f.Show();

                    this.Hide();
                    break;
                }
                else
                {
                    MessageBox.Show("Wrong Password");
                }
            }
            if (!find)
            {
                MessageBox.Show("this username isn`t exist");
            }

            Rd.Close();
            con.Close();
        }
Example #2
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     WindowsFormsApplication1.Form3 frm3 = new WindowsFormsApplication1.Form3();
     frm3.Show();
     this.Close();
 }