protected void GetStudents()
        {
            List <Estudiante> students = new GetBusinessLogic().GetStudents();

            GridView1.DataSource = students;
            GridView1.DataBind();
        }
Esempio n. 2
0
        protected void GetTeachers()
        {
            List <Profesor> teachers = new GetBusinessLogic().GetTeachers();

            GridView1.DataSource = teachers;
            GridView1.DataBind();
        }
        protected void ButtonS_Click(object sender, EventArgs e)
        {
            Materia materia = new GetBusinessLogic().GetMateriaByName(Materiatxt.Text);

            if (materia != null)
            {
                Response.Write("<script> alert('Ya hay una materia creada con este nombre. Valide por favor.')</script>");
                return;
            }

            try
            {
                int assignatureCreated = new CreateBusinessLogic().CreateAssignature(Materiatxt.Text);

                if (assignatureCreated == 0)
                {
                    Response.Write("<script> alert('La materia no ha podido ser creada')</script>");
                    return;
                }
                Materiatxt.Text = string.Empty;
                Response.Write("<script> alert('La materia se ha creado exitosamente. ')</script>");
                Response.AddHeader("REFRESH", "3;CrearMateria.aspx");
            }
            catch (Exception ex)
            {
                Response.Write($"<script> Console.log({ex.Message}, {ex.InnerException},{ex.Source})</script>");
                Response.Write("<script> alert('Ha ocurrido un error intentelo más tarde. ')</script>");
            }
        }
Esempio n. 4
0
        protected void GetAssignatures()
        {
            List <Materia> assignatures = new GetBusinessLogic().GetAssignaturesByTeacher(Session["Usuario"].ToString());

            DdlMateria.DataSource     = assignatures;
            DdlMateria.DataValueField = "idMateria";
            DdlMateria.DataTextField  = "nombreMateria";
            DdlMateria.DataBind();
            DdlMateria.Items.Insert(0, new ListItem("Seleccione", "0", true));
        }
        protected void EditProfesor()
        {
            int IdProfesor = Convert.ToInt32(Request.QueryString["IdProfesor"]);

            Profesor profesor = new GetBusinessLogic().GetTeacher(IdProfesor);

            txtCedula.Text   = profesor.Cedula.ToString();
            txtNombre.Text   = profesor.Nombres;
            txtApellido.Text = profesor.Apellidos;
        }
        protected void EditStudent()
        {
            int idStudent = Convert.ToInt32(Request.QueryString["IdEstudiante"]);

            Estudiante estudiante = new GetBusinessLogic().GetStudent(idStudent);

            txtCedula.Text   = estudiante.Cedula.ToString();
            txtNombre.Text   = estudiante.Nombres;
            txtApellido.Text = estudiante.Apellidos;
        }
Esempio n. 7
0
        private void GetAssignatures()
        {
            List <Materia> assignatures = new GetBusinessLogic().GetAssignaturesList();

            DdlMateria.DataSource     = assignatures;
            DdlMateria.DataValueField = "idMateria";
            DdlMateria.DataTextField  = "nombreMateria";
            DdlMateria.DataBind();
            DdlMateria.Items.Insert(0, new ListItem("Seleccione", "0", true));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Estudiante student = new GetBusinessLogic().GetStudent(Convert.ToInt32(Request.QueryString["IdEstudiante"]));

            NameLabel.Text = $"Estudiante: {student.Nombres} {student.Apellidos}";
            if (!IsPostBack)
            {
                GetAssignatures();
            }
        }
Esempio n. 9
0
        private void GetTemplates()
        {
            List <EstiloTemplate> templates = new GetBusinessLogic().GetTemplatesList();

            foreach (EstiloTemplate template in templates)
            {
                ListThemes.Items.Add(new ListItem(
                                         $"<img class='size' src='data: image / jpg; base64,{template.ImagenTemplate}' />",
                                         template.CodigoTemplate.ToString()));
            }
        }
Esempio n. 10
0
        protected void ButtonSave_Click1(object sender, EventArgs e)
        {
            Usuario usuario = new GetBusinessLogic().GetUser(Usuariotxt.Text);

            if (usuario != null)
            {
                Response.Write("<script> alert('Ya hay un usuario o un profesor con está cedula en el sistema. Valide por favor.')</script>");
                return;
            }

            try
            {
                int userCreated = CreateUsuario();

                if (userCreated == 0)
                {
                    Response.Write("<script> alert('El usuario no ha podido ser creado')</script>");
                    return;
                }

                int resultSaving = 0;

                switch (DdlUserType.SelectedValue)
                {
                case "2":
                    resultSaving = CreateStudent(userCreated);
                    break;

                case "3":
                    resultSaving = CreateTeacher(userCreated);
                    break;

                default:
                    Response.Write("<script> alert('Este tipo de usuario no existe.')</script>");
                    break;
                }

                if (resultSaving == 0)
                {
                    Response.Write("<script> alert('El usuario no ha podido ser creado')</script>");
                    return;
                }

                Response.Write("<script> alert('El usuario se ha creado exitosamente. ')</script>");
                Response.AddHeader("REFRESH", "1;CreateUser.aspx");
            }
            catch (Exception ex)
            {
                Response.Write($"<script> Console.log({ex.Message}, {ex.InnerException},{ex.Source})</script>");
                Response.Write("<script> alert('Ha ocurrido un error intentelo más tarde. ')</script>");
            }
        }
Esempio n. 11
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            string  username = txtUsuario.Text;
            string  password = txtClave.Text;
            Usuario usuario  = new GetBusinessLogic().LoginUser(username, password);

            if (usuario == null)
            {
                Response.Write("<script> alert('Verifique los datos. El usuario y/o contraseña son incorrectos.')</script>");
                Session["Usuario"] = ErrorPage;
                return;
            }

            Session["Usuario"]          = txtUsuario.Text;
            Session["Clave"]            = txtClave.Text;
            Session["TipoUser"]         = usuario.TipoUser.ToString();
            Session["Avatar"]           = usuario.Avatar;
            Session["FkCodigoTemplate"] = usuario.FKCodigoTemplate.ToString();

            Redirect(usuario.TipoUser);
        }