You are on page 1of 96

Siempre Observándote

INTRODUCCION

El presente trabajo contiene como finalidad, en desarrollar un sistema de control

de multas de transito y lo identificamos con las siguientes iniciales (S.C.M.T), con

este sistema podemos aplicar con provecho el análisis de las multas de los

vehículos que se reporten en las organizaciones laborales y particulares. La

compensación constituye un aspecto esencial del mantenimiento de las

herramientas y las ocho tablas que se utilizaran para esta base de datos y que

esta coordinado con la aplicación, que permanentemente busca obtener, mantener

y desarrollar una fuerza laboral efectiva. complemento de la comprensión real,

junto con los beneficios y servicios adicionales.

1
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

OBJETIVO GENERAL
Mejorar el sistema de control de multas que en la actualidad de seta utilizando

para poder brindar un mejor servicio a todas las personas que utilicen el sistema,

esto requiere que el mismo sea estandarizado, y que tenga una mejor interfaz.

OBJETIVOS ESPECIFICOS
 Mejorar los procedimientos existentes, en constante análisis, para beneficiar a la
empresa.
 Según el sistema nuevo y con el paso del tiempo , buscar actualizaciones de las
leyes
 No permitir que el sistema, tenga una categoría de obsoleto.
 Compartir recursos, equipos, información y programas que se encuentran
localmente o dispersos geográficamente.
 Brindar confiabilidad a la información, disponiendo de alternativas de
Almacenamiento.
 Obtener una buena relación costo / beneficio
 Transmitir información entre usuarios distantes de la manera más rápida y
eficiente posible

2
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Aná lisis del Sistema:

El Sistema de Control de Multas de Transito, es una aplicación, que posee una

interfaz de fácil entendimiento para los usuarios, además está dividida en dos

partes:

 Una de ellas está enfocada hacia el usuario (conductor), el cual podrá hacer

uso de esta aplicación nada mas usando su N° de Licencia, de esta manera

el podrá verificar sus Infracciones ósea, cuantas tiene por pagar, cuánto

debe al estado, y la información de cada una de ellas; puede consultar el

listado de infracciones que están vigentes en este sistema, también puede

consultar el Reglamento Vial, además nos puede enviar sus dudas o

sugerencias a través de nuestro apartado “Contáctenos” que está en el

sitio.

 La segunda opción va destinada, a los Usuarios privilegiados mejor

conocidos como Administradores, los que podrán ingresar a su área (Área

de Administradores), haciendo uso de su Nick y Password, estos usuarios

podrán realizar una gran variedad de procesos, entre los cuales están:

Agregar, borrar, modificar Administradores; Agregar, borrar, modificar

Infracciones; Agregar(cuando algún oficial les pase el reporte),

Borrar(cuando el usuario haya pagado) Multas; y muchas otras acciones

más.

3
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Situación Actual

En la actualidad existen muchos sistemas que realizan las mismas acciones, pero

caen en muchos conflictos al realizar acciones que requieren de un nivel de

análisis mucho más profundo de los ellos esperaban, además de que al momento

de querer actualizar o innovar el sistema, no es posible por falta de normas o

reglas que permiten poder realizar dichas acciones, y se ha detectado que al

momento de hacer algunas peticiones el servidor en algunas ocasiones tarda unos

segundos en cargar.

Solución Propuesta

En nuestro sistema , pensamos en todos los conflictos que se pueden

presentar al momento de querer hacer cambios e innovar, es por esa razón que

hemos estandarizado muchos de los campos requeridos, como por ejemplo el

numero de licencia debe de tener un formato “XXX-XXXX” donde “X” es un digito

del “0-9”, otro de estos campos en cuestión sería el número del Documento Único

de Identidad (DUI) que tendría este formato “ XXXXXXXX-X” en donde al igual

que el anterior “X” será un digito “0-9”; también hemos tratado de dar solución al

problema de recarga de peticiones al servidor, haciendo uso de llamas asíncronas,

implementando la Tecnología AJAX, junto al lenguaje Java script, pero todo esto

no se hubiese logrado sin las herramientas de Microsoft.NET y Visual Studio.

4
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Diseñ o y Descripció n de la base de


datos
Descripción de la Base de Datos

Usuario
id_usu

nombre Infracciones
apellido id_infraccion

nick nombre

password valor

Multas
Vehiculos_Reportados * licencia Licencias
n_motor lugar n_licencia

descripcion fecha_emision nombre

fecha_reporte infraccion apellido

lugar fecha_vencimiento fecha_emision

reportado_por oficial fecha_vencimiento

depto n_multa categoria

n_registro descripcion dui

Tarjetas_Circulacion
n_motor
Departamentos
n_placa
id_depto
descripcion
nombre
marca

modelo

año

propietario
Oficiales
n_placa
fecha_emision
nombre
fecha_vencimiento
apellido
dui
domicilio
n_tarjeta
delegacion

dui

5
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

DESCRIPCIÓ N DE TABLAS
1. Tabla usuarios
La tabla usuarios en el proyecto tiene el uso de almacenar los datos de los
administradores, los daros que usa son el nombre, apellido, password y
Nick, los administradores tienen la facultad para hacer los diferentes
mantenimientos a todas las tablas accediendo al sistema por medio del
Nick y password
2. Tabla infracciones
Es la tabla que almacena las diferentes faltas al reglamento vial y su
respectivo valor.
3. Tabla vehículos reportados
Es la tabla que almacena los vehículos reportados como robados así como
las características y datos que ayuden a su recuperación
4. Tabla licencias
La tabla licencia me permite almacenar las licencias de los conductores,
cada licencia es única y posee una fecha de emisión y de vencimiento q me
permite identificar q la licencia no este vencida
5. Tabla tarjetas de circulación
La tabla tarjetas de circulación es la que permite almacenar la tarjeta que
se le asigna a cada auto para su tránsito por las calles, posee los datos del
propietario y del auto.
6. Tabla oficiales
Esta tabla almacena los oficiales de tránsito que ponen las multas a los
conductores, cada oficial es único y se identifica por su placa.
7. Tabla departamento
Esta tabla almacena los departamentos del país, sirve para saber en qué
lugar los oficiales ponen las multas.
8. Tabla multas
Es la tabla que contiene toda la información de la multa que se le impone a
un conductor que infringe la ley. Contiene por qué se le puso la multa,
donde se le puso la multa y cuando se le puso la multa así como su licencia
para ser reportada a la base de datos. Esta tabla sirve también para que el
conductor verifique sus multas pendientes y su total a pagar.

6
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

DESCRIPCIÓ N DE CAMPOS
Campos de la tabla usuarios
Id_usuario: numero único asignado automáticamente a un administrador (int).

Nombre: almacena el nombre del administrador (varchar).

Apellido: almacena el apellido del administrador (varchar).

Nick: campo que permite acceder al sistema junto con el password (varchar).

Password: campo que permite acceder al sistema junto al nick (varchar).

Campos de la tabla infracciones


Id_infraccion: numero único que se le asigna automáticamente a una infracción
(int).

Nombre: almacena el nombre de la infracción (varchar).

Valor: almacena el valor monetario de cada infracción (decimal).

Campos de tabla vehículos_reportados


N_motor: almacena el número de identificación única de un motor (varchar)

Descripción: almacena la descripción general de los rasgos del vehículo


reportado como robado (varchar)

Fecha_reporte: almacena la fecha en el cual fue reportado como robado


(datetime)

Lugar: campo q almacena el lugar donde fue reportado como robado el vehiculo.
(varchar)

Reportado_por: nombre la persona que reporto el vehículo (varchar).


7
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Depto.: almacena en qué departamento fue reportado como robado un vehículo.
(varchar)

N_registro: numero único que se la asigna automáticamente a un reporte (int).

Campos de tabla licencias


N_licencia: campo único que almacena el número de licencia del conductor (int)

Nombre: almacena el nombre del conductor (varchar)

Apellido: almacena los apellidos del conductor (varchar)

Fecha_emision: almacena la fecha de emisión de la licencia (datetime)

Fecha_vencimiento: almacena la fecha de vencimiento de la licencia (datetime)

Categoría: almacena el tipo de categoría de la licencia (varchar)

Dui: almacena el dui del conductor y que no se puede repetir (varchar)

Campos tabla oficiales


n_placa: almacena el número único de identificación de un oficial de tránsito.(int).

Nombre: almacena el nombre del oficial de tránsito (varchar).

Apellido: almacena los apellidos del oficial de tránsito (varchar).

Domicilio: almacena la dirección de donde vive el oficial de tránsito (varchar).

Delegación: almacena el nombre de la delegación donde trabaja el agente


(varchar).

Dui: campo que almacena el dui y no se puede repetir (varchar)

8
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Campos tabla departamentos


id_depto: id asignado para cada departamento.

Nombre: almacena el nombre del departamento.

Campos de la tabla tarjetas_circulacion


N_motor: almacena el número de identificación única de un motor (varchar)

N_placa: almacena el número de placa del vehículo, es un campo que no se


puede repetir (varchar)

Descripción: almacena la descripción general de el vehículo (varchar)

Marca: almacena la marca del vehículo (varchar)

Modelo: almacena el modelo del vehículo (varchar)

Año: almacena el año en que fue fabricado el vehículo (int)

Propietario: almacena el nombre del propietario del vehículo (varchar)

Fecha_emision: almacena la fecha de emisión de la tarjeta de circulación


(datetime).

Fecha_vencimiento: almacena la fecha de vencimiento de la tarjeta de


circulación (date time).

Dui: almacena el dui de una persona, este campo es único no se puede repetir
(varchar).

N_tarjeta: número único con el cual se almacenan las tarjetas al ser registradas
(int).

9
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Campos de la tabla multas

Licencia: almacena el número de licencia del conductor infractor, sirve para


agregarle la multa al sistema (int)

Lugar: almacena el lugar donde se puso la infracción (varchar)

Fecha_emision: almacena la fecha donde se emitió la multa (datetime)

Infracción: este campo almacena la infracción que el conductor cometió (varchar).

Fecha_vencimiento: almacena la fecha límite que tiene el conductor para pagar


la multa (datetime)

Oficial: almacena el nombre del oficial que puso la multa (varchar).

Descripción: almacena la descripción de porque le pusieron la infracción al


conductor (varchar).

N_multa: número único autogenerado con el cual se guarda la multa en la base


de datos (int).

10
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Procedimientos Almacenados
--------------add_infracciones------------------

ALTER procedure [dbo].[add_infracciones]


@nombre varchar(100),@valor decimal(18,2)
as
begin
Insert into Infracciones values(@nombre,@valor)
End

--------add_multa------------
ALTER procedure [dbo].[add_multa]
@licencia varchar (8), @lugar int , @fecha_emision datetime, @oficial varchar (20),
@descripcion varchar (50),@infraccion int,@fecha_vencimiento datetime
as
begin
insert into Multas values(@licencia,@lugar,@fecha_emision,@infraccion, @fecha_vencimiento,
@oficial,@descripcion )
end

----------add_oficiales-------
ALTER procedure [dbo].[add_oficiales]
@n_placa varchar(15),@nombre varchar (15), @apellido varchar (15), @domicilio varchar (40),
@delegacion varchar(50), @dui varchar (10)
as
begin
Insert into Oficiales values(@n_placa,@nombre,@apellido,@domicilio,@delegacion,@dui)
End

--------add_reporte---------
ALTER procedure [dbo].[add_reporte]
@n_motor varchar(50),@descripcion varchar(100),@lugar varchar(50),@reportado_por
varchar(50),@depto int
as
begin
insert into Vehiculos_Reportados (n_motor,descripcion,lugar,reportado_por,depto) values
(@n_motor,@descripcion,@lugar,@reportado_por,@depto)
end

----------add_usuario-------
ALTER procedure [dbo].[add_usuario]
@nombre varchar(15),@apellido varchar(15),@nick varchar (10),@password varchar(300)
as
begin
Insert into Usuario values (@nombre,@apellido,@nick,@password)
End

-------------addlicencia----------
ALTER procedure [dbo].[addlicencia]
@n_licencia varchar(8),@nombre varchar (15), @apellido varchar (15), @fecha1 datetime,
@fecha2 datetime ,@categoria varchar(15),@dui varchar(10)
as
begin
Insert into Licencias values(@n_licencia,@nombre,@apellido,@fecha1,@fecha2,@categoria,@dui)
End

--------addtarjeta----------
ALTER procedure [dbo].[addtarjeta]
@n_motor varchar (50),@n_placa varchar (10),@descripcion varchar (100),@marca varchar
(20),@modelo varchar (20),@año int,@propietario varchar (30),@fecha_emision
datetime,@fecha_vencimiento datetime, @dui varchar (10),@n_tarjeta varchar (10)
as
begin
insert into Tarjetas_Circulacion values
(@n_motor,@n_placa,@descripcion,@marca,@modelo,@año,@propietario,@fecha_emision,@fecha_venci
miento,@dui,@n_tarjeta)

11
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
end

----------addusuario----------

12
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
ALTER procedure [dbo].[addusuario]
@nombre varchar (15),@apellido varchar (15),@nick varchar (10),@password varchar (300)
as
begin
insert into Usuario values (@nombre,@apellido,@nick,@password)
end

---------borrarmulta---------
ALTER procedure [dbo].[borrarmulta]
@n_multa int
as
begin
delete from Multas where n_multa = @n_multa
end
----------Check_nick----------
ALTER procedure [dbo].[Check_Nink]
@nick varchar (10)
as
begin
if exists (select * from Usuario Where nick=@nick)
select -1
else
select 1
end

