コード例 #1
0
        public static string Insertar(string nombre)
        {
            DCarrera Obj = new DCarrera();

            Obj.Nombre = nombre;
            return(Obj.Insertar(Obj));
        }
コード例 #2
0
        public ActionResult Index()
        {
            //Listamos todas las carreras en una tabla
            DataTable CarrerList = DCarrera.ListarCarreras();

            return(View(CarrerList));
        }
コード例 #3
0
        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());
            }
        }
コード例 #4
0
        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"));
            }
        }
コード例 #5
0
        public static string Editar(int idcarrera, string nombre)
        {
            DCarrera Obj = new DCarrera();

            Obj.IdCarrera = idcarrera;
            Obj.Nombre    = nombre;
            return(Obj.Editar(Obj));
        }
コード例 #6
0
        public static DataTable buscar_nombre(string texto_buscar)
        {
            DCarrera carrera = new DCarrera();

            carrera.Textobuscar = texto_buscar;

            return(carrera.buscar_nombre(carrera));
        }
コード例 #7
0
        public static string eliminar(string idcarrera)
        {
            DCarrera carrera = new DCarrera();

            carrera.Idcarrera = idcarrera;

            return(carrera.eliminar(carrera));
        }
コード例 #8
0
        public static string insertar(string idcarrera, string nombre_carrera)
        {
            DCarrera carrera = new DCarrera();

            carrera.Idcarrera      = idcarrera;
            carrera.Nombre_carrera = nombre_carrera;

            return(carrera.insertar(carrera));
        }
コード例 #9
0
 public ActionResult Create(Carrera carrera)
 {
     try
     {
         // TODO: Add insert logic here
         Console.WriteLine(DCarrera.InsertarCarrera(carrera));
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #10
0
 public ActionResult Edit(Carrera carrera)
 {
     try
     {
         // TODO: Add update logic here
         Console.WriteLine(DCarrera.AcutalizarCarrera(carrera));
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e);
         return(View());
     }
 }
コード例 #11
0
        // GET: Carrera/Edit/5
        public ActionResult Edit(int id)
        {
            DataTable dtCarrera = DCarrera.ObtenerCarreraPorId(id);

            if (dtCarrera.Rows.Count == 1)
            {
                Carrera carrera = new Carrera();
                carrera.IdCarrera    = Convert.ToInt32(dtCarrera.Rows[0][0].ToString());
                carrera.ClaveCarrera = Convert.ToString(dtCarrera.Rows[0][1].ToString());
                carrera.Nombre       = Convert.ToString(dtCarrera.Rows[0][2].ToString());
                return(View(carrera));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #12
0
        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"));
            }
        }
コード例 #13
0
        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"));
            }
        }
コード例 #14
0
        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"));
            }
        }
コード例 #15
0
        // 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"));
            }
        }
コード例 #16
0
 // GET: Grupo/Create
 public ActionResult Create()
 {
     ViewBag.carreras = DCarrera.LlenarCmbCarreras();
     ViewBag.c        = DCarrera.listCarrera();
     return(View(new Grupo()));
 }
コード例 #17
0
 // GET: Carrera/Delete/5
 public ActionResult Delete(int id)
 {
     System.Diagnostics.Debug.WriteLine(DCarrera.BajaCarrera(id));
     return(RedirectToAction("Index"));
 }
コード例 #18
0
 private void LlenarViewBagCmb()
 {
     ViewBag.carreras = DCarrera.LlenarCmbCarreras();
     ViewBag.grupos   = DGrupo.LlenarCmbGrupos();
     ViewBag.sexo     = new string[] { "Masculino", "Femenino" };
 }
コード例 #19
0
        public static DataTable mostrar()
        {
            DCarrera carrera = new DCarrera();

            return(carrera.mostrar());
        }