예제 #1
0
        //ekran yenileme
        private void button1_Click(object sender, EventArgs e)
        {
            KullaniciPanel kullaniciPanel = new KullaniciPanel();

            kullaniciPanel.Show();
            this.Close();
        }
예제 #2
0
        private void Baglan(int i)
        {
            connection.Open();
            try
            {
                if (i == 1)
                {
                    try
                    {
                        komut = new SqlCommand("INSERT INTO Kullanici (Sifre,KullaniciAdi) VALUES ('" + txtKayitSifre.Text + "','" + txtKayitKullaniciAdi.Text + "')", connection);
                        oku   = komut.ExecuteReader();
                        oku.Read();
                        MessageBox.Show("Kayıt İşlemi tamamlandı lütfen girişe yönelin");
                    }
                    catch
                    {
                        MessageBox.Show("Kayıt işlemi başarısız!!!");
                    }
                }
                else
                {
                    if (i == 2)
                    {
                        komut = new SqlCommand("select * from Kullanici where KullaniciAdi='" + txtGirisKullaniciAdi.Text + "' and Sifre='" + txtGirisSifre.Text + "'", connection);
                        oku   = komut.ExecuteReader();
                        if (oku.Read())
                        {
                            KullaniciBilgileri.KullaniciAdi = txtGirisKullaniciAdi.Text;
                            KullaniciBilgileri.Sifre        = txtGirisSifre.Text;
                            KullaniciBilgileri.KullaniciId  = Convert.ToInt32(oku.GetValue(0));
                            kullanici = new KullaniciPanel();
                            kullanici.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("Hatalı bilgiler girdiniz.");
                        }
                    }
                }
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show("Lütfen boşlukları uygun şekilde doldurunuz !!! {0} ", e.ToString());
            }

            oku.Close();
            komut.Dispose();
            connection.Close();
        }