FANESE Faculdade de Administração e Negócios de Sergipe. Tópicos Avançados em Desenvolvimento WEB. Prof.: Fabio Coriolano.



Similar documents
Systems Programming & Scripting

Aplicação ASP.NET MVC 4 Usando Banco de Dados

How To Create A Database In Araba

Conexión SQL Server C#

Boletim Técnico. Esta implementação consiste em atender a legislação do intercâmbio eletrônico na versão 4.0 adotado pela Unimed do Brasil.

ADOBE READER AND ACROBAT

Access Data Object (cont.)

Web Services in.net (1)

TABLE OF CONTENTS INSTALLATION MANUAL MASTERSAF DW

Classe AGI - PHP 5.x

CRM: customer relationship management: o revolucionário marketing de relacionamento com o cliente P

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

Database Communica/on in Visual Studio/C# using Web Services. Hans- Pe=er Halvorsen, M.Sc.

AD A O.N. ET E Access Data Object

Praktikum im Bereich Praktische Informatik Entwicklung eines Ray-Tracing Systems. computer graphics & visualization

How To Develop A Mobile Application On Sybase Unwired Platform

A PROJECT REPORT ON. SkyDrive. Submitted for the partial fulfillment of the requirement for the Award of the degree of MASTER OF COMPUTER APPLICATION

Ambientes de Desenvolvimento Avançados

5 Airport. Chapter 5: Airport 49. Right-click on Data Connections, then select Add Connection.

Seu servidor deverá estar com a versão 3.24 ou superior do Mikrotik RouterOS e no mínimo 4 (quatro) placas de rede.

I A Form és a párbeszédablakok I.1. MessageBox osztály MessageBox.Show(szöveg[,cím[,gombok[,ikon[,defaultbutton]]]]);

How To Design An Eprescription System


如 何 在 C#.2005 中 使 用 ICPDAS I/O Card 的 DLL 檔 案

Working with ecatt (Extended Computer Aided Test Tool)

DEVELOPMENT OF A SECURE FILE TRANSFER PROTOCOL FOR AN ENTERPRISE AND CAMPUS NETWORK

MyChartWebPart.cs. // For SortList using System.Collections.Generic; using System.Collections; // For DataTable using System.Data;

PROCEDURE INSERTION(NUM IN EMPLOYES.NUMEMP%TYPE, NOM VARCHAR2, PRENOM IN VARCHAR2, PPHOTO IN BLOB, SALAIRE IN NUMBER);

! "#" $ % & '( , -. / 0 1 ' % ' 3" 4569& 7 456: % 9 ; ; <&= 3 %,< & 4 4 % : ' % > ' % ? 1 3 & B&?

Inovando sistemas com arquiteturas elásticas

M2273-Updating Your Database Administration Skills to Microsoft SQL Server 2005

ArcHC_3D research case studies (FCT:PTDC/AUR/66476/2006) Casos de estudo do projecto ArcHC_3D (FCT:PTDC/AUR/66476/2006)

Introduction to Visual Studio and C#

Using ilove SharePoint Web Services Workflow Action

