protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Object user = Session["user"];
            if (user != null)
            {
                USUARIO userSesion = (USUARIO)user;
                if (userSesion.INSTITUCIONID != null)
                {
                    //
                    if (userSesion.PERFIL == 2)
                    {
                        menuAdmin.Visible = true;
                        menuNormal.Visible = false;
                    }
                    else
                    {
                        menuNormal.Visible = true;
                        menuAdmin.Visible = false;
                    }

                    INSTITUCION institucion = new INSTITUCION();
                    institucion = institucion.obtainInstitutionById(Int32.Parse(userSesion.INSTITUCIONID.ToString()));
                    if (institucion != null)
                    {
                        Session.Add("institucion", institucion.NOMBRE);
                        lblInsitucion.Text = institucion.NOMBRE;
                    }
                    else
                    {
                        Response.Redirect("Cuenta/Login.aspx");
                    }

                    PROFESOR profesor = new PROFESOR();
                    profesor = profesor.obtainProfesorByUserId(userSesion.USUARIOID);
                    if (profesor != null)
                    {
                        lblNombre.Text = profesor.NOMBRELARGO;
                        lblCedula.Text = profesor.CEDULA;
                        lblNombreCompletoMenuNormal.Text = profesor.NOMBRELARGO;
                        lblCedulaMenuNormal.Text = profesor.CEDULA;
                    }
                    else
                    {
                        Response.Redirect("Cuenta/Login.aspx");
                    }

                }
                else
                {
                    Response.Redirect("Cuenta/Login.aspx");
                }
            }
            else
            {
                Response.Redirect("Cuenta/Login.aspx");
            }
        }
    }
예제 #2
0
    public PROFESOR addProfesor(String nombre, String apellido, String nombreLargo, DateTime fechaNacimiento, String cedula, String genero, int usuarioId, Boolean validate)
    {
        PROFESOR profesor = new PROFESOR();
        List<PROFESOR> profesores = new List<PROFESOR>();
        try
        {
            if (validate)
            {
                profesores = profesor.obtainAllProfesoresByCedula(cedula);
            }

            if (profesores.Count <= 0)
            {

                profesor.PROFESORID = 0;
                profesor.NOMBRE = nombre;
                profesor.APELLIDO = apellido;
                profesor.NOMBRELARGO = nombreLargo;
                profesor.FECHANACIEMIENTO = fechaNacimiento;
                profesor.CEDULA = cedula;
                profesor.GENERO = genero;
                profesor.USUARIOID = usuarioId;

                Datos.PROFESORs.Add(profesor);
                Datos.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            string x = ex.Message;
        }

        return profesor;
    }
예제 #3
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            conexion conec = new conexion();
            string   rango = conec.comprovar(txtusuario.Text, txtcontraseña.Text);

            if (rango == "Padre")
            {
                PADRE form = new PADRE();
                form.CI = conec.ci(txtusuario.Text, txtcontraseña.Text);
                form.Show();
                this.Close();
            }
            else if (rango == "Maestro")
            {
                PROFESOR form = new PROFESOR();
                form.CI = conec.ci(txtusuario.Text, txtcontraseña.Text);
                form.Show();
                this.Close();
            }
            else if (rango == "Director" || rango == "Secretaria")
            {
                DIRECTOR form = new DIRECTOR();
                form.CI = conec.ci(txtusuario.Text, txtcontraseña.Text);
                form.Show();
                this.Close();
            }
            else
            {
                Lusuario.Visible = true;
            }
        }
예제 #4
0
        public IHttpActionResult PutPROFESOR(string id, PROFESOR pROFESOR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pROFESOR.ID_PROFESOR)
            {
                return(BadRequest());
            }

            db.Entry(pROFESOR).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PROFESORExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #5
0
 public HorarioViewModel(PROFESOR Profe, DateTime Dia, DateTime DiaMas7, DateTime DiaMenos7)
 {
     this.Profe     = Profe;
     this.Dia       = Dia;
     this.DiaMas7   = DiaMas7;
     this.DiaMenos7 = DiaMenos7;
 }
예제 #6
0
        public IHttpActionResult PostPROFESOR(PROFESOR pROFESOR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PROFESOR.Add(pROFESOR);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (PROFESORExists(pROFESOR.ID_PROFESOR))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = pROFESOR.ID_PROFESOR }, pROFESOR));
        }
