private void nuevaPersonaToolStripMenuItem_Click(object sender, EventArgs e) { RegistroPersonas registroPersonas = new RegistroPersonas(); registroPersonas.MdiParent = this; registroPersonas.Show(); }
//Metodo para eliminar la informacion en la tabla RegistroPersonas public static int EliminarPersona(RegistroPersonas Regperson) { try { ArrayList lstparametros = new ArrayList(); //se define lista de valores SQLSentencia sentencia = new SQLSentencia(); sentencia.PETICION = @"DELETE FROM RegistroPersonas WHERE identificacion=@identificacion"; //Defino parametros y sus caracteristicas SqlParameter identificacion = new SqlParameter(); identificacion.SqlDbType = System.Data.SqlDbType.Int; identificacion.ParameterName = "@identificacion"; identificacion.Value = Regperson.identificacion; //Agregando en la lista de valores lstparametros.Add(identificacion); //Asigna al atributo de la clase SQLSentencia la lista de valores sentencia.LSTPARAMETROS = lstparametros; Acceso objacceso = new Acceso(); return(objacceso.Ejecutar_TSQL(sentencia)); } catch (Exception ex) { throw ex; } }
private void RegistroPersonasMenuItem_Click(object sender, RoutedEventArgs e) { RegistroPersonas registroPersonas = new RegistroPersonas(); registroPersonas.Owner = this; registroPersonas.ShowDialog(); }
//Metodo para Buscar informacion en la tabla RegistroPersonas public static List <RegistroPersonas> BuscarPersona(RegistroPersonas Regperson) { try { SQLSentencia sentencia = new SQLSentencia(); sentencia.PETICION = @"SELECT * FROM RegistroPersonas WHERE identificacion='" + Regperson.identificacion + "'"; S03_03AccedoDatos.Acceso objAcceso = new S03_03AccedoDatos.Acceso(); return(objAcceso.ObtenerPersonas(sentencia)); } catch (Exception e) { throw e; } }
public List <RegistroPersonas> ObtenerPersonas(SQLSentencia objsentencia) { List <RegistroPersonas> lstresultados = new List <RegistroPersonas>(); System.Data.DataTable dt = new System.Data.DataTable(); try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = objsentencia.PETICION; cmd.Connection = objconexion; cmd.CommandType = System.Data.CommandType.Text; if (objsentencia.LSTPARAMETROS != null) { cmd.Parameters.AddRange(objsentencia.LSTPARAMETROS.ToArray()); } SqlDataAdapter objcarga = new SqlDataAdapter(cmd); objcarga.Fill(dt); foreach (System.Data.DataRow item in dt.Rows) { RegistroPersonas RegPerson = new RegistroPersonas(); RegPerson.identificacion = Convert.ToInt32(item.ItemArray[0].ToString()); RegPerson.nombre = item.ItemArray[1].ToString(); RegPerson.apellido = item.ItemArray[2].ToString(); RegPerson.edad = Convert.ToInt32(item.ItemArray[3].ToString()); RegPerson.correo = item.ItemArray[4].ToString(); RegPerson.tetefono = Convert.ToInt32(item.ItemArray[5].ToString()); RegPerson.pais = item.ItemArray[6].ToString(); RegPerson.ciudad = item.ItemArray[7].ToString(); RegPerson.detalles = item.ItemArray[8].ToString(); lstresultados.Add(RegPerson); } } catch (Exception ex) { throw ex; } finally { this.CERRAR(); } return(lstresultados); }
private RegistroPersonas procesobase() { RegistroPersonas persona = new RegistroPersonas(); persona.identificacion = Convert.ToInt32(txtIdentificacion.Text.Trim()); persona.nombre = txtNombre.Text.Trim(); persona.apellido = txtApellido.Text.Trim(); persona.edad = Convert.ToInt32(txtEdad.Text.Trim()); persona.correo = txtemail.Text.Trim(); persona.tetefono = Convert.ToInt32(txtTelefono.Text.Trim()); persona.pais = txtPais.Text.Trim(); persona.ciudad = txtCiudad.Text.Trim(); persona.detalles = txtDetalles.Text.Trim(); return(persona); }
private void btnBuscarPorId_Click(object sender, EventArgs e) { try { if (!txtBuscarId.Text.Equals("")) { RegistroPersonas search = new RegistroPersonas(); search.identificacion = Convert.ToInt32(txtBuscarId.Text.Trim()); List <RegistroPersonas> lstbusquedas = S03_02LogicaNegocio.Logica.BuscarPersona(search); this.dataGridView.DataSource = lstbusquedas; this.dataGridView.Refresh(); } else if (txtBuscarId.Text.Equals("")) { CargarPersonas(); } } catch (Exception ex) { MessageBox.Show("Error \n" + ex.Message + "\nal Encontrar Datos en Tabla RegistroPersonas"); } Limpiar(); }
private void clienteToolStripMenuItem_Click(object sender, EventArgs e) { RegistroPersonas registropersonas = new RegistroPersonas(); registropersonas.Show(); }
//Metodo para Modificar la informacion en la tabla RegistroPersonas public static int ModificarPersona(RegistroPersonas Regperson) { try { ArrayList lstparametros = new ArrayList(); //se define lista de valores SQLSentencia sentencia = new SQLSentencia(); sentencia.PETICION = @"UPDATE RegistroPersonas SET nombre= @nombre, apellido= @apellido, edad= @edad, correo= @correo, tetefono= @tetefono, pais= @pais, ciudad= @ciudad, detalles= @detalles WHERE identificacion=@identificacion"; //Defino parametros y sus caracteristicas SqlParameter nombre = new SqlParameter(); nombre.SqlDbType = System.Data.SqlDbType.NVarChar; nombre.ParameterName = "@nombre"; nombre.Value = Regperson.nombre; SqlParameter apellido = new SqlParameter(); apellido.SqlDbType = System.Data.SqlDbType.NVarChar; apellido.ParameterName = "@apellido"; apellido.Value = Regperson.apellido; SqlParameter edad = new SqlParameter(); edad.SqlDbType = System.Data.SqlDbType.Int; edad.ParameterName = "@edad"; edad.Value = Regperson.edad; SqlParameter correo = new SqlParameter(); correo.SqlDbType = System.Data.SqlDbType.NVarChar; correo.ParameterName = "@correo"; correo.Value = Regperson.correo; SqlParameter tetefono = new SqlParameter(); tetefono.SqlDbType = System.Data.SqlDbType.Int; tetefono.ParameterName = "@tetefono"; tetefono.Value = Regperson.tetefono; SqlParameter pais = new SqlParameter(); pais.SqlDbType = System.Data.SqlDbType.NVarChar; pais.ParameterName = "@pais"; pais.Value = Regperson.pais; SqlParameter ciudad = new SqlParameter(); ciudad.SqlDbType = System.Data.SqlDbType.NVarChar; ciudad.ParameterName = "@ciudad"; ciudad.Value = Regperson.ciudad; SqlParameter detalles = new SqlParameter(); detalles.SqlDbType = System.Data.SqlDbType.NVarChar; detalles.ParameterName = "@detalles"; detalles.Value = Regperson.detalles; SqlParameter identificacion = new SqlParameter(); identificacion.SqlDbType = System.Data.SqlDbType.Int; identificacion.ParameterName = "@identificacion"; identificacion.Value = Regperson.identificacion; //Agregando en la lista de valores lstparametros.Add(nombre); lstparametros.Add(apellido); lstparametros.Add(edad); lstparametros.Add(correo); lstparametros.Add(tetefono); lstparametros.Add(pais); lstparametros.Add(ciudad); lstparametros.Add(detalles); lstparametros.Add(identificacion); //Asigna al atributo de la clase SQLSentencia la lista de valores sentencia.LSTPARAMETROS = lstparametros; Acceso objconexion = new Acceso(); return(objconexion.Ejecutar_TSQL(sentencia)); } catch (Exception ex) { throw ex; } }
internal static bool Modificar(RegistroPersonas personas) { throw new NotImplementedException(); }