示例#1
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            GridView gv = (GridView)sender;
            if (e.CommandName != "Sort")
            {
                int cd = Int32.Parse(gv.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value.ToString());
                switch (e.CommandName)
                {
                    case "Selecionar":
                        t24_agenda t24 = new t24_agenda();
                        {
                            t24.t24_cd_agenda = cd;
                            t24.Retrieve();
                            if (t24.Found)
                            {
                                Session["cd_projeto"] = t24.t03_cd_projeto;
                                Response.Redirect("Arvore.aspx");
                            }
                        }
                        break;
                    case "Editar":
                        Exibir();
                        this.lblHeader.Text = "Alteração";
                        this.btnAcao.Text = "Alterar";
                        cod.Value = cd.ToString();
                        Retrieve();

                        break;
                    case "Deletar":
                        t24 = new t24_agenda();
                        {
                            t24.t24_cd_agenda = cd;
                            t24.Delete();
                            pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t24_agenda", "delete", t24.t24_cd_agenda.ToString());
                        }
                        GridBind();
                        lblMsg.Text = pb.Message("Exclusão realizada com sucesso!", "ok");
                        lblMsg.Visible = true;
                        break;
                }
            }
        }
        catch { }
    }
示例#2
0
 private void Retrieve()
 {
     t24_agenda t24 = new t24_agenda();
     {
         t24.t24_cd_agenda = Int32.Parse(cod.Value);
         t24.Retrieve();
         if (t24.Found)
         {
             txtds_agenda.Text = t24.ds_agenda;
             txtdt_data.Text = t24.dt_data.ToShortDateString();
         }
     }
 }