--------------checkduilicencia-----------
ALTER procedure [dbo].[checkduilicencia]
@dui varchar(10)
as
begin
if exists (select * from Licencias where dui = @dui)
select -1
else
select 1
end
-----------CheckDuiOficial-------------
ALTER procedure [dbo].[CheckDuiOficial]
@dui varchar(10)
as
begin
if exists (select * from Oficiales where dui=@dui)
select -1
else
select 1
end

------------CheckInfraccion------------
ALTER procedure [dbo].[CheckInfraccion]
@nombre varchar(50)
as
begin
if exists (select * from Infracciones where nombre=@nombre)
select -1
else
select 1
end

------------checlic------------
ALTER procedure [dbo].[checklic]
@licencia varchar(8)
as
begin
if exists (select * from Licencias where n_licencia=@licencia)
select -1
else
select 1
end

----------------checktargeta----------
ALTER procedure [dbo].[checktargeta]
@n_tarjeta varchar (10)

13
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
as
begin
if exists (select * from Tarjetas_Circulacion where n_tarjeta=@n_tarjeta)
select -1
else
select 1
end

------------chekeandomulta--------
ALTER procedure [dbo].[chekeandomulta]
@n_placa varchar(20),@n_licencia varchar(8)
as
if exists (select * from Licencias where n_licencia=@n_licencia)
begin
if exists (select * from Oficiales where n_placa=@n_placa)
select 1
else
select -1
end
else
select -1

------------consultarmultas-------------
ALTER procedure [dbo].[consultarmultas]
@licencia varchar(8)
as
begin
select
M.licencia,L.nombre,O.nombre,D.nombre,M.fecha_emision,M.fecha_vencimiento,M.descripcion,I.no
mbre,I.valor from Multas M inner join Infracciones I on M.infraccion=I.id_infraccion inner
join Departamentos D on M.lugar=D.id_depto inner join Licencias L on M.licencia=L.n_licencia
inner join Oficiales O on M.oficial=O.n_placa where M.licencia=@licencia
end

------------del_infraccion----------
ALTER procedure [dbo].[del_infraccion]
@id_infraccion int
as
begin
delete from Infracciones where id_infraccion=@id_infraccion
End

-------------del_oficiales--------------
ALTER procedure [dbo].[del_oficiales]
@n_placa varchar (20)
as
begin
delete from Oficiales where n_placa=@n_placa
End

-----------del_reporte-----------
ALTER procedure [dbo].[del_reporte]
@n_registro int
as
begin
delete from Vehiculos_Reportados where n_registro=@n_registro
end

---------------del_targetacirculacion---------
ALTER procedure [dbo].[del_targetacirculacion]
@n_tarjeta varchar (10)
as
begin
delete from Tarjetas_Circulacion where n_tarjeta=@n_tarjeta
End

-------------del_uauario-------------
ALTER procedure [dbo].[del_uauario]
@id_usu int
as
begin

14
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
delete from usuario where id_usu=@id_usu
End

---------delLicencia-----------
ALTER procedure [dbo].[del_uauario]
@id_usu int
as
begin
delete from usuario where id_usu=@id_usu
End

------------edit_infracciones--------------
ALTER procedure [dbo].[edit_infracciones]
@id_infraccion int, @nombre varchar(50),@valor decimal(18,2)
as
begin
update Infracciones set nombre=@nombre,valor=@valor where id_infraccion=@id_infraccion
End

-----------edit_oficiales--------
ALTER procedure [dbo].[edit_oficiales]
@n_placa varchar(20) , @nombre varchar(15),@apellido varchar (15),@domicilio
varchar(40),@delegacion varchar (50),@dui varchar (10)
as
begin
update Oficiales set
nombre=@nombre,apellido=@apellido,domicilio=@domicilio,delegacion=@delegacion,dui=@dui where
n_placa=@n_placa
End

---------------edit_reporte----------
ALTER procedure [dbo].[edit_reporte]
@n_motor varchar(50),@descripcion varchar(100),@fecha_reporte datetime,@lugar
varchar(50),@reportado_por varchar(50),@depto int,@n_registro int
as
begin
update Vehiculos_Reportados set
n_motor=@n_motor,descripcion=@descripcion,fecha_reporte=@fecha_reporte,lugar=@lugar,reportad
o_por=@reportado_por,depto=@depto where n_registro=@n_registro
end

------------edit_targetacirculacion-------------
ALTER procedure [dbo].[edit_targetacirculacion]
@n_motor varchar (50),@n_placa varchar (10),@descripcion varchar (100), @marca varchar
(20),@modelo varchar (20),@año int,@propietario varchar (30),@fecha_emision
datetime,@fecha_vencimiento datetime,@n_tarjeta varchar (10)
as
begin
update Tarjetas_Circulacion set
n_motor=@n_motor,n_placa=@n_placa,descripcion=@descripcion,marca=@marca,modelo=@modelo,año=@
año,propietario=@propietario,fecha_emision=@fecha_emision,fecha_vencimiento=@fecha_vencimien
to where n_tarjeta=@n_tarjeta
end

----------edit_usuario------------
ALTER procedure [dbo].[edit_usuario]
@id_usu int, @nombre varchar(15),@apellido varchar(15), @nick varchar(10),@password
varchar(300)
as
begin
update usuario set nombre=@nombre, apellido=@apellido, nick=@nick,password=@password where
id_usu=@id_usu
End

------------------edit_licencia------------------
ALTER procedure [dbo].[editlicencia]
@n_licencia varchar(8),@nombre varchar(15),@apellido varchar (15),@fecha_emision
datetime,@fecha_vencimiento datetime,@categoria varchar(15),@dui varchar (10)
as
begin

15
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
update Licencias set
nombre=@nombre,apellido=@apellido,fecha_emision=@fecha_emision,fecha_vencimiento=@fecha_venc
imiento,categoria=@categoria, dui=@dui where n_licencia=@n_licencia
End

------------ValidarUsuario--------

ALTER procedure [dbo].[ValidarUsuario]


@nick varchar(10), @password varchar(300)
as
begin
if exists(select id_usu from Usuario where nick=@nick and password=@password)
select 1
else
select -1
end

16
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Diseñ o del Sistema


Pantalla Principal:

 Para los Usuarios no Privilegiados:

- Existe un botón “Servicios” en el cual están las opciones de:

+ Consultar tus multas: donde el usuario introduce su licencia y le

muestra un listado con sus multas y cuanto debe al estado.

Acciones

17
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
En la Opción “Ver tus Multas”: se ingresa el numero de licencia y se

muestra el listado de multas que tienes pendientes.

Introduce su
licencia

Le muestra al usuario
su nombre, n. de
multas , total a pagar.
Y el detalle de las
multas

Al dar Clic en “Ver Infracciones”:

Numeros para ir
Se abre un ventana pasando las paginas
con un listado de (paginación)
infracciones

18
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Al dar clic en “Consultar Reglamento Vial”:

Se abre una ventana con el


reglamento Vial.

Generalizado:

Fecha y hora

Ver estructura del sitio (solo


Volver al Inicio Acciones del del usuario por razones de
Usuario seguridad)

Carga el formulario para


Carga Información de los que pueda enviarnos sus
desarrolladores dudas o sugerencias.

19
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
 Para los Administradores (Usuarios Privilegiados):

o Esta el formulario de Ingreso para acceso al área de

administradores.

El botón sirve para editar el campo luego el botón es para

guardar los cambios, o para cancelar los cambios.

El botón sirve para eliminar el campo.

20
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

Hora

Opciones del
Administrador
Formulario de Acceso Al
Área de
Administradores
Salir del Sistema
Al

ingresar tus credenciales te aparecerá el siguiente menú:

21
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al dar Clic en

Botón para agregar nuevo


Listado de Vehículos
Reporte
Reportados

Retorno al Menú

 Al dar Clic en “Nuevo Reporte”:

Campos necesarios para un nuevo


Reporte

Clic para Guardar el


Reporte

Regresar al Listado de
Reportes

22
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al dar Clic en se muestra lo siguiente:

Retorno al Menú
Botón para agregar nueva Listado de Tarjetas de
Tarjeta Circulación

 Al hacer clic en Nueva Tarjeta de Circulación se muestra el

siguiente formulario:

Campos necesarios para una nueva


Tarjeta (por favor siga el formato
mostrado en los campos)

Clic para Guardar la


Tarjeta

Regresar al Listado de
Tarjetas

23
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al hacer clic en pasamos a:

Retorno al Menú Botón para agregar nuevas Listado de Licencias


Licencias

 Al hacer clic en “Nueva Licencia” se cargar el Formulario:

Campos necesarios para una nueva


Licencia (por favor siga el formato
mostrado en los campos)

Regresar al Listado de
Licencias

Clic para Guardar la


Licencia

24
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al hacer clic en muestra lo siguiente

Botón para agregar un nuevo


Oficial de Transito

Retorno al Menú Listado de Oficiales

 Al Hacer clic en “nuevo oficial”

Campos necesarios para registrar un


nuevo oficial

Regresar al Listado de
Oficiales

Clic para Guardar un


nuevo oficial

25
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al hacer clic en

Paginación

Listado de infracciones

Botón para agregar una nueva


infracción
Retorno al Menú

 Al hacer clic en “Nueva Infracción”

Campos necesarios para agregar una


nueva infracción

Regresar al Listado de
infracciones

Clic para Guardar la


infracción

26
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al hacer clic en

Listado de administradores
Retorno al Menú

Botón para agregar un nuevo


administrador

 Al hacer clic en “Nuevo Administrador”

Campos necesarios para agregar un


administrador

Regresar al Listado de
administradores

Clic para Guardar el nuevo


administrador

27
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

 Al hacer clic

Listado de multas

Retorno al Menú
Botón para agregar una nueva
multa
 Al hacer clic en “Nueva Multa”

Campos necesarios para agregar una


multa

Clic para Guardar la nueva


Regresar al Listado de multa
multas

28
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Detalle de código fuente de cada modulo
-----------------------------------------------------INDEX.aspx-------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="INDEX.aspx.cs" Inherits="S.C.M.T.INDEX" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>--- S.C.M.T. ---</title>

<script language="JavaScript1.2" type="text/javascript">


<!--
function MM_findObj(n, d) { //v4.01
var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i]
[n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i <
(a.length - 2); i += 3)
if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src;
x.src = a[i + 2]; }
}
function MM_preloadImages() { //v3.0
var d = document; if (d.images) {
if (!d.MM_p) d.MM_p = new Array();
var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
}
}

//-->
</script>
<script language="JavaScript1.2" type="text/javascript" src="mm_css_menu.js"></script>
<style type="text/css" media="screen">
@import url("./menu.css");
#conte
{
text-align: center;
}
.style1
{
width: 100%;
}
.style3
{
height: 38px;
}
.style4
{
height: 43px;
}
.style2
{
text-align: center;
}
.style5
{
}
.style6

29
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
{
width: 754px;
}
.style7
{
color: #FFFFFF;
font-weight: bold;
font-size: large;
}
</style>
</head>
<body bgcolor="#ffffff"

onload="MM_preloadImages('menu_r2_c2_f2.gif','menu_r2_c2.gif','menu_r2_c4_f2.gif','menu_r2_c4.gif','menu_r2_c
6_f2.gif','menu_r2_c6.gif','menu_r2_c8_f2.gif','menu_r2_c8.gif','menu_r2_c10_f2.gif','menu_r2_c10.gif');"
background="imagenes/fondo.png">

<form id="form1" runat="server">


<table class="style1">
<tr>
<td colspan="2" style="font-size: medium; color: #FFFFFF; font-style: italic">

<div id="Div1" >


<span id="clock">

<script type="text/javascript" language="javascript">


<!-- Begin
var dayarray = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")
var montharray = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
function getthedate() {
var mydate = new Date()
var year = mydate.getYear()
if (year < 1000)
year += 1900
var day = mydate.getDay()
var month = mydate.getMonth()
var daym = mydate.getDate()
if (daym < 10)
daym = "" + daym
var hours = mydate.getHours()
var minutes = mydate.getMinutes()
var seconds = mydate.getSeconds()
var dn = "AM"
if (hours >= 12)
dn = "PM"
if (hours > 12) {
hours = hours - 12
}
{
d = new Date();
Time24H = new Date();
Time24H.setTime(d.getTime() + (d.getTimezoneOffset() * 60000) + 3600000);
}
if (hours == 0)
hours = 12
if (minutes <= 9)
minutes = "0" + minutes
if (seconds <= 9)
seconds = "0" + seconds
//change font size here
var cdate = dayarray[day] + " " + daym + " de " + montharray[month] + "&nbsp;" + year + "
&nbsp;" + hours + ":" + minutes + ":" + seconds + " " + dn + ""
if (document.all)
document.all.clock.innerHTML = cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML = cdate
else
document.write(cdate)
}

30
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
if (!document.all && !document.getElementById)
getthedate()
function goforit() {
if (document.all || document.getElementById)
setInterval("getthedate()", 1000)
}
window.onload = goforit
// End -->
</script>
<script>

function nuevoAjax(xmlhttp) {

try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp
}

function cargarContenido(pagina, destino) {


var contenedor;
var ajax;

contenedor = document.getElementById(destino);
ajax = nuevoAjax(ajax);
ajax.open("GET", pagina, true);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4) {
contenedor.innerHTML = ajax.responseText;
}
}
ajax.send(null);
}

