Ejemplo n.º 1
0
        protected void GridviewKonular_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Subject k = (Subject)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).ForeColor     = System.Drawing.Color.Red;
                    (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Bölüm 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).ForeColor     = System.Drawing.Color.Green;
                    (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Bölüm Aktif Edilecek');";
                }
                DropDownList ddl1      = (DropDownList)e.Row.FindControl("dropdownBolum");
                Label        lbldurum  = (Label)e.Row.FindControl("Label1");
                int          sectionid = Convert.ToInt32(lbldurum.Text);
                Section      sec       = new Section();
                sec                 = islem.TekGetir(sectionid);
                ddl1.DataSource     = islem.HepsiniGetir();
                ddl1.DataTextField  = "Name";
                ddl1.DataValueField = "Id";
                ddl1.SelectedValue  = sec.Id.ToString();
                ddl1.DataBind();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
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;
            }
        }