totvs ip campinas fsw treinamento .net c# - v4 por fabio delboni

140
1 TREINAMENTO MICROSOFT .NET C# - v4 Fábio Delboni – IPC FSW / janeiro - 2010

Upload: fabio-delboni

Post on 19-Nov-2014

3.356 views

Category:

Technology


25 download

DESCRIPTION

TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

TRANSCRIPT

Page 1: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

1

TREINAMENTO MICROSOFT .NET C# - v4Fábio Delboni – IPC FSW / janeiro - 2010

Page 2: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

2

MICROSOFT .NET C#

I.I) Plataforma .Net

• Vantagens da plataforma .Net• Processo de compilação• Linguagem .Net vs Java• Common Language Runtime

• .Net no mundo.• Framework• Conhecendo a IDE Microsoft Visual Studio

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de terceiros e Web Service

ÍNDICE

Page 3: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

3

MICROSOFT .NET C#

I.II) Sintaxe da linguagem

• Solução, projetos, namespaces, classes...• Declarando e setando variáveis• Ler teclas e escrever no console• Tipos de variáveis• Conversão de tipos• Estruturas condicionais• Operadores

• Exceção• Estruturas de repetição• Classe e objeto• Métodos• Propriedades• Sobrecarga de operador• Herança• Manipular arquivo texto

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 4: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

4

MICROSOFT .NET C#

II.I) Acesso ao banco de dados

• Tipos de conexão• String de conexão• Executar consulta• Manutenção de cadastro• Procedure com parâmetros• Utilizando os métodos de BD

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 5: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

5

MICROSOFT .NET C#

II.II) Desenvolvimento de aplicativos Winform

• Componente TextBox• Componente ComboBox• Componente CheckBox• Componente DataGridView• Escrever arquivo XML• Carregar arquivo XML

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

• MicrosoftReportViewer• User Control• Settings• MDI

Page 6: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

6

MICROSOFT .NET C#

III.I) Desenvolvendo DLL

• Criando projeto• Usando DLL

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 7: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

7

MICROSOFT .NET C#

III.II) Desenvolvimento Webform com AJAX

• Componente Menu• Conexão e Dataset• Componente GridView e DatailsView• Ajax Script Manager e Update Painel• Biding GridView via código• LinkButton na coluna da GridView• Response Redirect e Session

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

• Componente TextBox• Componente DropDownList• Componente RadioButtonList• Componente CheckBox• MicrosoftReportViewer• Web User Control• Dynamic Data Web Site

Page 8: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

8

MICROSOFT .NET C#

IV.I) Componentes de terceiros

• FreeTextBox• Asp .Net AJAX Control Toolkit• Nhibernate for .Net• DevExpress• Infragistics• StrataFrame

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 9: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

9

MICROSOFT .NET C#

IV.II) Web Service

• Criar Web Service• Consumir Web Service• Debug com SoapUI

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 10: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

[email protected]

PROJETO OS-TEC (ETAPA 0/4)

10

Modelagem (sugestão)

Page 11: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Namespace Transacao{ … }– Class Principal{ … }

• Método 1: public String Login (usuario, senha){… }

• Método 2: public String InserirOS (usuario, senha, projeto, data, tarefa, horas, observacao){ … }

[email protected]

PROJETO OS-TEC (ETAPA 1/4)

11

CAMADA TRANSAÇÃO

Page 12: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

[email protected]

PROJETO OS-TEC (ETAPA 2/4)

12

CAMADA TRANSAÇÃOWINFORM

BD RM+

TABELAS Z

CAMADA BD

Page 13: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

[email protected]

PROJETO OS-TEC (ETAPA 3/4)

13

CAMADA TRANSAÇÃOWINFORM

BD RM+

TABELAS Z

CAMADA BD

WEBFORM

Page 14: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

[email protected]

PROJETO OS-TEC (ETAPA 4/4)

14

CAMADA TRANSAÇÃO

WINFORM

BD RM+

TABELAS Z

CAMADA BD

WEBFORM

WEBSERVICE

Page 15: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

15

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#

Page 16: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

16

MICROSOFT .NET C#

I.I) Plataforma .Net