예제 #7
0
        //Editar Datos del profesor
        static public bool EditarDatosProfesor(int id_profesor, PROFESOR profeEditar)
        {
            try
            {
                using (var datos = new bd_webEntities())
                {
                    PROFESOR profesor = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profesor).FirstOrDefault();
                    profesor.CORREO    = profeEditar.CORREO;
                    profesor.CELULAR   = profeEditar.CELULAR;
                    profesor.APELLIDOS = profeEditar.APELLIDOS;
                    profesor.NOMBRES   = profeEditar.NOMBRES;
                    profesor.PROFESION = profeEditar.PROFESION;
                    profesor.FECHA_MOD = profeEditar.FECHA_MOD;
                    profesor.DIRECCION = profeEditar.DIRECCION;


                    datos.SaveChanges();
                }
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
예제 #8
0
    protected void btnEditarProfesor_Click(object sender, EventArgs e)
    {
        String textoValidacion = validarProfesor(true);
        if (textoValidacion.Equals(""))
        {

            USUARIO usuario = new USUARIO();
            usuario = usuario.refreshUser(Convert.ToInt32(lblUsuarioId.Text), txtUsuario.Text, txtClave.Text,
                Convert.ToInt32(lblInstitucionId.Text), Convert.ToInt32(cbPerfil.SelectedItem.Value));

            if (usuario.USUARIOID != 0)
            {
                DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);

                PROFESOR profesor = new PROFESOR();
                profesor.refreshProfesor(Convert.ToInt32(lblProfesorId.Text), txtNombreProfesor.Text, txtApellidoProfesor.Text, txtNombreProfesor.Text + " " + txtApellidoProfesor.Text, fechaNacimiento, txtcedulaProfesor.Text, dlGenero.SelectedValue.ToString(), usuario.USUARIOID);
                cargarProfesores();

                lblSucess.Text = "Se edito Correctamente el Profesor";
                pnlSucess.Visible = true;
            }
            else
            {
                lblError.Text = "Error al editar el Usuario";
                pnlError.Visible = true;
            }

        }
        else
        {
            lblError.Text = textoValidacion;
            pnlError.Visible = true;
        }
    }
예제 #9
0
        public ActionResult EditarProfesor(int id_profe)
        {
            PROFESOR profe = new PROFESOR();

            ProfesorTi.EditarDatosProfesor(id_profe, profe);
            return(View());
        }
예제 #10
0
    public PROFESOR addProfesor(String nombre, String apellido, String nombreLargo, DateTime fechaNacimiento, String cedula, String genero, int usuarioId, Boolean validate)
    {
        PROFESOR        profesor   = new PROFESOR();
        List <PROFESOR> profesores = new List <PROFESOR>();

        try
        {
            if (validate)
            {
                profesores = profesor.obtainAllProfesoresByCedula(cedula);
            }

            if (profesores.Count <= 0)
            {
                profesor.PROFESORID       = 0;
                profesor.NOMBRE           = nombre;
                profesor.APELLIDO         = apellido;
                profesor.NOMBRELARGO      = nombreLargo;
                profesor.FECHANACIEMIENTO = fechaNacimiento;
                profesor.CEDULA           = cedula;
                profesor.GENERO           = genero;
                profesor.USUARIOID        = usuarioId;

                Datos.PROFESORs.Add(profesor);
                Datos.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            string x = ex.Message;
        }

        return(profesor);
    }
예제 #11
0
    protected void btnGuardarProfesor_Click(object sender, EventArgs e)
    {
        pnlError.Visible  = false;
        pnlSucess.Visible = false;

        String textoValidacion = validarProfesor(false);

        if (textoValidacion.Equals(""))
        {
            DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);//InstitucionesUtil.transformaFecha(txtFechaNacimiento.Text);

            USUARIO usuario = guardarUsuario(txtUsuario.Text, txtClave.Text, Convert.ToInt32(cbPerfil.SelectedItem.Value));

            //DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);//InstitucionesUtil.transformaFecha(txtFechaNacimiento.Text);

            PROFESOR profesor = new PROFESOR();
            profesor = profesor.addProfesor(txtNombreProfesor.Text, txtApellidoProfesor.Text, txtNombreProfesor.Text + " " + txtApellidoProfesor.Text, fechaNacimiento, txtcedulaProfesor.Text, dlGenero.SelectedValue.ToString(), usuario.USUARIOID, false);
            cargarProfesores();
            lblSucess.Text    = "Se creo Correctamente el Profesor";
            pnlSucess.Visible = true;
        }
        else
        {
            lblError.Text    = textoValidacion;
            pnlError.Visible = true;
        }
    }
