Пример #1
0
        public List <Ogrenci> OgrenciListesi()
        {
            List <Ogrenci> listOgrenciler = new List <Ogrenci>();
            SqlCommand     comm           = new SqlCommand("Select * from Ogrenciler", conn);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr;

            try
            {
                dr = comm.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Ogrenci o = new Ogrenci();
                        o.Id           = Convert.ToInt32(dr[0]);
                        o.Adi          = dr[1].ToString();
                        o.Soyadi       = dr[2].ToString();
                        o.Telefon      = dr[3].ToString();
                        o.Adres        = dr[4].ToString();
                        o.TCKNo        = dr[5].ToString();
                        o.TaksitSayisi = Convert.ToByte(dr[6]);
                        o.TaksitTutari = Convert.ToDouble(dr[7]);
                        o.SinifId      = Convert.ToInt32(dr[8]);
                        listOgrenciler.Add(o);
                    }
                }
                dr.Close();
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(listOgrenciler);
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "OgrenciID,OgrenciAdi,OgrenciSoyadi,OgrenciNumarasi,KayitTarihi,MezuniyetTarihi,FakulteBolumlerID,OgrencininFakulteBolumu,OgrenimSekliID,EgitimDuzeyiID")] Ogrenci ogrenci, FormCollection frm, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                string ad = "";
                if (file != null)
                {
                    if (file.ContentLength > 0)
                    {
                        if (Path.GetExtension(file.FileName).ToLower() == ".jpg" || Path.GetExtension(file.FileName).ToLower() == ".png" || Path.GetExtension(file.FileName).ToLower() == ".gif" || Path.GetExtension(file.FileName).ToLower() == ".jpeg")
                        {
                            ad = Guid.NewGuid() + Path.GetExtension(file.FileName);
                            var path = Path.Combine(Server.MapPath("~/images"), ad);
                            file.SaveAs(path);
                        }
                    }
                }


                ogrenci.KayitTarihi       = DateTime.Parse(frm["kayitTarihi"]);
                ogrenci.FakulteBolumlerID = int.Parse(frm["bolumId"]);
                int             sayi            = ogrenciConcrete._ogrenciRepository.GetEntity().Where(x => x.FakulteBolumlerID == ogrenci.FakulteBolumlerID).Count() + 1;
                FakulteBolumler fakulteBolumler = fakulteBolumlerConcrete._fakulteBolumlerRepository.GetById(int.Parse(frm["bolumId"]));
                ogrenci.OgrenciNumarasi = ogrenci.KayitTarihi.Year.ToString() + ogrenci.EgitimDuzeyiID + ogrenci.OgrenimSekliID + fakulteBolumler.FakulteID + fakulteBolumler.BolumID + sayi;
                OgrenciBilgileri ogrenciBilgileri = new OgrenciBilgileri()
                {
                    Adres     = frm["adres"],
                    Fotograf  = ad,
                    OgrenciID = ogrenci.OgrenciID,
                    TCNo      = frm["tc"],
                    Telefon   = frm["telefon"],
                    MezunMu   = false
                };
                KullaniciIslemleri.OgrenciEkle(ogrenci, ogrenciBilgileri);

                return(RedirectToAction("Index"));
            }

            return(View(ogrenci));
        }