</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i]
[n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i <
(a.length - 2); i += 3)
if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src;
x.src = a[i + 2]; }
}
function MM_preloadImages() { //v3.0
var d = document; if (d.images) {
if (!d.MM_p) d.MM_p = new Array();
var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
}
}
function pagina(paginax) {

31
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
window.open(paginax, "multas", "toolbar=0, resizable=0,scrollbars=1, width=600, height=500,
status=0");
window.focus();

function pagina2(paginax) {
window.open(paginax, "multas", "toolbar=0, resizable=0,scrollbars=1, width=900, height=500,
status=0");
window.focus();

function ir(pag) {
document.location = pag;
}

//-->
</script>
</span></div>

&nbsp;</td>
</tr>
<tr>
<td class="style6">
<embed src="/flashes/banner2.swf" type="application/x-shockwave-flash"
style="width: 655px; height: 154px;"></embed>
&nbsp;</td>
<td class="style2" style="border: thin dashed #FFFFFF">
<span class="style7">Area de Administradores</span><br />
<table align="right" class="style1">
<tr>
<td class="style3">
LOGIN</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server" Font-Bold="True" Font-Size="Medium" Height="24px"
style="margin-left: 0px" Width="154px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style4">
PASSWORD</td>
<td class="style4">
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password" Font-Bold="True"
Font-Size="Medium" Height="24px" Width="154px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2" colspan="2">
<asp:Button ID="btningresar" runat="server" onclick="Button1_Click"
Text="INGRESAR" />
<br />
<asp:Label ID="lbl1" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>

</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style5" colspan="2">

<div id="FWTableContainer278912974">
<table border="0" cellpadding="0" cellspacing="0" width="950">
<!-- fwtable fwsrc="menu.png" fwbase="menu.gif" fwstyle="Dreamweaver" fwdocid = "278912974" fwnested="0" -->
<tr>
<td><img src="spacer.gif" width="28" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="165" height="1" border="0" alt="" /></td>

32
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<td><img src="spacer.gif" width="16" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="16" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="15" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="25" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="165" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="25" height="1" border="0" alt="" /></td>
<td><img src="spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>

<tr>
<td colspan="11"><img name="menu_r1_c1" src="menu_r1_c1.gif" width="950" height="9" border="0"
id="menu_r1_c1" usemap="#m_menu_r1_c1" alt="" /></td>
<td><img src="spacer.gif" width="1" height="9" border="0" alt="" /></td>
</tr>
<tr>
<td rowspan="2"><img name="menu_r2_c1" src="menu_r2_c1.gif" width="28" height="75" border="0"
id="menu_r2_c1" usemap="#m_menu_r2_c1" alt="" /></td>
<td><a href="" onmouseout="MM_swapImage('menu_r2_c2','','menu_r2_c2.gif',1);"
onmouseover="MM_swapImage('menu_r2_c2','','menu_r2_c2_f2.gif',1);"><img name="menu_r2_c2"
src="menu_r2_c2.gif" width="165" height="67" border="0" id="menu_r2_c2" usemap="#m_menu_r2_c2" alt=""
onclick="javascript:ir('INDEX.aspx')"/></a></td>
<td rowspan="2"><img name="menu_r2_c3" src="menu_r2_c3.gif" width="16" height="75" border="0"
id="menu_r2_c3" usemap="#m_menu_r2_c3" alt="" /></td>
<td><a href="" onmouseout="MM_swapImage('menu_r2_c4','','menu_r2_c4.gif',1);"
onmouseover="MM_swapImage('menu_r2_c4','','menu_r2_c4_f2.gif',1);"><img name="menu_r2_c4"
src="menu_r2_c4.gif" width="165" height="67" border="0" id="menu_r2_c4" usemap="#m_menu_r2_c4" alt=""
onclick="javascript:cargarContenido('quienessomos.aspx','conte')" /></a></td>
<td rowspan="2"><img name="menu_r2_c5" src="menu_r2_c5.gif" width="16" height="75" border="0"
id="menu_r2_c5" usemap="#m_menu_r2_c5" alt="" /></td>
<td><a href="javascript:;"
onmouseout="MM_swapImage('menu_r2_c6','','menu_r2_c6.gif',1);MM_menuStartTimeout(1000);"
onmouseover="MM_menuShowMenu('MMMenuContainer0525203338_0', 'MMMenu0525203338_0',-
261,67,'menu_r2_c6');MM_swapImage('menu_r2_c6','','menu_r2_c6_f2.gif',1);"><img name="menu_r2_c6"
src="menu_r2_c6.gif" width="165" height="67" border="0" id="menu_r2_c6" usemap="#m_menu_r2_c6" alt=""
onclick="javascript:cargarContenido('servicios.aspx','conte');" /></a></td>
<td rowspan="2"><img name="menu_r2_c7" src="menu_r2_c7.gif" width="15" height="75" border="0"
id="menu_r2_c7" usemap="#m_menu_r2_c7" alt="" /></td>
<td><a href="javascript:;" onmouseout="MM_swapImage('menu_r2_c8','','menu_r2_c8.gif',1);"
onmouseover="MM_swapImage('menu_r2_c8','','menu_r2_c8_f2.gif',1);"><img name="menu_r2_c8"
src="menu_r2_c8.gif" width="165" height="67" border="0" id="menu_r2_c8" usemap="#m_menu_r2_c8" alt=""
onclick="javascript:cargarContenido('contactanos.aspx','conte')" /></a></td>
<td rowspan="2"><img name="menu_r2_c9" src="menu_r2_c9.gif" width="25" height="75" border="0"
id="menu_r2_c9" usemap="#m_menu_r2_c9" alt="" /></td>
<td><a href="javascript:;" onmouseout="MM_swapImage('menu_r2_c10','','menu_r2_c10.gif',1);"
onmouseover="MM_swapImage('menu_r2_c10','','menu_r2_c10_f2.gif',1);"><img name="menu_r2_c10"
src="menu_r2_c10.gif" width="165" height="67" border="0" id="menu_r2_c10" usemap="#m_menu_r2_c10" alt=""
onclick="javascript:cargarContenido('sitemap.aspx','conte')" /></a></td>
<td rowspan="2"><img name="menu_r2_c11" src="menu_r2_c11.gif" width="25" height="75" border="0"
id="menu_r2_c11" usemap="#m_menu_r2_c11" alt="" /></td>
<td><img src="spacer.gif" width="1" height="67" border="0" alt="" /></td>
</tr>
<tr>
<td><img name="menu_r3_c2" src="menu_r3_c2.gif" width="165" height="8" border="0" id="menu_r3_c2"
usemap="#m_menu_r3_c2" alt="" /></td>
<td><img name="menu_r3_c4" src="menu_r3_c4.gif" width="165" height="8" border="0" id="menu_r3_c4"
usemap="#m_menu_r3_c4" alt="" /></td>
<td><img name="menu_r3_c6" src="menu_r3_c6.gif" width="165" height="8" border="0" id="menu_r3_c6"
usemap="#m_menu_r3_c6" alt="" /></td>
<td><img name="menu_r3_c8" src="menu_r3_c8.gif" width="165" height="8" border="0" id="menu_r3_c8"
usemap="#m_menu_r3_c8" alt="" /></td>
<td><img name="menu_r3_c10" src="menu_r3_c10.gif" width="165" height="8" border="0" id="menu_r3_c10"
usemap="#m_menu_r3_c10" alt="" /></td>
<td><img src="spacer.gif" width="1" height="8" border="0" alt="" /></td>
</tr>
</table>
<map name="m_menu_r1_c1" id="m_menu_r1_c1">
<area shape="rect" coords="0,0,950,84" href="javascript:;" alt="" />
</map>

33
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<map name="m_menu_r2_c1" id="m_menu_r2_c1">
<area shape="rect" coords="0,-9,950,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r2_c2" id="m_menu_r2_c2">
<area shape="rect" coords="-28,-9,922,75" href="javascript:;" alt=""
onmouseout="MM_swapImage('menu_r2_c2','','menu_r2_c2.gif',1);"
onmouseover="MM_swapImage('menu_r2_c2','','menu_r2_c2_f2.gif',1);" />
</map>
<map name="m_menu_r2_c3" id="m_menu_r2_c3">
<area shape="rect" coords="-193,-9,757,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r2_c4" id="m_menu_r2_c4">
<area shape="rect" coords="-209,-9,741,75" href="javascript:;" alt=""
onmouseout="MM_swapImage('menu_r2_c4','','menu_r2_c4.gif',1);"
onmouseover="MM_swapImage('menu_r2_c4','','menu_r2_c4_f2.gif',1);" />
</map>
<map name="m_menu_r2_c5" id="m_menu_r2_c5">
<area shape="rect" coords="-374,-9,576,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r2_c6" id="m_menu_r2_c6">
<area shape="rect" coords="-390,-9,560,75" href="javascript:;" alt=""
onmouseout="MM_swapImage('menu_r2_c6','','menu_r2_c6.gif',1);MM_menuStartTimeout(1000);"
onmouseover="MM_menuShowMenu('MMMenuContainer0525203338_0', 'MMMenu0525203338_0',-
651,58,'menu_r2_c6');MM_swapImage('menu_r2_c6','','menu_r2_c6_f2.gif',1);" />
</map>
<map name="m_menu_r2_c7" id="m_menu_r2_c7">
<area shape="rect" coords="-555,-9,395,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r2_c8" id="m_menu_r2_c8">
<area shape="rect" coords="0, 0, 950, 84" href="javascript:;" alt=""
onmouseout="MM_swapImage('menu_r2_c8','','menu_r2_c8.gif',1);"
onmouseover="MM_swapImage('menu_r2_c8','','menu_r2_c8_f2.gif',1);" />
</map>
<map name="m_menu_r2_c9" id="m_menu_r2_c9">
<area shape="rect" coords="-735,-9,215,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r2_c10" id="m_menu_r2_c10">
<area shape="rect" coords="-760,-9,190,75" href="javascript:;" alt=""
onmouseout="MM_swapImage('menu_r2_c10','','menu_r2_c10.gif',1);"
onmouseover="MM_swapImage('menu_r2_c10','','menu_r2_c10_f2.gif',1);" />
</map>
<map name="m_menu_r2_c11" id="m_menu_r2_c11">
<area shape="rect" coords="-925,-9,25,75" href="javascript:;" alt="" />
</map>
<map name="m_menu_r3_c2" id="m_menu_r3_c2">
<area shape="rect" coords="-28,-76,922,8" href="javascript:;" alt="" />
</map>
<map name="m_menu_r3_c4" id="m_menu_r3_c4">
<area shape="rect" coords="-209,-76,741,8" href="javascript:;" alt="" />
</map>
<map name="m_menu_r3_c6" id="m_menu_r3_c6">
<area shape="rect" coords="-390,-76,560,8" href="javascript:;" alt="" />
</map>
<map name="m_menu_r3_c8" id="m_menu_r3_c8">
<area shape="rect" coords="-570,-76,380,8" href="javascript:;" alt="" />
</map>
<map name="m_menu_r3_c10" id="m_menu_r3_c10">
<area shape="rect" coords="-760,-76,190,8" href="javascript:;" alt="" />
</map>
<div id="MMMenuContainer0525203338_0">
<div id="MMMenu0525203338_0" onmouseout="MM_menuStartTimeout(1000);" onmouseover="MM_menuResetTimeout();">
<a href="javascript:pagina('consultarmultas.aspx')" id="MMMenu0525203338_0_Item_0"
class="MMMIFHStyleMMMenu0525203338_0" onmouseover="MM_menuOverMenuItem('MMMenu0525203338_0');">
Ver&nbsp;tus&nbsp;Multas
</a>
<a href="javascript:pagina('verinfracciones.aspx')" id="MMMenu0525203338_0_Item_1"
class="MMMIHStyleMMMenu0525203338_0" onmouseover="MM_menuOverMenuItem('MMMenu0525203338_0');">
Ver&nbsp;las&nbsp;Infracciones
</a>
<a href="javascript:pagina2('verreglas.aspx')" id="MMMenu0525203338_0_Item_2"
class="MMMIHStyleMMMenu0525203338_0" onmouseover="MM_menuOverMenuItem('MMMenu0525203338_0');">

34
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Consultar&nbsp;el&nbsp;Reglamento&nbsp;Vial
</a>
</div>
</div>
</div
&nbsp;</td>
</tr>
<tr>
<td class="style5" colspan="2">
</td>
</tr>
</table>
</form>
<div id="conte" align="center"
style="text-align: center; vertical-align: middle">

<embed src="/flashes/bannerbienvenida.swf" type="application/x-shockwave-flash"


style="width: 587px; height: 81px;"></embed>

<br />
<br />
El sistema&nbsp;
<img alt="d" src="imagenes/logo.png" style="width: 96px; height: 36px" />&nbsp;
te da la Bienvenida a su sitio.<br />
<br />
En este lugar puedes consultar la cantidad de multas que tienes pendientes y
cuanto debes en total,<br />
&nbsp;ademas puedes ver el detalle de cada una de ellas, claro que si tienes una
licencia de conducir.<br />
&nbsp;</div>
</body>
</html>

---------------------------------------------------INDEX.aspx.cs-----------------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace S.C.M.T
{
public partial class INDEX : System.Web.UI.Page
{
ScriptManager scriptajax1 = new ScriptManager();
protected void Page_Load(object sender, EventArgs e)
{

}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.; Integrated Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;
protected void Button1_Click(object sender, EventArgs e)
{
objConex.ConnectionString = strConex;
objConex.Open();

objCmd = new SqlCommand("ValidarUsuario", objConex);

35
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@nick", SqlDbType.VarChar).Value = TextBox1.Text;
objCmd.Parameters.Add("@password", SqlDbType.VarChar).Value = TextBox2.Text;
int exist;
exist = Convert.ToInt32(objCmd.ExecuteScalar());
string nombre;
SqlDataReader LEC;
objCmd = new SqlCommand("Select nombre from Usuario where nick='" + TextBox1.Text + "'",
objConex);
objCmd.CommandType = CommandType.Text;
LEC = objCmd.ExecuteReader();
LEC.Read();
if (exist > 0)
{
nombre = LEC[0].ToString();
Session["NOMBRE"] = nombre;
Response.Redirect("menuadmin.aspx");
LEC.Close();
}
else
{
lbl1.Text = "Datos Incorrectos";
}
objConex.Close();
}
}
}

------------------------------------------------------servicios.aspx----------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="servicios.aspx.cs" Inherits="S.C.M.T.servicios" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>-- Servicios --</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 564px;
}
.style3
{
width: 52px;
}
</style>
<script>
function pagina(paginax) {
window.open(paginax, "multas", "toolbar=0, resizable=0,scrollbars=1, width=600, height=500,
status=0");
window.focus();
}
function pagina2(paginax) {
window.open(paginax, "multas", "toolbar=0, resizable=0,scrollbars=1, width=900, height=500,
status=0");
window.focus();
}

36
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</script>
</head>
<body>
<form id="form1" runat="server"
style="vertical-align: middle; text-align: center">
<div>
<asp:Panel ID="Panel1" runat="server">
<table class="style1" cellpadding="1" cellspacing="1">
<tr>
<td class="style2">
<br />
&nbsp;El sistema S.C.M.T. te ofrece los siguientes servicios, para que puedas llevar
un control de tus multas y asi no te cobren mora.<br />
<br />
<br />
</td>
<td align="justify" valign="top">
Elige una opcion:<br />
<br />
<table class="style1">
<tr>
<td class="style3">
<a href="javascript:pagina('consultarmultas.aspx')"><img alt="d"
src="imagenes/ticket.png" style="width: 57px; height: 57px" /></a></td>
<td>
<a href="javascript:pagina('consultarmultas.aspx')">Consultar tus
Multas</a></td>
</tr>
<tr>
<td class="style3">
<a href="javascript:pagina('verinfraccciones.aspx')"><img alt="x"
src="imagenes/3367786-illustration-of-no-passing-road-sign-with-two-
cars.jpg"
style="width: 53px; height: 55px" /></a></td>
<td>
<a href="javascript:pagina('verinfracciones.aspx')"> Ver el listado de
Infracciones</a></td>
</tr>
<tr>
<td class="style3">
<a href="javascript:pagina2('verreglas.aspx')"> <img alt="n"
src="imagenes/Reglamento(2).jpg"
style="width: 56px; height: 51px" /></a></td>
<td>
<a href="javascript:pagina2('verreglas.aspx')">Ver el reglamento
Vial</a></td>
</tr></table><br /><br/></td></tr></table></asp:Panel></div></form></body></html>

-----------------------------------------------------verinfracciones.aspx---------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="verinfracciones.aspx.cs"
Inherits="S.C.M.T.verinfracciones" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Ver Infracciones</title>
</head>
<body style="text-align: center" background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<img alt="mj" src="imagenes/imageninfracciones.png"


style="width: 600px; height: 100px" /><br />
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"

37
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
AutoGenerateColumns="False" DataKeyNames="id_infraccion"
DataSourceID="SqlDataSource1" Width="348px" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:BoundField DataField="id_infraccion" HeaderText="id_infraccion"
InsertVisible="False" ReadOnly="True" SortExpression="id_infraccion"
Visible="False" />
<asp:BoundField DataField="nombre" HeaderText="nombre"
SortExpression="Nombre" />
<asp:BoundField DataField="valor" HeaderText="valor"
SortExpression="Valor de la Infraccion" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="SELECT * FROM [Infracciones]"></asp:SqlDataSource>

</div>
</form>
</body>
</html>
---------------------------------------------------------consultarmultas.aspx--------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="consultarmultas.aspx.cs"
Inherits="S.C.M.T.consultarmultas" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Consulta de Multas --</title>
<style type="text/css">
.style1
{
width: 100%;
}

</style>

</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<br />
<br />
<table class="style1">
<tr>
<td>
Consulta de multas</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="255px" MaxLength="8"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Formato de Licencia Incorrecto!"
ValidationExpression="\d{3}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XXX-XXXX&quot;)<br />

38
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Consultar"
Width="90px" />
<br />
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
</td>
</tr>
</table>
<br />
<br />
<asp:Panel ID="Panel1" runat="server" Visible="False">
&nbsp;<asp:Label ID="Label2" runat="server" ForeColor="White" Font-Bold="True"
Font-Size="Large"></asp:Label><br />
<br />
<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Size="Large"
ForeColor="White"></asp:Label>
<br />
<br />
<asp:Label ID="Label4" runat="server" ForeColor="White" Font-Bold="True"
Font-Size="Large"></asp:Label>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" AllowPaging="True" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:BoundField DataField="licencia" HeaderText="N° Licencia"
SortExpression="licencia" />
<asp:BoundField DataField="nombre" HeaderText="Nombre del Conductor"
SortExpression="nombre" />
<asp:BoundField DataField="nombre1" HeaderText="Oficial que levanto la Multa"
SortExpression="nombre1" />
<asp:BoundField DataField="nombre2" HeaderText="Departamento"
SortExpression="nombre2" />
<asp:BoundField DataField="fecha_emision" HeaderText="Fecha de Imposicion"
SortExpression="fecha_emision" />
<asp:BoundField DataField="fecha_vencimiento" HeaderText="Fecha Limite de Pago"
SortExpression="fecha_vencimiento" />
<asp:BoundField DataField="descripcion" HeaderText="Descripcion de los Hechos"
SortExpression="descripcion" />
<asp:BoundField DataField="nombre3" HeaderText="Nombre de La Infraccion"
SortExpression="nombre3" />
<asp:BoundField DataField="valor" HeaderText="valor"
SortExpression="valor" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="consultarmultas" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="licencia" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Panel>
<br />

</div>
</form>
</body>
</html>
--------------------------------------------------consultarmultas.aspx.cs------------------------------------------------

39
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class consultarmultas : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SetFocus(TextBox1);
}

string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated Security=SSPI";


SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;
protected void Button1_Click(object sender, EventArgs e)
{
objConex.ConnectionString = strConex;
Label2.Text = "";
Label4.Text = "";
Panel1.Visible = false;
objConex.Open();
SqlCommand objCmd2;
objCmd2 = new SqlCommand("checklic", objConex);
objCmd2.CommandType = CommandType.StoredProcedure;
objCmd2.Parameters.Add("@licencia", SqlDbType.VarChar).Value = TextBox1.Text;
int no;
no = Convert.ToInt32(objCmd2.ExecuteScalar());
if (no < 0)
{
try
{
string nombre;
SqlDataReader LEC;
objCmd = new SqlCommand("Select nombre from Licencias where n_licencia='" + TextBox1.Text
+ "'", objConex);
objCmd.CommandType = CommandType.Text;
LEC = objCmd.ExecuteReader();
LEC.Read();

nombre = LEC[0].ToString();
Session["NOMBRE2"] = nombre;

objCmd = new SqlCommand("select COUNT(*) from Multas where licencia='" + TextBox1.Text +


"'", objConex);
objCmd.CommandType = CommandType.Text;

LEC.Close();
Label2.Visible = true;
Label3.Visible = true;
Label4.Visible = true;
Panel1.Visible = true;
int nmultas;
nmultas = Convert.ToInt32(objCmd.ExecuteScalar());
Label2.Text = "El usuario :" + Session["NOMBRE2"].ToString();
Label3.Text = "Posee " + nmultas + " multas por pagar";
SqlCommand objCmd3;
objCmd3 = new SqlCommand("select SUM(I.valor) from Multas M inner join Infracciones I on
M.infraccion=I.id_infraccion where M.licencia='" + TextBox1.Text+"'", objConex);
objCmd3.CommandType = CommandType.Text;

40
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
decimal total;
total = Convert.ToDecimal(objCmd3.ExecuteScalar());
Label4.Text = "Usted debe una cantidad de: " + total + " $US";

}
catch (Exception ex)
{

}
}
else
{
Response.Write("<scr" + "ipt language=javascript>alert('Verifique su N°de licencia porque no
esencuentra');</" + "script>");
Panel1.Visible = false;

SetFocus(TextBox1);
}
}}}

---------------------------------------------------verreglas.aspx-----------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="verreglas.aspx.cs" Inherits="S.C.M.T.verreglas" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Reglamento Vial</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>
<embed src="/flashes/reglamento_gral_transito_Y_seg_vial.swf"
type="application/x-shockwave-flash" style="height: 532px; width: 988px"
></embed>
</div>
</form>
</body>
</html>
-----------------------------------------------------menuadmin.aspx-------------------------------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="menuadmin.aspx.cs"


Inherits="S.C.M.T.menuadmin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Bienvenido --</title>
<style type="text/css">
.style4
{
width: 165px;
text-align: center;
}
.style5
{
width: 196px;

41
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
text-align: center;
}
.style6
{
width: 193px;
text-align: center;
}
.style7
{
text-align: center;
}
.style8
{
font-weight: bold;
text-decoration: underline;
}
.style9
{
font-weight: bold;
text-decoration: underline;
font-size: xx-large;
}
.style10
{
width: 165px;
text-align: center;
height: 96px;
}
.style11
{
width: 196px;
text-align: center;
height: 96px;
}
.style12
{
width: 193px;
text-align: center;
height: 96px;
}
.style13
{
width: 100%;
}
.style19
{
border-style:solid;
}
.style20
{
width: 613px;
}
.style21
{
width: 197px;
}
.style22

42
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
{
font-weight: normal;
}
.style23
{
width: 717px;
}
</style>
</head>
<body bgcolor="#000000" background="imagenes/fondo.png">
<form id="form1" runat="server">
<div style="color: #FFFFFF">

<table class="style13">
<tr>
<td class="style21" style="border: medium inset #FFFFFF">
<img alt="d" src="imagenes/logo.png" style="width: 264px; height:
80px" /></td>
<td class="style23"
style="border-style: inset; border-width: medium; border-color:
white">

<br />
<span class="style9">Bienvenido:</span><b>&nbsp;&nbsp;&nbsp;
<span class="style22">
<asp:Label ID="lblnombre" runat="server"

style="text-decoration: underline; font-weight: 700; font-


style: italic; font-size: xx-large"></asp:Label>
</span></b>
<br />
<br />
&nbsp;&nbsp;&nbsp; <span class="style8">Seleccione una Opcion para
comenzar:</span></td>
<td class="style20"
style="border: medium inset white; text-align: center;">

<embed src="/flashes/Reloj de pared.swf" type="application/x-


shockwave-flash"
style="width: 112px; height: 114px;"></embed></td>
</tr>
<tr>
<td colspan="3" style="text-align: center">
</embed>
&nbsp;<img alt="s" src="imagenes/imagenmenu.png"

style="width: 600px; height: 78px; text-align: center; margin-


right: 0px;" /></td>
</tr>
<tr>
<td colspan="3">
<br />
<table align="center" border="2" class="style19"
style="border-style: inset; border-width: thick">
<tr>
<td class="style10">

43
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<a href="vehiculos_robados.aspx"><img alt="car"
src="imagenes/27203532_1.jpg"
style="width: 150px; height: 111px" /></a><br />
<a href="vehiculos_robados.aspx">Vehiculos Robados</a></td><td
class="style11">
<a href = "targetasdecirculacion.aspx"><img alt="CirculationCards"
src="imagenes/Placas_de_Chihuahua.jpg"
style="width: 118px; height: 82px" /></a> <br />
<a href = "targetasdecirculacion.aspx"> Tarjetas de Circulacion</a></td>
<td class="style12">
<a href="licencias.aspx"><img alt="Licen" src="imagenes/Licencia.gif"
style="width: 135px; height: 96px" /></a><br />
<a href="licencias.aspx">Licencias de Conducir</a></td>
<td rowspan="2" class="style7">
<a href="multa.aspx"> <img alt="TraficTicket"
src="imagenes/contest-traffic-ticket.jpg"
style="width: 121px; height: 115px" /></a><br />
<a href="multa.aspx">Multas</a></td>
</tr>
<tr>
<td class="style4">
<a href="oficiales.aspx"> <img alt="Ofice"
src="imagenes/12236135462135583048radacina_policeman.svg.hi.png"
style="width: 68px; height: 84px" /></a><br />
<a href = "oficiales.aspx">Oficiales de Transito</a></td><td
class="style5">
<a href="infracciones.aspx"><img alt="Infracctions"
src="imagenes/3367786-illustration-of-no-passing-road-sign-with-
two-cars.jpg"
style="width: 94px; height: 87px" /></a><br />
<a href= "infracciones.aspx">Infracciones de transito</a></td>
<td class="style6">
<a href = "administradores.aspx"><img alt="Admin"
src="imagenes/Entorno_7217774_XS.jpg"
style="width: 102px; height: 93px" /></a><br />
<a href ="administradores.aspx">Administradores</a> </td>
</tr>
</table>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="INDEX.aspx"><img alt="" src="imagenes/salir.png"
style="width: 47px; height: 34px" /></a><br />
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/INDEX.aspx">Salir del Sistema</asp:HyperLink>
</td>
</tr></table>
<br /><br /><br /><br /><br /><br /></div>
</form>
</body>
</html>

---------------------------------------vehiculos_robados.aspx-----------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="vehiculos_robados.aspx.cs"
Inherits="S.C.M.T.vehiculos_robados" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

44
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Vehiculos Robados</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>
Vehiculos Robados</h2>
<p>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="n_registro" DataSourceID="SqlDataSource1"
style="margin-top: 19px" BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ShowDeleteButton="True"
ButtonType="Image" CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif" EditImageUrl="~/imagenes/editar.png"
UpdateImageUrl="~/imagenes/listo.jpg" />
<asp:BoundField DataField="n_motor" HeaderText="n_motor"
SortExpression="n_motor" />
<asp:BoundField DataField="descripcion" HeaderText="descripcion"
SortExpression="descripcion" />
<asp:BoundField DataField="fecha_reporte" HeaderText="fecha_reporte"
SortExpression="fecha_reporte" />
<asp:BoundField DataField="lugar" HeaderText="lugar" SortExpression="lugar" />
<asp:BoundField DataField="reportado_por" HeaderText="reportado_por"
SortExpression="reportado_por" />
<asp:BoundField DataField="depto" HeaderText="depto" SortExpression="depto"
Visible="False" />
<asp:BoundField DataField="n_registro" HeaderText="n_registro"
InsertVisible="False" ReadOnly="True" SortExpression="n_registro"
Visible="False" />
<asp:TemplateField HeaderText="Departamento">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource2" DataTextField="nombre"
DataValueField="id_depto"
Enabled="False" SelectedIndex='<%# Eval("depto") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="SELECT * FROM [Departamentos]"></asp:SqlDataSource>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="del_reporte" DeleteCommandType="StoredProcedure"
SelectCommand="select * from Vehiculos_Reportados" UpdateCommand="edit_reporte"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_registro" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="n_motor" Type="String" />
<asp:Parameter Name="descripcion" Type="String" />
<asp:Parameter Name="fecha_reporte" Type="DateTime" />
<asp:Parameter Name="lugar" Type="String" />
<asp:Parameter Name="reportado_por" Type="String" />
<asp:Parameter Name="depto" Type="Int32" />
<asp:Parameter Name="n_registro" Type="Int32" />

45
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</UpdateParameters>
</asp:SqlDataSource>
</p>
<p>
&nbsp;</p>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Nuevo Reporte" />
</p>

</div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink>
</form>
</body>
</html>

----------------------vehiculos_robados.aspx.cs--------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class vehiculos_robados : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("nuevo_reporte.aspx");
}
}
}

