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



                Subject c = subislem.TekGetir(userID);


                if (c.IsActive == true)
                {
                    if (subislem.DurumGuncelle(userID, false))
                    {
                        Doldur();
                    }
                }
                else
                {
                    if (subislem.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);
                GridviewKonular.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.Label        lbl4 = (System.Web.UI.WebControls.Label)(secilenSatir.FindControl("Label1"));
                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.DropDownList ddl1 = (System.Web.UI.WebControls.DropDownList)(secilenSatir.FindControl("dropdownBolum"));



                Subject konu = subislem.TekGetir(id);
                konu.CreatedDate = Convert.ToDateTime(txt5.Text);
                konu.Name        = txt4.Text;
                konu.SectionID   = Convert.ToInt32(ddl1.SelectedValue);


                if (subislem.Guncelle(konu))
                {
                    GridviewKonular.EditIndex = -1;
                    Doldur();
                }



                break;

            case "iptal":

                GridviewKonular.EditIndex = -1;
                Doldur();

                break;

            default:
                break;
            }
        }