예제 #12
0
    protected void btnEditarProfesor_Click(object sender, EventArgs e)
    {
        String textoValidacion = validarProfesor(true);

        if (textoValidacion.Equals(""))
        {
            USUARIO usuario = new USUARIO();
            usuario = usuario.refreshUser(Convert.ToInt32(lblUsuarioId.Text), txtUsuario.Text, txtClave.Text,
                                          Convert.ToInt32(lblInstitucionId.Text), Convert.ToInt32(cbPerfil.SelectedItem.Value));

            if (usuario.USUARIOID != 0)
            {
                DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);

                PROFESOR profesor = new PROFESOR();
                profesor.refreshProfesor(Convert.ToInt32(lblProfesorId.Text), txtNombreProfesor.Text, txtApellidoProfesor.Text, txtNombreProfesor.Text + " " + txtApellidoProfesor.Text, fechaNacimiento, txtcedulaProfesor.Text, dlGenero.SelectedValue.ToString(), usuario.USUARIOID);
                cargarProfesores();

                lblSucess.Text    = "Se edito Correctamente el Profesor";
                pnlSucess.Visible = true;
            }
            else
            {
                lblError.Text    = "Error al editar el Usuario";
                pnlError.Visible = true;
            }
        }
        else
        {
            lblError.Text    = textoValidacion;
            pnlError.Visible = true;
        }
    }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Object user = Session["user"];
            if (user != null)
            {
                USUARIO userSesion = (USUARIO)user;
                if (userSesion.INSTITUCIONID != null)
                {
                    //
                    if (userSesion.PERFIL == 2)
                    {
                        menuAdmin.Visible  = true;
                        menuNormal.Visible = false;
                    }
                    else
                    {
                        menuNormal.Visible = true;
                        menuAdmin.Visible  = false;
                    }

                    INSTITUCION institucion = new INSTITUCION();
                    institucion = institucion.obtainInstitutionById(Int32.Parse(userSesion.INSTITUCIONID.ToString()));
                    if (institucion != null)
                    {
                        Session.Add("institucion", institucion.NOMBRE);
                        lblInsitucion.Text = institucion.NOMBRE;
                    }
                    else
                    {
                        Response.Redirect("Cuenta/Login.aspx");
                    }

                    PROFESOR profesor = new PROFESOR();
                    profesor = profesor.obtainProfesorByUserId(userSesion.USUARIOID);
                    if (profesor != null)
                    {
                        lblNombre.Text = profesor.NOMBRELARGO;
                        lblCedula.Text = profesor.CEDULA;
                        lblNombreCompletoMenuNormal.Text = profesor.NOMBRELARGO;
                        lblCedulaMenuNormal.Text         = profesor.CEDULA;
                    }
                    else
                    {
                        Response.Redirect("Cuenta/Login.aspx");
                    }
                }
                else
                {
                    Response.Redirect("Cuenta/Login.aspx");
                }
            }
            else
            {
                Response.Redirect("Cuenta/Login.aspx");
            }
        }
    }
        public ActionResult DeleteConfirmed(int id)
        {
            PROFESOR pROFESOR = db.PROFESOR.Find(id);

            db.PROFESOR.Remove(pROFESOR);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID_PROFESOR,NOMBRE_PROFESOR,AP_PROFESOR")] PROFESOR pROFESOR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pROFESOR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pROFESOR));
 }
        public ActionResult Create([Bind(Include = "ID_PROFESOR,NOMBRE_PROFESOR,AP_PROFESOR")] PROFESOR pROFESOR)
        {
            if (ModelState.IsValid)
            {
                db.PROFESOR.Add(pROFESOR);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pROFESOR));
        }
예제 #17
0
        public IHttpActionResult GetPROFESOR(string id)
        {
            PROFESOR pROFESOR = db.PROFESOR.Find(id);

            if (pROFESOR == null)
            {
                return(NotFound());
            }

            return(Ok(pROFESOR));
        }
