protected void Page_Load(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "uy3", "AjaxFileUpload_change_text();", true); if (Session["StudentID"] != null) { Response.Redirect("Shares"); } if (Session["UserId"] != null || Session["SuperUserId"] != null) { if (Session["SuperUserId"] != null) { id = Convert.ToInt32(Session["SuperUserId"]); } else { id = Convert.ToInt32(Session["UserId"]); } Trainer gelen = kislem.TekGetir(id); if (DropDownListKonu.SelectedIndex >= 1 && (DropDownSinif.SelectedIndex >= 1 || DropDownTumSinif.SelectedIndex >= 1)) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "fyt4", "PanelUploadShow();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "fyt1", "Panel0Show();", true); } if (gelen != null) { if (!IsPostBack) { DropDownListKonu.DataSource = konu.HepsiniGetir().Where(p => p.SectionID == gelen.SectionID); DropDownListKonu.DataValueField = "Id"; DropDownListKonu.DataTextField = "Name"; DropDownListKonu.DataBind(); DropDownListKonu.Items.Insert(0, new ListItem("Konu Seçiniz..", "0")); DropDownSinif.DataSource = sinifislem.HepsiniGetir().Where(p => p.IsActive == true && p.TrainerID == gelen.Id); DropDownSinif.DataValueField = "Id"; DropDownSinif.DataTextField = "Name"; DropDownSinif.DataBind(); DropDownSinif.Items.Insert(0, new ListItem("Sınıf Seçiniz..", "0")); } } else if (Session["StudentID"] != null) { Response.Redirect("LogIn"); } else { Response.Redirect("LogIn"); ScriptManager.RegisterStartupScript(Page, this.GetType(), "js", "Bilgilendirme('Eğitmene ait sınıf yoktur.','success');", true); } } }
protected void GridviewSiniflar_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Classroom k = (Classroom)e.Row.DataItem; if (k.IsActive == true) { (e.Row.FindControl("LinkbuttonAktif") as LinkButton).ToolTip = "Pasif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).Text = "Pasif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).CssClass = "btn btn-danger btn-mini"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Kullanıcı Pasif Edilecek');"; } else { (e.Row.FindControl("LinkbuttonAktif") as LinkButton).ToolTip = "Aktif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).Text = "Aktif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).CssClass = "btn btn-success btn-mini"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Kullanıcı Aktif Edilecek');"; } int id; Label lblgelenid = (Label)e.Row.FindControl("lblID"); Label lblsecid = (Label)e.Row.FindControl("Label1"); Label lbltrgelenid = (Label)e.Row.FindControl("lbltr"); DropDownList ddl1 = (DropDownList)e.Row.FindControl("dropdownBolum"); DropDownList ddl2 = (DropDownList)e.Row.FindControl("dropdownEgitmen"); Label lbldurum = (Label)e.Row.FindControl("lbldurum"); SectionsRepository bolum = new SectionsRepository(); TrainerRepository egitmen = new TrainerRepository(); int sectionid = Convert.ToInt32(lblsecid.Text); Section sec = new Section(); sec = bolum.TekGetir(sectionid); ddl1.DataSource = bolum.HepsiniGetir(); ddl1.DataTextField = "Name"; ddl1.DataValueField = "Id"; ddl1.SelectedValue = sec.Id.ToString(); ddl1.DataBind(); int traineridd = Convert.ToInt32(lbltrgelenid.Text); Trainer tid = new Trainer(); tid = egitmen.TekGetir(traineridd); ddl2.SelectedValue = tid.Id.ToString(); ddl2.DataSource = egitmen.HepsiniGetir(); ddl2.DataTextField = "FullName"; ddl2.DataValueField = "Id"; ddl2.DataBind(); } }
protected void dtVeri_ItemDataBound(object sender, RepeaterItemEventArgs e) { int ID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "TrainerID").ToString()); int ID2 = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "Subject").ToString()); string url = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FileUrl").ToString()); SubjectRepository konuislem = new SubjectRepository(); Subject konu = konuislem.TekGetir(ID2); Label lblB = (Label)e.Item.FindControl("lblSubject"); lblB.Text = konu.Name; TrainerRepository gelentrainer = new TrainerRepository(); Trainer gelen = new Trainer(); gelen = gelentrainer.TekGetir(ID); Label lblA = (Label)e.Item.FindControl("lblTrainer"); lblA.Text = gelen.FullName; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserId"] != null || Session["SuperUserId"] != null) { int gelenid; if (Session["SuperUserId"] != null) { gelenid = Convert.ToInt32(Session["SuperUserId"]); } else { gelenid = Convert.ToInt32(Session["UserId"]); } users = kullanici.TekGetir(gelenid); if (users.IsSuperAdmin == true) { DropDownListBolum.DataSource = bolumislem.Getir().Where(p => p.IsActive == true); DropDownListBolum.DataValueField = "Id"; DropDownListBolum.DataTextField = "Name"; DropDownListBolum.DataBind(); DropDownListBolum.Items.Insert(0, new ListItem("Bölüm Seçiniz..", "0")); } else { DropDownListBolum.DataSource = bolumislem.Getir().Where(p => p.IsActive == true && p.Id == users.SectionID); DropDownListBolum.DataValueField = "Id"; DropDownListBolum.DataTextField = "Name"; DropDownListBolum.DataBind(); DropDownListBolum.Items.Insert(0, new ListItem("Bölüm Seçiniz..", "0")); } } } }
protected void GridviewSiniflar_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "aktif") { int userID = Convert.ToInt32(e.CommandArgument); Trainer c = islem.TekGetir(userID); if (c.IsActive == true) { if (islem.DurumGuncelle(userID, false)) { Doldur(); } } else { if (islem.DurumGuncelle(userID, true)) { Doldur(); } } } GridViewRow secilenSatir; int id; switch (e.CommandName) { case "duzenle": secilenSatir = (e.CommandSource as LinkButton).Parent.Parent as GridViewRow; id = Convert.ToInt32(e.CommandArgument); GridviewSiniflar.EditIndex = secilenSatir.RowIndex; Doldur(); break; case "guncelle": secilenSatir = (e.CommandSource as LinkButton).Parent.Parent as GridViewRow; id = Convert.ToInt32(e.CommandArgument); System.Web.UI.WebControls.DropDownList ddl1 = (System.Web.UI.WebControls.DropDownList)(secilenSatir.FindControl("dropdownBolum")); System.Web.UI.WebControls.TextBox txt4 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAd")); System.Web.UI.WebControls.TextBox txt5 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAcilis")); System.Web.UI.WebControls.TextBox txt6 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtSoyad")); System.Web.UI.WebControls.TextBox txt7 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtusername")); System.Web.UI.WebControls.TextBox txt8 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtmail")); Trainer trainer = islem.TekGetir(id); trainer.EMail = txt8.Text; trainer.FirstName = txt4.Text; trainer.LastName = txt6.Text; trainer.Username = txt7.Text; trainer.FullName = txt4.Text + "" + txt6.Text; trainer.SectionID = Convert.ToInt32(ddl1.SelectedValue); if (islem.Guncelle(trainer)) { GridviewSiniflar.EditIndex = -1; Doldur(); } break; case "iptal": GridviewSiniflar.EditIndex = -1; Doldur(); break; default: break; } }