public class Autenticador { private static final ThreadLocal<UsuarioInterface> threadusuario = new ThreadLocal<UsuarioInterface>();

1. La classe Connexion class Connexion {

'========================================================================== ==== Scans a range of A/D Input Channels

Implementation of the AutoComplete Feature of the Textbox Based on Ajax and Web Service

TRANSFERÊNCIAS BANCÁRIAS INTERNACIONAIS

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

NADABAS. Report from a short term mission to the National Statistical Institute of Mozambique, Maputo Mozambique April 2012

ASP.NET Dynamic Data

A Tutorial on SQL Server CMPT 354 Fall 2007

1.Tüm Kayıtları Getirme - Arama Yapma

See the Developer s Getting Started Guide for an introduction to My Docs Online Secure File Delivery and how to use it programmatically.

Real-World ASP.NET: Building a Content Management System

CREATE TABLE FUNCAO ( idfuncao INTEGER NOT NULL, DESCRICAO VARCHAR NULL, PRIMARY KEY(idFUNCAO) );

Smartphone Development Tutorial

VB.NET - DATABASE ACCESS

Using scanners with Axapta Document Management

Database Communica/on in Visual Studio/C# using ASP.NET Web Forms. Hans- PeBer Halvorsen, M.Sc.

Using IRDB in a Dot Net Project

Aucune validation n a été faite sur l exemple.

Classes para Manipulação de BDs 5

USER GUIDE Appointment Manager

Getting Started with Telerik Data Access. Contents

BACKING UP A DATABASE

Manual Activity after implementing note

C# Datenbank-Programmierung

Marcio de Almeida Braga

External User Manual. Online Registration of Users of the Electronic System for the Management of Medicinal Products of Human Use of INFARMED, I.P.

How to schedule and automate backups of SQL Server databases in SQL Server Express Editions

Web Session Classes: Performance Metrics For N-Tier s Business Logic Issues

EMC Documentum Application Connectors Software Development Kit

MCSD Azure Solutions Architect [Ativar Portugal] Sobre o curso. Metodologia. Microsoft - Percursos. Com certificação. Nível: Avançado Duração: 78h

ASP.NET Programming with C# and SQL Server

JAVASCRIPT DE QUALIDADE HOJE, AMANHÃ E SEMPRE GUILHERME CARREIRO THIAGO OLIVEIRA

MS Enterprise Library 5.0 (Logging Application Block)


Endnote Web tutorial for BJCVS/RBCCV

MySQL, HTML, LATEXe Perl/PHP

Tutorial 1: M/M/n Service System Simulation Tutorial 2: M/M/n Simulation using Excel input file Tutorial 3: A Production/Inventory System Simulation

Creating Form Rendering ASP.NET Applications

Web Services API Developer Guide

Using SQL Server Management Studio

Chapter 14 WCF Client WPF Implementation. Screen Layout

Android Bootcamp. Elaborado (com adaptações) a partir dos tutoriais:

How To: Create a Crystal Report from ADO.NET Dataset using Visual Basic.NET

Security API Cookbook

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

THINK SUCCESS MAKE IT HAPPEN ANNA NOT MISSING HER ENGLISH CLASS. myclass AN ENGLISH COURSE THAT FITS YOUR LIFE

Capybara. Exemplos de configuração. Com cucumber-rails. Com cucumber sem Rails. Tags para uso de JS. Nos steps do cucumber. Utilizando com RSpec

Technical Manual ONLINE ISSUANCE BY HSBC LINK

Curso SQL Server 2008 for Developers

13 melhores extensões Magento melhorar o SEO da sua loja

SQL Desktop Application For WebService in C# dr inż. Tomasz Tatoń

Using A Frame for Output

ASP and ADO (assumes knowledge of ADO)

Tenha um domínio do REGEDIT do Windows

StreamServe Project Guide and Framework Versão 1.4 / Maio-2013

İNTERNET TABANLI PROGRAMLAMA- 13.ders GRIDVIEW, DETAILSVIEW, ACCESSDATASOURCE NESNELERİ İLE BİLGİ GÖRÜNTÜLEME

Mobile First, Cloud First

1 // // Arquivo : UmPippo.vec 3 // Projeto : Robô Um Pippo 4 //

IDP780 and i-mxt Wi-Fi communication

Slides for Chapter 10: Peer-to-Peer Systems

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

Programação pelo modelo partilhada de memória

Brasuíno BS1 - Manual do Usuário

NORMAS PARA PUBLICAÇÃO NA REVISTA PENSAMENTO BIOCÊNTRICO

Sistemas de Informação I ODBMS SQL... SQL3. José Correia (jcorreia@ispgaya.pt) Mário Santos (msantos@ispgaya.pt)

Transcription:

FANESE Faculdade de Administração e Negócios de Sergipe Tópicos Avançados em Desenvolvimento WEB Prof.: Fabio Coriolano Aracaju/SE 2011

FANESE Faculdade de Administração e Negócios de Sergipe Sistemas para Internet 5º Período Equipe: Mac e Claudiana Tutorial Desenvolvimento de Aplicação Windows Mobile com WebService Aracaju/SE 2011

Ambiente Cenário: Linguagem: Windows 7 Professional; Visual Studio 2008 Professional; Sql Server Express 2005; Windows Mobile Device Center; VirtualPC 2007. Linguagem de programação orientada a objetos C#; Linguagem de programação em banco de dados Transact-SQL.

Configuração do Ambiente 1. No Visual Studio 2008 acesse o Device Emulator Manager: > Tools > Device Emulator Manager > Botão direito do mouse sobre o emulador USA Windows Mobile 5.0 Pocket PC R2 Emulator > Conect > Botão direito do mouse sobre o emulador USA Windows Mobile 5.0 Pocket PC R2 Emulator > Cradle

2. Com o Emulador do Windows Mobile aberto acesse a configuração do emulador > File > Configure > Network > * Marque as opções Enable NE2000 Pcmcia e Host-Only

3. Acesse o Windows Mobile Device Center e Configure na Configuração de Conexões para permitir conectar com DMA:

Banco de Dados 1. Crie as tabelas do banco de dados com seus respectivos relacionamentos conforme o DER abaixo:

2. No projeto utilizamos uma função para gerar uma senha de acesso ao sistema, para utilizar essa função no SQL siga os passos a. copie a DLL xp_md5.dll do endereço http:www.codeproject.com/kb/database/xp_md5/xp_md5_dll.zip e cole na pasta: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn b. Execute a sentaça SQL abaixo para criar uma procedure extendida no banco: USE master; EXEC sp_addextendedproc 'xp_md5', 'xp_md5.dll' c. Crie a função abaixo: CREATE FUNCTION [dbo].[fn_md5] (@data TEXT) RETURNS CHAR(32) AS BEGIN DECLARE @hash CHAR(32) EXEC master.dbo.xp_md5 @data, -1, @hash OUTPUT RETURN @hash END Obs.: Mais informações acesse o site: http:www.codeproject.com/kb/database/xp_md5.aspx?display=printall&fid=32460&df=90&mpp=10&noise=1&sort=position&view=none&fr=26. 3. Crie as procedures que abaixo que são utilizadas no sistema: a. Procedimento de Inclusão de Registro na Tabela Pessoa sp_inserirpessoa CREATE procedure sp_inserirpessoa(@nmpessoa varchar(100), @emailpessoa varchar(100),@fonepessoa varchar(10),@tippessoa int) as begin transaction begin try insert into tbpessoa(nmpessoa,emailpessoa,fonepessoa,tippessoa) values (@nmpessoa,@emailpessoa,@fonepessoa,@tippessoa) if(@tippessoa = 4) begin declare @codpessoa int set @codpessoa = (select codpessoa from tbpessoa where emailpessoa = @emailpessoa) declare @senha varchar(4) set @senha = (SELECT dbo.fn_md5(@emailpessoa)) insert into tbacesso(passacesso,codpessoaacesso) values ((substring(@senha,0,5)),@codpessoa) end commit transaction end try begin catch rollback transaction end catch

b. Procedimento de Inclusão de Cursos sp_inserircurso CREATE procedure sp_inserircurso (@nmcurso varchar(100), @codprofessorcurso int,@dtcurso datetime,@vlrcurso float, @chcurso int) as begin transaction begin try insert into tbcurso(nmcurso,codprofessorcurso,dtcurso,vlrcurso,chcurso) values (@nmcurso,@codprofessorcurso,@dtcurso,@vlrcurso,@chcurso) commit transaction end try begin catch rollback transaction end catch c. Procedimento de Inclusão de Inscrição sp_inserircurso CREATE procedure sp_inseririnscricao(@nmpessoa varchar(100), @emailpessoa varchar(100),@fonepessoa varchar(10),@tippessoa int, @codcurso int) as begin transaction begin try insert into tbpessoa(nmpessoa,emailpessoa,fonepessoa,tippessoa) values (@nmpessoa,@emailpessoa,@fonepessoa,@tippessoa) declare @codpessoa int set @codpessoa = (select codpessoa from tbpessoa where emailpessoa = @emailpessoa) insert into tbinscricao(codpessoainscricao,codcursoinscricao, data) values (@codpessoa,@codcurso,getdate()) declare @senha varchar(4) set @senha = (SELECT dbo.fn_md5(@emailpessoa)) insert into tbacesso(passacesso,codpessoaacesso) values ((substring(@senha,0,5)),@codpessoa) commit transaction end try begin catch rollback transaction end catch

Desenvolvimento WebService 1. Com os softwares devidamente instalados, abra o Visual Studio 2008 e crie uma nova solução: * File > New > Project > Other Projects Type > Visual Studio Solutions > Blank Solutions

2. Adicione à Solução Criada 3 projetos do tipo Class Library com os seguintes Nomes: 1- DAO Camada de Comunicação do o Banco; 2- Model Camada de Modelo de Objetos Bases; 3- RuleBusiness Camada de Regra de Negócios * Botão direito do mouse sobre a solução > Add > New Project > Windows > Class Library:

3. Adicione as seguintes Referencias entre os projetos: DAO RuleBusiness Projeto Model Model DAO Referências * Botão direito do mouse sobre o projeto > Add Reference... > Projects

Classe AcessoD.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; using Model; 4. No projeto Class Library DAO crie as seguintes classes e seus respectivos códigos: Código namespace DAO public class AcessoD /* * Método de validação do login do usuário * Retorna o tipo da pessoa logada */ public DataSet logar(acessom model) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select *,(select tippessoa from tbpessoa where codpessoa = codpessoaacesso) as TipoPessoa from tbacesso where codpessoaacesso = "+model.codpessoaacesso+" and passacesso = '"+model.passacesso+"'"; DataSet ds = new DataSet(); ds = Conexao.procedureReader(cmd); return ds; /* * Método pesquisar pessoa por email * Retorna uma linha com os dadods da pessoa */ public DataSet getusuario(string email) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select a.codpessoaacesso, a.passacesso from tbacesso a join tbpessoa p on a.codpessoaacesso = p.codpessoa where p.emailpessoa = '" + email + "'"; DataSet ds = new DataSet(); ds = Conexao.procedureReader(cmd); return ds; Conexao.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data; namespace DAO public class Conexao

Classe Código /* * Método de conexão com o banco de dados */ static private SqlConnection open() string constring = @"data source=macpratanote\sqlexpress; initial catalog = db_inc; user id = sa; password = 123456"; SqlConnection con = new SqlConnection(); con.connectionstring = constring; con.open(); return con; /* * Método de execução para comandos de inclir, deletar e alterar no banco */ static public bool procedurenonquery(sqlcommand cd) try cd.connection = open(); cd.executenonquery(); return true; catch (Exception ex) throw (ex); finally open().close(); /* * Método de execução de consultas no banco */ static public DataSet procedurereader(sqlcommand cd) try cd.connection = open(); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); da.selectcommand = cd; da.fill(ds); return ds; catch (Exception ex) throw (ex);

Classe InscricaoD finally open().close(); using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data; using Model; Código namespace DAO public class InscricaoD /* * Método de inserir inscrição no banco através da procedure */ public bool inseririnscricao(pessoam model, int codcurso) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "exec sp_inseririnscricao '" + model.nmpessoa + "','" + model.emailpessoa + "','" + model.fonepessoa + "',"+model.tippessoa+","+codcurso+""; bool rs = Conexao.procedureNonQuery(cmd); return rs; /* * Método de listar todas as inscrições cadastradas no banco */ public DataSet listallinscricoes() SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select (select nmpessoa from tbpessoa p where p.codpessoa = i.codpessoainscricao) as Inscrito, (select nmcurso from tbcurso c where c.codcurso = i.codcursoinscricao) as Curso from tbinscricao i"; DataSet ds = Conexao.procedureReader(cmd); return ds; /* * Método de listar inscrição por usuário */ public DataSet listinscricaobyinscrito(int codinscrito) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select c.nmcurso as Curso, (select nmpessoa from tbpessoa pp where pp.codpessoa = c.codprofessorcurso) as Professor, c.dtcurso as Data from tbcurso c join tbinscricao i on c.codcurso = i.codcursoinscricao where i.codpessoainscricao = " + codinscrito + ""; DataSet ds = Conexao.procedureReader(cmd); return ds;

Classe Código PessoaD using System; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using System.Data.SqlClient; using System.Data; namespace DAO public class PessoaD /* * Método de iserir Professores no banco */ public bool inserirprofessor(pessoam model) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "exec sp_inserirpessoa '" + model.nmpessoa + "','" + model.emailpessoa + "','" + model.fonepessoa + "',3"; bool rs = Conexao.procedureNonQuery(cmd); return rs; /* * Método de inserir Organizador do sistema no banco */ public bool inserirorganizador(pessoam model) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "exec sp_inserirpessoa '" + model.nmpessoa + "','" + model.emailpessoa + "','" + model.fonepessoa + "',4"; bool rs = Conexao.procedureNonQuery(cmd); return rs; /* * Método de validação de e-mail duplicado */ public DataRow verificaemail(pessoam model) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select emailpessoa from tbpessoa where emailpessoa = '"+model.emailpessoa+"'"; DataRow dr; try dr = Conexao.procedureReader(cmd).Tables[0].Rows[0]; catch (Exception ex) dr = null; return dr;

Classe /* * Método de listar todos os Professores cadastrados no banco */ public DataSet listallprofessor() SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select * from tbpessoa where tippessoa = 3"; DataSet ds = Conexao.procedureReader(cmd); return ds; /* * Método de listar Professor com parametro do nome do professor */ public DataSet listprofessorbynmprofessor(string nmpessoa) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select * from tbpessoa where nmpessoa = '"+nmpessoa+"'"; DataSet ds = Conexao.procedureReader(cmd); return ds; Código /* * Método de listar todos os Organizadores cadastrados no banco */ public DataSet listallorganizador() SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select * from tbpessoa where tippessoa = 4"; DataSet ds = Conexao.procedureReader(cmd); return ds; CursoD using System; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using System.Data.SqlClient; using System.Data; namespace DAO public class CursoD /* * Método de iserir cursos através da procedure do banco */ public bool insertcurso(cursom model) SqlCommand cmd = new SqlCommand();

Classe string strdata = Convert.ToString(model.DtCurso); strdata = strdata.substring(6, 4) + "" + strdata.substring(3, 2) + "" + strdata.substring(0, 2); Código cmd.commandtext = "exec sp_inserircurso '" + model.nmcurso + "'," + model.codprofessor + ",'" + strdata + "'," + model.vlrcurso + "," + model.chcurso + ""; bool rs = Conexao.procedureNonQuery(cmd); return rs; /* * Método de listar todos os cursos cadastrados no banco */ public DataSet listallcurso() SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select * from tbcurso"; DataSet ds = Conexao.procedureReader(cmd); return ds; /* * Método de listar cursos com o paramentro do nome do curso */ public DataSet gercursobynmcurso(string nmcurso) SqlCommand cmd = new SqlCommand(); cmd.commandtext = "select * from tbcurso where nmcurso ='"+nmcurso+"'"; DataSet ds = Conexao.procedureReader(cmd); return ds; 5. No projeto Class Library Model crie as seguintes classes e seus respectivos códigos: Classe InscricaoM.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model class InscricaoM /*Atributo codinscricao da tbinscricao*/ int codinscricao; /* Encapsulamento do atributo*/ public int CodInscricao get return codinscricao; set codinscricao = value; Código

Classe /*Atributo codpessoainscricao da tbinscricao*/ int codpessoainscricao; /* Encapsulamento do atributo*/ public int CodPessoaInscricao get return codpessoainscricao; set codpessoainscricao = value; /*Atributo codcursoinscricao da tbinscricao*/ int codcursoinscricao; /* Encapsulamento do atributo*/ public int CodCursoInscricao get return codcursoinscricao; set codcursoinscricao = value; Código CursoM.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model public class CursoM /*Atributo codcurso da tbcurso*/ int codcurso; /* Encapsulamento do atributo*/ public int CodCurso get return codcurso; set codcurso = value; /*Atributo nmcurso da tbcurso*/ string nmcurso; /* Encapsulamento do atributo*/ public string NmCurso get return nmcurso; set nmcurso = value; /*Atributo codprofessor da tbcurso*/ int codprofessor; /* Encapsulamento do atributo*/ public int CodProfessor get return codprofessor; set codprofessor = value; /*Atributo dtcurso da tbcurso*/ DateTime dtcurso;

Classe /* Encapsulamento do atributo*/ public DateTime DtCurso get return dtcurso; set dtcurso = value; /*Atributo vlrcurso da tbcurso*/ float vlrcurso; /* Encapsulamento do atributo*/ public float VlrCurso get return vlrcurso; set vlrcurso = value; /*Atributo chcurso da tbcurso*/ int chcurso; /* Encapsulamento do atributo*/ public int ChCurso get return chcurso; set chcurso = value; Código PessoaM.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model public class PessoaM /*Atributo codpessoa da tbpessoa*/ int codpessoa; /* Encapsulamento do atributo*/ public int CodPessoa get return codpessoa; set codpessoa = value; /*Atributo nmpessoa da tbpessoa*/ string nmpessoa; /* Encapsulamento do atributo*/ public string NmPessoa get return nmpessoa; set nmpessoa = value; /*Atributo emailpessoa da tbpessoa*/ string emailpessoa; /* Encapsulamento do atributo*/ public string EmailPessoa

Classe get return emailpessoa; set emailpessoa = value; /*Atributo fonepessoa da tbpessoa*/ string fonepessoa; /* Encapsulamento do atributo*/ public string FonePessoa get return fonepessoa; set fonepessoa = value; /*Atributo tippessoa da tbpessoa*/ int tippessoa; /* Encapsulamento do atributo*/ public int TipPessoa get return tippessoa; set tippessoa = value; Código AcessM.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model public class AcessoM /* Atributo codacesso da tbacesso*/ int codacesso; /* Encapsulamento do atributo*/ public int CodAcesso get return codacesso; set codacesso = value; /* Atributo codpessoaacesso da tbacesso*/ int codpessoaacesso; /* Encapsulamento do atributo*/ public int CodPessoaAcesso get return codpessoaacesso; set codpessoaacesso = value; /* Atributo passacesso da tbacesso*/ string passacesso; /* Encapsulamento do atributo*/ public string PassAcesso get return passacesso;

Classe set passacesso = value; Código 6. No projeto Class Library RuleBusiness crie as seguintes classes e seus respectivos códigos: Classe InscricaoRB.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using DAO; using System.Data; using System.Data.SqlClient; Código namespace RuleBusiness public class InscricaoRB /*Método de Acesso ao método iseririnscricao da Class Library DAO*/ public string inseririnscricao(pessoam model, int codcurso) InscricaoD dao = new InscricaoD(); bool rs = dao.inseririnscricao(model, codcurso); string rt = ""; if (rs) rt = "Inserido"; else rt = "Falha"; return rt; /*Método de Acesso ao método listallinscricoes da Class Library DAO*/ public DataSet listallinscricao() InscricaoD dao = new InscricaoD(); DataSet ds = new DataSet(); ds = dao.listallinscricoes(); return ds; /*Método de Acesso ao método listinscricaobyinscrito da Class Library DAO*/ public DataSet listinscricaobyinscrito(int codpessoa) InscricaoD dao = new InscricaoD();

Classe DataSet ds = new DataSet(); ds = dao.listinscricaobyinscrito(codpessoa); return ds; Código CursoRB.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using DAO; using System.Data; namespace RuleBusiness public class CursoRB /*Método de Acesso ao método iserircurso da Class Library DAO*/ public string inserircurso(cursom model) CursoD dao = new CursoD(); bool res = dao.insertcurso(model); string rs = "Falha"; if (res) rs = "Inserido"; return rs; /*Método de Acesso ao método listallcurso da Class Library DAO*/ public DataSet listallcurso() CursoD dao = new CursoD(); DataSet ds = new DataSet(); ds = dao.listallcurso(); return ds; /*Método de Acesso ao método gercursobynmcurso da Class Library DAO*/ public DataSet getcursobynmcurso(string nmcurso) CursoD dao = new CursoD(); DataSet ds = new DataSet(); ds = dao.gercursobynmcurso(nmcurso); return ds; PessoaRB.cs using System; using System.Collections.Generic;

Classe using System.Linq; using System.Text; using Model; using DAO; using System.Data; namespace RuleBusiness public class PessoaRB /*Método de Acesso ao método inserirprofessor da Class Library DAO*/ public bool inserirprofessor(pessoam model) PessoaD dao = new PessoaD(); bool rs = dao.inserirprofessor(model); return rs; /*Método de Acesso ao método inserirorganizador da Class Library DAO*/ public bool inserirorganizador(pessoam model) PessoaD dao = new PessoaD(); bool rs = dao.inserirorganizador(model); return rs; /*Método de Acesso ao método listallprofessor da Class Library DAO*/ public DataSet listallprofessor() PessoaD dao = new PessoaD(); DataSet ds = new DataSet(); ds = dao.listallprofessor(); return ds; /*Método de Acesso ao método listprofessorbynmprofessor da Class Library DAO*/ public DataSet listprofessorbynmprofessor(string nmprofessor) PessoaD dao = new PessoaD(); DataSet ds = new DataSet(); ds = dao.listprofessorbynmprofessor(nmprofessor); return ds; /*Método de Acesso ao método listallorganizador da Class Library DAO*/ public DataSet listallorganizador() PessoaD dao = new PessoaD(); DataSet ds = new DataSet(); ds = dao.listallorganizador(); return ds; /*Método de Acesso ao método verificaremail da Class Library DAO*/ public bool verificaemail(pessoam model) PessoaD dao = new PessoaD(); DataRow dr = dao.verificaemail(model); bool rs = false; Código

Classe if (dr!= null) rs = true; return rs; Código AcessoRB.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using DAO; using Model; namespace RuleBusiness public class AcessoRB /*Método de Acesso ao método logar da Class Library DAO*/ public DataSet logar(acessom model) AcessoD dao = new AcessoD(); DataSet ds = new DataSet(); ds = dao.logar(model); return ds; /*Método de Acesso ao método getusuario da Class Library DAO*/ public string getsenha(string email) AcessoD dao = new AcessoD(); DataSet ds = dao.getusuario(email); string senha = ""; senha = ds.tables[0].rows[0][1].tostring(); return senha; /*Método de Acesso ao método getusuario da Class Library DAO*/ public string getlogin(string email) AcessoD dao = new AcessoD(); DataSet ds = dao.getusuario(email); string senha = ""; senha = ds.tables[0].rows[0][0].tostring(); return senha;

7. Adicione à Solução Criada um novo Projeto do tipo ASP.NET Web Service Application com o nome de WebService: * Botão direito do mouse sobre a solução > Add > New Project > Web > ASP.NET Web Service Application:

8. Adicione a Referência entre os projetos de Class Library Model e RuleBusiness ao Projeto WebService: WebService Projeto Model RuleBusiness Referências * Botão direito do mouse sobre o projeto > Add Reference... > Projects

9. Um arquivo chamado Service1.asmx será criado, edite o código e adicione os métodos abaixo: Código Service1.asmx.cs using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using Model; using RuleBusiness; namespace WebService / <summary> / Summary description for Service1 / </summary> [WebService(Namespace = "http:tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService /* Método de obter a pessoa logada*/ [WebMethod] public string codpessoalogada(string Login, string Senha) string retorno = ""; AcessoM model = new AcessoM(); model.codpessoaacesso = Convert.ToInt32(Login); model.passacesso = Senha; AcessoRB rulebusiness = new AcessoRB(); try DataRow dr = rulebusiness.logar(model).tables[0].rows[0]; if (dr!= null) retorno = dr[1].tostring(); else retorno = "Falha"; catch (Exception ex) retorno = "Falha"; return retorno;

/*Método de login*/ [WebMethod] public string logar(string Login, string Senha) string retorno = ""; AcessoM model = new AcessoM(); model.codpessoaacesso = Convert.ToInt32(Login); model.passacesso = Senha; AcessoRB rulebusiness = new AcessoRB(); try DataRow dr = rulebusiness.logar(model).tables[0].rows[0]; if (dr!= null) retorno = dr[3].tostring(); else retorno = "Falha"; catch (Exception ex) retorno = "Falha"; return retorno; /*método de inserir professor*/ [WebMethod] public string inserirprofessor(string nmpessoa, string emailpessoa, string fonepessoa) string retorno = "Falha"; PessoaM model = new PessoaM(); model.nmpessoa = nmpessoa; model.emailpessoa = emailpessoa; model.fonepessoa = fonepessoa; PessoaRB rulebusiness = new PessoaRB(); if (!rulebusiness.verificaemail(model)) try bool rstmp = rulebusiness.inserirprofessor(model); if (rstmp!= false) retorno = "Inserido"; catch (Exception ex) retorno = "Falha"; else

retorno = "Duplicado"; return retorno; /*Método de inserir curso*/ [WebMethod] public string inserircurso(string nmcurso, int codprofessor, string data, float vlrcurso, int chcurso) string retorno = "Falha"; CursoM model = new CursoM(); model.nmcurso = nmcurso; model.codprofessor = codprofessor; model.dtcurso = DateTime.Parse(data); model.vlrcurso = vlrcurso; model.chcurso = chcurso; CursoRB rulebusiness = new CursoRB(); try string rstmp = rulebusiness.inserircurso(model); if (rstmp.equals("inserido")) retorno = "Inserido"; catch (Exception ex) retorno = "Falha"; return retorno; /*~Métod de Inserir Organizador após validar o email*/ [WebMethod] public string inserirorganizador(string nmpessoa, string emailpessoa, string fonepessoa) string retorno = "Falha"; PessoaM model = new PessoaM(); model.nmpessoa = nmpessoa; model.emailpessoa = emailpessoa; model.fonepessoa = fonepessoa; PessoaRB rulebusiness = new PessoaRB(); if (!rulebusiness.verificaemail(model)) try bool rstmp = rulebusiness.inserirorganizador(model); if (rstmp!= false) retorno = "Inserido"; catch (Exception ex)

retorno = "Falha"; else retorno = "Duplicado"; return retorno; /*Método de Listar Professor*/ [WebMethod] public DataTable ListProfessor() PessoaRB rulebusiness = new PessoaRB(); DataTable dt = new DataTable(); dt = rulebusiness.listallprofessor().tables[0]; return dt; /*Método de Listar inscrições por usuário logado*/ [WebMethod] public DataTable ListInscricoesByIncrito(int codpessoa) InscricaoRB rulebusiness = new InscricaoRB(); DataTable dt = new DataTable(); dt = rulebusiness.listinscricaobyinscrito(codpessoa).tables[0]; return dt; /*Método de Listar Organizador*/ [WebMethod] public DataTable ListOrganizador() PessoaRB rulebusiness = new PessoaRB(); DataTable dt = new DataTable(); dt = rulebusiness.listallorganizador().tables[0]; return dt; /*Método de pegar Senha gerada por email do usuário*/ [WebMethod] public string getsenha(string email) AcessoRB rulebusiness = new AcessoRB(); string rs = rulebusiness.getsenha(email); return rs; /*Método de pegar Login por email do usuário*/ [WebMethod] public string getlogin(string email) AcessoRB rulebusiness = new AcessoRB(); string rs = rulebusiness.getlogin(email); return rs;

/*Método de inserir Inscrição jundamente com o cadastro do usuário*/ [WebMethod] public string inseririnscricao(string nmpessoa, string emailpessoa, string fonepessoa, int tippessoa, int codcurso) PessoaM model = new PessoaM(); model.nmpessoa = nmpessoa; model.emailpessoa = emailpessoa; model.fonepessoa = fonepessoa; model.tippessoa = tippessoa; PessoaRB rulebusinessex = new PessoaRB(); InscricaoRB rulebusiness = new InscricaoRB(); string retorno = ""; if (!rulebusinessex.verificaemail(model)) try retorno = rulebusiness.inseririnscricao(model, codcurso); if (retorno.equals("inserido")) retorno = "Inserido"; catch (Exception ex) retorno = "Falha"; else retorno = " Email ja cadastrado."; return retorno; /*Método de Listar Curso*/ [WebMethod] public DataTable ListCurso() CursoRB rulebusiness = new CursoRB(); DataTable dt = new DataTable(); dt = rulebusiness.listallcurso().tables[0]; return dt; /*Método de Listar Inscrições*/ [WebMethod] public DataTable ListInscricoes() InscricaoRB rulebusiness = new InscricaoRB(); DataTable dt = new DataTable(); dt = rulebusiness.listallinscricao().tables[0]; return dt;

/*Método de recupera curso pelo nome do curso*/ [WebMethod] public int getcodcurso(string nmcurso) CursoRB rulebusiness = new CursoRB(); DataTable dt = new DataTable(); dt = rulebusiness.getcursobynmcurso(nmcurso).tables[0]; int codcurso = Convert.ToInt32(dt.Rows[0][0]); return codcurso; /*Método de recuperar professor por nome do professo*/ [WebMethod] public int getcodprofessor(string nmprofessor) PessoaRB rulebusiness = new PessoaRB(); DataTable dt = new DataTable(); dt = rulebusiness.listprofessorbynmprofessor(nmprofessor).tables[0]; int codprofessor = Convert.ToInt32(dt.Rows[0][0]); return codprofessor;

10. Após criar o Web Service, publique aplicação em alguma local (Servidor de Aplicação). * Opte por um servidor com suporte a ASPX, SQL Server 2005 e Framework 3.5. * Em ambiente de desenvolvimento utilize o Servidor de Aplicação IIS, nativo no Windows. * Para saber como publicar sua aplicação ASPX, leia os artigos: * http:msdn.microsoft.com/pt-br/library/ms178477.aspx - Fonte Oficial Microsoft; * http:carloscds.net/category/asp-net/ - Tutorial passo-a-passo de Carlos dos Santos.

Desenvolvimento Aplicação Mobile 1. Crie um novo projeto do tipo Smart Device: * File > New > Project > Smart Device > Smart Device Project:

* Selecione a opção Device Application

2. Após criado o Projeto devemos adicionar referência ao WebService que será utilizado na aplicação: * Botão Direito do mouse sobre o projeto criado > Add Web Reference > - Digite a URL do WebService e um nome da referencia (Por padrão adote como referencia a raiz da URL passada).

3. Crie um novo form com o nome de frmprincipal: * Botão Direito do mouse sobre o projeto criado > Add > Windows Form > * Repita esse processo de criação do Windows form para os Forms: -> frmpainel; -> frmcadcurso; -> frmcadinscricao; -> frmcadorganizador; -> frmcadprofessor; -> frmconta; -> frmlistcurso; -> frmlistinscricoes; -> frmlistorganizador; -> frmlistprofessor; -> frmlogin; -> frmloginacesso; -> frmloginacessoorganizador;

4. Crie uma pasta com o nome de images para facilitar a localização das imagens que serão incluídas no projeto: * Botão Direito do mouse sobre o projeto criado > Add > New Folder

5. Adicione os componentes necessários à criação das telas dos forms e implemente o código: Tela Design do Formulário Código do Formulário namespace Mobile partial class frmprincipal / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu mainmenu; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPrincipal)); this.mainmenu = new System.Windows.Forms.MainMenu(); this.menuitem1 = new System.Windows.Forms.MenuItem(); this.btnacesso = new System.Windows.Forms.MenuItem(); this.btninscricao = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.picturebox1 = new System.Windows.Forms.PictureBox(); this.suspendlayout(); mainmenu this.mainmenu.menuitems.add(this.menuitem1); this.mainmenu.menuitems.add(this.btnacesso); menuitem1 this.menuitem1.text = "Sair"; this.menuitem1.click += new System.EventHandler(this.menuItem1_Click); using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmprincipal : Form /*Contrutor*/ public frmprincipal() InitializeComponent(); /*Evento do botão Sair*/ private void menuitem1_click(object sender, EventArgs e) Close(); /*Evento do Botão Inscrever*/ private void btninscricao_click(object sender, EventArgs e) frmcadinscricao frmcadinscricao = new frmcadinscricao(); frmcadinscricao.show(); this.hide(); /*Evento do Botão Sistema*/ private void btnacesso_click(object sender, EventArgs e) frmlogin login = new frmlogin(); login.show(); this.hide();

btnacesso this.btnacesso.text = "Sistema"; this.btnacesso.click += new System.EventHandler(this.btnAcesso_Click); btninscricao this.btninscricao.location = new System.Drawing.Point(60, 221); this.btninscricao.name = "btninscricao"; this.btninscricao.size = new System.Drawing.Size(124, 20); this.btninscricao.tabindex = 2; this.btninscricao.text = "Inscreva-se"; this.btninscricao.click += new System.EventHandler(this.btnInscricao_Click); label1 this.label1.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.label1.forecolor = System.Drawing.SystemColors.Highlight; this.label1.location = new System.Drawing.Point(4, 83); this.label1.name = "label1"; this.label1.size = new System.Drawing.Size(233, 132); this.label1.text = resources.getstring("label1.text"); this.label1.textalign = System.Drawing.ContentAlignment.TopCenter; picturebox1 this.picturebox1.anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top System.Windows.Forms.AnchorStyles.Bottom) System.Windows.Forms.AnchorStyles.Left) System.Windows.Forms.AnchorStyles.Right))); this.picturebox1.image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.picturebox1.location = new System.Drawing.Point(5, 8); this.picturebox1.name = "picturebox1"; this.picturebox1.size = new System.Drawing.Size(228, 48); this.picturebox1.sizemode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; frmprincipal this.autoscaledimensions = new System.Drawing.SizeF(96F, 96F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Dpi; this.autoscroll = true; this.clientsize = new System.Drawing.Size(240, 268); this.controls.add(this.picturebox1); this.controls.add(this.label1); this.controls.add(this.btninscricao); this.menu = this.mainmenu; this.name = "frmprincipal"; this.text = "Seminários Integrados";

this.resumelayout(false); #endregion private System.Windows.Forms.MenuItem menuitem1; private System.Windows.Forms.Button btninscricao; private System.Windows.Forms.MenuItem btnacesso; private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox picturebox1;

namespace Mobile partial class frmcadinscricao / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu mainmenu1; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCadInscricao)); this.mainmenu1 = new System.Windows.Forms.MainMenu(); this.btnvoltar = new System.Windows.Forms.MenuItem(); this.lblnome = new System.Windows.Forms.Label(); this.lblemail = new System.Windows.Forms.Label(); this.lblfone = new System.Windows.Forms.Label(); this.lbltipo = new System.Windows.Forms.Label(); this.ddltipoinscricao = new System.Windows.Forms.ComboBox(); this.txtnome = new System.Windows.Forms.TextBox(); this.txtemail = new System.Windows.Forms.TextBox(); this.txtfone = new System.Windows.Forms.TextBox(); this.btnincluir = new System.Windows.Forms.Button(); this.btnlimpar = new System.Windows.Forms.Button(); this.picturebox1 = new System.Windows.Forms.PictureBox(); this.picturebox2 = new System.Windows.Forms.PictureBox(); this.ddlcurso = new System.Windows.Forms.ComboBox(); this.lblcurso = new System.Windows.Forms.Label(); this.lblmsg = new System.Windows.Forms.Label(); this.suspendlayout(); using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmcadinscricao : Form /*Cria uma variável statica para atribuir o email do inscrito cadastrado*/ public static string stremail; /*Contrutor*/ public frmcadinscricao() InitializeComponent(); fillddlcurso(); txtnome.focus(); /*Preenche do drop down list com as opções do curso*/ public void fillddlcurso() macpratanote.service1 ws = new Mobile.macpratanote.Service1(); DataTable dt = ws.listcurso(); ddlcurso.datasource = dt; ddlcurso.displaymember = "nmcurso"; ddlcurso.valuemember = "codcurso"; ddlcurso.selectedindex = -1; /*Evento do Botão Voltar*/ private void btnvoltar_click(object sender, EventArgs e) frmprincipal principal = new frmprincipal(); principal.show(); this.hide(); /*Evento do Botão Incluir*/ private void btnincluir_click(object sender, EventArgs e) macpratanote.service1 ws = new Mobile.macpratanote.Service1(); int codcurso = Convert.ToInt32(ws.getCodCurso(ddlCurso.Text)); /*Retorno do método ws.inseririnscricao*/ string rt = ws.inseririnscricao(txtnome.text, txtemail.text, txtfone.text, ddltipoinscricao.selectedindex, codcurso); /*Caso o retorno do método ws.inseririnscricao for

mainmenu1 this.mainmenu1.menuitems.add(this.btnvoltar); btnvoltar this.btnvoltar.text = "Voltar"; this.btnvoltar.click += new System.EventHandler(this.btnVoltar_Click); lblnome this.lblnome.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblnome.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblnome.location = new System.Drawing.Point(14, 49); this.lblnome.name = "lblnome"; this.lblnome.size = new System.Drawing.Size(57, 20); this.lblnome.text = "Nome:"; lblemail this.lblemail.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblemail.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblemail.location = new System.Drawing.Point(14, 84); this.lblemail.name = "lblemail"; this.lblemail.size = new System.Drawing.Size(57, 20); this.lblemail.text = "E-mail:"; lblfone this.lblfone.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblfone.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblfone.location = new System.Drawing.Point(14, 118); this.lblfone.name = "lblfone"; this.lblfone.size = new System.Drawing.Size(57, 20); this.lblfone.text = "Telefone:"; lbltipo this.lbltipo.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lbltipo.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lbltipo.location = new System.Drawing.Point(14, 152); this.lbltipo.name = "lbltipo"; this.lbltipo.size = new System.Drawing.Size(57, 20); this.lbltipo.text = "Tipo:"; ddltipoinscricao this.ddltipoinscricao.items.add(""); this.ddltipoinscricao.items.add("aluno Instituição Particular"); Inserido * um painel com os dados de acesso do Inscrito é exibido */ if (rt.equals("inserido")) stremail = txtemail.text; frmloginacesso loginacesso = new frmloginacesso(); loginacesso.show(); this.hide(); else lblmsg.text = rt; private void btnlimpar_click(object sender, EventArgs e) txtnome.text = ""; txtemail.text = ""; txtfone.text = ""; ddltipoinscricao.selectedindex = -1; ddlcurso.selectedindex = -1; txtnome.focus();

