public int registrar_enPersona(Becado a) { String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;" + "database=inf282g6;" + "port=3306;" + "password=Nk2ewy;" + "SslMode=none;"; MySqlConnection con = new MySqlConnection(cadena); MySqlCommand comando = new MySqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "F_INSERTAR_PERSONA"; comando.Parameters.Add("_codigo_pucp", MySqlDbType.Int32).Value = a.CodigoPUCP; comando.Parameters.Add("_nombres", MySqlDbType.VarChar).Value = a.Nombres; comando.Parameters.Add("_apellidos", MySqlDbType.VarChar).Value = a.Apellidos; comando.Parameters.Add("_sexo", MySqlDbType.VarChar).Value = a.Sexo; comando.Parameters.Add("_dni", MySqlDbType.Int32).Value = a.Dni; comando.Parameters.Add("_edad", MySqlDbType.Int32).Value = a.Edad; comando.Parameters.Add("_fecha_nacimiento", MySqlDbType.Date).Value = a.Fecha_nacimiento; comando.Parameters.Add("_correo_pucp", MySqlDbType.VarChar).Value = a.CorreoPUCP; comando.Parameters.Add("_correo_alternativo", MySqlDbType.VarChar).Value = a.CorreoAlternativo; comando.Parameters.Add("_telf_movil", MySqlDbType.VarChar).Value = a.TelfMovil; comando.Parameters.Add("_telf_fijo", MySqlDbType.VarChar).Value = a.TelfFijo; comando.Parameters.Add("_estado", MySqlDbType.VarChar).Value = a.Estado; comando.Parameters.Add("_id_usuario", MySqlDbType.Int32).Value = 1; comando.Parameters.Add("_id", MySqlDbType.Int32).Direction = System.Data.ParameterDirection.Output; comando.Connection = con; con.Open(); comando.ExecuteNonQuery(); int id = Int32.Parse(comando.Parameters["_id"].Value.ToString()); con.Close(); return(id); }
//hecho por Francisco public int registrarAlumno(Becado a) { int idx = accesoDatos.registrar_enPersona(a); //registra en la tabla personas; int idx_becado = accesoDatos.registrar_enBecado(a, idx); //registra en la tabla becado return(idx_becado); }
public frmConsultarBecarioT() { InitializeComponent(); logicaNegocioPersona = new BecadoBL(); alumnoSeleccionado = new Becado(); logicaNegoAB = new Becado_x_BecaBL(); }
public int registrar_enBecado(Becado a, int id_persona) { String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;" + "database=inf282g6;" + "port=3306;" + "password=Nk2ewy;" + "SslMode=none;"; MySqlConnection con = new MySqlConnection(cadena); MySqlCommand comando = new MySqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "F_INSERTAR_BECADO"; comando.Parameters.Add("_id_persona", MySqlDbType.Int32).Value = id_persona; comando.Parameters.Add("_id_especialidad", MySqlDbType.Int32).Value = a.Especialidad; comando.Parameters.Add("_id_facultad", MySqlDbType.Int32).Value = a.Facultad; comando.Parameters.Add("_ciclo_ingreso", MySqlDbType.VarChar).Value = a.Ciclo_ingreso; comando.Parameters.Add("_tipo_grupo", MySqlDbType.VarChar).Value = a.Tipo_grupo; comando.Parameters.Add("_distrito_nacimiento", MySqlDbType.VarChar).Value = a.Distrito_nacimiento; comando.Parameters.Add("_provincia_nacimiento", MySqlDbType.VarChar).Value = a.Provincia_nacimiento; comando.Parameters.Add("_departamento_nacimiento", MySqlDbType.VarChar).Value = a.Departamento_nacimiento; comando.Parameters.Add("_pais_nacimiento", MySqlDbType.VarChar).Value = a.Pais_nacimiento; comando.Parameters.Add("_direccion", MySqlDbType.VarChar).Value = a.Direccion; comando.Parameters.Add("_distrito_actual", MySqlDbType.VarChar).Value = a.Distrito_actual; comando.Parameters.Add("_provincia_actual", MySqlDbType.VarChar).Value = a.Provincia_actual; comando.Parameters.Add("_departamento_actual", MySqlDbType.VarChar).Value = a.Departamento_actual; comando.Parameters.Add("_id", MySqlDbType.Int32).Direction = System.Data.ParameterDirection.Output; comando.Connection = con; con.Open(); comando.ExecuteNonQuery(); int id = Int32.Parse(comando.Parameters["_id"].Value.ToString()); con.Close(); return(id); }
public string GetPago(Becado becado) { //string id = becado.BecadoID.ToString(); //var pago = db.ChecklistPagos. ////if() return "s"; }
public BindingList <Becado> listarBecadosPorCiclo(string ciclo) { BindingList <Becado> lstBecados = new BindingList <Becado>(); String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;database=inf282g6;" + "port=3306;password=Nk2ewy;SslMode=none;" + ""; MySqlConnection con = new MySqlConnection(cadena); con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandText = "SELECT p.NOMBRES, p.APELLIDOS, p.CORREO_PUCP, p.CODIGO_PUCP, p.SEXO, e.NOMBRE_ESPECIALIDAD FROM BECADO b , PERSONA p, ESPECIALIDAD e " + "where '" + ciclo + "'= CICLO_INGRESO and p.ID_PERSONA = b.ID_PERSONA and b.ID_ESPECIALIDAD_INGRESO = e.ID_ESPECIALIDAD;"; comando.Connection = con; MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Becado becado = new Becado(); becado.Nombres = reader.GetString("NOMBRES"); becado.Apellidos = reader.GetString("APELLIDOS"); becado.CorreoPUCP = reader.GetString("CORREO_PUCP"); becado.CodigoPUCP = reader.GetInt32("CODIGO_PUCP"); becado.Sexo = reader.GetChar("SEXO"); becado.NombreEspecialidad = reader.GetString("NOMBRE_ESPECIALIDAD"); lstBecados.Add(becado); } con.Close(); return(lstBecados); }
//Hecho por Yoluana public Becado buscarBecado(String cod) { String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;database=inf282g6;" + "port=3306;password=Nk2ewy;SslMode=none;" + ""; MySqlConnection con = new MySqlConnection(cadena); con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "Y_BUSCAR_BECARIO_ID"; comando.Connection = con; comando.Parameters.AddWithValue("codBec", Convert.ToInt32(cod)); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { //SELECT P.NOMBRES, P.APELLIDOS, P.CODIGO_PUCP FROM PERSONA P INNER JOIN BECADO B becado = new Becado(); becado.CodigoPUCP = reader.GetInt32("CODIGO_PUCP"); becado.Nombres = reader.GetString("NOMBRES"); becado.Apellidos = reader.GetString("APELLIDOS"); //es id becario } con.Close(); return(becado); }
//Hecho por Yoluana public bool enlazarBecario2(Becado pe, string idAlum) { //BindingList<Persona> lista = new BindingList<Persona>(); String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;database=inf282g6;" + "port=3306;password=Nk2ewy;SslMode=none;" + ""; MySqlConnection con = new MySqlConnection(cadena); try { con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "Y_ENLAZAR_BECARIO_TUTOR2"; //SET ID_TUTOR = idTut WHERE ID_BECADO = idBecario comando.Connection = con; comando.Parameters.AddWithValue("idBecario", idAlum); comando.Parameters.AddWithValue("idTut", pe.Id_tutor); comando.ExecuteNonQuery(); con.Close(); //update desde workb sii return(true); } catch (Exception e) { con.Close(); return(false); } }
private void dgvBecarios_CellClick(object sender, DataGridViewCellEventArgs e) { alumnoSeleccionado = (Becado)dgvBecarios.CurrentRow.DataBoundItem; txtApellidos.Text = alumnoSeleccionado.Apellidos.ToString(); //txtFechaConvocatoriaSelec.Text = becaSeleccionada.FechaConvocatoria.ToString(); txtCodigo.Text = alumnoSeleccionado.CodigoPUCP.ToString();; txtCorreoPUCP.Text = alumnoSeleccionado.CorreoPUCP.ToString(); txtNombreBecario.Text = alumnoSeleccionado.Nombres.ToString(); }
public frmBuscarBecario_F() { InitializeComponent(); logicaNegoAlumno = new BecadoBL(); _alumnoSeleccionado = new Becado(); dvg_alumnos.AllowUserToAddRows = false; //quitar la ultima fila dvg_alumnos.AutoGenerateColumns = false; }
public IActionResult OnGet(int id) { Becado = _becadoRepository.GetbyId(id); if (Becado == null) { return(NotFound()); } return(Page()); }
private void btnBuscarABTXB_Click(object sender, EventArgs e) { BuscarBecarioABTXB frmABTXB = new BuscarBecarioABTXB(); if (frmABTXB.ShowDialog() == DialogResult.OK) { per = (Becado)frmABTXB.PersonaSeleccionada; txtCodABTXB.Text = per.CodigoPUCP.ToString(); txtNombABTXB.Text = per.Nombres; txtApABTXB.Text = per.Apellidos; TxtIdOcultoB.Text = per.Id_becado.ToString(); } //frmABTXB.ShowDialog(); }
public frmConsultarCorreos() { InitializeComponent(); becadoBL = new BecadoBL(); dgvConsultarEmails.AutoGenerateColumns = false; dgvConsultarEmails.DataSource = lstBecados; lstFiltos = new BindingList <Becado>(); bec = new Becado(); bec.NombreEspecialidad = ""; bec.Sexo = '\0'; cbSexo.Items.Add(bec); cbEspecialidad.Items.Add(bec); //btnDescargarEmails.Visible = false; }
//Hecho por Yoluana public BindingList <Becado> listarBecarios(String cod) { BindingList <Becado> lista = new BindingList <Becado>(); String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;database=inf282g6;" + "port=3306;password=Nk2ewy;SslMode=none;" + ""; MySqlConnection con = new MySqlConnection(cadena); con.Open(); MySqlCommand comando = new MySqlCommand(); if (cod.Length == 0) { comando.CommandText = "SELECT P.CODIGO_PUCP, P.NOMBRES, P.APELLIDOS, P.CORREO_PUCP, B.ID_BECADO FROM PERSONA P INNER JOIN BECADO B WHERE P.ID_PERSONA = B.ID_PERSONA"; comando.Connection = con; } else { comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "Y_BUSCAR_BECARIO"; comando.Connection = con; comando.Parameters.AddWithValue("codBec", cod); } MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { //P.CODIGO_PUCP, P.NOMBRES, P.APELLIDOS, P.CORREO_PUCP, B.ID_BECADO FROM PERSONA P Becado per = new Becado(); per.CodigoPUCP = reader.GetInt32("CODIGO_PUCP"); per.Nombres = reader.GetString("NOMBRES"); per.Apellidos = reader.GetString("APELLIDOS"); //es id becario per.Id_becado = reader.GetInt32("ID_BECADO"); per.CorreoPUCP = reader.GetString("CORREO_PUCP"); lista.Add(per); } con.Close(); return(lista); }
public void actualizar_enBecado(Becado a) { String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;" + "database=inf282g6;" + "port=3306;" + "password=Nk2ewy;" + "SslMode=none;"; MySqlConnection con = new MySqlConnection(cadena); MySqlCommand comando = new MySqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "F_ACTUALIZAR_BECADO"; comando.Parameters.Add("_id_becado", MySqlDbType.Int32).Value = a.Id_becado; comando.Parameters.Add("_id_persona", MySqlDbType.Int32).Value = a.Id_persona; comando.Parameters.Add("_id_especialidad", MySqlDbType.Int32).Value = a.Especialidad; comando.Parameters.Add("_id_facultad", MySqlDbType.Int32).Value = a.Facultad; comando.Parameters.Add("_ciclo_ingreso", MySqlDbType.VarChar).Value = a.Ciclo_ingreso; comando.Parameters.Add("_tipo_grupo", MySqlDbType.VarChar).Value = a.Tipo_grupo; comando.Parameters.Add("_distrito_nacimiento", MySqlDbType.VarChar).Value = a.Distrito_nacimiento; comando.Parameters.Add("_provincia_nacimiento", MySqlDbType.VarChar).Value = a.Provincia_nacimiento; comando.Parameters.Add("_departamento_nacimiento", MySqlDbType.VarChar).Value = a.Departamento_nacimiento; comando.Parameters.Add("_pais_nacimiento", MySqlDbType.VarChar).Value = a.Pais_nacimiento; comando.Parameters.Add("_direccion", MySqlDbType.VarChar).Value = a.Direccion; comando.Parameters.Add("_distrito_actual", MySqlDbType.VarChar).Value = a.Distrito_actual; comando.Parameters.Add("_provincia_actual", MySqlDbType.VarChar).Value = a.Provincia_actual; comando.Parameters.Add("_departamento_actual", MySqlDbType.VarChar).Value = a.Departamento_actual; comando.Parameters.Add("_codigo_pucp", MySqlDbType.Int32).Value = a.CodigoPUCP; comando.Parameters.Add("_nombres", MySqlDbType.VarChar).Value = a.Nombres; comando.Parameters.Add("_apellidos", MySqlDbType.VarChar).Value = a.Apellidos; comando.Parameters.Add("_sexo", MySqlDbType.VarChar).Value = a.Sexo; comando.Parameters.Add("_dni", MySqlDbType.Int32).Value = a.Dni; comando.Parameters.Add("_edad", MySqlDbType.Int32).Value = a.Edad; comando.Parameters.Add("_fecha_nacimiento", MySqlDbType.Date).Value = a.Fecha_nacimiento; comando.Parameters.Add("_correo_pucp", MySqlDbType.VarChar).Value = a.CorreoPUCP; comando.Parameters.Add("_correo_alternativo", MySqlDbType.VarChar).Value = a.CorreoAlternativo; comando.Parameters.Add("_telf_movil", MySqlDbType.VarChar).Value = a.TelfMovil; comando.Parameters.Add("_telf_fijo", MySqlDbType.VarChar).Value = a.TelfFijo; comando.Parameters.Add("_estado", MySqlDbType.VarChar).Value = a.Estado; comando.Connection = con; con.Open(); comando.ExecuteNonQuery(); con.Close(); }
private void btnAceptar_Click(object sender, EventArgs e) { Tutor persona = new Tutor(); String idAlum = txtIdOcultoCambiar.Text; persona = (Tutor)cbxTutorCambiar.SelectedItem; Becado pe = new Becado(); pe.Id_tutor = persona.IdTutor; //pe.Id_persona = Convert.ToInt32(idAlum); if (logicaNegocioPer.enlazarBecario2(pe, idAlum)) { MessageBox.Show("La operación se realizó con éxito", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo realizar la operación", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Dispose(); }
public IActionResult Create(Becado item) { using (OracleConnection conn = new OracleConnection(connectionString: "User Id=sinuois;Password=SINUOIS;Data Source=localhost:1521")) { using (OracleCommand cmd = conn.CreateCommand()) { try { List <Becado> becados = this.GetAll().Value; conn.Open(); cmd.CommandText = "INSERT INTO BECADO VALUES(" + "'" + item.RUT + "', '" + item.CODIGO + "')"; cmd.ExecuteNonQuery(); //_context.Becados.Add(item); //_context.SaveChanges(); } catch (Exception ex) { return(NotFound()); } } } return(CreatedAtRoute("GetBecado", new { Id = item.CODIGO }, item)); }
public BindingList <Becado> buscar_enBecado() { BindingList <Becado> lista = new BindingList <Becado>(); String cadena = "server=quilla.lab.inf.pucp.edu.pe;" + "user=inf282g6;" + "database=inf282g6;" + "port=3306;" + "password=Nk2ewy;" + "SslMode=none;"; MySqlConnection con = new MySqlConnection(cadena); MySqlCommand comando = new MySqlCommand(); comando.CommandText = "SELECT * FROM BECADO"; comando.Connection = con; con.Open(); MySqlDataReader rs = comando.ExecuteReader(); while (rs.Read()) { Becado a = new Becado(); a.Id_becado = rs.GetInt32("ID_BECADO"); a.Id_persona = rs.GetInt32("ID_PERSONA"); a.Especialidad = rs.GetInt32("ID_ESPECIALIDAD_INGRESO"); a.Facultad = rs.GetInt32("ID_FACULTAD_INGRESO"); a.Ciclo_ingreso = rs.GetString("CICLO_INGRESO"); a.Tipo_grupo = rs.GetString("TIPO_GRUPO"); a.Distrito_nacimiento = rs.GetString("DISTRITO_NACIMIENTO"); a.Provincia_nacimiento = rs.GetString("PROVINCIA_NACIMIENTO"); a.Departamento_nacimiento = rs.GetString("DEPARTAMENTO_NACIMIENTO"); a.Pais_nacimiento = rs.GetString("PAIS_NACIMIENTO"); a.Direccion = rs.GetString("DIRECCION"); a.Distrito_actual = rs.GetString("DISTRITO_ACTUAL"); a.Provincia_actual = rs.GetString("PROVINCIA_ACTUAL"); a.Departamento_actual = rs.GetString("DEPARTAMENTO_ACTUAL"); lista.Add(a); } con.Close(); return(lista); }
private void btnGuardar_Click(object sender, EventArgs e) { if (validar()) { relleno(); Becado a = new Becado(); if (flag_elementoEditar == 1) { a.Id_persona = Int32.Parse(tbox_id_persona.Text); a.Id_becado = Int32.Parse(tbox_id_becado.Text); } a.CodigoPUCP = Int32.Parse(tbox_codigo.Text); a.Nombres = tbox_nombres.Text; a.Apellidos = tbox_apellidos.Text; if (rbutton_masculino.Checked == true) { a.Sexo = 'M'; } else if (rbutton_femenino.Checked == true) { a.Sexo = 'F'; } a.Edad = Int32.Parse(tbox_edad.Text); a.Dni = Int32.Parse(tbox_dni.Text); a.CorreoPUCP = tbox_correopucp.Text; a.CorreoAlternativo = tbox_correoalternativo.Text; a.TelfMovil = tbox_movil.Text; a.TelfFijo = tbox_fijo.Text; a.Ciclo_ingreso = cbox_ciclo1.Text + "-" + cbox_ciclo2.Text; a.Especialidad = ((Especialidad)cbox_especialidad.SelectedItem).Id_especialidad; a.Facultad = ((Especialidad)cbox_especialidad.SelectedItem).Facultad.Id_facultad; a.Tipo_grupo = cbox_tipogrupo.Text; a.Direccion = tbox_direccion.Text; a.Distrito_actual = cbox_distrito.Text; a.Distrito_nacimiento = tbox_provinciaN.Text; a.Provincia_actual = tbox_provincia.Text; a.Provincia_nacimiento = tbox_provinciaN.Text; a.Departamento_actual = cbox_departamento.Text; a.Departamento_nacimiento = cbox_departamentoN.Text; a.Pais_nacimiento = cbox_paisN.Text; a.Fecha_nacimiento = DateTime.Parse(dt_fechanacimiento.Text); a.Estado = cbox_estado.Text; estadoComponentes(Estado.Deshabilitado); if (flag_elementoNuevo == 1) { flag_elementoNuevo = 0; id_becado_ParaHistoriaAcademica = logicaNegoAlumno.registrarAlumno(a); MessageBox.Show("Se ha registrado un nuevo alumno con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); btn_historiaacademica.Enabled = true; } else if (flag_elementoEditar == 1) { flag_elementoEditar = 0; logicaNegoAlumno.actualizarAlumno(a); MessageBox.Show("Se ha actualizado con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnGuardar.Enabled = false; } }
private void btnFiltrar_Click(object sender, EventArgs e) { Becado becado1 = (Becado)cbSexo.SelectedItem; Becado becado2 = (Becado)cbEspecialidad.SelectedItem; if (becado1 == null) { becado1 = new Becado(); } if (becado2 == null) { becado2 = new Becado(); } lstFiltos = new BindingList <Becado>(); if (becado1.Sexo == '\0' && becado2.NombreEspecialidad == "") { dgvConsultarEmails.DataSource = lstBecados; } else if (becado1.Sexo == '\0' && becado2.NombreEspecialidad != "") { foreach (var i in lstBecados) { if (i.NombreEspecialidad == becado2.NombreEspecialidad) { lstFiltos.Add(i); } } dgvConsultarEmails.DataSource = lstFiltos; } else if (becado1.Sexo != '\0' && becado2.NombreEspecialidad == "") { foreach (var i in lstBecados) { if (i.Sexo.ToString() == becado1.Sexo.ToString()) { lstFiltos.Add(i); } } dgvConsultarEmails.DataSource = lstFiltos; } else { BindingList <Becado> lstAux = new BindingList <Becado>(); foreach (var i in lstBecados) { if (i.NombreEspecialidad == becado2.NombreEspecialidad) { lstFiltos.Add(i); } } foreach (var i in lstFiltos) { if (i.Sexo.ToString() == becado1.Sexo.ToString()) { lstAux.Add(i); } } lstFiltos = lstAux; dgvConsultarEmails.DataSource = lstFiltos; } }
private void btn_seleccionar_Click(object sender, EventArgs e) { _alumnoSeleccionado = ((Becado)dvg_alumnos.CurrentRow.DataBoundItem); this.DialogResult = DialogResult.OK; }
//hecho por Francisco public void actualizarAlumno(Becado a) { accesoDatos.actualizar_enBecado(a); }
public bool enlazarBecario2(Becado pe, string idAlum) { return(accesoDatosPersona.enlazarBecario2(pe, idAlum)); }