コード例 #1
0
 //boton modificar
 protected void btnEditar_Click(object sender, EventArgs e)
 {
     //Recorre Grid buscando chk
     foreach (GridViewRow row in PersonaGridView.Rows)
     {
         //busca el la fila
         if (row.RowType == DataControlRowType.DataRow)
         {
             //si esta checkeado instancia las propiedades del objeto
             if ((row.Cells[0].FindControl("chkRow") as CheckBox).Checked)
             {
                 //Se instancia objeto
                 Obj_Persona_DAL = new Cls_Persona_DAL();
                 //Secion tipo Editar
                 Session["tipo"]            = BD.Actualizar;
                 Obj_Persona_DAL.sIdPersona = row.Cells[0].Text;
                 Obj_Persona_DAL.sNombre    = WebUtility.HtmlDecode(row.Cells[1].Text);
                 Obj_Persona_DAL.sDireccion = WebUtility.HtmlDecode(row.Cells[2].Text);
                 // INICIO: Obtener Rol
                 Cls_Rol_BLL Obj_Rol_BLL = new Cls_Rol_BLL();
                 Cls_Rol_DAL Obj_Rol_DAL = new Cls_Rol_DAL();
                 Obj_Rol_DAL.sDescripcion = row.Cells[3].Text;
                 Obj_Rol_BLL.crudRol(ref Obj_Rol_DAL, BD.Filtrar);
                 Obj_Persona_DAL.bIdRol = Convert.ToByte(Obj_Rol_DAL.DS.Tables[0].Rows[0][0].ToString());
                 // FIN: Obtener Rol
                 //Sesion persona lleva el objeto
                 Session["Persona"] = Obj_Persona_DAL;
                 Response.Redirect(pantallaMantenimiento, false);
             }
         }
     }
 }
コード例 #2
0
 protected void btnGuardar_Click1(object sender, EventArgs e)
 {
     //Validar Campos en Blanco
     if (txtdescripcion.Value.Trim().Equals(string.Empty))
     {
         //se agrega el label que indique lo que no hay datos
         lblGuardar.InnerText = "Debe ingresar datos";
         lblGuardar.Visible   = true;
     }
     else
     {
         lblGuardar.Visible = false;
         Cls_Rol_DAL Obj_Rol_DAL = new Cls_Rol_DAL();
         Cls_Rol_BLL Obj_Rol_BLL = new Cls_Rol_BLL();
         Obj_Rol_DAL.sDescripcion = this.txtdescripcion.Value.ToString();
         if ((BD)Session["tipo"] == BD.Actualizar)
         {
             Obj_Rol_DAL.bIdRol = Convert.ToByte(this.txtRoles.Value); // Si se edita se debe de obtener el ID
             Obj_Rol_BLL.crudRol(ref Obj_Rol_DAL, BD.Actualizar);
         }
         else if ((BD)Session["tipo"] == BD.Insertar)
         {
             Obj_Rol_BLL.crudRol(ref Obj_Rol_DAL, BD.Insertar);
         }
         Response.Redirect(pantallaMantenimiento, true);
     }
     //Validar campos en Blanco
 }