this.ddltipoinscricao.items.add("aluno Instituição Pública"); this.ddltipoinscricao.location = new System.Drawing.Point(14, 165); this.ddltipoinscricao.name = "ddltipoinscricao"; this.ddltipoinscricao.size = new System.Drawing.Size(214, 22); this.ddltipoinscricao.tabindex = 9; txtnome this.txtnome.location = new System.Drawing.Point(14, 62); this.txtnome.name = "txtnome"; this.txtnome.size = new System.Drawing.Size(214, 21); this.txtnome.tabindex = 10; txtemail this.txtemail.location = new System.Drawing.Point(14, 96); this.txtemail.name = "txtemail"; this.txtemail.size = new System.Drawing.Size(214, 21); this.txtemail.tabindex = 11; txtfone this.txtfone.location = new System.Drawing.Point(14, 130); this.txtfone.name = "txtfone"; this.txtfone.size = new System.Drawing.Size(214, 21); this.txtfone.tabindex = 12; btnincluir this.btnincluir.location = new System.Drawing.Point(14, 227); this.btnincluir.name = "btnincluir"; this.btnincluir.size = new System.Drawing.Size(70, 20); this.btnincluir.tabindex = 13; this.btnincluir.text = "Inscrever"; this.btnincluir.click += new System.EventHandler(this.btnIncluir_Click); btnlimpar this.btnlimpar.location = new System.Drawing.Point(87, 227); this.btnlimpar.name = "btnlimpar"; this.btnlimpar.size = new System.Drawing.Size(70, 20); this.btnlimpar.tabindex = 15; this.btnlimpar.text = "Limpar"; this.btnlimpar.click += new System.EventHandler(this.btnLimpar_Click); picturebox1 this.picturebox1.image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.picturebox1.location = new System.Drawing.Point(88, 76); this.picturebox1.name = "picturebox1"; this.picturebox1.size = new System.Drawing.Size(133, 126);