---------------------------nuevo_reporte.aspx----------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevo_reporte.aspx.cs"
Inherits="S.C.M.T.nuevo_reporte" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Nuevo Reporte</title>
<style type="text/css">
.style1
{
width: 67%;
}
.style11
{
height: 51px;
}
.style9
{
width: 140px;
height: 48px;
}

46
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
.style10
{
height: 48px;
width: 456px;
}
.style5
{
height: 81px;
width: 140px;
}
.style3
{
height: 81px;
width: 456px;
}
.style6
{
height: 107px;
width: 140px;
}
.style2
{
height: 107px;
width: 456px;
}
.style7
{
width: 140px;
height: 103px;
}
.style8
{
height: 103px;
width: 456px;
}
.style4
{
width: 140px;
}
.style12
{
width: 456px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<table align="center" class="style1">
<tr>
<td class="style11" colspan="2">
<h2>
Nuevo Reporte de Vehiculo Robado</h2>
</td>
</tr>
<tr>
<td class="style9">
<h4>
N° de Motor del Vehiculo</h4>
</td>
<td class="style10">
<asp:TextBox ID="TextBox1" runat="server" Width="217px" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Campo Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style5">
<h4>
Departamento del Robo</h4>
</td>
<td class="style3">

47
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="nombre" DataValueField="id_depto"
Width="182px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="SELECT * FROM [Departamentos]"></asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="DropDownList1" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style6">
<h4>
Direccion</h4>
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" runat="server" Height="79px" TextMode="MultiLine"
Width="286px" MaxLength="50" ontextchanged="TextBox2_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Campo Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style7">
<h4>
Descripcion</h4>
</td>
<td class="style8">
<asp:TextBox ID="TextBox3" runat="server" Height="80px" TextMode="MultiLine"
Width="282px" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Campo Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style4">
<h4>
Reportado por</h4>
</td>
<td class="style12">
<asp:TextBox ID="TextBox4" runat="server" style="margin-bottom: 20px"
Width="258px" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox4" ErrorMessage="Campo Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Guardar Reporte" />
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
</td>
</tr>
</table>
<div>

</div>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/vehiculos_robados.aspx">Retornar</asp:HyperLink>
</form>

</body>
</html>

-----------------------------nuevo_reporte.aspx.cs----------------------

48
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class nuevo_reporte : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated Security=SSPI";


SqlConnection objConex=new SqlConnection();
SqlCommand objCmd;

protected void Button1_Click(object sender, EventArgs e)


{
objConex.ConnectionString = strConex;
objConex.Open();
objCmd = new SqlCommand("add_reporte", objConex);
objCmd.CommandType = CommandType.StoredProcedure;

objCmd.Parameters.Add("@n_motor", SqlDbType.VarChar).Value = TextBox1.Text;


objCmd.Parameters.Add("@descripcion", SqlDbType.VarChar).Value = TextBox3.Text;
objCmd.Parameters.Add("@lugar", SqlDbType.VarChar).Value =TextBox2.Text;
objCmd.Parameters.Add("@reportado_por", SqlDbType.VarChar).Value = TextBox4.Text;
objCmd.Parameters.Add("@depto", SqlDbType.Int).Value = Convert.ToInt32(DropDownList1.Text);
if (objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "Reporte agregado correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";

Response.Write("<scr" + "ipt language=javascript>alert('Listo');</" + "script>");

}
else
{
lbl.Text = "El Reporte no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('El Reporte no se pudo
agregar...');</" + "script>");
}
objConex.Close();

protected void TextBox2_TextChanged(object sender, EventArgs e)


{

}
}
}
------------------------------------targetasdecirculacion.aspx-----------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="targetasdecirculacion.aspx.cs"


