private void LlenarCarrera()
        {
            ControllerAlumno  CtrlAsignarC = new ControllerAlumno();
            List <TblCarrera> carrera      = CtrlAsignarC.ConsultaCarrera();

            ddlCarrera.Items.Add("Seleccionar");
            ddlCarrera.DataSource     = carrera;
            ddlCarrera.DataValueField = "id";
            ddlCarrera.DataTextField  = "strNombre";
            ddlCarrera.DataBind();
        }
        private void LlenarCuatri()
        {
            ControllerAlumno CtrlAsignarCuatri = new ControllerAlumno();
            List <TblCuatri> cuatri            = CtrlAsignarCuatri.ConsultaCuatri();

            ddlCuatri.Items.Add("Seleccionar");
            ddlCuatri.DataSource     = cuatri;
            ddlCuatri.DataValueField = "id";
            ddlCuatri.DataTextField  = "strNombre";
            ddlCuatri.DataBind();
        }
        protected void btnAceptarAgregar_Click(object sender, EventArgs e)
        {
            var sex     = cmbSexo.SelectedItem.Value;
            var carrera = ddlCarrera.SelectedValue;
            var cuatri  = ddlCuatri.SelectedValue;
            var grupo   = ddlGrupo.SelectedValue;

            if (FotoAlumno.HasFile)
            {
                string path = Server.MapPath("~/images/AlumRegistrado/" + FotoAlumno.FileName);
                FotoAlumno.SaveAs(path);

                TblAlumno alum = new TblAlumno();
                alum.strNombre    = txtNombreAgregar.Text.ToUpper();
                alum.strApellidoP = txtPaternoAgregar.Text.ToUpper();
                alum.strApellidoM = txtMaternoAgregar.Text.ToUpper();
                alum.intEdad      = Int32.Parse(txtEdadAgregar.Text);
                alum.strSexo      = sex;
                alum.strCorreo    = txtCorreoAgregar.Text;
                alum.bitFoto      = path;
                alum.idCarrera    = int.Parse(carrera);
                alum.idCuatri     = int.Parse(cuatri);
                alum.idGrupo      = int.Parse(grupo);

                var maximo = (from max in contexto.TblGrupo
                              where max.id == Convert.ToInt32(ddlGrupo.SelectedValue)
                              select max.strCapacidad).FirstOrDefault();

                var cuenta = (from cue in contexto.TblAlumno
                              where cue.idGrupo == Convert.ToInt32(ddlGrupo.SelectedValue) &&
                              cue.idCarrera == Convert.ToInt32(ddlCarrera.SelectedValue)
                              select cue.idGrupo).Count();

                var cuenta1 = cuenta + 1;
                if (maximo >= cuenta1)
                {
                    ControllerAlumno ctrlAlum = new ControllerAlumno();
                    ctrlAlum.InsertarAlum(GetDatosVista(alum));
                    alertBien.Visible = true;
                }
                else
                {
                    alertError.Visible = true;
                }
            }
            this.Response.Redirect("./Alumnosadmin.aspx", true);
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (FileUPArchivo.HasFile)
            {
                string path = Server.MapPath("~/images/AlumRegistrado/" + FileUPArchivo.FileName);
                FileUPArchivo.SaveAs(path);

                DateTime fechact = DateTime.Now;

                TblJustificante just = new TblJustificante();
                just.strMotivo  = txtMotivo.Text.ToUpper();
                just.fechaJusti = DateTime.Parse(fechajus.Text);
                just.strArchivo = path;
                just.fecha      = fechact;
                ControllerAlumno ctrlAlum = new ControllerAlumno();
                ctrlAlum.InsertarJusticante(just);
            }
            this.Response.Redirect("./PrincipalAlumno.aspx", true);
        }
Example #5
0
        protected void BtnEditar_Click(object sender, EventArgs e)
        {
            TblAlumno alum = new TblAlumno();

            alum.id = Convert.ToInt32(Session["id"]);
            if (TxtCorreo.Text.Length > 1)
            {
                alum.strCorreo = TxtCorreo.Text;
            }
            else
            {
                alum.strCorreo = lbcorreo.Text;
            }

            TblTelefono tel = new TblTelefono();

            tel.id = Convert.ToInt32(Session["forTel"]);
            if (TxtCelular.Text.Length > 1)
            {
                tel.strcelular = TxtCelular.Text;
            }
            else
            {
                tel.strcelular = lbCelular.Text;
            }
            if (TxtTelefono.Text.Length > 1)
            {
                tel.strtelCasa = TxtTelefono.Text;
            }
            else
            {
                tel.strtelCasa = lbTelefono.Text;
            }
            if (TxtOtro.Text.Length > 1)
            {
                tel.strotro = TxtOtro.Text;
            }
            else
            {
                tel.strotro = lbOtro.Text;
            }

            TblDireccion dom = new TblDireccion();

            dom.id = Convert.ToInt32(Session["forDom"]);
            if (TxtCalle.Text.Length > 1)
            {
                dom.strcalle = TxtCalle.Text;
            }
            else
            {
                dom.strcalle = lbCalle.Text;
            }
            if (TxtColonia.Text.Length > 1)
            {
                dom.strcolonia = TxtColonia.Text;
            }
            else
            {
                dom.strcolonia = lbColonia.Text;
            }
            if (TxtMunicipio.Text.Length > 1)
            {
                dom.strmunicipio = TxtMunicipio.Text;
            }
            else
            {
                dom.strmunicipio = lbMunicipio.Text;
            }
            ControllerAlumno ctrlAlum = new ControllerAlumno();

            ctrlAlum.Editar(alum, tel, dom);
            this.Response.Redirect("./DatosPersonales.aspx", true);
        }