public ActionResult Create(Persona p) { try { // TODO: Add insert logic here string carreraCombo = Request.Form["Carreras"].ToString(); string grupoCombo = Request.Form["Grupos"].ToString(); string sexoCombo = Request.Form["Generos"].ToString(); p.sexo = (sexoCombo.Equals("Masculino")) ? 'H' : 'M'; //asignamos el valor dependiendo del genero Alumno a = new Alumno(); a.idCarrera = DCarrera.ObtenerIdCarreraPNombre(carreraCombo); System.Diagnostics.Debug.WriteLine("ID ALUMNO " + a.idAlumno); System.Diagnostics.Debug.WriteLine("ID CARRERA " + a.idCarrera); a.idGrupo = DGrupo.ObtenerIdGrupoPNombre(grupoCombo); a.Persona = p; System.Diagnostics.Debug.WriteLine(DAlumno.InsertarAlumno(a)); return(RedirectToAction("Index")); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); LlenarViewBagCmb(); return(View()); } }
// GET: Grupo public ActionResult Index() { //Listamos todos los grupos reras en una tabla DataTable dt = DGrupo.ListarGrupos(); return(View(dt)); }
public ActionResult Edit(Persona persona, FormCollection collection) { try { // TODO: Add update logic here string password = Convert.ToString(collection["password"]); string carreraCombo = Request.Form["Carreras"].ToString(); string grupoCombo = Request.Form["Grupos"].ToString(); string sexoCombo = Request.Form["Generos"].ToString(); persona.sexo = (sexoCombo.Equals("Masculino")) ? 'H' : 'M'; //asignamos el valor dependiendo del genero Alumno a = new Alumno(); a.idCarrera = DCarrera.ObtenerIdCarreraPNombre(carreraCombo); a.idGrupo = DGrupo.ObtenerIdGrupoPNombre(grupoCombo); a.idAlumno = Convert.ToInt32(collection["idAlumno"]); a.Persona = persona; System.Diagnostics.Debug.WriteLine(DAlumno.AcutalizarAlumno(a, password)); return(RedirectToAction("Index")); } catch (Exception e) { return(RedirectToAction("Index")); } }
//----------------------------------------------------------------------------------------------- private void seleccionarCurso()//______--------/////////////////////////////////////////////////////////////////// { if (IsPostBack == false) { D_ListarTablaGrupos objNegocioListarTablaGrupos = new D_ListarTablaGrupos(); DGrupo.DataSource = objNegocioListarTablaGrupos.ListarGrupos(); DGrupo.DataTextField = "NombreGrupo"; // DGrupo.DataValueField = "IdGrupo"; DGrupo.DataBind(); } }
public ActionResult Edit(Grupo grupo) { try { // TODO: Add update logic here string carreraCombo = Request.Form["Carreras"].ToString(); grupo.IdCarrera = DCarrera.ObtenerIdCarreraPNombre(carreraCombo); Console.WriteLine(DGrupo.AcutalizarGrupo(grupo)); return(RedirectToAction("Index")); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); return(RedirectToAction("Index")); } }
public ActionResult Create(Grupo grupo) { try { ViewBag.c = DCarrera.ListarCarreras(); //grupo.IdCarrera = DCarrera.ObtenerIdCarreraPNombre(carreraCombo); string msg = DGrupo.InsertarGrupo(grupo); Console.WriteLine(msg); //System.Diagnostics.Debug.WriteLine(DGrupo.InsertarGrupo(grupo)); // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }
public ActionResult Edit(int id) { string genero = ""; int idCarrera; int idGrupo; DataTable dt = DAlumno.ObtenerAlumno(id); if (dt.Rows.Count == 1) { Persona persona = new Persona(); persona.nombre = Convert.ToString(dt.Rows[0][0].ToString()); persona.apPaterno = Convert.ToString(dt.Rows[0][1].ToString()); persona.apMaterno = Convert.ToString(dt.Rows[0][2].ToString()); persona.direccion = Convert.ToString(dt.Rows[0][3].ToString()); persona.codigoPostal = Convert.ToInt32(dt.Rows[0][4].ToString()); persona.telefono = Convert.ToString(dt.Rows[0][5].ToString()); genero = Convert.ToString(dt.Rows[0][6].ToString()); idCarrera = Convert.ToInt32(dt.Rows[0][7].ToString()); idGrupo = Convert.ToInt32(dt.Rows[0][8].ToString()); DataTable dtCarrera = DCarrera.ObtenerCarreraPorId(idCarrera); DataTable dtGrupo = DGrupo.ObtenerGrupoPorId(idGrupo); string _genero = (genero.Equals("H")) ? "Masculino" : "Femenino"; string nombreCarrera = Convert.ToString(dtCarrera.Rows[0][2]); string nombreGrupo = Convert.ToString(dtGrupo.Rows[0][2]);; ViewBag.genero = _genero; ViewBag.idAlumno = Convert.ToString(dt.Rows[0][9].ToString()); ViewBag.nombreCarrera = nombreCarrera; ViewBag.nombreGrupo = nombreGrupo; ViewBag.password = Convert.ToString(dt.Rows[0][10].ToString()); LlenarViewBagCmb(); // este viewbag llenara el dropdown (combobox) return(View(persona)); } else { return(RedirectToAction("Index")); } }
// GET: Grupo/Edit/5 public ActionResult Edit(int id) { DataTable dt = DGrupo.ObtenerGrupo(id); ViewBag.carreras = DCarrera.LlenarCmbCarreras(); // este viewbag llenara el dropdown (combobox) if (dt.Rows.Count == 1) { Grupo grupo = new Grupo(); grupo.IdGrupo = Convert.ToInt32(dt.Rows[0][0].ToString()); grupo.ClaveGrupo = Convert.ToString(dt.Rows[0][1].ToString()); grupo.Nombre = Convert.ToString(dt.Rows[0][2].ToString()); grupo.estatus = Convert.ToInt32(dt.Rows[0][3].ToString()); grupo.IdCarrera = Convert.ToInt32(dt.Rows[0][4].ToString()); return(View(grupo)); } else { return(RedirectToAction("Index")); } }
// GET: Grupo/Delete/5 public ActionResult Delete(int id) { System.Diagnostics.Debug.WriteLine(DGrupo.BajaGrupo(id)); return(RedirectToAction("Index")); }
private void LlenarViewBagCmb() { ViewBag.carreras = DCarrera.LlenarCmbCarreras(); ViewBag.grupos = DGrupo.LlenarCmbGrupos(); ViewBag.sexo = new string[] { "Masculino", "Femenino" }; }