Inherits="S.C.M.T.targetasdecirculacion" %>

49
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Tarjetas de Circulacion</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>
Tarjetas de Circulacion</h2>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"


DataKeyNames="n_tarjeta" DataSourceID="SqlDataSource2" Width="1012px"
BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
CellPadding="3" GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif" EditImageUrl="~/imagenes/editar.png"
UpdateImageUrl="~/imagenes/listo.jpg" ButtonType="Image" />
<asp:BoundField DataField="n_tarjeta" HeaderText="N° Tarjeta" ReadOnly="True"
SortExpression="n_tarjeta" />
<asp:BoundField DataField="n_motor" HeaderText="N° de Motor"
SortExpression="n_motor" />
<asp:BoundField DataField="n_placa" HeaderText="Placa de Vehiculo"
SortExpression="n_placa" />
<asp:BoundField DataField="descripcion" HeaderText="Descripcion del Vehiculo"
SortExpression="descripcion" />
<asp:BoundField DataField="marca" HeaderText="Marca de Vehiculo"
SortExpression="marca" />
<asp:BoundField DataField="modelo" HeaderText="Modelo de Vehiculo"
SortExpression="modelo" />
<asp:BoundField DataField="año" HeaderText="Año del Vehiculo"
SortExpression="año" />
<asp:BoundField DataField="propietario" HeaderText="Nombre del Propietario"
SortExpression="propietario" />
<asp:BoundField DataField="fecha_emision" HeaderText="Fecha de Emision"
SortExpression="fecha_emision" />
<asp:BoundField DataField="fecha_vencimiento" HeaderText="Fecha de Vencimiento"
SortExpression="fecha_vencimiento" />
<asp:BoundField DataField="dui" HeaderText="dui" SortExpression="dui"
Visible="False" ReadOnly="True" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="del_targetacirculacion" DeleteCommandType="StoredProcedure"
SelectCommand="select * from Tarjetas_Circulacion "
UpdateCommand="edit_targetacirculacion" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_tarjeta" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="n_motor" Type="String" />
<asp:Parameter Name="n_placa" Type="String" />
<asp:Parameter Name="descripcion" Type="String" />
<asp:Parameter Name="marca" Type="String" />
<asp:Parameter Name="modelo" Type="String" />
<asp:Parameter Name="año" Type="Int32" />
<asp:Parameter Name="propietario" Type="String" />
<asp:Parameter Name="fecha_emision" Type="DateTime" />

50
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:Parameter Name="fecha_vencimiento" Type="DateTime" />
<asp:Parameter Name="n_tarjeta" Type="String" />

</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="del_targetacirculacion" DeleteCommandType="StoredProcedure"
InsertCommand="add_infracciones" InsertCommandType="StoredProcedure"
SelectCommand="select * from Tarjetas_Circulacion "
UpdateCommand="edit_targetacirculacion" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_tarjeta" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="n_motor" Type="String" />
<asp:Parameter Name="n_placa" Type="String" />
<asp:Parameter Name="descripcion" Type="String" />
<asp:Parameter Name="marca" Type="String" />
<asp:Parameter Name="modelo" Type="String" />
<asp:Parameter Name="año" Type="Int32" />
<asp:Parameter Name="propietario" Type="String" />
<asp:Parameter Name="fecha_emision" Type="DateTime" />
<asp:Parameter Name="fecha_vencimiento" Type="DateTime" />
<asp:Parameter Name="n_tarjeta" Type="String" />
<asp:Parameter Name="dui" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="nombre" Type="String" />
<asp:Parameter Name="valor" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>

<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Nueva Tarjeta de Circulacion" Height="39px" />

</div>
<br />
<p>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink>
</p>
</form>
</body>
</html>
---------------------------------------tarjetasdecirculacion.aspx.cs--------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class targetasdecirculacion : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{

51
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Response.Redirect("tarjeta.aspx");
}
}
}