• Vantagens da plataforma .Net• Processo de compilação• Linguagem .Net vs Java• Common Language Runtime

• .Net no mundo.• Framework• Conhecendo a IDE Microsoft Visual Studio

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 17: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Framework– Independência de hardware– Conexão OLE DB

• .NET SDK– Base class library

• Linguagens Orientada á Objeto– Conceitos da linguagem Orientada a Objeto

• Linguagem interpredada (próximo slide)– Facilidade de distribuição– Garbage Collector gerenciamento da memória– Segurança (sistema e código)– Interoperabilidade

Vantagens da plataforma .Net

[email protected]

Plataforma .Net

17

Page 18: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Processo de Compilação

Plataforma .Net

18

[email protected]

Page 19: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Microsoft Visual Studio.• Suporta a diversas linguagens de programação (CLR)

http://pt.wikipedia.org/wiki/.NET• Integração nativa com outros produtos Microsoft como:

– SQL Server– Office– Windows Mobile– API’s do Windows e outros

• Dispositivo móvel com SQL Server Compact (Mobile Edition)• Link interessante:

– http://inf.unisinos.br/~barbosa/paradigmas/consipa3/53/s27/

Linguagem .Net vs Java

Plataforma .Net

19

[email protected]

Page 20: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Common Language Runtime

Plataforma .Net

20

[email protected]

Page 21: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Windows Presentation Foundation - XAML– Microsoft Expression Studio (Blend e Silverlight)

• Microsoft Popfly (Mashups)

• Windows Workflow Foundation• Windows Communication Foundation• LINQ• XNA• Microsoft Robotics Developer Studio• Framework 4.0 (F#, Microsoft Surface, etc.)• Windows Azure• Microsoft Small Basic• Projeto Mono e Moonlight• Outros projeto em: Microsoft DevLabs,Codeplex e Sourceforge…

.Net no mundo

Plataforma .Net

21

[email protected]

Page 22: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Microsoft .Net Framework 2.0– http://blogs.msdn.com/photos/brada/picture524537.aspx

• Microsoft .Net Framework 3.0 e 3.5– http://download.microsoft.com/download/4/a/3/4a3c7c55-84ab-4588-84a4-f96424a7d

82d/NET_35_Namespaces_Poster_JAN08.pdf

• Microsoft .Net Framework 4.0– http://brad_abrams.members.winisp.net/Projects/PDC2008/PDC2008-NETFX4

.pdf

Framework

Plataforma .Net

22

[email protected]

Page 23: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Editor de códigos– Suporte a outras linguagens JS, CSS, XML, DHTML, …– Identamento automático– Autocompleta código– IntelliSense– Code refactoring

• Debugger• Designer

– Windows, Web, WPF, Class, Data (Ex. SQL) e Mapping• Outras ferramentas

– Solution/ Object/ Data/ Server explorer e Properties Editor, etc…

Conhecendo a IDE Microsoft Visual Studio

Fonte: http://en.wikipedia.org/wiki/Microsoft_Visual_Studio

Plataforma .Net

23

Page 24: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

24

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#

Page 25: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

25

MICROSOFT .NET C#

I.II) Sintaxe da linguagem

• Solução, projetos, namespaces, classes...• Declarando e setando variáveis• Ler teclas e escrever no console• Tipos de variáveis• Conversão de tipos• Estruturas condicionais• Operadores

• Exceção• Estruturas de repetição• Classe e objeto• Métodos• Propriedades• Sobrecarga de operador• Herança• Manipular arquivo texto

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 26: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Solução, projetos, namespaces, classes e static void main

Sintaxe da linguagem

26

[email protected]

Page 27: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Declarando e setando variáveis

Sintaxe da linguagem

27

[email protected]

Page 28: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Declarando e setando variáveis (String)

Sintaxe da linguagem

28

[email protected]

Page 29: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Ler teclas e escrever no console

Sintaxe da linguagem

29

[email protected]

Page 30: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Tipos de variáveis

Sintaxe da linguagem

30

C# Type .NET Framework type Valores possíveis de se armazenar

bool System.Boolean Verdadeiro ou Falso (Valores booleandos)

byte System.Byte 0 a 255 (8 bits)

sbyte System.SByte -128 a 127 (8 bits)