picturebox2 this.picturebox2.anchor = System.Windows.Forms.AnchorStyles.Right; this.picturebox2.image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.picturebox2.location = new System.Drawing.Point(1, 2); this.picturebox2.name = "picturebox2"; this.picturebox2.size = new System.Drawing.Size(238, 44); ddlcurso this.ddlcurso.items.add(""); this.ddlcurso.items.add("organizador"); this.ddlcurso.items.add("participante"); this.ddlcurso.items.add("professor"); this.ddlcurso.location = new System.Drawing.Point(14, 201); this.ddlcurso.name = "ddlcurso"; this.ddlcurso.size = new System.Drawing.Size(214, 22); this.ddlcurso.tabindex = 24; lblcurso this.lblcurso.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblcurso.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblcurso.location = new System.Drawing.Point(14, 189); this.lblcurso.name = "lblcurso"; this.lblcurso.size = new System.Drawing.Size(57, 20); this.lblcurso.text = "Curso:"; lblmsg this.lblmsg.font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular); this.lblmsg.forecolor = System.Drawing.Color.Red; this.lblmsg.location = new System.Drawing.Point(14, 250); this.lblmsg.name = "lblmsg"; this.lblmsg.size = new System.Drawing.Size(214, 15); frmcadinscricao this.autoscaledimensions = new System.Drawing.SizeF(96F, 96F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Dpi; this.autoscroll = true; this.clientsize = new System.Drawing.Size(240, 268); this.controls.add(this.lblmsg); this.controls.add(this.ddlcurso); this.controls.add(this.lblcurso); this.controls.add(this.picturebox2); this.controls.add(this.btnlimpar); this.controls.add(this.btnincluir); this.controls.add(this.txtfone); this.controls.add(this.txtemail);

this.controls.add(this.txtnome); this.controls.add(this.ddltipoinscricao); this.controls.add(this.lbltipo); this.controls.add(this.lblfone); this.controls.add(this.lblemail); this.controls.add(this.lblnome); this.controls.add(this.picturebox1); this.menu = this.mainmenu1; this.name = "frmcadinscricao"; this.text = "Inscrição - Cadastrar"; this.resumelayout(false); #endregion private System.Windows.Forms.Label lblnome; private System.Windows.Forms.Label lblemail; private System.Windows.Forms.Label lblfone; private System.Windows.Forms.Label lbltipo; private System.Windows.Forms.ComboBox ddltipoinscricao; private System.Windows.Forms.TextBox txtnome; private System.Windows.Forms.TextBox txtemail; private System.Windows.Forms.TextBox txtfone; private System.Windows.Forms.Button btnincluir; private System.Windows.Forms.MenuItem btnvoltar; private System.Windows.Forms.Button btnlimpar; private System.Windows.Forms.PictureBox picturebox1; private System.Windows.Forms.PictureBox picturebox2; private System.Windows.Forms.ComboBox ddlcurso; private System.Windows.Forms.Label lblcurso; private System.Windows.Forms.Label lblmsg;

namespace Mobile partial class frmloginacesso / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu mainmenu1; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmLoginAcesso)); this.mainmenu1 = new System.Windows.Forms.MainMenu(); this.btnsair = new System.Windows.Forms.MenuItem(); this.btnacessar = new System.Windows.Forms.MenuItem(); this.picturebox2 = new System.Windows.Forms.PictureBox(); this.lbllogin = new System.Windows.Forms.Label(); this.lblsenha = new System.Windows.Forms.Label(); this.lblexibilogin = new System.Windows.Forms.Label(); this.lblexibsenha = new System.Windows.Forms.Label(); this.lblmsg = new System.Windows.Forms.Label(); this.suspendlayout(); mainmenu1 this.mainmenu1.menuitems.add(this.btnsair); this.mainmenu1.menuitems.add(this.btnacessar); btnsair this.btnsair.text = "Sair"; using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmloginacesso : Form /*Contrutor*/ public frmloginacesso() InitializeComponent(); lblexibilogin.text = getlogin(frmcadinscricao.stremail); lblexibsenha.text = getsenha(frmcadinscricao.stremail); /*Método de buscar Senha gerada pós cadastro via web service*/ public string getsenha(string email) macpratanote.service1 ws = new Mobile.macpratanote.Service1(); string rs = ws.getsenha(email); return rs; /*Método de buscar Login gerado pós cadastro via web service*/ public string getlogin(string email) macpratanote.service1 ws = new Mobile.macpratanote.Service1(); string rs = ws.getlogin(email); return rs; /*Evento do botão Sair*/ private void btnsair_click(object sender, EventArgs e) this.close(); /*Evento do botão Acessar*/ private void btnacessar_click(object sender, EventArgs e) frmlogin login = new frmlogin(); login.show(); this.hide();