--------------------------------------------tarjeta.aspx---------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tarjeta.aspx.cs"
Inherits="S.C.M.T.targeta" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title> Nueva Tarjeta</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
}
.style3
{
width: 351px;
height: 23px;
}
.style4
{
height: 23px;
}
.style5
{
height: 58px;
}
.style6
{
text-align: center;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<br />
<table class="style1" align="center">
<tr>
<td class="style2" colspan="2">
<h2 class="style6">
Registro de Tarjetas de Circulacion</h2>
</td>
</tr>
<tr>
<td class="style5">
Numero de Tarjeta</td>

52
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<td class="style5">
<asp:TextBox ID="TextBox1" runat="server" Height="25px"
Width="204px"
MaxLength="13"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Formato de N Tarjeta
Incorrecto"

ValidationExpression="\d{4}\-\d{3}\-\d{2}\-\d{1}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XXXX-XXX-XX-X&quot;)</td>
</tr>
<tr>
<td class="style3">
Numero de Motor</td>
<td class="style4">
<asp:TextBox ID="TextBox2" runat="server" MaxLength="50"
Width="180px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
<br />
</td>
</tr>
<tr>
<td class="style2">
Numero de Placa de Vehiculo</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" MaxLength="10"
Width="158px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server"
ControlToValidate="TextBox3" ErrorMessage="Formato de Placa
Incorrecto"

ValidationExpression="\D\b\D\D\d\d\d\-\d\d|\D\D\D\D\d\d\d\-\d\d"></asp:RegularExpressio
nValidator>
<br />
(Debe ser: &quot;A AAXXX-XX&quot; ó &quot;AAAAXXX-X&quot;</td>
</tr>
<tr>
<td class="style2">
Descripcion</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" MaxLength="100"
Width="211px"

53
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Height="78px" TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Marca</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" Height="22px"
MaxLength="20"
Width="158px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Modelo</td>
<td>
<asp:TextBox ID="TextBox6" runat="server" MaxLength="20"
Width="159px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox6"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Año</td>
<td>
<asp:TextBox ID="TextBox7" runat="server"
MaxLength="4"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox7"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3"
runat="server"
ControlToValidate="TextBox7" ErrorMessage="Año no Valido"
ValidationExpression="\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XXXX&quot;)</td>
</tr>
<tr>
<td class="style2">
Propietario</td>
<td>
<asp:TextBox ID="TextBox8" runat="server" MaxLength="30"
Width="285px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8"
runat="server"

54
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox8"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Fecha de Emision de Targeta Circulacion</td>
<td>
<asp:TextBox ID="TextBox9" runat="server"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox9"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4"
runat="server"
ControlToValidate="TextBox9" ErrorMessage="Formato de Fecha
Incorrecto!"

ValidationExpression="\d{2}\-\d{2}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style2">
Fecha de Vencimiento de Targeta de Circulacion</td>
<td>
<asp:TextBox ID="TextBox10" runat="server"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10"
runat="server"
ErrorMessage="Campo Necesario"
ControlToValidate="TextBox10"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5"
runat="server"
ControlToValidate="TextBox10" ErrorMessage="Formato de Fecha
Incorrecto!"

ValidationExpression="\d{2}\-\d{2}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style2" colspan="2" align="center">
&nbsp;&nbsp;<asp:Button ID="Button1" runat="server"
onclick="Button1_Click"
Text="Agregar Tarjeta" />
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
</td>

55
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</tr>
</table>
<br />

</div>

<asp:HyperLink ID="HyperLink1" runat="server"


NavigateUrl="~/targetasdecirculacion.aspx">Retornar</asp:HyperLink>

</form>
</body></html>
----------------------------------------------tarjeta.aspx.cs-----------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace S.C.M.T
{
public partial class targeta : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;
protected void Button1_Click(object sender, EventArgs e)
{
objConex.ConnectionString = strConex;
objConex.Open();
SqlCommand objCmd2;
objCmd2 = new SqlCommand("checktarjeta", objConex);
objCmd2.CommandType = CommandType.StoredProcedure;
objCmd2.Parameters.Add("@n_tarjeta", SqlDbType.VarChar).Value = TextBox1.Text;
int no;
no =Convert.ToInt32(objCmd2.ExecuteScalar());
if (no < 0)
{
lbl.Text = "TARJETA YA EXISTE";
Response.Write("<scr" + "ipt language=javascript>alert('TARJETA ya Existe');</" + "script>");
SetFocus(TextBox6);
}
else
{
objCmd = new SqlCommand("addtarjeta", objConex);
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@n_tarjeta", SqlDbType.VarChar).Value = TextBox1.Text;
objCmd.Parameters.Add("@n_motor", SqlDbType.VarChar).Value = TextBox2.Text;
objCmd.Parameters.Add("@n_placa", SqlDbType.VarChar).Value = TextBox3.Text;
objCmd.Parameters.Add("@descripcion", SqlDbType.VarChar).Value = TextBox4.Text;
objCmd.Parameters.Add("@marca", SqlDbType.VarChar).Value = TextBox5.Text;
objCmd.Parameters.Add("@modelo", SqlDbType.VarChar).Value = TextBox6.Text;
objCmd.Parameters.Add("@año", SqlDbType.Int).Value = Convert.ToInt32(TextBox7.Text);
objCmd.Parameters.Add("@propietario", SqlDbType.VarChar).Value = TextBox8.Text;
objCmd.Parameters.Add("@fecha_emision", SqlDbType.DateTime).Value = TextBox9.Text;
objCmd.Parameters.Add("@fecha_vencimiento", SqlDbType.DateTime).Value = TextBox10.Text;
objCmd.Parameters.Add("@dui", SqlDbType.VarChar).Value ="sbsdb";

if (objCmd.ExecuteNonQuery() > 0)

56
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
{
lbl.Text = "Tarjeta agregado correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
TextBox10.Text = "";

Response.Write("<scr" + "ipt language=javascript>alert('Listo');</" + "script>");


}
else
{
lbl.Text = "tarjeta no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('Tarjeta no se pudo
agregar...');</" + "script>");
}
}
objConex.Close();
}
}
}

------------------------------------------licencias.aspx-----------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="licencias.aspx.cs"
Inherits="S.C.M.T.licencias1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Licencias</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div> <h2>Licencias</h2>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="n_licencia" DataSourceID="SqlDataSource1" Width="916px"
BackColor="White" BorderColor="#999999" BorderStyle="None"
BorderWidth="1px"
CellPadding="3" GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ButtonType="Image" CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif"
EditImageUrl="~/imagenes/editar.png"
UpdateImageUrl="~/imagenes/listo.jpg" />
<asp:BoundField DataField="n_licencia" HeaderText="N° Licencia"
ReadOnly="True"
SortExpression="n_licencia" />
<asp:BoundField DataField="nombre" HeaderText="Nombres"
SortExpression="nombre" />
<asp:BoundField DataField="apellido" HeaderText="Apellidos"
SortExpression="apellido" />
<asp:BoundField DataField="fecha_emision" HeaderText="Fecha de Emision"

57
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
SortExpression="fecha_emision" />
<asp:BoundField DataField="fecha_vencimiento" HeaderText="Fecha de
vencimiento"
SortExpression="fecha_vencimiento" />
<asp:BoundField DataField="categoria" HeaderText="Categoria"
SortExpression="categoria" />
<asp:BoundField DataField="dui" HeaderText="DUI" SortExpression="dui"
/>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="delLicencia" DeleteCommandType="StoredProcedure"
SelectCommand="SELECT * FROM Licencias" UpdateCommand="editlicencia"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_licencia" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="n_licencia" Type="String" />
<asp:Parameter Name="nombre" Type="String" />
<asp:Parameter Name="apellido" Type="String" />
<asp:Parameter Name="fecha_emision" Type="DateTime" />
<asp:Parameter Name="fecha_vencimiento" Type="DateTime" />
<asp:Parameter Name="categoria" Type="String" />
<asp:Parameter Name="dui" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Button ID="btnnuevo" runat="server" Height="32px" onclick="btnnuevo_Click"
Text="Nueva Licencia" />
<br />
<br />
<asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink>
</div>
<br />
<br />

</form>
</body>
</html>
---------------------------------------licencias.aspx.cs----------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;

58
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class licencias1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void btnnuevo_Click(object sender, EventArgs e)


{
Response.Redirect("nuevalicencias.aspx");

}
}
}
-------------------------------------nuevalicencias.aspx----------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevalicencias.aspx.cs"
Inherits="S.C.M.T.licencias" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Nueva Licencia--</title>
<style type="text/css">
.style1
{
width: 71%;
}
.style2
{
text-align: center;
font-size: x-large;
}
.style3
{
width: 137px;
height: 33px;
}
.style4
{
width: 137px;
height: 35px;
}
.style5
{
height: 35px;
width: 586px;

59
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
}
.style6
{
width: 137px;
height: 38px;
}
.style7
{
height: 38px;
width: 586px;
}
.style8
{
width: 137px;
height: 39px;
}
.style9
{
height: 39px;
width: 586px;
}
.style10
{
width: 137px;
height: 37px;
}
.style11
{
height: 37px;
width: 586px;
}
.style12
{
height: 33px;
width: 586px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<table class="style1" align="center">


<tr>
<td class="style2" colspan="2">
Registro de Licencias</td>
</tr>
<tr>
<td class="style4">
N° de Licencia</td>
<td class="style5">
<asp:TextBox ID="TextBox1" runat="server" Width="205px"
MaxLength="8"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>

60
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:RegularExpressionValidator ID="RegularExpressionValidator4"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Formato de N°
Licencia Incorrecto"

ValidationExpression="\d{3}\-\d{4}"></asp:RegularExpressionValidator>
(Debe ser: &quot;XXX-XXXX&quot;)</td>
</tr>
<tr>
<td class="style6">
Nombres</td>
<td class="style7">
<asp:TextBox ID="TextBox2" runat="server" Width="243px"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ControlToValidate="TextBox2" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style6">
Apellidos</td>
<td class="style7">
<asp:TextBox ID="TextBox3" runat="server" Width="242px"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server"
ControlToValidate="TextBox3" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style4">
Fecha de Emision</td>
<td class="style5">
<asp:TextBox ID="TextBox4" runat="server" Width="175px"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server"
ControlToValidate="TextBox4" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server"
ControlToValidate="TextBox4" ErrorMessage="Formato de fecha
incorrecto"

ValidationExpression="\d\d\-\d\d\-\d\d\d\d"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XX-XX-XXXX&quot; osea &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style8">
Fecha de Vencimiento</td>
<td class="style9">

61
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:TextBox ID="TextBox5" runat="server" Width="172px"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server"
ControlToValidate="TextBox5" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3"
runat="server"
ControlToValidate="TextBox5" ErrorMessage="Formato de fecha
invalido"

ValidationExpression="\d\d\-\d\d\-\d\d\d\d"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XX-XX-XXXX&quot; osea &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style10">
Categoria</td>
<td class="style11">
<asp:TextBox ID="TextBox6" runat="server" Width="60px"
MaxLength="2"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6"
runat="server"
ControlToValidate="TextBox6" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style3">
DUI</td>
<td class="style12">
<asp:TextBox ID="TextBox7" runat="server" Height="20px"
Width="169px"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
runat="server"
ControlToValidate="TextBox7" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
&nbsp;<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox7" ErrorMessage="Formato de DUI
incorrecto"

ValidationExpression="\d\d\d\d\d\d\d\d\-\d"></asp:RegularExpressionValidator><br />
(Debe ser: &quot;XXXXXXXX-X&quot;)</td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<asp:Button ID="btnguardar" runat="server" style="text-align:
center"
Text="Guardar" onclick="btnguardar_Click" />
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
</td>
</tr>
</table>

62
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</div>
<p>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/licencias.aspx">Retornar</asp:HyperLink>
</p>
</form>
</body>
</html>
--------------------------------------nuevalicencias.aspx.cs-----------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class licencias : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated
Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;

protected void btnguardar_Click(object sender, EventArgs e)


{
objConex.ConnectionString = strConex;
objConex.Open();
SqlCommand objCmd2;
objCmd2 = new SqlCommand("checkduilicencia", objConex);
objCmd2.CommandType = CommandType.StoredProcedure;
objCmd2.Parameters.Add("@dui", SqlDbType.VarChar).Value = TextBox7.Text;
int no;
no = Convert.ToInt32(objCmd2.ExecuteScalar());
if (no < 0)
{
Response.Write("<scr" + "ipt language=javascript>alert('DUI YA
EXISTE');</" + "script>");
lbl.Text = "DUI YA EXISTE";

SetFocus(TextBox7);
}
else
{

63
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

objCmd = new SqlCommand("addlicencia", objConex);


objCmd.CommandType = CommandType.StoredProcedure;

objCmd.Parameters.Add("@n_licencia", SqlDbType.VarChar).Value =
TextBox1.Text;
objCmd.Parameters.Add("@nombre", SqlDbType.VarChar).Value =
TextBox2.Text;
objCmd.Parameters.Add("@apellido", SqlDbType.VarChar).Value =
TextBox3.Text;
objCmd.Parameters.Add("@fecha1", SqlDbType.DateTime).Value =
TextBox4.Text;
objCmd.Parameters.Add("@fecha2", SqlDbType.DateTime).Value =
TextBox5.Text;
objCmd.Parameters.Add("@categoria", SqlDbType.VarChar).Value =
TextBox6.Text;
objCmd.Parameters.Add("@dui", SqlDbType.VarChar).Value = TextBox7.Text;

try
{
//codigo protegido
if (objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "licencia agregada correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
Response.Write("<scr" + "ipt
language=javascript>alert('Listo');</" + "script>");

}
else
{
lbl.Text = "licencia no se pudo agregar...";
Response.Write("<scr" + "ipt
language=javascript>alert('licencia no se pudo agregar...');</" + "script>");
}
objConex.Close();

}
catch
{

//tratamiento y proceso de error

lbl.Text = "Error: la licencia ya Existe";

64
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Response.Write("<scr" + "ipt language=javascript>alert('Error: la
licencia ya Existe');</" + "script>");

}
finally
{

//instruccciones que siempre se ejecutan


}

}
}
----------------------------------------oficiales.aspx------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="oficiales.aspx.cs"
Inherits="S.C.M.T.oficiales" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Oficiales de Transito --</title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>
Oficiales De Trancito</h2>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<table class="style1">
<tr>
<td>

65
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="n_placa" DataSourceID="SqlDataSource1" Width="874px"
BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
CellPadding="3"
GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ButtonType="Image" CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif"
EditImageUrl="~/imagenes/editar.png"
UpdateImageUrl="~/imagenes/listo.jpg" >
<ItemStyle BorderWidth="2px" />
</asp:CommandField>
<asp:BoundField DataField="n_placa" HeaderText="N° Placa"
ReadOnly="True"
SortExpression="n_placa" >
<ControlStyle BorderColor="Black" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="nombre" HeaderText="Nombres"
SortExpression="nombre" >
<ControlStyle BorderColor="Black" BorderWidth="4px" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="apellido" HeaderText="Apellidos"
SortExpression="apellido" >
<ControlStyle BorderColor="Black" BorderWidth="4px" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="domicilio" HeaderText="Domicilio"
SortExpression="domicilio" >
<ControlStyle BorderColor="Black" BorderWidth="4px" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="delegacion" HeaderText="Delegacion"
SortExpression="delegacion" >
<ControlStyle BorderColor="Black" BorderWidth="4px" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="dui" HeaderText="DUI" SortExpression="dui" >
<ControlStyle BorderColor="Black" BorderWidth="4px" />
<HeaderStyle BorderColor="Black" BorderWidth="2px" />
<ItemStyle BorderColor="Black" BorderWidth="2px" />
</asp:BoundField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

66
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString2 %>"
DeleteCommand="del_oficiales" DeleteCommandType="StoredProcedure"
SelectCommand="SELECT * FROM [Oficiales]" UpdateCommand="edit_oficiales"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_placa" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="n_placa" Type="String" />
<asp:Parameter Name="nombre" Type="String" />
<asp:Parameter Name="apellido" Type="String" />
<asp:Parameter Name="domicilio" Type="String" />
<asp:Parameter Name="delegacion" Type="String" />
<asp:Parameter Name="dui" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnnuevo" runat="server" onclick="Button1_Click"
style="height: 26px; margin-bottom: 0px" Text="Nuevo Oficial" />

</td>
</tr>
</table>

</div>
<p>
&nbsp;<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink></p>
</form>
</body>
</html>
-------------------------------------oficiales.aspx.cs----------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class oficiales : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)

67
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
{

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("nuevooficial.aspx");
}
}
}
------------------------------------nuevooficial.aspx-----------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevooficial.aspx.cs"
Inherits="S.C.M.T.nuevooficial" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Nuevo Oficial</title>
<style type="text/css">
.style1
{
width: 75%;
}
.style2
{
height: 66px;
}
.style3
{
text-align: center;
}
.style4
{
text-align: center;
font-weight: bold;
font-size: x-large;
font-family: "Times New Roman", Times, serif;
height: 48px;
}
.style5
{
height: 84px;
}
.style6
{
height: 107px;
}
.style7
{
height: 38px;
}
.style8
{
height: 37px;
}

68
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
.style9
{
height: 54px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;
<table class="style1" align="center">
<tr>
<td class="style4" colspan="2">
Registro de un Nuevo Oficial</td>
</tr>
<tr>
<td class="style9">
N° de Placa</td>
<td class="style9">
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"
MaxLength="12" Width="176px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Formato de Placa No
Valido!"

ValidationExpression="\d{2}\-\d\-\d{4}\-\d{2}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XX-X-XXXX-XX&quot;)</td>
</tr>
<tr>
<td class="style8">
Nombre</td>
<td class="style8">
<asp:TextBox ID="TextBox2" runat="server" MaxLength="15"
Width="255px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style7">
Apellido</td>
<td class="style7">

69
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:TextBox ID="TextBox3" runat="server" MaxLength="15"
Width="253px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style6">
Domicilio</td>
<td class="style6">
<asp:TextBox ID="TextBox4" runat="server" Height="94px" MaxLength="40"
TextMode="MultiLine"
Width="287px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TextBox4" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style5">
Delegacion</td>
<td class="style5">
<asp:TextBox ID="TextBox5" runat="server" Height="69px" MaxLength="50"
TextMode="MultiLine"
Width="282px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox5" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
DUI</td>
<td class="style2">
<asp:TextBox ID="TextBox6" runat="server" MaxLength="10"
Width="223px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="TextBox6" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regex1" runat="server"
ControlToValidate="TextBox6" Display="Dynamic" ErrorMessage="Formato de DUI
Incorrecto"
ValidationExpression="\d\d\d\d\d\d\d\d\-\d"
SetFocusOnError="True"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XXXXXXXX-X&quot;)</td>
</tr>
<tr>
<td class="style3" colspan="2">
<asp:Button ID="btnregistrar" runat="server" onclick="btnregistrar_Click"
Text="Registrar Oficial" />
<br />
<asp:Label ID="lbl" runat="server" ForeColor="Red"></asp:Label>

</td>
</tr>

70
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</table>
&nbsp;
<a
href="oficiales.aspx">Retornar</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

</div>
</form>
</body>
</html>
--------------------------------------nuevooficial.aspx.cs-----------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class nuevooficial : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SetFocus(TextBox1);
}

protected void TextBox1_TextChanged(object sender, EventArgs e)


{

}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated
Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;

protected void btnregistrar_Click(object sender, EventArgs e)


{

objConex.ConnectionString = strConex;
objConex.Open();
SqlCommand objCmd2;
objCmd2 = new SqlCommand("CheckDuiOficial", objConex);
objCmd2.CommandType = CommandType.StoredProcedure;
objCmd2.Parameters.Add("@dui", SqlDbType.VarChar).Value = TextBox6.Text;
int no;
no =Convert.ToInt32(objCmd2.ExecuteScalar());
if (no < 0)

71
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
{
lbl.Text = "DUI YA EXISTE";
Response.Write("<scr" + "ipt language=javascript>alert('DUI ya
Existe');</" + "script>");
SetFocus(TextBox6);
}
else
{

objCmd = new SqlCommand("add_oficiales", objConex);


objCmd.CommandType = CommandType.StoredProcedure;

objCmd.Parameters.Add("@n_placa", SqlDbType.VarChar).Value =
TextBox1.Text;
objCmd.Parameters.Add("@nombre", SqlDbType.VarChar).Value =
TextBox2.Text;
objCmd.Parameters.Add("@apellido", SqlDbType.VarChar).Value =
TextBox3.Text;
objCmd.Parameters.Add("@domicilio", SqlDbType.VarChar).Value =
TextBox4.Text;
objCmd.Parameters.Add("@delegacion", SqlDbType.VarChar).Value =
TextBox5.Text;
objCmd.Parameters.Add("@dui", SqlDbType.VarChar).Value = TextBox6.Text;

try
{
//codigo protegido
if (objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "Oficial agregado correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
Response.Write("<scr" + "ipt
language=javascript>alert('Listo');</" + "script>");

}
else
{
lbl.Text = "Oficial no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('Oficial
no se pudo agregar...');</" + "script>");
}
objConex.Close();

}
catch
{

72
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
//tratamiento y proceso de error
lbl.Text = "Error: El N° de Placa ya Existe";
Response.Write("<scr" + "ipt language=javascript>alert('Error: El
N° de Placa ya Existe');</" + "script>");

}
finally
{

//instruccciones que siempre se ejecutan


}

/*
if (objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "Oficial agregado correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";

}
else
{
lbl.Text = "Oficial no se pudo agregar...";
}
objConex.Close();
*/
}

protected void btnretornar_Click(object sender, EventArgs e)


{
Response.Redirect("oficiales.aspx");
}
}
}
---------------------------------infracciones.aspx------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="infracciones.aspx.cs"
Inherits="S.C.M.T.infracciones" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>INFRACCIONES</title>
<style type="text/css">

73
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
.style1
{
width: 100%;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>Infracciones</h2><tr><td>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"


DataSourceID="SqlDataSource1" DataKeyNames="id_infraccion" Width="499px"
Height="141px" AllowPaging="True" BackColor="White"
BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ButtonType="Image" CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif"
EditImageUrl="~/imagenes/editar.png"
UpdateImageUrl="~/imagenes/listo.jpg" />
<asp:BoundField DataField="id_infraccion" HeaderText="id_infraccion"
SortExpression="id_infraccion" InsertVisible="False"
ReadOnly="True"
Visible="False" >
</asp:BoundField>
<asp:BoundField DataField="nombre" HeaderText="Nombre"
SortExpression="nombre" >
</asp:BoundField>
<asp:BoundField DataField="valor" HeaderText="Valor"
SortExpression="valor" >
</asp:BoundField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="del_infraccion"
SelectCommand="SELECT * FROM [Infracciones]"
DeleteCommandType="StoredProcedure" UpdateCommand="edit_infracciones"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="id_infraccion" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="id_infraccion" Type="Int32" />
<asp:Parameter Name="nombre" Type="String" />

74
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:Parameter Name="valor" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnnuevo" runat="server" onclick="Button1_Click"
Text="Nueva infraccion" />
</td>
</tr>
</table>
;<br />
&nbsp;<asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink>
<br />
</div>
</form>
</body>
</html>
--------------------------------infracciones.aspx.cs-------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class infracciones : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("nuevainfraccion.aspx");
}

75
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
}
}
-----------------------------------nuevainfraccion.aspx----------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevainfraccion.aspx.cs"
Inherits="S.C.M.T.nuevainfraccion" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Nuevas Infracciones --</title>

<script language="javascript" type="text/javascript">


// <!CDATA[

function Button1_onclick() {
document.URL("infracciones.aspx");
}

// ]]>
</script>
<style type="text/css">
.style1
{
width: 54%;
}
.style2
{
height: 49px;
}
.style3
{
font-size: x-large;
font-weight: bold;
text-align: center;
height: 63px;
}
.style4
{
text-align: center;
}
.style5
{
height: 47px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<br />
<table class="style1" align="center">
<tr>
<td class="style3" colspan="2">
Registro de una nueva Infraccion</td>
</tr>
<tr>

76
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<td class="style5">
Nombre</td>
<td class="style5">
<asp:TextBox ID="TextBox1" runat="server" Width="292px" MaxLength="100"
Height="97px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Campo
Requerido!"></asp:RequiredFieldValidator>&nbsp;</td>
</tr>
<tr>
<td class="style2">
Valor en&nbsp; $US</td>
<td class="style2">
<asp:TextBox ID="TextBox2" runat="server" Width="105px"
MaxLength="18"></asp:TextBox>
&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Campo
Requerido!"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox2"
ErrorMessage="Formato del Valor Incorrecto"

ValidationExpression="\d{2}\.\d{2}"></asp:RegularExpressionValidator><br />
(debe ser:&nbsp; &quot;XX.XX&quot;)</td>
</tr>
<tr>
<td class="style4" colspan="2">
<asp:Button ID="btnguardar" runat="server" onclick="btnguardar_Click"
Text="Guardar" />
<br />
<asp:Label ID="lbl" runat="server" Font-Bold="True"
ForeColor="Red"></asp:Label>
<br />

</td>
</tr>
</table>
<br />
<a href="infracciones.aspx" >Retornar</a><div>

<br />
</div>

</form>

</body>
</html>
-------------------------------nuevainfraccion.aspx.cs-------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;

77
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class nuevainfraccion : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SetFocus(TextBox1);
}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated
Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;

protected void btnguardar_Click(object sender, EventArgs e)


{
objConex.ConnectionString = strConex;
objConex.Open();

objCmd = new SqlCommand("CheckInfraccion", objConex);


objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@nombre", SqlDbType.VarChar).Value = TextBox1.Text;
int valor;
valor = Convert.ToInt32(objCmd.ExecuteScalar());
if (valor > 0)
{
objCmd = new SqlCommand("add_infracciones", objConex);
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@nombre", SqlDbType.VarChar).Value =
TextBox1.Text;
objCmd.Parameters.Add("@valor", SqlDbType.Decimal).Value =
Convert.ToDecimal(TextBox2.Text);

if ( objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "LaInfraccion ha sido agregada correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
Response.Write("<scr" + "ipt language=javascript>alert('Listo');</"
+ "script>");
}
else
{
lbl.Text = "La Infraccion no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('No se Pudo
Agregar');</" + "script>");
}
objConex.Close();
}

78
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
else
{
lbl.Text = "La infraccion ya existe";
Response.Write("<scr" + "ipt language=javascript>alert('La infraccion
ya existe');</" + "script>");
}
}

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("infracciones.aspx");
}
}
}

