Ejemplo n.º 1
0
 private void girisyapbuton_Click(object sender, EventArgs e)
 {
     try
     {
         if (ogrencino.Text == "" || ogrencisifre.Text == "")
         {
             MessageBox.Show("Lütfen boş alan bırakmayınız!!!");
         }
         else
         {
             islem = new SinifOgretmenGiris();
             user  = islem.getUser(ogrencino.Text, ogrencisifre.Text);
             if (user != null)
             {
                 OgretmenAnaMenu    a = new OgretmenAnaMenu();
                 OgretmenBilgiPanel b = new OgretmenBilgiPanel();
                 // a.textBox2.Text = "Sayın " + user.Unvan.ToString();
                 a.label9.Text = user.İsim.ToString() + " " + user.Soyisim.ToString();
                 a.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Öğretmen Kullanıcı adı veya şifreyi yanlış girdiniz. Lütfen tekrar deneyiniz.");
             }
         }
     }
     catch (Exception hata)
     {
         MessageBox.Show("Bir hata oluştu. \n");
         MessageBox.Show(hata.Message);
     }
 }
Ejemplo n.º 2
0
        public SinifOgretmen getUser(string kullaniciadi, string sifre)
        {
            SinifOgretmen user = null;

            using (var connection = Database.GetConnection())
            {
                var command = new SqlCommand("SELECT *FROM ogretim_gorevlisi WHERE ogretim_kullanici='" + kullaniciadi + "'and ogretim_sifre='" + sifre + "'");// "'and ad='" + isim + "'and soyad='" + soyisim + "'and unvan='" + unvan + "'");
                command.Connection = connection;
                connection.Open();
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        user = new SinifOgretmen();
                        user.KullaniciAdi = reader.GetString(5); // 3.tablo kullanıcı adı
                        user.Sifre        = reader.GetString(6); // 2.tablo sifredir. 0isim 1soyisim 5 ise unvan tablosu
                        user.İsim         = reader.GetString(1);
                        user.Soyisim      = reader.GetString(2);

                        //Üstteki komutlar doğrulama için alttakiler ise formdan forma bilgi aktarımı
                        KullaniciAdi1 = reader.GetString(5);
                        İsim1         = reader.GetString(1);
                        Soyisim1      = reader.GetString(2);
                        Unvan1        = reader.GetString(3);
                        BolumID1      = reader.GetInt32(4);
                    }
                }
                connection.Close();
            }
            return(user);
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (boxİsim.Text == "" || boxSoyisim.Text == "" || boxSifre.Text == "" || boxNO.Text == "" || boxBolumID.Text == "" || boxUnvan.Text == "")
            {
                MessageBox.Show("Lütfen eksik kutu bırakmayınız. Alanları doldurunuz. Bölümünüzü ve Ünvanınızı seçmeyi unutmayınız.");
            }
            else
            {
                SinifOgretmenGiris islem = new SinifOgretmenGiris();
                SinifOgretmen      user  = new SinifOgretmen();
                //islem2 = new SinifOgrenciGiris();
                //user2 = new SinifOgrenci();
                user.İsim         = boxİsim.Text;
                user.Soyisim      = boxSoyisim.Text;
                user.Sifre        = boxSifre.Text;
                user.BolumID      = Convert.ToInt32(boxBolumID.Text);
                user.KullaniciAdi = boxNO.Text;
                user.Unvan        = boxUnvan.Text;


                if (islem.InsertUser(user))
                {
                    MessageBox.Show("Kayıt işleminiz başarıyla sonuçlandı.");
                }
                else
                {
                    MessageBox.Show("Bu kullanıcı adı ile kayıtlı bir öğretim görevlisi mevcuttur. Lütfen başka kullanıcı adı seçiniz.");
                }
            }
        }
Ejemplo n.º 4
0
        private bool ContainsUser(SinifOgretmen user)
        {
            bool result = false;

            using (var connection = Database.GetConnection())
            {
                var command = new SqlCommand("SELECT *FROM ogretim_gorevlisi WHERE ogretim_kullanici='" + user.KullaniciAdi + "'");
                //var command = new SqlCommand("SELECT *FROM Users WHERE Name='" + user.Name + "' and Password='******'");
                command.Connection = connection;
                connection.Open();
                using (var reader = command.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        result = true;
                    }
                }
                connection.Close();
            }
            return(result);
        }
Ejemplo n.º 5
0
        public bool InsertUser(SinifOgretmen user)
        {
            bool result = false;

            if (!ContainsUser(user))
            {
                using (var connection = Database.GetConnection())
                {
                    // var command = new SqlCommand("INSERT INTO ogretmenn(isim,soyisim,kullaniciadi,sifre,unvan) VALUES('" + user.İsim + "','" + user.Soyisim + "','" + user.KullaniciAdi + "','" + user.Sifre + "','" + user.Unvan + ")'");
                    // var command = new SqlCommand("INSERT INTO ogretmenn(ad,soyad,kullaniciadi,sifre,unvan) VALUES ("+ user.İsim + "," + user.Soyisim + "," + user.KullaniciAdi + "," + user.Sifre + "," + user.Unvan + ",");
                    var command = new SqlCommand("INSERT INTO ogretim_gorevlisi(ad,soyad,ogretim_kullanici,ogretim_sifre,unvan,bolum_id) VALUES('" + user.İsim + "','" + user.Soyisim + "','" + user.KullaniciAdi + "','" + user.Sifre + "','" + user.Unvan + "','" + user.BolumID + "')");
                    command.Connection = connection;
                    connection.Open();
                    if (command.ExecuteNonQuery() != -1)
                    {
                        result = true;
                    }
                    connection.Close();
                }
            }
            return(result);
        }