예제 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        bool result;
        string msg;
        t13_foco t13 = new t13_foco();
        {
            try
            {
                t13.nm_foco = txtnm_foco.Text;
                t13.t03_cd_projeto = pb.cd_projeto();
                t13.fl_ativa = true;
                t13.dt_cadastro = DateTime.Now;
                t13.dt_alterado = DateTime.Now;
                result = t13.Save();
                msg = pb.Message("Inclusão realizada com sucesso", "ok");
                pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t13_foco", "insert", t13.nm_foco);
                txtnm_foco.Text = "";
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;
            GridBind();
        }
    }
예제 #2
0
    protected void Delete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        ImageButton btn = (ImageButton)sender;
        bool result;
        string msg;
        t13_foco t13 = new t13_foco();
        {
            try
            {
                t13.t13_cd_foco = Int32.Parse(btn.CommandArgument);
                result = t13.Delete();
                pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t13_foco", "delete", t13.t13_cd_foco.ToString());
                msg = pb.Message("Exclusão realizada com sucesso", "ok");
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;
            GridBind();
        }
    }
예제 #3
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];
        int cod = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
        TextBox txt1 = (TextBox)row.FindControl("txtnm_foco");

        bool result;
        string msg;
        t13_foco t13 = new t13_foco();
        {
            try
            {
                t13.t13_cd_foco = cod;
                t13.nm_foco = txt1.Text;
                t13.dt_alterado = DateTime.Now;
                pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t13_foco", "update", t13.t13_cd_foco.ToString());
                result = t13.Update();
                msg = pb.Message("Alteração realizada com sucesso", "ok");
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;

            GridView1.EditIndex = -1;
            GridBind();
        }
    }
예제 #4
0
    private void GridBind()
    {
        t13_foco t13 = new t13_foco();
        {
            t13.t03_cd_projeto = pb.cd_projeto();
            t13.order = "order by " + ViewState["campo"].ToString() + " " + ViewState["sentido"].ToString();
            t13.fl_ativa = true;
            GridView1.DataSource = t13.List();
            GridView1.DataBind();

        }
    }