char System.Char Um caractere (16 bits)

decimal System.Decimal ±1.0 × 10−28 a ±7.9 × 1028 (128 bits)

double System.Double ±5.0 × 10−324 a ±1.7 × 10308 (64 bits)

float System.Single ±1.5 × 10−45 a ±3.4 × 1038 (32 bits)

int System.Int32 -2,147,483,648 a 2,147,483,647 (32 bits)

uint System.UInt32 0 a 4,294,967,295 (32 bits)

long System.Int64 –9,223,372,036,854,775,808 a 9,223,372,036,854,775,807 (64 bits)

ulong System.UInt64 0 a 18,446,744,073,709,551,615 (64 bits)

object System.Object Qualquer tipo.

short System.Int16 -32,768 a 32,767 (16 bits)

ushort System.UInt16 0 a 65,535 (16 bits)

string System.String Seqüência de caracteres (16 bits por caractere)

Page 31: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Conversão de tipos

Sintaxe da linguagem

31

[email protected]

Page 32: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Exercício:

Sintaxe da linguagem

32

• Construir um aplicativo console, em que o usuário digite 2 números e estes sejam gravados em uma variável a e b, em seguida, realizar a soma dos dois números e apresentar o resultado:

• Tempo: 5 minutos.

[email protected]

Page 33: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Solução:

Sintaxe da linguagem

33

[email protected]

Page 34: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando SWITCH CASE

Estruturas condicionais

Sintaxe da linguagem

34

[email protected]

Page 35: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando IF

Estruturas condicionais

Sintaxe da linguagem

35

[email protected]

Page 36: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando IF ELSE

Estruturas condicionais

Sintaxe da linguagem

36

[email protected]

Page 37: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando IF ELSE encadeado

Estruturas condicionais

Sintaxe da linguagem

37

[email protected]

Page 38: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Operadores

Sintaxe da linguagem

38

[email protected]

Page 39: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Construir um aplicativo console onde, você digita o nome do aluno a sua nota. Em seguida o aplicativo exibe o nome do aluno e se o mesmo está aprovado, reprovado ou em recuperação, conforme exemplo abaixo:

De 0 até 4 – “Fábio, você foi reprovado.”De 5 até 6 – “Fábio, você está em recuperação.”De 7 até 10 – “Parabéns Fábio! Você está aprovado.”

• Tempo: 10 minutos.

Exercício:

Sintaxe da linguagem

39

[email protected]

Page 40: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Solução:

Sintaxe da linguagem

40

Page 41: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando DO WHILE

Estruturas de repetição

Sintaxe da linguagem

41

[email protected]

Page 42: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando WHILE

Estruturas de repetição

Sintaxe da linguagem

42

[email protected]

Page 43: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Comando FOR– Declara e/ou inicializa variável– Testa o fim repetição (repetir enquanto verdadeiro)– Incrementa ou decrementa

Estruturas de repetição

Sintaxe da linguagem

43

[email protected]

Page 44: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Adaptar a solução anterior para que o usuário insira notas de 0 a 10 somente.

• Tempo: 5 minutos.

Exercício:

Sintaxe da linguagem

44

[email protected]

Page 45: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Solução:

Sintaxe da linguagem

45

[email protected]

Page 46: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Contruir um aplicativo console que receba 10 números. Somar todos os numeros pares em uma variavel x e todos os números impares em uma variável y. Em seguida mostrar o total somado em x e y.

• Tempo: 12 minutos.

Exercício:

Sintaxe da linguagem

46

[email protected]

Page 47: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Solução:

Sintaxe da linguagem

47

[email protected]

Page 48: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Exceção

Sintaxe da linguagem

48

[email protected]

Page 49: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Classe e objeto

Sintaxe da linguagem

49

[email protected]

Page 51: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Desenvolver classe calculadora, com as operações matemáticas de soma, subtração, divisão e mutiplicação.

• Tempo: 6 minutos.

Exercício:

Sintaxe da linguagem

51

[email protected]

Page 53: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Enum

Sintaxe da linguagem

53

[email protected]

Cast

Page 54: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Propriedades

Sintaxe da linguagem

54

[email protected]

Page 55: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Sobrecarga de operador