this.btnsair.click += new System.EventHandler(this.btnSair_Click); btnacessar this.btnacessar.text = "Acessar"; this.btnacessar.click += new System.EventHandler(this.btnAcessar_Click); picturebox2 this.picturebox2.anchor = System.Windows.Forms.AnchorStyles.Right; this.picturebox2.image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.picturebox2.location = new System.Drawing.Point(1, 3); this.picturebox2.name = "picturebox2"; this.picturebox2.size = new System.Drawing.Size(238, 44); lbllogin this.lbllogin.location = new System.Drawing.Point(14, 115); this.lbllogin.name = "lbllogin"; this.lbllogin.size = new System.Drawing.Size(47, 20); this.lbllogin.text = "Login:"; lblsenha this.lblsenha.location = new System.Drawing.Point(14, 139); this.lblsenha.name = "lblsenha"; this.lblsenha.size = new System.Drawing.Size(47, 20); this.lblsenha.text = "Senha:"; lblexibilogin this.lblexibilogin.location = new System.Drawing.Point(68, 113); this.lblexibilogin.name = "lblexibilogin"; this.lblexibilogin.size = new System.Drawing.Size(152, 20); lblexibsenha this.lblexibsenha.location = new System.Drawing.Point(68, 136); this.lblexibsenha.name = "lblexibsenha"; this.lblexibsenha.size = new System.Drawing.Size(152, 20); lblmsg this.lblmsg.location = new System.Drawing.Point(17, 67); this.lblmsg.name = "lblmsg"; this.lblmsg.size = new System.Drawing.Size(206, 20); this.lblmsg.text = "Inscrição Realizada com Sucesso."; frmloginacesso this.autoscaledimensions = new System.Drawing.SizeF(96F, 96F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Dpi;

this.autoscroll = true; this.clientsize = new System.Drawing.Size(240, 268); this.controls.add(this.lblmsg); this.controls.add(this.lblexibsenha); this.controls.add(this.lblexibilogin); this.controls.add(this.lblsenha); this.controls.add(this.lbllogin); this.controls.add(this.picturebox2); this.menu = this.mainmenu1; this.name = "frmloginacesso"; this.text = "Acesso - Inscrito"; this.resumelayout(false); #endregion private System.Windows.Forms.MenuItem btnsair; private System.Windows.Forms.PictureBox picturebox2; private System.Windows.Forms.Label lbllogin; private System.Windows.Forms.Label lblsenha; private System.Windows.Forms.Label lblexibilogin; private System.Windows.Forms.Label lblexibsenha; private System.Windows.Forms.Label lblmsg; private System.Windows.Forms.MenuItem btnacessar;

namespace Mobile partial class frmlogin / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu menu; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmLogin)); this.menu = new System.Windows.Forms.MainMenu(); this.btnvoltar = new System.Windows.Forms.MenuItem(); this.lblmesagem = new System.Windows.Forms.Label(); this.btnacesso = new System.Windows.Forms.Button(); this.txtsenha = new System.Windows.Forms.TextBox(); this.lblsenha = new System.Windows.Forms.Label(); this.txtmatricula = new System.Windows.Forms.TextBox(); this.lblmatricula = new System.Windows.Forms.Label(); this.picturebox1 = new System.Windows.Forms.PictureBox(); this.lbllicenca = new System.Windows.Forms.Label(); this.picturebox2 = new System.Windows.Forms.PictureBox(); this.suspendlayout(); menu this.menu.menuitems.add(this.btnvoltar); BtnVoltar using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmlogin : Form public static int strcodpessoa; /*Contrutor*/ public frmlogin() InitializeComponent(); txtmatricula.focus(); /*Evento do botão Acessar*/ private void btnacesso_click(object sender, EventArgs e) if (txtmatricula.text!= null && txtmatricula.text!= "") if (txtsenha.text!= null && txtsenha.text!= "") lblmesagem.text = null; macpratanote.service1 ws = new Mobile.macpratanote.Service1(); /*retorno do método logar do web service, que retornar o tipo do usuario logado*/ string result = ws.logar(txtmatricula.text, txtsenha.text); /*Caso retorno do método ws.logar = 1, aciona o menu do usuário*/ if (result.equals("1")) strcodpessoa = Convert.ToInt32(txtMatricula.Text); frmconta conta = new frmconta(); conta.show(); this.close(); /*Caso retorno do método ws.logar = 4, aciona o menu do Organizador*/ else if (result.equals("4")) frmpainel painel = new frmpainel(); painel.show(); this.hide(); else

