//private void Temizle()
        //{
        //    txtVize.Text = "";
        //    txtFinal.Text = "";
        //    txtAdSoyad.Text = "";
        //    txtOrtalama.Text = "";
        //    txtOgrenciNo.Text = "";
        //    cmbDersAdi.Items.Clear();

        //}

        //private void btnKaydet_Click(object sender, EventArgs e)
        //{
        //    OgrenciTablo ogrencitablo = new OgrenciTablo();
        //    ogrencitablo.OgrenciNo = txtOgrenciNo.Text;

        //    NotlarTablo notlartablo = new NotlarTablo();
        //    notlartablo.Vize = Convert.ToInt32(txtVize.Text);
        //    notlartablo.Final = Convert.ToInt32(txtFinal.Text);
        //    notlartablo.Ortalama = Convert.ToInt32((notlartablo.Vize * 0.3) + (notlartablo.Final * 0.7));
        //    notlartablo.OgrenciId = OgrenciTablo.OgrenciIdBul(ogrencitablo);
        //    notlartablo.DerslerId = ((Dersler)cmbDersAdi.SelectedItem).DerslerId;
        //    NotlarTablo.NotGiris(notlartablo);
        //    MessageBox.Show("Not Girişi Başarılı");
        //    Temizle();
        //}

        private void DerslerDoldur()
        {
            OgrenciTablo ogrencitablo = new OgrenciTablo();

            ogrencitablo.OgrenciNo = txtOgrenciNo.Text;
            int           ogrenciIdsi  = OgrenciTablo.OgrenciIdBul(ogrencitablo);
            int           OgretmenIdsi = OgretmenTablo.OgretmenIdBul2();
            DataTable     tablo        = new DataTable();
            SqlConnection conn         = DbConncection.GetSqlConnection();
            var           cmd          = new SqlCommand();

            cmd.Connection = conn;
            conn.Open();

            cmd.CommandText = "SELECT Ahmet_Dersler.DersAdi, Ahmet_Notlar.Vize, Ahmet_Notlar.Final, Ahmet_Notlar.Ortalama FROM Ahmet_Dersler INNER JOIN Ahmet_SecilenDersler ON Ahmet_Dersler.DerslerId = Ahmet_SecilenDersler.DerslerId INNER JOIN Ahmet_Notlar ON Ahmet_Dersler.DerslerId = Ahmet_Notlar.DerslerId WHERE Ahmet_SecilenDersler.OgrenciId=@OgrenciId AND Ahmet_Dersler.OgretmenId=@OgretmenId ";
            cmd.Parameters.AddWithValue("@OgrenciId", ogrenciIdsi);
            cmd.Parameters.AddWithValue("@OgretmenId", OgretmenIdsi);
            SqlDataReader reader = cmd.ExecuteReader();

            tablo.Load(reader);

            dgNotGiris.DataSource            = tablo;
            dgNotGiris.Columns[1].HeaderText = "Ders Adı";
            dgNotGiris.Columns[2].HeaderText = "Vize";
            dgNotGiris.Columns[3].HeaderText = "Final";
            dgNotGiris.Columns[4].HeaderText = "Ortalama";
        }
        public static bool OgretmenTabloEkle(OgretmenTablo yeniOgretmenTablo)
        {
            SqlConnection conn = DbConncection.GetSqlConnection();
            var           cmd  = new SqlCommand();

            cmd.CommandText = "INSERT INTO Ahmet_Ogretmen(IseBaslama,GecmisDeneyimler) VALUES(@IseBalama,@GecmisDeneyimler)";
            cmd.Connection  = conn;
            cmd.Parameters.AddWithValue("@IseBalama", yeniOgretmenTablo.IseBaslama);
            cmd.Parameters.AddWithValue("@GecmisDeneyimler", yeniOgretmenTablo.GecmisDeneyimler);
            conn.Open();
            return(cmd.ExecuteNonQuery() > 0);

            conn.Close();
        }