Sintaxe da linguagem

55

[email protected]

Page 56: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Criar novos métodos de soma e subtração na classe calculadora para receber 2, 3 ou até 4 parâmetros.

• Tempo: 10 minutos.

Exercício:

Sintaxe da linguagem

56

[email protected]

Page 58: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Objeto do tipo List

Sintaxe da linguagem

58

[email protected]

Page 59: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Manipular arquivo texto

Sintaxe da linguagem

59

[email protected]

Page 60: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Manipular arquivo texto

Sintaxe da linguagem

60

[email protected]

Page 61: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Com base no slide “manipular arquivo texto”, ajuste e acrescente os métodos abaixo:– int TotalLinhas(String nomeArquivo)

• Retorna o número total de linhas do arquivo.

– String lerLinha(int numeroLinha)• Retorna uma String com o conteúdo da linha especificada.

– String Acrescentar(String nomeArquivo, String texto)• Acrescenta no final do arquivo a String texto.

• Tempo: 10 minutos.

Exercício:

Sintaxe da linguagem

61

[email protected]

Page 62: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

62

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#

Page 63: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

63

MICROSOFT .NET C#

II.I) Acesso ao banco de dados

• Tipos de conexão• String de conexão• Executar consulta• Manutenção de cadastro• Procedure com parâmetros• Utilizando os métodos de BD

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 64: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Como opções de tipo de conexão podemos destacar:

– Client • Exemplo: SQL Client ou Oracle Client

– OLE DB• Suporte nativo a SQL e ORACLE

– DLL• Fornecida pelo fabricando do SGBD ou terceiros.

Tipos de conexão

Acesso ao banco de dados

64

[email protected]

Page 65: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• SQL CLIENT• Data Source=AHOIII;Initial Catalog=CORPORE1080;Persist Security

Info=True;User ID=rm;Password=**

• ORACLE CLIENT• Data Source=xe;Persist Security Info=True;User

ID=rm;Password=**;Unicode=True

• OLE DB (SQL SERVER)• Provider=SQLOLEDB;Data Source=AHOIII;Persist Security

Info=True;User ID=rm;Initial Catalog=CORPORE1080;Password=**

• OLE DB (ORACLE)• Provider=MSDAORA;Data Source=XE;Persist Security

Info=True;User ID=rm;Password=**

String de conexão

Acesso ao banco de dados

65

[email protected]

Page 66: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Executar consulta

Acesso ao banco de dados

66

[email protected]

Page 67: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Manutenção de cadastro

Acesso ao banco de dados

67

[email protected]

Page 68: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Procedure com parâmetros

Acesso ao banco de dados

68

[email protected]

Page 69: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Procedure com parâmetros

Acesso ao banco de dados

69

[email protected]

Page 70: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Utilizando os métodos de BD

Acesso ao banco de dados

70

[email protected]

Page 71: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Testar os métodos da classe “bd”.

• Tempo: 10 minutos.

Exercício:

Acesso ao banco de dados

71

[email protected]

Page 72: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

72

MICROSOFT .NET C#

II.II) Desenvolvimento de aplicativos Winform

• Componente TextBox• Componente ComboBox• Componente CheckBox• Componente DataGridView• Escrever arquivo XML• Carregar arquivo XML

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

• MicrosoftReportViewer• User Control• Settings• MDI

Page 73: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente TextBox

Desenvolvimento de aplicativos Winform

73

[email protected]

Page 74: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente ComboBox

Desenvolvimento de aplicativos Winform

74

[email protected]

Page 75: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente CheckBox

Desenvolvimento de aplicativos Winform

75

[email protected]

Page 76: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente DataGridView

Desenvolvimento de aplicativos Winform

76

[email protected]

Page 77: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente DataGridView

Desenvolvimento de aplicativos Winform

77

[email protected]

Page 78: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Escrever arquivo XML

Desenvolvimento de aplicativos Winform

78

[email protected]

Page 79: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Carregar arquivo XML

Desenvolvimento de aplicativos Winform

79

[email protected]

Page 80: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Obter campos do registro selecionados da grid:

Manipular registros da Grid

Desenvolvimento de aplicativos Winform

80

[email protected]

