Ejemplo n.º 1
0
        protected void GridviewSiniflar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "aktif")
            {
                int userID = Convert.ToInt32(e.CommandArgument);



                Classroom 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.DropDownList ddl2 = (System.Web.UI.WebControls.DropDownList)(secilenSatir.FindControl("dropdownEgitmen"));
                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("txtKapanis"));

                Classroom sinif = islem.TekGetir(id);
                sinif.Id          = id;
                sinif.Name        = txt4.Text;
                sinif.ClosedDate  = Convert.ToDateTime(txt6.Text);
                sinif.CreatedDate = Convert.ToDateTime(txt5.Text);
                sinif.TrainerID   = Convert.ToInt32(ddl2.SelectedValue);
                sinif.SectionID   = Convert.ToInt32(ddl1.SelectedValue);

                if (islem.Guncelle(sinif))
                {
                    GridviewSiniflar.EditIndex = -1;
                    Doldur();
                }



                break;

            case "iptal":

                GridviewSiniflar.EditIndex = -1;
                Doldur();

                break;

            default:
                break;
            }
        }