this.btnvoltar.text = "Voltar"; this.btnvoltar.click += new System.EventHandler(this.btnVoltar_Click); lblmesagem this.lblmesagem.font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular); this.lblmesagem.forecolor = System.Drawing.Color.Red; this.lblmesagem.location = new System.Drawing.Point(4, 213); this.lblmesagem.name = "lblmesagem"; this.lblmesagem.size = new System.Drawing.Size(175, 27); btnacesso this.btnacesso.location = new System.Drawing.Point(3, 170); this.btnacesso.name = "btnacesso"; this.btnacesso.size = new System.Drawing.Size(60, 20); this.btnacesso.tabindex = 11; this.btnacesso.text = "Acessar"; this.btnacesso.click += new System.EventHandler(this.btnAcesso_Click); txtsenha this.txtsenha.font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular); this.txtsenha.location = new System.Drawing.Point(4, 135); this.txtsenha.name = "txtsenha"; this.txtsenha.passwordchar = '*'; this.txtsenha.size = new System.Drawing.Size(229, 29); this.txtsenha.tabindex = 10; lblsenha this.lblsenha.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblsenha.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblsenha.location = new System.Drawing.Point(4, 122); this.lblsenha.name = "lblsenha"; this.lblsenha.size = new System.Drawing.Size(64, 16); this.lblsenha.text = "Senha:"; txtmatricula this.txtmatricula.font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular); this.txtmatricula.location = new System.Drawing.Point(4, 87); this.txtmatricula.name = "txtmatricula"; this.txtmatricula.size = new System.Drawing.Size(229, 29); this.txtmatricula.tabindex = 8; lblmatricula this.lblmatricula.backcolor = System.Drawing.Color.Transparent; lblmesagem.text = "Usuário ou Senha inválido."; else lblmesagem.text = "Campo Senha Obrigatório!"; else lblmesagem.text = "Campo Matricula Obrigatório!"; /*Evento do Botão Voltar*/ private void btnvoltar_click(object sender, EventArgs e) frmprincipal principal = new frmprincipal(); principal.show(); this.hide();