Page 81: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Criar uma coluna CheckBox em uma dataGridView:

Manipular registros da Grid

Desenvolvimento de aplicativos Winform

81

[email protected]

Page 82: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Guardar o valor de um coluna CheckBox em um ArrayList:

Manipular registros da Grid

Desenvolvimento de aplicativos Winform

82

[email protected]

Page 83: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• A partir da modelagem abaixo, desenvolver uma tela de cadastro e tela de consulta.

• Tempo: 15 minutos.

Exercício:

Desenvolvimento de aplicativos Winform

83

[email protected]

Page 84: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

MicrosoftReportVierwer

Desenvolvimento de aplicativos Winform

84

[email protected]

Page 85: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

User Control

Desenvolvimento de aplicativos Winform

85

[email protected]

Page 86: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

User Control

Desenvolvimento de aplicativos Winform

86

[email protected]

Page 87: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Settings

Desenvolvimento de aplicativos Winform

87

[email protected]

Page 88: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Settings

Desenvolvimento de aplicativos Winform

88

[email protected]

Page 89: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

MDI

Desenvolvimento de aplicativos Winform

89

[email protected]

Page 90: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

90

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#

Page 91: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

91

MICROSOFT .NET C#

III.I) Desenvolvendo DLL

• Criando projeto• Usando DLL

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 92: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Criando projeto

Desenvolvendo DLL

92

[email protected]

Page 94: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Usando DLL

Desenvolvendo DLL

94

Page 95: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Construa sua própria DLL para acesso ao banco de dados, e teste os métodos da mesma.

• Tempo: 10 minutos.

Exercício:

Desenvolvendo DLL

95

[email protected]

Page 96: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

96

MICROSOFT .NET C#

III.II) Desenvolvimento Webform com AJAX

• Componente Menu• Conexão e Dataset• Componente GridView e DatailsView• Ajax Script Manager e Update Painel• Biding GridView via código• LinkButton na coluna da GridView• Response Redirect e Session

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

• Componente TextBox• Componente DropDownList• Componente RadioButtonList• Componente CheckBox• MicrosoftReportViewer• Web User Control• Dynamic Data Web Site

Page 97: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente Menu

Desenvolvimento Webform com AJAX

97

Page 98: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Conexão e Dataset

Desenvolvimento Webform com AJAX

98

[email protected]

Page 99: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Conexão e Dataset

Desenvolvimento Webform com AJAX

99

[email protected]

• Uma grande vantagem de criar itens DataSet, é que os objetos de cada TableAdapter possui os métodos de Insert, Update, Delete, GetData e Fill, ou seja, ganha-se em tempo de desenvolvimento da solução, de forma á dispensar a criação de diversas querys, inclusive a possibilidade de vincular as Grids um Dataset.

Page 100: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente GridView e Details View

Desenvolvimento Webform com AJAX

100

[email protected]

Page 101: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Crie uma conexão, e um DataSet para o cadastro de clientes/fornecedores. Em seguida utilize os componentes de GridView e Details View para consultar e editar os registros.

• Tempo: 15 minutos.

Exercício:

Desenvolvimento Webform com AJAX

101

[email protected]

Page 102: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Ajax Script Manager e Update Painel

Desenvolvimento Webform com AJAX

102

Page 103: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Ajax Script Manager e Update Painel

Desenvolvimento Webform com AJAX

103

Page 104: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Ajax Script Manager e Update Painel

Desenvolvimento Webform com AJAX

104

Page 105: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Biding GridView via código

Desenvolvimento Webform com AJAX

105

[email protected]

Page 106: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

LinkButton na colina da GridView

Desenvolvimento Webform com AJAX

106

[email protected]

Page 107: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Response Redirect e Session

Desenvolvimento Webform com AJAX

107

[email protected]

Page 108: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Response Redirect e Session

Desenvolvimento Webform com AJAX

108

[email protected]

Page 109: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente TextBox

Desenvolvimento Webform com AJAX

109

[email protected]

Page 110: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente DropDownList

Desenvolvimento Webform com AJAX

110

[email protected]

Page 111: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente RadioButtonList

Desenvolvimento Webform com AJAX

111

[email protected]

