Ejemplo n.º 1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            adminform admin = new adminform();

            this.Hide();
            admin.Show();
        }
Ejemplo n.º 2
0
        //private void dataGridView2_Click(object sender, EventArgs e)
        //{
        //    adminform display = new adminform();
        //   // display = dataGridView2.CurrentRow.Cells[0].Value.ToString();
        //}

        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells["police_id"].Value.ToString());
            //SqlConnection c = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False");
            string query = " select * from employee_table where police_id=" + id + " ";

            SqlDataAdapter sda = new SqlDataAdapter(query, sqlConnection);
            DataTable      d   = new DataTable();

            sda.Fill(d);
            adminform display = new adminform(d);

            this.Hide();
            display.Show();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // SqlConnection con = new SqlConnection(@"Data Source=desktop-olv0avb\sqlexpress;Initial Catalog=police_management_system;Integrated Security=True;Pooling=False");
            string         query = "select * from login_table where user_name='" + textBox1.Text.Trim() + "'and password='******' ";
            SqlDataAdapter sda   = new SqlDataAdapter(query, sqlConnection);
            DataTable      d     = new DataTable();

            sda.Fill(d);
            if (d.Rows.Count == 1)
            {
                string account_type = d.Rows[0]["account_type"].ToString();
                switch (account_type)
                {
                case "admin":
                    adminform admin = new adminform();
                    this.Hide();
                    admin.Show();
                    break;

                case "employee":
                    emp_form emp = new emp_form();
                    this.Hide();
                    emp.Show();
                    break;

                case "fir":
                    fir_form fir = new fir_form();
                    this.Hide();
                    fir.Show();
                    break;
                }
            }
            else
            {
                MessageBox.Show("Incorrect user name or password");
            }
        }