예제 #3
0
        private void DerslerDoldur()
        {
            OgrenciTablo ogrencitablo = new OgrenciTablo();

            ogrencitablo.OgrenciNo = txtOgrenciNo.Text;
            int ogrenciIdsi  = OgrenciTablo.OgrenciIdBul(ogrencitablo);
            int OgretmenIdsi = OgretmenTablo.OgretmenIdBul2();

            SqlConnection conn = DbConncection.GetSqlConnection();
            var           cmd  = new SqlCommand();

            cmd.Connection = conn;
            conn.Open();
            cmd.CommandText = "SELECT Ahmet_Dersler.DerslerId,Ahmet_Dersler.DersAdi FROM Ahmet_Dersler INNER JOIN Ahmet_SecilenDersler ON Ahmet_Dersler.DerslerId = Ahmet_SecilenDersler.DerslerId where Ahmet_SecilenDersler.OgrenciId=@OgrenciId AND Ahmet_Dersler.OgretmenId=@OgretmenId  ";
            cmd.Parameters.AddWithValue("@OgrenciId", ogrenciIdsi);
            cmd.Parameters.AddWithValue("@OgretmenId", OgretmenIdsi);

            SqlDataReader reader = cmd.ExecuteReader();

            if (!reader.HasRows)
            {
                MessageBox.Show("Bu öğrenciye not verme yetkiniz yoktur");
            }
            else
            {
                while (reader.Read())
                {
                    Dersler dersler = new Dersler();
                    {
                        dersler.DerslerId = reader.GetInt32(0);
                        dersler.DersAdi   = reader.GetString(1);
                    }
                    cmbDersAdi.Items.Add(dersler);
                }
                cmbDersAdi.SelectedIndex = 0;
            }

            conn.Close();
        }
        private void btnKayıtEkle_Click(object sender, EventArgs e)
        {
            if (((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId == 1)
            {
                OgrenciTablo ogrencitablo = new OgrenciTablo();
                ogrencitablo.OgrenciNo        = txtOgrenciNo.Text;
                ogrencitablo.OkulaGirisDonemi = ((String)cmbOkulaGirisDonemi.SelectedItem);
                ogrencitablo.OgrenciSinifi    = ((Int32)cmbOgrenciSinif.SelectedItem);
                ogrencitablo.FakulteId        = ((Fakulte)cmbFakulte.SelectedItem).FakulteId;
                ogrencitablo.BolumId          = ((Bolum)cmbBolum.SelectedItem).BolumId;
                OgrenciTablo.OgrenciTabloEkle(ogrencitablo);

                Kisisel ogrencikisisel = new Kisisel();
                ogrencikisisel.TC              = txtTc.Text;
                ogrencikisisel.Ad              = txtAd.Text;
                ogrencikisisel.Soyad           = txtSoyad.Text;
                ogrencikisisel.DogumTarih      = datetimeDogumTarih.Value;
                ogrencikisisel.CinsiyetId      = ((Cinsiyet)cmbCinsiyet.SelectedItem).CinsiyetId;
                ogrencikisisel.MedeniDurumId   = ((MedeniDurum)cmbMedeniDurum.SelectedItem).MedeniDurumId;
                ogrencikisisel.Mail            = txtmail.Text;
                ogrencikisisel.EvTel           = txtEvTel.Text;
                ogrencikisisel.CepTel          = txtCepTel.Text;
                ogrencikisisel.Unvan           = txtUnvan.Text;
                ogrencikisisel.KullaniciTipiId = ((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId;
                ogrencikisisel.KullaniciAdi    = ogrencitablo.OgrenciNo;
                ogrencikisisel.Sifre           = ogrencikisisel.TC;
                ogrencikisisel.OgrenciId       = OgrenciTablo.OgrenciIdBul(ogrencitablo);
                Kisisel.KisiselOgrenciEkle(ogrencikisisel);

                GecmisEgitim gecmis = new GecmisEgitim();
                gecmis.MezuniyetYil      = ((Int32)cmbMezuniyetYil.SelectedItem);
                gecmis.MezuniyetDerecesi = Convert.ToDouble(txtMezuniyetDerecesi.Text);
                gecmis.MezunOkul         = txtGecmisOkul.Text;
                gecmis.OgrenciId         = OgrenciTablo.OgrenciIdBul(ogrencitablo);
                GecmisEgitim.GecmisOgrenciEkle(gecmis);
                Temizle();

                MessageBox.Show("Öğrenci Kaydedildi");
            }
            if (((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId == 2)
            {
                OgretmenTablo ogretmentablo = new OgretmenTablo();
                ogretmentablo.IseBaslama       = datetimeIseBaslama.Value;
                ogretmentablo.GecmisDeneyimler = txtGecmisDeneyimler.Text;
                OgretmenTablo.OgretmenTabloEkle(ogretmentablo);

                Kisisel ogretmenkisisel = new Kisisel();
                ogretmenkisisel.TC              = txtTc.Text;
                ogretmenkisisel.Ad              = txtAd.Text;
                ogretmenkisisel.Soyad           = txtSoyad.Text;
                ogretmenkisisel.DogumTarih      = datetimeDogumTarih.Value;
                ogretmenkisisel.CinsiyetId      = ((Cinsiyet)cmbCinsiyet.SelectedItem).CinsiyetId;
                ogretmenkisisel.MedeniDurumId   = ((MedeniDurum)cmbMedeniDurum.SelectedItem).MedeniDurumId;
                ogretmenkisisel.Mail            = txtmail.Text;
                ogretmenkisisel.EvTel           = txtEvTel.Text;
                ogretmenkisisel.CepTel          = txtCepTel.Text;
                ogretmenkisisel.Unvan           = txtUnvan.Text;
                ogretmenkisisel.KullaniciTipiId = ((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId;
                ogretmenkisisel.OgretmenId      = OgretmenTablo.OgretmenIdBul();
                ogretmenkisisel.KullaniciAdi    = ogretmenkisisel.TC;
                ogretmenkisisel.Sifre           = ogretmenkisisel.TC;
                Kisisel.KisiselOgretmenEkle(ogretmenkisisel);

                GecmisEgitim gecmis = new GecmisEgitim();
                gecmis.MezuniyetYil      = ((Int32)cmbMezuniyetYil.SelectedItem);
                gecmis.MezuniyetDerecesi = Convert.ToDouble(txtMezuniyetDerecesi.Text);
                gecmis.MezunOkul         = txtGecmisOkul.Text;
                gecmis.OgretmenId        = OgretmenTablo.OgretmenIdBul();
                GecmisEgitim.GecmisOgretmenEkle(gecmis);

                MessageBox.Show("Öğretmen Kaydedildi");
            }
            if (((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId == 3)
            {
                VeliTablo velitablo = new VeliTablo();
                velitablo.OgrenciNo = txtOgrenciNo.Text;
                velitablo.OgrenciId = VeliTablo.VeliOgrenciIdBul(velitablo);
                VeliTablo.VeliTabloEkle(velitablo);

                Kisisel velikisisel = new Kisisel();
                velikisisel.TC              = txtTc.Text;
                velikisisel.Ad              = txtAd.Text;
                velikisisel.Soyad           = txtSoyad.Text;
                velikisisel.DogumTarih      = datetimeDogumTarih.Value;
                velikisisel.CinsiyetId      = ((Cinsiyet)cmbCinsiyet.SelectedItem).CinsiyetId;
                velikisisel.MedeniDurumId   = ((MedeniDurum)cmbMedeniDurum.SelectedItem).MedeniDurumId;
                velikisisel.Mail            = txtmail.Text;
                velikisisel.EvTel           = txtEvTel.Text;
                velikisisel.CepTel          = txtCepTel.Text;
                velikisisel.Unvan           = txtUnvan.Text;
                velikisisel.KullaniciTipiId = ((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId;
                velikisisel.VeliId          = VeliTablo.VeliIdBul();
                velikisisel.KullaniciAdi    = velikisisel.TC;
                velikisisel.Sifre           = velikisisel.TC;
                Kisisel.KisiselVeliEkle(velikisisel);

                MessageBox.Show("Veli Kaydedildi");
            }
            if (((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId == 4)
            {
                MemurTablo memurtablo = new MemurTablo();
                memurtablo.IseBaslama       = datetimeIseBaslama.Value;
                memurtablo.GecmisDeneyimler = txtGecmisDeneyimler.Text;
                MemurTablo.MemurTabloEkle(memurtablo);

                Kisisel memurkisisel = new Kisisel();
                memurkisisel.TC              = txtTc.Text;
                memurkisisel.Ad              = txtAd.Text;
                memurkisisel.Soyad           = txtSoyad.Text;
                memurkisisel.DogumTarih      = datetimeDogumTarih.Value;
                memurkisisel.CinsiyetId      = ((Cinsiyet)cmbCinsiyet.SelectedItem).CinsiyetId;
                memurkisisel.MedeniDurumId   = ((MedeniDurum)cmbMedeniDurum.SelectedItem).MedeniDurumId;
                memurkisisel.Mail            = txtmail.Text;
                memurkisisel.EvTel           = txtEvTel.Text;
                memurkisisel.CepTel          = txtCepTel.Text;
                memurkisisel.Unvan           = txtUnvan.Text;
                memurkisisel.KullaniciTipiId = ((KullaniciTipi)cmbKayıtTipi.SelectedItem).KullaniciTipiId;
                memurkisisel.MemurId         = MemurTablo.MemurIdBul();
                memurkisisel.KullaniciAdi    = memurkisisel.TC;
                memurkisisel.Sifre           = memurkisisel.TC;
                Kisisel.KisiselMemurEkle(memurkisisel);

                GecmisEgitim gecmis = new GecmisEgitim();
                gecmis.MezuniyetYil      = ((Int32)cmbMezuniyetYil.SelectedItem);
                gecmis.MezuniyetDerecesi = Convert.ToDouble(txtMezuniyetDerecesi.Text);
                gecmis.MezunOkul         = txtGecmisOkul.Text;
                gecmis.MemurId           = MemurTablo.MemurIdBul();
                GecmisEgitim.GecmisMemurEkle(gecmis);

                MessageBox.Show("MemurKaydedildi");
            }
            Temizle();
        }