Page 112: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componente CheckBox

Desenvolvimento Webform com AJAX

112

[email protected]

Page 113: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Com base na modelagem abaixo, crie os Forms de cadastro e consulta (tempo de 30 minutos):

Exercício:

Desenvolvimento Webform com AJAX

113

[email protected]

Page 114: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

MicrosoftReportViewer

Desenvolvimento Webform com AJAX

114

[email protected]

Page 115: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Criar um relatório de listagem de pedidos:

• Tempo: 10 minutos.

Exercício:

Desenvolvimento Webform com AJAX

115

[email protected]

Page 116: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Web User Control

Desenvolvimento Webform com AJAX

116

[email protected]

Page 117: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Web User Control

Desenvolvimento Webform com AJAX

117

[email protected]

Page 118: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Web User Control

Desenvolvimento Webform com AJAX

118

[email protected]

Page 119: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

119

Page 120: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

120

[email protected]

Page 121: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

121

[email protected]

Page 122: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

122

[email protected]

Page 123: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

123

[email protected]

Page 124: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Dynamic Data Web Site

Desenvolvimento Webform com AJAX

124

[email protected]

Page 125: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

• Criar um projeto Dinamic Data Web Site baseado na mesma modelagem de pedido (tempo de 5 minutos).

Exercício:

Desenvolvimento Webform com AJAX

125

[email protected]

Page 126: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

126

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#

Page 127: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

127

MICROSOFT .NET C#

IV.I) Componentes de terceiros

• FreeTextBox• Asp .Net AJAX Control Toolkit• Nhibernate for .Net• DevExpress• Infragistics• StrataFrame

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 128: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Componentes de Terceiros

128

http://freetextbox.com/demos/

FreeTextBox

Page 129: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Asp .Net AJAX Control Toolkit

Componentes de Terceiros

129

http://www.asp.net/ajax/AjaxControlToolkit/Samples/

• AccordionAlwaysVisibleControlAnimationAsyncFileUploadAutoCompleteCalendarCascadingDropDownCollapsiblePanelColorPickerComboBoxConfirmButtonDragPanelDropDownDropShadowDynamicPopulateFilteredTextBoxHoverMenuHTMLEditorListSearchMaskedEditModalPopupMultiHandleSlider

MutuallyExclusiveCheckBox

NoBotNumericUpDownPagingBulletedListPasswordStrengthPopupControlRatingReorderListResizableControlRoundedCornersSeadragonSliderSlideShowTabsTextBoxWatermarkToggleButtonUpdatePanelAnimationValidatorCallout

Page 130: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Nhibernate for .Net

Componentes de Terceiros

130

https://www.hibernate.org

Page 131: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

DevExpress

Componentes de Terceiros

131

http://www.devexpress.com

Page 132: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Infragistics

Componentes de Terceiros

132

http://www.infragistics.com

Page 133: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

StrataFrame

Componentes de Terceiros

133

http://www.strataframe.net

Page 134: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

134

MICROSOFT .NET C#

IV.II) Web Service

• Criar Web Service• Consumir Web Service• Debug com SoapUI

I) Plataforma .Net e a sintaxe da linguagem

II) Acesso ao BD e desenvolvimento Winform

III) Desenvolvendo DLL e Webform com AJAX

IV) Componentes de tercerios e Web Service

ÍNDICE

Page 135: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Criar Web Service

Web Service

135

Page 136: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Consumir Web Service

Web Service

136

[email protected]

Page 137: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Consumir Web Service

Web Service

137

[email protected]

Page 138: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Debug com SoapUI

Web Service

138

http://www.soapui.org

Page 139: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

Exercício

Web Service

139

[email protected]

• PARTE 1:– Construir um Web Service que contenha um método que recebe

o nome de uma tabela, e retorna os dados da mesma.

• PARTE 2:– Construir um aplicativo Windows que consome o Web Service

acima, e passando o nome de uma tabela e prenche em uma dataGridView.

• Tempo: 12 minutos (ambos).

Page 140: TOTVS IP CAMPINAS FSW Treinamento .NET C# - v4 POR FABIO DELBONI

140

Instrutor

[email protected]

QUESTÕES

IMAGEM

MICROSOFT .NET C#