this.lblmatricula.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lblmatricula.forecolor = System.Drawing.SystemColors.ActiveCaption; this.lblmatricula.location = new System.Drawing.Point(3, 74); this.lblmatricula.name = "lblmatricula"; this.lblmatricula.size = new System.Drawing.Size(64, 18); this.lblmatricula.text = "Matrícula:"; picturebox1 this.picturebox1.image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.picturebox1.location = new System.Drawing.Point(95, 64); this.picturebox1.name = "picturebox1"; this.picturebox1.size = new System.Drawing.Size(123, 133); lbllicenca this.lbllicenca.font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular); this.lbllicenca.forecolor = System.Drawing.SystemColors.InactiveCaption; this.lbllicenca.location = new System.Drawing.Point(4, 246); this.lbllicenca.name = "lbllicenca"; this.lbllicenca.size = new System.Drawing.Size(230, 17); this.lbllicenca.text = "Sistema licenciado para FabTech."; this.lbllicenca.textalign = System.Drawing.ContentAlignment.TopRight; picturebox2 this.picturebox2.anchor = System.Windows.Forms.AnchorStyles.Right; this.picturebox2.image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.picturebox2.location = new System.Drawing.Point(0, 3); this.picturebox2.name = "picturebox2"; this.picturebox2.size = new System.Drawing.Size(238, 44); frmlogin this.autoscaledimensions = new System.Drawing.SizeF(96F, 96F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Dpi; this.autoscroll = true; this.clientsize = new System.Drawing.Size(240, 268); this.controls.add(this.picturebox2); this.controls.add(this.lbllicenca); this.controls.add(this.lblmesagem); this.controls.add(this.btnacesso); this.controls.add(this.txtsenha); this.controls.add(this.lblsenha); this.controls.add(this.txtmatricula); this.controls.add(this.lblmatricula); this.controls.add(this.picturebox1); this.menu = this.menu; this.name = "frmlogin";

this.text = "Acesso"; this.resumelayout(false); #endregion private System.Windows.Forms.Label lblmesagem; private System.Windows.Forms.Button btnacesso; private System.Windows.Forms.TextBox txtsenha; private System.Windows.Forms.Label lblsenha; private System.Windows.Forms.TextBox txtmatricula; private System.Windows.Forms.Label lblmatricula; private System.Windows.Forms.MenuItem BtnVoltar; private System.Windows.Forms.PictureBox picturebox1; private System.Windows.Forms.Label lbllicenca; private System.Windows.Forms.PictureBox picturebox2;

namespace Mobile partial class frmconta / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu mainmenu1; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmConta)); this.mainmenu1 = new System.Windows.Forms.MainMenu(); this.btnsair = new System.Windows.Forms.MenuItem(); this.picturebox2 = new System.Windows.Forms.PictureBox(); this.lblsaudacoes = new System.Windows.Forms.Label(); this.dtglistinscricoes = new System.Windows.Forms.DataGrid(); this.suspendlayout(); mainmenu1 this.mainmenu1.menuitems.add(this.btnsair); btnsair this.btnsair.text = "Sair"; this.btnsair.click += new System.EventHandler(this.btnSair_Click); picturebox2 this.picturebox2.anchor = System.Windows.Forms.AnchorStyles.Right; using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmconta : Form /*Contrutor*/ public frmconta() InitializeComponent(); fillinscricoes(); /*Método de Listar Curso que o usuário esta inscrito*/ public void fillinscricoes() macpratanote.service1 ws = new Mobile.macpratanote.Service1(); DataTable dt = new DataTable(); dt = ws.listinscricoesbyincrito(frmlogin.strcodpessoa); dtglistinscricoes.datasource = dt; /*Evento do botão Sair*/ private void btnsair_click(object sender, EventArgs e) this.close();