예제 #18
0
        public PROFESOR DeleteProfesor(string nomina)
        {
            PROFESOR dbEntry = context.PROFESOR.Find(nomina);

            if (dbEntry != null)
            {
                context.PROFESOR.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
예제 #19
0
    private void cargarProfesores()
    {
        PROFESOR        profesor   = new PROFESOR();
        List <PROFESOR> profesores = profesor.obtainAllProfesoresByInstitucionId();

        if (profesores != null && profesores.Count() > 0)
        {
            gridProfesores.DataSource = profesores;
            gridProfesores.DataBind();
        }
        limpiar();
    }
예제 #20
0
    private String validarProfesor(Boolean isEdit)
    {
        if (txtFechaNacimiento.Text.Equals(""))
        {
            return("Complete la Fecha de Nacimiento");
        }
        if (txtNombreProfesor.Text.Equals(""))
        {
            return("Complete el Nombre del Profesor");
        }
        if (txtApellidoProfesor.Text.Equals(""))
        {
            return("Complete el Apellido del Profesor");
        }
        if (txtcedulaProfesor.Text.Equals(""))
        {
            return("Complete la cedula del Profesor");
        }
        if (txtUsuario.Text.Equals(""))
        {
            return("Complete el usuario");
        }
        if (txtClave.Text.Equals("") && !isEdit)
        {
            return("Complete la Clave");
        }
        if (lblInstitucionId.Text.Equals("") || lblInstitucionId.Text.Equals("0"))
        {
            return("Ocurrio un error en el id de la Institucion");
        }
        if ((lblProfesorId.Text.Equals("") || lblProfesorId.Text.Equals("0")) && isEdit)
        {
            return("Ocurrio un error en el id de la Profesor");
        }

        USUARIO        usuario = new USUARIO();
        List <USUARIO> users   = usuario.obtainUserByUserName(txtUsuario.Text);

        if (users.Count > 0 && !isEdit)
        {
            return("Ya existe el nombre del usuario");
        }

        PROFESOR        profesor   = new PROFESOR();
        List <PROFESOR> profesores = profesor.obtainAllProfesoresByCedula(txtcedulaProfesor.Text);

        if (profesores.Count > 0 && !isEdit)
        {
            return("Ya existe un Profesor con esa cedula");
        }
        return("");
    }
예제 #21
0
        public IHttpActionResult DeletePROFESOR(string id)
        {
            PROFESOR pROFESOR = db.PROFESOR.Find(id);

            if (pROFESOR == null)
            {
                return(NotFound());
            }

            db.PROFESOR.Remove(pROFESOR);
            db.SaveChanges();

            return(Ok(pROFESOR));
        }
예제 #22
0
        public ActionResult Guardar(string rut, string nombre, string titulo, string grado)
        {
            PROFESOR profe = new PROFESOR()
            {
                rut    = rut,
                nombre = nombre,
                titulo = titulo,
                grado  = grado
            };

            cnx.PROFESORs.Add(profe);
            cnx.SaveChanges();
            return(View("Listado", ListadoProfesores()));
        }
        // GET: PROFESORs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PROFESOR pROFESOR = db.PROFESOR.Find(id);

            if (pROFESOR == null)
            {
                return(HttpNotFound());
            }
            return(View(pROFESOR));
        }
예제 #24
0
        public ActionResult Ficha(string rut, string nombre, string titulo, string grado)
        {
            PROFESOR profe = new PROFESOR()
            {
                Rut    = rut,
                Nombre = nombre,
                Titulo = titulo,
                Grado  = grado
            };

            cnx.PROFESOR.Add(profe);
            cnx.SaveChanges();
            return(View(profe));
        }
예제 #25
0
 public object Register(PROFESOR model)
 {
     try
     {
         using (var ctx = new AdminContext())
         {
             ctx.Entry(model).State = System.Data.Entity.EntityState.Added;
             return(ctx.SaveChanges());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #26
0
 //Seleccionar o buscar a un profesor por su ID
 static public PROFESOR SelectProfesor(int id_profe)
 {
     try
     {
         PROFESOR profesorSelect = new PROFESOR();
         using (var datos = new bd_webEntities())
         {
             profesorSelect = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profe).FirstOrDefault();
         }
         return(profesorSelect);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
예제 #27
0
    public int deleteProfesor(int profesorId, int userId)
    {
        int      result         = 0;
        PROFESOR profesorDelete = obtainProfesorById(profesorId);

        if (profesorDelete != null)
        {
            Datos.PROFESORs.Remove(profesorDelete);
            result = Datos.SaveChanges();
        }

        USUARIO user = new USUARIO();

        user.deleteUser(userId);

        return(result);
    }
 public ActionResult Edit([Bind(Include = "ID_PROFESOR,NOMBRE1,NOMBRE2,APELLIDO1,APELLIDO2,CALLE,NO_EXTERIOR,NO_INTERIOR,LADA,TELEFONO,FECHA_NACIMIENTO,RFC,HORAS_SEMANALES,FIRMA")] PROFESOR pROFESOR)
 {
     try {
         if (ModelState.IsValid)
         {
             pROFESOR.HORAS_SEMANALES = Convert.ToInt32(Session["horasSemana"]);
             db.Entry(pROFESOR).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(pROFESOR));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("NoConect", "Home"));
     }
 }
        public ActionResult Create([Bind(Include = "ID_PROFESOR,NOMBRE1,NOMBRE2,APELLIDO1,APELLIDO2,CALLE,NO_EXTERIOR,NO_INTERIOR,LADA,TELEFONO,FECHA_NACIMIENTO,RFC,HORAS_SEMANALES,FIRMA")] PROFESOR pROFESOR)
        {
            if (ModelState.IsValid)
            {
                try {
                    db.PROFESOR.Add(pROFESOR);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception Ex)
                {
                    return(RedirectToAction("NoConect", "Home"));
                }
            }

            return(View(pROFESOR));
        }
예제 #30
0
 //Eliminar al profesor por su id
 static public bool EliminarProfesor(int id_profesor)
 {
     try
     {
         using (var datos = new bd_webEntities())
         {
             PROFESOR profe = datos.PROFESORs.Where(ss => ss.ID_PROFESOR == id_profesor).FirstOrDefault();
             datos.PROFESORs.Remove(profe);
             datos.SaveChanges();
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
예제 #31
0
    private void editarProfesorUsuario(int profesorId)
    {
        PROFESOR profesor = new PROFESOR();

        profesor = profesor.obtainProfesorById(profesorId);

        txtNombreProfesor.Text   = profesor.NOMBRE;
        txtApellidoProfesor.Text = profesor.APELLIDO;
        txtcedulaProfesor.Text   = profesor.CEDULA;
        dlGenero.SelectedValue   = profesor.GENERO;
        txtFechaNacimiento.Text  = InstitucionesUtil.transformaFecha(profesor.FECHANACIEMIENTO.ToString());
        txtUsuario.Text          = profesor.USUARIO.NOMBRE;
        txtClave.Text            = profesor.USUARIO.CLAVE;
        cbPerfil.SelectedValue   = profesor.USUARIO.PERFIL.ToString();
        lblUsuarioId.Text        = profesor.USUARIO.USUARIOID.ToString();
        edit();
    }
예제 #32
0
 public object Delete(PROFESOR model)
 {
     try
     {
         using (var ctx = new AdminContext())
         {
             var entry = ctx.Profesores.Where(e => e.ID == model.ID).First();
             ctx.Entry(entry).State = System.Data.Entity.EntityState.Deleted;
             var ctxs = ctx.SaveChanges();
             return(ctx.SaveChanges());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #33
0
        //Agregar profesor
        static public bool AgregarProfesor(PROFESOR ProfesorAdd)
        {
            try
            {
                using (var datos = new bd_webEntities())
                {
                    datos.PROFESORs.Add(ProfesorAdd);
                    datos.SaveChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
예제 #34
0
    protected void btnEliminarProfesor_Click(object sender, EventArgs e)
    {
        String textoValidacion = validarProfesor(true);
        if (textoValidacion.Equals(""))
        {
            PROFESOR profesor = new PROFESOR();
            profesor.deleteProfesor(Convert.ToInt32(lblProfesorId.Text), Convert.ToInt32(lblUsuarioId.Text));

            USUARIO usuario = new USUARIO();
            usuario.deleteUser(Convert.ToInt32(lblUsuarioId.Text));

            cargarProfesores();

            lblSucess.Text = "Se elimino Correctamente el Profesor";
            pnlSucess.Visible = true;

        }
        else
        {
            lblError.Text = textoValidacion;
            pnlError.Visible = true;
        }
    }
예제 #35
0
    protected void btnGuardarProfesor_Click(object sender, EventArgs e)
    {
        pnlError.Visible = false;
        pnlSucess.Visible = false;

        String textoValidacion = validarProfesor(false);
        if (textoValidacion.Equals(""))
        {
            DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);//InstitucionesUtil.transformaFecha(txtFechaNacimiento.Text);

            USUARIO usuario = guardarUsuario(txtUsuario.Text, txtClave.Text, Convert.ToInt32(cbPerfil.SelectedItem.Value));

            //DateTime fechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text);//InstitucionesUtil.transformaFecha(txtFechaNacimiento.Text);

            PROFESOR profesor = new PROFESOR();
            profesor = profesor.addProfesor(txtNombreProfesor.Text, txtApellidoProfesor.Text, txtNombreProfesor.Text + " " + txtApellidoProfesor.Text, fechaNacimiento, txtcedulaProfesor.Text, dlGenero.SelectedValue.ToString(), usuario.USUARIOID, false);
            cargarProfesores();
            lblSucess.Text = "Se creo Correctamente el Profesor";
            pnlSucess.Visible = true;
        }
        else
        {
            lblError.Text = textoValidacion;
            pnlError.Visible = true;
        }
    }
예제 #36
0
    private String validarProfesor(Boolean isEdit)
    {
        if (txtFechaNacimiento.Text.Equals(""))
        {
            return "Complete la Fecha de Nacimiento";
        }
        if (txtNombreProfesor.Text.Equals(""))
        {
            return "Complete el Nombre del Profesor";
        }
        if (txtApellidoProfesor.Text.Equals(""))
        {
            return "Complete el Apellido del Profesor";
        }
        if (txtcedulaProfesor.Text.Equals(""))
        {
            return "Complete la cedula del Profesor";
        }
        if (txtUsuario.Text.Equals(""))
        {
            return "Complete el usuario";
        }
        if (txtClave.Text.Equals("") && !isEdit)
        {
            return "Complete la Clave";
        }
        if (lblInstitucionId.Text.Equals("") || lblInstitucionId.Text.Equals("0"))
        {
            return "Ocurrio un error en el id de la Institucion";
        }
        if ((lblProfesorId.Text.Equals("") || lblProfesorId.Text.Equals("0")) && isEdit)
        {
            return "Ocurrio un error en el id de la Profesor";
        }

        USUARIO usuario = new USUARIO();
        List<USUARIO> users = usuario.obtainUserByUserName(txtUsuario.Text);
        if (users.Count > 0 && !isEdit)
        {
            return "Ya existe el nombre del usuario";
        }

        PROFESOR profesor = new PROFESOR();
        List<PROFESOR> profesores = profesor.obtainAllProfesoresByCedula(txtcedulaProfesor.Text);
        if (profesores.Count > 0 && !isEdit)
        {
            return "Ya existe un Profesor con esa cedula";
        }
        return "";
    }
예제 #37
0
    private void editarProfesorUsuario(int profesorId)
    {
        PROFESOR profesor = new PROFESOR();
        profesor = profesor.obtainProfesorById(profesorId);

        txtNombreProfesor.Text = profesor.NOMBRE;
        txtApellidoProfesor.Text = profesor.APELLIDO;
        txtcedulaProfesor.Text = profesor.CEDULA;
        dlGenero.SelectedValue = profesor.GENERO;
        txtFechaNacimiento.Text = InstitucionesUtil.transformaFecha(profesor.FECHANACIEMIENTO.ToString());
        txtUsuario.Text = profesor.USUARIO.NOMBRE;
        txtClave.Text = profesor.USUARIO.CLAVE;
        cbPerfil.SelectedValue = profesor.USUARIO.PERFIL.ToString();
        lblUsuarioId.Text = profesor.USUARIO.USUARIOID.ToString();
        edit();
    }
예제 #38
0
 private void cargarProfesores()
 {
     PROFESOR profesor = new PROFESOR();
     List<PROFESOR> profesores = profesor.obtainAllProfesoresByInstitucionId();
     if (profesores != null && profesores.Count() > 0)
     {
         gridProfesores.DataSource = profesores;
         gridProfesores.DataBind();
     }
     limpiar();
 }