Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (OnlineSinavEntities db = new OnlineSinavEntities())
                {
                    if (Request.QueryString != null && !string.IsNullOrEmpty(Request.QueryString["ID"].ToString()))
                    {
                        Dersler ders = new Dersler();
                        ders.DersId = Convert.ToInt32(Request.QueryString["ID"].ToString());
                        var mevcut = db.Derslers.Find(ders.DersId);
                        txtDersAdi.Text = mevcut.DersAdi;
                        if (mevcut.DersDurumu == true)
                        {
                            rbAktif.Checked = true;
                        }

                        else
                        {
                            rbPasif.Checked = true;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void bnt_Save_Click(object sender, EventArgs e)
        {
            using (OnlineSinavEntities db = new OnlineSinavEntities())
            {
                Dersler ders = new Dersler();
                ders.DersAdi = txtDersAdi.Text;

                db.Derslers.Add(ders);
                db.SaveChanges();

                Response.Write("<script>alert('Ders Kaydı Başarıyla Yapılmıştır.')</script>");
                txtDersAdi.Text = string.Empty;
            }
        }
Exemplo n.º 3
0
        protected void bnt_Save_Click(object sender, EventArgs e)
        {
            using (OnlineSinavEntities db = new OnlineSinavEntities())
            {
                int          sayac = 0;
                Kullanicilar kul   = new Kullanicilar();
                int          id    = Convert.ToInt32(ddlOgrenci.SelectedValue);

                for (int i = 0; i < cblDersler.Items.Count; i++)
                {
                    if (!cblDersler.Items[i].Selected)
                    {
                        sayac++;
                    }
                }

                if (ddlOgrenci.SelectedItem.Value == "0")
                {
                    Response.Write("<script>alert('Öğrenci Seçiniz')</script>");
                }

                else if (sayac == cblDersler.Items.Count)
                {
                    Response.Write("<script>alert('Ders veya Dersler Seçiniz')</script>");
                }

                else
                {
                    kul = db.Kullanicilars.Where(i => i.KullaniciId == id).First();

                    Dersler ders = new Dersler();
                    //int id2 = Convert.ToInt32(cblDersler.SelectedValue);
                    int seciliDers = cblDersler.Items.Count;
                    for (int i = 0; i < seciliDers; i++)
                    {
                        if (cblDersler.Items[i].Selected == true)
                        {
                            int id2 = Convert.ToInt32(cblDersler.Items[i].Value);
                            ders = db.Derslers.Where(m => m.DersId == id2).FirstOrDefault();
                            kul.Derslers.Add(ders);
                        }
                    }
                    db.SaveChanges();
                    DdlOgrenciDoldur(db);
                }
            }
        }
Exemplo n.º 4
0
        protected void rp_DersListe_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            using (OnlineSinavEntities db = new OnlineSinavEntities())
            {
                int Id = Convert.ToInt32(e.CommandArgument);
                if (e.CommandName == "Edit")
                {
                    Response.Redirect("AdminDersGuncelle.aspx?ID=" + Id);
                }

                else if (e.CommandName == "Delete")
                {
                    Dersler ders = db.Derslers.Where(d => d.DersId == Id).FirstOrDefault();
                    ders.DersDurumu = false;
                    db.SaveChanges();
                    Rp_DersleriDoldur();
                }
            }
        }
Exemplo n.º 5
0
        protected void bnt_Save_Click(object sender, EventArgs e)
        {
            using (OnlineSinavEntities db = new OnlineSinavEntities())
            {
                Dersler ders = new Dersler();
                ders.DersId = Convert.ToInt32(Request.QueryString["ID"].ToString());
                var mevcut = db.Derslers.Find(ders.DersId);
                mevcut.DersAdi = txtDersAdi.Text;
                if (rbPasif.Checked)
                {
                    mevcut.DersDurumu = false;
                }
                else if (rbAktif.Checked)
                {
                    mevcut.DersDurumu = true;
                }
                db.SaveChanges();
                Response.Redirect("AdminDersListesi.aspx");

            }
        }
Exemplo n.º 6
0
        private void Rp_DersleriDoldur()
        {
            using (OnlineSinavEntities db = new OnlineSinavEntities())
            {
                Dersler ders = new Dersler();
                //if (Request.QueryString[ders.DersId] != null && !string.IsNullOrEmpty(Request.QueryString[ders.DersId].ToString())) ;
                //{
                //    ders = (from d in db.Derslers where d.DersId == ders.DersId select d).SingleOrDefault();
                //    db.Derslers.Remove(ders);
                //    db.SaveChanges();
                //}

                rp_DersListe.DataSource = (from d in db.Derslers
                                           select new
                {
                    d.DersId,
                    d.DersAdi,
                    d.DersDurumu
                }).ToList();
                rp_DersListe.DataBind();
            }
        }