예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CargarRoles(); // Carga combo con posibles valores
         if ((BD)Session["tipo"] == BD.Actualizar)
         {
             Obj_Persona_DAL = (Cls_Persona_DAL)Session["Persona"];
             //this.mantenimiento.InnerHtml = "Modificacion de Persona";
             // Carga de datos Obj_Persona_DAL
             txtCedula.Disabled      = true;
             txtCedula.Value         = Obj_Persona_DAL.sIdPersona;
             txtnombre.Value         = Obj_Persona_DAL.sNombre;
             TextAreadireccion.Value = Obj_Persona_DAL.sDireccion;
             // Carga Rol
             DropDownRol.Value = Obj_Persona_DAL.bIdRol.ToString();
             // carga grid teléfonos
             Obj_Telefonos_DAL            = new Cls_Telefonos_DAL();
             Obj_Telefonos_DAL.sIdPersona = Obj_Persona_DAL.sIdPersona;
             Obj_Telefonos_BLL.crudTelefono(ref Obj_Telefonos_DAL, BD.Filtrar);
             GridViewTelefono.DataSource = Obj_Telefonos_DAL.DS.Tables[0];
             GridViewTelefono.DataBind();
             // carga grid de correos
             Obj_Correo_DAL            = new Cls_Correos_DAL();
             Obj_Correo_DAL.sIdPersona = Obj_Persona_DAL.sIdPersona;
             Obj_Correo_BLL.crudCorreos(ref Obj_Correo_DAL, BD.Filtrar);
             CorreoPersonaGridView.DataSource = Obj_Correo_DAL.DS.Tables[0];
             CorreoPersonaGridView.DataBind();
         }
         else
         {
             //this.mantenimiento.InnerHtml = "Nuevos de Estados";
             txtCedula.Value         = string.Empty;
             txtnombre.Value         = string.Empty;
             TextAreadireccion.Value = string.Empty;
         }
     }
 }
예제 #2
0
        protected void btnRemover2_Click1(object sender, EventArgs e)
        {
            // Quitar teléfono
            DataTable tabla = new DataTable();

            tabla.Columns.Add("telefono");
            if (ViewState["tablatelefono"] == null)
            {
                ViewState["tablatelefono"] = tabla;
            }
            else
            {
                tabla = (DataTable)ViewState["tablatelefono"];
            }
            List <int> quitar = new List <int>();

            foreach (GridViewRow row in GridViewTelefono.Rows)
            {
                //busca el la fila
                if (row.RowType == DataControlRowType.DataRow)
                {
                    //si esta checkeado instancia las propiedades del objeto
                    CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox);
                    if (chkRow.Checked)
                    {
                        quitar.Add(row.RowIndex);
                    }
                }
            }
            for (int i = quitar.Count - 1; i >= 0; i--)
            {
                tabla.Rows.RemoveAt(quitar[i]);
            }
            GridViewTelefono.DataSource = tabla;
            GridViewTelefono.DataBind();
            ViewState["tablatelefono"] = tabla;
        }
예제 #3
0
        //Botón de Teléfono
        protected void btnAgregar2_Click1(object sender, EventArgs e)
        {
            // Agregrar Teléfono
            if (txtTelefono.Value.Trim() == string.Empty)
            {
                return;
            }
            DataTable tabla;

            if (GridViewTelefono.Rows.Count > 0)
            {
                tabla = new DataTable();
                tabla.Columns.Add("telefono");
                ViewState["tablatelefono"] = tabla;

                foreach (GridViewRow row in GridViewTelefono.Rows)
                {
                    tabla.Rows.Add(row.Cells[0].Text);
                }
            }
            if (ViewState["tablatelefono"] == null)
            {
                tabla = new DataTable();
                tabla.Columns.Add("telefono");
                ViewState["tablatelefono"] = tabla;
            }
            else
            {
                tabla = (DataTable)ViewState["tablatelefono"];
            }
            tabla.Rows.Add(txtTelefono.Value.Trim());
            GridViewTelefono.DataSource = tabla;
            GridViewTelefono.DataBind();
            ViewState["tablatelefono"] = tabla;
            txtTelefono.Value          = string.Empty;
        }