this.picturebox2.image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.picturebox2.location = new System.Drawing.Point(1, 2); this.picturebox2.name = "picturebox2"; this.picturebox2.size = new System.Drawing.Size(238, 44); lblsaudacoes this.lblsaudacoes.location = new System.Drawing.Point(3, 72); this.lblsaudacoes.name = "lblsaudacoes"; this.lblsaudacoes.size = new System.Drawing.Size(194, 20); this.lblsaudacoes.text = "Você está Inscrito no Curso:"; dtglistinscricoes this.dtglistinscricoes.backgroundcolor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); this.dtglistinscricoes.location = new System.Drawing.Point(1, 95); this.dtglistinscricoes.name = "dtglistinscricoes"; this.dtglistinscricoes.size = new System.Drawing.Size(234, 110); this.dtglistinscricoes.tabindex = 3; frmconta this.autoscaledimensions = new System.Drawing.SizeF(96F, 96F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Dpi; this.autoscroll = true; this.clientsize = new System.Drawing.Size(240, 268); this.controls.add(this.dtglistinscricoes); this.controls.add(this.lblsaudacoes); this.controls.add(this.picturebox2); this.menu = this.mainmenu1; this.name = "frmconta"; this.text = "Painel - Inscrito"; this.resumelayout(false); #endregion private System.Windows.Forms.MenuItem btnsair; private System.Windows.Forms.PictureBox picturebox2; private System.Windows.Forms.Label lblsaudacoes; private System.Windows.Forms.DataGrid dtglistinscricoes;

namespace Mobile partial class frmpainel / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; private System.Windows.Forms.MainMenu mainmenu; / <summary> / Clean up any resources being used. / </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPainel)); this.mainmenu = new System.Windows.Forms.MainMenu(); this.btnsair = new System.Windows.Forms.MenuItem(); this.lblboasvindas = new System.Windows.Forms.Label(); this.lblopcao = new System.Windows.Forms.Label(); this.btncadprofessor = new System.Windows.Forms.Button(); this.btncadcurso = new System.Windows.Forms.Button(); this.btncadinscricao = new System.Windows.Forms.Button(); this.picturebox2 = new System.Windows.Forms.PictureBox(); this.lbllicenca = new System.Windows.Forms.Label(); this.btncadorganizador = new System.Windows.Forms.Button(); this.suspendlayout(); mainmenu this.mainmenu.menuitems.add(this.btnsair); btnsair this.btnsair.text = "Sair"; using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Mobile public partial class frmpainel : Form /*Contrutor*/ public frmpainel() InitializeComponent(); /*Evento do Botão de Cadastro de Inscrição*/ private void btncadinscricao_click(object sender, EventArgs e) frmlistinscricoes listinscricoes = new frmlistinscricoes(); listinscricoes.show(); this.hide(); /*Evento do botão de Cadastro de Professor*/ private void btncadprofessor_click(object sender, EventArgs e) frmcadprofessor cadprofessor = new frmcadprofessor(); cadprofessor.show(); this.hide(); /*Evento do botão de cadastro de Cursos*/ private void btncadcurso_click(object sender, EventArgs e) frmcadcurso cadcurso = new frmcadcurso(); cadcurso.show(); this.hide(); /*Evento do Botão Sair*/ private void btnsair_click(object sender, EventArgs e) this.close(); /*Evento do botão de cadastro de Organizador*/ private void btncadorganizador_click(object sender, EventArgs e)