142 lines
5.8 KiB
C#
142 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace Modelo
|
|
{
|
|
public class ModeloTecnicos
|
|
{
|
|
|
|
public ModeloTecnicos()
|
|
{
|
|
this.tec_cod = 0;
|
|
this.tec_nome = "";
|
|
this.tec_cpfcnpj = "";
|
|
this.tec_rgie = "";
|
|
this.tec_rsocial = "";
|
|
this.tec_nasci = "";
|
|
this.tec_tipo = "";
|
|
this.tec_cep = "";
|
|
this.tec_end = "";
|
|
this.tec_bairro = "";
|
|
this.tec_fone = "";
|
|
this.tec_cel = "";
|
|
this.tec_email = "";
|
|
this.tec_endnumero = "";
|
|
this.tec_cidade = "";
|
|
this.tec_estado = "";
|
|
}//modelo sem paramentros
|
|
|
|
public ModeloTecnicos(int tec_cod, String tec_nome, String tec_foto,
|
|
String tec_cpfcnpj,string tec_rgie,string tec_rsocial,string tec_nasci,string tec_tipo,string tec_cep,string tec_end,
|
|
string tec_bairro,string tec_fone,string tec_cel,string tec_email,string tec_endnumero,string tec_cidade, string tec_estado)
|
|
{
|
|
this.Tec_cod = tec_cod;
|
|
this.Tec_nome = tec_nome;
|
|
this.CarregaImagem(tec_foto);
|
|
this.Tec_cpfcnpj = tec_cpfcnpj;
|
|
this.Tec_rgie = tec_rgie;
|
|
this.Tec_nasci = tec_nasci;
|
|
this.Tec_tipo = tec_tipo;
|
|
this.Tec_cel = tec_cep;
|
|
this.Tec_end = Tec_end;
|
|
this.Tec_bairro = tec_bairro;
|
|
this.Tec_fone = tec_fone;
|
|
this.Tec_cel = tec_cel;
|
|
this.Tec_email = tec_email;
|
|
this.Tec_endnumero = tec_endnumero;
|
|
this.Tec_cidade = tec_cidade;
|
|
this.Tec_estado = Tec_estado;
|
|
|
|
}
|
|
public ModeloTecnicos(int tec_cod, String tec_nome, Byte [] tec_foto,
|
|
String tec_cpfcnpj, string tec_rgie, string tec_rsocial, string tec_nasci, string tec_tipo, string tec_cep, string tec_end,
|
|
string tec_bairro, string tec_fone, string tec_cel, string tec_email, string tec_endnumero, string tec_cidade, string tec_estado)
|
|
{
|
|
this.Tec_cod = tec_cod;
|
|
this.Tec_nome = tec_nome;
|
|
this.Tec_foto = tec_foto;
|
|
this.Tec_cpfcnpj = tec_cpfcnpj;
|
|
this.Tec_rgie = tec_rgie;
|
|
this.Tec_nasci = tec_nasci;
|
|
this.Tec_tipo = tec_tipo;
|
|
this.Tec_cel = tec_cep;
|
|
this.Tec_end = Tec_end;
|
|
this.Tec_bairro = tec_bairro;
|
|
this.Tec_fone = tec_fone;
|
|
this.Tec_cel = tec_cel;
|
|
this.Tec_email = tec_email;
|
|
this.Tec_endnumero = tec_endnumero;
|
|
this.Tec_cidade = tec_cidade;
|
|
this.Tec_estado = Tec_estado;
|
|
|
|
}
|
|
public void CarregaImagem(String imgCaminho)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(imgCaminho))
|
|
return;
|
|
//fornece propriedadese métodos de instância para criar, copiar,
|
|
//excluir, mover, e abrir arquivos, e ajuda na criação de objetos FileStream
|
|
FileInfo arqImagem = new FileInfo(imgCaminho);
|
|
//Expõe um Stream ao redor de um arquivo de suporte
|
|
//síncrono e assíncrono operações de leitura e gravar.
|
|
FileStream fs = new FileStream(imgCaminho, FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
//aloca memória para o vetor
|
|
this.Tec_foto = new byte[Convert.ToInt32(arqImagem.Length)];
|
|
//Lê um bloco de bytes do fluxo e grava osdados em um buffer fornecido.
|
|
int iBytesRead = fs.Read(this.Tec_foto, 0, Convert.ToInt32(arqImagem.Length));
|
|
fs.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message.ToString());
|
|
}
|
|
}//carregar imagem
|
|
|
|
|
|
|
|
|
|
//propriedades privadas
|
|
private int tec_cod;
|
|
private string tec_nome;
|
|
private byte[] tec_foto;
|
|
private string tec_cpfcnpj;
|
|
private string tec_rgie;
|
|
private string tec_rsocial;
|
|
private string tec_nasci;
|
|
private string tec_tipo;
|
|
private string tec_cep;
|
|
private string tec_end;
|
|
private string tec_bairro;
|
|
private string tec_fone;
|
|
private string tec_cel;
|
|
private string tec_email;
|
|
private string tec_endnumero;
|
|
private string tec_cidade;
|
|
private string tec_estado;
|
|
|
|
|
|
//propriedades publicas
|
|
public int Tec_cod { get => tec_cod; set => tec_cod = value; }
|
|
public string Tec_nome { get => tec_nome; set => tec_nome = value; }
|
|
public byte[] Tec_foto { get => tec_foto; set => tec_foto = value; }
|
|
public string Tec_cpfcnpj { get => tec_cpfcnpj; set => tec_cpfcnpj = value; }
|
|
public string Tec_rgie { get => tec_rgie; set => tec_rgie = value; }
|
|
public string Tec_rsocial { get => tec_rsocial; set => tec_rsocial = value; }
|
|
public string Tec_nasci { get => tec_nasci; set => tec_nasci = value; }
|
|
public string Tec_tipo { get => tec_tipo; set => tec_tipo = value; }
|
|
public string Tec_cep { get => tec_cep; set => tec_cep = value; }
|
|
public string Tec_end { get => tec_end; set => tec_end = value; }
|
|
public string Tec_bairro { get => tec_bairro; set => tec_bairro = value; }
|
|
public string Tec_fone { get => tec_fone; set => tec_fone = value; }
|
|
public string Tec_cel { get => tec_cel; set => tec_cel = value; }
|
|
public string Tec_email { get => tec_email; set => tec_email = value; }
|
|
public string Tec_endnumero { get => tec_endnumero; set => tec_endnumero = value; }
|
|
public string Tec_cidade { get => tec_cidade; set => tec_cidade = value; }
|
|
public string Tec_estado { get => tec_estado; set => tec_estado = value; }
|
|
}
|
|
}
|