Post on 01-Feb-2018
LENGUAJE DE PROGRAMACIÓN 3
SISTEMA DE MATRÍCULA DE LA FIIS DE LA UNIVERSIDAD NACIONAL DEL CALLAO v1.1
Integrantes:
Aguilar Chávez, Fernando 062713AFano Martel, Bayron 062088JMurillo Humbert, Christopher 062086GValles Velásquez, Jorge 064236F
Agregamos un MasterPage al proyecto:
Luego creamos una tabla y dentro contenemos al Master. Agregamos un Menú y un TreeView dentro de Exploración.
Iniciamos explicando el diseño; los banners que se parecía son realizados en http://www.bannersnack.com/, uno se loguea y realiza el banner de forma gratuita descargando sólo el código que se colocará en el proyecto, necesitamos conexión a internet.
www.bannersnack.com/
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQxNjgxMTA3MyZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=3b7145070b713065a61446d2cb212157&bgcolor=141414' width='728' height='90'><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=3b7145070b713065a61446d2cb212157&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript>
Insertamos un nuevo WebForm “bienvenidos”, que sea seleccionado con el MasterPage.
De la misma manera otros llamados:
Mision, vision, administracion, usuario, verificacionmatricula, consultadenotas, programacionhoraria, ingresarimprimir.
Editamos el Menu y el TreeView “Editar elementos del menú”
Agregamos los nodos necesarios, y luego en “NavigateUrl” colocamos el nombre del WebForm correspondiente, de igual manera en el TreeView.
Menú Inicio:
Dentro insertamos una tabla y en el código HTML, insertamos la dirección que nos brindó http://www.bannersnack.com/ para que aparezcan los banners de bienvenida.
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQxOTc5OTIzNSZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=3f005bdf0991f99efe7d751dbb212185&bgcolor=141414' width='435' height='150'><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?
hash_id=3f005bdf0991f99efe7d751dbb212185&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript>
Menú Misión
Menú Visión
Menú Administrador
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQxNzgyODMxMyZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=1ca3873ed9756a036abded860b212163&bgcolor=141414' width='435' height='75'><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?
Insertamos una tabla, agregamos otro banner de internet y realizamos el diseño con las herramientas
hash_id=1ca3873ed9756a036abded860b212163&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript>
Codificamos las funciones a realizar por los botones interactuando con la BD “BD_MATRICULA_UNAC” con la tabla Administrador, de cumplir el nombre y contraseña nos re direcciona al Webform “Mantenimiento”
Imports System.DataImports System.Data.SqlClientPartial Class administrador Inherits System.Web.UI.Page Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select * from auto", cnx) Public dst As New DataSet Public cmd As New SqlCommand Public Sub CmdAceptar_Click() If txtnombreadmin.Text = "" And txtcontraseñaadmin.Text = "" Then MsgBox("Ingrese Datos", MsgBoxStyle.Critical, " ::: Sistema ::: ")
End If
dap.SelectCommand.CommandText = "SELECT * FROM Administrador WHERE usuario='" & txtnombreadmin.Text & "' and contraseña='" & txtcontraseñaadmin.Text & "'" dap.Fill(dst, "dat") If dst.Tables("dat").Rows.Count = 0 Then MsgBox("Datos Incorrectos", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtnombreadmin.Text = "" txtcontraseñaadmin.Text = "" : txtcontraseñaadmin.Focus() Response.Redirect("administrador.aspx") End If dst.Tables("dat").Clear() Response.Redirect("mantenimiento.aspx?codigo=" & Me.txtnombreadmin.Text) End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub btningresar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btningresar.Click CmdAceptar_Click()
End Sub
Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click Response.Redirect("administrador.aspx") End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
En el WebForm “Mantenimiento” también ingresamos un banner, una tabla y realizamos el diseño
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQxNjgxMTA3MyZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-
flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=3b7145070b713065a61446d2cb212157&bgcolor=141414' height='90' style="width: 722px"><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=3b7145070b713065a61446d2cb212157&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript>
Para seguir con el trabajo, hemos realizado la clase llamada “Clsmatricula” donde se ocncentra el flujo de los datos a ingresar, mostrar eliminar, etc.
Imports System.DataImports System.Data.SqlClient
Public Class Clsmatricula Public Function CursoListar() As DataTable Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("conexion")) Dim Dap As New SqlDataAdapter("usp_Curso_Listar", Cnx) Dim dst As New DataSet Dap.Fill(dst, "cursos") Return dst.Tables("cursos") End Function
Public Function NotasListar() As DataTable Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("conexion")) Dim Dap As New SqlDataAdapter("usp_Notas_Listar", Cnx) Dim dst As New DataSet Dap.Fill(dst, "notas") Return dst.Tables("notas") End Function
Public Function ProfesorListar() As DataTable Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("conexion"))
CREATE PROCEDURE usp_Curso_Listar as select codcurso,numcurso,nomcurso,ciclocurso,tipocurso,creditocurso,idescuela,prerequisito,prerequisito2from curso
CREATE PROCEDURE usp_Notas_Listar as select idnota,codcurso,codalumno,notacurso,condicion,semestrefrom notas
CREATE PROCEDURE usp_Profesor_Listar as select codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofe
Dim Dap As New SqlDataAdapter("usp_Profesor_Listar", Cnx) Dim dst As New DataSet Dap.Fill(dst, "profesores") Return dst.Tables("profesores") End Function
Public Function UsuariosListar() As DataTable Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("conexion")) Dim Dap As New SqlDataAdapter("usp_Usuarios_Listar", Cnx) Dim dst As New DataSet Dap.Fill(dst, "usuarios") Return dst.Tables("usuarios") End Function
Public Function CursoDatos(ByVal numcurso As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Curso_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@numcurso", SqlDbType.Char, 2).Value = numcurso End With Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr End Function
Public Function ProfesorDatos(ByVal codprofesor As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Profesor_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codprofesor", SqlDbType.Char, 4).Value = codprofesor End With
CREATE PROCEDURE usp_Profesor_Listar as select codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofe
CRETAE PROCEDURE usp_Usuarios_Listar asSelect idadministrador,usuario,contraseñafrom Administrador
CREATE PROCEDURE usp_Curso_Datos @numcurso int as select codcurso,numcurso,nomcurso,ciclocurso,tipocurso,creditocurso,idescuela,prerequisito,prerequisito2from cursowhere numcurso=@numcurso
CREATE PROCEDURE usp_Profesor_Datos @codprofesor int as select codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofesor,gradoprofesor,especialid
Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr End Function
Public Function NotaDatos(ByVal idnota As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Notas_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idnota", SqlDbType.Char, 2).Value = idnota End With Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr End Function
Public Function UsuarioDatos(ByVal idadministrador As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Usuario_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idadministrador", SqlDbType.Char, 2).Value = idadministrador End With Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr
CREATE PROCEDURE usp_Profesor_Datos @codprofesor int as select codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofesor,gradoprofesor,especialid
CREATE PROCEDURE usp_Notas_Datos @idnota int as select idnota,codcurso,codalumno,notacurso,condicion,semestrefrom notas where idnota=@idnota
End Function
Public Sub CursoAdicionar(ByVal codcurso As String, ByVal numcurso As String, ByVal nomcurso As String, ByVal ciclocurso As String, ByVal tipocurso As String, ByVal creditocurso As String, ByVal idescuela As String, ByVal prerequisito As String, ByVal prerequisito2 As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Curso_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codcurso", SqlDbType.Char, 5).Value = codcurso .Parameters.Add("@numcurso", SqlDbType.Char, 2).Value = numcurso .Parameters.Add("@nomcurso", SqlDbType.VarChar, 50).Value = nomcurso .Parameters.Add("@ciclocurso", SqlDbType.Int).Value = ciclocurso .Parameters.Add("@tipocurso", SqlDbType.VarChar, 15).Value = tipocurso .Parameters.Add("@creditocurso", SqlDbType.Int).Value = creditocurso .Parameters.Add("@idescuela", SqlDbType.Char, 2).Value = idescuela .Parameters.Add("@prerequisito", SqlDbType.Char, 5).Value = prerequisito .Parameters.Add("@prerequisito2", SqlDbType.Char, 5).Value = prerequisito2
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
CREATE PROCEDURE usp_Usuario_Datos @idadministrador int as select idadministrador,usuario,contraseña from Administrador where idadministrador=@idadministrador
CREATE PROCEDURE usp_Curso_Adicionar @codcurso char(5),@numcurso char(2),@nomcurso varchar(50),@ciclocurso int,@tipocurso char(15),@creditocurso int,@idescuela char(2),@prerequisito char(5),@prerequisito2 char(5) AS Insert into curso(codcurso,numcurso,nomcurso,ciclocurso,tipocurso,creditocurso,idescuela,prerequisito,prerequisito2)values(@codcurso,@numcurso,@nomcurso,@ciclocurso,@tipocurso,@creditocurso,@idescuela,@prerequisito,@prerequisito2)
Public Sub CursoEliminar(ByVal numcurso As Integer) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Curso_Eliminar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@numcurso", SqlDbType.Int).Value = numcurso End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub CursoModificar(ByVal codcurso As String, ByVal numcurso As String, ByVal nomcurso As String, ByVal ciclocurso As String, ByVal tipocurso As String, ByVal creditocurso As String, ByVal idescuela As String, ByVal prerequisito As String, ByVal prerequisito2 As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Curso_Modificar", Cnx)
CREATE PROCEDURE usp_Curso_Eliminar @numcurso intASDelete from cursoWhere numcurso=@numcurso
With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codcurso", SqlDbType.Char, 5).Value = codcurso .Parameters.Add("@numcurso", SqlDbType.Char, 2).Value = numcurso .Parameters.Add("@nomcurso", SqlDbType.VarChar, 50).Value = nomcurso .Parameters.Add("@ciclocurso", SqlDbType.Int).Value = ciclocurso .Parameters.Add("@tipocurso", SqlDbType.VarChar, 15).Value = tipocurso .Parameters.Add("@creditocurso", SqlDbType.Int).Value = creditocurso .Parameters.Add("@idescuela", SqlDbType.Char, 2).Value = idescuela .Parameters.Add("@prerequisito", SqlDbType.Char, 5).Value = prerequisito .Parameters.Add("@prerequisito2", SqlDbType.Char, 5).Value = prerequisito2
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub UsuarioAdicionar(ByVal usuario As String, ByVal contraseña As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Usuario_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@usuario", SqlDbType.VarChar, 45).Value = usuario .Parameters.Add("@contraseña", SqlDbType.Char, 4).Value = contraseña
CREATE PROCEDURE usp_Curso_Modificar @codcurso char(5),@numcurso char(2),@nomcurso varchar(50),@ciclocurso int,@tipocurso char(15),@creditocurso int,@idescuela char(2),@prerequisito char(5),@prerequisito2 char(5)ASUpdate curso set codcurso=@codcurso,nomcurso=@nomcurso,ciclocurso=@ciclocurso,tipocurso=@tipocurso,creditocurso=@creditocurso,idescuela=@idescuela,prerequisito=@prerequisito,prerequisito2=@prerequisito2Where numcurso=@numcurso
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub UsuarioEliminar(ByVal idadministrador As Integer) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Usuario_Eliminar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idadministrador", SqlDbType.Int).Value = idadministrador End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub UsuarioModificar(ByVal idadministrador As String, ByVal usuario As String, ByVal contraseña As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Usuario_Modificar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idadministrador", SqlDbType.Int).Value = idadministrador .Parameters.Add("@usuario", SqlDbType.VarChar, 45).Value = usuario .Parameters.Add("@contraseña", SqlDbType.Char, 4).Value = contraseña
CREATE PROCEDURE usp_Usuario_Adicionar @usuario varchar(45),@contraseña char(4) AS Insert into Administrador(usuario,contraseña)values(@usuario,@contraseña)
CREATE PROCEDURE usp_Usuario_Eliminar @idadministrador intASDelete from AdministradorWhere idadministrador=@idadministrador
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub ProfesorAdicionar(ByVal codprofesor As String, ByVal nombreprofesor As String, ByVal direccionprofesor As String, ByVal telefonoprofesor As String, ByVal sexoprofesor As String, ByVal gradoprofesor As String, ByVal especialidadprofesor As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Profesor_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codprofesor", SqlDbType.Char, 4).Value = codprofesor .Parameters.Add("@nombreprofesor", SqlDbType.VarChar, 50).Value = nombreprofesor .Parameters.Add("@direccionprofesor", SqlDbType.VarChar, 50).Value = direccionprofesor .Parameters.Add("@telefonoprofesor", SqlDbType.VarChar, 10).Value = telefonoprofesor .Parameters.Add("@sexoprofesor", SqlDbType.VarChar, 10).Value = sexoprofesor .Parameters.Add("@gradoprofesor", SqlDbType.VarChar, 30).Value = gradoprofesor .Parameters.Add("@especialidadprofesor", SqlDbType.VarChar, 30).Value = especialidadprofesor End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
CREATE PROCEDURE usp_Usuario_Modificar @idadministrador int,@usuariovarchar(45),@contraseña char(4)ASUpdate Administrador set usuario=@usuario,contraseña= @contraseñaWhere idadministrador=@idadministrador
CREATE PROCEDURE usp_Profesor_Adicionar
@codprofesor char(4),@nombreprofesor varchar(50),@direccionprofesor varchar(50),@telefonoprofesor varchar(10),@sexoprofesor varchar(10),@gradoprofesor varchar(30),@especialidadprofesor varchar(30)ASInsert into profesor(codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofesor,gradoprofesor,especialidadprofesor)values(@codprofesor,@nombreprofesor,@direccionprofesor,@telefonoprofesor,@sexoprofesor,@gradoprofesor,@especialid
Public Sub ProfesorModificar(ByVal codprofesor As String, ByVal nombreprofesor As String, ByVal direccionprofesor As String, ByVal telefonoprofesor As String, ByVal sexoprofesor As String, ByVal gradoprofesor As String, ByVal especialidadprofesor As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Profesor_Modificar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codprofesor", SqlDbType.Char, 4).Value = codprofesor .Parameters.Add("@nombreprofesor", SqlDbType.VarChar, 50).Value = nombreprofesor .Parameters.Add("@direccionprofesor", SqlDbType.VarChar, 50).Value = direccionprofesor .Parameters.Add("@telefonoprofesor", SqlDbType.VarChar, 10).Value = telefonoprofesor .Parameters.Add("@sexoprofesor", SqlDbType.VarChar, 10).Value = sexoprofesor .Parameters.Add("@gradoprofesor", SqlDbType.VarChar, 30).Value = gradoprofesor .Parameters.Add("@especialidadprofesor", SqlDbType.VarChar, 30).Value = especialidadprofesor
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
CREATE PROCEDURE usp_Profesor_Adicionar
@codprofesor char(4),@nombreprofesor varchar(50),@direccionprofesor varchar(50),@telefonoprofesor varchar(10),@sexoprofesor varchar(10),@gradoprofesor varchar(30),@especialidadprofesor varchar(30)ASInsert into profesor(codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofesor,gradoprofesor,especialidadprofesor)values(@codprofesor,@nombreprofesor,@direccionprofesor,@telefonoprofesor,@sexoprofesor,@gradoprofesor,@especialid
CREATE PROCEDURE usp_Profesor_Modificar @codprofesor char(4),@nombreprofesor varchar(50),@direccionprofesor varchar(50),@telefonoprofesor varchar(10),@sexoprofesor varchar(10),@gradoprofesor varchar(30),@especialidadprofesor varchar(30)ASUpdate profesor set nombreprofesor=@nombreprofesor,direccionprofesor= @direccionprofesor,telefonoprofesor=@telefonoprofesor,sexoprofesor=@sexoprofesor,
Public Sub ProfesorEliminar(ByVal codprofesor As Integer) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Profesor_Eliminar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codprofesor", SqlDbType.Int).Value = codprofesor End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub NotasAdicionar(ByVal codcurso As String, ByVal codalumno As String, ByVal notacurso As String, ByVal condicion As String, ByVal semestre As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Notas_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codcurso", SqlDbType.Char, 5).Value = codcurso .Parameters.Add("@codalumno", SqlDbType.Char, 7).Value = codalumno .Parameters.Add("@notacurso", SqlDbType.Char, 4).Value = notacurso .Parameters.Add("@condicion", SqlDbType.VarChar, 15).Value = condicion
CREATE PROCEDURE usp_Profesor_Modificar @codprofesor char(4),@nombreprofesor varchar(50),@direccionprofesor varchar(50),@telefonoprofesor varchar(10),@sexoprofesor varchar(10),@gradoprofesor varchar(30),@especialidadprofesor varchar(30)ASUpdate profesor set nombreprofesor=@nombreprofesor,direccionprofesor= @direccionprofesor,telefonoprofesor=@telefonoprofesor,sexoprofesor=@sexoprofesor,
CREATE PROCEDURE usp_Profesor_Eliminar@codprofesor intASDelete from profesorWhere codprofesor=@codprofesor
ALTER PROCEDURE usp_Notas_Modificar@idnota int,@codcurso
.Parameters.Add("@semestre", SqlDbType.VarChar, 50).Value = semestre End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub NotasModificar(ByVal idnota As Integer, ByVal codalumno As String, ByVal codcurso As String, ByVal notacurso As String, ByVal condicion As String, ByVal semestre As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Notas_Modificar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idnota", SqlDbType.Int).Value = idnota .Parameters.Add("@codcurso", SqlDbType.Char, 5).Value = codcurso .Parameters.Add("@codalumno", SqlDbType.Char, 7).Value = codalumno .Parameters.Add("@notacurso", SqlDbType.Char, 4).Value = notacurso .Parameters.Add("@condicion", SqlDbType.VarChar, 15).Value = condicion .Parameters.Add("@semestre", SqlDbType.VarChar, 50).Value = semestre End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub NotasEliminar(ByVal idnota As Integer) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Notas_Eliminar", Cnx)
ALTER PROCEDURE usp_Notas_Modificar@idnota int,@codcurso
CREATE PROCEDURE usp_Notas_Modificar@idnota int,@codcurso char(5),@codalumno char(7),@notacurso char(4),@condicion varchar(15),@semestre varchar(50)ASUpdate notas set codcurso=@codcurso,codalumno= @codalumno,notacurso=@notacurso,condicion=@condicion,semestre=@semestreWhere idnota=@idnota
With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idnota", SqlDbType.Int).Value = idnota End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Function AlumnoDatos(ByVal idmatricula As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Alumno_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@idmatricula", SqlDbType.Int).Value = idmatricula End With Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr End Function
Public Sub ValidacionAdicionar(ByVal codalumno As String, ByVal idmatricula As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Validacion_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codalumno", SqlDbType.Char, 7).Value = codalumno .Parameters.Add("@idmatricula", SqlDbType.Char, 8).Value = idmatricula End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close()
CREATE PROCEDURE usp_Notas_Eliminar@idnota intASDelete from notasWhere idnota=@idnota
CREATE PROCEDURE usp_Alumno_Datos @idmatricula int AS select idmatricula,codalumno,fechapago,montopago from banco where idmatricula=@idmatricula
CREATE PROCEDURE usp_Validacion_Adicionar @codalumno char(7),@idmatricula char(8)
Catch ex As Exception Throw ex End Try End Sub
Public Function DatosDatos(ByVal codprofesor As Integer) As SqlDataReader Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Profesor_Datos", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codprofesor", SqlDbType.Char, 4).Value = codprofesor End With Cnx.Open() Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) Return dr End Function
Public Sub ValidacionEliminar() Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Validacion_Eliminar", Cnx) With cmd .CommandType = CommandType.StoredProcedure
End With Try Cnx.Open() cmd.ExecuteNonQuery()
CREATE PROCEDURE usp_Validacion_Adicionar @codalumno char(7),@idmatricula char(8)
CREATE PROCEDURE usp_Profesor_Datos@codprofesor intas select codprofesor,nombreprofesor,direccionprofesor,telefonoprofesor,sexoprofesor,gradoprofesor,especialidadprofesorfrom profesorwhere codprofesor=@codprofesor
CREATE PROCEDURE usp_Validacion_Eliminar
ASDelete from validacion
Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub MatriculadosAdicionar(ByVal codigocurso As String, ByVal codm As String, ByVal grupohorario As String, ByVal fechamatricula As Date, ByVal creditocurso As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Matriculados_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codigocurso", SqlDbType.Char, 5).Value = codigocurso .Parameters.Add("@codm", SqlDbType.Char, 7).Value = codm .Parameters.Add("@grupohorario", SqlDbType.Char, 3).Value = grupohorario .Parameters.Add("@fechamatricula", SqlDbType.DateTime).Value = fechamatricula .Parameters.Add("@creditocurso", SqlDbType.Int).Value = creditocurso
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub MatriculadosEliminar(ByVal codigocurso As String, ByVal codm As String) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Matriculados_Eliminar", Cnx) With cmd .CommandType = CommandType.StoredProcedure
CREATE PROCEDURE usp_Validacion_Eliminar
ASDelete from validacion
CREATE PROCEDURE usp_Matriculados_Adicionar @codigocurso char(5),@codm char(7),@grupohorario char(3),@fechamatricula datetime,@creditocurso intAs Insert into cursosmatriculados(codcurso,codalumno,grupohorario,fecha,creditocurso)values(@codigocurso,@codm,@grupohorario,@fecha
.Parameters.Add("@codigocurso", SqlDbType.Char, 5).Value = codigocurso .Parameters.Add("@codm", SqlDbType.Char, 7).Value = codm End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End Sub
Public Sub VerificacionAdicionar(ByVal codalumno As String, ByVal fechamatricula As Date) Dim Cnx As New SqlConnection(ConfigurationManager.AppSettings.Get("Conexion")) Dim cmd As New SqlCommand("usp_Verificacion_Adicionar", Cnx) With cmd .CommandType = CommandType.StoredProcedure .Parameters.Add("@codalumno", SqlDbType.Char, 7).Value = codalumno .Parameters.Add("@fechamatricula", SqlDbType.DateTime).Value = fechamatricula
End With Try Cnx.Open() cmd.ExecuteNonQuery() Cnx.Close() Catch ex As Exception Throw ex End Try End SubEnd Class
CREATE PROCEDURE usp_Matriculados_Eliminar @codigocurso char(5),@codm char(7)ASDelete from cursosmatriculadosWhere codcurso=@codigocurso and codalumno=@codm
CREATE PROCEDURE usp_Verificacion_Adicionar @codalumno char(7),@fechamatricula datetimeasInsert into verificacionmatricula(codalumno,fecha)values(@codalumno,@fechamatricula)
Cada click en los botones “Entrar” nos re direcciona a WebForm señalados en el código.
Partial Class mantenimiento Inherits System.Web.UI.Page
Protected Sub btncursor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncursor.Click Response.Redirect("admin_curso.aspx") End Sub
Protected Sub btnnotas_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnotas.Click Response.Redirect("admin_notas.aspx") End Sub
Protected Sub btnprofesor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnprofesor.Click Response.Redirect("admin_profesor.aspx") End Sub
Protected Sub btnusuario_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnusuario.Click Response.Redirect("admin_usuario.aspx") End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Label1.Text = Request.QueryString("codigo") End SubEnd Class
Botón Curso: Insertamos un GreedView
Para que los resultados se presenten en varias páginas activamos “AllowPaging”.
Partial Class admin_curso Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objX As New Clsmatricula grdcurso.DataSource = objX.CursoListar grdcurso.DataBind() End Sub
Protected Sub grdcurso_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdcurso.PageIndexChanging grdcurso.PageIndex = e.NewPageIndex grdcurso.DataBind() End Sub
Editamos las columnas del GreedVied,
El Hyperlink, nos envía a admin_cursodetalle.aspx?cod={0}
“admin_cursodetalle”
Los demás campos según nuestra base de datos tabla Cursos.
Así quedarán los campos llenados.
Al hacer click en el código del curso, pasaremos a “admin_cursodetalle”
Imports System.Data.SqlClientPartial Class admin_cursodetalle Inherits System.Web.UI.Page Private objX As New Clsmatricula Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Dim Codigo As String = Request.QueryString("cod") Dim dr As SqlDataReader = objX.CursoDatos(Integer.Parse(Codigo)) dr.Read() txtcodcurso.Text = dr(0)
txtnumcurso.Text = dr(1) txtnomcurso.Text = dr(2) txtciclocurso.Text = dr(3) txttipocurso.Text = dr(4) txtcreditocurso.Text = dr(5) txtidescuela.Text = dr(6) txtprerequisito1.Text = dr(7) txtprerequisito2.Text = dr(8) dr.Close() End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtcodcurso.Text = "" txtnumcurso.Text = "" txtnomcurso.Text = "" txtciclocurso.Text = "" txttipocurso.Text = "" txtcreditocurso.Text = "" txtprerequisito1.Text = "" txtprerequisito2.Text = "" End Sub
Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click txtcodcurso.Text = "" txtnumcurso.Text = "" txtnomcurso.Text = "" txtciclocurso.Text = "" txttipocurso.Text = "" txtcreditocurso.Text = "" txtprerequisito1.Text = "" txtprerequisito2.Text = "" Response.Redirect("admin_curso.aspx") End Sub
Protected Sub btnguardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnguardar.Click Try objX.CursoAdicionar(txtcodcurso.Text, txtnumcurso.Text, txtnomcurso.Text, txtciclocurso.Text, txttipocurso.Text, txtcreditocurso.Text, txtidescuela.Text, txtprerequisito1.Text, txtprerequisito2.Text) Server.Transfer("admin_curso.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try
End Sub
Protected Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click Try objX.CursoEliminar(Integer.Parse(txtnumcurso.Text)) Server.Transfer("admin_curso.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click
Try objX.CursoModificar(txtcodcurso.Text, Integer.Parse(txtnumcurso.Text), txtnomcurso.Text, txtciclocurso.Text, txttipocurso.Text, txtcreditocurso.Text, txtidescuela.Text, txtprerequisito1.Text, txtprerequisito2.Text) Server.Transfer("admin_curso.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
Botón Notas: Insertamos un GreedView
Para que los resultados se presenten en varias páginas activamos “AllowPaging”.
Partial Class admin_notas Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objX As New Clsmatricula grdnotas.DataSource = objX.NotasListar grdnotas.DataBind() End Sub
Protected Sub grdnotas_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdnotas.PageIndexChanging grdnotas.PageIndex = e.NewPageIndex grdnotas.DataBind() End SubEnd Class
Editamos las columnas del GreedVied,
El Hyperlink, nos envía a admin_notasdetalle.aspx?cod={0}
“admin_notasdetalle”
Los demás campos según nuestra base de datos tabla Notas.
Así quedarán los campos llenados.
Al hacer click en el código del alumno, pasaremos a “admin_notasdetalle”
Imports System.Data.SqlClientPartial Class admin_notasdetalle Inherits System.Web.UI.Page Private objX As New Clsmatricula
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Dim Codigo As String = Request.QueryString("cod") Dim dr As SqlDataReader = objX.NotaDatos(Integer.Parse(Codigo)) dr.Read()
txtidnota.Text = dr(0) txtcodigocurso.Text = dr(1) txtcodigoalumno.Text = dr(2) txtnotacurso.Text = dr(3) txtcondicion.Text = dr(4) txtsemestre.Text = dr(5) dr.Close() End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtidnota.Text = "" txtcodigoalumno.Text = "" txtcodigocurso.Text = "" txtnotacurso.Text = "" txtcondicion.Text = "" txtsemestre.Text = "" End Sub
Protected Sub btnguardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnguardar.Click Try objX.NotasAdicionar(txtcodigocurso.Text, txtcodigoalumno.Text, txtnotacurso.Text, txtcondicion.Text, txtsemestre.Text) Server.Transfer("admin_notas.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try
End Sub
Protected Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click Try objX.NotasModificar(Integer.Parse(txtidnota.Text), txtcodigocurso.Text, txtcodigoalumno.Text, txtnotacurso.Text, txtcondicion.Text, txtsemestre.Text) Server.Transfer("admin_notas.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click Try objX.NotasEliminar(Integer.Parse(txtidnota.Text))
Server.Transfer("admin_notas.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click txtcodigoalumno.Text = "" txtcodigocurso.Text = "" txtnotacurso.Text = "" txtcondicion.Text = "" txtsemestre.Text = ""
Response.Redirect("admin_notas.aspx") End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
Botón Profesores: Insertamos un GreedView
Para que los resultados se presenten en varias páginas activamos “AllowPaging”.
Partial Class admin_profesor Inherits System.Web.UI.Page
Protected Sub grdprofesor_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdprofesor.PageIndexChanging grdprofesor.PageIndex = e.NewPageIndex grdprofesor.DataBind() End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objX As New Clsmatricula grdprofesor.DataSource = objX.ProfesorListar grdprofesor.DataBind() End SubEnd Class
Editamos las columnas del GreedVied,
El Hyperlink, nos envía a admin_profesordetalle.aspx?cod={0}
“admin_profesordetalle”
Los demás campos según nuestra base de datos tabla Notas.
Así
quedarán los campos llenados.
Al hacer click en el código del profesor, pasaremos a “admin_profesordetalle”
Imports System.Data.SqlClientPartial Class admin_profesordetalle Inherits System.Web.UI.Page Private objX As New Clsmatricula
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Dim Codigo As String = Request.QueryString("cod") Dim dr As SqlDataReader = objX.ProfesorDatos(Integer.Parse(Codigo)) dr.Read() txtcodprofesor.Text = dr(0) txtnombreprofesor.Text = dr(1) txtdireccionprofesor.Text = dr(2) txttelefonoprofesor.Text = dr(3) txtsexoprofesor.Text = dr(4) txtgradoprofesor.Text = dr(5) txtespecialidadprofesor.Text = dr(6) dr.Close() End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtcodprofesor.Text = "" txtnombreprofesor.Text = "" txtdireccionprofesor.Text = "" txttelefonoprofesor.Text = "" txtsexoprofesor.Text = "" txtgradoprofesor.Text = "" txtespecialidadprofesor.Text = "" End Sub
Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click txtcodprofesor.Text = "" txtnombreprofesor.Text = "" txtdireccionprofesor.Text = "" txttelefonoprofesor.Text = "" txtsexoprofesor.Text = "" txtgradoprofesor.Text = "" txtespecialidadprofesor.Text = ""
Response.Redirect("admin_profesor.aspx") End Sub
Protected Sub btnguardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnguardar.Click Try objX.ProfesorAdicionar(txtcodprofesor.Text, txtnombreprofesor.Text, txtdireccionprofesor.Text, txttelefonoprofesor.Text, txtsexoprofesor.Text, txtgradoprofesor.Text, txtespecialidadprofesor.Text) Server.Transfer("admin_profesor.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click Try objX.ProfesorEliminar(Integer.Parse(txtcodprofesor.Text)) Server.Transfer("admin_profesor.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click
Try objX.ProfesorModificar(txtcodprofesor.Text, txtnombreprofesor.Text, txtdireccionprofesor.Text, txttelefonoprofesor.Text, txtsexoprofesor.Text, txtgradoprofesor.Text, txtespecialidadprofesor.Text) Server.Transfer("admin_profesor.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
Botón Usuarios: Insertamos un GreedView
Para que los resultados se presenten en varias páginas activamos “AllowPaging”.
Partial Class admin_usuario Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objX As New Clsmatricula grdusuario.DataSource = objX.UsuariosListar grdusuario.DataBind() End Sub
Protected Sub grdusuario_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdusuario.PageIndexChanging grdusuario.PageIndex = e.NewPageIndex grdusuario.DataBind() End SubEnd Class
Editamos las columnas del GreedVied,
El Hyperlink, nos envía a admin_usuariodetalle.aspx?cod={0}
“admin_usuariodetalle”
Los demás campos según nuestra base de datos tabla Administrador.
Así quedarán los campos llenados.
Al hacer click en Administrador, pasaremos a “admin_usuariodetalle”
Imports System.Data.SqlClientPartial Class admin_usuariodetalle Inherits System.Web.UI.Page Private objX As New Clsmatricula
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Dim Codigo As String = Request.QueryString("cod") Dim dr As SqlDataReader = objX.UsuarioDatos(Integer.Parse(Codigo)) dr.Read() txtidadministrador.Text = dr(0) txtusuario.Text = dr(1) txtclave.Text = dr(2)
dr.Close() End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtidadministrador.Text = "" txtusuario.Text = "" txtclave.Text = "" txtclave.TextMode = TextBoxMode.Password txtcontraseña2.TextMode = TextBoxMode.Password lblreclave.Visible = True txtcontraseña2.Visible = True
End Sub
Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click txtidadministrador.Text = "" txtusuario.Text = "" txtclave.Text = "" txtcontraseña2.Text = "" txtclave.TextMode = TextBoxMode.SingleLine txtcontraseña2.TextMode = TextBoxMode.SingleLine lblreclave.Visible = False txtcontraseña2.Visible = False Response.Redirect("admin_usuario.aspx") End Sub
Protected Sub btnguardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnguardar.Click If (txtclave.Text = txtcontraseña2.Text) Then Try objX.UsuarioAdicionar(txtusuario.Text, txtclave.Text) Server.Transfer("admin_usuario.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try
Else MsgBox("Datos Incorrectos", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtidadministrador.Text = "" txtusuario.Text = "" txtclave.Text = "" txtcontraseña2.Text = "" End If
End Sub
Protected Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click Try objX.UsuarioEliminar(Integer.Parse(txtidadministrador.Text)) Server.Transfer("admin_usuario.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click
Try objX.UsuarioModificar(Integer.Parse(txtidadministrador.Text), txtusuario.Text, txtclave.Text) Server.Transfer("admin_usuario.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
Trabajando en el TreeView del MasterPage:
Nos manda al WebForm Usuario.
Para los banners:
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQyNjc5NDYxNyZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=911af819e0225480e986a0e22b212211&bgcolor=141414' width='728' height='90'><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=911af819e0225480e986a0e22b212211&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript> <tr> <td colspan="3" style="height: 56px"> <img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNjA*MTQwNTU2NzkmcHQ9MTI2MDQxNDA2MzQ2OSZwPTQ1NTkzMiZkPSZnPTImbz*yOTg*Yjc4ZTMzYzQ*YTRmYjJiYjAzNzQ*MjZhZGY4OSZvZj*w.gif" /><object type='application/x-shockwave-flash' data='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=6fef21dcf62db5343ce91856eb212141&bgcolor=141414' width='435' height='75'><param name='movie' value='http://files.bannersnack.net/app/swf/EmbedCanvas.swf?hash_id=6fef21dcf62db5343ce91856eb212141&bgcolor=141414'><param name='bgcolor' value='#141414'></object><noscript><a href='http://bannersnack.com/' title='BannerSnack - the free flash banner maker'>Banner maker</a></noscript> </td> </tr> <tr>
A la hora de matricularnos, pagasmo al banco, éste nso bridna un código para acceder a la matrícula, éstos datos se encuentran dentro de la tabla “banco”.
Imports System.DataImports System.Data.SqlClient
Partial Class usuario Inherits System.Web.UI.Page Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select * from banco", cnx) Public dst As New DataSet Public cmd As New SqlCommand Private objX As New Clsmatricula
Public Sub CmdAceptar_Click() If txtcodigo.Text = "" And txtrecibo.Text = "" Then MsgBox("Ingrese Datos", MsgBoxStyle.Critical, " ::: Sistema ::: ") End If dap.SelectCommand.CommandText = "select * from verificacionmatricula where codalumno='" & txtcodigo.Text & "'" dap.Fill(dst, "dat1") If dst.Tables("dat1").Rows.Count <> 0 Then MsgBox("Ya está matriculado", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtcodigo.Text = "" txtrecibo.Text = "" : txtcodigo.Focus() Response.Redirect("usuario.aspx") End If
dap.SelectCommand.CommandText = "SELECT * FROM banco WHERE codalumno='" & txtcodigo.Text & "' and idmatricula='" & txtrecibo.Text & "'" dap.Fill(dst, "dat") If dst.Tables("dat").Rows.Count = 0 Then MsgBox("Datos Incorrectos", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtcodigo.Text = "" txtrecibo.Text = "" : txtrecibo.Focus() Response.Redirect("usuario.aspx") End If Try objX.ValidacionAdicionar(txtcodigo.Text, txtrecibo.Text) Server.Transfer("matricula.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try dst.Tables("dat").Clear() End Sub Protected Sub btncancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancelar.Click txtcodigo.Text = "" txtrecibo.Text = "" End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End Sub
Protected Sub btningresar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btningresar.Click CmdAceptar_Click() End SubEnd Class
Una vez aceptada los datos pedidos, pasamos al WebForm “matrícula”
Imports System.DataImports System.Data.SqlClient
Partial Class matricula Inherits System.Web.UI.Page Private objX As New Clsmatricula Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select codalumno from validacion", cnx) Public dst As New DataSet Public cmd As New SqlCommand Public Sub CmdAceptar_Click()
dap.Fill(dst, "dat") txtcodm.Text = dst.Tables("dat").Rows(0).Item(0)
End Sub
Protected Sub btnsi_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsi.Click CmdAceptar_Click()
dap.SelectCommand.CommandText = "select * from alumno where codalumno='" & txtcodm.Text & "' "
dap.Fill(dst, "dat1") txtnomm.Text = dst.Tables("dat1").Rows(0).Item(1) txtdirem.Text = dst.Tables("dat1").Rows(0).Item(2) txtfono.Text = dst.Tables("dat1").Rows(0).Item(3) txtsex.Text = dst.Tables("dat1").Rows(0).Item(4) txtidescuela.Text = dst.Tables("dat1").Rows(0).Item(6)
txtfechamatricula.Text = Now btnno.Enabled = False
btnsi.Enabled = False
End Sub
Protected Sub btnno_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnno.Click Try objX.ValidacionEliminar() Server.Transfer("bienvenidos.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try
End Sub
Protected Sub btnagregar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnagregar.Click ddlciclo.Enabled = False If txtnum.Text = "" And txtgrupohorario.Text = "" Then MsgBox("Ingrese Datos", MsgBoxStyle.Critical, " ::: Sistema ::: ") Else dap.SelectCommand.CommandText = "select * from programacionhoraria where grupohorario='" & txtgrupohorario.Text & "'and numcurso='" & txtnum.Text & "'" dap.Fill(dst, "dat2") txtcodigocurso.Text = dst.Tables("dat2").Rows(0).Item(1) txtlab.Text = dst.Tables("dat2").Rows(0).Item(4)
dap.SelectCommand.CommandText = "select * from curso where numcurso='" & txtnum.Text & "'" dap.Fill(dst, "dat5")
If dst.Tables("dat5").Rows(0).Item(3) > ddlciclo.SelectedValue + 2 Then
MsgBox("No puede llevar cursos del ciclo seleccionado", MsgBoxStyle.Critical, " ::: Sistema ::: ")
Else
dap.SelectCommand.CommandText = "select * from curso where numcurso='" & txtnum.Text & "'" dap.Fill(dst, "dat3") txtcreditoscurso.Text = dst.Tables("dat3").Rows(0).Item(5)
Try objX.MatriculadosAdicionar(txtcodigocurso.Text, txtcodm.Text, txtgrupohorario.Text, txtfechamatricula.Text, txtcreditoscurso.Text) Catch ex As Exception lblerror.Text = ex.Message
End Try
dap.SelectCommand.CommandText = "select sum(creditocurso) from cursosmatriculados where codalumno='" & txtcodm.Text & "'" dap.Fill(dst, "dat4") txtcreditostotal.Text = dst.Tables("dat4").Rows(0).Item(0)
If txtcreditostotal.Text > 22 Then MsgBox("Creditos Totales Supera los Permitidos", MsgBoxStyle.Critical, " ::: Sistema ::: ") Try objX.MatriculadosEliminar(txtcodigocurso.Text, txtcodm.Text) Catch ex As Exception lblerror.Text = ex.Message End Try
dap.SelectCommand.CommandText = "select sum(creditocurso) from cursosmatriculados where codalumno='" & txtcodm.Text & "'" dap.Fill(dst, "dat4") txtcreditostotal.Text = dst.Tables("dat4").Rows(0).Item(0) End If
End If
End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtlab.Text = "" txtcodigocurso.Text = "" txtnum.Text = "" txtgrupohorario.Text = "" End Sub
Protected Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click If txtnum.Text = "" And txtgrupohorario.Text = "" Then MsgBox("Ingrese Datos", MsgBoxStyle.Critical, " ::: Sistema ::: ")
Else dap.SelectCommand.CommandText = "select * from programacionhoraria where grupohorario='" & txtgrupohorario.Text & "'and numcurso='" & txtnum.Text & "'" dap.Fill(dst, "dat2")
txtcodigocurso.Text = dst.Tables("dat2").Rows(0).Item(1) txtlab.Text = dst.Tables("dat2").Rows(0).Item(4)
Try objX.MatriculadosEliminar(txtcodigocurso.Text, txtcodm.Text) Catch ex As Exception lblerror.Text = ex.Message End Try
dap.SelectCommand.CommandText = "select * from cursosmatriculados where codalumno='" & txtcodm.Text & "'" dap.Fill(dst, "dat4") If dst.Tables("dat4").Rows.Count = 0 Then txtcreditoscurso.Text = 0 txtcreditostotal.Text = 0 Else dap.SelectCommand.CommandText = "select sum(creditocurso) from cursosmatriculados where codalumno='" & txtcodm.Text & "'" dap.Fill(dst, "dat4") txtcreditostotal.Text = dst.Tables("dat4").Rows(0).Item(4) End If
txtlab.Text = "" txtcodigocurso.Text = "" txtnum.Text = "" txtgrupohorario.Text = ""
End If End Sub
Protected Sub brnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles brnsalir.Click Try objX.ValidacionEliminar() Server.Transfer("bienvenidos.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try End Sub
Protected Sub btnvermatricula_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnvermatricula.Click Response.Redirect("vermatricula.aspx?codigo=" & Me.txtcodm.Text & "&codigo1= " & Me.txtgrupohorario.Text)
End Sub
Protected Sub brnguardarmatricula_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles brnguardarmatricula.Click Try objX.VerificacionAdicionar(txtcodm.Text, txtfechamatricula.Text) Catch ex As Exception lblerror.Text = ex.Message End Try Try objX.ValidacionEliminar() Server.Transfer("bienvenidos.aspx") Catch ex As Exception lblerror.Text = ex.Message End Try
Response.Redirect("bienvenidos.aspx") End SubEnd Class
Una vez matriculados, podemos ver los ingresados.
Imports System.DataImports System.Data.SqlClientPartial Class vermatricula Inherits System.Web.UI.Page Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select * from cursosmatriculados", cnx) Public dst As New DataSet Public cmd As New SqlCommand
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.txtcodm.Text = Request.QueryString("codigo") Me.txtgrupohorario.Text = Request.QueryString("codigo1") dap.SelectCommand.CommandText = "select * from cursosmatriculados where codalumno='" & txtcodm.Text & "'" dap.Fill(dst, "dat") If dst.Tables("dat").Rows.Count = 0 Then lblmensaje.Visible = True End If End SubEnd Class
TreeView Verificación de Matrícula
Imports System.DataImports System.Data.SqlClientPartial Class verificacionmatricula Inherits System.Web.UI.Page Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select * from verificacionmatricula", cnx) Public dst As New DataSet Public cmd As New SqlCommand
Protected Sub btnaceptar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnaceptar.Click If txtcodalumno.Text = "" Then MsgBox("Ingrese Datos", MsgBoxStyle.Critical, " ::: Sistema ::: ")
End If
dap.SelectCommand.CommandText = "select * from verificacionmatricula where codalumno='" & txtcodalumno.Text & "'" dap.Fill(dst, "dat1") If dst.Tables("dat1").Rows.Count <> 0 Then MsgBox("Ya está Matriculado", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtcodalumno.Text = "" : txtcodalumno.Focus() Response.Redirect("verificacionmatricula.aspx") Else MsgBox("Aun no está Matriculado", MsgBoxStyle.Critical, " ::: Sistema ::: ") txtcodalumno.Text = "" : txtcodalumno.Focus() Response.Redirect("verificacionmatricula.aspx") End If End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtcodalumno.Text = "" End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
TreeView: Consulta de Notas
Partial Class consultadenotas Inherits System.Web.UI.Page
Protected Sub btnaceptar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnaceptar.Click Response.Redirect("imprimir.aspx?codigo=" & Me.txtcodalumno.Text) End Sub
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtcodalumno.Text = "" End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx")
End SubEnd Class
TreeView. Programación horaria
Creamos un TreeView dentro de la tabla para ingresar los cursos, luego copiamos la carpeta con los pdf’s en el proyecto y lo direccionamos cada link.
Ahí escogemos el archive pdf correspondiente, de igual manera para todos los demás.
Partial Class programacionhoraria Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Redirect("bienvenidos.aspx") End SubEnd Class
TreeView Imprimir Matrícula
Ingresamos el código que ya se encuentra matriculado.
Partial Class ingresarimprimir Inherits System.Web.UI.Page
Protected Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click txtcodalumno.Text = ""
End Sub
Protected Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Response.Redirect("bienvenidos.aspx")
End Sub
Protected Sub btnaceptar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnaceptar.Click Response.Redirect("imprimir.aspx?codigo=" & Me.txtcodalumno.Text) End SubEnd Class
Nos lanza la siguiente ventana con los datos correspondientes al alumno.
Imports System.DataImports System.Data.SqlClientPartial Class imprimir Inherits System.Web.UI.Page Public cnx As New SqlConnection("user id=sa;server=.;password=123456;database=BD_MATRICULA_UNAC") Public dap As New SqlDataAdapter("select * from alumno", cnx) Public dst As New DataSet Public cmd As New SqlCommand Public dst1 = New DataSet1() Public dap1 As New SqlDataAdapter
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.txtcodalumno.Text = Request.QueryString("codigo")
dap.SelectCommand.CommandText = "select * from alumno where codalumno='" & txtcodalumno.Text & "'" dap.Fill(dst, "dat") txtnomalumno.Text = dst.Tables("dat").Rows(0).Item(1)
dap.SelectCommand.CommandText = "select * from cursosmatriculados where codalumno='" & txtcodalumno.Text & "'" dap.Fill(dst, "dat1")
End Sub
End Class
Y en el Crystal Report agregado aparecerá el reporte final.