-------------------------------------administradore.aspx-----------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="administradores.aspx.cs"
Inherits="S.C.M.T.administradores" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Administradores</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>
Administradores</h2>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"


DataKeyNames="id_usu" DataSourceID="SqlDataSource1" Width="494px"
BackColor="White" BorderColor="#999999" BorderStyle="None"
BorderWidth="1px"
CellPadding="3" GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ButtonType="Image"
CancelImageUrl="~/imagenes/cancelar.jpg"
DeleteImageUrl="~/imagenes/eliminar.gif"
EditImageUrl="~/imagenes/editar.png"
ShowDeleteButton="True" ShowEditButton="True"
UpdateImageUrl="~/imagenes/listo.jpg" />
<asp:BoundField DataField="id_usu" HeaderText="id_usu"
InsertVisible="False"
ReadOnly="True" SortExpression="id_usu" Visible="False" />
<asp:BoundField DataField="nombre" HeaderText="nombre"
SortExpression="Nombre" />
<asp:BoundField DataField="apellido" HeaderText="apellido"
SortExpression="Apellido" />
<asp:BoundField DataField="nick" HeaderText="nick"
SortExpression="Nick" />
<asp:BoundField DataField="password" HeaderText="password"
SortExpression="Password" />

79
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="del_uauario" DeleteCommandType="StoredProcedure"
SelectCommand="select * from Usuario" UpdateCommand="edit_usuario"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="id_usu" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="id_usu" Type="Int32" />
<asp:Parameter Name="nombre" Type="String" />
<asp:Parameter Name="apellido" Type="String" />
<asp:Parameter Name="nick" Type="String" />
<asp:Parameter Name="password" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Button ID="btnnuevo" runat="server" onclick="btnnuevo_Click"
Text="Nuevo Administrador" />
<br />

</div>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/menuadmin.aspx">Retornar</asp:HyperLink>
</form>
</body>
</html>
----------------------------administradores.aspx.cs--------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class administradores : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

