protected void ButtonSave_Click(object sender, EventArgs e) { try { int notesCreated = new CreateBusinessLogic().CreateNotes(new Notas { Nota1 = null, Nota2 = null, FKIdMateria = Convert.ToInt32(DdlMateria.SelectedValue), FKIdEstudiante = Convert.ToInt32(Request.QueryString["IdEstudiante"]) }); if (notesCreated == 0) { Response.Write("<script> alert('No se ha podido asignar la materia al estudiante ')</script>"); return; } } catch (Exception ex) { Response.Write("<script> alert('No se ha podido asignar la materia al estudiante ')</script>"); } Response.Write("<script> alert('El estudiante se le ha asignado la materia exitosamente.')</script>"); Response.AddHeader("REFRESH", "1;ListaEstudiantes.aspx"); }
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>"); } }
protected int CreateStudent(int idUser) { int studentCreated = new CreateBusinessLogic().CreateStudent(new Estudiante { Cedula = Convert.ToInt64(Cedulatxt.Text), Nombres = Nombrestxt.Text, Apellidos = Apellidostxt.Text, FKUsuario = idUser, }); return(studentCreated); }
protected int CreateTeacher(int idUser) { int teacherCreated = new CreateBusinessLogic().CreateTeacher(new Profesor { Cedula = Convert.ToInt64(Cedulatxt.Text), Nombres = Nombrestxt.Text, Apellidos = Apellidostxt.Text, FKUsuario = idUser, FkIdMateria = Convert.ToInt32(DdlMateria.SelectedValue) }); return(teacherCreated); }
protected int CreateUsuario() { int userCreated = new CreateBusinessLogic().CreateUser(new Usuario { Username = Usuariotxt.Text, Contraseña = Clavetxt.Text, TipoUser = Convert.ToInt32(DdlUserType.SelectedValue), Avatar = Convert.ToBase64String(ThumnailImage()), FKCodigoTemplate = Convert.ToInt32(ListThemes.SelectedValue) }); return(userCreated); }