Пример #3
0
    protected void btnGirisYap_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable kullaniciTable = new DataTable();
            string    query          = "SELECT * FROM Ogrenci WHERE Mail = '" + loguser.Text + "' AND Password= '******'";

            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();

            // create data adapter
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            // this will query your database and return the result to your datatable
            da.Fill(kullaniciTable);
            con.Close();
            da.Dispose();
            if (kullaniciTable != null && kullaniciTable.Rows.Count > 0)
            {
                Ogrenci akitfKullanici = new Ogrenci();
                akitfKullanici.Id       = Convert.ToInt32(kullaniciTable.Rows[0]["Id"].ToString());
                akitfKullanici.SinifID  = (kullaniciTable.Rows[0]["SinifID"] != null && kullaniciTable.Rows[0]["SinifID"] != System.DBNull.Value) ? Convert.ToInt32(kullaniciTable.Rows[0]["SinifID"].ToString()) : 0;
                akitfKullanici.Adi      = kullaniciTable.Rows[0]["Adi"].ToString();
                akitfKullanici.Mail     = kullaniciTable.Rows[0]["Mail"].ToString();
                akitfKullanici.Password = kullaniciTable.Rows[0]["Password"].ToString();
                akitfKullanici.Adress   = kullaniciTable.Rows[0]["Adres"].ToString();
                akitfKullanici.KTarihi  = Convert.ToDateTime(kullaniciTable.Rows[0]["KTarihi"].ToString());
                akitfKullanici.Statu    = Convert.ToBoolean(kullaniciTable.Rows[0]["Statu"].ToString());

                Session["AktifKullanici"] = akitfKullanici;
                Response.Redirect("PersonalInfo.aspx", false);
            }
            else
            {
                Response.Write("hata");
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #4
0
        public NIslemSonuc Guncelle(Ogrenci kayit)
        {
            try
            {
                var duzenlenecekKayitlar = _veritabani.Ogrenciler.Where(o => o.Id == kayit.Id);
                if (duzenlenecekKayitlar.Count() > 0)
                {
                    var duzenlenecekKayit = duzenlenecekKayitlar.FirstOrDefault();
                    duzenlenecekKayit.Ad         = kayit.Ad;
                    duzenlenecekKayit.Soyad      = kayit.Soyad;
                    duzenlenecekKayit.KimlikNo   = kayit.KimlikNo;
                    duzenlenecekKayit.BolumId    = kayit.BolumId;
                    duzenlenecekKayit.DogumTarih = kayit.DogumTarih;
                    duzenlenecekKayit.GirisTarih = kayit.GirisTarih;
                    duzenlenecekKayit.CikisTarih = kayit.CikisTarih;
                    duzenlenecekKayit.EPosta     = kayit.EPosta;

                    _veritabani.SaveChanges();
                    return(new NIslemSonuc {
                        BasariliMi = true
                    });
                }
                else
                {
                    return(new NIslemSonuc
                    {
                        BasariliMi = false,
                        Mesaj = "Kayıt bulunamadı"
                    });
                }
            }
            catch (Exception hata)
            {
                return(new NIslemSonuc
                {
                    BasariliMi = false,
                    Mesaj = hata.Message
                });
            }
        }
Пример #5
0
        private void btnReference_Click(object sender, EventArgs e)
        {
            Ogrenci ogr1 = new Ogrenci();

            ogr1.FirstName = "Murat";
            ogr1.LastName  = "Vuranok";


            Ogrenci ogr2 = ogr1;

            ogr2.FirstName = "Ahmet";

            MessageBox.Show($"Birinci Öğrencinin Adı : {ogr1.FirstName}\nİkinci Öğrencinin Adı : {ogr2.FirstName}");
            MessageBox.Show($"Birinci Öğrenci : {ogr1.GetHashCode()}\nİkinci Öğrenci : {ogr2.GetHashCode()}");


            int[] sayilar = { 1, 2, 3, 4, 5, 6 };
            int[] numbers = sayilar; // 1,2,3,4,5,6
            numbers[1] = 22;         // 1,22,3,4,5,6

            MessageBox.Show(sayilar[1].ToString());
        }
Пример #6
0
        public static bool OgretmenGiris(Ogretmen ogretmen)
        {
            SqlCommand komut = new SqlCommand("OgretmenGiris", Baglanma.Baglanti);

            Baglanma.Baglanti.Open();
            komut.CommandType = CommandType.StoredProcedure;
            komut.Parameters.AddWithValue("@TCKN", ogretmen.OgrTCKN);
            komut.Parameters.AddWithValue("@Sifre", ogretmen.OgrSifre);
            SqlDataReader dr  = komut.ExecuteReader();
            Ogrenci       ogr = new Ogrenci();

            if (dr.Read())
            {
                Baglanma.Baglanti.Close();
                return(true);
            }
            else
            {
                Baglanma.Baglanti.Close();
                return(false);
            }
        }
Пример #7
0
 public ActionResult Kaydet(Ogrenci ogrenci)
 {
     if (ogrenci.Id == 0)
     {
         db.Ogrenci.Add(ogrenci);
     }
     else
     {
         var ogrenciGuncelle = db.Ogrenci.Find(ogrenci.Id);
         if (ogrenciGuncelle == null)
         {
             return(HttpNotFound());
         }
         ogrenciGuncelle.Ad         = ogrenci.Ad;
         ogrenciGuncelle.Soyad      = ogrenci.Soyad;
         ogrenciGuncelle.Yas        = ogrenci.Yas;
         ogrenciGuncelle.Cinsiyet   = ogrenci.Cinsiyet;
         ogrenciGuncelle.ogretmenId = ogrenci.ogretmenId;
     }
     db.SaveChanges();
     return(RedirectToAction("Liste", "Ogrenci"));
 }
Пример #8
0
        // GET: OgrenciDers/Edit/5
        public ActionResult Edit(int?ogrenciId, int?dersId)
        {
            if (ogrenciId == null && dersId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OgrenciDers ogrenciDers = db.OgrenciDers.Find(ogrenciId, dersId);

            if (ogrenciDers == null)
            {
                Ogrenci ogrenci = db.Ogrenci.Find(ogrenciId);
                Ders    ders    = db.Ders.Find(dersId);
                string  isim    = ogrenci.Ad + " " + ogrenci.Soyad;
                string  str     = isim + " isimli ogrencinin " + ders.Ad + " dersi icin onceden girilmis bir notu bulunmamaktadir.";
                TempData["Message"] = str;
                //ogrenciDers = new OgrenciDers { OgrenciId = ogrenciId.Value, DersId = dersId.Value };
                return(RedirectToAction("Index"));
            }
            ViewBag.DersId    = new SelectList(db.Ders, "Id", "Ad", ogrenciDers.DersId);
            ViewBag.OgrenciId = new SelectList(db.Ogrenci, "Id", "Ad", ogrenciDers.OgrenciId);
            return(View(ogrenciDers));
        }
Пример #9
0
 public bool Delete(Ogrenci entity)
 {
     try
     {
         using (IStudentDal _studentDal = new StudentRepository())
         {
             var deger = _studentDal.Delete(entity);
             if (deger == false)
             {
                 throw new Exception("Öğrenci silinemedi");
             }
             else
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Öğrenci silinemedi" + ex.Message);
     }
 }
Пример #10
0
        private static Ogrenci BolumDoldur()
        {
            using (MyDB dataBase = new MyDB())
            {
                Ogrenci model = new Ogrenci();
                model.DersList = (from ders in dataBase.Dersler.ToList()
                                  select new SelectListItem
                {
                    Selected = false,
                    Text = ders.DersAdi,
                    Value = ders.Id.ToString()
                }).ToList();
                model.DersList.Insert(0, new SelectListItem
                {
                    Selected = true,
                    Value    = "",
                    Text     = "seçiniz"
                });

                return(model);
            }
        }
Пример #11
0
        private void tsKaydet_Click(object sender, EventArgs e)
        {
            if (txtAdi.Text.Trim() != "" && txtSoyadi.Text.Trim() != "" && txtTCKNo.Text.Trim() != "")
            {
                if (os.OgrenciKontrolByTCKNo(txtTCKNo.Text))
                {
                    MessageBox.Show("var bu");
                    txtAdi.Focus();
                }
                else
                {
                    Ogrenci o = new Ogrenci();

                    o.Adi          = txtAdi.Text;
                    o.Soyadi       = txtSoyadi.Text;
                    o.Telefon      = txtTelefon.Text;
                    o.Adres        = txtAdres.Text;
                    o.TCKNo        = txtTCKNo.Text;
                    o.TaksitSayisi = Convert.ToByte(txtTaksitSayisi.Text);
                    o.TaksitTutari = Convert.ToDouble(txtTaksitTutari.Text);
                    o.SinifId      = SinifID;
                    if (os.OgrenciEkle(o))
                    {
                        MessageBox.Show("ok");
                        dataGridView1.DataSource = os.OgrenciListesi();
                        dgvOgrenciler.DataSource = os.OgrenciListesi();
                    }
                    else
                    {
                        MessageBox.Show("Ürün bilgileri eklenemedi.", "Kayıt Gerçekleşmedi.");
                    }
                }
            }
            else
            {
                MessageBox.Show("eksik");
                txtAdi.Focus();
            }
        }
Пример #12
0
        protected override void GuncelNesneOlustur()
        {
            currentEntity = new Ogrenci
            {
                Id                  = Id,
                Kod                 = txtKod.Text,
                TcKimlikNo          = txtTcKimlikNo.Text,
                Adi                 = txtAdi.Text,
                Soyadi              = txtSoyadi.Text,
                Cinsiyet            = txtCinsiyet.Text.GetEnum <Cinsiyet>(),
                Telefon             = txtTelefon.Text,
                KanGrubu            = txtKanGrubu.Text.GetEnum <KanGrubu>(),
                BabaAdi             = txtBabaAdi.Text,
                AnaAdi              = txtAnaAdi.Text,
                DogumYeri           = txtDogumYeri.Text,
                DogumTarihi         = (DateTime?)txtDogumTarihi.EditValue,
                KimlikSeri          = txtKimlikSeri.Text,
                KimlikSiraNo        = txtKimlikSiraNo.Text,
                KimlikIlId          = txtKimlikIl.Id,
                KimlikIlceId        = txtKimlikIlce.Id,
                KimlikMahalleKoy    = txtKimlikMahalleKoy.Text,
                KimlikCiltNo        = txtKimlikCiltNo.Text,
                KimlikAileSiraNo    = txtKimlikAileSiraNo.Text,
                KimlikBireySiraNo   = txtKimlikBireySiraNo.Text,
                KimlikVerildigiYer  = txtKimlikVerildigiYer.Text,
                KimlikVerilisNedeni = txtKimlikVerilisNedeni.Text,
                KimlikKayitNo       = txtKimlikKayitNo.Text,
                KimlikVerilisTarihi = (DateTime?)txtKimlikVerilisTarihi.EditValue,
                Resim               = (byte[])imgResim.EditValue,
                OzelKod1Id          = txtOzelKod1.Id,
                OzelKod2Id          = txtOzelKod2.Id,
                OzelKod3Id          = txtOzelKod3.Id,
                OzelKod4Id          = txtOzelKod4.Id,
                OzelKod5Id          = txtOzelKod5.Id,
                Durum               = tglDurum.IsOn
            };

            ButonEnabledDurumu();
        }
Пример #13
0
 public bool Add(Ogrenci entity)
 {
     try
     {
         using (IStudentDal _studentDal = new StudentRepository())
         {
             var deger = _studentDal.Add(entity);
             if (deger == null)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Öğrenci Eklenemedi" + ex.Message);
     }
 }
Пример #14
0
        public async Task <IActionResult> Index(Ogrenci model)
        {
            if (model.KullaniciAdi == "Admin" && model.Parola == "123")
            {
                var claims = new List <Claim>
                {
                    new Claim(ClaimTypes.Name, model.KullaniciAdi)
                };

                var             userIdentity = new ClaimsIdentity(claims, "Index");
                ClaimsPrincipal principal    = new ClaimsPrincipal(userIdentity);

                await HttpContext.SignInAsync(principal);

                return(RedirectToAction("List", "Ogrenci"));
            }
            else
            {
                ViewBag.Error = "Bilgileri kontrol ediniz";
            }
            return(View(model));
        }
        private void tsKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtAdi.Text) && !string.IsNullOrEmpty(txtSoyadi.Text) && !string.IsNullOrEmpty(txtTaksitTutari.Text))
            {
                if (os.OgrenciKontrolByTCKNo(txtTCKNo.Text))
                {
                    MessageBox.Show("Bu tcye ait öğrenci var");
                    txtTCKNo.Focus();
                }
                else
                {
                    Ogrenci o = new Ogrenci();
                    o.TCKNo        = txtTCKNo.Text;
                    o.Adi          = txtAdi.Text;
                    o.Soyadi       = txtSoyadi.Text;
                    o.SinifId      = sinifid;
                    o.Telefon      = txtTelefon.Text;
                    o.Adres        = txtAdres.Text;
                    o.TaksitSayisi = Convert.ToByte(txtTaksitSayisi.Text);
                    o.TaksitTutari = Convert.ToDouble(txtTaksitTutari.Text);

                    if (os.OgrenciEkle(o))
                    {
                        Listele(os.OgrenciListesi(), dgvOgrenciler);
                        MessageBox.Show("Ogrenci başarıyla eklendi");
                        Genel.Temizle(tpOgrenciKayit);
                        tsKaydet.Enabled = false;
                    }
                }
                tsKaydet.Enabled = false;
            }
            else
            {
                MessageBox.Show("Eksik bilgi girişi.", "Dikkat eksik bilgi!!");
            }

            txtAdi.Focus();
        }
Пример #16
0
    protected override void OnInit(EventArgs e)
    {
        TezDBEntities db      = new TezDBEntities();
        var           Ogrenci = db.Ogrenci.ToList();

        if (Session["Id"] != null)
        {
            if ((int)Session["derece"] == 1) //1 veritabanında Hoca demek
            {
                Response.Redirect(@"~/Forms/Hoca/index.aspx");
            }
            if ((int)Session["derece"] == 0)
            {
                Response.Redirect(@"~/Forms/Admin/index.aspx");
            }
        }
        else
        {
            if (Request.Cookies["MyCookie"] != null)
            {
                string  No      = Request.Cookies["MyCookie"]["No"];
                string  sifre   = Request.Cookies["MyCookie"]["sifre"];
                Ogrenci ogrenci = db.Ogrenci.Where(u => u.No == No && u.Sifre == sifre).FirstOrDefault();
                if (ogrenci != null)
                {
                    AppKontrol.id     = ogrenci.Id;
                    AppKontrol.name   = ogrenci.Ad;
                    AppKontrol.derece = Convert.ToInt32(ogrenci.Derece);
                    Response.Redirect(@"~/Default.aspx");
                }
            }
            else
            {
                Response.Redirect(@"~/Default.aspx");
            }
        }
        base.OnInit(e);
    }
Пример #17
0
 private void OK_Click(object sender, EventArgs e)
 {
     try
     {
         if (!String.IsNullOrEmpty(EditedNumber.Text) && !String.IsNullOrEmpty(EditedStudentName.Text) && !String.IsNullOrEmpty(EditedStudentSurname.Text))
         {
             Ogrenci ogrenci = new Ogrenci
             {
                 Id     = ogrenciDTO.Id,
                 Ad     = EditedStudentName.Text,
                 Soyad  = EditedStudentSurname.Text,
                 Numara = EditedNumber.Text
             };
             if (Men.Checked == true)
             {
                 ogrenci.Cinsiyet = true;
             }
             else
             {
                 ogrenci.Cinsiyet = false;
             }
             bool Result = OgrenciDAO.AddUpdateDeleteStudent(ogrenci, 1);
             if (Result == true)
             {
                 MessageBox.Show("İşlem Başarı ile tamamlandı !", "Tamamlandı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Bir Hata oluştu", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
Пример #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //son test yapıldı
        //BURADA ÖĞRENCİ KAYIT EKRANINDA GİRİLEN BİLGİLER ALNIYOR
        string ad    = Request.QueryString["adtxt"];
        string soyad = Request.QueryString["soyadtxt"];
        string email = Request.QueryString["emailtxt"];
        string tc    = Request.QueryString["tctxt"];
        string sfr   = Request.QueryString["sfr"];
        string bolum = Request.QueryString["bolum"];
        string sinif = Request.QueryString["sinif"];



        DbCrud      dbcrud      = new DbCrud();
        Ogrenci     ogrenci     = new Ogrenci();
        OgrenciCrud ogrencicrud = new OgrenciCrud();

        //BURADA ÖĞRENCİ BİLGİLERİ Ogrenci SINIFINDAN TÜRETİLEN ogrenci NESNESİNE AKTARILIYOR
        ogrenci.ad    = ad;
        ogrenci.soyad = soyad;
        ogrenci.email = email;
        ogrenci.tc    = tc;
        ogrenci.sfr   = sfr;
        ogrenci.bolum = bolum;
        ogrenci.sinif = sinif;

        //OgrenciCRUD SINIFI İÇERİSİNDE TANIMLANAN OgrenciKayit METODUYLA BİLGİLER VERİTABANINA KAYDEDİLİYOR.
        if (ogrencicrud.OgrenciKayit(ogrenci) == 1)
        {
            sonuc.InnerHtml = "Uzaktan Eğitim Sistemine Kaydınız Yapılmıştır.</br>Üye Girişi Yapmak İçin Lütfen <a href='uyegiris.aspx'>Tıklayınız</a>";
        }

        else
        {
            sonuc.InnerHtml = "Uzaktan Eğitim Sistemine Kaydınız Yapılamıştır!!!";
        }
    }
Пример #19
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            //Modeli (Ogrenci) doldurup,
            //DataAccessin Add metoduna arguman olarak gondermeniz
            //gerek.

            Ogrenci ogr = new Ogrenci();

            ogr.Sira          = int.Parse(txtSira.Text);
            ogr.OgrenciAdi    = txtAd.Text;
            ogr.OgrenciSoyadi = txtSoyad.Text;

            int sonuc = data.Add(ogr);

            if (sonuc != -1)
            {
                MessageBox.Show("Eklendi!");
            }
            else
            {
                MessageBox.Show("Eklenemedi!");
            }
        }
        public string OgrenciSil(int ID)
        {
            var            mesaj  = "";
            OgrenciService client = new OgrenciService();
            Ogrenci        ogr    = client.OgrencileriGetir().Where(x => x.ID == ID).SingleOrDefault();

            if (ogr != null)
            {
                if (new TezOgrenciService().TezOgrencileriGetir().Where(x => x.OgrenciID == ogr.ID).FirstOrDefault() == null)
                {
                    client.OgrenciSil(ogr);
                    new KullaniciService().KullaniciSil(new Kullanici {
                        ID = ogr.ID
                    });
                    mesaj = JsonConvert.SerializeObject(new { durum = "OK", mesaj = "Ogrenci Silindi" });
                }
                else
                {
                    mesaj = JsonConvert.SerializeObject(new { durum = "NO", mesaj = "Tez atanmış olan öğrenci silinemez" });
                }
            }
            return(mesaj);
        }
Пример #21
0
        public ActionResult OgrenciKaydet(Ogrenci model)
        {
            using (MyDB dataBase = new MyDB())
            {
                Ogrenci ogrenci = new Ogrenci();
                ogrenci.OgrenciNumarasi = model.OgrenciNumarasi;
                ogrenci.Ad    = model.Ad;
                ogrenci.Soyad = model.Soyad;

                model.DersList = BolumDoldur().DersList;
                var SecilenDers = model.DersList.Find(s => s.Value == model.DersId.ToString());
                ogrenci.DersinAdi = SecilenDers.Text;

                ogrenci.DersId   = model.DersId;
                ogrenci.Vize     = model.Vize;
                ogrenci.Final    = model.Final;
                ortalama         = (ogrenci.Vize * 0.3) + (ogrenci.Final * 0.7);
                ogrenci.Ortalama = ortalama;
                dataBase.Ogrenciler.Add(ogrenci);
                dataBase.SaveChanges();
                return(RedirectToAction("Index", model));
            }
        }
Пример #22
0
        public ActionResult Edit([Bind(Include = "OgrenciID,OgrenciAdi,OgrenciSoyadi,OgrenciNumarasi,KayitTarihi,MezuniyetTarihi,FakulteBolumlerID,OgrenimSekliID,EgitimDuzeyiID")] Ogrenci ogrenci, FormCollection frm)
        {
            if (ModelState.IsValid)
            {
                var ogrenciBilgileri = ogrenciBilgileriConcrete._ogrenciBilgileriRepository.GetEntity().FirstOrDefault(x => x.OgrenciID == ogrenci.OgrenciID);
                ogrenciBilgileri.Adres       = frm["OgrenciBilgisi.Adres"];
                ogrenciBilgileri.Fotograf    = frm["OgrenciBilgisi.Fotograf"];
                ogrenciBilgileri.MezunMu     = frm["OgrenciBilgisi.MezunMu"] == "on" ? true : false;
                ogrenciBilgileri.OgrenciMail = frm["OgrenciBilgisi.OgrenciMail"];
                ogrenciBilgileri.TCNo        = frm["OgrenciBilgisi.TCNo"];
                ogrenciBilgileri.Telefon     = frm["OgrenciBilgisi.Telefon"];

                ogrenciConcrete._ogrenciRepository.Update(ogrenci);
                ogrenciConcrete._ogrenciUnitOfWork.SaveChanges();
                ogrenciConcrete._ogrenciUnitOfWork.Dispose();
                ogrenciBilgileriConcrete._ogrenciBilgileriRepository.Update(ogrenciBilgileri);
                ogrenciBilgileriConcrete._ogrenciBilgileriUnitOfWork.SaveChanges();
                ogrenciBilgileriConcrete._ogrenciBilgileriUnitOfWork.Dispose();
                return(RedirectToAction("Index"));
            }

            return(View(ogrenci));
        }
Пример #23
0
        public ActionResult OGiris(Ogrenci k)
        {
            if (!ModelState.IsValid)
            {
                using (InternshipEntities dc = new InternshipEntities())
                {
                    var v = dc.Ogrenci.Where(a => a.ogr_mail.Equals(k.ogr_mail) &&
                                             a.ogr_parola.Equals(k.ogr_parola)).FirstOrDefault();

                    if (v != null)
                    {
                        Session["LogedUserID"]   = v.ogr_tc.ToString();
                        Session["LogedUserName"] = v.ogr_ad.ToString();
                        return(RedirectToAction("../StajBilgis/Index"));
                    }
                    else
                    {
                        return(RedirectToAction("../OgrenciIslem/OGiris"));
                    }
                }
            }
            return(View(k));
        }
Пример #24
0
        private void btnOgrenciKaydet_Click(object sender, EventArgs e)
        {
            Ogrenci ogrenci = new Ogrenci();

            ogrenci.Adi                = txtAd.Text;
            ogrenci.Soyadi             = txtSoyad.Text;
            ogrenci.OgrenciNo          = Guid.NewGuid().ToString().Substring(0, 11);
            ogrenci.KimlikNo           = txtKimlik.Text;
            ogrenci.Cinsiyeti          = rdbErkek.Checked == true ? Cinsiyet.Erkek : Cinsiyet.Kadin;
            ogrenci.DogumTarihi        = dateDogumTarihi.Value;
            ogrenci.OlusuturulmaTarihi = DateTime.Now;
            ogrenci.AktifMi            = true;
            int sayi = _ogrenciService.AddOgrenciService(ogrenci);

            if (sayi > 0)
            {
                MessageBox.Show("Öğrenci başarıyla eklendi");
            }
            else
            {
                MessageBox.Show("Eklenemedi");
            }
        }
Пример #25
0
        public ActionResult OgrenciEkle(Ogrenci ogr)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var okl = ctx.Okullar.Find(ogr.okulId);
                    ogr.okulu = okl;
                    ctx.Ogrenciler.Add(ogr);
                }

                int sonuc = ctx.SaveChanges();
                if (sonuc > 0)
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (DbEntityValidationException ex)
            {
                Response.Write(ex);
            }
            return(View());
        }
Пример #26
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        Label1.Text = "";
        Label3.Text = "";
        Label5.Text = "";
        string id;
        int    tezid, ogid;

        switch (e.CommandName)
        {
        case "Sec":
            id               = e.CommandArgument.ToString();
            tezid            = Convert.ToInt32(id);
            Ogrenci.Tez_ID   = Convert.ToInt32(id);
            Ogrenci.Tez_Onay = false;
            db.SaveChanges();
            Repeater1.DataBind();
            Response.Redirect(@"~/Forms/Ogrenci/TezSec.aspx");

            break;

        case "incele":
            id      = e.CommandArgument.ToString();
            ogid    = Convert.ToInt32(id);
            Ogrenci = db.Ogrenci.Where(w => w.Id == AppKontrol.id).FirstOrDefault();
            var hoca = db.Hoca.Find(Ogrenci.Hoca_ID);
            tez          = db.Tez.Where(oo => oo.Id == ogid).FirstOrDefault();
            Label1.Text += tez.Konu;
            Label3.Text  = hoca.Ad;
            Label5.Text  = Label5.Text + tez.Aciklama;
            var tezalan = db.Ogrenci.Where(oo => oo.Tez_ID == ogid && oo.Tez_Onay == true).ToList();
            Repeater2.DataSource = tezalan;
            Repeater2.DataBind();
            Page.ClientScript.RegisterStartupScript(GetType(), "modelBox", "$('.modal').modal()", true);
            break;
        }
    }
Пример #27
0
 public ActionResult AddStudent(Ogrenci ogrenci)
 {
     try
     {
         Random rastgele = new Random();
         if (ModelState.IsValid) //model doğru gelmişse
         {
             ogrenci.Silindi          = false;
             ogrenci.OgrenciNo        = rastgele.Next(1, 1000);
             ogrenci.OgrenciCezaPuani = 0;
             _studentService.Add(ogrenci);
             return(RedirectToAction("ListStudent"));
         }
         else
         {
             return(View("AddStudent"));
         }
     }
     catch (Exception error)
     {
         ModelState.AddModelError("", error.Message);
         return(View("AddStudent"));
     }
 }
Пример #28
0
        public NIslemSonuc <int> Kaydet(Ogrenci kayit)
        {
            try
            {
                _veritabani.Ogrenciler.Add(kayit);
                _veritabani.SaveChanges();

                var uyelikEkleSonuc = _uyelik.KullaniciEkle(kayit.KimlikNo, "Ogrenci");
                if (uyelikEkleSonuc.BasariliMi)
                {
                    return(new NIslemSonuc <int>
                    {
                        BasariliMi = true,
                        Veri = kayit.Id
                    });
                }
                else
                {
                    return(new NIslemSonuc <int>
                    {
                        BasariliMi = false,
                        Veri = kayit.Id,
                        Mesaj = uyelikEkleSonuc.Mesaj
                    });
                }
                return(null);
            }
            catch (Exception hata)
            {
                return(new NIslemSonuc <int>()
                {
                    BasariliMi = false,
                    Mesaj = hata.Message
                });
            }
        }
 public ActionResult OgrenciGuncelle(Ogrenci ogr, int?OgrenciGuncelleme = 0)
 {
     OgrenciBL.OgrenciGuncelle(ogr);
     return(Redirect("/Home/Index"));
 }
Пример #30
0
 public void GetInfo(Ogrenci ogrenci)
 {
     this.ogrenci = ogrenci;
 }
Пример #31
0
        public NIslemSonuc Guncelle(Ogrenci kayit)
        {
            try
            {
                var duzenlenecekKayitlar = _veritabani.Ogrenciler.Where(o => o.Id == kayit.Id);
                if (duzenlenecekKayitlar.Count() > 0)
                {
                    var duzenlenecekKayit = duzenlenecekKayitlar.FirstOrDefault();
                    duzenlenecekKayit.Ad = kayit.Ad;
                    duzenlenecekKayit.Soyad = kayit.Soyad;
                    duzenlenecekKayit.KimlikNo = kayit.KimlikNo;
                    duzenlenecekKayit.BolumId = kayit.BolumId;
                    duzenlenecekKayit.DogumTarih = kayit.DogumTarih;
                    duzenlenecekKayit.GirisTarih = kayit.GirisTarih;
                    duzenlenecekKayit.CikisTarih = kayit.CikisTarih;
                    duzenlenecekKayit.Eposta = kayit.Eposta;

                    _veritabani.SaveChanges();
                    return new NIslemSonuc { BasariliMi = true };
                }
                else
                {
                    return new NIslemSonuc
                    {
                        BasariliMi = false,
                        Mesaj = "Kayıt bulunamadı"
                    };
                }
            }
            catch (Exception hata)
            {
                return new NIslemSonuc
                {
                    BasariliMi = false,
                    Mesaj = hata.Message
                };
            }
        }
Пример #32
0
        public NIslemSonuc<int> Kaydet(Ogrenci kayit)
        {
            try
            {
                _veritabani.Ogrenciler.Add(kayit);
                _veritabani.SaveChanges();

                var uyelikEkleSonuc = _uyelik.KullaniciEkle(kayit.KimlikNo, "Ogrenci");
                if (uyelikEkleSonuc.BasariliMi)
                {
                    return new NIslemSonuc<int>
                    {
                        BasariliMi = true,
                        Veri = kayit.Id
                    };
                }
                else
                {
                    return new NIslemSonuc<int>
                    {
                        BasariliMi = false,
                        Veri = kayit.Id,
                        Mesaj = uyelikEkleSonuc.Mesaj
                    };
                }
                return null;
            }
            catch (Exception hata)
            {
                return new NIslemSonuc<int>()
                {
                    BasariliMi = false,
                    Mesaj = hata.Message
                };
            }
        }