Você está na página 1de 21

SUMRIO

1 1.1

ABERTURA DE UMA NOVA ESCOLA 3 diagrama de classe 3

1.1.1 Cdigo da tabela contas a pagar 4 1.1.1.1.1 1.2 1.3 Cdigo da tabela disciplina 5 4

Cdigo da tabela curso

Cdigo da tabela pessoa 5 6 7

1.3.1 Cdigo da tabela professor 2

CLASSES CRIADAS NO C SHARP

2.1.1 CLASSE PESSOA 7 2.1.2 CLASSE PROFESSOR 2.1.3 CLASSE DISCIPLINA 2.1.4 CLASSE TURMA 9 9 12 8 8

2.1.5 CLASSE CONTAS A PAGAR 3

PROGRAMA DE INSERO DE CONTAS A PAGAR EM FILA 12

3.1.1 SCREEN DO PROGRAMA

3.1.2 CODIGO DO FORMULARIO (DESIGN) 12 3.1.3 IMPLEMENTAO DE CODIGO DO FORMULARIO 15 REFERNCIAS 18

abertura de uma nova escola

Os baixos iro apresentar passo a passo de um programa desenvolvido para uma abertura de uma nova escola, apresentando assim diagrama de classes,cdigo das tabelas ,classes criadas no c Sharp,e tambm um screen do programa.

1 diagrama de classe

[pic]

1 Cdigo da tabela contas a pagar

[pic]

1 Cdigo da tabela disciplina

[pic]

2 Cdigo da tabela curso

[pic]

3 Cdigo da tabela pessoa

[pic]

1 Cdigo da tabela professor

[pic]

4.3.2Cdigo da tabela turma [pic]

CLASSES CRIADAS NO C SHARP

1 CLASSE PESSOA

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace PortifolioWork { class _Pessoa { public int id; public string nome; public string endereco; public string bairro; public string cidade; public string estado; public string nomepai; public string nomemae; public string cpf; public DateTime datanasc; public _Turma turmas;

public string incluir() { return "";

public string excluir() { return ""; }

public string alterar() { return ""; } } }

2 CLASSE PROFESSOR

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace PortifolioWork { class _professor : _Pessoa { public string formacao; public string titulo;

public _Disciplina[] disciplinas; } }

3 CLASSE DISCIPLINA

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace PortifolioWork { class _Disciplina { public string descricao; public int cargahoraria; public _professor professor;

public string criar() { return ""; }

public string excluir() { return "";

public string alterar() { return ""; }

} }

4 CLASSE TURMA

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace PortifolioWork { class _Turma { public int turma_id; public string nome; public DateTime horario; public _Pessoa[] pessoas;

public string iniciar()

{ return ""; }

public string concluir() { return ""; }

public string alterar() { return ""; }

public string excluir() { return ""; }

} }

5 CLASSE CONTAS A PAGAR

Essa classe implementa tambm o cdigo de incluso em fila.

using System;

using System.Collections.Generic; using System.Linq; using System.Text;

namespace PortifolioWork { class _ContasaPagar { public int conta_ID; public string nome; public DateTime vencimento; public decimal valor;

private int[] Vconta_ID; private string[] Vnome; private DateTime[] Vvencimento; private decimal[] Vvalor; private int contador = 0; private string msg; const int qtdArray = 3;

public void criarArray() {

Vconta_ID = new int[qtdArray]; Vnome = new string[qtdArray]; Vvencimento = new DateTime[qtdArray];

Vvalor = new decimal[qtdArray]; }

public string exibir() { msg = ""; for (int i = 0; i < contador; i++) msg += "Posicao " + String.Format("{0:0}", i+1) + ": - " + Vnome[i] + " | Vencimento: "+String.Format("{0:d}",Vvencimento[i])+ " | Valor: " + String.Format("{0:0.00}", Vvalor[i])+ Environment.NewLine;

return msg; }

public string incluir() {

if (qtdArray - contador == 0) return "Overflow ! No possivel inserir mais dados";

Vconta_ID[contador] = contador + 1; if (nome == "XXX") return "O Nome da despesa nao foi informado!"; Vnome[contador] = nome;

if (vencimento == Convert.ToDateTime("11/11/1111")) return "A data do Vencimento nao foi informada!"; Vvencimento[contador] = vencimento;

if (valor == 0) return "O valor nao foi informado!";

Vvalor[contador] = valor;

contador++; return "Registro Incluido com sucesso !" + Environment.NewLine + "Lanamentos restantes: " + String.Format("{0:0}", qtdArray - contador);

public string alterar() { return ""; }

public string excluir() { return ""; }

public void ordenarVetor() { if (contador Vvencimento[j+1]) { tmpconta_ID = Vconta_ID[j]; tmpnome = Vnome[j]; tmpvencimento = Vvencimento[j]; tmpvalor = Vvalor[j]; Vconta_ID[j] = Vconta_ID[j + 1];

Vnome[j] = Vnome[j + 1]; Vvencimento[j] = Vvencimento[j + 1]; Vvalor[j] = Vvalor[j + 1]; Vconta_ID[j + 1] = tmpconta_ID; Vnome[j + 1] = tmpnome; Vvencimento[j + 1] = tmpvencimento; Vvalor[j + 1] = tmpvalor;

} } } }

} }

PROGRAMA DE INSERO DE CONTAS A PAGAR EM FILA

1 SCREEN DO PROGRAMA

[pic]

2 CODIGO DO FORMULARIO (DESIGN)

namespace PortifolioWork { partial class Form1

{ /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null;

/// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }

#region Windows Form Designer generated code

/// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() {

this.TXTcodigo = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.TXTnome = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.TXTvencimento = new System.Windows.Forms.MaskedTextBox(); this.TXTvalor = new System.Windows.Forms.MaskedTextBox(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // TXTcodigo // this.TXTcodigo.Location = new System.Drawing.Point(126, 22); this.TXTcodigo.Name = "TXTcodigo"; this.TXTcodigo.ReadOnly = true; this.TXTcodigo.Size = new System.Drawing.Size(100, 20); this.TXTcodigo.TabIndex = 5; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(39, 29); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(70, 13);

this.label1.TabIndex = 1; this.label1.Text = "Codigo conta"; // // TXTnome // this.TXTnome.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.TXTnome.Location = new System.Drawing.Point(126, 64); this.TXTnome.Name = "TXTnome"; this.TXTnome.Size = new System.Drawing.Size(100, 20); this.TXTnome.TabIndex = 0; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(39, 71); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(35, 13); this.label2.TabIndex = 5; this.label2.Text = "Nome"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(39, 114); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(63, 13);

this.label3.TabIndex = 6; this.label3.Text = "Vencimento"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(39, 156); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(31, 13); this.label4.TabIndex = 7; this.label4.Text = "Valor"; // // button1 // this.button1.Location = new System.Drawing.Point(12, 207); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 4; this.button1.Text = "Ver Lista"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(205, 207); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23);

this.button2.TabIndex = 3; this.button2.Text = "Inserir"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // TXTvencimento // this.TXTvencimento.Location = new System.Drawing.Point(126, 107); this.TXTvencimento.Mask = "00/00/0000"; this.TXTvencimento.Name = "TXTvencimento"; this.TXTvencimento.Size = new System.Drawing.Size(100, 20); this.TXTvencimento.TabIndex = 1; this.TXTvencimento.ValidatingType = typeof(System.DateTime); // // TXTvalor // this.TXTvalor.Location = new System.Drawing.Point(126, 149); this.TXTvalor.Name = "TXTvalor"; this.TXTvalor.Size = new System.Drawing.Size(100, 20); this.TXTvalor.TabIndex = 2; // // button3 // this.button3.Location = new System.Drawing.Point(108, 207); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 8;

this.button3.Text = "Fechar"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.button3); this.Controls.Add(this.TXTvalor); this.Controls.Add(this.TXTvencimento); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.TXTnome); this.Controls.Add(this.label1); this.Controls.Add(this.TXTcodigo); this.MaximizeBox = false; this.Name = "Form1"; this.Text = "Contas a Pagar"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); this.PerformLayout();

#endregion

private System.Windows.Forms.TextBox TXTcodigo; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox TXTnome; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.MaskedTextBox TXTvencimento; private System.Windows.Forms.MaskedTextBox TXTvalor; private System.Windows.Forms.Button button3; } }

