public void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Datos_Personales.ToList(); foreach (var valores in item.Where(n => n.ID_Datos_Personales == ID_dp)) { ID_t = valores.ID_Referencia; } if (ID_t != null) { var datostutor = context.Tutor.ToList(); foreach (var valores in datostutor.Where(n => n.ID_Ref == ID_t)) { NomTutorNR.Text = valores.Nombre1_Tutor; NomTutor2NR.Text = valores.Nombre2_Tutor; ApeTutorNR.Text = valores.Ap_P_T; ApeTutor2NR.Text = valores.AP_M_T; TelTutorNR.Text = valores.TelefonoT; NomRefNR.Text = valores.Nombre1_Ref; NomRef2NR.Text = valores.Nombre2_Ref; ApeRefNR.Text = valores.AP_P_R; ApeRef2NR.Text = valores.AP_M_R; TelRefNR.Text = valores.TelefonoR; } } } }
private void Validar() { if (NivelCampo.Text == "" || NombreCarrera.Text == "") { MessageBox.Show("Falta llenar campos obligatorios", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { nivel = NivelCampo.Text; nombrecarrera = NombreCarrera.Text; using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Carrera.SingleOrDefault(n => n.ID_Carrera == ID); if (a != null) { a.Nombre_Carrera = nombrecarrera; a.Escolaridad = nivel; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); this.Dispose(); } } }
private void BtnGuardarTutorNR_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (Comprobar() == false) { MessageBox.Show("Datos Incompletos"); } if (Comprobar() == true) { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Tutor.SingleOrDefault(n => n.ID_Ref == ID_t); if (a != null) { a.Nombre1_Tutor = NomTutorNR.Text.Trim(); a.Nombre2_Tutor = NomTutor2NR.Text.Trim(); a.Ap_P_T = ApeTutorNR.Text.Trim(); a.AP_M_T = ApeTutor2NR.Text.Trim(); a.TelefonoT = TelTutorNR.Text.Trim(); a.Nombre1_Ref = NomRefNR.Text.Trim(); a.Nombre2_Ref = NomRef2NR.Text.Trim(); a.AP_P_R = ApeRefNR.Text.Trim(); a.AP_M_R = ApeRef2NR.Text.Trim(); a.TelefonoR = TelRefNR.Text.Trim(); context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); } } } }
private void BtnGuardarProgramaNR_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (Validar() == false) { MessageBox.Show("Datos Incompletos"); } else { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Programa.SingleOrDefault(n => n.ID_Programa == this.ID_programa); if (a != null) { a.Nombre_Programa = TextBoxPrograma.Text.Trim(); a.Horas_Diarias = Int32.Parse(HorasDiariasNR.Text); a.Horas_Totales = Int32.Parse(HorasTotalesNR.Text); a.Fecha_Inicio = FechaInicioNR.Value; a.Fecha_Final = FechaTermNR.Value; a.Hora_Inicio = HoraEntradaNR.Text + ":" + HoraEntradaNR2.Text; a.Hora_Termino = HoraSalidaNR.Text + ":" + HoraSalidaNR2.Text; a.Actividades = ActividadesNR.Text.Trim(); a.Nombre_Proyecto = ProyectoNR.Text.Trim(); context.SaveChanges(); } } Cargar(); MessageBox.Show("Datos cambiados con éxito"); } } }
public void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { string horainicio = null; string horafin = null; var datosprograma = context.Programa.ToList(); foreach (var valores in datosprograma.Where(n => n.ID_Programa == ID_programa)) { TextBoxPrograma.Text = valores.Nombre_Programa; HorasDiariasNR.Text = valores.Horas_Diarias.ToString(); HorasTotalesNR.Text = valores.Horas_Totales.ToString(); FechaInicioNR.Value = valores.Fecha_Inicio; FechaTermNR.Value = valores.Fecha_Final; horainicio = valores.Hora_Inicio; horafin = valores.Hora_Termino; ActividadesNR.Text = valores.Actividades; ProyectoNR.Text = valores.Nombre_Proyecto; } String[] hi = horainicio.Split(':'); String[] ht = horafin.Split(':'); HoraEntradaNR.Text = hi[0]; HoraEntradaNR2.Text = hi[1]; HoraSalidaNR.Text = ht[0]; HoraSalidaNR2.Text = ht[1]; } }
public void Cargar() { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var queryacept = (from e in context.Estudiante join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join av in context.Avance on pg.ID_Programa equals av.ID_Avance where (av.Estado == true && av.Peticion_folio_aceptacion == true && av.Peticion_Carta_Aceptacion != 2) select new FoliosSolicitadoscls { ID = e.ID_Estudiante, Nombre = dp.Nombre1 + " " + dp.Nombre2 + " " + dp.Apellido_Paterno + " " + dp.Apellido_Materno, FolioCarta = av.ID_Aceptacion.ToString(), FechaSolicitud = av.Fecha_Peticion_Folio_Aceptacion.ToString(), }).ToList(); var queryter = (from e in context.Estudiante join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join av in context.Avance on pg.ID_Programa equals av.ID_Avance where (av.Estado == true && av.Peticion_Folio_Carta_Terminacion == true && av.Peticion_Carta_Terminacion != 2) select new FoliosSolicitadoscls { ID = e.ID_Estudiante, Nombre = dp.Nombre1 + " " + dp.Nombre2 + " " + dp.Apellido_Paterno + " " + dp.Apellido_Materno, FolioCarta = av.ID_Terminacion.ToString(), FechaSolicitud = av.Fecha_Peticion_Folio_Carta_Terminacion.ToString(), }).ToList(); foliosAceptacionSolicitadosclsBindingSource.DataSource = queryacept; foliosTerminacionSolicitadosclsBindingSource.DataSource = queryter; } }
private void BtnDatosPersonales_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 0) { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Avance.SingleOrDefault(n => n.ID_Avance == this.ID_Av); if (a != null) { a.Curso_De_Induccion = 1; a.Fecha_Curso_Induccion = null; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); Cargar(); } } if (comboBox1.SelectedIndex == 1) { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Avance.SingleOrDefault(n => n.ID_Avance == this.ID_Av); if (a != null) { a.Curso_De_Induccion = 2; a.Fecha_Curso_Induccion = DateTime.Today; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); Cargar(); } } }
private void ListaJefes_SelectedIndexChanged(object sender, EventArgs e) { if (ListaJefes.SelectedIndex > 0) { ModificarJefeArea.Enabled = true; var a = ((KeyValuePair <string, string>)ListaJefes.SelectedItem).Key; int id = Int32.Parse(a); ID_Jefe = id; using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Jefe_Area.ToList(); foreach (var valores in item.Where(n => n.ID_Jefe_Area == id)) { NomJefeNR.Text = valores.Nombre1_Jefe; NomJefe2NR.Text = valores.Nombre2_Jefe; ApeJefeNR.Text = valores.Apellido_Paterno_Jefe; ApeJefe2NR.Text = valores.Apellido_Materno_Jefe; FichaJefe.Text = valores.Ficha; } ; } } else { ModificarJefeArea.Enabled = false; NomJefeNR.Text = null; NomJefe2NR.Text = null; ApeJefeNR.Text = null; ApeJefe2NR.Text = null; FichaJefe.Text = null; } }
private void BtnGuardarDireccionNR_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (Comprobar() == false) { MessageBox.Show("Faltan Campos Por Llenar"); } else { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Direccion.SingleOrDefault(n => n.ID_Direccion == ID_dir); if (a != null) { a.Calle = CalleNR.Text.Trim(); a.Numero_Interior = NoInteriorNR.Text.Trim(); a.Numero_Exterior = NoExteriorNR.Text.Trim(); a.Colonia = ColoniaNR.Text.Trim(); a.Municipio = MunicipioNR.Text.Trim(); a.Estado = EstadoNR.Text.Trim(); a.Pais = PaisNR.Text.Trim(); a.Codigo_Postal = CodigoPostalNR.Text.Trim(); context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); } } } }
public void LlenarDatosEscolares() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { Dictionary <string, string> diccionario = new Dictionary <string, string>(); var item = context.Escuela.ToList(); diccionario.Add("0", "Seleccione"); foreach (var valores in item) { var nombre = valores.Nombre_Escuela; var id = valores.ID_Escuela; diccionario.Add(id.ToString(), nombre); } ListaEscuela.DataSource = new BindingSource(diccionario, null); ListaEscuela.DisplayMember = "Value"; ListaEscuela.ValueMember = "Key"; ListaEscuela.SelectedValue = ID_esc.ToString(); //// /// Dictionary <string, string> diccionario2 = new Dictionary <string, string>(); var item2 = context.Carrera.ToList(); diccionario2.Add("0", "Seleccione"); foreach (var valores in item2) { var nombre = valores.Nombre_Carrera; var id = valores.ID_Carrera; diccionario2.Add(id.ToString(), nombre); } ListaCarrera.DataSource = new BindingSource(diccionario2, null); ListaCarrera.DisplayMember = "Value"; ListaCarrera.ValueMember = "Key"; ListaCarrera.SelectedValue = ID_car.ToString(); ///// Dictionary <string, string> diccionario3 = new Dictionary <string, string>(); var item3 = context.Encargado_Escuela.ToList(); diccionario3.Add("0", "Seleccione"); foreach (var valores in item3) { var nombre = valores.Nombre1_Encargado + " " + valores.Nombre2_Encargado + " " + valores.Apellido_Paterno + " " + valores.Apellido_Materno; var id = valores.ID_Encargado; diccionario3.Add(id.ToString(), nombre); } ListaEncargado.DataSource = new BindingSource(diccionario3, null); ListaEncargado.DisplayMember = "Value"; ListaEncargado.ValueMember = "Key"; ListaEncargado.SelectedValue = ID_persona.ToString(); } }
private void LlenarTabla(int?a) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var listabusqueda = (from e in context.Estudiante join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join av in context.Avance on pg.ID_Programa equals av.ID_Avance join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join de in context.Datos_Escolares on e.ID_Datos_Escolares equals de.ID_Datos_Escolares join esc in context.Escuela on de.ID_Escuela equals esc.ID_Escuela select new SolicitudFolio { ID = e.ID_Estudiante, FolioAcept = av.ID_Aceptacion.ToString(), Nombre = dp.Nombre1 + " " + dp.Nombre2 + " " + dp.Apellido_Paterno + " " + dp.Apellido_Materno, SolAcept = av.Peticion_folio_aceptacion.ToString(), SolTermn = av.Peticion_Folio_Carta_Terminacion.ToString(), Estado = av.Estado.ToString() }).AsQueryable(); if (a == null) { if (!string.IsNullOrEmpty(TextFolio.Text)) { listabusqueda = listabusqueda.Where(f => f.FolioAcept.Contains(TextFolio.Text.Trim())); dataGridView1.DataSource = listabusqueda.ToList(); } if (!string.IsNullOrEmpty(TextNombre.Text)) { listabusqueda = listabusqueda.Where(n => n.Nombre.Contains(TextNombre.Text.Trim())); dataGridView1.DataSource = listabusqueda.ToList(); } } if (a == 1)//folios aceptacion { listabusqueda = listabusqueda.Where(f => f.SolAcept.Contains("False")); dataGridView1.DataSource = listabusqueda.ToList(); } if (a == 2)//folios terminacion { listabusqueda = listabusqueda.Where(f => f.SolTermn.Contains("False")); dataGridView1.DataSource = listabusqueda.ToList(); } if (dataGridView1.Rows.Count != 0) { panel2.Visible = true; } else { panel2.Visible = false; } } }
private void btnEliminar_Click(object sender, EventArgs e) { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { using (var a = new EliminarReporte(CadenaConexion, ID_EST)) { a.ShowDialog(); } } }
public void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Area.ToList(); foreach (var valores in item.Where(n => n.ID_Area == ID_Area)) { ID_Asesor = valores.ID_Asesor; ID_Jefe = valores.ID_Jefe_Area; } } }
private void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Puerta.ToList(); foreach (var valores in item.Where(n => n.ID_Puerta == ID)) { NomPuerta.Text = valores.Nombre; } } }
public void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Area.ToList(); foreach (var valores in item.Where(n => n.ID_Area == ID_Area)) { ID_Puerta = valores.ID_Puerta; ID_Departamento = valores.ID_Departamento; } } }
private void CargarOrigen() { queryorigen.Clear(); GraficoOrigen.Titles.Clear(); GraficoOrigen.Series.Clear(); using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var entloc = (from e in context.Estudiante join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join dir in context.Direccion on dp.ID_Direccion equals dir.ID_Direccion join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join av in context.Avance on pg.ID_Programa equals av.ID_Avance where (av.Estado == true && dir.ID_Direccion_Renta == null) select e.ID_Estudiante).Count(); var entfor = (from e in context.Estudiante join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join dir in context.Direccion on dp.ID_Direccion equals dir.ID_Direccion join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join av in context.Avance on pg.ID_Programa equals av.ID_Avance where (av.Estado == true && dir.ID_Direccion_Renta != null) select e.ID_Estudiante).Count(); Origencls origenlocal = new Origencls { Lugar = "Local", Cantidad = entloc }; queryorigen.Add(origenlocal); Origencls origenforaneo = new Origencls { Lugar = "Foraneo", Cantidad = entfor }; queryorigen.Add(origenforaneo); } GraficoOrigen.Series.Add("Origen"); GraficoOrigen.Series["Origen"].IsValueShownAsLabel = true; GraficoOrigen.Series["Origen"].ChartType = SeriesChartType.Pie; GraficoOrigen.Titles.Add("Cantidad de estudiantes por origen de procedencia"); if (queryorigen[0].Cantidad > 0) { GraficoOrigen.Series["Origen"].Points.AddXY(queryorigen[0].Lugar, queryorigen[0].Cantidad); } if (queryorigen[1].Cantidad > 0) { GraficoOrigen.Series["Origen"].Points.AddXY(queryorigen[1].Lugar, queryorigen[1].Cantidad); } GraficoOrigen.Palette = ChartColorPalette.SeaGreen; }
private void GuardarExpediente() { int idd, idr; using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var a = new Documentos() { Entrevista = ListaDocumentos[0], Carta_Compromiso = ListaDocumentos[1], Anexo = ListaDocumentos[2], Reglamento = ListaDocumentos[3], Hoja_Renta = ListaDocumentos[4] }; context.Documentos.Add(a); context.SaveChanges(); idd = a.ID_Documentos; } using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var a = new Requisitos() { Carta_Presentacion = ListaRequisitos[0], Carta_Seguro = ListaRequisitos[1], Historial_Academico = ListaRequisitos[2], Fotos = ListaRequisitos[3], Comprobante_Domicilio = ListaRequisitos[4], Acta_Nacimiento = ListaRequisitos[5], Curp = ListaRequisitos[6], Credencial_Escolar = ListaRequisitos[7], Credencial_Elector = ListaRequisitos[8], Carta_Compromiso = ListaRequisitos[9], Cartilla_Servicio = ListaRequisitos[10], }; context.Requisitos.Add(a); context.SaveChanges(); idr = a.ID_Requisitos; } using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var a = new Expediente() { Etiqueta = false, ID_Documentacion = idd, ID_Requisitos = idr }; context.Expediente.Add(a); context.SaveChanges(); ID_Expediente = a.ID_Expediente; } }
private void CadenaConexion() { EntityConnectionStringBuilder ConexionEntity = new EntityConnectionStringBuilder(); ConexionEntity.Provider = "System.Data.SqlClient"; ConexionEntity.ProviderConnectionString = "data source=" + servidor + ";initial catalog=Base_Servicio_Practicas;" + "persist security info=True;user id=sa; password = Pemex2020;MultipleActiveResultSets=True;App=EntityFramework"; ConexionEntity.Metadata = "res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl"; cd = ConexionEntity.ToString(); Base_Servicio_PracticasEntities conexion1 = new Base_Servicio_PracticasEntities(ConexionEntity.ToString()); conexion = conexion1; }
private void LlenarTabla(int?a) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var listabusqueda = (from e in context.Estudiante join pg in context.Programa on e.ID_Programa equals pg.ID_Programa join av in context.Avance on pg.ID_Programa equals av.ID_Avance join dp in context.Datos_Personales on e.ID_Datos_Personales equals dp.ID_Datos_Personales join exp in context.Expediente on e.ID_Expediente equals exp.ID_Expediente select new GeneradorCredenciales { ID = e.ID_Estudiante, FolioAcept = av.ID_Aceptacion.ToString(), Nombre = dp.Nombre1 + " " + dp.Nombre2 + " " + dp.Apellido_Paterno + " " + dp.Apellido_Materno, Credencial = av.Credencial.ToString(), Estado = av.Estado.ToString() }).AsQueryable(); if (a == null) { if (!string.IsNullOrEmpty(TextFolio.Text)) { listabusqueda = listabusqueda.Where(f => f.FolioAcept.Contains(TextFolio.Text.Trim())); dataGridView1.DataSource = listabusqueda.ToList(); } if (!string.IsNullOrEmpty(TextNombre.Text)) { listabusqueda = listabusqueda.Where(n => n.Nombre.Contains(TextNombre.Text.Trim())); dataGridView1.DataSource = listabusqueda.ToList(); } } if (a == 1)//sin credencial entregada { listabusqueda = listabusqueda.Where(f => f.Credencial.Contains("False")); dataGridView1.DataSource = listabusqueda.ToList(); } if (dataGridView1.Rows.Count != 0) { panel2.Visible = true; } else { panel2.Visible = false; } } }
private void GuardarCartaAceptacion() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Avance.SingleOrDefault(n => n.ID_Avance == this.ID_Av); if (a != null) { a.Carta_Aceptacion = true; a.Fecha_Carta_Aceptacion = dateTimePicker1.Value; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); } }
private void EliminarCredencial() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Avance.SingleOrDefault(n => n.ID_Avance == this.ID_Av); if (a != null) { a.Credencial = false; a.Fecha_Credencial = null; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); } }
public void CargarDias() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { IQueryable <FestivosDias> listadias = from d in context.Dias_Festivos orderby d.dia ascending select new FestivosDias { Nombre = d.nombre, Dia = d.dia, }; DiasLista.DataSource = listadias.ToList(); } }
private void EliminarFolioAceptacion() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var a = context.Avance.SingleOrDefault(n => n.ID_Avance == this.ID_Av); if (a != null) { a.ID_Aceptacion = null; context.SaveChanges(); } MessageBox.Show("Modificacion Correcta"); comboBox1.SelectedIndex = -1; } }
private void Calcular_Click(object sender, EventArgs e) { if (ProgramaNR.SelectedIndex == 0) { MessageBox.Show("Seleccione un Programa"); } if (ProgramaNR.SelectedIndex == 1) { var fecha = FechaInicioNR.Value.AddMonths(6); FechaTermNR.Value = fecha.Date; } if (ProgramaNR.SelectedIndex == 2) { if (string.IsNullOrEmpty(HorasDiariasNR.Text) || string.IsNullOrEmpty(HorasTotalesNR.Text)) { MessageBox.Show("Falta llenar horas totales u horas diarias"); } else { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var fecha = FechaInicioNR.Value; int diaslab = Int32.Parse(HorasTotalesNR.Text) / Int32.Parse(HorasDiariasNR.Text); int residuo = Int32.Parse(HorasTotalesNR.Text) % Int32.Parse(HorasDiariasNR.Text); if (residuo != 0) { diaslab = diaslab + 1; } var item = context.Dias_Festivos.ToList(); do { fecha = fecha.AddDays(1); diaslab--; foreach (var valores in item.Where(n => n.dia == fecha.Date)) { diaslab++; } if ((int)fecha.DayOfWeek == 0 || (int)fecha.DayOfWeek == 6) { diaslab++; } } while (diaslab > 1); FechaTermNR.Value = fecha.Date; } } } }
private void BtnInfoCompleta_Click(object sender, EventArgs e) { int?id = GetID(); if (id != null) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { using (var a = new BusquedaAlumno(cadenaconexion, id.GetValueOrDefault())) { a.ShowDialog(); } } } }
private void Button5_Click(object sender, EventArgs e) { int?id = GetID(); if (id != null) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { using (var a = new AsistenciaRegistro(cadenaconexion, id.GetValueOrDefault())) { a.ShowDialog(); } } } }
private void BtnGenerar_Click(object sender, EventArgs e) { int?id = GetID(); if (id != null) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { using (var a = new CartaAceptacion(id.GetValueOrDefault(), cadenaconexion)) { a.ShowDialog(); } } } }
private void BtnEliminarFolio_Click(object sender, EventArgs e) { int?id = GetID(); if (id != null) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { using (var a = new FolioEliminar(cadenaconexion, id.GetValueOrDefault())) { a.ShowDialog(); } } } }
private void EliminarAlumno(int?id) { using (var context = new Base_Servicio_PracticasEntities(cadenaconexion)) { var tablaEstudiante = context.Estudiante.Where(n => n.ID_Estudiante == id).FirstOrDefault(); var tablaDatosEscolares = context.Datos_Escolares.Where(n => n.ID_Datos_Escolares == id).FirstOrDefault(); var tablaArea = context.Area.Where(n => n.ID_Area == id).FirstOrDefault(); var tablaExpediente = context.Expediente.Where(n => n.ID_Expediente == id).FirstOrDefault(); var tablaRequisitos = context.Requisitos.Where(n => n.ID_Requisitos == id).FirstOrDefault(); var tablaDocumentos = context.Documentos.Where(n => n.ID_Documentos == id).FirstOrDefault(); var tablaDatosPersonales = context.Datos_Personales.Where(n => n.ID_Datos_Personales == id).FirstOrDefault(); var tablaTutor = context.Tutor.Where(n => n.ID_Ref == id).FirstOrDefault(); var tablaDireccion = context.Direccion.Where(n => n.ID_Direccion == id).FirstOrDefault(); var tablaPrograma = context.Programa.Where(n => n.ID_Programa == id).FirstOrDefault(); var tablaAvance = context.Avance.Where(n => n.ID_Avance == id).FirstOrDefault(); IQueryable <Reportes> reportesAlumno = context.Reportes.Where(n => n.ID_Avance == id); int?idRenta = null; foreach (var valor in context.Direccion.Where(n => n.ID_Direccion == id)) { idRenta = valor.ID_Direccion_Renta; } if (idRenta != null) { var tablaRenta = context.DireccionRenta.Where(n => n.ID_Renta == idRenta).FirstOrDefault(); context.DireccionRenta.Remove(tablaRenta); } context.Estudiante.Remove(tablaEstudiante); context.Datos_Escolares.Remove(tablaDatosEscolares); context.Area.Remove(tablaArea); context.Expediente.Remove(tablaExpediente); context.Requisitos.Remove(tablaRequisitos); context.Documentos.Remove(tablaDocumentos); context.Datos_Personales.Remove(tablaDatosPersonales); context.Tutor.Remove(tablaTutor); context.Direccion.Remove(tablaDireccion); context.Programa.Remove(tablaPrograma); context.Avance.Remove(tablaAvance); context.Reportes.RemoveRange(reportesAlumno); context.SaveChanges(); } }
private void Cargar() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { var item = context.Datos_Escolares.ToList(); foreach (var valores in item.Where(n => n.ID_Datos_Escolares == ID_datosescolares)) { this.ID_esc = valores.ID_Escuela; this.ID_car = valores.ID_Carrera; this.ID_persona = valores.ID_Persona_Enc; MatriculaNR.Text = valores.Matricula; SemestreTxtbox.Text = valores.Semestre; PromedioNR.Text = valores.Promedio_General.ToString(); } } }