예제 #1
0
        protected void GridviewBolumler_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "aktif")
            {
                int userID = Convert.ToInt32(e.CommandArgument);



                Section 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);
                GridviewBolumler.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.TextBox txt4 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAd"));
                System.Web.UI.WebControls.TextBox txt5 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAcilis"));


                Section bolum = islem.TekGetir(id);
                bolum.CreatedDate = Convert.ToDateTime(txt5.Text);
                bolum.Name        = txt4.Text;


                if (islem.Guncelle(bolum))
                {
                    GridviewBolumler.EditIndex = -1;
                    Doldur();
                }



                break;

            case "iptal":

                GridviewBolumler.EditIndex = -1;
                Doldur();

                break;

            default:
                break;
            }
        }