3 IMPLEMENTAO DE CODIGO DO FORMULARIO

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms;

namespace PortifolioWork { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

_ContasaPagar contasapagar = new _ContasaPagar();

private void button1_Click(object sender, EventArgs e) { contasapagar.ordenarVetor(); string mensagem1; mensagem1 = contasapagar.exibir(); MessageBox.Show(mensagem1,"Lista de contas a pagar");

private void button2_Click(object sender, EventArgs e) { string mensagem; if (TXTnome.Text != "") contasapagar.nome = TXTnome.Text;

else contasapagar.nome = "XXX";

if (TXTvencimento.Text != " / /") contasapagar.vencimento = DateTime.Parse(TXTvencimento.Text); else contasapagar.vencimento = DateTime.Parse("11/11/1111");

if (TXTvalor.Text != "") contasapagar.valor = decimal.Parse(TXTvalor.Text); else contasapagar.valor = decimal.Parse("0");

mensagem = contasapagar.incluir();

MessageBox.Show(mensagem); TXTnome.Clear(); TXTvencimento.Clear(); TXTvalor.Clear(); TXTnome.Focus();

private void Form1_Load(object sender, EventArgs e) {

contasapagar.criarArray(); }

private void button3_Click(object sender, EventArgs e) { this.Close(); } } }

REFERNCIAS

Tanaka,Simone Sawasaki, Analise de sistemas II, pginas 61,62,69,70,78,79,80.So Paulo,Pearson Prentice Hall,2009. Silva,Flavio de Almeida. Desenvolvimento Orientado a Objetos I, pginas 33,34,103,104,105,106. So Paulo,Pearson Prentice Hall,2009 http://diariodecodigos.info/category/net/csharp/

----------------------daniel cesar pereira crespan IARA BRAZ MARIANO MARCOS AURLIO ROSA DE AQUINO WILIAM HENRI DA SILVA

PORTFOLIO INTERDISCIPLINAR

Você também pode gostar