80
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
protected void btnnuevo_Click(object sender, EventArgs e)
{
Response.Redirect("nuevoadmin.aspx");
}
}
}
-----------------------------------nuevoadmin.aspx-----------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevoadmin.aspx.cs"
Inherits="S.C.M.T.nuevoadmin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Nuevo Administrador</title>
<style type="text/css">
.style1
{
width: 66%;
}
.style2
{ text-align: center;
}
.style3
{
height: 8px;
width: 274px;
}
.style4
{
width: 101px;
}
.style5
{
height: 8px;
width: 101px;
}
.style6
{
width: 274px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<br />
<table class="style1" align="center">
<tr>
<td class="style2" colspan="2">
<h2>
Nuevo Administrador</h2>
</td>
</tr>

81
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<tr>
<td class="style4">
Nombre</td>
<td class="style6">
<asp:TextBox ID="TextBox1" runat="server" MaxLength="15"
Width="186px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style4">
Apellido</td>
<td class="style6">
<asp:TextBox ID="TextBox2" runat="server" MaxLength="15"
Width="184px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ControlToValidate="TextBox2" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style4">
Nick</td>
<td class="style6">
<asp:TextBox ID="TextBox3" runat="server"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server"
ControlToValidate="TextBox3" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style5">
Password</td>
<td class="style3">
<asp:TextBox ID="TextBox4" runat="server" MaxLength="300"
TextMode="Password"
Width="177px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server"
ControlToValidate="TextBox4" ErrorMessage="Campo
Requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style4">
Confirmar Password</td>
<td class="style6">
<asp:TextBox ID="TextBox5" runat="server" MaxLength="300"
TextMode="Password"
Width="176px"></asp:TextBox>

82
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server"
ControlToValidate="TextBox5" ErrorMessage="Campo
requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2" colspan="2">
<asp:Button ID="btnnuevo" runat="server" onclick="btnnuevo_Click"
Text=" Nuevo Administrador" />
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
<br />
</td>
</tr>
</table>

</div>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/administradores.aspx">Retornar</asp:HyperLink>
</form>
</body>
</html>
------------------------------------nuevoadmin.aspx.cs----------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class nuevoadmin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated
Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;

protected void btnnuevo_Click(object sender, EventArgs e)


{
objConex.ConnectionString = strConex;
objConex.Open();

objCmd = new SqlCommand("Check_Nink", objConex);

83
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@nick", SqlDbType.VarChar).Value = TextBox3.Text;
int valor;
valor = Convert.ToInt32(objCmd.ExecuteScalar());
if (valor > 0)
{

objCmd = new SqlCommand("addusuario", objConex);


objCmd.CommandType = CommandType.StoredProcedure;

objCmd.Parameters.Add("@nombre", SqlDbType.VarChar).Value =
TextBox1.Text;
objCmd.Parameters.Add("@apellido", SqlDbType.VarChar).Value =
TextBox2.Text;
objCmd.Parameters.Add("@nick", SqlDbType.VarChar).Value =
TextBox3.Text;
objCmd.Parameters.Add("@password", SqlDbType.VarChar).Value =
TextBox4.Text;

//----------------------
if(TextBox4.Text==TextBox5.Text)
{
goto soniguales;
}
else
{
lbl.Text = "Password no coincide";
Response.Write("<scr" + "ipt language=javascript>alert('Password no
coincide');</" + "script>");
SetFocus(TextBox4);
goto noson;

//-------------------------------
soniguales:
if (objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "Administrador ha sido agregado correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Response.Write("<scr" + "ipt
language=javascript>alert('Listo');</" + "script>");
}
else
{
lbl.Text = "El Adminitrador no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('El
Adminitrador no se pudo agregar...');</" + "script>");

84
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
}
noson:
objConex.Close();

}
//-----------------------------

//------------------------
else
{
lbl.Text = "El nick ya existe";
Response.Write("<scr" + "ipt language=javascript>alert('El nick ya
existe');</" + "script>");

}
}

protected void btnretornar_Click(object sender, EventArgs e)


{

Response.Redirect("administradores.aspx");
}
}
}
------------------------------------multa.aspx-------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="multa.aspx.cs"
Inherits="S.C.M.T.multa" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>-- Multas --</title>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<h2>
Multas Registradas</h2>
<br />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"


DataKeyNames="n_multa" DataSourceID="SqlDataSource1" Width="1053px"
BackColor="White" BorderColor="#999999" BorderStyle="None"
BorderWidth="1px"
CellPadding="3" GridLines="Vertical">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:CommandField ButtonType="Image"
CancelImageUrl="~/imagenes/cancelar.jpg"

85
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
DeleteImageUrl="~/imagenes/eliminar.gif"
EditImageUrl="~/imagenes/editar.png"
ShowDeleteButton="True" UpdateImageUrl="~/imagenes/listo.jpg" />
<asp:BoundField DataField="licencia" HeaderText="N° de Licencia"
SortExpression="adad" />
<asp:BoundField DataField="lugar" HeaderText="lugares"
SortExpression="lugares" Visible="False" />
<asp:BoundField DataField="nombre" HeaderText="Nombre del Infractor"
SortExpression="nombre" />
<asp:BoundField DataField="nombre1" HeaderText="Departamento"
SortExpression="nombre1" />
<asp:BoundField DataField="fecha_emision" HeaderText="fecha_emision"
SortExpression="Fecha de Imposicion" />
<asp:BoundField DataField="n_multa" HeaderText="n_multa"
ReadOnly="True"
SortExpression="n_multa" InsertVisible="False" Visible="False" />
<asp:BoundField DataField="nombre2" HeaderText="Infraccion"
SortExpression="nombre2" />
<asp:BoundField DataField="fecha_vencimiento" HeaderText="Fecha Limite
de pago"
SortExpression="fecha_vencimiento" />
<asp:BoundField DataField="nombre3" HeaderText="Levantada por el
Oficial N°"
SortExpression="nombre3" />
<asp:BoundField DataField="descripcion" HeaderText="Descripcion"
SortExpression="descripcion" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>

</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:S.C.M.T.ConnectionString26 %>"
DeleteCommand="borrarmulta" DeleteCommandType="StoredProcedure"

SelectCommand="select
M.licencia,M.lugar,L.nombre,D.nombre,M.fecha_emision,M.n_multa,I.nombre,M.fecha_vencimi
ento,O.nombre ,M.descripcion from Multas M inner join Departamentos D on
M.lugar=D.id_depto inner join Infracciones I on M.infraccion=I.id_infraccion inner join
Oficiales O on M.oficial=O.n_placa inner join Licencias L on M.licencia=L.n_licencia"
UpdateCommand="edit_multa"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="n_multa" Type="Int32" />
</DeleteParameters>

<UpdateParameters>
<asp:Parameter Name="licencia" Type="String" />

86
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<asp:ControlParameter Name="nombre" ControlID="DropDownList1"
PropertyName="SelectedValue" Type="Int32" />

<asp:Parameter Name="fecha_emision" Type="DateTime" />


<asp:Parameter Name="infraccion" Type="Int32" />
<asp:Parameter Name="fecha_vencimiento" Type="DateTime" />
<asp:Parameter Name="oficial" Type="String" />
<asp:Parameter Name="n_multa" Type="Int32" />

<asp:Parameter Name="descripcion" Type="String" />


</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Nueva Multa" />
<br />
<br />

<asp:HyperLink ID="HyperLink1" runat="server"


NavigateUrl="~/menuadmin.aspx">retornar</asp:HyperLink>

</form>
</body>
</html>
-----------------------------------multa.aspx.cs-----------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace S.C.M.T
{
public partial class multa : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("nuevamulta.aspx");
}

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)


{

87
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote

}
}
--------------------------------nuevamulta.aspx--------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nuevamulta.aspx.cs"
Inherits="S.C.M.T.nuevamulta" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >


<head runat="server">
<title>Nueva Multa</title>
<style type="text/css">
.style1
{
width: 77%;
}
.style2
{
text-align: center;
}
.style3
{
width: 169px;
height: 110px;
}
.style4
{
height: 110px;
}
.style5
{
width: 169px;
}
.style6
{
text-align: center;
height: 56px;
}
.style7
{
width: 169px;
height: 55px;
}
.style8
{
height: 55px;
}
.style9
{
width: 169px;
height: 65px;
}
.style10
{

88
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
height: 65px;
}
.style11
{
width: 169px;
height: 51px;
}
.style12
{
height: 51px;
}
.style13
{
width: 169px;
height: 56px;
}
.style14
{
height: 56px;
}
</style>
</head>
<body background="imagenes/fondo.png">
<form id="form1" runat="server">
<div>

<table class="style1" align="center">


<tr>
<td class="style6" colspan="2">
<h2>
Registro de Multas</h2>
</td>
</tr>
<tr>
<td class="style7">
<h4>
N° de Licencia</h4>
</td>
<td class="style8">
<asp:TextBox ID="TextBox1" runat="server" Width="200px"
MaxLength="8"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="Formato de Licencia
Incorrecto"

ValidationExpression="\d{3}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XXX-XXXX&quot;)</td>
</tr>
<tr>
<td class="style3">

89
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
<h4>
Departamento</h4>
</td>
<td class="style4">
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="nombre"
DataValueField="id_depto" Width="141px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="SELECT * FROM
[Departamentos]"></asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8"
runat="server"
ControlToValidate="DropDownList1" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style9">
<h4>
Fecha de Imposicion</h4>
</td>
<td class="style10">
<asp:TextBox ID="TextBox2" runat="server" Width="177px"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server"
ControlToValidate="TextBox2" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server"
ControlToValidate="TextBox2" ErrorMessage="Formato de Fecha
Incorrecto"

ValidationExpression="\d{2}\-\d{2}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style7">
<h4>
Infraccion</h4>
</td>
<td class="style8">
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="SqlDataSource4" DataTextField="nombre"
DataValueField="id_infraccion" Width="524px" Height="30px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$
ConnectionStrings:S.C.M.T.ConnectionString26 %>"
SelectCommand="SELECT [id_infraccion], [nombre] FROM
[Infracciones]">
</asp:SqlDataSource>

90
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server"
ControlToValidate="DropDownList2" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="style11">
<h4>
Fecha limite de Pago</h4>
</td>
<td class="style12">
<asp:TextBox ID="TextBox3" runat="server" Width="174px"
MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server"
ControlToValidate="TextBox3" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3"
runat="server"
ControlToValidate="TextBox3" ErrorMessage="Formato de Fecha
Incorrecto"

ValidationExpression="\d{2}\-\d{2}\-\d{4}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;dd-mm-aaaa&quot;)</td>
</tr>
<tr>
<td class="style13">
<h4>
Levantada por el oficial</h4>
</td>
<td class="style14">
<asp:TextBox ID="TextBox4" runat="server" Width="154px"
MaxLength="20"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4"
runat="server"
ControlToValidate="TextBox4" ErrorMessage="El Formato de la
placa es Invalido!"

ValidationExpression="\d{2}\-\d\-\d{4}\-\d{2}"></asp:RegularExpressionValidator>
<br />
(Debe ser: &quot;XX-X-XXXX-XX&quot;)</td>
</tr>
<tr>
<td class="style5">
<h4>
Descripcion</h4>
</td>
<td valign="middle">
<asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine"
Height="128px"
Width="281px" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
runat="server"
ControlToValidate="TextBox5" ErrorMessage="campo
requerido"></asp:RequiredFieldValidator>

91
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
</td>
</tr>
<tr>
<td class="style2" colspan="2">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Registrar la Multa" />
<br />
<h4>
<asp:Label ID="lbl" runat="server"></asp:Label>
</h4>
</td>
</tr>
</table>

</div>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/multa.aspx">retornar</asp:HyperLink>
</form>

</body>
</html>
----------------------------------nuevamulta.aspx.cs------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace S.C.M.T
{
public partial class nuevamulta : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
string strConex = @"Data Source=LAP;Initial Catalog=S.C.M.T.;Integrated
Security=SSPI";
SqlConnection objConex = new SqlConnection();
SqlCommand objCmd;
SqlCommand objCmd2;

protected void Button1_Click(object sender, EventArgs e)


{
objConex.ConnectionString = strConex;
objConex.Open();

///-------------------
objCmd2 = new SqlCommand("chekeandomulta", objConex);

92
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
objCmd2.CommandType = CommandType.StoredProcedure;
objCmd2.Parameters.Add("@n_placa", SqlDbType.VarChar).Value =
TextBox4.Text;
objCmd2.Parameters.Add("@n_licencia", SqlDbType.VarChar).Value =
TextBox1.Text;
int q=Convert.ToInt32(objCmd2.ExecuteScalar());
if (q < 0)
{

Response.Write("<scr" + "ipt language=javascript>alert('El numero de


licencia o Placa de Oficial no existe');</" + "script>");
lbl.Text = "";
goto aa;
}

///--------
objCmd = new SqlCommand("add_multa", objConex);
objCmd.CommandType = CommandType.StoredProcedure;

objCmd.Parameters.Add("@licencia", SqlDbType.VarChar).Value =
TextBox1.Text;
objCmd.Parameters.Add("@lugar", SqlDbType.Int).Value =
Convert.ToInt32(DropDownList1.Text);
objCmd.Parameters.Add("@fecha_emision", SqlDbType.DateTime).Value =
TextBox2.Text;
objCmd.Parameters.Add("@oficial", SqlDbType.VarChar).Value =
TextBox4.Text;
objCmd.Parameters.Add("@descripcion", SqlDbType.VarChar).Value =
TextBox5.Text;
objCmd.Parameters.Add("@infraccion", SqlDbType.Int).Value =
Convert.ToInt32(DropDownList2.Text);
objCmd.Parameters.Add("@fecha_vencimiento",
SqlDbType.DateTime).Value = TextBox3.Text;

if ( objCmd.ExecuteNonQuery() > 0)
{
lbl.Text = "La Multa ha sido agregada correctamente...";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";

Response.Write("<scr" + "ipt language=javascript>alert('Listo');</"


+ "script>");
}
else
{
lbl.Text = "La Multa no se pudo agregar...";
Response.Write("<scr" + "ipt language=javascript>alert('No se Pudo
Agregar');</" + "script>");
}

93
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
aa:
objConex.Close();
}
}
}

CONCLUSIONES

Las organizaciones se ven enfrentadas a gastos que muchas veces sobrepasan

sus intereses, es por eso que hacen uso de los avances informáticos, para

beneficiar su empresa en especialidad. El software existente que incluyen la

programación y la creación de BD, distribuye adecuadamente gastos, dándoles a

los líderes de la administración y usuarios finales un programa desarrollado de

acuerdo a sus capacidades y puestos que desempeñan.

94
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Nosotros como alumnos universitarios, estamos agradecidos por el conocimiento

existente, proporcionado en clases, prácticas e investigaciones personales,

creando un programa en el cual observamos como desarrollar una aplicación, una

conexión de la BD. Y verificar futuras mejoras.

Recomendaciones

Se recomienda que los usuarios privilegiados que vayan a utilizar este sistema

traten de leer este manual ya que si no se está familiarizado con la información

que en el presente esta escrito se le dificultara la realización de su trabajo.

95
Programación II Sección 03 Ing. Kirio Ventura
Siempre Observándote
Sele recomienda a las personas que se hagan de esta aplicación, que tengan en

cuenta que si no se le esta dando constante soporte, podría llegar a quedar

obsoleta.

Bibliografía

 .Librería de Ayuda MSDN


 Andrew Dutie Aprenda ya ASP.NET.
 Mhrydula Pahdar La Biblia de ASP.NET.

96
Programación II Sección 03 Ing. Kirio Ventura

You might also like