private void btoMostrar_Click(object sender, EventArgs e) { ngLista_Curso car = new ngLista_Curso(); this.dgListadoCargos.DataSource = car.retornaLista_CursoDataSet(); this.dgListadoCargos.DataMember = "Lista_Curso"; }
private void btnGuardar_Click(object sender, EventArgs e) { ngLista_Curso car = new ngLista_Curso(); if (txtIdListaCurso.Text.Trim().Length == 0 || txtAno.Text.Trim().Length == 0 || txtSemestre.Text.Trim().Length == 0 || cmbAlumno.SelectedIndex == -1 || cmbCod_Curso.SelectedIndex == -1) { MessageBox.Show("Ningún campo puede estar vacío"); return; } else { if (String.IsNullOrEmpty(Convert.ToString(car.buscaLista_Curso(this.txtIdListaCurso.Text).IdListaCurso))) { ngLista_Curso ncargo = new ngLista_Curso(); ngLista_Curso tod = new ngLista_Curso(); ncargo.IdListaCurso = txtIdListaCurso.Text; ncargo.Ano = Convert.ToInt32(txtAno.Text); ncargo.Semestre = txtSemestre.Text; ncargo.Rut = Convert.ToString(cmbAlumno.SelectedValue); ncargo.Cod_Curso = Convert.ToString(cmbCod_Curso.SelectedValue); tod.ingresaLista_Curso(ncargo); MessageBox.Show("Lista Curso Guardada Correctamente"); Limpiar(); } else { MessageBox.Show("Lista Curso ya existe", "Mensaje Sistema"); return; } } }
private void btnEliminar_Click(object sender, EventArgs e) { ngLista_Curso ncargo = new ngLista_Curso(); if (String.IsNullOrEmpty(Convert.ToString(ncargo.buscaLista_Curso(this.txtIdListaCurso.Text).IdListaCurso))) { MessageBox.Show("No se puede eliminar la Lista del Curso", "Mensaje Sistema"); } else { ncargo.eliminarLista_Curso(txtIdListaCurso.Text); MessageBox.Show("Lista del Curso eliminada", "Mensaje Sistema"); Limpiar(); this.txtIdListaCurso.Focus(); } }
private void txtIdListaCurso_Leave(object sender, EventArgs e) { ngLista_Curso ncar = new ngLista_Curso(); Lista_Curso ncar2 = new Lista_Curso(); ncar2 = ncar.buscaLista_Curso(txtIdListaCurso.Text); if (String.IsNullOrEmpty(Convert.ToString(ncar2.IdListaCurso))) { return; } else { txtIdListaCurso.Text = Convert.ToString(ncar2.IdListaCurso); txtAno.Text = Convert.ToString(ncar2.Ano); txtSemestre.Text = ncar2.Semestre; cmbAlumno.SelectedValue = ncar2.Rut; cmbCod_Curso.SelectedValue = ncar2.Cod_Curso; } }