예제 #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable      tbl   = new DataTable();
                SqlDataAdapter adptr = new SqlDataAdapter("Select * From kullanici Where Kullanici_adi='" + tb_name.Text.ToString() + "' and kullanici_sifre='" + tb_pass.Text.ToString() + "'", conn);
                adptr.Fill(tbl);
                dataGridView1.DataSource = tbl;


                if (dataGridView1.Rows.Count > 1)
                {
                    if (dataGridView1.Rows[0].Cells[5].Value.ToString() == "admin")
                    {
                        connection.yetki = "admin";
                    }
                    else
                    {
                        connection.yetki = "user";
                    }
                    user_id       = int.Parse(dataGridView1.Rows[0].Cells[0].Value.ToString());
                    user_name     = tb_name.Text.ToString();
                    user_password = tb_pass.ToString();
                    user_type     = dataGridView1.Rows[0].Cells[5].Value.ToString();
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection  = conn;
                    cmd.CommandText = "Update kullanici set kullanici_giris_sayisi='" + (int.Parse(dataGridView1.Rows[0].Cells[6].Value.ToString()) + 1) + "',kullanici_giris_tarihi='" + DateTime.Now.Date + "',kullanici_giris_saati='" + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "' where kulanici_no='" + user_id + "'";
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    ad    = dataGridView1.Rows[0].Cells[1].Value.ToString();
                    soyad = dataGridView1.Rows[0].Cells[2].Value.ToString();
                    MessageBox.Show("Hoşgeldiniz " + dataGridView1.Rows[0].Cells[1].Value.ToString() + " " + dataGridView1.Rows[0].Cells[2].Value.ToString() + " Anasayfaya Yönlendiriliyorsunuz");
                    anasayfa ana = new anasayfa();
                    ana.Show();
                    Hide();
                }
                else
                {
                    MessageBox.Show("Kullanıcı adı veya şifre hatalı!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void depo_FormClosed(object sender, FormClosedEventArgs e)
        {
            anasayfa a = new anasayfa();

            a.Show();
        }
예제 #3
0
        private void teknik_servis_FormClosed(object sender, FormClosedEventArgs e)
        {
            anasayfa a = new anasayfa();

            a.Show();
        }