commit ae3bfc8746be699513d93a2ec3554a19d1f5e88d Author: levelcode365 Date: Fri Apr 17 21:22:43 2026 -0300 estrutura inicial LevelOS diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0735242 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.vs/ +**/.vs/ +bin/ +obj/ +*.dll +*.exe +*.pdb +*.cache +*.user +*.suo \ No newline at end of file diff --git a/BLL/BLL.csproj b/BLL/BLL.csproj new file mode 100644 index 0000000..9a00b99 --- /dev/null +++ b/BLL/BLL.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/BLL/BLLAgenda.cs b/BLL/BLLAgenda.cs new file mode 100644 index 0000000..d63607b --- /dev/null +++ b/BLL/BLLAgenda.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using DALL; +using MLL; + +namespace BLL +{ + public class BLLAgenda + { + private readonly DALAgenda dal; + + public BLLAgenda(string connectionString) + { + dal = new DALAgenda(connectionString); + }// 🔹 CONSTRUTOR + + // 🔹 LISTAR + public List Listar() + { + return dal.Listar(); + } + + // 🔹 CARREGAR POR ID + public ModeloAgenda CarregarModeloAgenda(int id) + { + return dal.CarregarModeloAgenda(id); + } + + // 🔹 INSERIR + public bool Inserir(ModeloAgenda obj) + { + return dal.Inserir(obj); + } + + // 🔹 ALTERAR + public bool Alterar(ModeloAgenda obj) + { + return dal.Alterar(obj); + } + + // 🔹 EXCLUIR + public bool Excluir(int id) + { + return dal.Excluir(id); + } + } +} \ No newline at end of file diff --git a/BLL/BLLBancos.cs b/BLL/BLLBancos.cs new file mode 100644 index 0000000..615f2b6 --- /dev/null +++ b/BLL/BLLBancos.cs @@ -0,0 +1,111 @@ +using System; +using System.Data; +using DALL; +using MLL; + +namespace BLL +{ + public class BLLBancos + { + private DALBancos dal; + + public BLLBancos(string conexao) + { + dal = new DALBancos(conexao); + } + + #region INSERT + public bool Inserir(ModeloBancos banco) + { + string erro = Validar(banco); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + return dal.Inserir(banco.NUMERO, banco.NOME); + } + #endregion + + #region UPDATE + public bool Alterar(ModeloBancos banco) + { + if (banco.ID_BANCOS <= 0) + throw new Exception("Banco inválido."); + + string erro = Validar(banco); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + return dal.Alterar(banco.ID_BANCOS, banco.NUMERO, banco.NOME); + } + #endregion + + #region DELETE + public bool Excluir(int id) + { + if (id <= 0) + throw new Exception("ID inválido."); + + return dal.Excluir(id); + } + #endregion + + #region SELECT + public DataTable LocalizarTodos() + { + return dal.LocalizarTodos(); + } + + public ModeloBancos Carregar(int id) + { + if (id <= 0) + return null; + + return dal.CarregarModeloBanco(id); + } + + public string ObterNomePorNumero(string numero) + { + if (string.IsNullOrWhiteSpace(numero)) + return null; + + return dal.ObterNomePorNumero(numero.Trim()); + } + #endregion + + #region VALIDAÇÃO + private string Validar(ModeloBancos banco) + { + if (banco == null) + return "Objeto banco inválido."; + + if (string.IsNullOrWhiteSpace(banco.NUMERO)) + return "Número do banco é obrigatório."; + + if (!SomenteNumeros(banco.NUMERO)) + return "Número do banco deve conter apenas números."; + + if (string.IsNullOrWhiteSpace(banco.NOME)) + return "Nome do banco é obrigatório."; + + if (banco.NOME.Length < 3) + return "Nome do banco muito curto."; + + return null; + } + #endregion + + #region AUX + private bool SomenteNumeros(string texto) + { + foreach (char c in texto) + { + if (!char.IsDigit(c)) + return false; + } + return true; + } + #endregion + } +} \ No newline at end of file diff --git a/BLL/BLLClientes.cs b/BLL/BLLClientes.cs new file mode 100644 index 0000000..577a364 --- /dev/null +++ b/BLL/BLLClientes.cs @@ -0,0 +1,149 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using DALL; +using MLL; + +namespace BLL +{ + public class BLLClientes + { + private DALClientes dal; + + public BLLClientes(string conexao) + { + dal = new DALClientes(conexao); + } + + #region INSERT + public bool Inserir(ModeloCliente c) + { + string erro = Validar(c); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + // 🔥 evita duplicidade (Documento + Empresa) + var existente = CarregarPorDocumento(c.EmpresaId, c.Documento); + + if (existente != null) + throw new Exception("Já existe um cliente com esse documento."); + + return dal.Inserir(c); + }//Inserir + #endregion + + #region UPDATE + public bool Alterar(ModeloCliente c) + { + if (c.Id <= 0) + throw new Exception("Cliente inválido."); + + string erro = Validar(c); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + var existente = CarregarPorDocumento(c.EmpresaId, c.Documento); + + if (existente != null && existente.Id != c.Id) + throw new Exception("Já existe outro cliente com esse documento."); + + return dal.Alterar(c); + }//Alterar + #endregion + + #region DELETE + public bool Excluir(int id) + { + if (id <= 0) + throw new Exception("ID inválido."); + + return dal.Excluir(id); + }//Excluir + #endregion + + #region SELECT + public ModeloCliente Carregar(int id) + { + if (id <= 0) + return null; + + return dal.Carregar(id); + }//Carregar + + public List Listar() + { + return dal.Listar(); + }//Listar + #endregion + + #region BUSCA POR DOCUMENTO + public ModeloCliente CarregarPorDocumento(int empresaId, string documento) + { + if (string.IsNullOrWhiteSpace(documento)) + return null; + + documento = LimparNumeros(documento); + + return dal.Listar() + .FirstOrDefault(x => + x.EmpresaId == empresaId && + LimparNumeros(x.Documento) == documento); + } + #endregion + + #region VALIDAÇÃO + private string Validar(ModeloCliente c) + { + if (c == null) + return "Objeto cliente inválido."; + + if (c.EmpresaId <= 0) + return "Empresa inválida."; + + if (string.IsNullOrWhiteSpace(c.Nome)) + return "Nome é obrigatório."; + + if (string.IsNullOrWhiteSpace(c.TipoPessoa)) + return "Tipo de pessoa é obrigatório."; + + if (string.IsNullOrWhiteSpace(c.Documento)) + return "Documento é obrigatório."; + + // 🔥 limpa CPF/CNPJ + c.Documento = LimparNumeros(c.Documento); + + if (c.TipoPessoa == "PF" && c.Documento.Length != 11) + return "CPF inválido."; + + if (c.TipoPessoa == "PJ" && c.Documento.Length != 14) + return "CNPJ inválido."; + + if (!string.IsNullOrEmpty(c.Email)) + { + if (!c.Email.Contains("@")) + return "Email inválido."; + } + + if (!string.IsNullOrEmpty(c.UF)) + { + if (c.UF.Length != 2) + return "UF inválida."; + } + + return null; + } + #endregion + + #region AUX + private string LimparNumeros(string texto) + { + if (string.IsNullOrWhiteSpace(texto)) + return texto; + + return new string(texto.Where(char.IsDigit).ToArray()); + } + #endregion + } +} \ No newline at end of file diff --git a/BLL/BLLEmpresa.cs b/BLL/BLLEmpresa.cs new file mode 100644 index 0000000..b6f7eeb --- /dev/null +++ b/BLL/BLLEmpresa.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using DALL; +using MLL; + +namespace BLL +{ + public class BLLEmpresa + { + private readonly DALEmpresa dal; + + public BLLEmpresa(string connectionString) + { + dal = new DALEmpresa(connectionString); + }//Constructor + + // 🔹 LISTAR + public List Listar() + { + return dal.Listar(); + } + + // 🔹 CARREGAR POR ID + public ModeloEmpresa CarregarModeloEmpresa(int id) + { + return dal.CarregarModeloEmpresa(id); + } + + // 🔹 INSERIR + public bool Inserir(ModeloEmpresa obj) + { + // validação básica (pode evoluir depois) + if (string.IsNullOrWhiteSpace(obj.Nome) || + string.IsNullOrWhiteSpace(obj.CNPJ) || + string.IsNullOrWhiteSpace(obj.Email)) + return false; + + return dal.Inserir(obj); + } + + // 🔹 ALTERAR + public bool Alterar(ModeloEmpresa obj) + { + if (obj.Id <= 0) + return false; + + return dal.Alterar(obj); + } + + // 🔹 EXCLUIR + public bool Excluir(int id) + { + if (id <= 0) + return false; + + return dal.Excluir(id); + } + public ModeloEmpresa? CarregarEmpresaAtiva() + { + return dal.CarregarEmpresaAtiva(); + } + } +} \ No newline at end of file diff --git a/BLL/BLLEmpresaConfig.cs b/BLL/BLLEmpresaConfig.cs new file mode 100644 index 0000000..1d2699b --- /dev/null +++ b/BLL/BLLEmpresaConfig.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + public class BLLEmpresaConfig + { + private readonly DALEmpresaConfig _dal; + + public BLLEmpresaConfig( string connectionString) + { + _dal = new DALEmpresaConfig(connectionString); + }//metodo construtor + public bool Inserir(ModeloEmpresaConfig config) + { + ValidarInserir(config); + bool result = _dal.Inserir(config); + if (result) + { + return true; + } + else + { + return false; + } + + }//Inserir + public bool Alterar(ModeloEmpresaConfig config) + { + ValidarAlterar(config); + bool result = _dal.Atualizar(config); + if (result) + { + return true; + } + else + { + return false; + } + + }//Alterar + public bool Excluir(int Cod) + { + bool result = _dal.Excluir(Cod); + if (result) + { + return true; + } + else + { + return false; + } + }//Excluir + public List LocalizarTodas() + { + return _dal.LocalizarTodas(); + }//LocalizarTodas + public ModeloEmpresaConfig ObterPorEmpresa(int idEmpresa) + { + return _dal.ObterPorEmpresa(idEmpresa); + }//ObterPorEmpresa + public int ObterEmpresaAtivaId() + { + return _dal.ObterEmpresaAtivaId(); + }//Obter ID empresa ativa + + #region VALIDAÇÕES + private void ValidarInserir(ModeloEmpresaConfig config) + { + + if (config.IdEmpresa <= 0) + throw new Exception("Empresa inválida."); + + if (string.IsNullOrWhiteSpace(config.NomeSistema)) + throw new Exception("Nome do sistema é obrigatório."); + + if (config.DiasGarantiaPadrao < 0) + throw new Exception("Dias de garantia inválido."); + + if (!string.IsNullOrEmpty(config.CorPrimaria) && !config.CorPrimaria.StartsWith("#")) + throw new Exception("Cor primária inválida. Use formato HEX (#FFFFFF)."); + + if (!string.IsNullOrEmpty(config.CorSecundaria) && !config.CorSecundaria.StartsWith("#")) + throw new Exception("Cor secundária inválida."); + + }//inserir + + private void ValidarAlterar(ModeloEmpresaConfig config) + { + if (config.IdEmpresaConfig <= 0) + throw new Exception("Código da configuração invalida"); + + if (config.IdEmpresa <= 0) + throw new Exception("Empresa inválida."); + + if (string.IsNullOrWhiteSpace(config.NomeSistema)) + throw new Exception("Nome do sistema é obrigatório."); + + if (config.DiasGarantiaPadrao < 0) + throw new Exception("Dias de garantia inválido."); + + if (!string.IsNullOrEmpty(config.CorPrimaria) && !config.CorPrimaria.StartsWith("#")) + throw new Exception("Cor primária inválida. Use formato HEX (#FFFFFF)."); + + if (!string.IsNullOrEmpty(config.CorSecundaria) && !config.CorSecundaria.StartsWith("#")) + throw new Exception("Cor secundária inválida."); + + }//inserir + + + #endregion + } +} diff --git a/BLL/BLLFuncionarios.cs b/BLL/BLLFuncionarios.cs new file mode 100644 index 0000000..94d6e32 --- /dev/null +++ b/BLL/BLLFuncionarios.cs @@ -0,0 +1,119 @@ +using System; +using DALL; +using MLL; + +namespace BLL +{ + public class BLLFuncionarios + { + private DALFuncionarios dal; + + public BLLFuncionarios(string conexao) + { + dal = new DALFuncionarios(conexao); + } + + #region INSERT + public bool Inserir(ModeloFuncionarios f) + { + string erro = Validar(f); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + return dal.Inserir(f); + } + #endregion + + #region UPDATE + public bool Alterar(ModeloFuncionarios f) + { + if (f.ID_FUNCIONARIO <= 0) + throw new Exception("Funcionário inválido."); + + string erro = Validar(f); + + if (!string.IsNullOrEmpty(erro)) + throw new Exception(erro); + + return dal.Alterar(f); + } + #endregion + + #region DELETE + public bool Excluir(int id) + { + if (id <= 0) + throw new Exception("ID inválido."); + + return dal.Excluir(id); + } + #endregion + + public ModeloFuncionarios CarregarModeloFuncionario(int id) + { + return dal.Carregar(id); + }//CarregarModeloFuncionario + public List Listar() + { + return dal.Listar(); + }//List + public List LocalizarOtimizado(ModeloFuncionarios filtro) + { + return dal.LocalizarOtimizado(filtro); + }//List LocalizarOtimizado(ModeloFuncionarios filtro) + public string ObterNomePorCodigo(string codigo) + { + return dal.ObterNomePorCodigo(codigo); + }//ObterNomePorCodigo + public ModeloFuncionarios CarregarPorCodigo(string codigo) + { + if (string.IsNullOrWhiteSpace(codigo)) + return null; + + return dal.CarregarPorCodigo(codigo); + }//CarregarPorCodigo + + #region VALIDAÇÃO + private string Validar(ModeloFuncionarios f) + { + if (f == null) + return "Objeto funcionário inválido."; + + if (string.IsNullOrWhiteSpace(f.NOME)) + return "Nome é obrigatório."; + + // 🔥 LIMPA CPF antes de validar + f.CPF = LimparNumeros(f.CPF); + + if (!string.IsNullOrEmpty(f.CPF)) + { + if (f.CPF.Length != 11) + return "CPF deve conter 11 dígitos."; + } + + return null; + } + private string LimparNumeros(string texto) + { + if (string.IsNullOrWhiteSpace(texto)) + return texto; + + return new string(texto.Where(char.IsDigit).ToArray()); + } + + #endregion + + #region AUX + private bool SomenteNumeros(string texto) + { + foreach (char c in texto) + { + if (!char.IsDigit(c)) + return false; + } + return true; + } + #endregion + } +} \ No newline at end of file diff --git a/CAB/App.config b/CAB/App.config new file mode 100644 index 0000000..5ab1a35 --- /dev/null +++ b/CAB/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/CAB/CAB.csproj b/CAB/CAB.csproj new file mode 100644 index 0000000..b1ae0a7 --- /dev/null +++ b/CAB/CAB.csproj @@ -0,0 +1,108 @@ + + + + + Debug + AnyCPU + {19039AC1-EE08-460B-821B-0277442D04D1} + WinExe + CAB + CAB + v4.8.1 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + Form + + + Form_Alert.cs + + + + + Form1.cs + + + Form_Alert.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CAB/Form1.Designer.cs b/CAB/Form1.Designer.cs new file mode 100644 index 0000000..5cc35d3 --- /dev/null +++ b/CAB/Form1.Designer.cs @@ -0,0 +1,131 @@ +namespace CAB +{ + 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.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button1 + // + this.button1.BackColor = System.Drawing.Color.SeaGreen; + this.button1.FlatAppearance.BorderSize = 0; + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.ForeColor = System.Drawing.Color.White; + this.button1.Location = new System.Drawing.Point(169, 101); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(204, 58); + this.button1.TabIndex = 0; + this.button1.Text = "Success"; + this.button1.UseVisualStyleBackColor = false; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.BackColor = System.Drawing.Color.OrangeRed; + this.button2.FlatAppearance.BorderSize = 0; + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.ForeColor = System.Drawing.Color.White; + this.button2.Location = new System.Drawing.Point(169, 165); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(204, 58); + this.button2.TabIndex = 0; + this.button2.Text = "Warning"; + this.button2.UseVisualStyleBackColor = false; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.BackColor = System.Drawing.Color.DarkRed; + this.button3.FlatAppearance.BorderSize = 0; + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.ForeColor = System.Drawing.Color.White; + this.button3.Location = new System.Drawing.Point(169, 229); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(204, 58); + this.button3.TabIndex = 0; + this.button3.Text = "Error"; + this.button3.UseVisualStyleBackColor = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.BackColor = System.Drawing.Color.RoyalBlue; + this.button4.FlatAppearance.BorderSize = 0; + this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button4.ForeColor = System.Drawing.Color.White; + this.button4.Location = new System.Drawing.Point(169, 293); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(204, 58); + this.button4.TabIndex = 0; + this.button4.Text = "info"; + this.button4.UseVisualStyleBackColor = false; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Century Gothic", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(180, 35); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(174, 25); + this.label1.TabIndex = 1; + this.label1.Text = "C# Ui Academy"; + // + // Form1 + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(555, 413); + this.Controls.Add(this.label1); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Font = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label1; + } +} + diff --git a/CAB/Form1.cs b/CAB/Form1.cs new file mode 100644 index 0000000..e588da2 --- /dev/null +++ b/CAB/Form1.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CAB +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + public void Alert(string msg, Form_Alert.enmType type) + { + Form_Alert frm = new Form_Alert(); + frm.showAlert(msg,type); + } + private void button1_Click(object sender, EventArgs e) + { + this.Alert("Success Alert",Form_Alert.enmType.Success); + } + + private void button2_Click(object sender, EventArgs e) + { + this.Alert("Warning Alert", Form_Alert.enmType.Warning); + } + + private void button3_Click(object sender, EventArgs e) + { + this.Alert("Error Alert", Form_Alert.enmType.Error); + } + + private void button4_Click(object sender, EventArgs e) + { + this.Alert("Info Alert", Form_Alert.enmType.Info); + } + } +} diff --git a/CAB/Form1.resx b/CAB/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CAB/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CAB/Form_Alert.Designer.cs b/CAB/Form_Alert.Designer.cs new file mode 100644 index 0000000..13653f4 --- /dev/null +++ b/CAB/Form_Alert.Designer.cs @@ -0,0 +1,100 @@ +namespace CAB +{ + partial class Form_Alert + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.lblMsg = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.SuspendLayout(); + // + // lblMsg + // + this.lblMsg.AutoSize = true; + this.lblMsg.ForeColor = System.Drawing.Color.White; + this.lblMsg.Location = new System.Drawing.Point(65, 22); + this.lblMsg.Name = "lblMsg"; + this.lblMsg.Size = new System.Drawing.Size(116, 21); + this.lblMsg.TabIndex = 0; + this.lblMsg.Text = "Message Text"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::CAB.Properties.Resources.success; + this.pictureBox1.Location = new System.Drawing.Point(12, 13); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(41, 39); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // timer1 + // + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // pictureBox2 + // + this.pictureBox2.Image = global::CAB.Properties.Resources.icons8_cancel_25px; + this.pictureBox2.Location = new System.Drawing.Point(298, 22); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(26, 30); + this.pictureBox2.TabIndex = 3; + this.pictureBox2.TabStop = false; + this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); + // + // Form_Alert + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.SystemColors.Highlight; + this.ClientSize = new System.Drawing.Size(347, 74); + this.Controls.Add(this.pictureBox2); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.lblMsg); + this.Font = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Form_Alert"; + this.Text = "Form_Alert"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lblMsg; + private System.Windows.Forms.PictureBox pictureBox1; + internal System.Windows.Forms.Timer timer1; + private System.Windows.Forms.PictureBox pictureBox2; + } +} \ No newline at end of file diff --git a/CAB/Form_Alert.cs b/CAB/Form_Alert.cs new file mode 100644 index 0000000..8b3ce4d --- /dev/null +++ b/CAB/Form_Alert.cs @@ -0,0 +1,139 @@ +using CAB.Properties; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CAB +{ + public partial class Form_Alert : Form + { + public Form_Alert() + { + InitializeComponent(); + } + + public enum enmAction + { + wait, + start, + close + } + + public enum enmType + { + Success, + Warning, + Error, + Info + } + private Form_Alert.enmAction action; + + private int x, y; + + private void button1_Click(object sender, EventArgs e) + { + + } + + private void timer1_Tick(object sender, EventArgs e) + { + switch(this.action) + { + case enmAction.wait: + timer1.Interval = 5000; + action = enmAction.close; + break; + case Form_Alert.enmAction.start: + this.timer1.Interval = 1; + this.Opacity += 0.1; + if (this.x < this.Location.X) + { + this.Left--; + } + else + { + if (this.Opacity == 1.0) + { + action = Form_Alert.enmAction.wait; + } + } + break; + case enmAction.close: + timer1.Interval = 1; + this.Opacity -= 0.1; + + this.Left -= 3; + if (base.Opacity == 0.0) + { + base.Close(); + } + break; + } + } + + private void pictureBox2_Click(object sender, EventArgs e) + { + timer1.Interval = 1; + action = enmAction.close; + } + + public void showAlert(string msg, enmType type) + { + this.Opacity = 0.0; + this.StartPosition = FormStartPosition.Manual; + string fname; + + for (int i = 1; i < 10; i++) + { + fname = "alert" + i.ToString(); + Form_Alert frm = (Form_Alert)Application.OpenForms[fname]; + + if (frm == null) + { + this.Name = fname; + this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; + this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i; + this.Location = new Point(this.x, this.y); + break; + + } + + } + this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; + + switch(type) + { + case enmType.Success: + this.pictureBox1.Image = Resources.success; + this.BackColor = Color.SeaGreen; + break; + case enmType.Error: + this.pictureBox1.Image = Resources.error; + this.BackColor = Color.DarkRed; + break; + case enmType.Info: + this.pictureBox1.Image = Resources.info; + this.BackColor = Color.RoyalBlue; + break; + case enmType.Warning: + this.pictureBox1.Image = Resources.warning; + this.BackColor = Color.DarkOrange; + break; + } + + + this.lblMsg.Text = msg; + + this.Show(); + this.action = enmAction.start; + this.timer1.Interval = 1; + this.timer1.Start(); + } + } +} diff --git a/CAB/Form_Alert.resx b/CAB/Form_Alert.resx new file mode 100644 index 0000000..1f666f2 --- /dev/null +++ b/CAB/Form_Alert.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/CAB/Program.cs b/CAB/Program.cs new file mode 100644 index 0000000..6fe0265 --- /dev/null +++ b/CAB/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CAB +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/CAB/Properties/AssemblyInfo.cs b/CAB/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cf7eef9 --- /dev/null +++ b/CAB/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CAB")] +[assembly: AssemblyDescription("Biblioteca de classe C# para MessageBox")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Levelcode")] +[assembly: AssemblyProduct("CAB")] +[assembly: AssemblyCopyright("Copyright © 2026")] +[assembly: AssemblyTrademark("Levelcode Developed")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("19039ac1-ee08-460b-821b-0277442d04d1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.1.2")] +[assembly: AssemblyFileVersion("1.0.1.2")] diff --git a/CAB/Properties/Resources.Designer.cs b/CAB/Properties/Resources.Designer.cs new file mode 100644 index 0000000..26101fa --- /dev/null +++ b/CAB/Properties/Resources.Designer.cs @@ -0,0 +1,113 @@ +//------------------------------------------------------------------------------ +// +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 +// +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. +// +//------------------------------------------------------------------------------ + +namespace CAB.Properties { + using System; + + + /// + /// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc. + /// + // Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder + // através de uma ferramenta como ResGen ou Visual Studio. + // Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente + // com a opção /str, ou recrie o projeto do VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Retorna a instância de ResourceManager armazenada em cache usada por essa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CAB.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Substitui a propriedade CurrentUICulture do thread atual para todas as + /// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_cancel_25px { + get { + object obj = ResourceManager.GetObject("icons8_cancel_25px", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap info { + get { + object obj = ResourceManager.GetObject("info", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap success { + get { + object obj = ResourceManager.GetObject("success", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap warning { + get { + object obj = ResourceManager.GetObject("warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CAB/Properties/Resources.resx b/CAB/Properties/Resources.resx new file mode 100644 index 0000000..9f23fd7 --- /dev/null +++ b/CAB/Properties/Resources.resx @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8_cancel_25px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\success.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CAB/Properties/Settings.Designer.cs b/CAB/Properties/Settings.Designer.cs new file mode 100644 index 0000000..57d17f9 --- /dev/null +++ b/CAB/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 +// +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. +// +//------------------------------------------------------------------------------ + +namespace CAB.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "18.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/CAB/Properties/Settings.settings b/CAB/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/CAB/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CAB/Resources/error.png b/CAB/Resources/error.png new file mode 100644 index 0000000..0bff229 Binary files /dev/null and b/CAB/Resources/error.png differ diff --git a/CAB/Resources/icons8_cancel_25px.png b/CAB/Resources/icons8_cancel_25px.png new file mode 100644 index 0000000..a6e2f4f Binary files /dev/null and b/CAB/Resources/icons8_cancel_25px.png differ diff --git a/CAB/Resources/info.png b/CAB/Resources/info.png new file mode 100644 index 0000000..f3679d6 Binary files /dev/null and b/CAB/Resources/info.png differ diff --git a/CAB/Resources/success.png b/CAB/Resources/success.png new file mode 100644 index 0000000..041b09b Binary files /dev/null and b/CAB/Resources/success.png differ diff --git a/CAB/Resources/warning.png b/CAB/Resources/warning.png new file mode 100644 index 0000000..02057d3 Binary files /dev/null and b/CAB/Resources/warning.png differ diff --git a/CCH/AppFileSystem.cs b/CCH/AppFileSystem.cs new file mode 100644 index 0000000..abe7ba1 --- /dev/null +++ b/CCH/AppFileSystem.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CCH +{ + public static class AppFileSystem + { + //Private + private readonly static string appFileIconSystem = Path.Combine(AppFolderSystem.appDataFolderConfig, "icone.ico"); + private readonly static string appFileDBSystem = Path.Combine(AppFolderSystem.appDataFolderConfig, "Database.cfg"); + private readonly static string appFileFTPSystem = Path.Combine(AppFolderSystem.appDataFolderConfig, "Ftp-client.cfg"); + private readonly static string appFileTelegramSystem = Path.Combine(AppFolderSystem.appDataFolderConfig, "Telegram-Client.cfg"); + private readonly static string appFileSMTPSystem = Path.Combine(AppFolderSystem.appDataFolderConfig, "Smtp-Client.cfg"); + private readonly static string appFileConfigEmpresa = Path.Combine(AppFolderSystem.appDataFolderConfig, "Empresa-Client.cfg"); + + + + //Public + public static string AppFileIconSystem => appFileIconSystem; + public static string AppFileDBSystem => appFileDBSystem; + + public static string AppFileFTPSystem => appFileFTPSystem; + + public static string AppFileTelegramSystem => appFileTelegramSystem; + + public static string AppFileSMTPSystem => appFileSMTPSystem; + + public static string AppFileConfigEmpresa => appFileConfigEmpresa; + } +} diff --git a/CCH/AppFolderSystem.cs b/CCH/AppFolderSystem.cs new file mode 100644 index 0000000..f231318 --- /dev/null +++ b/CCH/AppFolderSystem.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +namespace CCH +{ + public static class AppFolderSystem + { + // ROOT + public static readonly string appDataFolderRoot = @"C:\LevelCode"; + + // SISTEMA + public static readonly string appDataFolderSystem = Path.Combine(appDataFolderRoot, "LevelOS"); + public static readonly string appDataFolderConfig = Path.Combine(appDataFolderSystem, "Config"); + + // USUÁRIO + public static readonly string appDataFolderUser = Path.Combine(appDataFolderSystem, "UserData"); + public static readonly string appDataFolderUserTemp = Path.Combine(appDataFolderUser, "Temp"); + public static readonly string appDataFolderUserCache = Path.Combine(appDataFolderUser, "Cache"); + + // LOGS + public static readonly string appDataFolderLogs = Path.Combine(appDataFolderSystem, "Logs"); + public static readonly string appDataFolderLogsError = Path.Combine(appDataFolderLogs, "Error"); + public static readonly string appDataFolderLogsAccess = Path.Combine(appDataFolderLogs, "Access"); + + // BACKUP + public static readonly string appDataFolderBackup = Path.Combine(appDataFolderSystem, "Backup"); + public static readonly string appDataFolderBackupDatabase = Path.Combine(appDataFolderBackup, "Database"); + public static readonly string appDataFolderBackupFiles = Path.Combine(appDataFolderBackup, "Files"); + + // RELATÓRIOS + public static readonly string appDataFolderReports = Path.Combine(appDataFolderSystem, "Reports"); + public static readonly string appDataFolderReportsPDF = Path.Combine(appDataFolderReports, "PDF"); + public static readonly string appDataFolderReportsTemp = Path.Combine(appDataFolderReports, "Temp"); + + // UPLOADS + public static readonly string appDataFolderUploads = Path.Combine(appDataFolderSystem, "Uploads"); + public static readonly string appDataFolderUploadsImages = Path.Combine(appDataFolderUploads, "Images"); + public static readonly string appDataFolderUploadsDocuments = Path.Combine(appDataFolderUploads, "Documents"); + + // CONTRATOS / OS + public static readonly string appDataFolderContracts = Path.Combine(appDataFolderSystem, "Contracts"); + public static readonly string appDataFolderOS = Path.Combine(appDataFolderSystem, "OrdemServico"); + + // EXPORTAÇÕES + public static readonly string appDataFolderExport = Path.Combine(appDataFolderSystem, "Export"); + public static readonly string appDataFolderImport = Path.Combine(appDataFolderSystem, "Import"); + public static readonly string appDataFolderExportXML = Path.Combine(appDataFolderSystem, "Xml"); + + public static void CriarEstruturaPastas() + { + var pastas = new[] + { + // ROOT + appDataFolderRoot, + + // SISTEMA + appDataFolderSystem, + appDataFolderConfig, + + // USUÁRIO + appDataFolderUser, + appDataFolderUserTemp, + appDataFolderUserCache, + + // LOGS + appDataFolderLogs, + appDataFolderLogsError, + appDataFolderLogsAccess, + + // BACKUP + appDataFolderBackup, + appDataFolderBackupDatabase, + appDataFolderBackupFiles, + + // RELATÓRIOS + appDataFolderReports, + appDataFolderReportsPDF, + appDataFolderReportsTemp, + + // UPLOADS + appDataFolderUploads, + appDataFolderUploadsImages, + appDataFolderUploadsDocuments, + + // CONTRATOS / OS + appDataFolderContracts, + appDataFolderOS, + + // EXPORTAÇÃO + appDataFolderExport, + appDataFolderImport, + appDataFolderExportXML + }; + + foreach (var pasta in pastas) + { + if (!Directory.Exists(pasta)) + { + Directory.CreateDirectory(pasta); + } + } + }//Criando estruturaDePastas + } + +} diff --git a/CCH/AppInfoSystem.cs b/CCH/AppInfoSystem.cs new file mode 100644 index 0000000..ffa06e8 --- /dev/null +++ b/CCH/AppInfoSystem.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace CCH +{ + public static class AppInfoSystem + { + private readonly static string appKeyMasterCrip = "LevelCode@2026#" + GerarChaveMaquina(); + + + + + + + + public static string AppKeyMasterCrip => appKeyMasterCrip; + + private static string GerarChaveMaquina() + { + string baseInfo = Environment.MachineName + Environment.UserName; + + using var sha = SHA256.Create(); + var hash = sha.ComputeHash(Encoding.UTF8.GetBytes(baseInfo)); + + return Convert.ToBase64String(hash); + }//Cria uma chave unica baseada em cada maquina + } +} diff --git a/CCH/CCH.csproj b/CCH/CCH.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/CCH/CCH.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/CMB/CMB.csproj b/CMB/CMB.csproj new file mode 100644 index 0000000..c4a1e15 --- /dev/null +++ b/CMB/CMB.csproj @@ -0,0 +1,18 @@ + + + + net8.0-windows + true + enable + enable + + + + + + + + + + + \ No newline at end of file diff --git a/CMB/FormMessageBox.Designer.cs b/CMB/FormMessageBox.Designer.cs new file mode 100644 index 0000000..71e5727 --- /dev/null +++ b/CMB/FormMessageBox.Designer.cs @@ -0,0 +1,227 @@ + +namespace CMB +{ + partial class FormMessageBox + { + /// + /// 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() + { + panelTitleBar = new Panel(); + labelCaption = new Label(); + btnClose = new Button(); + panelButtons = new Panel(); + button3 = new Button(); + button2 = new Button(); + button1 = new Button(); + panelBody = new Panel(); + labelMessage = new Label(); + pictureBoxIcon = new PictureBox(); + panelTitleBar.SuspendLayout(); + panelButtons.SuspendLayout(); + panelBody.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxIcon).BeginInit(); + SuspendLayout(); + // + // panelTitleBar + // + panelTitleBar.BackColor = Color.CornflowerBlue; + panelTitleBar.Controls.Add(labelCaption); + panelTitleBar.Controls.Add(btnClose); + panelTitleBar.Dock = DockStyle.Top; + panelTitleBar.Location = new Point(2, 2); + panelTitleBar.Margin = new Padding(4, 3, 4, 3); + panelTitleBar.Name = "panelTitleBar"; + panelTitleBar.Size = new Size(404, 40); + panelTitleBar.TabIndex = 0; + panelTitleBar.MouseDown += panelTitleBar_MouseDown; + // + // labelCaption + // + labelCaption.AutoSize = true; + labelCaption.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, 0); + labelCaption.ForeColor = Color.White; + labelCaption.Location = new Point(10, 9); + labelCaption.Margin = new Padding(4, 0, 4, 0); + labelCaption.Name = "labelCaption"; + labelCaption.Size = new Size(86, 17); + labelCaption.TabIndex = 4; + labelCaption.Text = "labelCaption"; + // + // btnClose + // + btnClose.Dock = DockStyle.Right; + btnClose.FlatAppearance.BorderSize = 0; + btnClose.FlatAppearance.MouseOverBackColor = Color.FromArgb(224, 79, 95); + btnClose.FlatStyle = FlatStyle.Flat; + btnClose.Font = new Font("Microsoft Sans Serif", 13F, FontStyle.Regular, GraphicsUnit.Point, 0); + btnClose.ForeColor = Color.White; + btnClose.Location = new Point(357, 0); + btnClose.Margin = new Padding(4, 3, 4, 3); + btnClose.Name = "btnClose"; + btnClose.Size = new Size(47, 40); + btnClose.TabIndex = 3; + btnClose.Text = "X"; + btnClose.UseVisualStyleBackColor = false; + btnClose.Click += btnClose_Click; + // + // panelButtons + // + panelButtons.BackColor = Color.FromArgb(235, 235, 235); + panelButtons.Controls.Add(button3); + panelButtons.Controls.Add(button2); + panelButtons.Controls.Add(button1); + panelButtons.Dock = DockStyle.Bottom; + panelButtons.Location = new Point(2, 102); + panelButtons.Margin = new Padding(4, 3, 4, 3); + panelButtons.Name = "panelButtons"; + panelButtons.Size = new Size(404, 69); + panelButtons.TabIndex = 1; + // + // button3 + // + button3.BackColor = Color.SeaGreen; + button3.FlatAppearance.BorderSize = 0; + button3.FlatStyle = FlatStyle.Flat; + button3.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, 0); + button3.ForeColor = Color.WhiteSmoke; + button3.Location = new Point(270, 14); + button3.Margin = new Padding(4, 3, 4, 3); + button3.Name = "button3"; + button3.Size = new Size(117, 40); + button3.TabIndex = 2; + button3.Text = "button3"; + button3.UseVisualStyleBackColor = false; + // + // button2 + // + button2.BackColor = Color.SeaGreen; + button2.FlatAppearance.BorderSize = 0; + button2.FlatStyle = FlatStyle.Flat; + button2.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, 0); + button2.ForeColor = Color.WhiteSmoke; + button2.Location = new Point(146, 14); + button2.Margin = new Padding(4, 3, 4, 3); + button2.Name = "button2"; + button2.Size = new Size(117, 40); + button2.TabIndex = 1; + button2.Text = "button2"; + button2.UseVisualStyleBackColor = false; + // + // button1 + // + button1.BackColor = Color.SeaGreen; + button1.FlatAppearance.BorderSize = 0; + button1.FlatStyle = FlatStyle.Flat; + button1.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, 0); + button1.ForeColor = Color.WhiteSmoke; + button1.Location = new Point(22, 14); + button1.Margin = new Padding(4, 3, 4, 3); + button1.Name = "button1"; + button1.Size = new Size(117, 40); + button1.TabIndex = 0; + button1.Text = "button1"; + button1.UseVisualStyleBackColor = false; + // + // panelBody + // + panelBody.BackColor = Color.WhiteSmoke; + panelBody.Controls.Add(labelMessage); + panelBody.Controls.Add(pictureBoxIcon); + panelBody.Dock = DockStyle.Fill; + panelBody.Location = new Point(2, 42); + panelBody.Margin = new Padding(4, 3, 4, 3); + panelBody.Name = "panelBody"; + panelBody.Padding = new Padding(12, 12, 0, 0); + panelBody.Size = new Size(404, 60); + panelBody.TabIndex = 2; + // + // labelMessage + // + labelMessage.AutoSize = true; + labelMessage.Dock = DockStyle.Fill; + labelMessage.Font = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular, GraphicsUnit.Point, 0); + labelMessage.ForeColor = Color.FromArgb(85, 85, 85); + labelMessage.Location = new Point(59, 12); + labelMessage.Margin = new Padding(4, 0, 4, 0); + labelMessage.MaximumSize = new Size(700, 0); + labelMessage.Name = "labelMessage"; + labelMessage.Padding = new Padding(6, 6, 12, 17); + labelMessage.Size = new Size(113, 40); + labelMessage.TabIndex = 1; + labelMessage.Text = "labelMessage"; + labelMessage.TextAlign = ContentAlignment.MiddleLeft; + // + // pictureBoxIcon + // + pictureBoxIcon.Dock = DockStyle.Left; + pictureBoxIcon.Image = Properties.Resources.chat; + pictureBoxIcon.Location = new Point(12, 12); + pictureBoxIcon.Margin = new Padding(4, 3, 4, 3); + pictureBoxIcon.Name = "pictureBoxIcon"; + pictureBoxIcon.Size = new Size(47, 48); + pictureBoxIcon.TabIndex = 0; + pictureBoxIcon.TabStop = false; + // + // FormMessageBox + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.CornflowerBlue; + ClientSize = new Size(408, 173); + Controls.Add(panelBody); + Controls.Add(panelButtons); + Controls.Add(panelTitleBar); + Margin = new Padding(4, 3, 4, 3); + MinimumSize = new Size(406, 167); + Name = "FormMessageBox"; + Padding = new Padding(2); + StartPosition = FormStartPosition.CenterParent; + Text = "Form1"; + panelTitleBar.ResumeLayout(false); + panelTitleBar.PerformLayout(); + panelButtons.ResumeLayout(false); + panelBody.ResumeLayout(false); + panelBody.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxIcon).EndInit(); + ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panelTitleBar; + private System.Windows.Forms.Panel panelButtons; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button btnClose; + private System.Windows.Forms.Panel panelBody; + private System.Windows.Forms.Label labelMessage; + private System.Windows.Forms.PictureBox pictureBoxIcon; + private System.Windows.Forms.Label labelCaption; + } +} + diff --git a/CMB/FormMessageBox.cs b/CMB/FormMessageBox.cs new file mode 100644 index 0000000..fc14638 --- /dev/null +++ b/CMB/FormMessageBox.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CMB +{ + public partial class FormMessageBox : Form + { + //Fields + private Color primaryColor = Color.CornflowerBlue; + private int borderSize = 2; + + //Properties + public Color PrimaryColor + { + get { return primaryColor; } + set + { + primaryColor = value; + this.BackColor = primaryColor;//Form Border Color + this.panelTitleBar.BackColor = PrimaryColor;//Title Bar Back Color + } + } + + //Constructors + public FormMessageBox(string text) + { + InitializeComponent(); + InitializeItems(); + this.PrimaryColor = primaryColor; + this.labelMessage.Text = text; + this.labelCaption.Text = ""; + SetFormSize(); + SetButtons(MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);//Set Default Buttons + } + public FormMessageBox(string text, string caption) + { + InitializeComponent(); + InitializeItems(); + this.PrimaryColor = primaryColor; + this.labelMessage.Text = text; + this.labelCaption.Text = caption; + SetFormSize(); + SetButtons(MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);//Set Default Buttons + } + public FormMessageBox(string text, string caption, MessageBoxButtons buttons) + { + InitializeComponent(); + InitializeItems(); + this.PrimaryColor = primaryColor; + this.labelMessage.Text = text; + this.labelCaption.Text = caption; + SetFormSize(); + SetButtons(buttons, MessageBoxDefaultButton.Button1);//Set [Default Button 1] + } + public FormMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) + { + InitializeComponent(); + InitializeItems(); + this.PrimaryColor = primaryColor; + this.labelMessage.Text = text; + this.labelCaption.Text = caption; + SetFormSize(); + SetButtons(buttons, MessageBoxDefaultButton.Button1);//Set [Default Button 1] + SetIcon(icon); + } + public FormMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) + { + InitializeComponent(); + InitializeItems(); + this.PrimaryColor = primaryColor; + this.labelMessage.Text = text; + this.labelCaption.Text = caption; + SetFormSize(); + SetButtons(buttons, defaultButton); + SetIcon(icon); + } + + //-> Private Methods + private void InitializeItems() + { + this.FormBorderStyle = FormBorderStyle.None; + this.Padding = new Padding(borderSize);//Set border size + this.labelMessage.MaximumSize = new Size(550, 0); + this.btnClose.DialogResult = DialogResult.Cancel; + this.button1.DialogResult = DialogResult.OK; + this.button1.Visible = false; + this.button2.Visible = false; + this.button3.Visible = false; + } + private void SetFormSize() + { + int widht = this.labelMessage.Width + this.pictureBoxIcon.Width + this.panelBody.Padding.Left; + int height = this.panelTitleBar.Height + this.labelMessage.Height + this.panelButtons.Height + this.panelBody.Padding.Top; + this.Size = new Size(widht, height); + } + private void SetButtons(MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton) + { + int xCenter = (this.panelButtons.Width - button1.Width) / 2; + int yCenter = (this.panelButtons.Height - button1.Height) / 2; + + switch (buttons) + { + case MessageBoxButtons.OK: + //OK Button + button1.Visible = true; + button1.Location = new Point(xCenter, yCenter); + button1.Text = "Ok"; + button1.DialogResult = DialogResult.OK;//Set DialogResult + + //Set Default Button + SetDefaultButton(defaultButton); + break; + case MessageBoxButtons.OKCancel: + //OK Button + button1.Visible = true; + button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter); + button1.Text = "Ok"; + button1.DialogResult = DialogResult.OK;//Set DialogResult + + //Cancel Button + button2.Visible = true; + button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter); + button2.Text = "Cancel"; + button2.DialogResult = DialogResult.Cancel;//Set DialogResult + button2.BackColor = Color.DimGray; + + //Set Default Button + if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3 + SetDefaultButton(defaultButton); + else SetDefaultButton(MessageBoxDefaultButton.Button1); + break; + + case MessageBoxButtons.RetryCancel: + //Retry Button + button1.Visible = true; + button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter); + button1.Text = "Retry"; + button1.DialogResult = DialogResult.Retry;//Set DialogResult + + //Cancel Button + button2.Visible = true; + button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter); + button2.Text = "Cancel"; + button2.DialogResult = DialogResult.Cancel;//Set DialogResult + button2.BackColor = Color.DimGray; + + //Set Default Button + if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3 + SetDefaultButton(defaultButton); + else SetDefaultButton(MessageBoxDefaultButton.Button1); + break; + + case MessageBoxButtons.YesNo: + //Yes Button + button1.Visible = true; + button1.Location = new Point(xCenter - (button1.Width / 2) - 5, yCenter); + button1.Text = "Yes"; + button1.DialogResult = DialogResult.Yes;//Set DialogResult + + //No Button + button2.Visible = true; + button2.Location = new Point(xCenter + (button2.Width / 2) + 5, yCenter); + button2.Text = "No"; + button2.DialogResult = DialogResult.No;//Set DialogResult + button2.BackColor = Color.IndianRed; + + //Set Default Button + if (defaultButton != MessageBoxDefaultButton.Button3)//There are only 2 buttons, so the Default Button cannot be Button3 + SetDefaultButton(defaultButton); + else SetDefaultButton(MessageBoxDefaultButton.Button1); + break; + case MessageBoxButtons.YesNoCancel: + //Yes Button + button1.Visible = true; + button1.Location = new Point(xCenter - button1.Width - 5, yCenter); + button1.Text = "Yes"; + button1.DialogResult = DialogResult.Yes;//Set DialogResult + + //No Button + button2.Visible = true; + button2.Location = new Point(xCenter, yCenter); + button2.Text = "No"; + button2.DialogResult = DialogResult.No;//Set DialogResult + button2.BackColor = Color.IndianRed; + + //Cancel Button + button3.Visible = true; + button3.Location = new Point(xCenter + button2.Width + 5, yCenter); + button3.Text = "Cancel"; + button3.DialogResult = DialogResult.Cancel;//Set DialogResult + button3.BackColor = Color.DimGray; + + //Set Default Button + SetDefaultButton(defaultButton); + break; + + case MessageBoxButtons.AbortRetryIgnore: + //Abort Button + button1.Visible = true; + button1.Location = new Point(xCenter - button1.Width - 5, yCenter); + button1.Text = "Abort"; + button1.DialogResult = DialogResult.Abort;//Set DialogResult + button1.BackColor = Color.Goldenrod; + + //Retry Button + button2.Visible = true; + button2.Location = new Point(xCenter, yCenter); + button2.Text = "Retry"; + button2.DialogResult = DialogResult.Retry;//Set DialogResult + + //Ignore Button + button3.Visible = true; + button3.Location = new Point(xCenter + button2.Width + 5, yCenter); + button3.Text = "Ignore"; + button3.DialogResult = DialogResult.Ignore;//Set DialogResult + button3.BackColor = Color.IndianRed; + + //Set Default Button + SetDefaultButton(defaultButton); + break; + } + } + private void SetDefaultButton(MessageBoxDefaultButton defaultButton) + { + switch (defaultButton) + { + case MessageBoxDefaultButton.Button1://Focus button 1 + button1.Select(); + button1.ForeColor = Color.White; + button1.Font = new Font(button1.Font, FontStyle.Underline); + break; + case MessageBoxDefaultButton.Button2://Focus button 2 + button2.Select(); + button2.ForeColor = Color.White; + button2.Font = new Font(button2.Font, FontStyle.Underline); + break; + case MessageBoxDefaultButton.Button3://Focus button 3 + button3.Select(); + button3.ForeColor = Color.White; + button3.Font = new Font(button3.Font, FontStyle.Underline); + break; + } + } + private void SetIcon(MessageBoxIcon icon) + { + switch (icon) + { + case MessageBoxIcon.Error: //Error + this.pictureBoxIcon.Image = Properties.Resources.error; + PrimaryColor = Color.FromArgb(224, 79, 95); + this.btnClose.FlatAppearance.MouseOverBackColor = Color.Crimson; + break; + case MessageBoxIcon.Information: //Information + this.pictureBoxIcon.Image = Properties.Resources.information; + PrimaryColor = Color.FromArgb(38, 191, 166); + break; + case MessageBoxIcon.Question://Question + this.pictureBoxIcon.Image = Properties.Resources.question; + PrimaryColor = Color.FromArgb(10, 119, 232); + break; + case MessageBoxIcon.Exclamation://Exclamation + this.pictureBoxIcon.Image = Properties.Resources.exclamation; + PrimaryColor = Color.FromArgb(255, 140, 0); + break; + case MessageBoxIcon.None: //None + this.pictureBoxIcon.Image = Properties.Resources.chat; + PrimaryColor = Color.CornflowerBlue; + break; + } + } + + //-> Events Methods + private void btnClose_Click(object sender, EventArgs e) + { + this.Close(); + } + + #region -> Drag Form + [DllImport("user32.DLL", EntryPoint = "SendMessage")] + private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam); + [DllImport("user32.DLL", EntryPoint = "ReleaseCapture")] + private extern static void ReleaseCapture(); + private void panelTitleBar_MouseDown(object sender, MouseEventArgs e) + { + ReleaseCapture(); + SendMessage(this.Handle, 0x112, 0xf012, 0); + } + #endregion + } +} diff --git a/CMB/FormMessageBox.resx b/CMB/FormMessageBox.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/CMB/FormMessageBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CMB/NT-MessageBox.cs b/CMB/NT-MessageBox.cs new file mode 100644 index 0000000..434c602 --- /dev/null +++ b/CMB/NT-MessageBox.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using CMB; + +namespace CustomMessageBox +{ +public abstract class NT_MessageBox +{ + public static DialogResult Show(string text) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text)) + result = msgForm.ShowDialog(); + return result; + } + public static DialogResult Show(string text, string caption) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption)) + result = msgForm.ShowDialog(); + return result; + } + public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons)) + result = msgForm.ShowDialog(); + return result; + } + public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons, icon)) + result = msgForm.ShowDialog(); + return result; + } + public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons, icon, defaultButton)) + result = msgForm.ShowDialog(); + return result; + } + + /*-> IWin32Window Owner: + * Displays a message box in front of the specified object and with the other specified parameters. + * An implementation of IWin32Window that will own the modal dialog box.*/ + public static DialogResult Show(IWin32Window owner, string text) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text)) + result = msgForm.ShowDialog(owner); + return result; + } + public static DialogResult Show(IWin32Window owner, string text, string caption) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption)) + result = msgForm.ShowDialog(owner); + return result; + } + public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons)) + result = msgForm.ShowDialog(owner); + return result; + } + public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons, icon)) + result = msgForm.ShowDialog(owner); + return result; + } + public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) + { + DialogResult result; + using (var msgForm = new FormMessageBox(text, caption, buttons, icon, defaultButton)) + result = msgForm.ShowDialog(owner); + return result; + } +} +} diff --git a/CMB/Properties/Resources.Designer.cs b/CMB/Properties/Resources.Designer.cs new file mode 100644 index 0000000..47a3ddd --- /dev/null +++ b/CMB/Properties/Resources.Designer.cs @@ -0,0 +1,113 @@ +//------------------------------------------------------------------------------ +// +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 +// +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. +// +//------------------------------------------------------------------------------ + +namespace CMB.Properties { + using System; + + + /// + /// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc. + /// + // Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder + // através de uma ferramenta como ResGen ou Visual Studio. + // Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente + // com a opção /str, ou recrie o projeto do VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Retorna a instância de ResourceManager armazenada em cache usada por essa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CMB.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Substitui a propriedade CurrentUICulture do thread atual para todas as + /// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap chat { + get { + object obj = ResourceManager.GetObject("chat", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap exclamation { + get { + object obj = ResourceManager.GetObject("exclamation", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap information { + get { + object obj = ResourceManager.GetObject("information", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap question { + get { + object obj = ResourceManager.GetObject("question", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CMB/Properties/Resources.resx b/CMB/Properties/Resources.resx new file mode 100644 index 0000000..63aee44 --- /dev/null +++ b/CMB/Properties/Resources.resx @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\chat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\exclamation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CMB/Resources/chat.png b/CMB/Resources/chat.png new file mode 100644 index 0000000..060339f Binary files /dev/null and b/CMB/Resources/chat.png differ diff --git a/CMB/Resources/error.png b/CMB/Resources/error.png new file mode 100644 index 0000000..e06bd2c Binary files /dev/null and b/CMB/Resources/error.png differ diff --git a/CMB/Resources/exclamation.png b/CMB/Resources/exclamation.png new file mode 100644 index 0000000..04edd8e Binary files /dev/null and b/CMB/Resources/exclamation.png differ diff --git a/CMB/Resources/information.png b/CMB/Resources/information.png new file mode 100644 index 0000000..321e192 Binary files /dev/null and b/CMB/Resources/information.png differ diff --git a/CMB/Resources/question.png b/CMB/Resources/question.png new file mode 100644 index 0000000..f2b0a76 Binary files /dev/null and b/CMB/Resources/question.png differ diff --git a/CPM/Buttons/LV-BUTTON.cs b/CPM/Buttons/LV-BUTTON.cs new file mode 100644 index 0000000..ba67d8e --- /dev/null +++ b/CPM/Buttons/LV-BUTTON.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using System.Windows.Forms; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.ComponentModel; + +namespace CPM +{ + public class LV_BUTTON : Button + { + //Fields + private int borderSize = 0; + private int borderRadius = 0; + private Color borderColor = Color.PaleVioletRed; + private Color hoverColor = Color.LightBlue; + private Color clickColor = Color.DarkBlue; + + [Category("Levelcode")] + public Color HoverColor + { + get { return hoverColor; } + set { hoverColor = value; } + } + + [Category("Levelcode")] + public Color ClickColor + { + get { return clickColor; } + set { clickColor = value; } + } + //Properties + [Category("Levelcode")] + public int BorderSize + { + get { return borderSize; } + set + { + borderSize = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public int BorderRadius + { + get { return borderRadius; } + set + { + borderRadius = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color BorderColor + { + get { return borderColor; } + set + { + borderColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color BackgroundColor + { + get { return this.BackColor; } + set { this.BackColor = value; } + } + + [Category("Levelcode")] + public Color TextColor + { + get { return this.ForeColor; } + set { this.ForeColor = value; } + } + + //Constructor + public LV_BUTTON() + { + this.FlatStyle = FlatStyle.Flat; + this.FlatAppearance.BorderSize = 0; + this.Size = new Size(150, 40); + this.BackColor = Color.MediumSlateBlue; + this.ForeColor = Color.White; + this.Resize += new EventHandler(Button_Resize); + this.MouseEnter += (s, e) => this.BackColor = hoverColor; + this.MouseLeave += (s, e) => this.BackColor = BackgroundColor; + this.MouseDown += (s, e) => this.BackColor = clickColor; + this.MouseUp += (s, e) => this.BackColor = hoverColor; + } + + //Methods + private GraphicsPath GetFigurePath(Rectangle rect, int radius) + { + GraphicsPath path = new GraphicsPath(); + float curveSize = radius * 2F; + + path.StartFigure(); + path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90); + path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90); + path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90); + path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90); + path.CloseFigure(); + return path; + } + + protected override void OnPaint(PaintEventArgs pevent) + { + base.OnPaint(pevent); + + + Rectangle rectSurface = this.ClientRectangle; + Rectangle rectBorder = Rectangle.Inflate(rectSurface, -borderSize, -borderSize); + int smoothSize = 2; + if (borderSize > 0) + smoothSize = borderSize; + + if (borderRadius > 2) //Rounded button + { + using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius)) + using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius - borderSize)) + using (Pen penSurface = new Pen(this.Parent.BackColor, smoothSize)) + using (Pen penBorder = new Pen(borderColor, borderSize)) + { + pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + //Button surface + this.Region = new Region(pathSurface); + //Draw surface border for HD result + pevent.Graphics.DrawPath(penSurface, pathSurface); + + //Button border + if (borderSize >= 1) + //Draw control border + pevent.Graphics.DrawPath(penBorder, pathBorder); + } + } + else //Normal button + { + pevent.Graphics.SmoothingMode = SmoothingMode.None; + //Button surface + this.Region = new Region(rectSurface); + //Button border + if (borderSize >= 1) + { + using (Pen penBorder = new Pen(borderColor, borderSize)) + { + penBorder.Alignment = PenAlignment.Inset; + pevent.Graphics.DrawRectangle(penBorder, 0, 0, this.Width - 1, this.Height - 1); + } + } + } + } + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + this.Parent.BackColorChanged += new EventHandler(Container_BackColorChanged); + } + + private void Container_BackColorChanged(object sender, EventArgs e) + { + this.Invalidate(); + } + private void Button_Resize(object sender, EventArgs e) + { + if (borderRadius > this.Height) + borderRadius = this.Height; + } + } + +} diff --git a/CPM/CPM.csproj b/CPM/CPM.csproj new file mode 100644 index 0000000..19d9643 --- /dev/null +++ b/CPM/CPM.csproj @@ -0,0 +1,36 @@ + + + + net8.0-windows + true + enable + disable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CPM/ComboBox/LV-COMBOBOXCUSTOM.cs b/CPM/ComboBox/LV-COMBOBOXCUSTOM.cs new file mode 100644 index 0000000..7e51de1 --- /dev/null +++ b/CPM/ComboBox/LV-COMBOBOXCUSTOM.cs @@ -0,0 +1,347 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Design; +using System.Windows.Forms; + +namespace CPM +{ + [ToolboxItem(true)] + public class LV_COMBOBOXCUSTOM : UserControl + { + // Fields + private Color backColor = Color.WhiteSmoke; + private Color iconColor = Color.MediumSlateBlue; + private Color listBackColor = Color.FromArgb(230, 228, 245); + private Color listTextColor = Color.DimGray; + private Color borderColor = Color.MediumSlateBlue; + private int borderSize = 1; + + // Components + private ComboBox cmbList; + private Label lblText; + private Button btnIcon; + + // Events + public event EventHandler OnSelectedIndexChanged; + + public LV_COMBOBOXCUSTOM() + { + cmbList = new ComboBox(); + lblText = new Label(); + btnIcon = new Button(); + + this.SuspendLayout(); + + // ComboBox + cmbList.BackColor = listBackColor; + cmbList.Font = new Font(this.Font.Name, 10F); + cmbList.ForeColor = listTextColor; + cmbList.SelectedIndexChanged += ComboBox_SelectedIndexChanged; + cmbList.TextChanged += ComboBox_TextChanged; + + // Button (icon) + btnIcon.Dock = DockStyle.Right; + btnIcon.FlatStyle = FlatStyle.Flat; + btnIcon.FlatAppearance.BorderSize = 0; + btnIcon.BackColor = backColor; + btnIcon.Size = new Size(30, 30); + btnIcon.Cursor = Cursors.Hand; + btnIcon.Click += Icon_Click; + btnIcon.Paint += Icon_Paint; + + // Label (text) + lblText.Dock = DockStyle.Fill; + lblText.AutoSize = false; + lblText.BackColor = backColor; + lblText.TextAlign = ContentAlignment.MiddleLeft; + lblText.Padding = new Padding(8, 0, 0, 0); + lblText.Font = new Font(this.Font.Name, 10F); + lblText.Click += Surface_Click; + lblText.MouseEnter += Surface_MouseEnter; + lblText.MouseLeave += Surface_MouseLeave; + + // Add controls + this.Controls.Add(lblText); + this.Controls.Add(btnIcon); + this.Controls.Add(cmbList); + + // UserControl properties + this.MinimumSize = new Size(200, 30); + this.Size = new Size(200, 30); + this.ForeColor = Color.DimGray; + this.Padding = new Padding(borderSize); + base.BackColor = borderColor; + + this.ResumeLayout(); + AdjustComboBoxDimensions(); + } + // Properties + [Category("Levelcode")] + public new Color BackColor + { + get => backColor; + set + { + backColor = value; + lblText.BackColor = backColor; + btnIcon.BackColor = backColor; + } + } + + [Category("Levelcode")] + public Color IconColor + { + get => iconColor; + set + { + iconColor = value; + btnIcon.Invalidate(); + } + } + + [Category("Levelcode")] + public Color ListBackColor + { + get => listBackColor; + set + { + listBackColor = value; + cmbList.BackColor = listBackColor; + } + } + + [Category("Levelcode")] + public Color ListTextColor + { + get => listTextColor; + set + { + listTextColor = value; + cmbList.ForeColor = listTextColor; + } + } + + [Category("Levelcode")] + public Color BorderColor + { + get => borderColor; + set + { + borderColor = value; + base.BackColor = borderColor; + } + } + + [Category("Levelcode")] + public int BorderSize + { + get => borderSize; + set + { + borderSize = value; + this.Padding = new Padding(borderSize); + AdjustComboBoxDimensions(); + } + } + + [Category("Levelcode")] + public override Color ForeColor + { + get => base.ForeColor; + set + { + base.ForeColor = value; + lblText.ForeColor = value; + } + } + + [Category("Levelcode")] + public override Font Font + { + get => base.Font; + set + { + base.Font = value; + lblText.Font = value; + cmbList.Font = value; + } + } + + [Category("Levelcode")] + public string Texts + { + get => lblText.Text; + set => lblText.Text = value; + } + + [Category("Levelcode")] + public ComboBoxStyle DropDownStyle + { + get => cmbList.DropDownStyle; + set + { + if (value != ComboBoxStyle.Simple) + cmbList.DropDownStyle = value; + } + } + + [Category("Levelcode - Data")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + [Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] + [Localizable(true)] + public ComboBox.ObjectCollection Items => cmbList.Items; + + [Category("Levelcode - Data")] + [AttributeProvider(typeof(IListSource))] + [DefaultValue(null)] + public object DataSource + { + get => cmbList.DataSource; + set => cmbList.DataSource = value; + } + + [Category("Levelcode - Data")] + [Browsable(true)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + [Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] + [EditorBrowsable(EditorBrowsableState.Always)] + [Localizable(true)] + public AutoCompleteStringCollection AutoCompleteCustomSource + { + get => cmbList.AutoCompleteCustomSource; + set => cmbList.AutoCompleteCustomSource = value; + } + + [Category("Levelcode - Data")] + [Browsable(true)] + [DefaultValue(AutoCompleteSource.None)] + [EditorBrowsable(EditorBrowsableState.Always)] + public AutoCompleteSource AutoCompleteSource + { + get => cmbList.AutoCompleteSource; + set => cmbList.AutoCompleteSource = value; + } + + [Category("Levelcode - Data")] + [Browsable(true)] + [DefaultValue(AutoCompleteMode.None)] + [EditorBrowsable(EditorBrowsableState.Always)] + public AutoCompleteMode AutoCompleteMode + { + get => cmbList.AutoCompleteMode; + set => cmbList.AutoCompleteMode = value; + } + + [Category("Levelcode - Data")] + [Bindable(true)] + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public object SelectedItem + { + get => cmbList.SelectedItem; + set => cmbList.SelectedItem = value; + } + + [Category("Levelcode - Data")] + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectedIndex + { + get => cmbList.SelectedIndex; + set => cmbList.SelectedIndex = value; + } + + [Category("Levelcode - Data")] + [DefaultValue("")] + [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] + [TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string DisplayMember + { + get => cmbList.DisplayMember; + set => cmbList.DisplayMember = value; + } + + [Category("Levelcode - Data")] + [DefaultValue("")] + [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] + public string ValueMember + { + get => cmbList.ValueMember; + set => cmbList.ValueMember = value; + } + + [Category("Levelcode - Data")] + [Browsable(true)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public object SelectedValue + { + get => cmbList.SelectedValue; + set => cmbList.SelectedValue = value; + } + + // Private methods + private void AdjustComboBoxDimensions() + { + cmbList.Width = Math.Max(lblText.Width, 0); + cmbList.Location = new Point( + this.Padding.Left, + lblText.Bottom - cmbList.Height + ); + } + + // Events + private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + lblText.Text = cmbList.Text; + OnSelectedIndexChanged?.Invoke(this, e); + } + + private void ComboBox_TextChanged(object sender, EventArgs e) + { + lblText.Text = cmbList.Text; + } + + private void Icon_Paint(object sender, PaintEventArgs e) + { + int iconWidth = 14; + int iconHeight = 6; + var rectIcon = new Rectangle((btnIcon.Width - iconWidth) / 2, (btnIcon.Height - iconHeight) / 2, iconWidth, iconHeight); + Graphics graph = e.Graphics; + + using (GraphicsPath path = new GraphicsPath()) + using (Pen pen = new Pen(iconColor, 2)) + { + graph.SmoothingMode = SmoothingMode.AntiAlias; + path.AddLine(rectIcon.X, rectIcon.Y, rectIcon.X + (iconWidth / 2), rectIcon.Bottom); + path.AddLine(rectIcon.X + (iconWidth / 2), rectIcon.Bottom, rectIcon.Right, rectIcon.Y); + graph.DrawPath(pen, path); + } + } + + private void Icon_Click(object sender, EventArgs e) + { + cmbList.Select(); + cmbList.DroppedDown = true; + } + + private void Surface_Click(object sender, EventArgs e) + { + this.OnClick(e); + cmbList.Select(); + if (cmbList.DropDownStyle == ComboBoxStyle.DropDownList) + cmbList.DroppedDown = true; + } + + private void Surface_MouseEnter(object sender, EventArgs e) => this.OnMouseEnter(e); + private void Surface_MouseLeave(object sender, EventArgs e) => this.OnMouseLeave(e); + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + AdjustComboBoxDimensions(); + } + } + +} diff --git a/CPM/Datetimepicker/LV-DATETIMEPICKER.cs b/CPM/Datetimepicker/LV-DATETIMEPICKER.cs new file mode 100644 index 0000000..5279481 --- /dev/null +++ b/CPM/Datetimepicker/LV-DATETIMEPICKER.cs @@ -0,0 +1,164 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Reflection; +using System.Windows.Forms; +using System.ComponentModel; + +namespace CPM.Datetimepicker +{ + [ToolboxItem(true)] + public class LV_DATETIMEPICKER : DateTimePicker + { + // Aparência + private Color skinColor = Color.MediumSlateBlue; + private Color textColor = Color.White; + private Color borderColor = Color.PaleVioletRed; + private int borderSize = 0; + + // Auxiliares + private bool droppedDown = false; + private Image calendarIcon; + private RectangleF iconButtonArea; + private const int calendarIconWidth = 34; + private const int arrowIconWidth = 17; + + public LV_DATETIMEPICKER() + { + SetStyle(ControlStyles.UserPaint, true); + MinimumSize = new Size(0, 35); + Font = new Font(Font.Name, 9.5F); + + calendarIcon = + LoadEmbeddedImage("Imagens.calendarWhite.png") + ?? SystemIcons.Information.ToBitmap(); + } + + // 🔹 Propriedades públicas + public Color SkinColor + { + get => skinColor; + set + { + skinColor = value; + + // Troca automática de ícone conforme o fundo + calendarIcon = + skinColor.GetBrightness() >= 0.6F + ? LoadEmbeddedImage("Imagens.calendarDark.png") + : LoadEmbeddedImage("Imagens.calendarWhite.png") + ?? SystemIcons.Information.ToBitmap(); + + Invalidate(); + } + } + + public Color TextColor + { + get => textColor; + set { textColor = value; Invalidate(); } + } + + public Color BorderColor + { + get => borderColor; + set { borderColor = value; Invalidate(); } + } + + public int BorderSize + { + get => borderSize; + set { borderSize = value; Invalidate(); } + } + + // 🔹 Eventos + protected override void OnDropDown(EventArgs e) + { + base.OnDropDown(e); + droppedDown = true; + Invalidate(); + } + + protected override void OnCloseUp(EventArgs e) + { + base.OnCloseUp(e); + droppedDown = false; + Invalidate(); + } + + protected override void OnKeyPress(KeyPressEventArgs e) + { + base.OnKeyPress(e); + e.Handled = true; + } + + protected override void OnPaint(PaintEventArgs e) + { + Graphics g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + + using var penBorder = new Pen(borderColor, borderSize) { Alignment = PenAlignment.Inset }; + using var skinBrush = new SolidBrush(skinColor); + using var textBrush = new SolidBrush(textColor); + using var openBrush = new SolidBrush(Color.FromArgb(50, 64, 64, 64)); + using var format = new StringFormat { LineAlignment = StringAlignment.Center }; + + RectangleF client = new RectangleF(0, 0, Width - 0.5F, Height - 0.5F); + RectangleF iconArea = new RectangleF(client.Width - calendarIconWidth, 0, calendarIconWidth, client.Height); + + // Fundo + g.FillRectangle(skinBrush, client); + + // Texto + g.DrawString(" " + Text, Font, textBrush, client, format); + + // Ícone + if (calendarIcon != null) + { + g.DrawImage(calendarIcon, + Width - calendarIcon.Width - 9, + (Height - calendarIcon.Height) / 2); + } + + // Destaque quando aberto + if (droppedDown) + g.FillRectangle(openBrush, iconArea); + + // Borda + if (borderSize > 0) + g.DrawRectangle(penBorder, client.X, client.Y, client.Width, client.Height); + } + + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + + int iconWidth = GetIconButtonWidth(); + iconButtonArea = new RectangleF(Width - iconWidth, 0, iconWidth, Height); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + Cursor = iconButtonArea.Contains(e.Location) ? Cursors.Hand : Cursors.Default; + } + + // 🔹 Métodos privados + private int GetIconButtonWidth() + { + int textWidth = TextRenderer.MeasureText(Text, Font).Width; + return textWidth <= Width - (calendarIconWidth + 20) + ? calendarIconWidth + : arrowIconWidth; + } + + private Image LoadEmbeddedImage(string relativePath) + { + var asm = Assembly.GetExecutingAssembly(); + var resourceName = $"{asm.GetName().Name}.{relativePath}"; + + using var stream = asm.GetManifestResourceStream(resourceName); + return stream != null ? Image.FromStream(stream) : null; + } + } +} diff --git a/CPM/DropdownMenu/LV-DROPDOWNMENU.cs b/CPM/DropdownMenu/LV-DROPDOWNMENU.cs new file mode 100644 index 0000000..19e5f59 --- /dev/null +++ b/CPM/DropdownMenu/LV-DROPDOWNMENU.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CPM.DropdownMenu +{ + public class LV_DROPDOWNMENU : ContextMenuStrip + { + //Fields + private bool isMainMenu; + private int menuItemHeight = 25; + private Color menuItemTextColor = Color.Empty;//No color, The default color is set in the MenuRenderer class + private Color primaryColor = Color.Empty;//No color, The default color is set in the MenuRenderer class + private Bitmap menuItemHeaderSize; + + public LV_DROPDOWNMENU(IContainer container) + : base(container) + { + + } + //Properties + //Optionally, hide the properties in the toolbox to avoid the problem of displaying and/or + //saving control property changes in the designer at design time in Visual Studio. + //If the problem I mention does not occur you can expose the properties and manipulate them from the toolbox. + [Browsable(false)] + public bool IsMainMenu + { + get { return isMainMenu; } + set { isMainMenu = value; } + } + [Browsable(false)] + public int MenuItemHeight + { + get { return menuItemHeight; } + set { menuItemHeight = value; } + } + [Browsable(false)] + public Color MenuItemTextColor + { + get { return menuItemTextColor; } + set { menuItemTextColor = value; } + } + [Browsable(false)] + public Color PrimaryColor + { + get { return primaryColor; } + set { primaryColor = value; } + } + //Private methods + private void LoadMenuItemHeight() + { + if (isMainMenu) + menuItemHeaderSize = new Bitmap(25, 45); + else menuItemHeaderSize = new Bitmap(20, menuItemHeight); + foreach (ToolStripMenuItem menuItemL1 in this.Items) + { + menuItemL1.ImageScaling = ToolStripItemImageScaling.None; + if (menuItemL1.Image == null) menuItemL1.Image = menuItemHeaderSize; + foreach (ToolStripMenuItem menuItemL2 in menuItemL1.DropDownItems) + { + menuItemL2.ImageScaling = ToolStripItemImageScaling.None; + if (menuItemL2.Image == null) menuItemL2.Image = menuItemHeaderSize; + foreach (ToolStripMenuItem menuItemL3 in menuItemL2.DropDownItems) + { + menuItemL3.ImageScaling = ToolStripItemImageScaling.None; + if (menuItemL3.Image == null) menuItemL3.Image = menuItemHeaderSize; + foreach (ToolStripMenuItem menuItemL4 in menuItemL3.DropDownItems) + { + menuItemL4.ImageScaling = ToolStripItemImageScaling.None; + if (menuItemL4.Image == null) menuItemL4.Image = menuItemHeaderSize; + ///Level 5++ + } + } + } + } + } + //Overrides + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + if (this.DesignMode == false) + { + this.Renderer = new LV_MENURENDERER(isMainMenu, primaryColor, menuItemTextColor); + LoadMenuItemHeight(); + } + } + + } +} diff --git a/CPM/DropdownMenu/LV-MENUCOLORTABLE.cs b/CPM/DropdownMenu/LV-MENUCOLORTABLE.cs new file mode 100644 index 0000000..3690b00 --- /dev/null +++ b/CPM/DropdownMenu/LV-MENUCOLORTABLE.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CPM.DropdownMenu +{ + public class LV_MENUCOLORTABLE : ProfessionalColorTable + { + //Fields + private Color backColor; + private Color leftColumnColor; + private Color borderColor; + private Color menuItemBorderColor; + private Color menuItemSelectedColor; + + public LV_MENUCOLORTABLE(bool isMainMenu, Color primaryColor) + { + if (isMainMenu) + { + backColor = Color.MediumPurple; + leftColumnColor = Color.Transparent; + borderColor = Color.FromArgb(32, 33, 51); + menuItemBorderColor = primaryColor; + menuItemSelectedColor = primaryColor; + } + else + { + backColor = Color.White; + leftColumnColor = Color.LightGray; + borderColor = Color.LightGray; + menuItemBorderColor = primaryColor; + menuItemSelectedColor = primaryColor; + } + } + //Overrides + public override Color ToolStripDropDownBackground { get { return backColor; } } + public override Color MenuBorder { get { return borderColor; } } + public override Color MenuItemBorder { get { return menuItemBorderColor; } } + public override Color MenuItemSelected { get { return menuItemSelectedColor; } } + public override Color ImageMarginGradientBegin { get { return leftColumnColor; } } + public override Color ImageMarginGradientMiddle { get { return leftColumnColor; } } + public override Color ImageMarginGradientEnd { get { return leftColumnColor; } } + + } +} diff --git a/CPM/DropdownMenu/LV-MENURENDERER.cs b/CPM/DropdownMenu/LV-MENURENDERER.cs new file mode 100644 index 0000000..b5b8cec --- /dev/null +++ b/CPM/DropdownMenu/LV-MENURENDERER.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CPM.DropdownMenu +{ + public class LV_MENURENDERER : ToolStripProfessionalRenderer + { + //Fields + private Color primaryColor; + private Color textColor; + private int arrowThickness; + //Constructor + public LV_MENURENDERER(bool isMainMenu, Color primaryColor, Color textColor) + : base(new LV_MENUCOLORTABLE(isMainMenu, primaryColor)) + { + this.primaryColor = primaryColor; + if (isMainMenu) + { + arrowThickness = 3; + if (textColor == Color.Empty) //Set Default Color + this.textColor = Color.Gainsboro; + else//Set custom text color + this.textColor = textColor; + } + else + { + arrowThickness = 2; + if (textColor == Color.Empty) //Set Default Color + this.textColor = Color.DimGray; + else//Set custom text color + this.textColor = textColor; + } + } + //Overrides + protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) + { + base.OnRenderItemText(e); + e.Item.ForeColor = e.Item.Selected ? Color.White : textColor; + } + protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) + { + //Fields + var graph = e.Graphics; + var arrowSize = new Size(5, 12); + var arrowColor = e.Item.Selected ? Color.White : primaryColor; + var rect = new Rectangle(e.ArrowRectangle.Location.X, (e.ArrowRectangle.Height - arrowSize.Height) / 2, + arrowSize.Width, arrowSize.Height); + using (GraphicsPath path = new GraphicsPath()) + using (Pen pen = new Pen(arrowColor, arrowThickness)) + { + //Drawing + graph.SmoothingMode = SmoothingMode.AntiAlias; + path.AddLine(rect.Left, rect.Top, rect.Right, rect.Top + rect.Height / 2); + path.AddLine(rect.Right, rect.Top + rect.Height / 2, rect.Left, rect.Top + rect.Height); + graph.DrawPath(pen, path); + } + }//end onrender + } + +} diff --git a/CPM/Imagens/calendarDark.png b/CPM/Imagens/calendarDark.png new file mode 100644 index 0000000..c93a061 Binary files /dev/null and b/CPM/Imagens/calendarDark.png differ diff --git a/CPM/Imagens/calendarWhite.png b/CPM/Imagens/calendarWhite.png new file mode 100644 index 0000000..668b051 Binary files /dev/null and b/CPM/Imagens/calendarWhite.png differ diff --git a/CPM/Imagens/chat.png b/CPM/Imagens/chat.png new file mode 100644 index 0000000..060339f Binary files /dev/null and b/CPM/Imagens/chat.png differ diff --git a/CPM/Imagens/error.png b/CPM/Imagens/error.png new file mode 100644 index 0000000..e06bd2c Binary files /dev/null and b/CPM/Imagens/error.png differ diff --git a/CPM/Imagens/exclamation.png b/CPM/Imagens/exclamation.png new file mode 100644 index 0000000..04edd8e Binary files /dev/null and b/CPM/Imagens/exclamation.png differ diff --git a/CPM/Imagens/information.png b/CPM/Imagens/information.png new file mode 100644 index 0000000..321e192 Binary files /dev/null and b/CPM/Imagens/information.png differ diff --git a/CPM/Imagens/question.png b/CPM/Imagens/question.png new file mode 100644 index 0000000..f2b0a76 Binary files /dev/null and b/CPM/Imagens/question.png differ diff --git a/CPM/MasktedTextbox/LV-MaskTextboxCustom.cs b/CPM/MasktedTextbox/LV-MaskTextboxCustom.cs new file mode 100644 index 0000000..9cdf5eb --- /dev/null +++ b/CPM/MasktedTextbox/LV-MaskTextboxCustom.cs @@ -0,0 +1,322 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ControllsCustom.NT_MASKTEXTBOX +{ + public partial class LV_MASKTEDTEXTBOX : UserControl + { + private Color borderColor = Color.MediumSlateBlue; + private Color borderFocusColor = Color.HotPink; + private int borderSize = 2; + private bool underlinedStyle = false; + private bool isFocused = false; + private int borderRadius = 0; + private Color placeholderColor = Color.DarkGray; + private string placeholderText = ""; + private bool isPlaceholder = false; + public LV_MASKTEDTEXTBOX() + { + InitializeComponent(); + SetPlaceholder(); + } + [Category("levelcode")] + public Color BorderColor + { + get { return borderColor; } + set + { + borderColor = value; + this.Invalidate(); + } + } + + [Category("levelcode")] + public Color BorderFocusColor + { + get { return borderFocusColor; } + set { borderFocusColor = value; } + } + + [Category("levelcode")] + public int BorderSize + { + get { return borderSize; } + set + { + if (value >= 1) + { + borderSize = value; + this.Invalidate(); + } + } + } + + [Category("levelcode")] + public bool UnderlinedStyle + { + get { return underlinedStyle; } + set + { + underlinedStyle = value; + this.Invalidate(); + } + } + + [Category("levelcode")] + public override Color BackColor + { + get { return base.BackColor; } + set + { + base.BackColor = value; + maskedTextBox1.BackColor = value; + } + } + + [Category("levelcode")] + public override Color ForeColor + { + get { return base.ForeColor; } + set + { + base.ForeColor = value; + maskedTextBox1.ForeColor = value; + } + } + + [Category("levelcode")] + public override Font Font + { + get { return base.Font; } + set + { + base.Font = value; + maskedTextBox1.Font = value; + if (this.DesignMode) + UpdateControlHeight(); + } + } + + [Category("levelcode")] + public string Texts + { + get + { + if (isPlaceholder) return ""; + else return maskedTextBox1.Text; + } + set + { + maskedTextBox1.Text = value; + SetPlaceholder(); + } + } + + [Category("levelcode")] + public int BorderRadius + { + get { return borderRadius; } + set + { + if (value >= 0) + { + borderRadius = value; + this.Invalidate();//Redraw control + } + } + } + + [Category("levelcode")] + public Color PlaceholderColor + { + get { return placeholderColor; } + set + { + placeholderColor = value; + if (isPlaceholder) + maskedTextBox1.ForeColor = value; + } + } + + [Category("levelcode")] + public string PlaceholderText + { + get { return placeholderText; } + set + { + placeholderText = value; + maskedTextBox1.Text = ""; + SetPlaceholder(); + } + } + [Category("levelcode")] + public string Mask + { + get { return maskedTextBox1.Mask; } + set { maskedTextBox1.Mask = value; } + } + + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + if (this.DesignMode) + UpdateControlHeight(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + UpdateControlHeight(); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + Graphics graph = e.Graphics; + + if (borderRadius > 1)//Rounded MaskedTextBox + { + var rectBorderSmooth = this.ClientRectangle; + var rectBorder = Rectangle.Inflate(rectBorderSmooth, -borderSize, -borderSize); + int smoothSize = borderSize > 0 ? borderSize : 1; + + using (GraphicsPath pathBorderSmooth = GetFigurePath(rectBorderSmooth, borderRadius)) + using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius - borderSize)) + using (Pen penBorderSmooth = new Pen(this.Parent.BackColor, smoothSize)) + using (Pen penBorder = new Pen(borderColor, borderSize)) + { + this.Region = new Region(pathBorderSmooth);//Set the rounded region of UserControl + if (borderRadius > 15) SetMaskedTextBoxRoundedRegion();//Set the rounded region of MaskedTextBox component + graph.SmoothingMode = SmoothingMode.AntiAlias; + penBorder.Alignment = PenAlignment.Center; + if (isFocused) penBorder.Color = borderFocusColor; + + if (underlinedStyle) //Line Style + { + graph.DrawPath(penBorderSmooth, pathBorderSmooth); + graph.SmoothingMode = SmoothingMode.None; + graph.DrawLine(penBorder, 0, this.Height - 1, this.Width, this.Height - 1); + } + else //Normal Style + { + graph.DrawPath(penBorderSmooth, pathBorderSmooth); + graph.DrawPath(penBorder, pathBorder); + } + } + } + else //Square/Normal MaskedTextBox + { + using (Pen penBorder = new Pen(borderColor, borderSize)) + { + this.Region = new Region(this.ClientRectangle); + penBorder.Alignment = PenAlignment.Inset; + if (isFocused) penBorder.Color = borderFocusColor; + + if (underlinedStyle) //Line Style + graph.DrawLine(penBorder, 0, this.Height - 1, this.Width, this.Height - 1); + else //Normal Style + graph.DrawRectangle(penBorder, 0, 0, this.Width - 0.5F, this.Height - 0.5F); + } + } + } + + private void SetPlaceholder() + { + if (string.IsNullOrWhiteSpace(maskedTextBox1.Text) && placeholderText != "") + { + isPlaceholder = true; + maskedTextBox1.Text = placeholderText; + maskedTextBox1.ForeColor = placeholderColor; + } + } + + private void RemovePlaceholder() + { + if (isPlaceholder && placeholderText != "") + { + isPlaceholder = false; + maskedTextBox1.Text = ""; + maskedTextBox1.ForeColor = this.ForeColor; + } + } + + private GraphicsPath GetFigurePath(Rectangle rect, int radius) + { + GraphicsPath path = new GraphicsPath(); + float curveSize = radius * 2F; + + path.StartFigure(); + path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90); + path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90); + path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90); + path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90); + path.CloseFigure(); + return path; + } + + private void SetMaskedTextBoxRoundedRegion() + { + GraphicsPath pathTxt; + if (maskedTextBox1.Multiline) + { + pathTxt = GetFigurePath(maskedTextBox1.ClientRectangle, borderRadius - borderSize); + maskedTextBox1.Region = new Region(pathTxt); + } + else + { + pathTxt = GetFigurePath(maskedTextBox1.ClientRectangle, borderSize * 2); + maskedTextBox1.Region = new Region(pathTxt); + } + pathTxt.Dispose(); + } + + private void UpdateControlHeight() + { + if (!maskedTextBox1.Multiline) + { + int txtHeight = TextRenderer.MeasureText("Text", this.Font).Height + 1; + maskedTextBox1.Multiline = true; + maskedTextBox1.MinimumSize = new Size(0, txtHeight); + maskedTextBox1.Multiline = false; + + this.Height = maskedTextBox1.Height + this.Padding.Top + this.Padding.Bottom; + } + } + + private void maskedTextBox1_Enter(object sender, EventArgs e) + { + isFocused = true; + this.Invalidate(); + RemovePlaceholder(); + } + + private void maskedTextBox1_Leave(object sender, EventArgs e) + { + isFocused = false; + this.Invalidate(); + SetPlaceholder(); + } + + private void maskedTextBox1_TextChanged(object sender, EventArgs e) + { + if (isPlaceholder) + { + maskedTextBox1.ForeColor = placeholderColor; + } + else + { + maskedTextBox1.ForeColor = this.ForeColor; + } + } + + } +} diff --git a/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.Designer.cs b/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.Designer.cs new file mode 100644 index 0000000..a0cdc6d --- /dev/null +++ b/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.Designer.cs @@ -0,0 +1,62 @@ +namespace ControllsCustom.NT_MASKTEXTBOX +{ + partial class LV_MASKTEDTEXTBOX + { + /// + /// Variável de designer necessária. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpar os recursos que estão sendo usados. + /// + /// true se for necessário descartar os recursos gerenciados; caso contrário, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código gerado pelo Designer de Componentes + + /// + /// Método necessário para suporte ao Designer - não modifique + /// o conteúdo deste método com o editor de código. + /// + private void InitializeComponent() + { + this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox(); + this.SuspendLayout(); + // + // maskedTextBox1 + // + this.maskedTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.maskedTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.maskedTextBox1.Location = new System.Drawing.Point(7, 7); + this.maskedTextBox1.Name = "maskedTextBox1"; + this.maskedTextBox1.Size = new System.Drawing.Size(236, 13); + this.maskedTextBox1.TabIndex = 0; + // + // NT_MASKTEDTEXTBOX + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.maskedTextBox1); + this.Margin = new System.Windows.Forms.Padding(4); + this.Name = "NT_MASKTEDTEXTBOX"; + this.Padding = new System.Windows.Forms.Padding(7); + this.Size = new System.Drawing.Size(250, 30); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MaskedTextBox maskedTextBox1; + } +} diff --git a/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.resx b/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CPM/Monthcalendar/LV-MonthCalendar.cs b/CPM/Monthcalendar/LV-MonthCalendar.cs new file mode 100644 index 0000000..f9a48a7 --- /dev/null +++ b/CPM/Monthcalendar/LV-MonthCalendar.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CPM.Monthcalendar +{ + public class LV_MonthCalendar : MonthCalendar + { + // Fields for appearance + private Color titleBackColor = Color.MediumSlateBlue; + private Color titleForeColor = Color.White; + private Color dayForeColor = Color.Black; + private Color borderColor = Color.PaleVioletRed; + private int borderSize = 2; + + // Properties + public Color TitleBackColor + { + get { return titleBackColor; } + set { titleBackColor = value; this.Invalidate(); } + } + + public Color TitleForeColor + { + get { return titleForeColor; } + set { titleForeColor = value; this.Invalidate(); } + } + + public Color DayForeColor + { + get { return dayForeColor; } + set { dayForeColor = value; this.Invalidate(); } + } + + public Color BorderColor + { + get { return borderColor; } + set { borderColor = value; this.Invalidate(); } + } + + public int BorderSize + { + get { return borderSize; } + set { borderSize = value; this.Invalidate(); } + } + + public LV_MonthCalendar() + { + // Customizations on creation + this.TitleBackColor = titleBackColor; + this.TitleForeColor = titleForeColor; + this.ForeColor = dayForeColor; + this.Font = new Font("Arial", 10F, FontStyle.Regular); + } + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + // Drawing custom border + using (Pen borderPen = new Pen(borderColor, borderSize)) + { + e.Graphics.DrawRectangle(borderPen, this.ClientRectangle.X, this.ClientRectangle.Y, + this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1); + } + } + + // Example method to adjust title colors dynamically + protected override void OnDateChanged(DateRangeEventArgs e) + { + base.OnDateChanged(e); + this.TitleBackColor = Color.FromArgb(100, 150, 200); // Dynamic title color change + } + } +} diff --git a/CPM/PictureBar/LV-CIRCULARBARPICTUREBOX.cs b/CPM/PictureBar/LV-CIRCULARBARPICTUREBOX.cs new file mode 100644 index 0000000..96a0921 --- /dev/null +++ b/CPM/PictureBar/LV-CIRCULARBARPICTUREBOX.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPM.PictureBar +{ + public class LV_CIRCULARBARPICTUREBOX : PictureBox + { + private int borderSize = 2; + private Color borderColor = Color.RoyalBlue; + private Color borderColor2 = Color.HotPink; + private DashStyle borderLineStyle = DashStyle.Solid; + private DashCap borderCapStyle = DashCap.Flat; + private float gradientAngle = 50F; + + public LV_CIRCULARBARPICTUREBOX() + { + this.Size = new Size(100, 100); + this.SizeMode = PictureBoxSizeMode.StretchImage; + } + //Properties + [Category("Levelcode")] + public int BorderSize + { + get { return borderSize; } + set + { + borderSize = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color BorderColor + { + get { return borderColor; } + set + { + borderColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color BorderColor2 + { + get { return borderColor2; } + set + { + borderColor2 = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public DashStyle BorderLineStyle + { + get { return borderLineStyle; } + set + { + borderLineStyle = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public DashCap BorderCapStyle + { + get { return borderCapStyle; } + set + { + borderCapStyle = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public float GradientAngle + { + get { return gradientAngle; } + set + { + gradientAngle = value; + this.Invalidate(); + } + } + + //Overridden methods + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + this.Size = new Size(this.Width, this.Width); + } + + protected override void OnPaint(PaintEventArgs pe) + { + base.OnPaint(pe); + //Fields + var graph = pe.Graphics; + var rectContourSmooth = Rectangle.Inflate(this.ClientRectangle, -1, -1); + var rectBorder = Rectangle.Inflate(rectContourSmooth, -borderSize, -borderSize); + var smoothSize = borderSize > 0 ? borderSize * 3 : 1; + using (var borderGColor = new LinearGradientBrush(rectBorder, borderColor, borderColor2, gradientAngle)) + using (var pathRegion = new GraphicsPath()) + using (var penSmooth = new Pen(this.Parent.BackColor, smoothSize)) + using (var penBorder = new Pen(borderGColor, borderSize)) + { + graph.SmoothingMode = SmoothingMode.AntiAlias; + penBorder.DashStyle = borderLineStyle; + penBorder.DashCap = borderCapStyle; + pathRegion.AddEllipse(rectContourSmooth); + //Set rounded region + this.Region = new Region(pathRegion); + + //Drawing + graph.DrawEllipse(penSmooth, rectContourSmooth);//Draw contour smoothing + if (borderSize > 0) //Draw border + graph.DrawEllipse(penBorder, rectBorder); + } + } + } +} diff --git a/CPM/ProgressBar/LV-CIRCULEPROGRESSBAR.cs b/CPM/ProgressBar/LV-CIRCULEPROGRESSBAR.cs new file mode 100644 index 0000000..f48528b --- /dev/null +++ b/CPM/ProgressBar/LV-CIRCULEPROGRESSBAR.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPM.ProgressBar +{ + public class LV_CIRCULEPROGRESSBAR : UserControl + { + private int _valor = 0; + private int _maximo = 100; + private int _larguraBorda = 10; + private Color _corProgresso = Color.FromArgb(0, 120, 215); + private Color _corFundo = Color.LightGray; + private Font _fonteTexto = new Font("Segoe UI", 10, FontStyle.Bold); + private bool _mostrarPorcentagem = true; + + [Category("Comportamento")] + public int Valor + { + get => _valor; + set + { + _valor = Math.Min(_maximo, Math.Max(0, value)); + Invalidate(); + } + } + + [Category("Comportamento")] + public int Maximo + { + get => _maximo; + set + { + _maximo = value <= 0 ? 1 : value; + Invalidate(); + } + } + + [Category("Aparência")] + public int LarguraBorda + { + get => _larguraBorda; + set + { + _larguraBorda = Math.Max(1, value); + Invalidate(); + } + } + + [Category("Aparência")] + public Color CorProgresso + { + get => _corProgresso; + set + { + _corProgresso = value; + Invalidate(); + } + } + + [Category("Aparência")] + public Color CorFundo + { + get => _corFundo; + set + { + _corFundo = value; + Invalidate(); + } + } + + [Category("Aparência")] + public Font FonteTexto + { + get => _fonteTexto; + set + { + _fonteTexto = value; + Invalidate(); + } + } + + [Category("Aparência")] + public bool MostrarPorcentagem + { + get => _mostrarPorcentagem; + set + { + _mostrarPorcentagem = value; + Invalidate(); + } + } + + public LV_CIRCULEPROGRESSBAR() + { + DoubleBuffered = true; + ResizeRedraw = true; + Size = new Size(150, 150); + } + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + + Rectangle rect = new Rectangle(_larguraBorda, _larguraBorda, + Width - _larguraBorda * 2, Height - _larguraBorda * 2); + + using (Pen fundoPen = new Pen(_corFundo, _larguraBorda)) + using (Pen progressoPen = new Pen(_corProgresso, _larguraBorda)) + { + progressoPen.StartCap = LineCap.Round; + progressoPen.EndCap = LineCap.Round; + + // Fundo + e.Graphics.DrawArc(fundoPen, rect, -90, 360); + + // Progresso + float angulo = 360f * _valor / _maximo; + e.Graphics.DrawArc(progressoPen, rect, -90, angulo); + } + + if (_mostrarPorcentagem) + { + string texto = $"{(int)((double)_valor / _maximo * 100)}%"; + SizeF tamanhoTexto = e.Graphics.MeasureString(texto, _fonteTexto); + e.Graphics.DrawString(texto, _fonteTexto, new SolidBrush(Color.White), + (Width - tamanhoTexto.Width) / 2, (Height - tamanhoTexto.Height) / 2); + } + } + } +} diff --git a/CPM/ProgressBar/LV-PROGRESSBARCUSTOM.cs b/CPM/ProgressBar/LV-PROGRESSBARCUSTOM.cs new file mode 100644 index 0000000..6a4a0f5 --- /dev/null +++ b/CPM/ProgressBar/LV-PROGRESSBARCUSTOM.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.ComponentModel; + +namespace CPM.ProgressBar +{ + public class LV_PROGRESSBARCUSTON : System.Windows.Forms.ProgressBar + { + public enum TextPosition + { + Left, + Right, + Center, + Sliding, + None + } + + //Fields + //-> Appearance + private Color channelColor = Color.LightSteelBlue; + private Color sliderColor = Color.RoyalBlue; + private Color foreBackColor = Color.RoyalBlue; + private int channelHeight = 6; + private int sliderHeight = 6; + private TextPosition showValue = TextPosition.Right; + private string symbolBefore = ""; + private string symbolAfter = ""; + private bool showMaximun = false; + + //-> Others + private bool paintedBack = false; + private bool stopPainting = false; + + public LV_PROGRESSBARCUSTON() + { + this.SetStyle(ControlStyles.UserPaint, true); + this.ForeColor = Color.White; + } + //Propertiesfff + [Category("Levelcode")] + public Color ChannelColor + { + get { return channelColor; } + set + { + channelColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color SliderColor + { + get { return sliderColor; } + set + { + sliderColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color ForeBackColor + { + get { return foreBackColor; } + set + { + foreBackColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public int ChannelHeight + { + get { return channelHeight; } + set + { + channelHeight = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public int SliderHeight + { + get { return sliderHeight; } + set + { + sliderHeight = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public TextPosition ShowValue + { + get { return showValue; } + set + { + showValue = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public string SymbolBefore + { + get { return symbolBefore; } + set + { + symbolBefore = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public string SymbolAfter + { + get { return symbolAfter; } + set + { + symbolAfter = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public bool ShowMaximun + { + get { return showMaximun; } + set + { + showMaximun = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + public override Font Font + { + get { return base.Font; } + set + { + base.Font = value; + } + } + + [Category("Levelcode")] + public override Color ForeColor + { + get { return base.ForeColor; } + set + { + base.ForeColor = value; + } + } + + //-> Paint the background & channel + protected override void OnPaintBackground(PaintEventArgs pevent) + { + if (stopPainting == false) + { + if (paintedBack == false) + { + //Fields + Graphics graph = pevent.Graphics; + Rectangle rectChannel = new Rectangle(0, 0, this.Width, ChannelHeight); + using (var brushChannel = new SolidBrush(channelColor)) + { + if (channelHeight >= sliderHeight) + rectChannel.Y = this.Height - channelHeight; + else rectChannel.Y = this.Height - ((channelHeight + sliderHeight) / 2); + + //Painting + graph.Clear(this.Parent.BackColor);//Surface + graph.FillRectangle(brushChannel, rectChannel);//Channel + + //Stop painting the back & Channel + if (this.DesignMode == false) + paintedBack = true; + } + } + //Reset painting the back & channel + if (this.Value == this.Maximum || this.Value == this.Minimum) + paintedBack = false; + } + } + //-> Paint slider + protected override void OnPaint(PaintEventArgs e) + { + if (stopPainting == false) + { + //Fields + Graphics graph = e.Graphics; + double scaleFactor = (((double)this.Value - this.Minimum) / ((double)this.Maximum - this.Minimum)); + int sliderWidth = (int)(this.Width * scaleFactor); + Rectangle rectSlider = new Rectangle(0, 0, sliderWidth, sliderHeight); + using (var brushSlider = new SolidBrush(sliderColor)) + { + if (sliderHeight >= channelHeight) + rectSlider.Y = this.Height - sliderHeight; + else rectSlider.Y = this.Height - ((sliderHeight + channelHeight) / 2); + + //Painting + if (sliderWidth > 1) //Slider + graph.FillRectangle(brushSlider, rectSlider); + if (showValue != TextPosition.None) //Text + DrawValueText(graph, sliderWidth, rectSlider); + } + } + if (this.Value == this.Maximum) stopPainting = true;//Stop painting + else stopPainting = false; //Keep painting + } + + //-> Paint value text + private void DrawValueText(Graphics graph, int sliderWidth, Rectangle rectSlider) + { + //Fields + string text = symbolBefore + this.Value.ToString() + symbolAfter; + if (showMaximun) text = text + "/" + symbolBefore + this.Maximum.ToString() + symbolAfter; + var textSize = TextRenderer.MeasureText(text, this.Font); + var rectText = new Rectangle(0, 0, textSize.Width, textSize.Height + 2); + using (var brushText = new SolidBrush(this.ForeColor)) + using (var brushTextBack = new SolidBrush(foreBackColor)) + using (var textFormat = new StringFormat()) + { + switch (showValue) + { + case TextPosition.Left: + rectText.X = 0; + textFormat.Alignment = StringAlignment.Near; + break; + + case TextPosition.Right: + rectText.X = this.Width - textSize.Width; + textFormat.Alignment = StringAlignment.Far; + break; + + case TextPosition.Center: + rectText.X = (this.Width - textSize.Width) / 2; + textFormat.Alignment = StringAlignment.Center; + break; + + case TextPosition.Sliding: + rectText.X = sliderWidth - textSize.Width; + textFormat.Alignment = StringAlignment.Center; + //Clean previous text surface + using (var brushClear = new SolidBrush(this.Parent.BackColor)) + { + var rect = rectSlider; + rect.Y = rectText.Y; + rect.Height = rectText.Height; + graph.FillRectangle(brushClear, rect); + } + break; + } + //Painting + graph.FillRectangle(brushTextBack, rectText); + graph.DrawString(text, this.Font, brushText, rectText, textFormat); + } + } + } +} diff --git a/CPM/Properties/Resources.Designer.cs b/CPM/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7bd31d2 --- /dev/null +++ b/CPM/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 +// +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. +// +//------------------------------------------------------------------------------ + +namespace CPM.Properties { + using System; + + + /// + /// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc. + /// + // Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder + // através de uma ferramenta como ResGen ou Visual Studio. + // Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente + // com a opção /str, ou recrie o projeto do VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Retorna a instância de ResourceManager armazenada em cache usada por essa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPM.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Substitui a propriedade CurrentUICulture do thread atual para todas as + /// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/CPM/Properties/Resources.resx b/CPM/Properties/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/CPM/Properties/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CPM/Radiobutton/LV-RADIOBUTTON.cs b/CPM/Radiobutton/LV-RADIOBUTTON.cs new file mode 100644 index 0000000..5822865 --- /dev/null +++ b/CPM/Radiobutton/LV-RADIOBUTTON.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace CPM.Radiobutton +{ + public class LV_RADIOBUTTON : RadioButton + { + //propriedades privadas + private Color checkedColor = Color.MediumSlateBlue; + private Color unCheckedColor = Color.Gray; + + //propriedades publicas + public Color CheckedColor { get => checkedColor; set => checkedColor = value; } + public Color UnCheckedColor { get => unCheckedColor; set => unCheckedColor = value; } + + public LV_RADIOBUTTON() + { + this.MinimumSize = new Size(0, 21); + //Add a padding of 10 to the left to have a considerable distance between the text and the RadioButton. + this.Padding = new Padding(10, 0, 0, 0); + } + protected override void OnPaint(PaintEventArgs pevent) + { + //Fields + Graphics graphics = pevent.Graphics; + graphics.SmoothingMode = SmoothingMode.AntiAlias; + float rbBorderSize = 18F; + float rbCheckSize = 12F; + RectangleF rectRbBorder = new RectangleF() + { + X = 0.5F, + Y = (this.Height - rbBorderSize) / 2, //Center + Width = rbBorderSize, + Height = rbBorderSize + }; + RectangleF rectRbCheck = new RectangleF() + { + X = rectRbBorder.X + ((rectRbBorder.Width - rbCheckSize) / 2), //Center + Y = (this.Height - rbCheckSize) / 2, //Center + Width = rbCheckSize, + Height = rbCheckSize + }; + + //Drawing + using (Pen penBorder = new Pen(checkedColor, 1.6F)) + using (SolidBrush brushRbCheck = new SolidBrush(checkedColor)) + using (SolidBrush brushText = new SolidBrush(this.ForeColor)) + { + //Draw surface + graphics.Clear(this.BackColor); + //Draw Radio Button + if (this.Checked) + { + graphics.DrawEllipse(penBorder, rectRbBorder);//Circle border + graphics.FillEllipse(brushRbCheck, rectRbCheck); //Circle Radio Check + } + else + { + penBorder.Color = unCheckedColor; + graphics.DrawEllipse(penBorder, rectRbBorder); //Circle border + } + //Draw text + graphics.DrawString(this.Text, this.Font, brushText, + rbBorderSize + 8, (this.Height - TextRenderer.MeasureText(this.Text, this.Font).Height) / 2);//Y=Center + } + } + + //X-> Obsolete code, this was replaced by the Padding property in the constructor + //(this.Padding = new Padding(10,0,0,0);) + //protected override void OnResize(EventArgs e) + //{ + // base.OnResize(e); + // this.Width = TextRenderer.MeasureText(this.Text, this.Font).Width + 30; + //} + }//end OnPaint + +} diff --git a/CPM/Test/FrmTestComponents.Designer.cs b/CPM/Test/FrmTestComponents.Designer.cs new file mode 100644 index 0000000..10ab7d7 --- /dev/null +++ b/CPM/Test/FrmTestComponents.Designer.cs @@ -0,0 +1,45 @@ +namespace CPM.Test +{ + partial class FrmTestComponents + { + /// + /// 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() + { + SuspendLayout(); + // + // FrmTestComponents + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(739, 605); + Name = "FrmTestComponents"; + Text = "FrmTestComponents"; + ResumeLayout(false); + } + + #endregion + } +} \ No newline at end of file diff --git a/CPM/Test/FrmTestComponents.cs b/CPM/Test/FrmTestComponents.cs new file mode 100644 index 0000000..0b5aa5c --- /dev/null +++ b/CPM/Test/FrmTestComponents.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CPM.Test +{ + public partial class FrmTestComponents : Form + { + public FrmTestComponents() + { + InitializeComponent(); + } + } +} diff --git a/CPM/Test/FrmTestComponents.resx b/CPM/Test/FrmTestComponents.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/CPM/Test/FrmTestComponents.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CPM/Textbox/LV-TEXTBOX1.cs b/CPM/Textbox/LV-TEXTBOX1.cs new file mode 100644 index 0000000..a86ef50 --- /dev/null +++ b/CPM/Textbox/LV-TEXTBOX1.cs @@ -0,0 +1,210 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using static System.Net.Mime.MediaTypeNames; +using Image = System.Drawing.Image; + +namespace CPM +{ + public partial class LV_TEXTBOX1 : UserControl + { + private Color borderColor = Color.Gray; + private Color borderFocusColor = Color.DodgerBlue; + private int borderSize = 2; + private bool isFocused = false; + private bool underlineStyle = false; + + public event EventHandler IconClick; + + public LV_TEXTBOX1() + { + InitializeComponent(); + Redraw(); + } + + // Propriedades + public override string Text + { + get { return txt.Text; } + set { txt.Text = value; } + } + + public Color BorderColor + { + get { return borderColor; } + set { borderColor = value; Invalidate(); } + } + + public Color BorderFocusColor + { + get { return borderFocusColor; } + set { borderFocusColor = value; Invalidate(); } + } + public bool ReadOnly + { + get { return txt.ReadOnly; } + set { txt.ReadOnly = value; } + } + public int BorderSize + { + get { return borderSize; } + set { borderSize = value; Invalidate(); } + } + // No seu LvlTextbox + [Browsable(true)] + [Category("Behavior")] + public int SelectionStart + { + get { return txt.SelectionStart; } + set { txt.SelectionStart = value; } + } + + [Browsable(true)] + [Category("Behavior")] + public int MaxLength + { + get { return txt.MaxLength; } + set { txt.MaxLength = value; } + } + [Browsable(true)] + [Category("Behavior")] + public bool Multiline + { + get { return txt.Multiline; } + set { txt.Multiline = value; } + } + + public bool UnderlineStyle + { + get { return underlineStyle; } + set { underlineStyle = value; Invalidate(); } + } + + public Image Icon + { + get { return picIcon.Image; } + set + { + picIcon.Image = value; + picIcon.Visible = (value != null); + Redraw(); + } + } + + public enum IconAlignEnum { Left, Right } + + private IconAlignEnum iconAlign = IconAlignEnum.Left; + + public IconAlignEnum IconAlign + { + get { return iconAlign; } + set { iconAlign = value; Redraw(); } + } + + // Renderização da borda + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Color color = isFocused ? borderFocusColor : borderColor; + + using (Pen pen = new Pen(color, borderSize)) + { + pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; + + if (underlineStyle) + { + e.Graphics.DrawLine(pen, 0, Height - 1, Width, Height - 1); + } + else + { + e.Graphics.DrawRectangle(pen, 0, 0, Width - 1, Height - 1); + } + } + } + + // Atualizar layout + public void Redraw() + { + int offset = 0; + + if (picIcon.Visible) + { + offset = picIcon.Width + 8; + + if (iconAlign == IconAlignEnum.Left) + { + picIcon.Left = 5; + txt.Left = offset; + txt.Width = Width - offset - 5; + } + else + { + picIcon.Left = Width - picIcon.Width - 5; + txt.Left = 5; + txt.Width = Width - offset - 5; + } + } + else + { + txt.Left = 5; + txt.Width = Width - 10; + } + + Invalidate(); + } + + // Eventos internos + private void txt_Enter(object sender, EventArgs e) + { + isFocused = true; + Invalidate(); + } + + private void txt_Leave(object sender, EventArgs e) + { + isFocused = false; + Invalidate(); + } + private char _passwordChar = '\0'; + public char PasswordChar + { + get { return _passwordChar; } + set + { + _passwordChar = value; + txt.PasswordChar = value; + txt.UseSystemPasswordChar = (value != '\0'); + } + } + + public bool UseSystemPasswordChar + { + get { return txt.UseSystemPasswordChar; } + set { txt.UseSystemPasswordChar = value; } + } + + + private void txt_KeyPress(object sender, KeyPressEventArgs e) + { + OnKeyPress(e); + } + + private void txt_TextChanged(object sender, EventArgs e) + { + OnTextChanged(e); + } + + private void picIcon_Click(object sender, EventArgs e) + { + if (IconClick != null) + IconClick(this, e); + } + + private void LvlTextbox_Resize(object sender, EventArgs e) + { + Redraw(); + } + } +} diff --git a/CPM/Textbox/LV-TEXTBOX1.resx b/CPM/Textbox/LV-TEXTBOX1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CPM/Textbox/LV-TEXTBOX1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CPM/Textbox/LV_TEXTBOX1.Designer.cs b/CPM/Textbox/LV_TEXTBOX1.Designer.cs new file mode 100644 index 0000000..c155ebd --- /dev/null +++ b/CPM/Textbox/LV_TEXTBOX1.Designer.cs @@ -0,0 +1,60 @@ +namespace CPM +{ + partial class LV_TEXTBOX1 + { + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.TextBox txt; + private System.Windows.Forms.PictureBox picIcon; + + protected override void Dispose(bool disposing) + { + if (disposing && components != null) + components.Dispose(); + + base.Dispose(disposing); + } + + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.txt = new System.Windows.Forms.TextBox(); + this.picIcon = new System.Windows.Forms.PictureBox(); + + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit(); + this.SuspendLayout(); + + // txt + this.txt.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txt.Location = new System.Drawing.Point(5, 5); + this.txt.Name = "txt"; + this.txt.Size = new System.Drawing.Size(150, 16); + this.txt.TabIndex = 0; + this.txt.Enter += new System.EventHandler(this.txt_Enter); + this.txt.Leave += new System.EventHandler(this.txt_Leave); + this.txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_KeyPress); + this.txt.TextChanged += new System.EventHandler(this.txt_TextChanged); + + // picIcon + this.picIcon.Location = new System.Drawing.Point(5, 5); + this.picIcon.Name = "picIcon"; + this.picIcon.Size = new System.Drawing.Size(20, 20); + this.picIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.picIcon.TabStop = false; + this.picIcon.Visible = false; + this.picIcon.Click += new System.EventHandler(this.picIcon_Click); + + // LvlTextbox + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.picIcon); + this.Controls.Add(this.txt); + this.Name = "LvlTextbox"; + this.Size = new System.Drawing.Size(200, 30); + this.Resize += new System.EventHandler(this.LvlTextbox_Resize); + + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + this.txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_KeyPress); + } + } +} diff --git a/CPM/ToggleButton/LV-TOGGLEBUTTON.cs b/CPM/ToggleButton/LV-TOGGLEBUTTON.cs new file mode 100644 index 0000000..87edf83 --- /dev/null +++ b/CPM/ToggleButton/LV-TOGGLEBUTTON.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Drawing.Drawing2D; +using System.ComponentModel; +using System.Drawing; + +namespace CPM.ToggleButton +{ + public class LV_TOGGLEBUTTON : CheckBox + { + //Fields + private Color onBackColor = Color.MediumSlateBlue; + private Color onToggleColor = Color.WhiteSmoke; + private Color offBackColor = Color.Gray; + private Color offToggleColor = Color.Gainsboro; + private bool solidStyle = true; + + //Properties + [Category("Levelcode")] + public Color OnBackColor + { + get + { + return onBackColor; + } + + set + { + onBackColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color OnToggleColor + { + get + { + return onToggleColor; + } + + set + { + onToggleColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color OffBackColor + { + get + { + return offBackColor; + } + + set + { + offBackColor = value; + this.Invalidate(); + } + } + + [Category("Levelcode")] + public Color OffToggleColor + { + get + { + return offToggleColor; + } + + set + { + offToggleColor = value; + this.Invalidate(); + } + } + + [Browsable(false)] + public override string Text + { + get + { + return base.Text; + } + + set + { + + } + } + + [Category("Levelcode")] + [DefaultValue(true)] + public bool SolidStyle + { + get + { + return solidStyle; + } + + set + { + solidStyle = value; + this.Invalidate(); + } + } + + public LV_TOGGLEBUTTON() + { + this.MinimumSize = new Size(45, 22); + } + + //Methods + private GraphicsPath GetFigurePath() + { + int arcSize = this.Height - 1; + Rectangle leftArc = new Rectangle(0, 0, arcSize, arcSize); + Rectangle rightArc = new Rectangle(this.Width - arcSize - 2, 0, arcSize, arcSize); + + GraphicsPath path = new GraphicsPath(); + path.StartFigure(); + path.AddArc(leftArc, 90, 180); + path.AddArc(rightArc, 270, 180); + path.CloseFigure(); + + return path; + } + + protected override void OnPaint(PaintEventArgs pevent) + { + int toggleSize = this.Height - 5; + pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + pevent.Graphics.Clear(this.Parent.BackColor); + + if (this.Checked) //ON + { + //Draw the control surface + if (solidStyle) + pevent.Graphics.FillPath(new SolidBrush(onBackColor), GetFigurePath()); + else pevent.Graphics.DrawPath(new Pen(onBackColor, 2), GetFigurePath()); + //Draw the toggle + pevent.Graphics.FillEllipse(new SolidBrush(onToggleColor), + new Rectangle(this.Width - this.Height + 1, 2, toggleSize, toggleSize)); + } + else //OFF + { + //Draw the control surface + if (solidStyle) + pevent.Graphics.FillPath(new SolidBrush(offBackColor), GetFigurePath()); + else pevent.Graphics.DrawPath(new Pen(offBackColor, 2), GetFigurePath()); + //Draw the toggle + pevent.Graphics.FillEllipse(new SolidBrush(offToggleColor), + new Rectangle(2, 2, toggleSize, toggleSize)); + } + } + } +} diff --git a/CPT/CPT.csproj b/CPT/CPT.csproj new file mode 100644 index 0000000..9882360 --- /dev/null +++ b/CPT/CPT.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/CPT/Class1.cs b/CPT/Class1.cs new file mode 100644 index 0000000..e96b531 --- /dev/null +++ b/CPT/Class1.cs @@ -0,0 +1,7 @@ +namespace CPT +{ + public class Class1 + { + + } +} diff --git a/CPT/DatabaseHelper.cs b/CPT/DatabaseHelper.cs new file mode 100644 index 0000000..cf8ab0b --- /dev/null +++ b/CPT/DatabaseHelper.cs @@ -0,0 +1,91 @@ +using DAL; +using System; +using System.IO; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; + +namespace CPT +{ + public static class DatabaseHelperCPT + { + // Opcional: Um "Salt" para dificultar ataques de dicionário locais + private static readonly byte[] s_salt = { 12, 5, 8, 20, 31, 42 }; + + public static void Salvar(string caminhoArquivo) + { + try + { + // 1. Criamos um objeto anônimo com os dados que estão na sua classe 'DadosDaConexao' + var dados = new + { + Host = DadosDaConexao.Host, + Port = DadosDaConexao.Port, + Banco = DadosDaConexao.Banco, + Usuario = DadosDaConexao.Usuario, + Senha = DadosDaConexao.Senha, + Timeout = DadosDaConexao.ConnectTimeout, + Encrypt = DadosDaConexao.Encrypt, + Trust = DadosDaConexao.TrustServerCertificate + }; + + // 2. Converte para JSON (texto puro temporário) + string jsonPuro = JsonSerializer.Serialize(dados); + byte[] bytesPuros = Encoding.UTF8.GetBytes(jsonPuro); + + // 3. CRIPTOGRAFIA DPAPI: Vincula os dados a ESTA máquina + byte[] bytesCriptografados = ProtectedData.Protect( + bytesPuros, + s_salt, + DataProtectionScope.LocalMachine); + + // 4. Salva o arquivo binário no disco + File.WriteAllBytes(caminhoArquivo, bytesCriptografados); + } + catch (Exception ex) + { + throw new Exception("Erro ao salvar configurações de segurança: " + ex.Message); + } + }//Salvar + + public static string Carregar(string caminhoArquivo) + { + if (!File.Exists(caminhoArquivo)) return null; + + try + { + // 1. Lê e Descriptografa os bytes do disco via DPAPI + byte[] bytesCriptografados = File.ReadAllBytes(caminhoArquivo); + byte[] bytesPuros = ProtectedData.Unprotect(bytesCriptografados, s_salt, DataProtectionScope.LocalMachine); + string jsonPuro = Encoding.UTF8.GetString(bytesPuros); + + // 2. Preenche a sua classe DadosDaConexao + using (JsonDocument doc = JsonDocument.Parse(jsonPuro)) + { + var root = doc.RootElement; + DadosDaConexao.Host = root.GetProperty("Host").GetString(); + DadosDaConexao.Port = root.GetProperty("Port").GetInt32(); + DadosDaConexao.Banco = root.GetProperty("Banco").GetString(); + DadosDaConexao.Usuario = root.GetProperty("Usuario").GetString(); + DadosDaConexao.Senha = root.GetProperty("Senha").GetString(); + DadosDaConexao.ConnectTimeout = root.GetProperty("Timeout").GetInt32(); + DadosDaConexao.Encrypt = root.GetProperty("Encrypt").GetBoolean(); + DadosDaConexao.TrustServerCertificate = root.GetProperty("Trust").GetBoolean(); + } + + // 3. Monta e retorna a String de Conexão formatada + return $"Data Source={DadosDaConexao.Host},{DadosDaConexao.Port};" + + $"Initial Catalog={DadosDaConexao.Banco};" + + $"User ID={DadosDaConexao.Usuario};" + + $"Password={DadosDaConexao.Senha};" + + $"Connect Timeout={DadosDaConexao.ConnectTimeout};" + + $"Encrypt={DadosDaConexao.Encrypt.ToString().ToLower()};" + + $"TrustServerCertificate={DadosDaConexao.TrustServerCertificate.ToString().ToLower()};"; + } + catch (Exception ex) + { + throw new Exception("Erro ao processar configurações: " + ex.Message); + } + }//Carregar + } +} diff --git a/CPT/SecurityManager.cs b/CPT/SecurityManager.cs new file mode 100644 index 0000000..a9ff16b --- /dev/null +++ b/CPT/SecurityManager.cs @@ -0,0 +1,144 @@ +using System; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; + +namespace CPT +{ + public static class SecurityManager + { + // O "Salt" (Entropia) adiciona uma camada extra de segurança. + // Mude esses valores para o seu projeto, mas guarde-os! + // Se mudar o salt, não conseguirá descriptografar o que foi salvo antes. + private static readonly byte[] OptionalEntropy = { 10, 22, 31, 45, 59 }; + + /// + /// Criptografa uma string usando DPAPI e retorna em Base64. + /// + public static string Encrypt(string plainText) + { + if (string.IsNullOrEmpty(plainText)) return null; + + try + { + // Converte a string em bytes + byte[] dataToEncrypt = Encoding.UTF8.GetBytes(plainText); + + // Criptografa os bytes vinculando-os à máquina local + byte[] encryptedData = ProtectedData.Protect( + dataToEncrypt, + OptionalEntropy, + DataProtectionScope.LocalMachine); + + // Retorna como string Base64 para facilitar o salvamento em arquivos (XML, JSON, Config) + return Convert.ToBase64String(encryptedData); + } + catch (Exception ex) + { + // Em um sistema real, logue o erro em um arquivo de log + throw new Exception("Falha ao criptografar os dados: " + ex.Message); + } + } + + /// + /// Descriptografa uma string Base64 vinda do DPAPI. + /// + public static string Decrypt(string encryptedBase64) + { + if (string.IsNullOrEmpty(encryptedBase64)) return null; + + try + { + // Converte a string Base64 de volta para bytes + byte[] dataToDecrypt = Convert.FromBase64String(encryptedBase64); + + // Descriptografa os bytes + byte[] decryptedData = ProtectedData.Unprotect( + dataToDecrypt, + OptionalEntropy, + DataProtectionScope.LocalMachine); + + // Retorna a string original + return Encoding.UTF8.GetString(decryptedData); + } + catch (CryptographicException) + { + throw new Exception("A descriptografia falhou. O dado pode ter sido corrompido ou movido de máquina."); + } + catch (Exception ex) + { + throw new Exception("Erro genérico na descriptografia: " + ex.Message); + } + } + + // Classe que representa o que será salvo no arquivo + public class AppConfig + { + public string EncryptedConnectionString { get; set; } + } + + public static class ConfigProvider + { + // Caminho: C:\Users\Usuario\AppData\Local\NomeDoSeuApp\config.json + private static readonly string FolderPath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "LevelOS"); + + private static readonly string FilePath = Path.Combine(FolderPath, "config.json"); + + /// + /// Salva a string de conexão criptografada no disco. + /// + public static void SalvarConexao(string connectionStringPura) + { + try + { + // 1. Criptografa a string usando nossa classe SecurityManager + string encrypted = SecurityManager.Encrypt(connectionStringPura); + + // 2. Cria o objeto de configuração + var config = new AppConfig { EncryptedConnectionString = encrypted }; + + // 3. Garante que a pasta existe + if (!Directory.Exists(FolderPath)) + Directory.CreateDirectory(FolderPath); + + // 4. Serializa para JSON + string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); + + // 5. Grava no arquivo + File.WriteAllText(FilePath, json); + } + catch (Exception ex) + { + throw new Exception("Erro ao salvar arquivo de configuração: " + ex.Message); + } + } + + /// + /// Lê do disco e retorna a string de conexão já descriptografada. + /// + public static string CarregarConexao() + { + try + { + if (!File.Exists(FilePath)) + return null; + + // 1. Lê o JSON do arquivo + string json = File.ReadAllText(FilePath); + + // 2. Deserializa + var config = JsonSerializer.Deserialize(json); + + // 3. Descriptografa e retorna + return SecurityManager.Decrypt(config.EncryptedConnectionString); + } + catch (Exception ex) + { + throw new Exception("Erro ao carregar configuração: " + ex.Message); + } + } + } + } +} \ No newline at end of file diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj new file mode 100644 index 0000000..7321d5a --- /dev/null +++ b/DAL/DAL.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/DAL/DALAgenda.cs b/DAL/DALAgenda.cs new file mode 100644 index 0000000..86b7c4c --- /dev/null +++ b/DAL/DALAgenda.cs @@ -0,0 +1,207 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using MLL; +using Microsoft.Data.SqlClient; + +namespace DALL +{ + public class DALAgenda + { + private readonly string connectionString; + + public DALAgenda(string conn) + { + connectionString = conn; + } + + // 🔹 LISTAR + public List Listar() + { + var lista = new List(); + + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "SELECT * FROM Agenda"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + lista.Add(new ModeloAgenda( + Convert.ToInt32(dr["ID_AGENDA"]), + dr["CODIGO"]?.ToString(), + dr["COMPROMISSO"]?.ToString(), + dr["dDATA"]?.ToString(), + dr["AVISAR"]?.ToString(), + dr["FUNC"]?.ToString(), + dr["DIA"]?.ToString(), + dr["HORA"]?.ToString(), + dr["REALIZADO"]?.ToString(), + dr["OS_VINC"]?.ToString() + )); + } + } + } + } + catch + { + return new List(); + } + + return lista; + }//Listar agenda + + // 🔹 INSERIR + public bool Inserir(ModeloAgenda obj) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = @"INSERT INTO Agenda + (COMPROMISSO, dDATA, AVISAR, FUNC, DIA, HORA, REALIZADO, OS_VINC) + VALUES + (@COMPROMISSO, @dDATA, @AVISAR, @FUNC, @DIA, @HORA, @REALIZADO, @OS_VINC)"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + //cmd.Parameters.AddWithValue("@CODIGO", obj.CODIGO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@COMPROMISSO", obj.COMPROMISSO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@dDATA", obj.dDATA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@AVISAR", obj.AVISAR ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@FUNC", obj.FUNC ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@DIA", obj.DIA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@HORA", obj.HORA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@REALIZADO", obj.REALIZADO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@OS_VINC", obj.OS_VINC ?? (object)DBNull.Value); + + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Inserir agenda + + // 🔹 ALTERAR + public bool Alterar(ModeloAgenda obj) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = @"UPDATE Agenda SET + CODIGO = @CODIGO, + COMPROMISSO = @COMPROMISSO, + dDATA = @dDATA, + AVISAR = @AVISAR, + FUNC = @FUNC, + DIA = @DIA, + HORA = @HORA, + REALIZADO = @REALIZADO, + OS_VINC = @OS_VINC + WHERE ID_AGENDA = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", obj.ID_AGENDA); + cmd.Parameters.AddWithValue("@CODIGO", obj.CODIGO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@COMPROMISSO", obj.COMPROMISSO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@dDATA", obj.dDATA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@AVISAR", obj.AVISAR ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@FUNC", obj.FUNC ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@DIA", obj.DIA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@HORA", obj.HORA ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@REALIZADO", obj.REALIZADO ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@OS_VINC", obj.OS_VINC ?? (object)DBNull.Value); + + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Alterar agenda + + // 🔹 EXCLUIR + public bool Excluir(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "DELETE FROM Agenda WHERE ID_AGENDA = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", id); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Excluir agenda + + public ModeloAgenda CarregarModeloAgenda(int cod) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "SELECT * FROM Agenda WHERE ID_AGENDA = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", cod); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + return new ModeloAgenda( + Convert.ToInt32(dr["ID_AGENDA"]), + dr["CODIGO"]?.ToString(), + dr["COMPROMISSO"]?.ToString(), + dr["dDATA"]?.ToString(), + dr["AVISAR"]?.ToString(), + dr["FUNC"]?.ToString(), + dr["DIA"]?.ToString(), + dr["HORA"]?.ToString(), + dr["REALIZADO"]?.ToString(), + dr["OS_VINC"]?.ToString() + ); + } + } + } + } + } + catch + { + throw new Exception("Erro ao carregar compromisso da agenda."); + } + + return null; + }//Carregar Modelo Agenda + } +} \ No newline at end of file diff --git a/DAL/DALBancos.cs b/DAL/DALBancos.cs new file mode 100644 index 0000000..f054cbc --- /dev/null +++ b/DAL/DALBancos.cs @@ -0,0 +1,210 @@ +using Microsoft.Data.SqlClient; +using MLL; +using System; +using System.Collections.Generic; +using System.Data; + +namespace DALL +{ + public class DALBancos + { + private readonly string _conexao; + + public DALBancos(string conexao) + { + _conexao = conexao; + } + + #region INSERT + public bool Inserir(string numero, string nome) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"INSERT INTO Bancos (NUMERO, NOME) + VALUES (@NUMERO, @NOME)"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@NUMERO", (object?)numero ?? DBNull.Value); + cmd.Parameters.AddWithValue("@NOME", (object?)nome ?? DBNull.Value); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Inserir + #endregion + + #region UPDATE + public bool Alterar(int id, string numero, string nome) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"UPDATE Bancos + SET NUMERO = @NUMERO, + NOME = @NOME + WHERE ID_BANCOS = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", id); + cmd.Parameters.AddWithValue("@NUMERO", (object?)numero ?? DBNull.Value); + cmd.Parameters.AddWithValue("@NOME", (object?)nome ?? DBNull.Value); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//alterar + #endregion + + #region DELETE + public bool Excluir(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "DELETE FROM Bancos WHERE ID_BANCOS = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", id); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Excluir + #endregion + + #region SELECT TODOS (DataTable) + public DataTable LocalizarTodos() + { + DataTable tabela = new DataTable(); + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Bancos ORDER BY NOME"; + + using (SqlDataAdapter da = new SqlDataAdapter(sql, conn)) + { + da.Fill(tabela); + } + } + + return tabela; + }//LocalizarTodos + #endregion + + #region SELECT LISTA (opcional - forte tipagem) + public List<(int id, string numero, string nome)> ListarLista() + { + var lista = new List<(int, string, string)>(); + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT ID_BANCOS, NUMERO, NOME FROM Bancos ORDER BY NOME"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + lista.Add(( + Convert.ToInt32(dr["ID_BANCOS"]), + dr["NUMERO"]?.ToString(), + dr["NOME"]?.ToString() + )); + } + } + } + } + + return lista; + }//ListarLista + #endregion + + #region SELECT POR NUMERO + public string ObterNomePorNumero(string numero) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT NOME FROM Bancos WHERE NUMERO = @NUMERO"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@NUMERO", numero); + + conn.Open(); + + object result = cmd.ExecuteScalar(); + + return result != null ? result.ToString() : null; + } + } + } + catch + { + return null; + } + }//ObterNomePorNumero + #endregion + public ModeloBancos CarregarModeloBanco(int cod) + { + ModeloBancos banco = null; + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Bancos WHERE ID_BANCOS = @ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", cod); + + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + banco = new ModeloBancos + { + ID_BANCOS = Convert.ToInt32(dr["ID_BANCOS"]), + NUMERO = dr["NUMERO"]?.ToString(), + NOME = dr["NOME"]?.ToString() + }; + } + } + } + } + + return banco; + }//CarregarModeloBanco + + } +} \ No newline at end of file diff --git a/DAL/DALClientes.cs b/DAL/DALClientes.cs new file mode 100644 index 0000000..4e752b5 --- /dev/null +++ b/DAL/DALClientes.cs @@ -0,0 +1,277 @@ +using System; +using System.Data; +using System.Collections.Generic; +using Microsoft.Data.SqlClient; +using MLL; + +namespace DALL +{ + public class DALClientes + { + private readonly string _conexao; + + public DALClientes(string conexao) + { + _conexao = conexao; + } + + #region INSERT + public bool Inserir(ModeloCliente c) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"INSERT INTO Clientes + (EmpresaId, Nome, NomeFantasia, TipoPessoa, Documento, RG, InscricaoMunicipal, + DataNascimento, Contato, Telefone1, Telefone2, Celular, Whatsapp, Email, EmailNFe, + Site, Grupo, Cep, Endereco, Numero, Complemento, Bairro, Cidade, UF, Pais, + LimiteCredito, Bloqueado, ObservacoesCobranca, VendedorPadraoId, TipoConsumidor, + Observacoes, CampoExtra1, CampoExtra2, CampoExtra3, + Bitcoin, Ethereum, Litecoin, Ativo, UltimaCompra) + VALUES + (@EmpresaId, @Nome, @NomeFantasia, @TipoPessoa, @Documento, @RG, @InscricaoMunicipal, + @DataNascimento, @Contato, @Telefone1, @Telefone2, @Celular, @Whatsapp, @Email, @EmailNFe, + @Site, @Grupo, @Cep, @Endereco, @Numero, @Complemento, @Bairro, @Cidade, @UF, @Pais, + @LimiteCredito, @Bloqueado, @ObservacoesCobranca, @VendedorPadraoId, @TipoConsumidor, + @Observacoes, @CampoExtra1, @CampoExtra2, @CampoExtra3, + @Bitcoin, @Ethereum, @Litecoin, @Ativo, @UltimaCompra)"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, c); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//inserir + #endregion + + #region UPDATE + public bool Alterar(ModeloCliente c) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"UPDATE Clientes SET + Nome=@Nome, NomeFantasia=@NomeFantasia, TipoPessoa=@TipoPessoa, + Documento=@Documento, RG=@RG, InscricaoMunicipal=@InscricaoMunicipal, + DataNascimento=@DataNascimento, Contato=@Contato, + Telefone1=@Telefone1, Telefone2=@Telefone2, Celular=@Celular, + Whatsapp=@Whatsapp, Email=@Email, EmailNFe=@EmailNFe, + Site=@Site, Grupo=@Grupo, Cep=@Cep, Endereco=@Endereco, + Numero=@Numero, Complemento=@Complemento, Bairro=@Bairro, + Cidade=@Cidade, UF=@UF, Pais=@Pais, + LimiteCredito=@LimiteCredito, Bloqueado=@Bloqueado, + ObservacoesCobranca=@ObservacoesCobranca, + VendedorPadraoId=@VendedorPadraoId, + TipoConsumidor=@TipoConsumidor, + Observacoes=@Observacoes, + CampoExtra1=@CampoExtra1, CampoExtra2=@CampoExtra2, CampoExtra3=@CampoExtra3, + Bitcoin=@Bitcoin, Ethereum=@Ethereum, Litecoin=@Litecoin, + Ativo=@Ativo, UltimaCompra=@UltimaCompra, + AtualizadoEm=GETDATE() + WHERE Id=@Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, c); + cmd.Parameters.AddWithValue("@Id", c.Id); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Alterar + #endregion + + #region DELETE + public bool Excluir(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "DELETE FROM Clientes WHERE Id=@Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@Id", id); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Excluir + #endregion + + #region SELECT POR ID + public ModeloCliente Carregar(int id) + { + ModeloCliente c = null; + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Clientes WHERE Id=@Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@Id", id); + + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + c = new ModeloCliente(); + PreencherModelo(c, dr); + } + } + } + } + + return c; + }//CarregarModelo + #endregion + + #region LISTAR + public List Listar() + { + var lista = new List(); + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Clientes ORDER BY Nome"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + var c = new ModeloCliente(); + PreencherModelo(c, dr); + lista.Add(c); + } + } + } + } + + return lista; + }//Listar Clientes + #endregion + + #region AUX PARAMETROS + private void PreencherParametros(SqlCommand cmd, ModeloCliente c) + { + cmd.Parameters.AddWithValue("@EmpresaId", c.EmpresaId); + cmd.Parameters.AddWithValue("@Nome", c.Nome); + cmd.Parameters.AddWithValue("@NomeFantasia", (object?)c.NomeFantasia ?? DBNull.Value); + cmd.Parameters.AddWithValue("@TipoPessoa", c.TipoPessoa); + cmd.Parameters.AddWithValue("@Documento", c.Documento); + cmd.Parameters.AddWithValue("@RG", (object?)c.RG ?? DBNull.Value); + cmd.Parameters.AddWithValue("@InscricaoMunicipal", (object?)c.InscricaoMunicipal ?? DBNull.Value); + cmd.Parameters.AddWithValue("@DataNascimento", c.DataNascimento ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Contato", (object?)c.Contato ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Telefone1", (object?)c.Telefone1 ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Telefone2", (object?)c.Telefone2 ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Celular", (object?)c.Celular ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Whatsapp", (object?)c.Whatsapp ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Email", (object?)c.Email ?? DBNull.Value); + cmd.Parameters.AddWithValue("@EmailNFe", (object?)c.EmailNFe ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Site", (object?)c.Site ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Grupo", (object?)c.Grupo ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Cep", (object?)c.Cep ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Endereco", (object?)c.Endereco ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Numero", c.Numero ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Complemento", (object?)c.Complemento ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Bairro", (object?)c.Bairro ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Cidade", (object?)c.Cidade ?? DBNull.Value); + cmd.Parameters.AddWithValue("@UF", (object?)c.UF ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Pais", (object?)c.Pais ?? DBNull.Value); + cmd.Parameters.AddWithValue("@LimiteCredito", c.LimiteCredito); + cmd.Parameters.AddWithValue("@Bloqueado", c.Bloqueado); + cmd.Parameters.AddWithValue("@ObservacoesCobranca", (object?)c.ObservacoesCobranca ?? DBNull.Value); + cmd.Parameters.AddWithValue("@VendedorPadraoId", c.VendedorPadraoId ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@TipoConsumidor", (object?)c.TipoConsumidor ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Observacoes", (object?)c.Observacoes ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CampoExtra1", (object?)c.CampoExtra1 ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CampoExtra2", (object?)c.CampoExtra2 ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CampoExtra3", (object?)c.CampoExtra3 ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Bitcoin", (object?)c.Bitcoin ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Ethereum", (object?)c.Ethereum ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Litecoin", (object?)c.Litecoin ?? DBNull.Value); + cmd.Parameters.AddWithValue("@Ativo", c.Ativo); + cmd.Parameters.AddWithValue("@UltimaCompra", c.UltimaCompra ?? (object)DBNull.Value); + } + #endregion + + #region AUX MODEL + private void PreencherModelo(ModeloCliente c, SqlDataReader dr) + { + c.Id = Convert.ToInt32(dr["Id"]); + c.EmpresaId = Convert.ToInt32(dr["EmpresaId"]); + c.Nome = dr["Nome"].ToString(); + c.NomeFantasia = dr["NomeFantasia"]?.ToString(); + c.TipoPessoa = dr["TipoPessoa"].ToString(); + c.Documento = dr["Documento"].ToString(); + c.RG = dr["RG"]?.ToString(); + c.InscricaoMunicipal = dr["InscricaoMunicipal"]?.ToString(); + c.DataNascimento = dr["DataNascimento"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dr["DataNascimento"]); + c.Contato = dr["Contato"]?.ToString(); + c.Telefone1 = dr["Telefone1"]?.ToString(); + c.Telefone2 = dr["Telefone2"]?.ToString(); + c.Celular = dr["Celular"]?.ToString(); + c.Whatsapp = dr["Whatsapp"]?.ToString(); + c.Email = dr["Email"]?.ToString(); + c.EmailNFe = dr["EmailNFe"]?.ToString(); + c.Site = dr["Site"]?.ToString(); + c.Grupo = dr["Grupo"]?.ToString(); + c.Cep = dr["Cep"]?.ToString(); + c.Endereco = dr["Endereco"]?.ToString(); + c.Numero = dr["Numero"] == DBNull.Value ? null : (int?)Convert.ToInt32(dr["Numero"]); + c.Complemento = dr["Complemento"]?.ToString(); + c.Bairro = dr["Bairro"]?.ToString(); + c.Cidade = dr["Cidade"]?.ToString(); + c.UF = dr["UF"]?.ToString(); + c.Pais = dr["Pais"]?.ToString(); + c.LimiteCredito = Convert.ToDecimal(dr["LimiteCredito"]); + c.Bloqueado = Convert.ToBoolean(dr["Bloqueado"]); + c.ObservacoesCobranca = dr["ObservacoesCobranca"]?.ToString(); + c.VendedorPadraoId = dr["VendedorPadraoId"] == DBNull.Value ? null : (int?)Convert.ToInt32(dr["VendedorPadraoId"]); + c.TipoConsumidor = dr["TipoConsumidor"]?.ToString(); + c.Observacoes = dr["Observacoes"]?.ToString(); + c.CampoExtra1 = dr["CampoExtra1"]?.ToString(); + c.CampoExtra2 = dr["CampoExtra2"]?.ToString(); + c.CampoExtra3 = dr["CampoExtra3"]?.ToString(); + c.Bitcoin = dr["Bitcoin"]?.ToString(); + c.Ethereum = dr["Ethereum"]?.ToString(); + c.Litecoin = dr["Litecoin"]?.ToString(); + c.Ativo = Convert.ToBoolean(dr["Ativo"]); + c.UltimaCompra = dr["UltimaCompra"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dr["UltimaCompra"]); + c.CriadoEm = Convert.ToDateTime(dr["CriadoEm"]); + c.AtualizadoEm = Convert.ToDateTime(dr["AtualizadoEm"]); + } + #endregion + } +} \ No newline at end of file diff --git a/DAL/DALEmpresa.cs b/DAL/DALEmpresa.cs new file mode 100644 index 0000000..1ce0407 --- /dev/null +++ b/DAL/DALEmpresa.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using Microsoft.Data.SqlClient; +using MLL; + +namespace DALL +{ + public class DALEmpresa + { + private readonly string connectionString; + + public DALEmpresa(string conn) + { + connectionString = conn; + } + + // 🔹 LISTAR + public List Listar() + { + var lista = new List(); + + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "SELECT * FROM Empresa"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + lista.Add(new ModeloEmpresa( + Convert.ToInt32(dr["IdEmpresa"]), + dr["Nome"]?.ToString(), + dr["CNPJ"]?.ToString(), + dr["TipoEmpresa"]?.ToString(), + dr["RegimeTributario"]?.ToString(), + dr["CNAE"]?.ToString(), + dr["Cep"]?.ToString(), + dr["Endereco"]?.ToString(), + Convert.ToInt32(dr["Numero"]), + dr["Complemento"]?.ToString(), + dr["Bairro"]?.ToString(), + dr["Cidade"]?.ToString(), + dr["UF"]?.ToString(), + dr["Pais"]?.ToString(), + dr["Telefone1"]?.ToString(), + dr["Telefone2"]?.ToString(), + dr["Celular"]?.ToString(), + dr["Whatsapp"]?.ToString(), + dr["Email"]?.ToString(), + dr["Site"]?.ToString(), + dr["InscricaoEstadual"]?.ToString(), + dr["InscricaoMunicipal"]?.ToString(), + dr["CNPJCPF_Contador"]?.ToString(), + dr["Nome_Contador"]?.ToString(), + dr["TextoParaRecibo"]?.ToString(), + Convert.ToBoolean(dr["Ativo"]), + Convert.ToDateTime(dr["CriadoEm"]), + Convert.ToDateTime(dr["AtualizadoEm"]) + )); + } + } + } + } + catch + { + return new List(); + } + + return lista; + }//listarEmpresa + + // 🔹 CARREGAR POR ID + public ModeloEmpresa CarregarModeloEmpresa(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "SELECT * FROM Empresa WHERE IdEmpresa = @Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@Id", id); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + return new ModeloEmpresa( + Convert.ToInt32(dr["Id"]), + dr["Nome"]?.ToString(), + dr["CNPJ"]?.ToString(), + dr["TipoEmpresa"]?.ToString(), + dr["RegimeTributario"]?.ToString(), + dr["CNAE"]?.ToString(), + dr["Cep"]?.ToString(), + dr["Endereco"]?.ToString(), + Convert.ToInt32(dr["Numero"]), + dr["Complemento"]?.ToString(), + dr["Bairro"]?.ToString(), + dr["Cidade"]?.ToString(), + dr["UF"]?.ToString(), + dr["Pais"]?.ToString(), + dr["Telefone1"]?.ToString(), + dr["Telefone2"]?.ToString(), + dr["Celular"]?.ToString(), + dr["Whatsapp"]?.ToString(), + dr["Email"]?.ToString(), + dr["Site"]?.ToString(), + dr["InscricaoEstadual"]?.ToString(), + dr["InscricaoMunicipal"]?.ToString(), + dr["CNPJCPF_Contador"]?.ToString(), + dr["Nome_Contador"]?.ToString(), + dr["TextoParaRecibo"]?.ToString(), + Convert.ToBoolean(dr["Ativo"]), + Convert.ToDateTime(dr["CriadoEm"]), + Convert.ToDateTime(dr["AtualizadoEm"]) + ); + } + } + } + } + } + catch { } + + return null; + }//CarregarModeloEmpresaPorID + + // 🔹 INSERIR + public bool Inserir(ModeloEmpresa obj) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = @"INSERT INTO Empresa + (Nome, CNPJ, TipoEmpresa, RegimeTributario, CNAE, Cep, Endereco, Numero, + Complemento, Bairro, Cidade, UF, Pais, Telefone1, Telefone2, Celular, + Whatsapp, Email, Site, InscricaoEstadual, InscricaoMunicipal, + CNPJCPF_Contador, Nome_Contador, TextoParaRecibo, Ativo) + VALUES + (@Nome, @CNPJ, @TipoEmpresa, @RegimeTributario, @CNAE, @Cep, @Endereco, @Numero, + @Complemento, @Bairro, @Cidade, @UF, @Pais, @Telefone1, @Telefone2, @Celular, + @Whatsapp, @Email, @Site, @InscricaoEstadual, @InscricaoMunicipal, + @CNPJCPF_Contador, @Nome_Contador, @TextoParaRecibo, @Ativo)"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, obj); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Incluir + + // 🔹 ALTERAR + public bool Alterar(ModeloEmpresa obj) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = @"UPDATE Empresa SET + Nome=@Nome, CNPJ=@CNPJ, TipoEmpresa=@TipoEmpresa, RegimeTributario=@RegimeTributario, + CNAE=@CNAE, Cep=@Cep, Endereco=@Endereco, Numero=@Numero, + Complemento=@Complemento, Bairro=@Bairro, Cidade=@Cidade, UF=@UF, + Pais=@Pais, Telefone1=@Telefone1, Telefone2=@Telefone2, + Celular=@Celular, Whatsapp=@Whatsapp, Email=@Email, Site=@Site, + InscricaoEstadual=@InscricaoEstadual, InscricaoMunicipal=@InscricaoMunicipal, + CNPJCPF_Contador=@CNPJCPF_Contador, Nome_Contador=@Nome_Contador, + TextoParaRecibo=@TextoParaRecibo, Ativo=@Ativo, + AtualizadoEm=GETDATE() + WHERE IdEmpresa=@Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, obj); + cmd.Parameters.AddWithValue("@Id", obj.Id); + + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Alterar + + // 🔹 EXCLUIR + public bool Excluir(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + string sql = "DELETE FROM Empresa WHERE IdEmpresa=@Id"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@Id", id); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + }//Excluir + + // 🔹 MÉTODO AUXILIAR (evita repetição) + private void PreencherParametros(SqlCommand cmd, ModeloEmpresa obj) + { + cmd.Parameters.AddWithValue("@Nome", obj.Nome ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@CNPJ", obj.CNPJ ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@TipoEmpresa", obj.TipoEmpresa ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@RegimeTributario", obj.RegimeTributario ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@CNAE", obj.CNAE ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Cep", obj.Cep ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Endereco", obj.Endereco ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Numero", obj.Numero); + cmd.Parameters.AddWithValue("@Complemento", obj.Complemento ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Bairro", obj.Bairro ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Cidade", obj.Cidade ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@UF", obj.UF ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Pais", obj.Pais ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Telefone1", obj.Telefone1 ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Telefone2", obj.Telefone2 ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Celular", obj.Celular ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Whatsapp", obj.Whatsapp ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Email", obj.Email ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Site", obj.Site ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@InscricaoEstadual", obj.InscricaoEstadual ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@InscricaoMunicipal", obj.InscricaoMunicipal ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@CNPJCPF_Contador", obj.CNPJCPF_Contador ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Nome_Contador", obj.Nome_Contador ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@TextoParaRecibo", obj.TextoParaRecibo ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Ativo", obj.Ativo); + }//Preencher parametros + + public ModeloEmpresa? CarregarEmpresaAtiva() + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + conn.Open(); + + // Retorna a primeira empresa com Ativo = true + string sql = "SELECT TOP 1 * FROM Empresa WHERE Ativo = 1"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + return new ModeloEmpresa( + Convert.ToInt32(dr["IdEmpresa"]), + dr["Nome"]?.ToString(), + dr["CNPJ"]?.ToString(), + dr["TipoEmpresa"]?.ToString(), + dr["RegimeTributario"]?.ToString(), + dr["CNAE"]?.ToString(), + dr["Cep"]?.ToString(), + dr["Endereco"]?.ToString(), + Convert.ToInt32(dr["Numero"]), + dr["Complemento"]?.ToString(), + dr["Bairro"]?.ToString(), + dr["Cidade"]?.ToString(), + dr["UF"]?.ToString(), + dr["Pais"]?.ToString(), + dr["Telefone1"]?.ToString(), + dr["Telefone2"]?.ToString(), + dr["Celular"]?.ToString(), + dr["Whatsapp"]?.ToString(), + dr["Email"]?.ToString(), + dr["Site"]?.ToString(), + dr["InscricaoEstadual"]?.ToString(), + dr["InscricaoMunicipal"]?.ToString(), + dr["CNPJCPF_Contador"]?.ToString(), + dr["Nome_Contador"]?.ToString(), + dr["TextoParaRecibo"]?.ToString(), + Convert.ToBoolean(dr["Ativo"]), + Convert.ToDateTime(dr["CriadoEm"]), + Convert.ToDateTime(dr["AtualizadoEm"]) + ); + } + } + } + } + catch { } + + return null; + }//CarregarEmpresaAtiva + } +} \ No newline at end of file diff --git a/DAL/DALEmpresaConfig.cs b/DAL/DALEmpresaConfig.cs new file mode 100644 index 0000000..3326bed --- /dev/null +++ b/DAL/DALEmpresaConfig.cs @@ -0,0 +1,250 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using Microsoft.Data.SqlClient; + +public class DALEmpresaConfig +{ + private readonly string _connectionString; + + public DALEmpresaConfig(string connectionString) + { + _connectionString = connectionString; + } + + #region INSERT + public bool Inserir(ModeloEmpresaConfig config) + { + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = @" + INSERT INTO Empresa_config ( + IdEmpresa, + NomeSistema, + CorPrimaria, + CorSecundaria, + Logo, + Favicon, + ExibirCPFCliente, + ExibirTelefoneCliente, + ExibirGarantia, + DiasGarantiaPadrao, + GerarReciboAutomatico, + ExibirValoresOS, + EnviarEmailAutomatico, + EnviarWhatsappAutomatico, + ModoEscuro, + PermitirEdicaoOSFinalizada + ) + SELECT + @IdEmpresa, + @NomeSistema, + @CorPrimaria, + @CorSecundaria, + @Logo, + @Favicon, + @ExibirCPFCliente, + @ExibirTelefoneCliente, + @ExibirGarantia, + @DiasGarantiaPadrao, + @GerarReciboAutomatico, + @ExibirValoresOS, + @EnviarEmailAutomatico, + @EnviarWhatsappAutomatico, + @ModoEscuro, + @PermitirEdicaoOSFinalizada + WHERE EXISTS ( + SELECT 1 FROM Empresa + WHERE IdEmpresa = @IdEmpresa AND Ativo = 1 + ) + AND NOT EXISTS ( + SELECT 1 FROM Empresa_config + WHERE IdEmpresa = @IdEmpresa + );"; + + SqlCommand cmd = new SqlCommand(sql, conn); + AddParametros(cmd, config); + + conn.Open(); + int linhas = cmd.ExecuteNonQuery(); + + if (linhas == 0) + throw new Exception("Empresa não encontrada, inativa ou já possui configuração."); + + return true; + } + } + #endregion + + #region UPDATE + public bool Atualizar(ModeloEmpresaConfig config) + { + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = @" + UPDATE Empresa_config + SET + NomeSistema = @NomeSistema, + CorPrimaria = @CorPrimaria, + CorSecundaria = @CorSecundaria, + Logo = @Logo, + Favicon = @Favicon, + ExibirCPFCliente = @ExibirCPFCliente, + ExibirTelefoneCliente = @ExibirTelefoneCliente, + ExibirGarantia = @ExibirGarantia, + DiasGarantiaPadrao = @DiasGarantiaPadrao, + GerarReciboAutomatico = @GerarReciboAutomatico, + ExibirValoresOS = @ExibirValoresOS, + EnviarEmailAutomatico = @EnviarEmailAutomatico, + EnviarWhatsappAutomatico = @EnviarWhatsappAutomatico, + ModoEscuro = @ModoEscuro, + PermitirEdicaoOSFinalizada = @PermitirEdicaoOSFinalizada, + AtualizadoEm = GETDATE() + WHERE IdEmpresaConfig = @IdEmpresaConfig + AND EXISTS ( + SELECT 1 FROM Empresa + WHERE IdEmpresa = @IdEmpresa AND Ativo = 1 + );"; + + SqlCommand cmd = new SqlCommand(sql, conn); + AddParametros(cmd, config); + cmd.Parameters.AddWithValue("@IdEmpresaConfig", config.IdEmpresaConfig); + + conn.Open(); + int linhas = cmd.ExecuteNonQuery(); + + if (linhas == 0) + throw new Exception("Não foi possível atualizar."); + + return true; + } + } + #endregion + + #region DELETE + public bool Excluir(int id) + { + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = "DELETE FROM Empresa_config WHERE IdEmpresaConfig = @Id"; + + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.Parameters.AddWithValue("@Id", id); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + #endregion + + #region GET POR EMPRESA + public ModeloEmpresaConfig ObterPorEmpresa(int idEmpresa) + { + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = "SELECT * FROM Empresa_config WHERE IdEmpresa = @IdEmpresa"; + + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.Parameters.AddWithValue("@IdEmpresa", idEmpresa); + + conn.Open(); + SqlDataReader dr = cmd.ExecuteReader(); + + if (dr.Read()) + return Mapear(dr); + + return null; + } + } + #endregion + + #region AUXILIARES + private void AddParametros(SqlCommand cmd, ModeloEmpresaConfig config) + { + cmd.Parameters.AddWithValue("@IdEmpresa", config.IdEmpresa); + cmd.Parameters.AddWithValue("@NomeSistema", config.NomeSistema ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@CorPrimaria", config.CorPrimaria ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@CorSecundaria", config.CorSecundaria ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Logo", config.Logo ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@Favicon", config.Favicon ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@ExibirCPFCliente", config.ExibirCPFCliente); + cmd.Parameters.AddWithValue("@ExibirTelefoneCliente", config.ExibirTelefoneCliente); + cmd.Parameters.AddWithValue("@ExibirGarantia", config.ExibirGarantia); + cmd.Parameters.AddWithValue("@DiasGarantiaPadrao", config.DiasGarantiaPadrao); + cmd.Parameters.AddWithValue("@GerarReciboAutomatico", config.GerarReciboAutomatico); + cmd.Parameters.AddWithValue("@ExibirValoresOS", config.ExibirValoresOS); + cmd.Parameters.AddWithValue("@EnviarEmailAutomatico", config.EnviarEmailAutomatico); + cmd.Parameters.AddWithValue("@EnviarWhatsappAutomatico", config.EnviarWhatsappAutomatico); + cmd.Parameters.AddWithValue("@ModoEscuro", config.ModoEscuro); + cmd.Parameters.AddWithValue("@PermitirEdicaoOSFinalizada", config.PermitirEdicaoOSFinalizada); + } + public List LocalizarTodas() + { + List lista = new List(); + + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = "SELECT * FROM Empresa_config"; + + SqlCommand cmd = new SqlCommand(sql, conn); + + conn.Open(); + SqlDataReader dr = cmd.ExecuteReader(); + + while (dr.Read()) + { + lista.Add(Mapear(dr)); + } + } + + return lista; + } + + private ModeloEmpresaConfig Mapear(SqlDataReader dr) + { + return new ModeloEmpresaConfig + { + IdEmpresaConfig = (int)dr["IdEmpresaConfig"], + IdEmpresa = (int)dr["IdEmpresa"], + NomeSistema = dr["NomeSistema"]?.ToString(), + CorPrimaria = dr["CorPrimaria"]?.ToString(), + CorSecundaria = dr["CorSecundaria"]?.ToString(), + Logo = dr["Logo"]?.ToString(), + Favicon = dr["Favicon"]?.ToString(), + ExibirCPFCliente = (bool)dr["ExibirCPFCliente"], + ExibirTelefoneCliente = (bool)dr["ExibirTelefoneCliente"], + ExibirGarantia = (bool)dr["ExibirGarantia"], + DiasGarantiaPadrao = (int)dr["DiasGarantiaPadrao"], + GerarReciboAutomatico = (bool)dr["GerarReciboAutomatico"], + ExibirValoresOS = (bool)dr["ExibirValoresOS"], + EnviarEmailAutomatico = (bool)dr["EnviarEmailAutomatico"], + EnviarWhatsappAutomatico = (bool)dr["EnviarWhatsappAutomatico"], + ModoEscuro = (bool)dr["ModoEscuro"], + PermitirEdicaoOSFinalizada = (bool)dr["PermitirEdicaoOSFinalizada"], + CriadoEm = (DateTime)dr["CriadoEm"], + AtualizadoEm = (DateTime)dr["AtualizadoEm"] + }; + } + public int ObterEmpresaAtivaId() + { + using (SqlConnection conn = new SqlConnection(_connectionString)) + { + string sql = @" + SELECT TOP 1 IdEmpresa + FROM Empresa + WHERE Ativo = 1"; + + SqlCommand cmd = new SqlCommand(sql, conn); + + conn.Open(); + + object result = cmd.ExecuteScalar(); + + if (result == null) + throw new Exception("Nenhuma empresa ativa encontrada."); + + return Convert.ToInt32(result); + } + } + #endregion +} \ No newline at end of file diff --git a/DAL/DALFuncionarios.cs b/DAL/DALFuncionarios.cs new file mode 100644 index 0000000..08ffbb5 --- /dev/null +++ b/DAL/DALFuncionarios.cs @@ -0,0 +1,422 @@ +using System; +using System.Data; +using System.Collections.Generic; +using Microsoft.Data.SqlClient; +using MLL; + +namespace DALL +{ + public class DALFuncionarios + { + private readonly string _conexao; + + public DALFuncionarios(string conexao) + { + _conexao = conexao; + } + + #region INSERT + public bool Inserir(ModeloFuncionarios f) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"INSERT INTO Funcionarios + (CODIGO, NOME, PAI, MAE, CPF, CI, CTPS, CNH, CAT_CNH, + ECIVIL, REGIME, CEP, ENDERECO, ENDNUMERO, BAIRRO, CIDADE, UF, + BANCO, AGENCIA, CONTA, TELEFONE, PASS, + MASTERUSER, VENDEDOR, TECNICO, DEMITIDO, + FTECNICO, FVENDEDOR, FPATH, OBSERV, + DATA_ADM, DATA_DEM, ANIVER) + VALUES + (@CODIGO, @NOME, @PAI, @MAE, @CPF, @CI, @CTPS, @CNH, @CAT_CNH, + @ECIVIL, @REGIME, @CEP, @ENDERECO, @ENDNUMERO, @BAIRRO, @CIDADE, @UF, + @BANCO, @AGENCIA, @CONTA, @TELEFONE, @PASS, + @MASTERUSER, @VENDEDOR, @TECNICO, @DEMITIDO, + @FTECNICO, @FVENDEDOR, @FPATH, @OBSERV, + @DATA_ADM, @DATA_DEM, @ANIVER)"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, f); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + } + #endregion + + #region UPDATE + public bool Alterar(ModeloFuncionarios f) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = @"UPDATE Funcionarios SET + CODIGO=@CODIGO, NOME=@NOME, PAI=@PAI, MAE=@MAE, + CPF=@CPF, CI=@CI, CTPS=@CTPS, CNH=@CNH, CAT_CNH=@CAT_CNH, + ECIVIL=@ECIVIL, REGIME=@REGIME, + CEP=@CEP, ENDERECO=@ENDERECO, ENDNUMERO=@ENDNUMERO, + BAIRRO=@BAIRRO, CIDADE=@CIDADE, UF=@UF, + BANCO=@BANCO, AGENCIA=@AGENCIA, CONTA=@CONTA, + TELEFONE=@TELEFONE, PASS=@PASS, + MASTERUSER=@MASTERUSER, VENDEDOR=@VENDEDOR, + TECNICO=@TECNICO, DEMITIDO=@DEMITIDO, + FTECNICO=@FTECNICO, FVENDEDOR=@FVENDEDOR, + FPATH=@FPATH, OBSERV=@OBSERV, + DATA_ADM=@DATA_ADM, DATA_DEM=@DATA_DEM, ANIVER=@ANIVER + WHERE ID_FUNCIONARIO=@ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + PreencherParametros(cmd, f); + cmd.Parameters.AddWithValue("@ID", f.ID_FUNCIONARIO); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + } + #endregion + + #region DELETE + public bool Excluir(int id) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "DELETE FROM Funcionarios WHERE ID_FUNCIONARIO=@ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", id); + + conn.Open(); + return cmd.ExecuteNonQuery() > 0; + } + } + } + catch + { + return false; + } + } + #endregion + + #region SELECT BY ID + public ModeloFuncionarios Carregar(int id) + { + ModeloFuncionarios f = null; + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Funcionarios WHERE ID_FUNCIONARIO=@ID"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@ID", id); + + conn.Open(); + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + f = new ModeloFuncionarios(); + PreencherModelo(f, dr); + } + } + } + } + + return f; + } + #endregion + + #region SELECT LISTA + public List Listar() + { + List lista = new List(); + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Funcionarios"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + ModeloFuncionarios f = new ModeloFuncionarios(); + PreencherModelo(f, dr); + lista.Add(f); + } + } + } + } + + return lista; + }//List + public List LocalizarOtimizado(ModeloFuncionarios filtro) + { + List lista = new List(); + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Funcionarios WHERE 1=1 "; + SqlCommand cmd = new SqlCommand(); + + cmd.Connection = conn; + + // 🔎 FILTROS DINÂMICOS + + if (!string.IsNullOrEmpty(filtro.CODIGO)) + { + sql += " AND CODIGO LIKE @CODIGO"; + cmd.Parameters.AddWithValue("@CODIGO", "%" + filtro.CODIGO + "%"); + } + + if (!string.IsNullOrEmpty(filtro.NOME)) + { + sql += " AND NOME LIKE @NOME"; + cmd.Parameters.AddWithValue("@NOME", "%" + filtro.NOME + "%"); + } + + if (!string.IsNullOrEmpty(filtro.CPF)) + { + sql += " AND CPF = @CPF"; + cmd.Parameters.AddWithValue("@CPF", filtro.CPF); + } + + if (!string.IsNullOrEmpty(filtro.CIDADE)) + { + sql += " AND CIDADE LIKE @CIDADE"; + cmd.Parameters.AddWithValue("@CIDADE", "%" + filtro.CIDADE + "%"); + } + + if (!string.IsNullOrEmpty(filtro.UF)) + { + sql += " AND UF = @UF"; + cmd.Parameters.AddWithValue("@UF", filtro.UF); + } + + if (!string.IsNullOrEmpty(filtro.TELEFONE)) + { + sql += " AND TELEFONE LIKE @TEL"; + cmd.Parameters.AddWithValue("@TEL", "%" + filtro.TELEFONE + "%"); + } + + // 🔹 BOOL (BIT) + if (filtro.VENDEDOR) + { + sql += " AND VENDEDOR = @VENDEDOR"; + cmd.Parameters.AddWithValue("@VENDEDOR", true); + } + + if (filtro.TECNICO) + { + sql += " AND TECNICO = @TECNICO"; + cmd.Parameters.AddWithValue("@TECNICO", true); + } + + if (filtro.DEMITIDO) + { + sql += " AND DEMITIDO = @DEMITIDO"; + cmd.Parameters.AddWithValue("@DEMITIDO", true); + } + + // 🔹 DATAS + if (filtro.DATA_ADM.HasValue) + { + sql += " AND DATA_ADM = @DATA_ADM"; + cmd.Parameters.AddWithValue("@DATA_ADM", filtro.DATA_ADM.Value); + } + + if (filtro.DATA_DEM.HasValue) + { + sql += " AND DATA_DEM = @DATA_DEM"; + cmd.Parameters.AddWithValue("@DATA_DEM", filtro.DATA_DEM.Value); + } + + // 🔥 ORDENAÇÃO (importante) + sql += " ORDER BY NOME"; + + cmd.CommandText = sql; + + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + while (dr.Read()) + { + ModeloFuncionarios f = new ModeloFuncionarios(); + PreencherModelo(f, dr); + lista.Add(f); + } + } + } + + return lista; + }//LocalizarOtimizado + public string ObterNomePorCodigo(string codigo) + { + try + { + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT NOME FROM Funcionarios WHERE CODIGO = @CODIGO"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@CODIGO", codigo); + + conn.Open(); + + object result = cmd.ExecuteScalar(); + + return result != null ? result.ToString() : null; + } + } + } + catch + { + return null; + } + }//ObterNomePorCodigo + public ModeloFuncionarios CarregarPorCodigo(string codigo) + { + ModeloFuncionarios f = null; + + using (SqlConnection conn = new SqlConnection(_conexao)) + { + string sql = "SELECT * FROM Funcionarios WHERE CODIGO = @CODIGO"; + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddWithValue("@CODIGO", codigo); + + conn.Open(); + + using (SqlDataReader dr = cmd.ExecuteReader()) + { + if (dr.Read()) + { + f = new ModeloFuncionarios(); + PreencherModelo(f, dr); + } + } + } + } + + return f; + }//CarregarPorCodigo + #endregion + + #region PARAMETROS + private void PreencherParametros(SqlCommand cmd, ModeloFuncionarios f) + { + cmd.Parameters.AddWithValue("@CODIGO", (object?)f.CODIGO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@NOME", (object?)f.NOME ?? DBNull.Value); + cmd.Parameters.AddWithValue("@PAI", (object?)f.PAI ?? DBNull.Value); + cmd.Parameters.AddWithValue("@MAE", (object?)f.MAE ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CPF", (object?)f.CPF ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CI", (object?)f.CI ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CTPS", (object?)f.CTPS ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CNH", (object?)f.CNH ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CAT_CNH", (object?)f.CAT_CNH ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@ECIVIL", (object?)f.ECIVIL ?? DBNull.Value); + cmd.Parameters.AddWithValue("@REGIME", (object?)f.REGIME ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@CEP", (object?)f.CEP ?? DBNull.Value); + cmd.Parameters.AddWithValue("@ENDERECO", (object?)f.ENDERECO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@ENDNUMERO", (object?)f.ENDNUMERO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@BAIRRO", (object?)f.BAIRRO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CIDADE", (object?)f.CIDADE ?? DBNull.Value); + cmd.Parameters.AddWithValue("@UF", (object?)f.UF ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@BANCO", (object?)f.BANCO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@AGENCIA", (object?)f.AGENCIA ?? DBNull.Value); + cmd.Parameters.AddWithValue("@CONTA", (object?)f.CONTA ?? DBNull.Value); + cmd.Parameters.AddWithValue("@TELEFONE", (object?)f.TELEFONE ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@PASS", (object?)f.PASS ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@MASTERUSER", f.MASTERUSER); + cmd.Parameters.AddWithValue("@VENDEDOR", f.VENDEDOR); + cmd.Parameters.AddWithValue("@TECNICO", f.TECNICO); + cmd.Parameters.AddWithValue("@DEMITIDO", f.DEMITIDO); + + cmd.Parameters.AddWithValue("@FTECNICO", (object?)f.FTECNICO ?? DBNull.Value); + cmd.Parameters.AddWithValue("@FVENDEDOR", (object?)f.FVENDEDOR ?? DBNull.Value); + cmd.Parameters.AddWithValue("@FPATH", (object?)f.FPATH ?? DBNull.Value); + cmd.Parameters.AddWithValue("@OBSERV", (object?)f.OBSERV ?? DBNull.Value); + + cmd.Parameters.AddWithValue("@DATA_ADM", f.DATA_ADM ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@DATA_DEM", f.DATA_DEM ?? (object)DBNull.Value); + cmd.Parameters.AddWithValue("@ANIVER", f.ANIVER ?? (object)DBNull.Value); + } + #endregion + + #region MODEL + private void PreencherModelo(ModeloFuncionarios f, SqlDataReader dr) + { + f.ID_FUNCIONARIO = Convert.ToInt32(dr["ID_FUNCIONARIO"]); + f.CODIGO = dr["CODIGO"]?.ToString(); + f.NOME = dr["NOME"]?.ToString(); + f.PAI = dr["PAI"]?.ToString(); + f.MAE = dr["MAE"]?.ToString(); + f.CPF = dr["CPF"]?.ToString(); + f.CI = dr["CI"]?.ToString(); + f.CTPS = dr["CTPS"]?.ToString(); + f.CNH = dr["CNH"]?.ToString(); + f.CAT_CNH = dr["CAT_CNH"]?.ToString(); + f.ECIVIL = dr["ECIVIL"]?.ToString(); + f.REGIME = dr["REGIME"]?.ToString(); + + f.CEP = dr["CEP"]?.ToString(); + f.ENDERECO = dr["ENDERECO"]?.ToString(); + f.ENDNUMERO = dr["ENDNUMERO"]?.ToString(); + f.BAIRRO = dr["BAIRRO"]?.ToString(); + f.CIDADE = dr["CIDADE"]?.ToString(); + f.UF = dr["UF"]?.ToString(); + + f.BANCO = dr["BANCO"]?.ToString(); + f.AGENCIA = dr["AGENCIA"]?.ToString(); + f.CONTA = dr["CONTA"]?.ToString(); + f.TELEFONE = dr["TELEFONE"]?.ToString(); + f.PASS = dr["PASS"]?.ToString(); + + f.MASTERUSER = dr["MASTERUSER"] != DBNull.Value && Convert.ToBoolean(dr["MASTERUSER"]); + f.VENDEDOR = dr["VENDEDOR"] != DBNull.Value && Convert.ToBoolean(dr["VENDEDOR"]); + f.TECNICO = dr["TECNICO"] != DBNull.Value && Convert.ToBoolean(dr["TECNICO"]); + f.DEMITIDO = dr["DEMITIDO"] != DBNull.Value && Convert.ToBoolean(dr["DEMITIDO"]); + + f.FTECNICO = dr["FTECNICO"]?.ToString(); + f.FVENDEDOR = dr["FVENDEDOR"]?.ToString(); + f.FPATH = dr["FPATH"]?.ToString(); + f.OBSERV = dr["OBSERV"]?.ToString(); + + f.DATA_ADM = dr["DATA_ADM"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dr["DATA_ADM"]); + f.DATA_DEM = dr["DATA_DEM"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dr["DATA_DEM"]); + f.ANIVER = dr["ANIVER"] == DBNull.Value ? null : (DateTime?)Convert.ToDateTime(dr["ANIVER"]); + } + #endregion + } +} \ No newline at end of file diff --git a/DAL/DALLBackupService.cs b/DAL/DALLBackupService.cs new file mode 100644 index 0000000..1b6762f --- /dev/null +++ b/DAL/DALLBackupService.cs @@ -0,0 +1,174 @@ +using System; +using System.Data; +using Microsoft.Data.SqlClient; + +namespace DALL +{ + public class DALLBackupService + { + private readonly string _connectionString; + + public DALLBackupService(string connectionString) + { + _connectionString = connectionString; + } + + // ============================================= + // Backup FULL + // ============================================= + public BackupResult ExecutarBackupFull() + { + return ExecutarProcedure("sp_BackupFull", "FULL"); + } + + // ============================================= + // Backup DIFERENCIAL + // ============================================= + public BackupResult ExecutarBackupDiferencial() + { + return ExecutarProcedure("sp_BackupDiferencial", "DIFERENCIAL"); + } + + // ============================================= + // Limpeza de backups antigos + // ============================================= + public BackupResult ExecutarLimpeza() + { + return ExecutarProcedure("sp_LimpezaBackups", "LIMPEZA"); + } + + // ============================================= + // Restauração — FULL ou DIFERENCIAL + // ============================================= + public BackupResult RestaurarBackup(string caminhoArquivo, TipoRestauracao tipo) + { + var resultado = new BackupResult { Tipo = "RESTAURACAO", Inicio = DateTime.Now }; + + try + { + using var connection = new SqlConnection(_connectionString); + connection.Open(); + + using var command = new SqlCommand("master.dbo.sp_RestaurarBackup", connection) + { + CommandType = CommandType.StoredProcedure, + CommandTimeout = 3600 + }; + + command.Parameters.AddWithValue("@Arquivo", caminhoArquivo); + command.Parameters.AddWithValue("@Tipo", tipo == TipoRestauracao.Full ? "F" : "D"); + + connection.InfoMessage += (s, e) => + resultado.Mensagens += e.Message + Environment.NewLine; + + command.ExecuteNonQuery(); + + resultado.Sucesso = true; + resultado.Fim = DateTime.Now; + } + catch (Exception ex) + { + resultado.Sucesso = false; + resultado.Erro = ex.Message; + resultado.Fim = DateTime.Now; + } + + return resultado; + } + + // ============================================= + // Lista backups disponíveis no histórico + // ============================================= + public DataTable ListarHistoricoBackups() + { + var tabela = new DataTable(); + + try + { + using var connection = new SqlConnection(_connectionString); + connection.Open(); + + var query = @" + SELECT + CASE bs.type + WHEN 'D' THEN 'FULL' + WHEN 'I' THEN 'DIFERENCIAL' + END AS Tipo, + bmf.physical_device_name AS Arquivo, + bs.backup_start_date AS Inicio, + bs.backup_finish_date AS Fim, + CAST(bs.backup_size / 1024.0 / 1024.0 AS DECIMAL(10,2)) AS TamanhoMB + FROM msdb.dbo.backupset bs + JOIN msdb.dbo.backupmediafamily bmf + ON bs.media_set_id = bmf.media_set_id + WHERE bs.database_name = 'Levelcode-LevelOS' + ORDER BY bs.backup_finish_date DESC"; + + using var adapter = new SqlDataAdapter(query, connection); + adapter.Fill(tabela); + } + catch (Exception ex) + { + Console.WriteLine($"Erro ao listar histórico: {ex.Message}"); + } + + return tabela; + } + + // ============================================= + // Método interno reutilizável + // ============================================= + private BackupResult ExecutarProcedure(string procedure, string tipo) + { + var resultado = new BackupResult { Tipo = tipo, Inicio = DateTime.Now }; + + try + { + using var connection = new SqlConnection(_connectionString); + connection.Open(); + + using var command = new SqlCommand($"[Levelcode-LevelOS].dbo.{procedure}", connection) + { + CommandType = CommandType.StoredProcedure, + CommandTimeout = 3600 + }; + + connection.InfoMessage += (s, e) => + resultado.Mensagens += e.Message + Environment.NewLine; + + command.ExecuteNonQuery(); + + resultado.Sucesso = true; + resultado.Fim = DateTime.Now; + } + catch (Exception ex) + { + resultado.Sucesso = false; + resultado.Erro = ex.Message; + resultado.Fim = DateTime.Now; + } + + return resultado; + } + } + + // ============================================= + // Modelos + // ============================================= + public class BackupResult + { + public string Tipo { get; set; } = string.Empty; + public bool Sucesso { get; set; } + public DateTime Inicio { get; set; } + public DateTime Fim { get; set; } + public string? Erro { get; set; } + public string Mensagens { get; set; } = string.Empty; + public TimeSpan Duracao => Fim - Inicio; + } + + public enum TipoRestauracao + { + Full, + Diferencial + } +} \ No newline at end of file diff --git a/DAL/DadosDaConexao.cs b/DAL/DadosDaConexao.cs new file mode 100644 index 0000000..dffbb12 --- /dev/null +++ b/DAL/DadosDaConexao.cs @@ -0,0 +1,62 @@ +using Microsoft.Data.SqlClient; + +namespace DAL +{ + public static class DadosDaConexao + { + // ===== CONFIG ===== + public static string Host { get; set; } = string.Empty; + public static int Port { get; set; } = 1433; + + public static string Banco { get; set; } = string.Empty; + + public static string Usuario { get; set; } = string.Empty; + public static string Senha { get; set; } = string.Empty; + + public static int ConnectTimeout { get; set; } = 3; + public static bool Encrypt { get; set; } = true; + public static bool TrustServerCertificate { get; set; } = true; + + public static readonly string ObjetoStringConexao = ObterConexao(); + + // ===== CONEXÃO ===== + public static string ObterConexao() + { + if (string.IsNullOrWhiteSpace(Host)) + return string.Empty; + + var cs = new SqlConnectionStringBuilder + { + DataSource = $"{Host},{Port}", + InitialCatalog = Banco, + UserID = Usuario, + Password = Senha, + ConnectTimeout = ConnectTimeout, + Encrypt = Encrypt, + TrustServerCertificate = TrustServerCertificate + }; + + return cs.ConnectionString; + } + + // ===== TESTE ===== + public static bool TestarConexao() + { + var cs = ObterConexao(); + + if (string.IsNullOrWhiteSpace(cs)) + return false; + + try + { + using var conn = new SqlConnection(cs); + conn.Open(); + return true; + } + catch + { + return false; + } + } + } +} \ No newline at end of file diff --git a/MLL/MLL.csproj b/MLL/MLL.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/MLL/MLL.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/MLL/ModeloAgenda.cs b/MLL/ModeloAgenda.cs new file mode 100644 index 0000000..df75ea8 --- /dev/null +++ b/MLL/ModeloAgenda.cs @@ -0,0 +1,46 @@ +using System; + +namespace MLL +{ + public class ModeloAgenda + { + public ModeloAgenda() + { + this.ID_AGENDA = 0; + this.CODIGO = string.Empty; + this.COMPROMISSO = string.Empty; + this.dDATA = string.Empty; + this.AVISAR = string.Empty; + this.FUNC = string.Empty; + this.DIA = string.Empty; + this.HORA = string.Empty; + this.REALIZADO = string.Empty; + this.OS_VINC = string.Empty; + + } + public ModeloAgenda(int iD_AGENDA, string cODIGO, string cOMPROMISSO, string dDATA, string aVISAR, string fUNC, string dIA, string hORA, string rEALIZADO, string oS_VINC) + { + ID_AGENDA = iD_AGENDA; + CODIGO = cODIGO; + COMPROMISSO = cOMPROMISSO; + this.dDATA = dDATA; + AVISAR = aVISAR; + FUNC = fUNC; + DIA = dIA; + HORA = hORA; + REALIZADO = rEALIZADO; + OS_VINC = oS_VINC; + } + + public int ID_AGENDA { get; set; } + public string CODIGO { get; set; } + public string COMPROMISSO { get; set; } + public string dDATA { get; set; } + public string AVISAR { get; set; } + public string FUNC { get; set; } + public string DIA { get; set; } + public string HORA { get; set; } + public string REALIZADO { get; set; } + public string OS_VINC { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloBancos.cs b/MLL/ModeloBancos.cs new file mode 100644 index 0000000..1d9dbda --- /dev/null +++ b/MLL/ModeloBancos.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloBancos + { + // ✅ Construtor vazio (OBRIGATÓRIO pro seu DAL) + public ModeloBancos() + { + } + + // ✅ Construtor completo + public ModeloBancos(int id, string numero, string nome) + { + ID_BANCOS = id; + NUMERO = numero; + NOME = nome; + } + + public int ID_BANCOS { get; set; } + + public string NUMERO { get; set; } + + public string NOME { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloBoletos.cs b/MLL/ModeloBoletos.cs new file mode 100644 index 0000000..29a1124 --- /dev/null +++ b/MLL/ModeloBoletos.cs @@ -0,0 +1,56 @@ +using System; + +namespace MLL +{ + public class ModeloBoletos + { + public ModeloBoletos(int iD_BOLETO, string cODIGO, string eMITIDO, string vENCE, string vALOR, string nUMERO, string pG, string sACADO, string cONTA, string oBSERVACAO, string cOD_CONTA, string nOSSO_NUMERO, string aCEITE, string iMPRESSO, string iMPORTACAO) + { + ID_BOLETO = iD_BOLETO; + CODIGO = cODIGO; + EMITIDO = eMITIDO; + VENCE = vENCE; + VALOR = vALOR; + NUMERO = nUMERO; + PG = pG; + SACADO = sACADO; + CONTA = cONTA; + OBSERVACAO = oBSERVACAO; + COD_CONTA = cOD_CONTA; + NOSSO_NUMERO = nOSSO_NUMERO; + ACEITE = aCEITE; + IMPRESSO = iMPRESSO; + IMPORTACAO = iMPORTACAO; + } + + public int ID_BOLETO { get; set; } + + public string CODIGO { get; set; } + + public string EMITIDO { get; set; } + + public string VENCE { get; set; } + + public string VALOR { get; set; } + + public string NUMERO { get; set; } + + public string PG { get; set; } + + public string SACADO { get; set; } + + public string CONTA { get; set; } + + public string OBSERVACAO { get; set; } + + public string COD_CONTA { get; set; } + + public string NOSSO_NUMERO { get; set; } + + public string ACEITE { get; set; } + + public string IMPRESSO { get; set; } + + public string IMPORTACAO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCalibracao.cs b/MLL/ModeloCalibracao.cs new file mode 100644 index 0000000..1b916f4 --- /dev/null +++ b/MLL/ModeloCalibracao.cs @@ -0,0 +1,27 @@ +using System; + +namespace MLL +{ + public class ModeloCalibracao + { + public ModeloCalibracao(int ID_codigo, string cODIGO, string oS_NUMERO, string dATA, string tEMP, string hUMIDADE, string rESPONSABEL, string oBSERV) + { + ID_CALIBRACAO = ID_codigo; + CODIGO = cODIGO; + OS_NUMERO = oS_NUMERO; + DATA = dATA; + TEMP = tEMP; + HUMIDADE = hUMIDADE; + RESPONSABEL = rESPONSABEL; + OBSERV = oBSERV; + } + public int ID_CALIBRACAO { get; set; } + public string CODIGO { get; set; } + public string OS_NUMERO { get; set; } + public string DATA { get; set; } + public string TEMP { get; set; } + public string HUMIDADE { get; set; } + public string RESPONSABEL { get; set; } + public string OBSERV { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCalibracaoEnsaio.cs b/MLL/ModeloCalibracaoEnsaio.cs new file mode 100644 index 0000000..9d382b0 --- /dev/null +++ b/MLL/ModeloCalibracaoEnsaio.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloCalibracaoEnsaio + { + public ModeloCalibracaoEnsaio(int iD_CALIBRACAO_ENSAIO, string cOD_CALIBRACAO, string dESCRICAO, string mINIMO, string mAXIMO, string oBTIDO, string uNIDADE) + { + ID_CALIBRACAO_ENSAIO = iD_CALIBRACAO_ENSAIO; + COD_CALIBRACAO = cOD_CALIBRACAO; + DESCRICAO = dESCRICAO; + MINIMO = mINIMO; + MAXIMO = mAXIMO; + OBTIDO = oBTIDO; + UNIDADE = uNIDADE; + }//METODO: Construtor para a classe ModeloCalibracaoEnsaio + + public int ID_CALIBRACAO_ENSAIO { get; set; } + public string COD_CALIBRACAO { get; set; } + public string DESCRICAO { get; set; } + public string MINIMO { get; set; } + public string MAXIMO { get; set; } + public string OBTIDO { get; set; } + public string UNIDADE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCalibracaoPadrao.cs b/MLL/ModeloCalibracaoPadrao.cs new file mode 100644 index 0000000..486e3ec --- /dev/null +++ b/MLL/ModeloCalibracaoPadrao.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloCalibracaoPadrao + { + public ModeloCalibracaoPadrao(int iD_CALIBRACAO_PADRAO, string cODIGO, string oS_NUMERO, string dATA, string tEMP, string hUMIDADE, string rESPONSABEL, string oBSERV) + { + ID_CALIBRACAO_PADRAO = iD_CALIBRACAO_PADRAO; + CODIGO = cODIGO; + OS_NUMERO = oS_NUMERO; + DATA = dATA; + TEMP = tEMP; + HUMIDADE = hUMIDADE; + RESPONSABEL = rESPONSABEL; + OBSERV = oBSERV; + } + + public int ID_CALIBRACAO_PADRAO { get; set; } + public string CODIGO { get; set; } + public string OS_NUMERO { get; set; } + public string DATA { get; set; } + public string TEMP { get; set; } + public string HUMIDADE { get; set; } + public string RESPONSABEL { get; set; } + public string OBSERV { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCalibracaoPadraoEnsaios.cs b/MLL/ModeloCalibracaoPadraoEnsaios.cs new file mode 100644 index 0000000..8e14fa9 --- /dev/null +++ b/MLL/ModeloCalibracaoPadraoEnsaios.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloCalibracaoPadraoEnsaios + { + public ModeloCalibracaoPadraoEnsaios(int iD_CAL_PADRAO_ENSAIOS, string cODIGO, string cOD_CALIBRACAO, string dESCRICAO, string mINIMO, string mAXIMO, string oBTIDO, string uNIDADE) + { + ID_CAL_PADRAO_ENSAIOS = iD_CAL_PADRAO_ENSAIOS; + CODIGO = cODIGO; + COD_CALIBRACAO = cOD_CALIBRACAO; + DESCRICAO = dESCRICAO; + MINIMO = mINIMO; + MAXIMO = mAXIMO; + OBTIDO = oBTIDO; + UNIDADE = uNIDADE; + }// Construtor sem parâmetros + + public int ID_CAL_PADRAO_ENSAIOS { get; set; } + public string CODIGO { get; set; } + public string COD_CALIBRACAO { get; set; } + public string DESCRICAO { get; set; } + public string MINIMO { get; set; } + public string MAXIMO { get; set; } + public string OBTIDO { get; set; } + public string UNIDADE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCartoes.cs b/MLL/ModeloCartoes.cs new file mode 100644 index 0000000..a81e8d5 --- /dev/null +++ b/MLL/ModeloCartoes.cs @@ -0,0 +1,44 @@ +using System; + +namespace MLL +{ + public class ModeloCartoes + { + public ModeloCartoes(int iD_COD_CARTAO, string cODIGO, string bANDEIRA, string nUM_CARTAO, string nOME, string vALIDADE, string aUTORIZACAO, string pARCELAS, string vALOR, string cOD_CLIENTE, string rESUMO, string dEBITO, string cOD_CONTA, string dIA, string cOMPENSADO, string oBS_COMP) + { + ID_COD_CARTAO = iD_COD_CARTAO; + CODIGO = cODIGO; + BANDEIRA = bANDEIRA; + NUM_CARTAO = nUM_CARTAO; + NOME = nOME; + VALIDADE = vALIDADE; + AUTORIZACAO = aUTORIZACAO; + PARCELAS = pARCELAS; + VALOR = vALOR; + COD_CLIENTE = cOD_CLIENTE; + RESUMO = rESUMO; + DEBITO = dEBITO; + COD_CONTA = cOD_CONTA; + DIA = dIA; + COMPENSADO = cOMPENSADO; + OBS_COMP = oBS_COMP; + } + + public int ID_COD_CARTAO { get; set; } + public string CODIGO { get; set; } + public string BANDEIRA { get; set; } + public string NUM_CARTAO { get; set; } + public string NOME { get; set; } + public string VALIDADE { get; set; } + public string AUTORIZACAO { get; set; } + public string PARCELAS { get; set; } + public string VALOR { get; set; } + public string COD_CLIENTE { get; set; } + public string RESUMO { get; set; } + public string DEBITO { get; set; } + public string COD_CONTA { get; set; } + public string DIA { get; set; } + public string COMPENSADO { get; set; } + public string OBS_COMP { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloChamado.cs b/MLL/ModeloChamado.cs new file mode 100644 index 0000000..1764d5e --- /dev/null +++ b/MLL/ModeloChamado.cs @@ -0,0 +1,41 @@ +using System; + +namespace MLL +{ + public class ModeloChamado + { + public ModeloChamado(int iD_CHAMADO, string cODIGO, string tIPO, + string cOD_CLIENTE, string nOME_AVULSO, string fONES, string + eMAIL, string pARA, string pRIORIDADE, string rEALIZADO, string dIA_CHAMADO, + string oBS, string eNDER_CLI) + { + ID_CHAMADO = iD_CHAMADO; + CODIGO = cODIGO; + TIPO = tIPO; + COD_CLIENTE = cOD_CLIENTE; + NOME_AVULSO = nOME_AVULSO; + FONES = fONES; + EMAIL = eMAIL; + PARA = pARA; + PRIORIDADE = pRIORIDADE; + REALIZADO = rEALIZADO; + DIA_CHAMADO = dIA_CHAMADO; + OBS = oBS; + ENDER_CLI = eNDER_CLI; + } + + public int ID_CHAMADO { get; set; } + public string CODIGO { get; set; } + public string TIPO { get; set; } + public string COD_CLIENTE { get; set; } + public string NOME_AVULSO { get; set; } + public string FONES { get; set; } + public string EMAIL { get; set; } + public string PARA { get; set; } + public string PRIORIDADE { get; set; } + public string REALIZADO { get; set; } + public string DIA_CHAMADO { get; set; } + public string OBS { get; set; } + public string ENDER_CLI { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloChegues.cs b/MLL/ModeloChegues.cs new file mode 100644 index 0000000..1c05418 --- /dev/null +++ b/MLL/ModeloChegues.cs @@ -0,0 +1,46 @@ +using System; + +namespace MLL +{ + public class ModeloChegues + { + public ModeloChegues(int iD_CHEGUES, string cODIGO, string bANCO, string aGENCIA, + string vALOR, string cLIENTE, string fORNECEDOR, string eMITIDO, string cOMPENSAR, + string oK, string tIPO, string cONTA, string nUMERO, string oBS, string cOD_CONTA, string eMITENTE) + { + ID_CHEGUES = iD_CHEGUES; + CODIGO = cODIGO; + BANCO = bANCO; + AGENCIA = aGENCIA; + VALOR = vALOR; + CLIENTE = cLIENTE; + FORNECEDOR = fORNECEDOR; + EMITIDO = eMITIDO; + COMPENSAR = cOMPENSAR; + OK = oK; + TIPO = tIPO; + CONTA = cONTA; + NUMERO = nUMERO; + OBS = oBS; + COD_CONTA = cOD_CONTA; + EMITENTE = eMITENTE; + } + + public int ID_CHEGUES { get; set; } + public string CODIGO { get; set; } + public string BANCO { get; set; } + public string AGENCIA { get; set; } + public string VALOR { get; set; } + public string CLIENTE { get; set; } + public string FORNECEDOR { get; set; } + public string EMITIDO { get; set; } + public string COMPENSAR { get; set; } + public string OK { get; set; } + public string TIPO { get; set; } + public string CONTA { get; set; } + public string NUMERO { get; set; } + public string OBS { get; set; } + public string COD_CONTA { get; set; } + public string EMITENTE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCliente.cs b/MLL/ModeloCliente.cs new file mode 100644 index 0000000..40a9f4a --- /dev/null +++ b/MLL/ModeloCliente.cs @@ -0,0 +1,106 @@ +public class ModeloCliente +{ + public ModeloCliente() + { + } + public ModeloCliente(int id, int empresaId, string nome, string nomeFantasia, string tipoPessoa, string documento, string rG, string inscricaoMunicipal, DateTime? dataNascimento, string contato, string telefone1, string telefone2, string celular, string whatsapp, string email, string emailNFe, string site, string grupo, string cep, string endereco, int? numero, string complemento, string bairro, string cidade, string uF, string pais, decimal limiteCredito, bool bloqueado, string observacoesCobranca, int? vendedorPadraoId, string tipoConsumidor, string observacoes, string campoExtra1, string campoExtra2, string campoExtra3, string bitcoin, string ethereum, string litecoin, bool ativo, DateTime? ultimaCompra, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + NomeFantasia = nomeFantasia; + TipoPessoa = tipoPessoa; + Documento = documento; + RG = rG; + InscricaoMunicipal = inscricaoMunicipal; + DataNascimento = dataNascimento; + Contato = contato; + Telefone1 = telefone1; + Telefone2 = telefone2; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + EmailNFe = emailNFe; + Site = site; + Grupo = grupo; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + Pais = pais; + LimiteCredito = limiteCredito; + Bloqueado = bloqueado; + ObservacoesCobranca = observacoesCobranca; + VendedorPadraoId = vendedorPadraoId; + TipoConsumidor = tipoConsumidor; + Observacoes = observacoes; + CampoExtra1 = campoExtra1; + CampoExtra2 = campoExtra2; + CampoExtra3 = campoExtra3; + Bitcoin = bitcoin; + Ethereum = ethereum; + Litecoin = litecoin; + Ativo = ativo; + UltimaCompra = ultimaCompra; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string NomeFantasia { get; set; } + public string TipoPessoa { get; set; } + public string Documento { get; set; } + + public string RG { get; set; } + public string InscricaoMunicipal { get; set; } + public DateTime? DataNascimento { get; set; } + + public string Contato { get; set; } + public string Telefone1 { get; set; } + public string Telefone2 { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + public string EmailNFe { get; set; } + public string Site { get; set; } + + public string Grupo { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int? Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + public string Pais { get; set; } + + public decimal LimiteCredito { get; set; } + public bool Bloqueado { get; set; } + public string ObservacoesCobranca { get; set; } + + public int? VendedorPadraoId { get; set; } + public string TipoConsumidor { get; set; } + + public string Observacoes { get; set; } + + public string CampoExtra1 { get; set; } + public string CampoExtra2 { get; set; } + public string CampoExtra3 { get; set; } + + public string Bitcoin { get; set; } + public string Ethereum { get; set; } + public string Litecoin { get; set; } + + public bool Ativo { get; set; } + public DateTime? UltimaCompra { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloClientesEnderecos.cs b/MLL/ModeloClientesEnderecos.cs new file mode 100644 index 0000000..492172c --- /dev/null +++ b/MLL/ModeloClientesEnderecos.cs @@ -0,0 +1,34 @@ +using System; + +namespace MLL +{ + public class ModeloClientesEnderecos + { + public ModeloClientesEnderecos(int iD_COD_CLIENTE_END, string cODIGO, string cOD_CLIENTE, string lOGRADOURO, string nUMERO, string cOMPLEM, string bAIRRO, string cIDADE, string uF, string cEP, string dATA_CADASTRO) + { + ID_COD_CLIENTE_END = iD_COD_CLIENTE_END; + CODIGO = cODIGO; + COD_CLIENTE = cOD_CLIENTE; + LOGRADOURO = lOGRADOURO; + NUMERO = nUMERO; + COMPLEM = cOMPLEM; + BAIRRO = bAIRRO; + CIDADE = cIDADE; + UF = uF; + CEP = cEP; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_COD_CLIENTE_END { get; set; } + public string CODIGO { get; set; } + public string COD_CLIENTE { get; set; } + public string LOGRADOURO { get; set; } + public string NUMERO { get; set; } + public string COMPLEM { get; set; } + public string BAIRRO { get; set; } + public string CIDADE { get; set; } + public string UF { get; set; } + public string CEP { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloConfig.cs b/MLL/ModeloConfig.cs new file mode 100644 index 0000000..a016b19 --- /dev/null +++ b/MLL/ModeloConfig.cs @@ -0,0 +1,264 @@ +using System; + +namespace MLL +{ + public class ModeloConfig + { + public ModeloConfig(int iD_CONFIG, string eSTOQUE, string oFICINA, + string bANCO, string cONTAS, string vENDASL1, string vENDASL2, + string mODELOVENDA, string pRNPORTVENDA, string cOPIASVENDA, + string vERSAO, string sERIAL, string sERIAL2, string sMTP_SERVER, + string sMTP_USER, string sMTP_PASS, string sMTP_TIT, string sMTP_EMAIL, + string sMTP_CC, string sMTP_PORT, string sMTP_SSL, string sMTP_COK, + string oFICINADONO, string nOSSONUMERO, string rEVENDA, string cOMISS_VENDAS, + string mAXDES_VENDAS, string cARTAO_REG_OK, string cARTAO_DEBT_DIRETO, + string cARTAO_CRED_DIRETO, string cARTAO_CRED_COMISS, string cARTAO_DEBT_COMISS, + string vERSAOP, string sHCompras, string nFE_FORMA_EMISSAO, string cARTAO_CRED_PARCELA, + string sMTP_SEMAUTENTICA, string nFE_ENFE, string nFE_EMAIL_OK, string dATA_CADASTRO, + string uLTIMA_IMPRESSAO, string dATA_SAIDA, string iMPRESSA, string fRETE_NUMERO, + string dESTINATARIO_NOME, string dESTINATARIO_ENDERECO, string dESTINATARIO_BAIRRO, + string dESTINATARIO_CIDADE, string dESTINATARIO_UF, string dESTINATARIO_CEP, + string dESTINATARIO_COD_PAIS, string dESTINATARIO_TEL, string dESTINATARIO_FAX, + string dESTINATARIO_EMAIL, string dESTINATARIO_IE_RG, string dESTINATARIO_CNPJCPF, + string vALOR_DESCONTO, string vALOR_IRRF, string vALOR_IRPJ, string vALOR_PIS, + string vALOR_COFINS, string vALOR_CSLL, string vALOR_BENEF, string vALOR_INSS, + string vALOR_SIMPLES, string tOTAL_DESC, string tOTAL_DEDUCOES, string tOTAL_SERVICOS, + string tOTAL_PRODUTOS, string tOTAL_ISS, string tOTAL_IRRF, string tOTAL_IRPJ, + string tOTAL_PIS, string tOTAL_COFINS, string tOTAL_CSLL, string tOTAL_INSS, + string tOTAL_SIMPLES, string fRETE_NOME, string fRETE_UF, string fRETE_CNPJCPF, + string fRETE_IERG, string fRETE_ENDERECO, string fRETE_MUNICIPIO, string fRETE_TUF, + string dB_cs_ICMS_S, string dB_cs_FRETE, string dB_cs_SEGURO, string dB_cs_DESPESAS, + string dB_cin_FRETE, string dB_cin_SEGURO, string dB_cin_DESPESAS, string dB_cin_DESCONTO, + string dB_cs_ISS, string dB_cs_IRRF, string dB_cs_IRPJ, string dB_cs_PIS, string dB_cs_COFINS, + string dB_cs_CSLL, string dB_cs_INSS, string dB_cs_SIMPLES, string v_FRETE, string v_SEGURO, + string v_OUTROS, string cOD_FAB) + { + ID_CONFIG = iD_CONFIG; + ESTOQUE = eSTOQUE; + OFICINA = oFICINA; + BANCO = bANCO; + CONTAS = cONTAS; + VENDASL1 = vENDASL1; + VENDASL2 = vENDASL2; + MODELOVENDA = mODELOVENDA; + PRNPORTVENDA = pRNPORTVENDA; + COPIASVENDA = cOPIASVENDA; + VERSAO = vERSAO; + SERIAL = sERIAL; + SERIAL2 = sERIAL2; + SMTP_SERVER = sMTP_SERVER; + SMTP_USER = sMTP_USER; + SMTP_PASS = sMTP_PASS; + SMTP_TIT = sMTP_TIT; + SMTP_EMAIL = sMTP_EMAIL; + SMTP_CC = sMTP_CC; + SMTP_PORT = sMTP_PORT; + SMTP_SSL = sMTP_SSL; + SMTP_COK = sMTP_COK; + OFICINADONO = oFICINADONO; + NOSSONUMERO = nOSSONUMERO; + REVENDA = rEVENDA; + COMISS_VENDAS = cOMISS_VENDAS; + MAXDES_VENDAS = mAXDES_VENDAS; + CARTAO_REG_OK = cARTAO_REG_OK; + CARTAO_DEBT_DIRETO = cARTAO_DEBT_DIRETO; + CARTAO_CRED_DIRETO = cARTAO_CRED_DIRETO; + CARTAO_CRED_COMISS = cARTAO_CRED_COMISS; + CARTAO_DEBT_COMISS = cARTAO_DEBT_COMISS; + VERSAOP = vERSAOP; + SHCompras = sHCompras; + NFE_FORMA_EMISSAO = nFE_FORMA_EMISSAO; + CARTAO_CRED_PARCELA = cARTAO_CRED_PARCELA; + SMTP_SEMAUTENTICA = sMTP_SEMAUTENTICA; + NFE_ENFE = nFE_ENFE; + NFE_EMAIL_OK = nFE_EMAIL_OK; + DATA_CADASTRO = dATA_CADASTRO; + ULTIMA_IMPRESSAO = uLTIMA_IMPRESSAO; + DATA_SAIDA = dATA_SAIDA; + IMPRESSA = iMPRESSA; + FRETE_NUMERO = fRETE_NUMERO; + DESTINATARIO_NOME = dESTINATARIO_NOME; + DESTINATARIO_ENDERECO = dESTINATARIO_ENDERECO; + DESTINATARIO_BAIRRO = dESTINATARIO_BAIRRO; + DESTINATARIO_CIDADE = dESTINATARIO_CIDADE; + DESTINATARIO_UF = dESTINATARIO_UF; + DESTINATARIO_CEP = dESTINATARIO_CEP; + DESTINATARIO_COD_PAIS = dESTINATARIO_COD_PAIS; + DESTINATARIO_TEL = dESTINATARIO_TEL; + DESTINATARIO_FAX = dESTINATARIO_FAX; + DESTINATARIO_EMAIL = dESTINATARIO_EMAIL; + DESTINATARIO_IE_RG = dESTINATARIO_IE_RG; + DESTINATARIO_CNPJCPF = dESTINATARIO_CNPJCPF; + VALOR_DESCONTO = vALOR_DESCONTO; + VALOR_IRRF = vALOR_IRRF; + VALOR_IRPJ = vALOR_IRPJ; + VALOR_PIS = vALOR_PIS; + VALOR_COFINS = vALOR_COFINS; + VALOR_CSLL = vALOR_CSLL; + VALOR_BENEF = vALOR_BENEF; + VALOR_INSS = vALOR_INSS; + VALOR_SIMPLES = vALOR_SIMPLES; + TOTAL_DESC = tOTAL_DESC; + TOTAL_DEDUCOES = tOTAL_DEDUCOES; + TOTAL_SERVICOS = tOTAL_SERVICOS; + TOTAL_PRODUTOS = tOTAL_PRODUTOS; + TOTAL_ISS = tOTAL_ISS; + TOTAL_IRRF = tOTAL_IRRF; + TOTAL_IRPJ = tOTAL_IRPJ; + TOTAL_PIS = tOTAL_PIS; + TOTAL_COFINS = tOTAL_COFINS; + TOTAL_CSLL = tOTAL_CSLL; + TOTAL_INSS = tOTAL_INSS; + TOTAL_SIMPLES = tOTAL_SIMPLES; + FRETE_NOME = fRETE_NOME; + FRETE_UF = fRETE_UF; + FRETE_CNPJCPF = fRETE_CNPJCPF; + FRETE_IERG = fRETE_IERG; + FRETE_ENDERECO = fRETE_ENDERECO; + FRETE_MUNICIPIO = fRETE_MUNICIPIO; + FRETE_TUF = fRETE_TUF; + DB_cs_ICMS_S = dB_cs_ICMS_S; + DB_cs_FRETE = dB_cs_FRETE; + DB_cs_SEGURO = dB_cs_SEGURO; + DB_cs_DESPESAS = dB_cs_DESPESAS; + DB_cin_FRETE = dB_cin_FRETE; + DB_cin_SEGURO = dB_cin_SEGURO; + DB_cin_DESPESAS = dB_cin_DESPESAS; + DB_cin_DESCONTO = dB_cin_DESCONTO; + DB_cs_ISS = dB_cs_ISS; + DB_cs_IRRF = dB_cs_IRRF; + DB_cs_IRPJ = dB_cs_IRPJ; + DB_cs_PIS = dB_cs_PIS; + DB_cs_COFINS = dB_cs_COFINS; + DB_cs_CSLL = dB_cs_CSLL; + DB_cs_INSS = dB_cs_INSS; + DB_cs_SIMPLES = dB_cs_SIMPLES; + V_FRETE = v_FRETE; + V_SEGURO = v_SEGURO; + V_OUTROS = v_OUTROS; + COD_FAB = cOD_FAB; + } + + public int ID_CONFIG { get; set; } + public string ESTOQUE { get; set; } + public string OFICINA { get; set; } + public string BANCO { get; set; } + public string CONTAS { get; set; } + public string VENDASL1 { get; set; } + public string VENDASL2 { get; set; } + public string MODELOVENDA { get; set; } + public string PRNPORTVENDA { get; set; } + public string COPIASVENDA { get; set; } + public string VERSAO { get; set; } + public string SERIAL { get; set; } + public string SERIAL2 { get; set; } + + public string SMTP_SERVER { get; set; } + public string SMTP_USER { get; set; } + public string SMTP_PASS { get; set; } + public string SMTP_TIT { get; set; } + public string SMTP_EMAIL { get; set; } + public string SMTP_CC { get; set; } + public string SMTP_PORT { get; set; } + public string SMTP_SSL { get; set; } + public string SMTP_COK { get; set; } + + public string OFICINADONO { get; set; } + public string NOSSONUMERO { get; set; } + public string REVENDA { get; set; } + + public string COMISS_VENDAS { get; set; } + public string MAXDES_VENDAS { get; set; } + + public string CARTAO_REG_OK { get; set; } + public string CARTAO_DEBT_DIRETO { get; set; } + public string CARTAO_CRED_DIRETO { get; set; } + public string CARTAO_CRED_COMISS { get; set; } + public string CARTAO_DEBT_COMISS { get; set; } + + public string VERSAOP { get; set; } + public string SHCompras { get; set; } + public string NFE_FORMA_EMISSAO { get; set; } + public string CARTAO_CRED_PARCELA { get; set; } + public string SMTP_SEMAUTENTICA { get; set; } + + public string NFE_ENFE { get; set; } + public string NFE_EMAIL_OK { get; set; } + + public string DATA_CADASTRO { get; set; } + public string ULTIMA_IMPRESSAO { get; set; } + public string DATA_SAIDA { get; set; } + public string IMPRESSA { get; set; } + + public string FRETE_NUMERO { get; set; } + + public string DESTINATARIO_NOME { get; set; } + public string DESTINATARIO_ENDERECO { get; set; } + public string DESTINATARIO_BAIRRO { get; set; } + public string DESTINATARIO_CIDADE { get; set; } + public string DESTINATARIO_UF { get; set; } + public string DESTINATARIO_CEP { get; set; } + public string DESTINATARIO_COD_PAIS { get; set; } + public string DESTINATARIO_TEL { get; set; } + public string DESTINATARIO_FAX { get; set; } + public string DESTINATARIO_EMAIL { get; set; } + public string DESTINATARIO_IE_RG { get; set; } + public string DESTINATARIO_CNPJCPF { get; set; } + + public string VALOR_DESCONTO { get; set; } + public string VALOR_IRRF { get; set; } + public string VALOR_IRPJ { get; set; } + public string VALOR_PIS { get; set; } + public string VALOR_COFINS { get; set; } + public string VALOR_CSLL { get; set; } + public string VALOR_BENEF { get; set; } + public string VALOR_INSS { get; set; } + public string VALOR_SIMPLES { get; set; } + + public string TOTAL_DESC { get; set; } + public string TOTAL_DEDUCOES { get; set; } + public string TOTAL_SERVICOS { get; set; } + public string TOTAL_PRODUTOS { get; set; } + public string TOTAL_ISS { get; set; } + public string TOTAL_IRRF { get; set; } + public string TOTAL_IRPJ { get; set; } + public string TOTAL_PIS { get; set; } + public string TOTAL_COFINS { get; set; } + public string TOTAL_CSLL { get; set; } + public string TOTAL_INSS { get; set; } + public string TOTAL_SIMPLES { get; set; } + + public string FRETE_NOME { get; set; } + public string FRETE_UF { get; set; } + public string FRETE_CNPJCPF { get; set; } + public string FRETE_IERG { get; set; } + public string FRETE_ENDERECO { get; set; } + public string FRETE_MUNICIPIO { get; set; } + public string FRETE_TUF { get; set; } + + public string DB_cs_ICMS_S { get; set; } + public string DB_cs_FRETE { get; set; } + public string DB_cs_SEGURO { get; set; } + public string DB_cs_DESPESAS { get; set; } + + public string DB_cin_FRETE { get; set; } + public string DB_cin_SEGURO { get; set; } + public string DB_cin_DESPESAS { get; set; } + public string DB_cin_DESCONTO { get; set; } + + public string DB_cs_ISS { get; set; } + public string DB_cs_IRRF { get; set; } + public string DB_cs_IRPJ { get; set; } + public string DB_cs_PIS { get; set; } + public string DB_cs_COFINS { get; set; } + public string DB_cs_CSLL { get; set; } + public string DB_cs_INSS { get; set; } + public string DB_cs_SIMPLES { get; set; } + + public string V_FRETE { get; set; } + public string V_SEGURO { get; set; } + public string V_OUTROS { get; set; } + + public string COD_FAB { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloContaPagar.cs b/MLL/ModeloContaPagar.cs new file mode 100644 index 0000000..3cc02b6 --- /dev/null +++ b/MLL/ModeloContaPagar.cs @@ -0,0 +1,51 @@ +public class ModeloContaPagar +{ + public ModeloContaPagar(int id, int empresaId, int fornecedorId, int planoContaId, string descricao, decimal valor, decimal? valorPago, decimal juros, decimal multa, decimal desconto, string status, DateTime? dataEmissao, DateTime dataVencimento, DateTime? dataPagamento, string observacoes, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + FornecedorId = fornecedorId; + PlanoContaId = planoContaId; + Descricao = descricao; + Valor = valor; + ValorPago = valorPago; + Juros = juros; + Multa = multa; + Desconto = desconto; + Status = status; + DataEmissao = dataEmissao; + DataVencimento = dataVencimento; + DataPagamento = dataPagamento; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public int FornecedorId { get; set; } + public int PlanoContaId { get; set; } + + public string Descricao { get; set; } + + public decimal Valor { get; set; } + public decimal? ValorPago { get; set; } + + public decimal Juros { get; set; } + public decimal Multa { get; set; } + public decimal Desconto { get; set; } + + public string Status { get; set; } + + public DateTime? DataEmissao { get; set; } + public DateTime DataVencimento { get; set; } + public DateTime? DataPagamento { get; set; } + + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloContaReceber.cs b/MLL/ModeloContaReceber.cs new file mode 100644 index 0000000..e14de0e --- /dev/null +++ b/MLL/ModeloContaReceber.cs @@ -0,0 +1,54 @@ +public class ModeloContaReceber +{ + public ModeloContaReceber(int id, int empresaId, int clienteId, int planoContaId, int? contratoId, string descricao, decimal valor, decimal? valorPago, decimal juros, decimal multa, decimal desconto, string status, DateTime? dataEmissao, DateTime dataVencimento, DateTime? dataPagamento, string observacoes, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + ClienteId = clienteId; + PlanoContaId = planoContaId; + ContratoId = contratoId; + Descricao = descricao; + Valor = valor; + ValorPago = valorPago; + Juros = juros; + Multa = multa; + Desconto = desconto; + Status = status; + DataEmissao = dataEmissao; + DataVencimento = dataVencimento; + DataPagamento = dataPagamento; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public int ClienteId { get; set; } + public int PlanoContaId { get; set; } + + public int? ContratoId { get; set; } + + public string Descricao { get; set; } + + public decimal Valor { get; set; } + public decimal? ValorPago { get; set; } + + public decimal Juros { get; set; } + public decimal Multa { get; set; } + public decimal Desconto { get; set; } + + public string Status { get; set; } + + public DateTime? DataEmissao { get; set; } + public DateTime DataVencimento { get; set; } + public DateTime? DataPagamento { get; set; } + + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloContas.cs b/MLL/ModeloContas.cs new file mode 100644 index 0000000..fcc5715 --- /dev/null +++ b/MLL/ModeloContas.cs @@ -0,0 +1,90 @@ +using System; + +namespace MLL +{ + public class ModeloContas + { + public ModeloContas(int iD_CONTAS, string cODIGO, string tIPO, string cLIENTE, string fORNECEDOR, + string cOD_CLIENTE, string cOD_FORNECEDOR, string vENCIMENTO, string pAGO, + string pLANO_CONTAS, string oBSERVACAO, string vALOR, string rEFERENCIA, + string fCOBRANCA, string pARCELA, string eCF_DINHEIRO, string eCF_CHEQUE, + string eCF_CARTAO, string eCF_BOLETO, string eCF_TROCO, string dATA_DOCTO, + string jUROS, string dESCONTO, string cFOP, string cLISTSERV, string pMVAST, + string pREDBCST, string vBCICMSST, string aICMSST, string vICMSST, string dATA_PGTO, + string cOD_CORRENTE, string oBS_COB) + { + ID_CONTAS = iD_CONTAS; + CODIGO = cODIGO; + TIPO = tIPO; + CLIENTE = cLIENTE; + FORNECEDOR = fORNECEDOR; + COD_CLIENTE = cOD_CLIENTE; + COD_FORNECEDOR = cOD_FORNECEDOR; + VENCIMENTO = vENCIMENTO; + PAGO = pAGO; + PLANO_CONTAS = pLANO_CONTAS; + OBSERVACAO = oBSERVACAO; + VALOR = vALOR; + REFERENCIA = rEFERENCIA; + FCOBRANCA = fCOBRANCA; + PARCELA = pARCELA; + ECF_DINHEIRO = eCF_DINHEIRO; + ECF_CHEQUE = eCF_CHEQUE; + ECF_CARTAO = eCF_CARTAO; + ECF_BOLETO = eCF_BOLETO; + ECF_TROCO = eCF_TROCO; + DATA_DOCTO = dATA_DOCTO; + JUROS = jUROS; + DESCONTO = dESCONTO; + CFOP = cFOP; + CLISTSERV = cLISTSERV; + PMVAST = pMVAST; + PREDBCST = pREDBCST; + VBCICMSST = vBCICMSST; + AICMSST = aICMSST; + VICMSST = vICMSST; + DATA_PGTO = dATA_PGTO; + COD_CORRENTE = cOD_CORRENTE; + OBS_COB = oBS_COB; + } + + public int ID_CONTAS { get; set; } + public string CODIGO { get; set; } + public string TIPO { get; set; } + public string CLIENTE { get; set; } + public string FORNECEDOR { get; set; } + public string COD_CLIENTE { get; set; } + public string COD_FORNECEDOR { get; set; } + public string VENCIMENTO { get; set; } + public string PAGO { get; set; } + public string PLANO_CONTAS { get; set; } + public string OBSERVACAO { get; set; } + public string VALOR { get; set; } + public string REFERENCIA { get; set; } + public string FCOBRANCA { get; set; } + public string PARCELA { get; set; } + + public string ECF_DINHEIRO { get; set; } + public string ECF_CHEQUE { get; set; } + public string ECF_CARTAO { get; set; } + public string ECF_BOLETO { get; set; } + public string ECF_TROCO { get; set; } + + public string DATA_DOCTO { get; set; } + public string JUROS { get; set; } + public string DESCONTO { get; set; } + + public string CFOP { get; set; } + public string CLISTSERV { get; set; } + + public string PMVAST { get; set; } + public string PREDBCST { get; set; } + public string VBCICMSST { get; set; } + public string AICMSST { get; set; } + public string VICMSST { get; set; } + + public string DATA_PGTO { get; set; } + public string COD_CORRENTE { get; set; } + public string OBS_COB { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloContasContas.cs b/MLL/ModeloContasContas.cs new file mode 100644 index 0000000..9ff40b7 --- /dev/null +++ b/MLL/ModeloContasContas.cs @@ -0,0 +1,20 @@ +using System; + +namespace MLL +{ + public class ModeloContasContas + { + public ModeloContasContas(int iD_CONTAS_CONTAS, string cODIGO, string dESCRICAO, string sALDO_INI) + { + ID_CONTAS_CONTAS = iD_CONTAS_CONTAS; + CODIGO = cODIGO; + DESCRICAO = dESCRICAO; + SALDO_INI = sALDO_INI; + } + + public int ID_CONTAS_CONTAS { get; set; } + public string CODIGO { get; set; } + public string DESCRICAO { get; set; } + public string SALDO_INI { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloContasDeposito.cs b/MLL/ModeloContasDeposito.cs new file mode 100644 index 0000000..b867feb --- /dev/null +++ b/MLL/ModeloContasDeposito.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MLL +{ + public class ModeloContasDeposito + { + public ModeloContasDeposito(int iD_COD_CONTA_DEPO, string? cODIGO, string? cOD_CORRENTE, + string? cOD_LANCTO, string? vALOR, string? dATA_CADASTRO) + { + ID_COD_CONTA_DEPO = iD_COD_CONTA_DEPO; + CODIGO = cODIGO; + COD_CORRENTE = cOD_CORRENTE; + COD_LANCTO = cOD_LANCTO; + VALOR = vALOR; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_COD_CONTA_DEPO { get; set; } + public string? CODIGO { get; set; } + public string? COD_CORRENTE { get; set; } + public string? COD_LANCTO { get; set; } + public string? VALOR { get; set; } + public string? DATA_CADASTRO { get; set; } + } +} diff --git a/MLL/ModeloContasPagar.cs b/MLL/ModeloContasPagar.cs new file mode 100644 index 0000000..2e91a95 --- /dev/null +++ b/MLL/ModeloContasPagar.cs @@ -0,0 +1,62 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace MLL // Ou o namespace de sua preferência +{ + // Opcional: Para Entity Framework, especifica o nome da tabela e o schema + // [Table("ContasPagar", Schema = "dbo")] + public class ModeloContasPagar + { + // [Key] // Opcional: Indica que esta é a chave primária + // [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID + public int Id { get; set; } + + public int EmpresaId { get; set; } + public int FornecedorId { get; set; } + public int PlanoContaId { get; set; } + + // [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF + public string? Descricao { get; set; } // varchar(255) NULL -> string? + + public decimal Valor { get; set; } // decimal(10, 2) NOT NULL -> decimal + + public DateTime? DataEmissao { get; set; } // date NULL -> DateTime? + + public DateTime DataVencimento { get; set; } // date NOT NULL -> DateTime + + public DateTime? DataPagamento { get; set; } // date NULL -> DateTime? + + // [StringLength(20)] // Opcional: Para validação de tamanho + public string Status { get; set; } = "Pendente"; // varchar(20) NOT NULL com DEFAULT -> string. Inicializado com o valor padrão. + + public decimal? ValorPago { get; set; } // decimal(10, 2) NULL -> decimal? + + public decimal? Juros { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public decimal? Multa { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public decimal? Desconto { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public string? Observacoes { get; set; } // varchar(max) NULL -> string? + + public bool Ativo { get; set; } = true; // bit NOT NULL com DEFAULT -> bool. Inicializado com o valor padrão. + + public DateTime? CriadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + public DateTime? AtualizadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + + // Opcional: Propriedades de navegação para relacionamentos (para ORMs como Entity Framework) + /* + [ForeignKey("EmpresaId")] + public virtual ModeloEmpresa? Empresa { get; set; } // Assumindo que você tem um modelo ModeloEmpresa + + [ForeignKey("FornecedorId")] + public virtual ModeloFornecedor? Fornecedor { get; set; } // Assumindo que você tem um modelo ModeloFornecedor + + [ForeignKey("PlanoContaId")] + public virtual ModeloPlanoDeContas? PlanoDeContas { get; set; } // Assumindo que você tem um modelo ModeloPlanoDeContas + */ + } +} \ No newline at end of file diff --git a/MLL/ModeloContasReceber.cs b/MLL/ModeloContasReceber.cs new file mode 100644 index 0000000..e8a226c --- /dev/null +++ b/MLL/ModeloContasReceber.cs @@ -0,0 +1,66 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace MLL // Ou o namespace de sua preferência +{ + // Opcional: Para Entity Framework, especifica o nome da tabela e o schema + // [Table("ContasReceber", Schema = "dbo")] + public class ModeloContasReceber + { + // [Key] // Opcional: Indica que esta é a chave primária + // [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID + public int Id { get; set; } + + public int EmpresaId { get; set; } + public int ClienteId { get; set; } + public int PlanoContaId { get; set; } + public int? ContratoId { get; set; } // int NULL -> int? + + // [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF + public string? Descricao { get; set; } // varchar(255) NULL -> string? + + public decimal Valor { get; set; } // decimal(10, 2) NOT NULL -> decimal + + public DateTime? DataEmissao { get; set; } // date NULL -> DateTime? + + public DateTime DataVencimento { get; set; } // date NOT NULL -> DateTime + + public DateTime? DataPagamento { get; set; } // date NULL -> DateTime? + + // [StringLength(20)] // Opcional: Para validação de tamanho + public string Status { get; set; } = "Pendente"; // varchar(20) NOT NULL com DEFAULT -> string. Inicializado com o valor padrão. + + public decimal? ValorPago { get; set; } // decimal(10, 2) NULL -> decimal? + + public decimal? Juros { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public decimal? Multa { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public decimal? Desconto { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão. + + public string? Observacoes { get; set; } // varchar(max) NULL -> string? + + public bool Ativo { get; set; } = true; // bit NOT NULL com DEFAULT -> bool. Inicializado com o valor padrão. + + public DateTime? CriadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + public DateTime? AtualizadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + + // Opcional: Propriedades de navegação para relacionamentos (para ORMs como Entity Framework) + /* + [ForeignKey("EmpresaId")] + public virtual ModeloEmpresa? Empresa { get; set; } // Assumindo que você tem um modelo ModeloEmpresa + + [ForeignKey("ClienteId")] + public virtual ModeloCliente? Cliente { get; set; } // Assumindo que você tem um modelo ModeloCliente + + [ForeignKey("PlanoContaId")] + public virtual ModeloPlanoDeContas? PlanoDeContas { get; set; } // Assumindo que você tem um modelo ModeloPlanoDeContas + + [ForeignKey("ContratoId")] + public virtual ModeloContrato? Contrato { get; set; } // Assumindo que você tem um modelo ModeloContrato + */ + } +} \ No newline at end of file diff --git a/MLL/ModeloContrato.cs b/MLL/ModeloContrato.cs new file mode 100644 index 0000000..b658315 --- /dev/null +++ b/MLL/ModeloContrato.cs @@ -0,0 +1,47 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace MLL // Ou o namespace de sua preferência +{ + // Opcional: Para Entity Framework, especifica o nome da tabela e o schema + // [Table("Contratos", Schema = "dbo")] + public class ModeloContrato + { + // [Key] // Opcional: Indica que esta é a chave primária + // [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID + public int Id { get; set; } + + public int EmpresaId { get; set; } + public int ClienteId { get; set; } + + // [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF + public string? Descricao { get; set; } // varchar(255) NULL -> string? + + public string? Observacoes { get; set; } // varchar(max) NULL -> string? + + public decimal Valor { get; set; } // decimal(10, 2) NOT NULL -> decimal + + public DateTime? DataInicio { get; set; } // date NULL -> DateTime? + + public DateTime? DataValidade { get; set; } // date NULL -> DateTime? + + public int? FranquiaTempo { get; set; } // int NULL -> int? + + public bool Ativo { get; set; } = true; // bit NOT NULL com DEFAULT -> bool. Inicializado com o valor padrão. + + public DateTime? CriadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + public DateTime? AtualizadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime? + + + // Opcional: Propriedades de navegação para relacionamentos (para ORMs como Entity Framework) + /* + [ForeignKey("EmpresaId")] + public virtual ModeloEmpresa? Empresa { get; set; } // Assumindo que você tem um modelo ModeloEmpresa + + [ForeignKey("ClienteId")] + public virtual ModeloCliente? Cliente { get; set; } // Assumindo que você tem um modelo ModeloCliente + */ + } +} \ No newline at end of file diff --git a/MLL/ModeloContratoEquipamentos.cs b/MLL/ModeloContratoEquipamentos.cs new file mode 100644 index 0000000..ebad413 --- /dev/null +++ b/MLL/ModeloContratoEquipamentos.cs @@ -0,0 +1,41 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace MLL // Ou o namespace de sua preferência +{ + // Opcional: Para Entity Framework, especifica o nome da tabela e o schema + // [Table("ContratoEquipamentos", Schema = "dbo")] + public class ModeloContratoEquipamentos + { + // [Key] // Opcional: Indica que esta é a chave primária + // [Column("Id_equipamentos")] // Opcional: Se o nome da propriedade C# for diferente do nome da coluna SQL + // [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID + public int Id_equipamentos { get; set; } + + public int ContratoId { get; set; } + + // [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF + public string? Modelo { get; set; } // varchar(255) NULL -> string? + + // [StringLength(255)] + public string? Marca { get; set; } // varchar(255) NULL -> string? + + // [StringLength(100)] + public string? Operadora { get; set; } // varchar(100) NULL -> string? + + // [StringLength(100)] + public string? Serial { get; set; } // varchar(100) NULL -> string? + + // [StringLength(100)] + public string? NumeroPatrimonio { get; set; } // varchar(100) NULL -> string? + + public string? Observacoes { get; set; } // varchar(max) NULL -> string? + + // Opcional: Propriedade de navegação para o relacionamento com Contratos (para ORMs como Entity Framework) + /* + [ForeignKey("ContratoId")] + public virtual ModeloContrato? Contrato { get; set; } // Assumindo que você tenha um modelo ModeloContrato para a tabela [dbo].[Contratos] + */ + } +} \ No newline at end of file diff --git a/MLL/ModeloConvenioBoletos.cs b/MLL/ModeloConvenioBoletos.cs new file mode 100644 index 0000000..2bdc142 --- /dev/null +++ b/MLL/ModeloConvenioBoletos.cs @@ -0,0 +1,62 @@ +using System; + +namespace MLL +{ + public class ModeloConvenioBoletos + { + public ModeloConvenioBoletos(int iD_CONVENIO_BOLETOS, string cODIGO, string bANCO, + string cARTEIRA, string cONVENIO, string aGENCIA, string cONTA, string nOME_CEDENTE, + string lOCAL_PGTO, string iNSTRU_01, string iNSTRU_02, string iNSTRU_03, string iNSTRU_04, + string iNSTRU_05, string iNSTRU_06, string iNSTRU_07, string iNSTRU_08, string iNSTRU_09, + string iNSTRU_10, string dIAS_PROTESTO, string tIPO_DOC_COB, string tIPO_ESP_DOC) + { + ID_CONVENIO_BOLETOS = iD_CONVENIO_BOLETOS; + CODIGO = cODIGO; + BANCO = bANCO; + CARTEIRA = cARTEIRA; + CONVENIO = cONVENIO; + AGENCIA = aGENCIA; + CONTA = cONTA; + NOME_CEDENTE = nOME_CEDENTE; + LOCAL_PGTO = lOCAL_PGTO; + INSTRU_01 = iNSTRU_01; + INSTRU_02 = iNSTRU_02; + INSTRU_03 = iNSTRU_03; + INSTRU_04 = iNSTRU_04; + INSTRU_05 = iNSTRU_05; + INSTRU_06 = iNSTRU_06; + INSTRU_07 = iNSTRU_07; + INSTRU_08 = iNSTRU_08; + INSTRU_09 = iNSTRU_09; + INSTRU_10 = iNSTRU_10; + DIAS_PROTESTO = dIAS_PROTESTO; + TIPO_DOC_COB = tIPO_DOC_COB; + TIPO_ESP_DOC = tIPO_ESP_DOC; + } + + public int ID_CONVENIO_BOLETOS { get; set; } + public string CODIGO { get; set; } + public string BANCO { get; set; } + public string CARTEIRA { get; set; } + public string CONVENIO { get; set; } + public string AGENCIA { get; set; } + public string CONTA { get; set; } + public string NOME_CEDENTE { get; set; } + public string LOCAL_PGTO { get; set; } + + public string INSTRU_01 { get; set; } + public string INSTRU_02 { get; set; } + public string INSTRU_03 { get; set; } + public string INSTRU_04 { get; set; } + public string INSTRU_05 { get; set; } + public string INSTRU_06 { get; set; } + public string INSTRU_07 { get; set; } + public string INSTRU_08 { get; set; } + public string INSTRU_09 { get; set; } + public string INSTRU_10 { get; set; } + + public string DIAS_PROTESTO { get; set; } + public string TIPO_DOC_COB { get; set; } + public string TIPO_ESP_DOC { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloConvenioCartoes.cs b/MLL/ModeloConvenioCartoes.cs new file mode 100644 index 0000000..3088a90 --- /dev/null +++ b/MLL/ModeloConvenioCartoes.cs @@ -0,0 +1,38 @@ +using System; + +namespace MLL +{ + public class ModeloConvenioCartoes + { + public ModeloConvenioCartoes(int iD_CONV_CARTOES, string cODIGO, string nOME, + string cOMIS_CRED, string cOMIS_DEBT, string oP_CRED, string oP_DEBT, string lANCA_30, + string cNPJ_OPERADORA, string tBand) + { + ID_CONV_CARTOES = iD_CONV_CARTOES; + CODIGO = cODIGO; + NOME = nOME; + COMIS_CRED = cOMIS_CRED; + COMIS_DEBT = cOMIS_DEBT; + OP_CRED = oP_CRED; + OP_DEBT = oP_DEBT; + LANCA_30 = lANCA_30; + CNPJ_OPERADORA = cNPJ_OPERADORA; + this.tBand = tBand; + } + + public int ID_CONV_CARTOES { get; set; } + public string CODIGO { get; set; } + public string NOME { get; set; } + + public string COMIS_CRED { get; set; } + public string COMIS_DEBT { get; set; } + + public string OP_CRED { get; set; } + public string OP_DEBT { get; set; } + + public string LANCA_30 { get; set; } + + public string CNPJ_OPERADORA { get; set; } + public string tBand { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloCoordImpres.cs b/MLL/ModeloCoordImpres.cs new file mode 100644 index 0000000..aeea64d --- /dev/null +++ b/MLL/ModeloCoordImpres.cs @@ -0,0 +1,34 @@ +using System; + +namespace MLL +{ + public class ModeloCoordImpres + { + public ModeloCoordImpres(int iD_COORD_IMPRES, string cODIGO, string cOD_MODELO, + string nOME_CAMPO, string cOD_CAMPO, string tIPO, string cX, string cY, string cOMP, + string aTIVO) + { + ID_COORD_IMPRES = iD_COORD_IMPRES; + CODIGO = cODIGO; + COD_MODELO = cOD_MODELO; + NOME_CAMPO = nOME_CAMPO; + COD_CAMPO = cOD_CAMPO; + TIPO = tIPO; + CX = cX; + CY = cY; + COMP = cOMP; + ATIVO = aTIVO; + } + + public int ID_COORD_IMPRES { get; set; } + public string CODIGO { get; set; } + public string COD_MODELO { get; set; } + public string NOME_CAMPO { get; set; } + public string COD_CAMPO { get; set; } + public string TIPO { get; set; } + public string CX { get; set; } + public string CY { get; set; } + public string COMP { get; set; } + public string ATIVO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloDespFixa.cs b/MLL/ModeloDespFixa.cs new file mode 100644 index 0000000..ee24a5a --- /dev/null +++ b/MLL/ModeloDespFixa.cs @@ -0,0 +1,29 @@ +using System; + +namespace MLL +{ + public class ModeloDespFixa + { + public ModeloDespFixa(int iD_DESP_FIXA, string cODIGO, string tIPO, + string cOD_CLIENTE, string vENCIMENTO, string pLANO_CONTAS, string oBSERVACAO, string vALOR) + { + ID_DESP_FIXA = iD_DESP_FIXA; + CODIGO = cODIGO; + TIPO = tIPO; + COD_CLIENTE = cOD_CLIENTE; + VENCIMENTO = vENCIMENTO; + PLANO_CONTAS = pLANO_CONTAS; + OBSERVACAO = oBSERVACAO; + VALOR = vALOR; + } + + public int ID_DESP_FIXA { get; set; } + public string CODIGO { get; set; } + public string TIPO { get; set; } + public string COD_CLIENTE { get; set; } + public string VENCIMENTO { get; set; } + public string PLANO_CONTAS { get; set; } + public string OBSERVACAO { get; set; } + public string VALOR { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloDespesas.cs b/MLL/ModeloDespesas.cs new file mode 100644 index 0000000..d52a243 --- /dev/null +++ b/MLL/ModeloDespesas.cs @@ -0,0 +1,27 @@ +using System; + +namespace MLL +{ + public class ModeloDespesas + { + public ModeloDespesas(int iD_DESPESAS, string cODIGO, string pROCESSO, + string dESCRICAO, string vALOR, string pAGO, string dIA) + { + ID_DESPESAS = iD_DESPESAS; + CODIGO = cODIGO; + PROCESSO = pROCESSO; + DESCRICAO = dESCRICAO; + VALOR = vALOR; + PAGO = pAGO; + DIA = dIA; + } + + public int ID_DESPESAS { get; set; } + public string CODIGO { get; set; } + public string PROCESSO { get; set; } + public string DESCRICAO { get; set; } + public string VALOR { get; set; } + public string PAGO { get; set; } + public string DIA { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEcfCfg.cs b/MLL/ModeloEcfCfg.cs new file mode 100644 index 0000000..7891880 --- /dev/null +++ b/MLL/ModeloEcfCfg.cs @@ -0,0 +1,25 @@ +using System; + +namespace MLL +{ + public class ModeloEcfCfg + { + public ModeloEcfCfg(int iD_EFC_CFG, string cODIGO, string mODELO, + string pORTA, string tEM_GAVETA, string iNDICE_AL_SERV) + { + ID_EFC_CFG = iD_EFC_CFG; + CODIGO = cODIGO; + MODELO = mODELO; + PORTA = pORTA; + TEM_GAVETA = tEM_GAVETA; + INDICE_AL_SERV = iNDICE_AL_SERV; + } + + public int ID_EFC_CFG { get; set; } + public string CODIGO { get; set; } + public string MODELO { get; set; } + public string PORTA { get; set; } + public string TEM_GAVETA { get; set; } + public string INDICE_AL_SERV { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEmpresa.cs b/MLL/ModeloEmpresa.cs new file mode 100644 index 0000000..f4f9034 --- /dev/null +++ b/MLL/ModeloEmpresa.cs @@ -0,0 +1,77 @@ +namespace MLL +{ + public class ModeloEmpresa + { + public ModeloEmpresa() + { + } + public ModeloEmpresa(int id, string nome, string cNPJ, string tipoEmpresa, string regimeTributario, string cNAE, string cep, string endereco, int numero, string complemento, string bairro, string cidade, string uF, string pais, string telefone1, string telefone2, string celular, string whatsapp, string email, string site, string inscricaoEstadual, string inscricaoMunicipal, string cNPJCPF_Contador, string nome_Contador, string textoParaRecibo, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + Nome = nome; + CNPJ = cNPJ; + TipoEmpresa = tipoEmpresa; + RegimeTributario = regimeTributario; + CNAE = cNAE; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + Pais = pais; + Telefone1 = telefone1; + Telefone2 = telefone2; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + Site = site; + InscricaoEstadual = inscricaoEstadual; + InscricaoMunicipal = inscricaoMunicipal; + CNPJCPF_Contador = cNPJCPF_Contador; + Nome_Contador = nome_Contador; + TextoParaRecibo = textoParaRecibo; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + + public string Nome { get; set; } + public string CNPJ { get; set; } + public string TipoEmpresa { get; set; } + public string RegimeTributario { get; set; } + public string CNAE { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + public string Pais { get; set; } + + public string Telefone1 { get; set; } + public string Telefone2 { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + public string Site { get; set; } + + public string InscricaoEstadual { get; set; } + public string InscricaoMunicipal { get; set; } + + public string CNPJCPF_Contador { get; set; } + public string Nome_Contador { get; set; } + + public string TextoParaRecibo { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEmpresaConfig.cs b/MLL/ModeloEmpresaConfig.cs new file mode 100644 index 0000000..503c147 --- /dev/null +++ b/MLL/ModeloEmpresaConfig.cs @@ -0,0 +1,52 @@ +public class ModeloEmpresaConfig +{ + public ModeloEmpresaConfig() { } + public ModeloEmpresaConfig(int idEmpresaConfig, int idEmpresa, string nomeSistema, string corPrimaria, string corSecundaria, string logo, string favicon, bool exibirCPFCliente, bool exibirTelefoneCliente, bool exibirGarantia, int diasGarantiaPadrao, bool gerarReciboAutomatico, bool exibirValoresOS, bool enviarEmailAutomatico, bool enviarWhatsappAutomatico, bool modoEscuro, bool permitirEdicaoOSFinalizada, DateTime criadoEm, DateTime atualizadoEm) + { + IdEmpresaConfig = idEmpresaConfig; + IdEmpresa = idEmpresa; + NomeSistema = nomeSistema; + CorPrimaria = corPrimaria; + CorSecundaria = corSecundaria; + Logo = logo; + Favicon = favicon; + ExibirCPFCliente = exibirCPFCliente; + ExibirTelefoneCliente = exibirTelefoneCliente; + ExibirGarantia = exibirGarantia; + DiasGarantiaPadrao = diasGarantiaPadrao; + GerarReciboAutomatico = gerarReciboAutomatico; + ExibirValoresOS = exibirValoresOS; + EnviarEmailAutomatico = enviarEmailAutomatico; + EnviarWhatsappAutomatico = enviarWhatsappAutomatico; + ModoEscuro = modoEscuro; + PermitirEdicaoOSFinalizada = permitirEdicaoOSFinalizada; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int IdEmpresaConfig { get; set; } + public int IdEmpresa { get; set; } + + public string NomeSistema { get; set; } + public string CorPrimaria { get; set; } + public string CorSecundaria { get; set; } + public string Logo { get; set; } + public string Favicon { get; set; } + + public bool ExibirCPFCliente { get; set; } + public bool ExibirTelefoneCliente { get; set; } + public bool ExibirGarantia { get; set; } + public int DiasGarantiaPadrao { get; set; } + + public bool GerarReciboAutomatico { get; set; } + public bool ExibirValoresOS { get; set; } + + public bool EnviarEmailAutomatico { get; set; } + public bool EnviarWhatsappAutomatico { get; set; } + + public bool ModoEscuro { get; set; } + public bool PermitirEdicaoOSFinalizada { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloEmpresas.cs b/MLL/ModeloEmpresas.cs new file mode 100644 index 0000000..6ea3dc8 --- /dev/null +++ b/MLL/ModeloEmpresas.cs @@ -0,0 +1,147 @@ +using System; + +namespace MLL +{ + public class ModeloEmpresas + { + public ModeloEmpresas(int iD_EMPRESAS, string cODIGO, string nOME, string fANTASIA, + string eNDERECO, string nUMERO, string cOMPLEM, string bAIRRO, string cIDADE, + string uF, string cEP, string cNPJ_CPF, string rG_IE, string eMAIL, string sITE, + string tELEFONE, string fAX, string mOVEL, string cONTATOS, string cNAE, string cOD_MUNICIPIO, + string i_IRRF, string i_IRPJ, string i_CSLL, string i_INSS, string i_ISS, string i_COFINS, + string i_ICMSF, string i_PISPASEP, string i_RETEM, string oBS_NOTA_PADR, string iNS_MUNICIPAL, + string nF_ICMS_S, string nF_FRETE, string nF_SEGURO, string nF_DESPESAS, string nF_cin_FRETE, + string nF_cin_SEGURO, string nF_cin_DESPESAS, string nF_cin_DESCONTO, string nF_ISS, string nF_IRRF, + string nF_IRPJ, string nF_PIS, string nF_COFINS, string nF_CSLL, string nF_INSS, string lCP116, string cFOP_SERV, + string rEGIME, string mYLOGO_NFE, string mYLOGO_RECIBOS, string cARTEIRA_CRYPTOMOEDA1, string cARTEIRA_CRYPTOMOEDA2, + string cARTEIRA_CRYPTOMOEDA3) + { + ID_EMPRESAS = iD_EMPRESAS; + CODIGO = cODIGO; + NOME = nOME; + FANTASIA = fANTASIA; + ENDERECO = eNDERECO; + NUMERO = nUMERO; + COMPLEM = cOMPLEM; + BAIRRO = bAIRRO; + CIDADE = cIDADE; + UF = uF; + CEP = cEP; + CNPJ_CPF = cNPJ_CPF; + RG_IE = rG_IE; + EMAIL = eMAIL; + SITE = sITE; + TELEFONE = tELEFONE; + FAX = fAX; + MOVEL = mOVEL; + CONTATOS = cONTATOS; + CNAE = cNAE; + COD_MUNICIPIO = cOD_MUNICIPIO; + I_IRRF = i_IRRF; + I_IRPJ = i_IRPJ; + I_CSLL = i_CSLL; + I_INSS = i_INSS; + I_ISS = i_ISS; + I_COFINS = i_COFINS; + I_ICMSF = i_ICMSF; + I_PISPASEP = i_PISPASEP; + I_RETEM = i_RETEM; + OBS_NOTA_PADR = oBS_NOTA_PADR; + INS_MUNICIPAL = iNS_MUNICIPAL; + NF_ICMS_S = nF_ICMS_S; + NF_FRETE = nF_FRETE; + NF_SEGURO = nF_SEGURO; + NF_DESPESAS = nF_DESPESAS; + NF_cin_FRETE = nF_cin_FRETE; + NF_cin_SEGURO = nF_cin_SEGURO; + NF_cin_DESPESAS = nF_cin_DESPESAS; + NF_cin_DESCONTO = nF_cin_DESCONTO; + NF_ISS = nF_ISS; + NF_IRRF = nF_IRRF; + NF_IRPJ = nF_IRPJ; + NF_PIS = nF_PIS; + NF_COFINS = nF_COFINS; + NF_CSLL = nF_CSLL; + NF_INSS = nF_INSS; + LCP116 = lCP116; + CFOP_SERV = cFOP_SERV; + REGIME = rEGIME; + MYLOGO_NFE = mYLOGO_NFE; + MYLOGO_RECIBOS = mYLOGO_RECIBOS; + CARTEIRA_CRYPTOMOEDA1 = cARTEIRA_CRYPTOMOEDA1; + CARTEIRA_CRYPTOMOEDA2 = cARTEIRA_CRYPTOMOEDA2; + CARTEIRA_CRYPTOMOEDA3 = cARTEIRA_CRYPTOMOEDA3; + } + + public int ID_EMPRESAS { get; set; } + + public string CODIGO { get; set; } + public string NOME { get; set; } + public string FANTASIA { get; set; } + + public string ENDERECO { get; set; } + public string NUMERO { get; set; } + public string COMPLEM { get; set; } + public string BAIRRO { get; set; } + public string CIDADE { get; set; } + public string UF { get; set; } + public string CEP { get; set; } + + public string CNPJ_CPF { get; set; } + public string RG_IE { get; set; } + + public string EMAIL { get; set; } + public string SITE { get; set; } + + public string TELEFONE { get; set; } + public string FAX { get; set; } + public string MOVEL { get; set; } + public string CONTATOS { get; set; } + + public string CNAE { get; set; } + public string COD_MUNICIPIO { get; set; } + + public string I_IRRF { get; set; } + public string I_IRPJ { get; set; } + public string I_CSLL { get; set; } + public string I_INSS { get; set; } + public string I_ISS { get; set; } + public string I_COFINS { get; set; } + public string I_ICMSF { get; set; } + public string I_PISPASEP { get; set; } + public string I_RETEM { get; set; } + + public string OBS_NOTA_PADR { get; set; } + public string INS_MUNICIPAL { get; set; } + + public string NF_ICMS_S { get; set; } + public string NF_FRETE { get; set; } + public string NF_SEGURO { get; set; } + public string NF_DESPESAS { get; set; } + + public string NF_cin_FRETE { get; set; } + public string NF_cin_SEGURO { get; set; } + public string NF_cin_DESPESAS { get; set; } + public string NF_cin_DESCONTO { get; set; } + + public string NF_ISS { get; set; } + public string NF_IRRF { get; set; } + public string NF_IRPJ { get; set; } + public string NF_PIS { get; set; } + public string NF_COFINS { get; set; } + public string NF_CSLL { get; set; } + public string NF_INSS { get; set; } + + public string LCP116 { get; set; } + public string CFOP_SERV { get; set; } + + public string REGIME { get; set; } + + public string MYLOGO_NFE { get; set; } + public string MYLOGO_RECIBOS { get; set; } + + public string CARTEIRA_CRYPTOMOEDA1 { get; set; } + public string CARTEIRA_CRYPTOMOEDA2 { get; set; } + public string CARTEIRA_CRYPTOMOEDA3 { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEquipContratos.cs b/MLL/ModeloEquipContratos.cs new file mode 100644 index 0000000..39703e4 --- /dev/null +++ b/MLL/ModeloEquipContratos.cs @@ -0,0 +1,20 @@ +using System; + +namespace MLL +{ + public class ModeloEquipContratos + { + public ModeloEquipContratos(int iD_EQUIP_CONTRATOS, string cODIGO, string cOD_EQUIP, string cOD_CONTRATO) + { + ID_EQUIP_CONTRATOS = iD_EQUIP_CONTRATOS; + CODIGO = cODIGO; + COD_EQUIP = cOD_EQUIP; + COD_CONTRATO = cOD_CONTRATO; + } + + public int ID_EQUIP_CONTRATOS { get; set; } + public string CODIGO { get; set; } + public string COD_EQUIP { get; set; } + public string COD_CONTRATO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEquipamentos.cs b/MLL/ModeloEquipamentos.cs new file mode 100644 index 0000000..cd3b7c7 --- /dev/null +++ b/MLL/ModeloEquipamentos.cs @@ -0,0 +1,52 @@ +using System; + +namespace MLL +{ + public class ModeloEquipamentos + { + public ModeloEquipamentos(int iD_EQUIPAMENTOS, string cODIGO, string cOD_CLIENTE, + string dESCRICAO, string mARCA, string mODELO, string sERIE, string pAT, string oBSERVACOES, + string dATA_COMPRA, string rEVENDA, string nUM_NF, string nUM_CERTGAR, string cAMPO_BOOL, + string cAMPO_DOUBLE) + { + ID_EQUIPAMENTOS = iD_EQUIPAMENTOS; + CODIGO = cODIGO; + COD_CLIENTE = cOD_CLIENTE; + DESCRICAO = dESCRICAO; + MARCA = mARCA; + MODELO = mODELO; + SERIE = sERIE; + PAT = pAT; + OBSERVACOES = oBSERVACOES; + DATA_COMPRA = dATA_COMPRA; + REVENDA = rEVENDA; + NUM_NF = nUM_NF; + NUM_CERTGAR = nUM_CERTGAR; + CAMPO_BOOL = cAMPO_BOOL; + CAMPO_DOUBLE = cAMPO_DOUBLE; + } + + public int ID_EQUIPAMENTOS { get; set; } + + public string CODIGO { get; set; } + public string COD_CLIENTE { get; set; } + + public string DESCRICAO { get; set; } + public string MARCA { get; set; } + public string MODELO { get; set; } + + public string SERIE { get; set; } + public string PAT { get; set; } + + public string OBSERVACOES { get; set; } + + public string DATA_COMPRA { get; set; } + public string REVENDA { get; set; } + + public string NUM_NF { get; set; } + public string NUM_CERTGAR { get; set; } + + public string CAMPO_BOOL { get; set; } + public string CAMPO_DOUBLE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloEsquemas.cs b/MLL/ModeloEsquemas.cs new file mode 100644 index 0000000..0fa9d32 --- /dev/null +++ b/MLL/ModeloEsquemas.cs @@ -0,0 +1,30 @@ +using System; + +namespace MLL +{ + public class ModeloEsquemas + { + public ModeloEsquemas(int iD_ESQUEMAS, string cODIGO, string mARCA, string nOME, + string lOCAL, string fPATH, string oBS) + { + ID_ESQUEMAS = iD_ESQUEMAS; + CODIGO = cODIGO; + MARCA = mARCA; + NOME = nOME; + LOCAL = lOCAL; + FPATH = fPATH; + OBS = oBS; + } + + public int ID_ESQUEMAS { get; set; } + + public string CODIGO { get; set; } + public string MARCA { get; set; } + public string NOME { get; set; } + + public string LOCAL { get; set; } + public string FPATH { get; set; } + + public string OBS { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloFcaixa.cs b/MLL/ModeloFcaixa.cs new file mode 100644 index 0000000..7b5bc9e --- /dev/null +++ b/MLL/ModeloFcaixa.cs @@ -0,0 +1,36 @@ +using System; + +namespace MLL +{ + public class ModeloFcaixa + { + public ModeloFcaixa(int iD_FCAIXA, string cODIGO, string dIA, string rECEITA, + string dESPESA, string oBS, string pLANO_CONTAS, string cOD_CONTA, string fORMA) + { + ID_FCAIXA = iD_FCAIXA; + CODIGO = cODIGO; + DIA = dIA; + RECEITA = rECEITA; + DESPESA = dESPESA; + OBS = oBS; + PLANO_CONTAS = pLANO_CONTAS; + COD_CONTA = cOD_CONTA; + FORMA = fORMA; + } + + public int ID_FCAIXA { get; set; } + + public string CODIGO { get; set; } + public string DIA { get; set; } + + public string RECEITA { get; set; } + public string DESPESA { get; set; } + + public string OBS { get; set; } + + public string PLANO_CONTAS { get; set; } + public string COD_CONTA { get; set; } + + public string FORMA { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloFornecedor.cs b/MLL/ModeloFornecedor.cs new file mode 100644 index 0000000..047faed --- /dev/null +++ b/MLL/ModeloFornecedor.cs @@ -0,0 +1,59 @@ +public class ModeloFornecedor +{ + public ModeloFornecedor(int id, int empresaId, string nome, string tipoPessoa, string documento, string telefone, string celular, string whatsapp, string email, string cep, string endereco, int? numero, string complemento, string bairro, string cidade, string uF, string nomeFantasia, string inscricaoEstadual, string site, string observacoes, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + TipoPessoa = tipoPessoa; + Documento = documento; + Telefone = telefone; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + NomeFantasia = nomeFantasia; + InscricaoEstadual = inscricaoEstadual; + Site = site; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string TipoPessoa { get; set; } + public string Documento { get; set; } + + public string Telefone { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int? Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + + public string NomeFantasia { get; set; } + public string InscricaoEstadual { get; set; } + public string Site { get; set; } + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloFornecedores.cs b/MLL/ModeloFornecedores.cs new file mode 100644 index 0000000..cf85d1a --- /dev/null +++ b/MLL/ModeloFornecedores.cs @@ -0,0 +1,70 @@ +using System; + +namespace MLL +{ + public class ModeloFornecedores + { + public ModeloFornecedores(int id, int empresaId, string nome, string tipoPessoa, string documento, + string telefone, string celular, string whatsapp, string email, string cep, + string endereco, int? numero, string complemento, string bairro, string cidade, + string uF, string nomeFantasia, string inscricaoEstadual, string site, string observacoes, + bool ativo, DateTime? criadoEm, DateTime? atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + TipoPessoa = tipoPessoa; + Documento = documento; + Telefone = telefone; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + NomeFantasia = nomeFantasia; + InscricaoEstadual = inscricaoEstadual; + Site = site; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string TipoPessoa { get; set; } + public string Documento { get; set; } + + public string Telefone { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int? Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + + public string NomeFantasia { get; set; } + public string InscricaoEstadual { get; set; } + + public string Site { get; set; } + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + + public DateTime? CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloFornecerDE.cs b/MLL/ModeloFornecerDE.cs new file mode 100644 index 0000000..201082e --- /dev/null +++ b/MLL/ModeloFornecerDE.cs @@ -0,0 +1,23 @@ +using System; + +namespace MLL +{ + public class ModeloFornecerDE + { + public ModeloFornecerDE(int iD_FORNECER_DE, string cODIGO, string cOD_FOR, string cOD_ITEM, string uLTIMA) + { + ID_FORNECER_DE = iD_FORNECER_DE; + CODIGO = cODIGO; + COD_FOR = cOD_FOR; + COD_ITEM = cOD_ITEM; + ULTIMA = uLTIMA; + } + + public int ID_FORNECER_DE { get; set; } + + public string CODIGO { get; set; } + public string COD_FOR { get; set; } + public string COD_ITEM { get; set; } + public string ULTIMA { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloFuncionarios.cs b/MLL/ModeloFuncionarios.cs new file mode 100644 index 0000000..7e48275 --- /dev/null +++ b/MLL/ModeloFuncionarios.cs @@ -0,0 +1,176 @@ +using System; +using System.Data; +using System.Runtime.ConstrainedExecution; +using System.Text.RegularExpressions; +using static System.Net.Mime.MediaTypeNames; + +namespace MLL +{ + public class ModeloFuncionarios + { + public int ID_FUNCIONARIO { get; set; } + + public string CODIGO { get; set; } + public string NOME { get; set; } + + public string PAI { get; set; } + public string MAE { get; set; } + + public string CPF { get; set; } + public string CI { get; set; } + public string CTPS { get; set; } + + public string CNH { get; set; } + public string CAT_CNH { get; set; } + + public string ECIVIL { get; set; } + public string REGIME { get; set; } + + public string CEP { get; set; } + public string ENDERECO { get; set; } + public string ENDNUMERO { get; set; } + public string BAIRRO { get; set; } + public string CIDADE { get; set; } + public string UF { get; set; } + + public string BANCO { get; set; } + public string AGENCIA { get; set; } + public string CONTA { get; set; } + + public string TELEFONE { get; set; } + + public string PASS { get; set; } + + public bool MASTERUSER { get; set; } + public bool VENDEDOR { get; set; } + public bool TECNICO { get; set; } + public bool DEMITIDO { get; set; } + + public string FTECNICO { get; set; } + public string FVENDEDOR { get; set; } + public string FPATH { get; set; } + + public string OBSERV { get; set; } + + public DateTime? DATA_ADM { get; set; } + public DateTime? DATA_DEM { get; set; } + public DateTime? ANIVER { get; set; } + + #region CONSTRUTORES + + // Construtor vazio + public ModeloFuncionarios() + { + ID_FUNCIONARIO = 0; + CODIGO = ""; + NOME = ""; + PAI = ""; + MAE = ""; + CPF = ""; + CI = ""; + CTPS = ""; + CNH = ""; + CAT_CNH = ""; + ECIVIL = ""; + REGIME = ""; + CEP = ""; + ENDERECO = ""; + ENDNUMERO = ""; + BAIRRO = ""; + CIDADE = ""; + UF = ""; + BANCO = ""; + AGENCIA = ""; + CONTA = ""; + TELEFONE = ""; + PASS = ""; + MASTERUSER = false; + VENDEDOR = false; + TECNICO = false; + DEMITIDO = false; + FTECNICO = ""; + FVENDEDOR = ""; + FPATH = ""; + OBSERV = ""; + DATA_ADM = DateTime.Now; + DATA_DEM = DateTime.Now; + ANIVER = DateTime.Now; + } + + // Construtor completo + public ModeloFuncionarios( + int id, + string codigo, + string nome, + string pai, + string mae, + string cpf, + string ci, + string ctps, + string cnh, + string catCnh, + string ecivil, + string regime, + string cep, + string endereco, + string endNumero, + string bairro, + string cidade, + string uf, + string banco, + string agencia, + string conta, + string telefone, + string pass, + bool masterUser, + bool vendedor, + bool tecnico, + bool demitido, + string fTecnico, + string fVendedor, + string fPath, + string observ, + DateTime? dataAdm, + DateTime? dataDem, + DateTime? aniver + ) + { + ID_FUNCIONARIO = id; + CODIGO = codigo; + NOME = nome; + PAI = pai; + MAE = mae; + CPF = cpf; + CI = ci; + CTPS = ctps; + CNH = cnh; + CAT_CNH = catCnh; + ECIVIL = ecivil; + REGIME = regime; + CEP = cep; + ENDERECO = endereco; + ENDNUMERO = endNumero; + BAIRRO = bairro; + CIDADE = cidade; + UF = uf; + BANCO = banco; + AGENCIA = agencia; + CONTA = conta; + TELEFONE = telefone; + PASS = pass; + MASTERUSER = masterUser; + VENDEDOR = vendedor; + TECNICO = tecnico; + DEMITIDO = demitido; + FTECNICO = fTecnico; + FVENDEDOR = fVendedor; + FPATH = fPath; + OBSERV = observ; + DATA_ADM = dataAdm; + DATA_DEM = dataDem; + ANIVER = aniver; + } + + #endregion + } +} \ No newline at end of file diff --git a/MLL/ModeloIBPT.cs b/MLL/ModeloIBPT.cs new file mode 100644 index 0000000..d99caaf --- /dev/null +++ b/MLL/ModeloIBPT.cs @@ -0,0 +1,33 @@ +using System; + +namespace MLL +{ + public class ModeloIBPT + { + public ModeloIBPT(int iD_IBPT, string cODIGO, string nCM, string nacionalFederal, + string importadosFederal, string estadual, string municipal, string tipo) + { + ID_IBPT = iD_IBPT; + CODIGO = cODIGO; + NCM = nCM; + NacionalFederal = nacionalFederal; + ImportadosFederal = importadosFederal; + Estadual = estadual; + Municipal = municipal; + Tipo = tipo; + } + + public int ID_IBPT { get; set; } + + public string CODIGO { get; set; } + public string NCM { get; set; } + + public string NacionalFederal { get; set; } + public string ImportadosFederal { get; set; } + + public string Estadual { get; set; } + public string Municipal { get; set; } + + public string Tipo { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloIcmsEmp.cs b/MLL/ModeloIcmsEmp.cs new file mode 100644 index 0000000..6eaae87 --- /dev/null +++ b/MLL/ModeloIcmsEmp.cs @@ -0,0 +1,83 @@ +using System; + +namespace MLL +{ + public class ModeloIcmsEmp + { + public ModeloIcmsEmp(int iD_ICMS_EMP, string cODIGO, string uF, string iCMS, string uF_AC, + string uF_AL, string uF_AM, string uF_AP, string uF_BA, string uF_CE, + string uF_DF, string uF_ES, string uF_GO, string uF_MA, string uF_MT, + string uF_MS, string uF_MG, string uF_PA, string uF_PB, string uF_PR, + string uF_PE, string uF_PI, string uF_RN, string uF_RS, string uF_RJ, + string uF_RO, string uF_RR, string uF_SC, string uF_SP, string uF_SE, + string uF_TO, string fCP) + { + ID_ICMS_EMP = iD_ICMS_EMP; + CODIGO = cODIGO; + UF = uF; + ICMS = iCMS; + UF_AC = uF_AC; + UF_AL = uF_AL; + UF_AM = uF_AM; + UF_AP = uF_AP; + UF_BA = uF_BA; + UF_CE = uF_CE; + UF_DF = uF_DF; + UF_ES = uF_ES; + UF_GO = uF_GO; + UF_MA = uF_MA; + UF_MT = uF_MT; + UF_MS = uF_MS; + UF_MG = uF_MG; + UF_PA = uF_PA; + UF_PB = uF_PB; + UF_PR = uF_PR; + UF_PE = uF_PE; + UF_PI = uF_PI; + UF_RN = uF_RN; + UF_RS = uF_RS; + UF_RJ = uF_RJ; + UF_RO = uF_RO; + UF_RR = uF_RR; + UF_SC = uF_SC; + UF_SP = uF_SP; + UF_SE = uF_SE; + UF_TO = uF_TO; + FCP = fCP; + } + + public int ID_ICMS_EMP { get; set; } + public string CODIGO { get; set; } + public string UF { get; set; } + public string ICMS { get; set; } + public string UF_AC { get; set; } + public string UF_AL { get; set; } + public string UF_AM { get; set; } + public string UF_AP { get; set; } + public string UF_BA { get; set; } + public string UF_CE { get; set; } + public string UF_DF { get; set; } + public string UF_ES { get; set; } + public string UF_GO { get; set; } + public string UF_MA { get; set; } + public string UF_MT { get; set; } + public string UF_MS { get; set; } + public string UF_MG { get; set; } + public string UF_PA { get; set; } + public string UF_PB { get; set; } + public string UF_PR { get; set; } + public string UF_PE { get; set; } + public string UF_PI { get; set; } + public string UF_RN { get; set; } + public string UF_RS { get; set; } + public string UF_RJ { get; set; } + public string UF_RO { get; set; } + public string UF_RR { get; set; } + public string UF_SC { get; set; } + public string UF_SP { get; set; } + public string UF_SE { get; set; } + public string UF_TO { get; set; } + + public string FCP { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloIcmsUf.cs b/MLL/ModeloIcmsUf.cs new file mode 100644 index 0000000..0e78e25 --- /dev/null +++ b/MLL/ModeloIcmsUf.cs @@ -0,0 +1,24 @@ +using System; + +namespace MLL +{ + public class ModeloIcmsUf + { + public ModeloIcmsUf(int iD_ICMS_UF, string cODIGO, string cOD_ITEM, string uF, string iCMS) + { + ID_ICMS_UF = iD_ICMS_UF; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + UF = uF; + ICMS = iCMS; + } + + public int ID_ICMS_UF { get; set; } + + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + + public string UF { get; set; } + public string ICMS { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItens.cs b/MLL/ModeloItens.cs new file mode 100644 index 0000000..6328fb4 --- /dev/null +++ b/MLL/ModeloItens.cs @@ -0,0 +1,97 @@ +using System; + +namespace MLL +{ + public class ModeloItens + { + public ModeloItens(int iD_ITENS, string cODIGO, string nUMERO, string nOME, + string gRUPO, string sUBGRUPO, string tIPO, string uNIDADE, + string nUMERO_FAB, string eSTOQUE_MIN, string eSTOQUE_IDEAL, + string eSTOQUE_DISP, string cUSTO, string lUCRO, string vENDA, string fORNECEDOR, string lOCAL, string gAVETA, string fABRICANTE, string nOMECURTO, string p_FOTO, string nC_MERCOSUL, string c_CST, string c_ICMS, string c_IPI, string uLTIMA_VENDA, string uLTIMA_COMPRA, string pRECO_1, string pRECO_2, string gTIN, string vALIDADE, string oBSERVACOES) + { + ID_ITENS = iD_ITENS; + CODIGO = cODIGO; + NUMERO = nUMERO; + NOME = nOME; + GRUPO = gRUPO; + SUBGRUPO = sUBGRUPO; + TIPO = tIPO; + UNIDADE = uNIDADE; + NUMERO_FAB = nUMERO_FAB; + ESTOQUE_MIN = eSTOQUE_MIN; + ESTOQUE_IDEAL = eSTOQUE_IDEAL; + ESTOQUE_DISP = eSTOQUE_DISP; + CUSTO = cUSTO; + LUCRO = lUCRO; + VENDA = vENDA; + FORNECEDOR = fORNECEDOR; + LOCAL = lOCAL; + GAVETA = gAVETA; + FABRICANTE = fABRICANTE; + NOMECURTO = nOMECURTO; + P_FOTO = p_FOTO; + NC_MERCOSUL = nC_MERCOSUL; + C_CST = c_CST; + C_ICMS = c_ICMS; + C_IPI = c_IPI; + ULTIMA_VENDA = uLTIMA_VENDA; + ULTIMA_COMPRA = uLTIMA_COMPRA; + PRECO_1 = pRECO_1; + PRECO_2 = pRECO_2; + GTIN = gTIN; + VALIDADE = vALIDADE; + OBSERVACOES = oBSERVACOES; + } + + public int ID_ITENS { get; set; } + public string CODIGO { get; set; } + public string NUMERO { get; set; } + public string NOME { get; set; } + + public string GRUPO { get; set; } + public string SUBGRUPO { get; set; } + + public string TIPO { get; set; } + + public string UNIDADE { get; set; } + + public string NUMERO_FAB { get; set; } + + public string ESTOQUE_MIN { get; set; } + public string ESTOQUE_IDEAL { get; set; } + public string ESTOQUE_DISP { get; set; } + + public string CUSTO { get; set; } + public string LUCRO { get; set; } + public string VENDA { get; set; } + + public string FORNECEDOR { get; set; } + + public string LOCAL { get; set; } + public string GAVETA { get; set; } + + public string FABRICANTE { get; set; } + + public string NOMECURTO { get; set; } + + public string P_FOTO { get; set; } + + public string NC_MERCOSUL { get; set; } + + public string C_CST { get; set; } + public string C_ICMS { get; set; } + public string C_IPI { get; set; } + + public string ULTIMA_VENDA { get; set; } + public string ULTIMA_COMPRA { get; set; } + + public string PRECO_1 { get; set; } + public string PRECO_2 { get; set; } + + public string GTIN { get; set; } + + public string VALIDADE { get; set; } + + public string OBSERVACOES { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensEntrada.cs b/MLL/ModeloItensEntrada.cs new file mode 100644 index 0000000..c80bc8a --- /dev/null +++ b/MLL/ModeloItensEntrada.cs @@ -0,0 +1,36 @@ +using System; + +namespace MLL +{ + public class ModeloItensEntrada + { + public ModeloItensEntrada(int iD_ITENS_ENTRADA, string cODIGO, string cOD_ITEM, + string nOVOS, string nOTA, string tOTAL, string dATA_INC, + string fUNCIONARIO, string oBSERVACAO, string fORNECEDOR, string pED_NUM) + { + ID_ITENS_ENTRADA = iD_ITENS_ENTRADA; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + NOVOS = nOVOS; + NOTA = nOTA; + TOTAL = tOTAL; + DATA_INC = dATA_INC; + FUNCIONARIO = fUNCIONARIO; + OBSERVACAO = oBSERVACAO; + FORNECEDOR = fORNECEDOR; + PED_NUM = pED_NUM; + } + + public int ID_ITENS_ENTRADA { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + public string NOVOS { get; set; } + public string NOTA { get; set; } + public string TOTAL { get; set; } + public string DATA_INC { get; set; } + public string FUNCIONARIO { get; set; } + public string OBSERVACAO { get; set; } + public string FORNECEDOR { get; set; } + public string PED_NUM { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensFabrica.cs b/MLL/ModeloItensFabrica.cs new file mode 100644 index 0000000..8358a7b --- /dev/null +++ b/MLL/ModeloItensFabrica.cs @@ -0,0 +1,32 @@ +using System; + +namespace MLL +{ + public class ModeloItensFabrica + { + public ModeloItensFabrica(int iD_ITENS_FABRICA, string cODIGO, string kIT_CODIGO, string iTEM_CODIGO, string bARCODE, string dESCRICAO, string qTD, string cUSTO, string vENDA, string sERVICO) + { + ID_ITENS_FABRICA = iD_ITENS_FABRICA; + CODIGO = cODIGO; + KIT_CODIGO = kIT_CODIGO; + ITEM_CODIGO = iTEM_CODIGO; + BARCODE = bARCODE; + DESCRICAO = dESCRICAO; + QTD = qTD; + CUSTO = cUSTO; + VENDA = vENDA; + SERVICO = sERVICO; + } + + public int ID_ITENS_FABRICA { get; set; } + public string CODIGO { get; set; } + public string KIT_CODIGO { get; set; } + public string ITEM_CODIGO { get; set; } + public string BARCODE { get; set; } + public string DESCRICAO { get; set; } + public string QTD { get; set; } + public string CUSTO { get; set; } + public string VENDA { get; set; } + public string SERVICO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensFotosML.cs b/MLL/ModeloItensFotosML.cs new file mode 100644 index 0000000..46d85b5 --- /dev/null +++ b/MLL/ModeloItensFotosML.cs @@ -0,0 +1,21 @@ +using System; + +namespace MLL +{ + public class ModeloItensFotosML + { + public ModeloItensFotosML(int iD_ITENS_FOTOS_ML, string cODIGO, string cOD_ITEM, string lINK_FOTO) + { + ID_ITENS_FOTOS_ML = iD_ITENS_FOTOS_ML; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + LINK_FOTO = lINK_FOTO; + } + + public int ID_ITENS_FOTOS_ML { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + + public string LINK_FOTO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensNota.cs b/MLL/ModeloItensNota.cs new file mode 100644 index 0000000..1da659d --- /dev/null +++ b/MLL/ModeloItensNota.cs @@ -0,0 +1,63 @@ +using System; + +namespace MLL +{ + public class ModeloItensNota + { + public ModeloItensNota(int iD_ITENS_NOTA, string cODIGO, string cOD_NOTA, string tIPO, + string cOD_VENDEDOR, string cOD_ITEM, string dESCRICAO, string uNIDADE, + string qTD, string pRECO, string iCMS, string iPI, string iSS, string dESCONTO, + string tOTAL, string cFOP, string cST, string gTIN, string iNF_ADIC) + { + ID_ITENS_NOTA = iD_ITENS_NOTA; + CODIGO = cODIGO; + COD_NOTA = cOD_NOTA; + TIPO = tIPO; + COD_VENDEDOR = cOD_VENDEDOR; + COD_ITEM = cOD_ITEM; + DESCRICAO = dESCRICAO; + UNIDADE = uNIDADE; + QTD = qTD; + PRECO = pRECO; + ICMS = iCMS; + IPI = iPI; + ISS = iSS; + DESCONTO = dESCONTO; + TOTAL = tOTAL; + CFOP = cFOP; + CST = cST; + GTIN = gTIN; + INF_ADIC = iNF_ADIC; + } + + public int ID_ITENS_NOTA { get; set; } + + public string CODIGO { get; set; } + public string COD_NOTA { get; set; } + + public string TIPO { get; set; } + + public string COD_VENDEDOR { get; set; } + public string COD_ITEM { get; set; } + + public string DESCRICAO { get; set; } + public string UNIDADE { get; set; } + + public string QTD { get; set; } + public string PRECO { get; set; } + + public string ICMS { get; set; } + public string IPI { get; set; } + public string ISS { get; set; } + + public string DESCONTO { get; set; } + public string TOTAL { get; set; } + + public string CFOP { get; set; } + public string CST { get; set; } + + public string GTIN { get; set; } + + public string INF_ADIC { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensOrca.cs b/MLL/ModeloItensOrca.cs new file mode 100644 index 0000000..0fc3252 --- /dev/null +++ b/MLL/ModeloItensOrca.cs @@ -0,0 +1,42 @@ +using System; + +namespace MLL +{ + public class ModeloItensOrca + { + public ModeloItensOrca(int iD_ITENS, string bARCODE, string dESCRICAO, string sERVICO, + string qTD, string vRL_UN, string dESCONTO, string vLR_TOTAL, string uN, + string vENDA, string cODIGO) + { + ID_ITENS = iD_ITENS; + BARCODE = bARCODE; + DESCRICAO = dESCRICAO; + SERVICO = sERVICO; + QTD = qTD; + VRL_UN = vRL_UN; + DESCONTO = dESCONTO; + VLR_TOTAL = vLR_TOTAL; + UN = uN; + VENDA = vENDA; + CODIGO = cODIGO; + } + + public int ID_ITENS { get; set; } + + public string BARCODE { get; set; } + public string DESCRICAO { get; set; } + + public string SERVICO { get; set; } + + public string QTD { get; set; } + public string VRL_UN { get; set; } + public string DESCONTO { get; set; } + public string VLR_TOTAL { get; set; } + + public string UN { get; set; } + + public string VENDA { get; set; } + + public string CODIGO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensPedido.cs b/MLL/ModeloItensPedido.cs new file mode 100644 index 0000000..13b7488 --- /dev/null +++ b/MLL/ModeloItensPedido.cs @@ -0,0 +1,51 @@ +using System; + +namespace MLL +{ + public class ModeloItensPedido + { + public ModeloItensPedido(int iD_ITENS_PEDIDO, string cODIGO, string iTEM, string pEDIDO, + string cOD_ITEM, string nOME, string uN, string qTD, string vLR, string iPI, string iCMS, + string vALOR, string cOD_FAB, string vFrete, string vSeguro, string vDesconto, string vOutros, + string sERIAIS_IN) + { + ID_ITENS_PEDIDO = iD_ITENS_PEDIDO; + CODIGO = cODIGO; + ITEM = iTEM; + PEDIDO = pEDIDO; + COD_ITEM = cOD_ITEM; + NOME = nOME; + UN = uN; + QTD = qTD; + VLR = vLR; + IPI = iPI; + ICMS = iCMS; + VALOR = vALOR; + COD_FAB = cOD_FAB; + this.vFrete = vFrete; + this.vSeguro = vSeguro; + this.vDesconto = vDesconto; + this.vOutros = vOutros; + SERIAIS_IN = sERIAIS_IN; + } + + public int ID_ITENS_PEDIDO { get; set; } + public string CODIGO { get; set; } + public string ITEM { get; set; } + public string PEDIDO { get; set; } + public string COD_ITEM { get; set; } + public string NOME { get; set; } + public string UN { get; set; } + public string QTD { get; set; } + public string VLR { get; set; } + public string IPI { get; set; } + public string ICMS { get; set; } + public string VALOR { get; set; } + public string COD_FAB { get; set; } + public string vFrete { get; set; } + public string vSeguro { get; set; } + public string vDesconto { get; set; } + public string vOutros { get; set; } + public string SERIAIS_IN { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensSaida.cs b/MLL/ModeloItensSaida.cs new file mode 100644 index 0000000..677767f --- /dev/null +++ b/MLL/ModeloItensSaida.cs @@ -0,0 +1,37 @@ +using System; + +namespace MLL +{ + public class ModeloItensSaida + { + public ModeloItensSaida(int iD_ITENS_SAIDA, string cODIGO, string cOD_ITEM, string qTD_SAI, string fUNCIONARIO, string nOTA, + string oS, string oP, string oBSERVACAO, string dATA_SAIDA, string nATUREZA, string oV) + { + ID_ITENS_SAIDA = iD_ITENS_SAIDA; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + QTD_SAI = qTD_SAI; + FUNCIONARIO = fUNCIONARIO; + NOTA = nOTA; + OS = oS; + OP = oP; + OBSERVACAO = oBSERVACAO; + DATA_SAIDA = dATA_SAIDA; + NATUREZA = nATUREZA; + OV = oV; + } + + public int ID_ITENS_SAIDA { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + public string QTD_SAI { get; set; } + public string FUNCIONARIO { get; set; } + public string NOTA { get; set; } + public string OS { get; set; } + public string OP { get; set; } + public string OBSERVACAO { get; set; } + public string DATA_SAIDA { get; set; } + public string NATUREZA { get; set; } + public string OV { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensSerial.cs b/MLL/ModeloItensSerial.cs new file mode 100644 index 0000000..d455192 --- /dev/null +++ b/MLL/ModeloItensSerial.cs @@ -0,0 +1,34 @@ +using System; + +namespace MLL +{ + public class ModeloItensSerial + { + public ModeloItensSerial(int iD_ITENS_SERIAL, string cODIGO, string cOD_ITEM, string sERIAL, string cOD_NF_ENTRADA, string cOD_NF_SAIDA, string cOD_ENTRADA, string cOD_SAIDA, string dATA_MOVIM, string bAIXADO, string oBS) + { + ID_ITENS_SERIAL = iD_ITENS_SERIAL; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + SERIAL = sERIAL; + COD_NF_ENTRADA = cOD_NF_ENTRADA; + COD_NF_SAIDA = cOD_NF_SAIDA; + COD_ENTRADA = cOD_ENTRADA; + COD_SAIDA = cOD_SAIDA; + DATA_MOVIM = dATA_MOVIM; + BAIXADO = bAIXADO; + OBS = oBS; + } + + public int ID_ITENS_SERIAL { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + public string SERIAL { get; set; } + public string COD_NF_ENTRADA { get; set; } + public string COD_NF_SAIDA { get; set; } + public string COD_ENTRADA { get; set; } + public string COD_SAIDA { get; set; } + public string DATA_MOVIM { get; set; } + public string BAIXADO { get; set; } + public string OBS { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloItensVenda.cs b/MLL/ModeloItensVenda.cs new file mode 100644 index 0000000..544fd54 --- /dev/null +++ b/MLL/ModeloItensVenda.cs @@ -0,0 +1,53 @@ +using System; + +namespace MLL +{ + public class ModeloItensVenda + { + public ModeloItensVenda(int iD_ITENS_VENDA, string cODIGO, string iTEM_CODIGO, string bARCODE, + string dESCRICAO, string sERVICO, string qTD, string vRL_UN, string dESCONTO, + string vLR_TOTAL, string uN, string vENDA, string dIA, string sERIAIS_IN, string xPED, + string nITEMPED, string cUSTO, string vINF_ADIC, string lOTES) + { + ID_ITENS_VENDA = iD_ITENS_VENDA; + CODIGO = cODIGO; + ITEM_CODIGO = iTEM_CODIGO; + BARCODE = bARCODE; + DESCRICAO = dESCRICAO; + SERVICO = sERVICO; + QTD = qTD; + VRL_UN = vRL_UN; + DESCONTO = dESCONTO; + VLR_TOTAL = vLR_TOTAL; + UN = uN; + VENDA = vENDA; + DIA = dIA; + SERIAIS_IN = sERIAIS_IN; + XPED = xPED; + NITEMPED = nITEMPED; + CUSTO = cUSTO; + VINF_ADIC = vINF_ADIC; + LOTES = lOTES; + } + + public int ID_ITENS_VENDA { get; set; } + public string CODIGO { get; set; } + public string ITEM_CODIGO { get; set; } + public string BARCODE { get; set; } + public string DESCRICAO { get; set; } + public string SERVICO { get; set; } + public string QTD { get; set; } + public string VRL_UN { get; set; } + public string DESCONTO { get; set; } + public string VLR_TOTAL { get; set; } + public string UN { get; set; } + public string VENDA { get; set; } + public string DIA { get; set; } + public string SERIAIS_IN { get; set; } + public string XPED { get; set; } + public string NITEMPED { get; set; } + public string CUSTO { get; set; } + public string VINF_ADIC { get; set; } + public string LOTES { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloLCP116.cs b/MLL/ModeloLCP116.cs new file mode 100644 index 0000000..2a1a25e --- /dev/null +++ b/MLL/ModeloLCP116.cs @@ -0,0 +1,24 @@ +using System; + +namespace MLL +{ + public class ModeloLCP116 + { + public ModeloLCP116(int iD_LCP116, string cODIGO, string dESCRICAO, string cODIGO_PAI, string cODIGO_FILHO, string dATA_CADASTRO) + { + ID_LCP116 = iD_LCP116; + CODIGO = cODIGO; + DESCRICAO = dESCRICAO; + CODIGO_PAI = cODIGO_PAI; + CODIGO_FILHO = cODIGO_FILHO; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_LCP116 { get; set; } + public string CODIGO { get; set; } + public string DESCRICAO { get; set; } + public string CODIGO_PAI { get; set; } + public string CODIGO_FILHO { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloLogUser.cs b/MLL/ModeloLogUser.cs new file mode 100644 index 0000000..a5e855f --- /dev/null +++ b/MLL/ModeloLogUser.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloLogUser + { + public ModeloLogUser(int iD_LOG_USER, string cODIGO, string uSUARIO, string mICRO, string aCAO, string rISCO, string dIA_LOG, string eNDER_CLI) + { + ID_LOG_USER = iD_LOG_USER; + CODIGO = cODIGO; + USUARIO = uSUARIO; + MICRO = mICRO; + ACAO = aCAO; + RISCO = rISCO; + DIA_LOG = dIA_LOG; + ENDER_CLI = eNDER_CLI; + } + + public int ID_LOG_USER { get; set; } + public string CODIGO { get; set; } + public string USUARIO { get; set; } + public string MICRO { get; set; } + public string ACAO { get; set; } + public string RISCO { get; set; } + public string DIA_LOG { get; set; } + public string ENDER_CLI { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNFEInutilizadas.cs b/MLL/ModeloNFEInutilizadas.cs new file mode 100644 index 0000000..9317b23 --- /dev/null +++ b/MLL/ModeloNFEInutilizadas.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloNFEInutilizadas + { + public ModeloNFEInutilizadas(int iD_NFE_INUTILIZADAS, string cODIGO, string mOTIVO, string nUMERO_INICIAL, string nUMERO_FINAL, string dIA, string mODELO) + { + ID_NFE_INUTILIZADAS = iD_NFE_INUTILIZADAS; + CODIGO = cODIGO; + MOTIVO = mOTIVO; + NUMERO_INICIAL = nUMERO_INICIAL; + NUMERO_FINAL = nUMERO_FINAL; + DIA = dIA; + MODELO = mODELO; + } + + public int ID_NFE_INUTILIZADAS { get; set; } + public string CODIGO { get; set; } + public string MOTIVO { get; set; } + public string NUMERO_INICIAL { get; set; } + public string NUMERO_FINAL { get; set; } + public string DIA { get; set; } + public string MODELO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNFENumeroLote.cs b/MLL/ModeloNFENumeroLote.cs new file mode 100644 index 0000000..035f324 --- /dev/null +++ b/MLL/ModeloNFENumeroLote.cs @@ -0,0 +1,22 @@ +using System; + +namespace MLL +{ + public class ModeloNFENumeroLote + { + public ModeloNFENumeroLote(int iD_NFE_NUM_LOTE, string cODIGO, string nUM_NF, string dATA_GERADO, string rETORNO) + { + ID_NFE_NUM_LOTE = iD_NFE_NUM_LOTE; + CODIGO = cODIGO; + NUM_NF = nUM_NF; + DATA_GERADO = dATA_GERADO; + RETORNO = rETORNO; + } + + public int ID_NFE_NUM_LOTE { get; set; } + public string CODIGO { get; set; } + public string NUM_NF { get; set; } + public string DATA_GERADO { get; set; } + public string RETORNO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNFEUfCidade.cs b/MLL/ModeloNFEUfCidade.cs new file mode 100644 index 0000000..c451d34 --- /dev/null +++ b/MLL/ModeloNFEUfCidade.cs @@ -0,0 +1,22 @@ +using System; + +namespace MLL +{ + public class ModeloNFEUfCidade + { + public ModeloNFEUfCidade(int iD_NFE_UF_CIDADE, string uF_COD, string uF_NOME, string cID_COD, string cID_NOME) + { + ID_NFE_UF_CIDADE = iD_NFE_UF_CIDADE; + UF_COD = uF_COD; + UF_NOME = uF_NOME; + CID_COD = cID_COD; + CID_NOME = cID_NOME; + }//Modelo + + public int ID_NFE_UF_CIDADE { get; set; } + public string UF_COD { get; set; } + public string UF_NOME { get; set; } + public string CID_COD { get; set; } + public string CID_NOME { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasCCE.cs b/MLL/ModeloNotasCCE.cs new file mode 100644 index 0000000..c313f77 --- /dev/null +++ b/MLL/ModeloNotasCCE.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloNotasCCE + { + public ModeloNotasCCE(int iD_NOTAS_CCE, string cODIGO, string cOD_NFE, string cORRECAO, string dATA_HORA, string tZD, string eVENTO, string rETORNO) + { + ID_NOTAS_CCE = iD_NOTAS_CCE; + CODIGO = cODIGO; + COD_NFE = cOD_NFE; + CORRECAO = cORRECAO; + DATA_HORA = dATA_HORA; + TZD = tZD; + EVENTO = eVENTO; + RETORNO = rETORNO; + } + + public int ID_NOTAS_CCE { get; set; } + public string CODIGO { get; set; } + public string COD_NFE { get; set; } + public string CORRECAO { get; set; } + public string DATA_HORA { get; set; } + public string TZD { get; set; } + public string EVENTO { get; set; } + public string RETORNO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasCFOP.cs b/MLL/ModeloNotasCFOP.cs new file mode 100644 index 0000000..6383df0 --- /dev/null +++ b/MLL/ModeloNotasCFOP.cs @@ -0,0 +1,30 @@ +using System; + +namespace MLL +{ + public class ModeloNotasCFOP + { + public ModeloNotasCFOP(int iD_NOTAS_CFOP, string cODIGO, string cFOP, string dESCRICAO, string bESTOQUE, string bCONTAS, string bICMS, string bICMS_ST, string bASE) + { + ID_NOTAS_CFOP = iD_NOTAS_CFOP; + CODIGO = cODIGO; + CFOP = cFOP; + DESCRICAO = dESCRICAO; + BESTOQUE = bESTOQUE; + BCONTAS = bCONTAS; + BICMS = bICMS; + BICMS_ST = bICMS_ST; + BASE = bASE; + } + + public int ID_NOTAS_CFOP { get; set; } + public string CODIGO { get; set; } + public string CFOP { get; set; } + public string DESCRICAO { get; set; } + public string BESTOQUE { get; set; } + public string BCONTAS { get; set; } + public string BICMS { get; set; } + public string BICMS_ST { get; set; } + public string BASE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasCompras.cs b/MLL/ModeloNotasCompras.cs new file mode 100644 index 0000000..830908e --- /dev/null +++ b/MLL/ModeloNotasCompras.cs @@ -0,0 +1,210 @@ +using System; + +namespace MLL +{ + public class ModeloNotasCompras + { + public ModeloNotasCompras(int iD_NOTAS_COMPRAS, string cODIGO, string cFOP, string iDE_INDPAG, string iDE_MOD, + string iDE_SERIE, string iDE_NNF, string iDE_DEMI, string iDE_DSAIENT, string iDE_HSAIENT, string iDE_CMUNFG, + string iDE_CHNFE, string iDE_INDEMIT, string iDE_CODCONS, string dESTEMIT_CODIGO, string dESTEMIT_CNPJCPF, string dESTEMIT_XNOME, + string dESTEMIT_XFANT, string dESTEMIT_XLGR, string dESTEMIT_NRO, string dESTEMIT_XCLP, string dESTEMIT_XBAIRRO, string dESTEMIT_CMUN, + string dESTEMIT_XMUN, string dESTEMIT_UF, string dESTEMIT_CEP, string dESTEMIT_CPAIS, string dESTEMIT_XPAIS, string dESTEMIT_FONE, string dESTEMIT_IE, + string dESTEMIT_IEST, string dESTEMIT_IM, string dESTEMIT_CNAE, string dESTEMIT_CRT, string dESTEMIT_ISUF, string dESTEMIT_EMAIL, string tRANSP_CODIGO, + string tRANSP_MODFRETE, string tRANSP_CNPJCPF, string tRANSP_XNOME, string tRANSP_IE, string tRANSP_XBAIRRO, string tRANSP_XLGR, string tRANSP_CPAIS, + string tRANSP_CMUN, string tRANSP_XMUN, string tRANSP_NRO, string tRANSP_UF, string tRANSP_PLACA, string tRANSP_RNTC, string tRANSP_QVOL, string tRANSP_ESP, + string tRANSP_MARCA, string tRANSP_NVOL, string tRANSP_PESOL, string tRANSP_PESOB, string tOTAL_VBC, string tOTAL_VICMS, string tOTAL_VBCST, string tOTAL_VST, string tOTAL_VPROD, string tOTAL_VFRETE, string tOTAL_VSEG, string tOTAL_VDESC, string tOTAL_VII, string tOTAL_VIPI, string tOTAL_VPIS_ST, string tOTAL_VPIS, string tOTAL_VCOFINS, string tOTAL_VCOFINS_ST, string tOTAL_VOUTRO, string tOTAL_ISS, string tOTAL_VNF, string nFREF_REFNF, string rEFECF_MOD, string rEFECF_NECF, string rEFECF_NCOO, string rEFECF_TPIMP, string rEFECF_TPEMIS, string rEFECF_FINNFE, string rEFECF_PROCEMI, string rEFECF_VERPROC, string rEFECF_DHCONT, string rEFECF_XJUST, string fAT_INDTIT, string oBS_COMPRADOR, string iDE_NATOP, string mANIFESTO, string iDE_CODSIT, string infCpl, string infAdFisco) + { + ID_NOTAS_COMPRAS = iD_NOTAS_COMPRAS; + CODIGO = cODIGO; + CFOP = cFOP; + IDE_INDPAG = iDE_INDPAG; + IDE_MOD = iDE_MOD; + IDE_SERIE = iDE_SERIE; + IDE_NNF = iDE_NNF; + IDE_DEMI = iDE_DEMI; + IDE_DSAIENT = iDE_DSAIENT; + IDE_HSAIENT = iDE_HSAIENT; + IDE_CMUNFG = iDE_CMUNFG; + IDE_CHNFE = iDE_CHNFE; + IDE_INDEMIT = iDE_INDEMIT; + IDE_CODCONS = iDE_CODCONS; + DESTEMIT_CODIGO = dESTEMIT_CODIGO; + DESTEMIT_CNPJCPF = dESTEMIT_CNPJCPF; + DESTEMIT_XNOME = dESTEMIT_XNOME; + DESTEMIT_XFANT = dESTEMIT_XFANT; + DESTEMIT_XLGR = dESTEMIT_XLGR; + DESTEMIT_NRO = dESTEMIT_NRO; + DESTEMIT_XCLP = dESTEMIT_XCLP; + DESTEMIT_XBAIRRO = dESTEMIT_XBAIRRO; + DESTEMIT_CMUN = dESTEMIT_CMUN; + DESTEMIT_XMUN = dESTEMIT_XMUN; + DESTEMIT_UF = dESTEMIT_UF; + DESTEMIT_CEP = dESTEMIT_CEP; + DESTEMIT_CPAIS = dESTEMIT_CPAIS; + DESTEMIT_XPAIS = dESTEMIT_XPAIS; + DESTEMIT_FONE = dESTEMIT_FONE; + DESTEMIT_IE = dESTEMIT_IE; + DESTEMIT_IEST = dESTEMIT_IEST; + DESTEMIT_IM = dESTEMIT_IM; + DESTEMIT_CNAE = dESTEMIT_CNAE; + DESTEMIT_CRT = dESTEMIT_CRT; + DESTEMIT_ISUF = dESTEMIT_ISUF; + DESTEMIT_EMAIL = dESTEMIT_EMAIL; + TRANSP_CODIGO = tRANSP_CODIGO; + TRANSP_MODFRETE = tRANSP_MODFRETE; + TRANSP_CNPJCPF = tRANSP_CNPJCPF; + TRANSP_XNOME = tRANSP_XNOME; + TRANSP_IE = tRANSP_IE; + TRANSP_XBAIRRO = tRANSP_XBAIRRO; + TRANSP_XLGR = tRANSP_XLGR; + TRANSP_CPAIS = tRANSP_CPAIS; + TRANSP_CMUN = tRANSP_CMUN; + TRANSP_XMUN = tRANSP_XMUN; + TRANSP_NRO = tRANSP_NRO; + TRANSP_UF = tRANSP_UF; + TRANSP_PLACA = tRANSP_PLACA; + TRANSP_RNTC = tRANSP_RNTC; + TRANSP_QVOL = tRANSP_QVOL; + TRANSP_ESP = tRANSP_ESP; + TRANSP_MARCA = tRANSP_MARCA; + TRANSP_NVOL = tRANSP_NVOL; + TRANSP_PESOL = tRANSP_PESOL; + TRANSP_PESOB = tRANSP_PESOB; + TOTAL_VBC = tOTAL_VBC; + TOTAL_VICMS = tOTAL_VICMS; + TOTAL_VBCST = tOTAL_VBCST; + TOTAL_VST = tOTAL_VST; + TOTAL_VPROD = tOTAL_VPROD; + TOTAL_VFRETE = tOTAL_VFRETE; + TOTAL_VSEG = tOTAL_VSEG; + TOTAL_VDESC = tOTAL_VDESC; + TOTAL_VII = tOTAL_VII; + TOTAL_VIPI = tOTAL_VIPI; + TOTAL_VPIS_ST = tOTAL_VPIS_ST; + TOTAL_VPIS = tOTAL_VPIS; + TOTAL_VCOFINS = tOTAL_VCOFINS; + TOTAL_VCOFINS_ST = tOTAL_VCOFINS_ST; + TOTAL_VOUTRO = tOTAL_VOUTRO; + TOTAL_ISS = tOTAL_ISS; + TOTAL_VNF = tOTAL_VNF; + NFREF_REFNF = nFREF_REFNF; + REFECF_MOD = rEFECF_MOD; + REFECF_NECF = rEFECF_NECF; + REFECF_NCOO = rEFECF_NCOO; + REFECF_TPIMP = rEFECF_TPIMP; + REFECF_TPEMIS = rEFECF_TPEMIS; + REFECF_FINNFE = rEFECF_FINNFE; + REFECF_PROCEMI = rEFECF_PROCEMI; + REFECF_VERPROC = rEFECF_VERPROC; + REFECF_DHCONT = rEFECF_DHCONT; + REFECF_XJUST = rEFECF_XJUST; + FAT_INDTIT = fAT_INDTIT; + OBS_COMPRADOR = oBS_COMPRADOR; + IDE_NATOP = iDE_NATOP; + MANIFESTO = mANIFESTO; + IDE_CODSIT = iDE_CODSIT; + this.infCpl = infCpl; + this.infAdFisco = infAdFisco; + } + + public int ID_NOTAS_COMPRAS { get; set; } + public string CODIGO { get; set; } + public string CFOP { get; set; } + + public string IDE_INDPAG { get; set; } + public string IDE_MOD { get; set; } + public string IDE_SERIE { get; set; } + public string IDE_NNF { get; set; } + public string IDE_DEMI { get; set; } + public string IDE_DSAIENT { get; set; } + public string IDE_HSAIENT { get; set; } + public string IDE_CMUNFG { get; set; } + public string IDE_CHNFE { get; set; } + public string IDE_INDEMIT { get; set; } + public string IDE_CODCONS { get; set; } + + public string DESTEMIT_CODIGO { get; set; } + public string DESTEMIT_CNPJCPF { get; set; } + public string DESTEMIT_XNOME { get; set; } + public string DESTEMIT_XFANT { get; set; } + public string DESTEMIT_XLGR { get; set; } + public string DESTEMIT_NRO { get; set; } + public string DESTEMIT_XCLP { get; set; } + public string DESTEMIT_XBAIRRO { get; set; } + public string DESTEMIT_CMUN { get; set; } + public string DESTEMIT_XMUN { get; set; } + public string DESTEMIT_UF { get; set; } + public string DESTEMIT_CEP { get; set; } + public string DESTEMIT_CPAIS { get; set; } + public string DESTEMIT_XPAIS { get; set; } + public string DESTEMIT_FONE { get; set; } + public string DESTEMIT_IE { get; set; } + public string DESTEMIT_IEST { get; set; } + public string DESTEMIT_IM { get; set; } + public string DESTEMIT_CNAE { get; set; } + public string DESTEMIT_CRT { get; set; } + public string DESTEMIT_ISUF { get; set; } + public string DESTEMIT_EMAIL { get; set; } + + public string TRANSP_CODIGO { get; set; } + public string TRANSP_MODFRETE { get; set; } + public string TRANSP_CNPJCPF { get; set; } + public string TRANSP_XNOME { get; set; } + public string TRANSP_IE { get; set; } + public string TRANSP_XBAIRRO { get; set; } + public string TRANSP_XLGR { get; set; } + public string TRANSP_CPAIS { get; set; } + public string TRANSP_CMUN { get; set; } + public string TRANSP_XMUN { get; set; } + public string TRANSP_NRO { get; set; } + public string TRANSP_UF { get; set; } + public string TRANSP_PLACA { get; set; } + public string TRANSP_RNTC { get; set; } + public string TRANSP_QVOL { get; set; } + public string TRANSP_ESP { get; set; } + public string TRANSP_MARCA { get; set; } + public string TRANSP_NVOL { get; set; } + public string TRANSP_PESOL { get; set; } + public string TRANSP_PESOB { get; set; } + + public string TOTAL_VBC { get; set; } + public string TOTAL_VICMS { get; set; } + public string TOTAL_VBCST { get; set; } + public string TOTAL_VST { get; set; } + public string TOTAL_VPROD { get; set; } + public string TOTAL_VFRETE { get; set; } + public string TOTAL_VSEG { get; set; } + public string TOTAL_VDESC { get; set; } + public string TOTAL_VII { get; set; } + public string TOTAL_VIPI { get; set; } + public string TOTAL_VPIS_ST { get; set; } + public string TOTAL_VPIS { get; set; } + public string TOTAL_VCOFINS { get; set; } + public string TOTAL_VCOFINS_ST { get; set; } + public string TOTAL_VOUTRO { get; set; } + public string TOTAL_ISS { get; set; } + public string TOTAL_VNF { get; set; } + + public string NFREF_REFNF { get; set; } + + public string REFECF_MOD { get; set; } + public string REFECF_NECF { get; set; } + public string REFECF_NCOO { get; set; } + public string REFECF_TPIMP { get; set; } + public string REFECF_TPEMIS { get; set; } + public string REFECF_FINNFE { get; set; } + public string REFECF_PROCEMI { get; set; } + public string REFECF_VERPROC { get; set; } + public string REFECF_DHCONT { get; set; } + public string REFECF_XJUST { get; set; } + + public string FAT_INDTIT { get; set; } + public string OBS_COMPRADOR { get; set; } + public string IDE_NATOP { get; set; } + public string MANIFESTO { get; set; } + public string IDE_CODSIT { get; set; } + + public string infCpl { get; set; } + public string infAdFisco { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasComprasCorel.cs b/MLL/ModeloNotasComprasCorel.cs new file mode 100644 index 0000000..b4ec4fa --- /dev/null +++ b/MLL/ModeloNotasComprasCorel.cs @@ -0,0 +1,22 @@ +using System; + +namespace MLL +{ + public class ModeloNotasComprasCorel + { + public ModeloNotasComprasCorel(int iD_NOTAS_COMP_COREL, string cODIGO, string fORNEC_CNPJ, string fORNEC_cProd, string mEU_cProd) + { + ID_NOTAS_COMP_COREL = iD_NOTAS_COMP_COREL; + CODIGO = cODIGO; + FORNEC_CNPJ = fORNEC_CNPJ; + FORNEC_cProd = fORNEC_cProd; + MEU_cProd = mEU_cProd; + } + + public int ID_NOTAS_COMP_COREL { get; set; } + public string CODIGO { get; set; } + public string FORNEC_CNPJ { get; set; } + public string FORNEC_cProd { get; set; } + public string MEU_cProd { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasComprasDFE.cs b/MLL/ModeloNotasComprasDFE.cs new file mode 100644 index 0000000..78552ac --- /dev/null +++ b/MLL/ModeloNotasComprasDFE.cs @@ -0,0 +1,20 @@ +using System; + +namespace MLL +{ + public class ModeloNotasComprasDFE + { + public ModeloNotasComprasDFE(int iD_NOTAS_COMPRAS_DFE, string cODIGO, string cHAVE, string mANIFESTADO) + { + ID_NOTAS_COMPRAS_DFE = iD_NOTAS_COMPRAS_DFE; + CODIGO = cODIGO; + CHAVE = cHAVE; + MANIFESTADO = mANIFESTADO; + } + + public int ID_NOTAS_COMPRAS_DFE { get; set; } + public string CODIGO { get; set; } + public string CHAVE { get; set; } + public string MANIFESTADO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasComprasFaturas.cs b/MLL/ModeloNotasComprasFaturas.cs new file mode 100644 index 0000000..a22ee98 --- /dev/null +++ b/MLL/ModeloNotasComprasFaturas.cs @@ -0,0 +1,24 @@ +using System; + +namespace MLL +{ + public class ModeloNotasComprasFaturas + { + public ModeloNotasComprasFaturas(int iD_NOTAS_COMP_FATURAS, string cODIGO, string nOTA_ID, string nPARC, string dVENC, string vPARC) + { + ID_NOTAS_COMP_FATURAS = iD_NOTAS_COMP_FATURAS; + CODIGO = cODIGO; + NOTA_ID = nOTA_ID; + NPARC = nPARC; + DVENC = dVENC; + VPARC = vPARC; + } + + public int ID_NOTAS_COMP_FATURAS { get; set; } + public string CODIGO { get; set; } + public string NOTA_ID { get; set; } + public string NPARC { get; set; } + public string DVENC { get; set; } + public string VPARC { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasComprasItens.cs b/MLL/ModeloNotasComprasItens.cs new file mode 100644 index 0000000..b62cea5 --- /dev/null +++ b/MLL/ModeloNotasComprasItens.cs @@ -0,0 +1,112 @@ +using System; + +namespace MLL +{ + public class ModeloNotasComprasItens + { + public ModeloNotasComprasItens(int iD_NOTAS_COMP_ITENS, string cODIGO, string nOTA_ID, string cPROD, string cEAN, string xPROD, + string nCM, string cFOP, string uCOM, string qCOM, string vUNCOM, string vPROD, string vFRETE, string vSEG, + string vDESC, string vOUTRO, string oRIG, string cST_ICMS, string cST_PIS, string cST_COFINS, string cST_IPI, + string dI_NDI, string dI_DDI, string dI_XLOCDESEMB, string dI_UFDESEMB, string dI_CEXPORTADOR, string cOD_NAT, + string xPROD_COMPL, string nAT_BC_CRED, string cOD_CTA, string cOD_CCUS, string eX_IPI, string iND_NAT_FRT, string iPI_VBC, + string iPI_PIPI, string iPI_VIPI, string iCMS_VBC, string iCMS_PICMS, string iCMS_VICMS, string iCMS_VBCST, string iCMS_PICMSST, + string iCMS_VICMSST, string cOD_INTERNO, string xPED, string nITEMPED, string sERIAIS_IN, string eAN) + { + ID_NOTAS_COMP_ITENS = iD_NOTAS_COMP_ITENS; + CODIGO = cODIGO; + NOTA_ID = nOTA_ID; + CPROD = cPROD; + CEAN = cEAN; + XPROD = xPROD; + NCM = nCM; + CFOP = cFOP; + UCOM = uCOM; + QCOM = qCOM; + VUNCOM = vUNCOM; + VPROD = vPROD; + VFRETE = vFRETE; + VSEG = vSEG; + VDESC = vDESC; + VOUTRO = vOUTRO; + ORIG = oRIG; + CST_ICMS = cST_ICMS; + CST_PIS = cST_PIS; + CST_COFINS = cST_COFINS; + CST_IPI = cST_IPI; + DI_NDI = dI_NDI; + DI_DDI = dI_DDI; + DI_XLOCDESEMB = dI_XLOCDESEMB; + DI_UFDESEMB = dI_UFDESEMB; + DI_CEXPORTADOR = dI_CEXPORTADOR; + COD_NAT = cOD_NAT; + XPROD_COMPL = xPROD_COMPL; + NAT_BC_CRED = nAT_BC_CRED; + COD_CTA = cOD_CTA; + COD_CCUS = cOD_CCUS; + EX_IPI = eX_IPI; + IND_NAT_FRT = iND_NAT_FRT; + IPI_VBC = iPI_VBC; + IPI_PIPI = iPI_PIPI; + IPI_VIPI = iPI_VIPI; + ICMS_VBC = iCMS_VBC; + ICMS_PICMS = iCMS_PICMS; + ICMS_VICMS = iCMS_VICMS; + ICMS_VBCST = iCMS_VBCST; + ICMS_PICMSST = iCMS_PICMSST; + ICMS_VICMSST = iCMS_VICMSST; + COD_INTERNO = cOD_INTERNO; + XPED = xPED; + NITEMPED = nITEMPED; + SERIAIS_IN = sERIAIS_IN; + EAN = eAN; + } + + public int ID_NOTAS_COMP_ITENS { get; set; } + public string CODIGO { get; set; } + public string NOTA_ID { get; set; } + public string CPROD { get; set; } + public string CEAN { get; set; } + public string XPROD { get; set; } + public string NCM { get; set; } + public string CFOP { get; set; } + public string UCOM { get; set; } + public string QCOM { get; set; } + public string VUNCOM { get; set; } + public string VPROD { get; set; } + public string VFRETE { get; set; } + public string VSEG { get; set; } + public string VDESC { get; set; } + public string VOUTRO { get; set; } + public string ORIG { get; set; } + public string CST_ICMS { get; set; } + public string CST_PIS { get; set; } + public string CST_COFINS { get; set; } + public string CST_IPI { get; set; } + public string DI_NDI { get; set; } + public string DI_DDI { get; set; } + public string DI_XLOCDESEMB { get; set; } + public string DI_UFDESEMB { get; set; } + public string DI_CEXPORTADOR { get; set; } + public string COD_NAT { get; set; } + public string XPROD_COMPL { get; set; } + public string NAT_BC_CRED { get; set; } + public string COD_CTA { get; set; } + public string COD_CCUS { get; set; } + public string EX_IPI { get; set; } + public string IND_NAT_FRT { get; set; } + public string IPI_VBC { get; set; } + public string IPI_PIPI { get; set; } + public string IPI_VIPI { get; set; } + public string ICMS_VBC { get; set; } + public string ICMS_PICMS { get; set; } + public string ICMS_VICMS { get; set; } + public string ICMS_VBCST { get; set; } + public string ICMS_PICMSST { get; set; } + public string ICMS_VICMSST { get; set; } + public string COD_INTERNO { get; set; } + public string XPED { get; set; } + public string NITEMPED { get; set; } + public string SERIAIS_IN { get; set; } + public string EAN { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasConsumidorFormas.cs b/MLL/ModeloNotasConsumidorFormas.cs new file mode 100644 index 0000000..61e9290 --- /dev/null +++ b/MLL/ModeloNotasConsumidorFormas.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloNotasConsumidorFormas + { + public ModeloNotasConsumidorFormas(int iD_NOTAS_CONS_FORMAS, string cODIGO, string cOD_NFCE, string fORMA, string vALOR, string dATA_CADASTRO, string cNPJ_OPERADORA, string tBand) + { + ID_NOTAS_CONS_FORMAS = iD_NOTAS_CONS_FORMAS; + CODIGO = cODIGO; + COD_NFCE = cOD_NFCE; + FORMA = fORMA; + VALOR = vALOR; + DATA_CADASTRO = dATA_CADASTRO; + CNPJ_OPERADORA = cNPJ_OPERADORA; + this.tBand = tBand; + } + + public int ID_NOTAS_CONS_FORMAS { get; set; } + public string CODIGO { get; set; } + public string COD_NFCE { get; set; } + public string FORMA { get; set; } + public string VALOR { get; set; } + public string DATA_CADASTRO { get; set; } + public string CNPJ_OPERADORA { get; set; } + public string tBand { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasConsumidorItens.cs b/MLL/ModeloNotasConsumidorItens.cs new file mode 100644 index 0000000..204815c --- /dev/null +++ b/MLL/ModeloNotasConsumidorItens.cs @@ -0,0 +1,149 @@ +using System; + +namespace MLL +{ + public class ModeloNotasConsumidorItens + { + public ModeloNotasConsumidorItens(int iD_NOTAS_CONSU_ITENS, string cODIGO, string cOD_NFCE, string iTEM_TIPO, string iTEM_CEAN, + string iTEM_CPROD, string iTEM_XPROD, string iTEM_INF_ADIC, string iTEM_CFOP, string iTEM_NCM, + string iTEM_UNCOM, string iTEM_QCOM, string iTEM_VPROD, string iTEM_VOUTRO, string iTEM_VFRETE, + string iTEM_VSEG, string iTEM_VDESC, string iTEM_vTotTrib, string iTEM_ORIGEM, string iTEM_CST, + string dATA_CADASTRO, string iTEM_ICMS_modBC, string iTEM_ICMS_pRedBC, string iTEM_ICMS_vBC, + string iTEM_ICMS_pICMS, string iTEM_ICMS_vICMS, string iTEM_ICMS_vICMSDeson, string iTEM_ICMS_motDesICMS, + string iTEM_ICMS_modBCST, string iTEM_ICMS_pMVAST, string iTEM_ICMS_pRedBCST, string iTEM_ICMS_vBCST, + string iTEM_ICMS_pICMSST, string iTEM_ICMS_vICMSST, string iTEM_cProdANP, string iTEM_CEST, string cBenef, + string iTEM_pFCP, string iTEM_vFCP, string iTEM_vBCFCP, string iTEM_vBCFCPST, string iTEM_pFCPST, string iTEM_vFCPST, + string iTEM_pST, string iTEM_vBCFCPSTRet, string iTEM_pFCPSTRet, string iTEM_vFCPSTRet, string iTEM_PIS_CST, string iTEM_PIS_vBC, + string iTEM_PIS_pPIS, string iTEM_PIS_vPIS, string iTEM_COFINS_CST, string iTEM_COFINS_vBC, string iTEM_COFINS_pCOFINS, string iTEM_COFINS_vCOFINS, + string vICMSSubstituto, string pRedBCEfet, string vBCEfet, string pICMSEfet, string vICMSEfet) + { + ID_NOTAS_CONSU_ITENS = iD_NOTAS_CONSU_ITENS; + CODIGO = cODIGO; + COD_NFCE = cOD_NFCE; + ITEM_TIPO = iTEM_TIPO; + ITEM_CEAN = iTEM_CEAN; + ITEM_CPROD = iTEM_CPROD; + ITEM_XPROD = iTEM_XPROD; + ITEM_INF_ADIC = iTEM_INF_ADIC; + ITEM_CFOP = iTEM_CFOP; + ITEM_NCM = iTEM_NCM; + ITEM_UNCOM = iTEM_UNCOM; + ITEM_QCOM = iTEM_QCOM; + ITEM_VPROD = iTEM_VPROD; + ITEM_VOUTRO = iTEM_VOUTRO; + ITEM_VFRETE = iTEM_VFRETE; + ITEM_VSEG = iTEM_VSEG; + ITEM_VDESC = iTEM_VDESC; + ITEM_vTotTrib = iTEM_vTotTrib; + ITEM_ORIGEM = iTEM_ORIGEM; + ITEM_CST = iTEM_CST; + DATA_CADASTRO = dATA_CADASTRO; + ITEM_ICMS_modBC = iTEM_ICMS_modBC; + ITEM_ICMS_pRedBC = iTEM_ICMS_pRedBC; + ITEM_ICMS_vBC = iTEM_ICMS_vBC; + ITEM_ICMS_pICMS = iTEM_ICMS_pICMS; + ITEM_ICMS_vICMS = iTEM_ICMS_vICMS; + ITEM_ICMS_vICMSDeson = iTEM_ICMS_vICMSDeson; + ITEM_ICMS_motDesICMS = iTEM_ICMS_motDesICMS; + ITEM_ICMS_modBCST = iTEM_ICMS_modBCST; + ITEM_ICMS_pMVAST = iTEM_ICMS_pMVAST; + ITEM_ICMS_pRedBCST = iTEM_ICMS_pRedBCST; + ITEM_ICMS_vBCST = iTEM_ICMS_vBCST; + ITEM_ICMS_pICMSST = iTEM_ICMS_pICMSST; + ITEM_ICMS_vICMSST = iTEM_ICMS_vICMSST; + ITEM_cProdANP = iTEM_cProdANP; + ITEM_CEST = iTEM_CEST; + this.cBenef = cBenef; + ITEM_pFCP = iTEM_pFCP; + ITEM_vFCP = iTEM_vFCP; + ITEM_vBCFCP = iTEM_vBCFCP; + ITEM_vBCFCPST = iTEM_vBCFCPST; + ITEM_pFCPST = iTEM_pFCPST; + ITEM_vFCPST = iTEM_vFCPST; + ITEM_pST = iTEM_pST; + ITEM_vBCFCPSTRet = iTEM_vBCFCPSTRet; + ITEM_pFCPSTRet = iTEM_pFCPSTRet; + ITEM_vFCPSTRet = iTEM_vFCPSTRet; + ITEM_PIS_CST = iTEM_PIS_CST; + ITEM_PIS_vBC = iTEM_PIS_vBC; + ITEM_PIS_pPIS = iTEM_PIS_pPIS; + ITEM_PIS_vPIS = iTEM_PIS_vPIS; + ITEM_COFINS_CST = iTEM_COFINS_CST; + ITEM_COFINS_vBC = iTEM_COFINS_vBC; + ITEM_COFINS_pCOFINS = iTEM_COFINS_pCOFINS; + ITEM_COFINS_vCOFINS = iTEM_COFINS_vCOFINS; + this.vICMSSubstituto = vICMSSubstituto; + this.pRedBCEfet = pRedBCEfet; + this.vBCEfet = vBCEfet; + this.pICMSEfet = pICMSEfet; + this.vICMSEfet = vICMSEfet; + } + + public int ID_NOTAS_CONSU_ITENS { get; set; } + public string CODIGO { get; set; } + public string COD_NFCE { get; set; } + public string ITEM_TIPO { get; set; } + public string ITEM_CEAN { get; set; } + public string ITEM_CPROD { get; set; } + public string ITEM_XPROD { get; set; } + public string ITEM_INF_ADIC { get; set; } + public string ITEM_CFOP { get; set; } + public string ITEM_NCM { get; set; } + public string ITEM_UNCOM { get; set; } + public string ITEM_QCOM { get; set; } + public string ITEM_VPROD { get; set; } + public string ITEM_VOUTRO { get; set; } + public string ITEM_VFRETE { get; set; } + public string ITEM_VSEG { get; set; } + public string ITEM_VDESC { get; set; } + public string ITEM_vTotTrib { get; set; } + public string ITEM_ORIGEM { get; set; } + public string ITEM_CST { get; set; } + public string DATA_CADASTRO { get; set; } + + public string ITEM_ICMS_modBC { get; set; } + public string ITEM_ICMS_pRedBC { get; set; } + public string ITEM_ICMS_vBC { get; set; } + public string ITEM_ICMS_pICMS { get; set; } + public string ITEM_ICMS_vICMS { get; set; } + public string ITEM_ICMS_vICMSDeson { get; set; } + public string ITEM_ICMS_motDesICMS { get; set; } + public string ITEM_ICMS_modBCST { get; set; } + public string ITEM_ICMS_pMVAST { get; set; } + public string ITEM_ICMS_pRedBCST { get; set; } + public string ITEM_ICMS_vBCST { get; set; } + public string ITEM_ICMS_pICMSST { get; set; } + public string ITEM_ICMS_vICMSST { get; set; } + + public string ITEM_cProdANP { get; set; } + public string ITEM_CEST { get; set; } + public string cBenef { get; set; } + + public string ITEM_pFCP { get; set; } + public string ITEM_vFCP { get; set; } + public string ITEM_vBCFCP { get; set; } + public string ITEM_vBCFCPST { get; set; } + public string ITEM_pFCPST { get; set; } + public string ITEM_vFCPST { get; set; } + public string ITEM_pST { get; set; } + public string ITEM_vBCFCPSTRet { get; set; } + public string ITEM_pFCPSTRet { get; set; } + public string ITEM_vFCPSTRet { get; set; } + + public string ITEM_PIS_CST { get; set; } + public string ITEM_PIS_vBC { get; set; } + public string ITEM_PIS_pPIS { get; set; } + public string ITEM_PIS_vPIS { get; set; } + + public string ITEM_COFINS_CST { get; set; } + public string ITEM_COFINS_vBC { get; set; } + public string ITEM_COFINS_pCOFINS { get; set; } + public string ITEM_COFINS_vCOFINS { get; set; } + + public string vICMSSubstituto { get; set; } + public string pRedBCEfet { get; set; } + public string vBCEfet { get; set; } + public string pICMSEfet { get; set; } + public string vICMSEfet { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasContador.cs b/MLL/ModeloNotasContador.cs new file mode 100644 index 0000000..d4f64a9 --- /dev/null +++ b/MLL/ModeloNotasContador.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloNotasContador + { + public ModeloNotasContador(int iD_NOTAS_CONTADOR, string cODIGO, string cNPJ_CPF, string nOME, string dATA_CADASTRO, string eMAIL, string tELEFONE, string cONTADOR_ID) + { + ID_NOTAS_CONTADOR = iD_NOTAS_CONTADOR; + CODIGO = cODIGO; + CNPJ_CPF = cNPJ_CPF; + NOME = nOME; + DATA_CADASTRO = dATA_CADASTRO; + EMAIL = eMAIL; + TELEFONE = tELEFONE; + CONTADOR_ID = cONTADOR_ID; + } + + public int ID_NOTAS_CONTADOR { get; set; } + public string CODIGO { get; set; } + public string CNPJ_CPF { get; set; } + public string NOME { get; set; } + public string DATA_CADASTRO { get; set; } + public string EMAIL { get; set; } + public string TELEFONE { get; set; } + public string CONTADOR_ID { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasDeServicos.cs b/MLL/ModeloNotasDeServicos.cs new file mode 100644 index 0000000..90c6744 --- /dev/null +++ b/MLL/ModeloNotasDeServicos.cs @@ -0,0 +1,149 @@ +using System; + +namespace MLL +{ + public class ModeloNotasDeServicos + { + public ModeloNotasDeServicos(int iD_NOTAS_SERVICOS, string cODIGO, string iDE_RPS, string iDE_SERIE, string iDE_TIPO, string iDE_DT_EMIS, string iDE_CAMPO1, string iDE_CAMPO2, string iDE_REG_TRIB, string iDE_SIMPLES, string iDE_IN_CULTURAL, string tOMADOR_CNPJ, string tOMADOR_IMUN, string tOMADOR_RAZAO, string tOMADOR_END, string tOMADOR_NUM, string tOMADOR_CPL, string tOMADOR_BAIRRO, string tOMADOR_COD_MUN, string tOMADOR_UF, string tOMADOR_CEP, string tOMADOR_EMAIL, string tOMADOR_TELEFONE, string rPS_LOTE, string rPS_OBS, string rPS_ETAPA1, string rPS_ETAPA2, string rPS_ETAPA3, string rPS_ETAPA4, string rPS_ETAPA5, string nFS_SUBSTITUIDO_RPS, string nFS_SUBSTITUIDO_SERIE, string nFS_SUBSTITUIDO_TIPO, string cODIGO_OBRA, string nUMERO_ART, string iNTERMEDIARIO_CNP, string iNTERMEDIARIO_IM, string iNTERMEDIARIO_RAZAO, string rPS_COD_SERV, string nFS_ValorServicos, string nFS_ValorDeducoes, string nFS_ValorPis, string nFS_ValorCofins, string nFS_ValorInss, string nFS_ValorCredito, string nFS_BaseCalculo, string nFS_ValorLiquidoNfse, string nFS_ValorIr, string nFS_ValorCsll, string nFS_IssRetido, string nFS_ValorIss, string nFS_OutrasRetencoes, string nFS_DescontoIncondicionado, string nFS_DescontoCondicionado, string nFS_Aliquota, string nFS_CodigoServico, string nFS_CNAE, string nFS_CodigoTributacaoMunicipio, string nFS_Discriminacao, string nFS_CodigoMunicipio, string nFS_TributacaoRPS, string nFS_CODPAIS, string nFS_Exigibilidade, string nFS_CodigoMunIncidencia) + { + ID_NOTAS_SERVICOS = iD_NOTAS_SERVICOS; + CODIGO = cODIGO; + IDE_RPS = iDE_RPS; + IDE_SERIE = iDE_SERIE; + IDE_TIPO = iDE_TIPO; + IDE_DT_EMIS = iDE_DT_EMIS; + IDE_CAMPO1 = iDE_CAMPO1; + IDE_CAMPO2 = iDE_CAMPO2; + IDE_REG_TRIB = iDE_REG_TRIB; + IDE_SIMPLES = iDE_SIMPLES; + IDE_IN_CULTURAL = iDE_IN_CULTURAL; + TOMADOR_CNPJ = tOMADOR_CNPJ; + TOMADOR_IMUN = tOMADOR_IMUN; + TOMADOR_RAZAO = tOMADOR_RAZAO; + TOMADOR_END = tOMADOR_END; + TOMADOR_NUM = tOMADOR_NUM; + TOMADOR_CPL = tOMADOR_CPL; + TOMADOR_BAIRRO = tOMADOR_BAIRRO; + TOMADOR_COD_MUN = tOMADOR_COD_MUN; + TOMADOR_UF = tOMADOR_UF; + TOMADOR_CEP = tOMADOR_CEP; + TOMADOR_EMAIL = tOMADOR_EMAIL; + TOMADOR_TELEFONE = tOMADOR_TELEFONE; + RPS_LOTE = rPS_LOTE; + RPS_OBS = rPS_OBS; + RPS_ETAPA1 = rPS_ETAPA1; + RPS_ETAPA2 = rPS_ETAPA2; + RPS_ETAPA3 = rPS_ETAPA3; + RPS_ETAPA4 = rPS_ETAPA4; + RPS_ETAPA5 = rPS_ETAPA5; + NFS_SUBSTITUIDO_RPS = nFS_SUBSTITUIDO_RPS; + NFS_SUBSTITUIDO_SERIE = nFS_SUBSTITUIDO_SERIE; + NFS_SUBSTITUIDO_TIPO = nFS_SUBSTITUIDO_TIPO; + CODIGO_OBRA = cODIGO_OBRA; + NUMERO_ART = nUMERO_ART; + INTERMEDIARIO_CNP = iNTERMEDIARIO_CNP; + INTERMEDIARIO_IM = iNTERMEDIARIO_IM; + INTERMEDIARIO_RAZAO = iNTERMEDIARIO_RAZAO; + RPS_COD_SERV = rPS_COD_SERV; + NFS_ValorServicos = nFS_ValorServicos; + NFS_ValorDeducoes = nFS_ValorDeducoes; + NFS_ValorPis = nFS_ValorPis; + NFS_ValorCofins = nFS_ValorCofins; + NFS_ValorInss = nFS_ValorInss; + NFS_ValorCredito = nFS_ValorCredito; + NFS_BaseCalculo = nFS_BaseCalculo; + NFS_ValorLiquidoNfse = nFS_ValorLiquidoNfse; + NFS_ValorIr = nFS_ValorIr; + NFS_ValorCsll = nFS_ValorCsll; + NFS_IssRetido = nFS_IssRetido; + NFS_ValorIss = nFS_ValorIss; + NFS_OutrasRetencoes = nFS_OutrasRetencoes; + NFS_DescontoIncondicionado = nFS_DescontoIncondicionado; + NFS_DescontoCondicionado = nFS_DescontoCondicionado; + NFS_Aliquota = nFS_Aliquota; + NFS_CodigoServico = nFS_CodigoServico; + NFS_CNAE = nFS_CNAE; + NFS_CodigoTributacaoMunicipio = nFS_CodigoTributacaoMunicipio; + NFS_Discriminacao = nFS_Discriminacao; + NFS_CodigoMunicipio = nFS_CodigoMunicipio; + NFS_TributacaoRPS = nFS_TributacaoRPS; + NFS_CODPAIS = nFS_CODPAIS; + NFS_Exigibilidade = nFS_Exigibilidade; + NFS_CodigoMunIncidencia = nFS_CodigoMunIncidencia; + } + + public int ID_NOTAS_SERVICOS { get; set; } + public string CODIGO { get; set; } + + public string IDE_RPS { get; set; } + public string IDE_SERIE { get; set; } + public string IDE_TIPO { get; set; } + public string IDE_DT_EMIS { get; set; } + public string IDE_CAMPO1 { get; set; } + public string IDE_CAMPO2 { get; set; } + public string IDE_REG_TRIB { get; set; } + public string IDE_SIMPLES { get; set; } + public string IDE_IN_CULTURAL { get; set; } + + public string TOMADOR_CNPJ { get; set; } + public string TOMADOR_IMUN { get; set; } + public string TOMADOR_RAZAO { get; set; } + public string TOMADOR_END { get; set; } + public string TOMADOR_NUM { get; set; } + public string TOMADOR_CPL { get; set; } + public string TOMADOR_BAIRRO { get; set; } + public string TOMADOR_COD_MUN { get; set; } + public string TOMADOR_UF { get; set; } + public string TOMADOR_CEP { get; set; } + public string TOMADOR_EMAIL { get; set; } + public string TOMADOR_TELEFONE { get; set; } + + public string RPS_LOTE { get; set; } + public string RPS_OBS { get; set; } + public string RPS_ETAPA1 { get; set; } + public string RPS_ETAPA2 { get; set; } + public string RPS_ETAPA3 { get; set; } + public string RPS_ETAPA4 { get; set; } + public string RPS_ETAPA5 { get; set; } + + public string NFS_SUBSTITUIDO_RPS { get; set; } + public string NFS_SUBSTITUIDO_SERIE { get; set; } + public string NFS_SUBSTITUIDO_TIPO { get; set; } + + public string CODIGO_OBRA { get; set; } + public string NUMERO_ART { get; set; } + + public string INTERMEDIARIO_CNP { get; set; } + public string INTERMEDIARIO_IM { get; set; } + public string INTERMEDIARIO_RAZAO { get; set; } + + public string RPS_COD_SERV { get; set; } + + public string NFS_ValorServicos { get; set; } + public string NFS_ValorDeducoes { get; set; } + public string NFS_ValorPis { get; set; } + public string NFS_ValorCofins { get; set; } + public string NFS_ValorInss { get; set; } + public string NFS_ValorCredito { get; set; } + public string NFS_BaseCalculo { get; set; } + public string NFS_ValorLiquidoNfse { get; set; } + public string NFS_ValorIr { get; set; } + public string NFS_ValorCsll { get; set; } + public string NFS_IssRetido { get; set; } + public string NFS_ValorIss { get; set; } + public string NFS_OutrasRetencoes { get; set; } + public string NFS_DescontoIncondicionado { get; set; } + public string NFS_DescontoCondicionado { get; set; } + public string NFS_Aliquota { get; set; } + + public string NFS_CodigoServico { get; set; } + public string NFS_CNAE { get; set; } + public string NFS_CodigoTributacaoMunicipio { get; set; } + public string NFS_Discriminacao { get; set; } + public string NFS_CodigoMunicipio { get; set; } + public string NFS_TributacaoRPS { get; set; } + public string NFS_CODPAIS { get; set; } + public string NFS_Exigibilidade { get; set; } + public string NFS_CodigoMunIncidencia { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasEnderecos.cs b/MLL/ModeloNotasEnderecos.cs new file mode 100644 index 0000000..c1e9afb --- /dev/null +++ b/MLL/ModeloNotasEnderecos.cs @@ -0,0 +1,51 @@ +using System; + +namespace MLL +{ + public class ModeloNotasEnderecos + { + public ModeloNotasEnderecos(int iD_NOTAS_ENDERECOS, string cODIGO, string cOD_NOTA, string cNPJ_CPF, + string xLgr, string nro, string xCpl, string xBairro, string xMun, string uF, + string tIPO, string dATA_CADASTRO, string cEP, string cPAIS, string xPAIS, + string fONE, string eMAIL, string iE) + { + ID_NOTAS_ENDERECOS = iD_NOTAS_ENDERECOS; + CODIGO = cODIGO; + COD_NOTA = cOD_NOTA; + CNPJ_CPF = cNPJ_CPF; + this.xLgr = xLgr; + this.nro = nro; + this.xCpl = xCpl; + this.xBairro = xBairro; + this.xMun = xMun; + UF = uF; + TIPO = tIPO; + DATA_CADASTRO = dATA_CADASTRO; + CEP = cEP; + CPAIS = cPAIS; + XPAIS = xPAIS; + FONE = fONE; + EMAIL = eMAIL; + IE = iE; + } + + public int ID_NOTAS_ENDERECOS { get; set; } + public string CODIGO { get; set; } + public string COD_NOTA { get; set; } + public string CNPJ_CPF { get; set; } + public string xLgr { get; set; } + public string nro { get; set; } + public string xCpl { get; set; } + public string xBairro { get; set; } + public string xMun { get; set; } + public string UF { get; set; } + public string TIPO { get; set; } + public string DATA_CADASTRO { get; set; } + public string CEP { get; set; } + public string CPAIS { get; set; } + public string XPAIS { get; set; } + public string FONE { get; set; } + public string EMAIL { get; set; } + public string IE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasFaturas.cs b/MLL/ModeloNotasFaturas.cs new file mode 100644 index 0000000..74eae4b --- /dev/null +++ b/MLL/ModeloNotasFaturas.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloNotasFaturas + { + public ModeloNotasFaturas(int iD_NOTAS_FATURAS, string cODIGO, string cOD_NOTA, string iNDICE, string nUMERO, string vENCTO, string vALOR) + { + ID_NOTAS_FATURAS = iD_NOTAS_FATURAS; + CODIGO = cODIGO; + COD_NOTA = cOD_NOTA; + INDICE = iNDICE; + NUMERO = nUMERO; + VENCTO = vENCTO; + VALOR = vALOR; + } + + public int ID_NOTAS_FATURAS { get; set; } + public string CODIGO { get; set; } + public string COD_NOTA { get; set; } + public string INDICE { get; set; } + public string NUMERO { get; set; } + public string VENCTO { get; set; } + public string VALOR { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasFiscais.cs b/MLL/ModeloNotasFiscais.cs new file mode 100644 index 0000000..2b01f05 --- /dev/null +++ b/MLL/ModeloNotasFiscais.cs @@ -0,0 +1,282 @@ +using System; + +namespace MLL +{ + public class ModeloNotasFiscais + { + public ModeloNotasFiscais(int iD_NOTAS_FISCAIS, string cODIGO, string sAIDA, string cFOP, string cFOP1, string nATUREZA, + string dESTINATARIO_NOME, string dESTINATARIO_ENDERECO, string dESTINATARIO_BAIRRO, string dESTINATARIO_CIDADE, + string dESTINATARIO_UF, string dESTINATARIO_CEP, string dESTINATARIO_TEL, string dESTINATARIO_FAX, string dESTINATARIO_EMAIL, + string dESTINATARIO_IE_RG, string dESTINATARIO_CNPJCPF, string dATA, string dATA_SAIDA, string bASE_ICMS, string bASE_ICMS_SUBS, + string vALOR_ICMS, string vALOR_ICMS_SUBS, string vALOR_FRETE, string vALOR_SEGURO, string vALOR_DESCONTO, string vALOR_ISS, string vALOR_IPI, + string oUTRAS_DESPESAS, string vALOR_IRRF, string vALOR_IRPJ, string vALOR_PIS, string vALOR_COFINS, string vALOR_CSLL, string vALOR_SIMPLES, + string vALOR_BENEF, string vALOR_INSS, string tOTAL_ISS, string tOTAL_IRRF, string tOTAL_IRPJ, string tOTAL_PIS, string tOTAL_COFINS, string tOTAL_CSLL, + string tOTAL_INSS, string tOTAL_SIMPLES, string tOTAL_DESC, string tOTAL_DEDUCOES, string tOTAL_SERVICOS, string tOTAL_PRODUTOS, string tOTAL, + string tRANSPORTADOR, string fRETE_POR, string fRETE_PLACA, string fRETE_QTD, string fRETE_PESO_BRUTO, string fRETE_PESO_LIQUIDO, string fRETE_MARCA, + string fRETE_ESPECIME, string fRETE_NUMERO, string fRETE_NOME, string fRETE_UF, string fRETE_CNPJCPF, string fRETE_IERG, string fRETE_ENDERECO, + string fRETE_MUNICIPIO, string fRETE_TUF, string oBSERVACOES, string dATA_CADASTRO, string cANCELADA, string dB_cs_ICMS_S, string dB_cs_FRETE, + string dB_cs_SEGURO, string dB_cs_DESPESAS, string dB_cin_FRETE, string dB_cin_SEGURO, string dB_cin_DESPESAS, string dB_cs_ISS, string dB_cs_IRRF, + string dB_cs_IRPJ, string dB_cs_PIS, string dB_cs_COFINS, string dB_cs_CSLL, string dB_cs_INSS, string dB_cs_SIMPLES, string nFE_ENFE, string iIIgnora, + string nFE_ID_CANCEL_DATE, string nFE_ID_CANCEL_PROT, string nFE_ID_AUTOR_DATE, string nFE_ID_AUTOR_PROT, string nFE_ID_CHAVE, string nFE_ARQ_NOTA, string nFE_ARQ_LOTE, + string nFE_LOG, string nFE_ENVIADA, string nFE_DANFE_IMP, string nFE_STATUS, string nFE_LAST_ERROR, string mOTIVO_CANCELA, string dESTINATARIO_COD_PAIS, string dESTINATARIO_NUMERO, + string dESTINATARIO_COMPLEM, string cOD_ANTT, string iNFO_FISCO, string cOMPRAS_PUBLICAS, string eXPORTA_EMBARQUE, string sERIE, string fINNFE, string rEFNFE, string idEstrangeiro, + string cbindIEDest, string indPres, string qAMBIENTE, string indFinal, string rEFNFE1, string rEFNFE2, string rEFNFE3, string idCadIntTran, string yB02_CNPJ, string yA05_CNPJ) + { + ID_NOTAS_FISCAIS = iD_NOTAS_FISCAIS; + CODIGO = cODIGO; + SAIDA = sAIDA; + CFOP = cFOP; + CFOP1 = cFOP1; + NATUREZA = nATUREZA; + DESTINATARIO_NOME = dESTINATARIO_NOME; + DESTINATARIO_ENDERECO = dESTINATARIO_ENDERECO; + DESTINATARIO_BAIRRO = dESTINATARIO_BAIRRO; + DESTINATARIO_CIDADE = dESTINATARIO_CIDADE; + DESTINATARIO_UF = dESTINATARIO_UF; + DESTINATARIO_CEP = dESTINATARIO_CEP; + DESTINATARIO_TEL = dESTINATARIO_TEL; + DESTINATARIO_FAX = dESTINATARIO_FAX; + DESTINATARIO_EMAIL = dESTINATARIO_EMAIL; + DESTINATARIO_IE_RG = dESTINATARIO_IE_RG; + DESTINATARIO_CNPJCPF = dESTINATARIO_CNPJCPF; + DATA = dATA; + DATA_SAIDA = dATA_SAIDA; + BASE_ICMS = bASE_ICMS; + BASE_ICMS_SUBS = bASE_ICMS_SUBS; + VALOR_ICMS = vALOR_ICMS; + VALOR_ICMS_SUBS = vALOR_ICMS_SUBS; + VALOR_FRETE = vALOR_FRETE; + VALOR_SEGURO = vALOR_SEGURO; + VALOR_DESCONTO = vALOR_DESCONTO; + VALOR_ISS = vALOR_ISS; + VALOR_IPI = vALOR_IPI; + OUTRAS_DESPESAS = oUTRAS_DESPESAS; + VALOR_IRRF = vALOR_IRRF; + VALOR_IRPJ = vALOR_IRPJ; + VALOR_PIS = vALOR_PIS; + VALOR_COFINS = vALOR_COFINS; + VALOR_CSLL = vALOR_CSLL; + VALOR_SIMPLES = vALOR_SIMPLES; + VALOR_BENEF = vALOR_BENEF; + VALOR_INSS = vALOR_INSS; + TOTAL_ISS = tOTAL_ISS; + TOTAL_IRRF = tOTAL_IRRF; + TOTAL_IRPJ = tOTAL_IRPJ; + TOTAL_PIS = tOTAL_PIS; + TOTAL_COFINS = tOTAL_COFINS; + TOTAL_CSLL = tOTAL_CSLL; + TOTAL_INSS = tOTAL_INSS; + TOTAL_SIMPLES = tOTAL_SIMPLES; + TOTAL_DESC = tOTAL_DESC; + TOTAL_DEDUCOES = tOTAL_DEDUCOES; + TOTAL_SERVICOS = tOTAL_SERVICOS; + TOTAL_PRODUTOS = tOTAL_PRODUTOS; + TOTAL = tOTAL; + TRANSPORTADOR = tRANSPORTADOR; + FRETE_POR = fRETE_POR; + FRETE_PLACA = fRETE_PLACA; + FRETE_QTD = fRETE_QTD; + FRETE_PESO_BRUTO = fRETE_PESO_BRUTO; + FRETE_PESO_LIQUIDO = fRETE_PESO_LIQUIDO; + FRETE_MARCA = fRETE_MARCA; + FRETE_ESPECIME = fRETE_ESPECIME; + FRETE_NUMERO = fRETE_NUMERO; + FRETE_NOME = fRETE_NOME; + FRETE_UF = fRETE_UF; + FRETE_CNPJCPF = fRETE_CNPJCPF; + FRETE_IERG = fRETE_IERG; + FRETE_ENDERECO = fRETE_ENDERECO; + FRETE_MUNICIPIO = fRETE_MUNICIPIO; + FRETE_TUF = fRETE_TUF; + OBSERVACOES = oBSERVACOES; + DATA_CADASTRO = dATA_CADASTRO; + CANCELADA = cANCELADA; + DB_cs_ICMS_S = dB_cs_ICMS_S; + DB_cs_FRETE = dB_cs_FRETE; + DB_cs_SEGURO = dB_cs_SEGURO; + DB_cs_DESPESAS = dB_cs_DESPESAS; + DB_cin_FRETE = dB_cin_FRETE; + DB_cin_SEGURO = dB_cin_SEGURO; + DB_cin_DESPESAS = dB_cin_DESPESAS; + DB_cs_ISS = dB_cs_ISS; + DB_cs_IRRF = dB_cs_IRRF; + DB_cs_IRPJ = dB_cs_IRPJ; + DB_cs_PIS = dB_cs_PIS; + DB_cs_COFINS = dB_cs_COFINS; + DB_cs_CSLL = dB_cs_CSLL; + DB_cs_INSS = dB_cs_INSS; + DB_cs_SIMPLES = dB_cs_SIMPLES; + NFE_ENFE = nFE_ENFE; + IIIgnora = iIIgnora; + NFE_ID_CANCEL_DATE = nFE_ID_CANCEL_DATE; + NFE_ID_CANCEL_PROT = nFE_ID_CANCEL_PROT; + NFE_ID_AUTOR_DATE = nFE_ID_AUTOR_DATE; + NFE_ID_AUTOR_PROT = nFE_ID_AUTOR_PROT; + NFE_ID_CHAVE = nFE_ID_CHAVE; + NFE_ARQ_NOTA = nFE_ARQ_NOTA; + NFE_ARQ_LOTE = nFE_ARQ_LOTE; + NFE_LOG = nFE_LOG; + NFE_ENVIADA = nFE_ENVIADA; + NFE_DANFE_IMP = nFE_DANFE_IMP; + NFE_STATUS = nFE_STATUS; + NFE_LAST_ERROR = nFE_LAST_ERROR; + MOTIVO_CANCELA = mOTIVO_CANCELA; + DESTINATARIO_COD_PAIS = dESTINATARIO_COD_PAIS; + DESTINATARIO_NUMERO = dESTINATARIO_NUMERO; + DESTINATARIO_COMPLEM = dESTINATARIO_COMPLEM; + COD_ANTT = cOD_ANTT; + INFO_FISCO = iNFO_FISCO; + COMPRAS_PUBLICAS = cOMPRAS_PUBLICAS; + EXPORTA_EMBARQUE = eXPORTA_EMBARQUE; + SERIE = sERIE; + FINNFE = fINNFE; + REFNFE = rEFNFE; + this.idEstrangeiro = idEstrangeiro; + this.cbindIEDest = cbindIEDest; + this.indPres = indPres; + QAMBIENTE = qAMBIENTE; + this.indFinal = indFinal; + REFNFE1 = rEFNFE1; + REFNFE2 = rEFNFE2; + REFNFE3 = rEFNFE3; + this.idCadIntTran = idCadIntTran; + YB02_CNPJ = yB02_CNPJ; + YA05_CNPJ = yA05_CNPJ; + } + + public int ID_NOTAS_FISCAIS { get; set; } + public string CODIGO { get; set; } + public string SAIDA { get; set; } + public string CFOP { get; set; } + public string CFOP1 { get; set; } + public string NATUREZA { get; set; } + + public string DESTINATARIO_NOME { get; set; } + public string DESTINATARIO_ENDERECO { get; set; } + public string DESTINATARIO_BAIRRO { get; set; } + public string DESTINATARIO_CIDADE { get; set; } + public string DESTINATARIO_UF { get; set; } + public string DESTINATARIO_CEP { get; set; } + public string DESTINATARIO_TEL { get; set; } + public string DESTINATARIO_FAX { get; set; } + public string DESTINATARIO_EMAIL { get; set; } + public string DESTINATARIO_IE_RG { get; set; } + public string DESTINATARIO_CNPJCPF { get; set; } + + public string DATA { get; set; } + public string DATA_SAIDA { get; set; } + + public string BASE_ICMS { get; set; } + public string BASE_ICMS_SUBS { get; set; } + public string VALOR_ICMS { get; set; } + public string VALOR_ICMS_SUBS { get; set; } + public string VALOR_FRETE { get; set; } + public string VALOR_SEGURO { get; set; } + public string VALOR_DESCONTO { get; set; } + public string VALOR_ISS { get; set; } + public string VALOR_IPI { get; set; } + public string OUTRAS_DESPESAS { get; set; } + public string VALOR_IRRF { get; set; } + public string VALOR_IRPJ { get; set; } + public string VALOR_PIS { get; set; } + public string VALOR_COFINS { get; set; } + public string VALOR_CSLL { get; set; } + public string VALOR_SIMPLES { get; set; } + public string VALOR_BENEF { get; set; } + public string VALOR_INSS { get; set; } + + public string TOTAL_ISS { get; set; } + public string TOTAL_IRRF { get; set; } + public string TOTAL_IRPJ { get; set; } + public string TOTAL_PIS { get; set; } + public string TOTAL_COFINS { get; set; } + public string TOTAL_CSLL { get; set; } + public string TOTAL_INSS { get; set; } + public string TOTAL_SIMPLES { get; set; } + public string TOTAL_DESC { get; set; } + public string TOTAL_DEDUCOES { get; set; } + public string TOTAL_SERVICOS { get; set; } + public string TOTAL_PRODUTOS { get; set; } + public string TOTAL { get; set; } + + public string TRANSPORTADOR { get; set; } + public string FRETE_POR { get; set; } + public string FRETE_PLACA { get; set; } + public string FRETE_QTD { get; set; } + public string FRETE_PESO_BRUTO { get; set; } + public string FRETE_PESO_LIQUIDO { get; set; } + public string FRETE_MARCA { get; set; } + public string FRETE_ESPECIME { get; set; } + public string FRETE_NUMERO { get; set; } + public string FRETE_NOME { get; set; } + public string FRETE_UF { get; set; } + public string FRETE_CNPJCPF { get; set; } + public string FRETE_IERG { get; set; } + public string FRETE_ENDERECO { get; set; } + public string FRETE_MUNICIPIO { get; set; } + public string FRETE_TUF { get; set; } + + public string OBSERVACOES { get; set; } + public string DATA_CADASTRO { get; set; } + public string CANCELADA { get; set; } + + public string DB_cs_ICMS_S { get; set; } + public string DB_cs_FRETE { get; set; } + public string DB_cs_SEGURO { get; set; } + public string DB_cs_DESPESAS { get; set; } + public string DB_cin_FRETE { get; set; } + public string DB_cin_SEGURO { get; set; } + public string DB_cin_DESPESAS { get; set; } + public string DB_cs_ISS { get; set; } + public string DB_cs_IRRF { get; set; } + public string DB_cs_IRPJ { get; set; } + public string DB_cs_PIS { get; set; } + public string DB_cs_COFINS { get; set; } + public string DB_cs_CSLL { get; set; } + public string DB_cs_INSS { get; set; } + public string DB_cs_SIMPLES { get; set; } + + public string NFE_ENFE { get; set; } + public string IIIgnora { get; set; } + public string NFE_ID_CANCEL_DATE { get; set; } + public string NFE_ID_CANCEL_PROT { get; set; } + public string NFE_ID_AUTOR_DATE { get; set; } + public string NFE_ID_AUTOR_PROT { get; set; } + public string NFE_ID_CHAVE { get; set; } + public string NFE_ARQ_NOTA { get; set; } + public string NFE_ARQ_LOTE { get; set; } + public string NFE_LOG { get; set; } + public string NFE_ENVIADA { get; set; } + public string NFE_DANFE_IMP { get; set; } + public string NFE_STATUS { get; set; } + public string NFE_LAST_ERROR { get; set; } + public string MOTIVO_CANCELA { get; set; } + + public string DESTINATARIO_COD_PAIS { get; set; } + public string DESTINATARIO_NUMERO { get; set; } + public string DESTINATARIO_COMPLEM { get; set; } + + public string COD_ANTT { get; set; } + public string INFO_FISCO { get; set; } + public string COMPRAS_PUBLICAS { get; set; } + public string EXPORTA_EMBARQUE { get; set; } + + public string SERIE { get; set; } + public string FINNFE { get; set; } + public string REFNFE { get; set; } + + public string idEstrangeiro { get; set; } + public string cbindIEDest { get; set; } + public string indPres { get; set; } + public string QAMBIENTE { get; set; } + public string indFinal { get; set; } + + public string REFNFE1 { get; set; } + public string REFNFE2 { get; set; } + public string REFNFE3 { get; set; } + + public string idCadIntTran { get; set; } + public string YB02_CNPJ { get; set; } + public string YA05_CNPJ { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasFiscaisConsumidor.cs b/MLL/ModeloNotasFiscaisConsumidor.cs new file mode 100644 index 0000000..0a4eb35 --- /dev/null +++ b/MLL/ModeloNotasFiscaisConsumidor.cs @@ -0,0 +1,116 @@ +using System; + +namespace MLL +{ + public class ModeloNotasFiscaisConsumidor + { + public ModeloNotasFiscaisConsumidor(int iD_NOTAS_FISCAIS_CONS, string cODIGO, string pRODUCAO, string sERIE, string nATUREZA, + string eMISSAO, string dEST_NOME, string dEST_EMAIL, string dEST_CPF_CNPJ, string dEST_IDESTRANGEIRO, + string dEST_xLgr, string dEST_CPL, string dEST_nro, string dEST_xBairro, string dEST_cMun, string dEST_xMun, + string dEST_UF, string dEST_CEP, string dEST_cPais, string dEST_xPais, string dEST_fone, string fRETE_MODALIDADE, + string fRETE_xCNPJ_CPF, string fRETE_xNome, string nFC_PRONTA, string nFC_infCpl, string tOTAL_vBC, string tOTAL_vICMS, + string tOTAL_vBCST, string tOTAL_vST, string tOTAL_vProd, string tOTAL_vFrete, string tOTAL_vSeg, string tOTAL_vDesc, string tOTAL_vII, + string tOTAL_vIPI, string tOTAL_vPIS, string tOTAL_vCOFINS, string tOTAL_vOutro, string tOTAL_vNF, string tERMINAL, string cHAVE_NFC, + string pROTOCOLO, string pROTOCOLO_CANCELA, string sITUACAO, string dATA_CADASTRO) + { + ID_NOTAS_FISCAIS_CONS = iD_NOTAS_FISCAIS_CONS; + CODIGO = cODIGO; + PRODUCAO = pRODUCAO; + SERIE = sERIE; + NATUREZA = nATUREZA; + EMISSAO = eMISSAO; + DEST_NOME = dEST_NOME; + DEST_EMAIL = dEST_EMAIL; + DEST_CPF_CNPJ = dEST_CPF_CNPJ; + DEST_IDESTRANGEIRO = dEST_IDESTRANGEIRO; + DEST_xLgr = dEST_xLgr; + DEST_CPL = dEST_CPL; + DEST_nro = dEST_nro; + DEST_xBairro = dEST_xBairro; + DEST_cMun = dEST_cMun; + DEST_xMun = dEST_xMun; + DEST_UF = dEST_UF; + DEST_CEP = dEST_CEP; + DEST_cPais = dEST_cPais; + DEST_xPais = dEST_xPais; + DEST_fone = dEST_fone; + FRETE_MODALIDADE = fRETE_MODALIDADE; + FRETE_xCNPJ_CPF = fRETE_xCNPJ_CPF; + FRETE_xNome = fRETE_xNome; + NFC_PRONTA = nFC_PRONTA; + NFC_infCpl = nFC_infCpl; + TOTAL_vBC = tOTAL_vBC; + TOTAL_vICMS = tOTAL_vICMS; + TOTAL_vBCST = tOTAL_vBCST; + TOTAL_vST = tOTAL_vST; + TOTAL_vProd = tOTAL_vProd; + TOTAL_vFrete = tOTAL_vFrete; + TOTAL_vSeg = tOTAL_vSeg; + TOTAL_vDesc = tOTAL_vDesc; + TOTAL_vII = tOTAL_vII; + TOTAL_vIPI = tOTAL_vIPI; + TOTAL_vPIS = tOTAL_vPIS; + TOTAL_vCOFINS = tOTAL_vCOFINS; + TOTAL_vOutro = tOTAL_vOutro; + TOTAL_vNF = tOTAL_vNF; + TERMINAL = tERMINAL; + CHAVE_NFC = cHAVE_NFC; + PROTOCOLO = pROTOCOLO; + PROTOCOLO_CANCELA = pROTOCOLO_CANCELA; + SITUACAO = sITUACAO; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_NOTAS_FISCAIS_CONS { get; set; } + public string CODIGO { get; set; } + public string PRODUCAO { get; set; } + public string SERIE { get; set; } + public string NATUREZA { get; set; } + public string EMISSAO { get; set; } + + public string DEST_NOME { get; set; } + public string DEST_EMAIL { get; set; } + public string DEST_CPF_CNPJ { get; set; } + public string DEST_IDESTRANGEIRO { get; set; } + public string DEST_xLgr { get; set; } + public string DEST_CPL { get; set; } + public string DEST_nro { get; set; } + public string DEST_xBairro { get; set; } + public string DEST_cMun { get; set; } + public string DEST_xMun { get; set; } + public string DEST_UF { get; set; } + public string DEST_CEP { get; set; } + public string DEST_cPais { get; set; } + public string DEST_xPais { get; set; } + public string DEST_fone { get; set; } + + public string FRETE_MODALIDADE { get; set; } + public string FRETE_xCNPJ_CPF { get; set; } + public string FRETE_xNome { get; set; } + + public string NFC_PRONTA { get; set; } + public string NFC_infCpl { get; set; } + + public string TOTAL_vBC { get; set; } + public string TOTAL_vICMS { get; set; } + public string TOTAL_vBCST { get; set; } + public string TOTAL_vST { get; set; } + public string TOTAL_vProd { get; set; } + public string TOTAL_vFrete { get; set; } + public string TOTAL_vSeg { get; set; } + public string TOTAL_vDesc { get; set; } + public string TOTAL_vII { get; set; } + public string TOTAL_vIPI { get; set; } + public string TOTAL_vPIS { get; set; } + public string TOTAL_vCOFINS { get; set; } + public string TOTAL_vOutro { get; set; } + public string TOTAL_vNF { get; set; } + + public string TERMINAL { get; set; } + public string CHAVE_NFC { get; set; } + public string PROTOCOLO { get; set; } + public string PROTOCOLO_CANCELA { get; set; } + public string SITUACAO { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasFormas.cs b/MLL/ModeloNotasFormas.cs new file mode 100644 index 0000000..c4be880 --- /dev/null +++ b/MLL/ModeloNotasFormas.cs @@ -0,0 +1,32 @@ +using System; + +namespace MLL +{ + public class ModeloNotasFormas + { + public ModeloNotasFormas(int iD_NOTAS_FORMAS, string cODIGO, string cOD_NFE, string nDUP, string vENCTO, string fORMA, string vALOR, string dATA_CADASTRO, string cNPJ_OPERADORA, string tBand) + { + ID_NOTAS_FORMAS = iD_NOTAS_FORMAS; + CODIGO = cODIGO; + COD_NFE = cOD_NFE; + this.nDUP = nDUP; + VENCTO = vENCTO; + FORMA = fORMA; + VALOR = vALOR; + DATA_CADASTRO = dATA_CADASTRO; + CNPJ_OPERADORA = cNPJ_OPERADORA; + this.tBand = tBand; + } + + public int ID_NOTAS_FORMAS { get; set; } + public string CODIGO { get; set; } + public string COD_NFE { get; set; } + public string nDUP { get; set; } + public string VENCTO { get; set; } + public string FORMA { get; set; } + public string VALOR { get; set; } + public string DATA_CADASTRO { get; set; } + public string CNPJ_OPERADORA { get; set; } + public string tBand { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasItensDetalha.cs b/MLL/ModeloNotasItensDetalha.cs new file mode 100644 index 0000000..7a541ac --- /dev/null +++ b/MLL/ModeloNotasItensDetalha.cs @@ -0,0 +1,93 @@ +using System; + +namespace MLL +{ + public class ModeloNotasItensDetalha + { + public ModeloNotasItensDetalha(int iD_NOTAS_ITENS_DETALHA, string cODIGO, string cOD_ITEM, string tIPO, string tpOp, + string chassi, string cCor, string xCor, string pot, string cilin, string pesoL, string pesoB, + string nSerie, string tpComb, string nMotor, string cMT, string dist, string anoMod, string anoFab, + string tpPint, string tpVeic, string espVeic, string vIN, string condVeic, string cMod, string cCorDENATRAN, + string lota, string tpRest, string tpArma, string nSerie_arma, string nCano, string descr, string nLote, string qLote, + string dFab, string dVal, string vPMC, string rECOPI) + { + ID_NOTAS_ITENS_DETALHA = iD_NOTAS_ITENS_DETALHA; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + TIPO = tIPO; + this.tpOp = tpOp; + this.chassi = chassi; + this.cCor = cCor; + this.xCor = xCor; + this.pot = pot; + this.cilin = cilin; + this.pesoL = pesoL; + this.pesoB = pesoB; + this.nSerie = nSerie; + this.tpComb = tpComb; + this.nMotor = nMotor; + CMT = cMT; + this.dist = dist; + this.anoMod = anoMod; + this.anoFab = anoFab; + this.tpPint = tpPint; + this.tpVeic = tpVeic; + this.espVeic = espVeic; + VIN = vIN; + this.condVeic = condVeic; + this.cMod = cMod; + this.cCorDENATRAN = cCorDENATRAN; + this.lota = lota; + this.tpRest = tpRest; + this.tpArma = tpArma; + NSerie_arma = nSerie_arma; + this.nCano = nCano; + this.descr = descr; + this.nLote = nLote; + this.qLote = qLote; + this.dFab = dFab; + this.dVal = dVal; + this.vPMC = vPMC; + RECOPI = rECOPI; + } + + public int ID_NOTAS_ITENS_DETALHA { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + public string TIPO { get; set; } + public string tpOp { get; set; } + public string chassi { get; set; } + public string cCor { get; set; } + public string xCor { get; set; } + public string pot { get; set; } + public string cilin { get; set; } + public string pesoL { get; set; } + public string pesoB { get; set; } + public string nSerie { get; set; } + public string tpComb { get; set; } + public string nMotor { get; set; } + public string CMT { get; set; } + public string dist { get; set; } + public string anoMod { get; set; } + public string anoFab { get; set; } + public string tpPint { get; set; } + public string tpVeic { get; set; } + public string espVeic { get; set; } + public string VIN { get; set; } + public string condVeic { get; set; } + public string cMod { get; set; } + public string cCorDENATRAN { get; set; } + public string lota { get; set; } + public string tpRest { get; set; } + public string tpArma { get; set; } + public string NSerie_arma { get; set; } + public string nCano { get; set; } + public string descr { get; set; } + public string nLote { get; set; } + public string qLote { get; set; } + public string dFab { get; set; } + public string dVal { get; set; } + public string vPMC { get; set; } + public string RECOPI { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasItensRastreabilidade.cs b/MLL/ModeloNotasItensRastreabilidade.cs new file mode 100644 index 0000000..681964b --- /dev/null +++ b/MLL/ModeloNotasItensRastreabilidade.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloNotasItensRastreabilidade + { + public ModeloNotasItensRastreabilidade(int iD_NOTAS_ITENS_RASTRE, string cODIGO, string cOD_ITEM, string nLote, string qLote, string dFab, string dVal, string cAgreg) + { + ID_NOTAS_ITENS_RASTRE = iD_NOTAS_ITENS_RASTRE; + CODIGO = cODIGO; + COD_ITEM = cOD_ITEM; + this.nLote = nLote; + this.qLote = qLote; + this.dFab = dFab; + this.dVal = dVal; + this.cAgreg = cAgreg; + } + + public int ID_NOTAS_ITENS_RASTRE { get; set; } + public string CODIGO { get; set; } + public string COD_ITEM { get; set; } + public string nLote { get; set; } + public string qLote { get; set; } + public string dFab { get; set; } + public string dVal { get; set; } + public string cAgreg { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasRefNFP.cs b/MLL/ModeloNotasRefNFP.cs new file mode 100644 index 0000000..b60981b --- /dev/null +++ b/MLL/ModeloNotasRefNFP.cs @@ -0,0 +1,36 @@ +using System; + +namespace MLL +{ + public class ModeloNotasRefNFP + { + public ModeloNotasRefNFP(int iD_NOTAS_REF_NFP, string cODIGO, string cOD_NOTA, string cUF, string aAMM, string cNPJ_CPF, string iE, string modelo, string serie, string nNF, string produtor, string dATA_CADASTRO) + { + ID_NOTAS_REF_NFP = iD_NOTAS_REF_NFP; + CODIGO = cODIGO; + COD_NOTA = cOD_NOTA; + this.cUF = cUF; + AAMM = aAMM; + CNPJ_CPF = cNPJ_CPF; + IE = iE; + Modelo = modelo; + this.serie = serie; + this.nNF = nNF; + Produtor = produtor; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_NOTAS_REF_NFP { get; set; } + public string CODIGO { get; set; } + public string COD_NOTA { get; set; } + public string cUF { get; set; } + public string AAMM { get; set; } + public string CNPJ_CPF { get; set; } + public string IE { get; set; } + public string Modelo { get; set; } + public string serie { get; set; } + public string nNF { get; set; } + public string Produtor { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasRetencoes.cs b/MLL/ModeloNotasRetencoes.cs new file mode 100644 index 0000000..53cc0f4 --- /dev/null +++ b/MLL/ModeloNotasRetencoes.cs @@ -0,0 +1,33 @@ +using System; + +namespace MLL +{ + public class ModeloNotasRetencoes + { + public ModeloNotasRetencoes(int iD_NOTAS_RETENCOES, string cODIGO, string cOD_NOTA, string vIRRF, + string vBCIRRF, string vBCRetPrev, string vRetPrev, string vRetCOFINS, string vRetCSLL, string vRetPIS) + { + ID_NOTAS_RETENCOES = iD_NOTAS_RETENCOES; + CODIGO = cODIGO; + COD_NOTA = cOD_NOTA; + this.vIRRF = vIRRF; + this.vBCIRRF = vBCIRRF; + this.vBCRetPrev = vBCRetPrev; + this.vRetPrev = vRetPrev; + this.vRetCOFINS = vRetCOFINS; + this.vRetCSLL = vRetCSLL; + this.vRetPIS = vRetPIS; + } + + public int ID_NOTAS_RETENCOES { get; set; } + public string CODIGO { get; set; } + public string COD_NOTA { get; set; } + public string vIRRF { get; set; } + public string vBCIRRF { get; set; } + public string vBCRetPrev { get; set; } + public string vRetPrev { get; set; } + public string vRetCOFINS { get; set; } + public string vRetCSLL { get; set; } + public string vRetPIS { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloNotasXml.cs b/MLL/ModeloNotasXml.cs new file mode 100644 index 0000000..a9dcb67 --- /dev/null +++ b/MLL/ModeloNotasXml.cs @@ -0,0 +1,18 @@ +using System; + +namespace MLL +{ + public class ModeloNotasXml + { + public ModeloNotasXml(int iD_NOTAS_XML, string cHAVE, string xML) + { + ID_NOTAS_XML = iD_NOTAS_XML; + CHAVE = cHAVE; + XML = xML; + } + + public int ID_NOTAS_XML { get; set; } + public string CHAVE { get; set; } + public string XML { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOSPecas.cs b/MLL/ModeloOSPecas.cs new file mode 100644 index 0000000..ae63d32 --- /dev/null +++ b/MLL/ModeloOSPecas.cs @@ -0,0 +1,44 @@ +using System; + +namespace MLL +{ + public class ModeloOSPecas + { + public ModeloOSPecas(int iD_OS_PECAS, string cODIGO, string dESCRICAO, string cOD_PECA, + string vALOR, string tECNICO, string qTD, string dIA, string cOD_OS, + string cUSTO, string sERIAIS_IN, string xPED, string nITEMPED, string cOD_BAIXA, string lOTES) + { + ID_OS_PECAS = iD_OS_PECAS; + CODIGO = cODIGO; + DESCRICAO = dESCRICAO; + COD_PECA = cOD_PECA; + VALOR = vALOR; + TECNICO = tECNICO; + QTD = qTD; + DIA = dIA; + COD_OS = cOD_OS; + CUSTO = cUSTO; + SERIAIS_IN = sERIAIS_IN; + XPED = xPED; + NITEMPED = nITEMPED; + COD_BAIXA = cOD_BAIXA; + LOTES = lOTES; + } + + public int ID_OS_PECAS { get; set; } + public string CODIGO { get; set; } + public string DESCRICAO { get; set; } + public string COD_PECA { get; set; } + public string VALOR { get; set; } + public string TECNICO { get; set; } + public string QTD { get; set; } + public string DIA { get; set; } + public string COD_OS { get; set; } + public string CUSTO { get; set; } + public string SERIAIS_IN { get; set; } + public string XPED { get; set; } + public string NITEMPED { get; set; } + public string COD_BAIXA { get; set; } + public string LOTES { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOSPerson.cs b/MLL/ModeloOSPerson.cs new file mode 100644 index 0000000..df7348e --- /dev/null +++ b/MLL/ModeloOSPerson.cs @@ -0,0 +1,295 @@ +using System; + +namespace MLL +{ + public class ModeloOSPerson + { + public ModeloOSPerson(int iD_OS_PERSON, string tX_DESC, string tX_MARCA, string tX_MODELO, string tX_SERIE, + string tX_PAT, string tX_DESLOCA, string tX_TERCEIROS, string cOBRA_DESLOCA, string cOBRA_TERCEIROS, + string pRAZO_GARANTIA, string tERMO_GARANTIA, string mODELO_RECEBE, string mODELO_ENTREGA, string tEXTO1, + string tEXTO2, string tEXTO3, string tEXTO4, string tEXTO5, string cOPIAS_REC, string cOPIAS_ENT, string oBS_REC1, + string oBS_REC2, string oBS_REC3, string oBS_REC4, string rODAPE_DEV1, string rODAPE_DEV2, string rODAPE_ENT1, string rODAPE_ENT2, + string pORTA_PRN, string cOM_PECASERV, string sO_TOTAL, string mYLOGO, string oS_COM_ENDE, string oS_SALTA_NP, string oRCA_POE_SERV, + string oRCA_POE_PECA, string oRCA_MAIL_TIPO, string oRCA_MAIL_SOLI, string oRCA_PRINT_GRAF, string mYLOGO_TELA, string oS_ABERTURA, + string oS_FINALIZA, string oS_TITULO, string oS_TEXTO_ENTREGA, string oS_TEXTO_ENCERRA, string oS_TEXTO_DEVOLVE, string cARTAS_FORNECE, + string cARTAS_CLIENTE, string cARTAS_CONTRATO, string cARTAS_ORCAS, string cARTAS_LAUDO, string oS_POE_OBS, string cOM_PECASERV_E, string nO_EPSON, + string oRCA_VIDA, string oS_COM_CPF, string oRCA_POE_END, string oRCA_POE_CPF, string oRCA_FORMAS, string oS_COM_DESC, string oS_TEXTO_EQUIPAM, string nF_OS, + string vENDA_ORCA_VALIDADE, string vENDA_ORCA_EXCLUI, string vENDA_MAXDESC, string vENDA_TEXTOLIVRE, string vENDA_IMPRAPOS, string vENDA_TEXTOLIVRE_ORCA, + string oS_GARANTIA_VAR, string lOGO_VENDA, string oS_CONTROLA3, string oRCA_MOD_BELO, string oS_DRAFT_SALTOS, string oS_KILOMET, string oS_CONDI_GERAL, + string oS_BOLETIM_EMAIL, string oS_BOLETIM_LAST, string vENDA_DRAFT_PORTA, string vENDA_DRAFT_SALTOS, string vENDA_40COLUNAS, string vENDA_COMP_ASSINA, + string vENDA_COMP_RECIBO, string vENDA_MAIL_IMG, string oRCA_MAIL_IMG, string oRCA_MOSTRA_UN, string cK_ORCA_MOSTRA_COD, string oS_BOLETIM_FECHADAS, + string oS_BOLETIM_SO_DO_DIA, string vENDA_ORCA_OCULTA, string vENDA_40COLUNAS_GRAF, string oRCA_TEXTO_APROVA, string oRCA_PAP_TIMBRADO, string bAIXA_ESTOQUE_NAHORA, + string qUERO_FABRICA, string vENDA_CLI_DIRECT, string vENDA_BALCAO_SEPARADO, string vENDA_ORCA_DADOS_CLI, string oS_PRINT_GUIA, string oS_FICHA_SERVICO, string wEB_PC_ENVIO, + string wEB_TEXTO_1, string wEB_TEXTO_2, string wEB_TEXTO_3, string wEB_TEXTO_4, string wEB_TEXTO_5, string wEB_EMAIL_RETORNO, string wEB_FORMA_PG, string wEB_OPC_OS, + string oS_EMAIL_ABRIR, string oS_EMAIL_FECHAR, string oS_CHAVE_WEB_TITULO, string oRCA_CHAVE_WEB_TITULO, string vENDA_OPCOES, string sUPORTECOD, string sUPORTEDTA, + string sERIAL_NFE_AMB, string cARTAS_LAUDO1, string cARTAS_LAUDO2, string vENDAS_CLIENTE_FIDELIZADO) + { + ID_OS_PERSON = iD_OS_PERSON; + TX_DESC = tX_DESC; + TX_MARCA = tX_MARCA; + TX_MODELO = tX_MODELO; + TX_SERIE = tX_SERIE; + TX_PAT = tX_PAT; + TX_DESLOCA = tX_DESLOCA; + TX_TERCEIROS = tX_TERCEIROS; + COBRA_DESLOCA = cOBRA_DESLOCA; + COBRA_TERCEIROS = cOBRA_TERCEIROS; + PRAZO_GARANTIA = pRAZO_GARANTIA; + TERMO_GARANTIA = tERMO_GARANTIA; + MODELO_RECEBE = mODELO_RECEBE; + MODELO_ENTREGA = mODELO_ENTREGA; + TEXTO1 = tEXTO1; + TEXTO2 = tEXTO2; + TEXTO3 = tEXTO3; + TEXTO4 = tEXTO4; + TEXTO5 = tEXTO5; + COPIAS_REC = cOPIAS_REC; + COPIAS_ENT = cOPIAS_ENT; + OBS_REC1 = oBS_REC1; + OBS_REC2 = oBS_REC2; + OBS_REC3 = oBS_REC3; + OBS_REC4 = oBS_REC4; + RODAPE_DEV1 = rODAPE_DEV1; + RODAPE_DEV2 = rODAPE_DEV2; + RODAPE_ENT1 = rODAPE_ENT1; + RODAPE_ENT2 = rODAPE_ENT2; + PORTA_PRN = pORTA_PRN; + COM_PECASERV = cOM_PECASERV; + SO_TOTAL = sO_TOTAL; + MYLOGO = mYLOGO; + OS_COM_ENDE = oS_COM_ENDE; + OS_SALTA_NP = oS_SALTA_NP; + ORCA_POE_SERV = oRCA_POE_SERV; + ORCA_POE_PECA = oRCA_POE_PECA; + ORCA_MAIL_TIPO = oRCA_MAIL_TIPO; + ORCA_MAIL_SOLI = oRCA_MAIL_SOLI; + ORCA_PRINT_GRAF = oRCA_PRINT_GRAF; + MYLOGO_TELA = mYLOGO_TELA; + OS_ABERTURA = oS_ABERTURA; + OS_FINALIZA = oS_FINALIZA; + OS_TITULO = oS_TITULO; + OS_TEXTO_ENTREGA = oS_TEXTO_ENTREGA; + OS_TEXTO_ENCERRA = oS_TEXTO_ENCERRA; + OS_TEXTO_DEVOLVE = oS_TEXTO_DEVOLVE; + CARTAS_FORNECE = cARTAS_FORNECE; + CARTAS_CLIENTE = cARTAS_CLIENTE; + CARTAS_CONTRATO = cARTAS_CONTRATO; + CARTAS_ORCAS = cARTAS_ORCAS; + CARTAS_LAUDO = cARTAS_LAUDO; + OS_POE_OBS = oS_POE_OBS; + COM_PECASERV_E = cOM_PECASERV_E; + NO_EPSON = nO_EPSON; + ORCA_VIDA = oRCA_VIDA; + OS_COM_CPF = oS_COM_CPF; + ORCA_POE_END = oRCA_POE_END; + ORCA_POE_CPF = oRCA_POE_CPF; + ORCA_FORMAS = oRCA_FORMAS; + OS_COM_DESC = oS_COM_DESC; + OS_TEXTO_EQUIPAM = oS_TEXTO_EQUIPAM; + NF_OS = nF_OS; + VENDA_ORCA_VALIDADE = vENDA_ORCA_VALIDADE; + VENDA_ORCA_EXCLUI = vENDA_ORCA_EXCLUI; + VENDA_MAXDESC = vENDA_MAXDESC; + VENDA_TEXTOLIVRE = vENDA_TEXTOLIVRE; + VENDA_IMPRAPOS = vENDA_IMPRAPOS; + VENDA_TEXTOLIVRE_ORCA = vENDA_TEXTOLIVRE_ORCA; + OS_GARANTIA_VAR = oS_GARANTIA_VAR; + LOGO_VENDA = lOGO_VENDA; + OS_CONTROLA3 = oS_CONTROLA3; + ORCA_MOD_BELO = oRCA_MOD_BELO; + OS_DRAFT_SALTOS = oS_DRAFT_SALTOS; + OS_KILOMET = oS_KILOMET; + OS_CONDI_GERAL = oS_CONDI_GERAL; + OS_BOLETIM_EMAIL = oS_BOLETIM_EMAIL; + OS_BOLETIM_LAST = oS_BOLETIM_LAST; + VENDA_DRAFT_PORTA = vENDA_DRAFT_PORTA; + VENDA_DRAFT_SALTOS = vENDA_DRAFT_SALTOS; + VENDA_40COLUNAS = vENDA_40COLUNAS; + VENDA_COMP_ASSINA = vENDA_COMP_ASSINA; + VENDA_COMP_RECIBO = vENDA_COMP_RECIBO; + VENDA_MAIL_IMG = vENDA_MAIL_IMG; + ORCA_MAIL_IMG = oRCA_MAIL_IMG; + ORCA_MOSTRA_UN = oRCA_MOSTRA_UN; + CK_ORCA_MOSTRA_COD = cK_ORCA_MOSTRA_COD; + OS_BOLETIM_FECHADAS = oS_BOLETIM_FECHADAS; + OS_BOLETIM_SO_DO_DIA = oS_BOLETIM_SO_DO_DIA; + VENDA_ORCA_OCULTA = vENDA_ORCA_OCULTA; + VENDA_40COLUNAS_GRAF = vENDA_40COLUNAS_GRAF; + ORCA_TEXTO_APROVA = oRCA_TEXTO_APROVA; + ORCA_PAP_TIMBRADO = oRCA_PAP_TIMBRADO; + BAIXA_ESTOQUE_NAHORA = bAIXA_ESTOQUE_NAHORA; + QUERO_FABRICA = qUERO_FABRICA; + VENDA_CLI_DIRECT = vENDA_CLI_DIRECT; + VENDA_BALCAO_SEPARADO = vENDA_BALCAO_SEPARADO; + VENDA_ORCA_DADOS_CLI = vENDA_ORCA_DADOS_CLI; + OS_PRINT_GUIA = oS_PRINT_GUIA; + OS_FICHA_SERVICO = oS_FICHA_SERVICO; + WEB_PC_ENVIO = wEB_PC_ENVIO; + WEB_TEXTO_1 = wEB_TEXTO_1; + WEB_TEXTO_2 = wEB_TEXTO_2; + WEB_TEXTO_3 = wEB_TEXTO_3; + WEB_TEXTO_4 = wEB_TEXTO_4; + WEB_TEXTO_5 = wEB_TEXTO_5; + WEB_EMAIL_RETORNO = wEB_EMAIL_RETORNO; + WEB_FORMA_PG = wEB_FORMA_PG; + WEB_OPC_OS = wEB_OPC_OS; + OS_EMAIL_ABRIR = oS_EMAIL_ABRIR; + OS_EMAIL_FECHAR = oS_EMAIL_FECHAR; + OS_CHAVE_WEB_TITULO = oS_CHAVE_WEB_TITULO; + ORCA_CHAVE_WEB_TITULO = oRCA_CHAVE_WEB_TITULO; + VENDA_OPCOES = vENDA_OPCOES; + SUPORTECOD = sUPORTECOD; + SUPORTEDTA = sUPORTEDTA; + SERIAL_NFE_AMB = sERIAL_NFE_AMB; + CARTAS_LAUDO1 = cARTAS_LAUDO1; + CARTAS_LAUDO2 = cARTAS_LAUDO2; + VENDAS_CLIENTE_FIDELIZADO = vENDAS_CLIENTE_FIDELIZADO; + } + + public int ID_OS_PERSON { get; set; } + public string TX_DESC { get; set; } + public string TX_MARCA { get; set; } + public string TX_MODELO { get; set; } + public string TX_SERIE { get; set; } + public string TX_PAT { get; set; } + public string TX_DESLOCA { get; set; } + public string TX_TERCEIROS { get; set; } + public string COBRA_DESLOCA { get; set; } + public string COBRA_TERCEIROS { get; set; } + public string PRAZO_GARANTIA { get; set; } + public string TERMO_GARANTIA { get; set; } + public string MODELO_RECEBE { get; set; } + public string MODELO_ENTREGA { get; set; } + + public string TEXTO1 { get; set; } + public string TEXTO2 { get; set; } + public string TEXTO3 { get; set; } + public string TEXTO4 { get; set; } + public string TEXTO5 { get; set; } + + public string COPIAS_REC { get; set; } + public string COPIAS_ENT { get; set; } + + public string OBS_REC1 { get; set; } + public string OBS_REC2 { get; set; } + public string OBS_REC3 { get; set; } + public string OBS_REC4 { get; set; } + + public string RODAPE_DEV1 { get; set; } + public string RODAPE_DEV2 { get; set; } + public string RODAPE_ENT1 { get; set; } + public string RODAPE_ENT2 { get; set; } + + public string PORTA_PRN { get; set; } + public string COM_PECASERV { get; set; } + public string SO_TOTAL { get; set; } + public string MYLOGO { get; set; } + public string OS_COM_ENDE { get; set; } + public string OS_SALTA_NP { get; set; } + + public string ORCA_POE_SERV { get; set; } + public string ORCA_POE_PECA { get; set; } + public string ORCA_MAIL_TIPO { get; set; } + public string ORCA_MAIL_SOLI { get; set; } + public string ORCA_PRINT_GRAF { get; set; } + public string MYLOGO_TELA { get; set; } + + public string OS_ABERTURA { get; set; } + public string OS_FINALIZA { get; set; } + public string OS_TITULO { get; set; } + public string OS_TEXTO_ENTREGA { get; set; } + public string OS_TEXTO_ENCERRA { get; set; } + public string OS_TEXTO_DEVOLVE { get; set; } + + public string CARTAS_FORNECE { get; set; } + public string CARTAS_CLIENTE { get; set; } + public string CARTAS_CONTRATO { get; set; } + public string CARTAS_ORCAS { get; set; } + public string CARTAS_LAUDO { get; set; } + + public string OS_POE_OBS { get; set; } + public string COM_PECASERV_E { get; set; } + public string NO_EPSON { get; set; } + public string ORCA_VIDA { get; set; } + public string OS_COM_CPF { get; set; } + public string ORCA_POE_END { get; set; } + public string ORCA_POE_CPF { get; set; } + public string ORCA_FORMAS { get; set; } + public string OS_COM_DESC { get; set; } + public string OS_TEXTO_EQUIPAM { get; set; } + + public string NF_OS { get; set; } + public string VENDA_ORCA_VALIDADE { get; set; } + public string VENDA_ORCA_EXCLUI { get; set; } + public string VENDA_MAXDESC { get; set; } + public string VENDA_TEXTOLIVRE { get; set; } + public string VENDA_IMPRAPOS { get; set; } + public string VENDA_TEXTOLIVRE_ORCA { get; set; } + + public string OS_GARANTIA_VAR { get; set; } + public string LOGO_VENDA { get; set; } + public string OS_CONTROLA3 { get; set; } + public string ORCA_MOD_BELO { get; set; } + public string OS_DRAFT_SALTOS { get; set; } + public string OS_KILOMET { get; set; } + public string OS_CONDI_GERAL { get; set; } + + public string OS_BOLETIM_EMAIL { get; set; } + public string OS_BOLETIM_LAST { get; set; } + + public string VENDA_DRAFT_PORTA { get; set; } + public string VENDA_DRAFT_SALTOS { get; set; } + public string VENDA_40COLUNAS { get; set; } + public string VENDA_COMP_ASSINA { get; set; } + public string VENDA_COMP_RECIBO { get; set; } + public string VENDA_MAIL_IMG { get; set; } + + public string ORCA_MAIL_IMG { get; set; } + public string ORCA_MOSTRA_UN { get; set; } + public string CK_ORCA_MOSTRA_COD { get; set; } + + public string OS_BOLETIM_FECHADAS { get; set; } + public string OS_BOLETIM_SO_DO_DIA { get; set; } + + public string VENDA_ORCA_OCULTA { get; set; } + public string VENDA_40COLUNAS_GRAF { get; set; } + public string ORCA_TEXTO_APROVA { get; set; } + public string ORCA_PAP_TIMBRADO { get; set; } + + public string BAIXA_ESTOQUE_NAHORA { get; set; } + public string QUERO_FABRICA { get; set; } + public string VENDA_CLI_DIRECT { get; set; } + public string VENDA_BALCAO_SEPARADO { get; set; } + public string VENDA_ORCA_DADOS_CLI { get; set; } + + public string OS_PRINT_GUIA { get; set; } + public string OS_FICHA_SERVICO { get; set; } + + public string WEB_PC_ENVIO { get; set; } + public string WEB_TEXTO_1 { get; set; } + public string WEB_TEXTO_2 { get; set; } + public string WEB_TEXTO_3 { get; set; } + public string WEB_TEXTO_4 { get; set; } + public string WEB_TEXTO_5 { get; set; } + + public string WEB_EMAIL_RETORNO { get; set; } + public string WEB_FORMA_PG { get; set; } + public string WEB_OPC_OS { get; set; } + + public string OS_EMAIL_ABRIR { get; set; } + public string OS_EMAIL_FECHAR { get; set; } + + public string OS_CHAVE_WEB_TITULO { get; set; } + public string ORCA_CHAVE_WEB_TITULO { get; set; } + + public string VENDA_OPCOES { get; set; } + public string SUPORTECOD { get; set; } + public string SUPORTEDTA { get; set; } + public string SERIAL_NFE_AMB { get; set; } + + public string CARTAS_LAUDO1 { get; set; } + public string CARTAS_LAUDO2 { get; set; } + + public string VENDAS_CLIENTE_FIDELIZADO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOSServicos.cs b/MLL/ModeloOSServicos.cs new file mode 100644 index 0000000..c4cd16d --- /dev/null +++ b/MLL/ModeloOSServicos.cs @@ -0,0 +1,48 @@ +using System; + +namespace MLL +{ + public class ModeloOSServicos + { + public ModeloOSServicos(int iD_OS_SEVICOS, string cODIGO, string dESCRICAO, string tOTAL, string iNICIO, string fIM, string tECNICO, string tIPO, string oS_NUM, string cOD_SERV, string qTD, string v_FRETE, string v_SEGURO, string v_OUTROS, string nUM_NF_PED, string cUSTO, string xPED, string nITEMPED) + { + ID_OS_SEVICOS = iD_OS_SEVICOS; + CODIGO = cODIGO; + DESCRICAO = dESCRICAO; + TOTAL = tOTAL; + INICIO = iNICIO; + FIM = fIM; + TECNICO = tECNICO; + TIPO = tIPO; + OS_NUM = oS_NUM; + COD_SERV = cOD_SERV; + QTD = qTD; + V_FRETE = v_FRETE; + V_SEGURO = v_SEGURO; + V_OUTROS = v_OUTROS; + NUM_NF_PED = nUM_NF_PED; + CUSTO = cUSTO; + XPED = xPED; + NITEMPED = nITEMPED; + } + + public int ID_OS_SEVICOS { get; set; } + public string CODIGO { get; set; } + public string DESCRICAO { get; set; } + public string TOTAL { get; set; } + public string INICIO { get; set; } + public string FIM { get; set; } + public string TECNICO { get; set; } + public string TIPO { get; set; } + public string OS_NUM { get; set; } + public string COD_SERV { get; set; } + public string QTD { get; set; } + public string V_FRETE { get; set; } + public string V_SEGURO { get; set; } + public string V_OUTROS { get; set; } + public string NUM_NF_PED { get; set; } + public string CUSTO { get; set; } + public string XPED { get; set; } + public string NITEMPED { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrcaPadrao.cs b/MLL/ModeloOrcaPadrao.cs new file mode 100644 index 0000000..4b372f8 --- /dev/null +++ b/MLL/ModeloOrcaPadrao.cs @@ -0,0 +1,25 @@ +using System; + +namespace MLL +{ + public class ModeloOrcaPadrao + { + public ModeloOrcaPadrao(int iD_ORCA_PADRAO, string cODIGO, string nOME, string oBS, string sHOW_OBS, string uSADO) + { + ID_ORCA_PADRAO = iD_ORCA_PADRAO; + CODIGO = cODIGO; + NOME = nOME; + OBS = oBS; + SHOW_OBS = sHOW_OBS; + USADO = uSADO; + } + + + public int ID_ORCA_PADRAO { get; set; } + public string CODIGO { get; set; } + public string NOME { get; set; } + public string OBS { get; set; } + public string SHOW_OBS { get; set; } + public string USADO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrcaPadraoItens.cs b/MLL/ModeloOrcaPadraoItens.cs new file mode 100644 index 0000000..a30d1a7 --- /dev/null +++ b/MLL/ModeloOrcaPadraoItens.cs @@ -0,0 +1,24 @@ +using System; + +namespace MLL +{ + public class ModeloOrcaPadraoItens + { + public ModeloOrcaPadraoItens(int iD_ORCA_PADRAO_ITENS, string cODIGO, string cOD_ORCA, string iTEM_TIPO, string iTEM_COD, string iTEM_QTD) + { + ID_ORCA_PADRAO_ITENS = iD_ORCA_PADRAO_ITENS; + CODIGO = cODIGO; + COD_ORCA = cOD_ORCA; + ITEM_TIPO = iTEM_TIPO; + ITEM_COD = iTEM_COD; + ITEM_QTD = iTEM_QTD; + } + + public int ID_ORCA_PADRAO_ITENS { get; set; } + public string CODIGO { get; set; } + public string COD_ORCA { get; set; } + public string ITEM_TIPO { get; set; } + public string ITEM_COD { get; set; } + public string ITEM_QTD { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrcas.cs b/MLL/ModeloOrcas.cs new file mode 100644 index 0000000..a40cf38 --- /dev/null +++ b/MLL/ModeloOrcas.cs @@ -0,0 +1,49 @@ +using System; + +namespace MLL +{ + public class ModeloOrcas + { + public ModeloOrcas(int iD_ORCAS, string cODIGO, string oPERADOR, string tOTAL, string dIA, + string cOMISSAO, string cLIENTE, string dESCONTO, string tOTAL_SERVICOS, + string tOTAL_PECAS, string tOTAL_IMPOSTOS, string vENCIMENTO, string tOTAL_GERAL, + string sITUACAO, string cLIENTE_CAD, string cLIENTE_NOME, string oBS) + { + ID_ORCAS = iD_ORCAS; + CODIGO = cODIGO; + OPERADOR = oPERADOR; + TOTAL = tOTAL; + DIA = dIA; + COMISSAO = cOMISSAO; + CLIENTE = cLIENTE; + DESCONTO = dESCONTO; + TOTAL_SERVICOS = tOTAL_SERVICOS; + TOTAL_PECAS = tOTAL_PECAS; + TOTAL_IMPOSTOS = tOTAL_IMPOSTOS; + VENCIMENTO = vENCIMENTO; + TOTAL_GERAL = tOTAL_GERAL; + SITUACAO = sITUACAO; + CLIENTE_CAD = cLIENTE_CAD; + CLIENTE_NOME = cLIENTE_NOME; + OBS = oBS; + } + + public int ID_ORCAS { get; set; } + public string CODIGO { get; set; } + public string OPERADOR { get; set; } + public string TOTAL { get; set; } + public string DIA { get; set; } + public string COMISSAO { get; set; } + public string CLIENTE { get; set; } + public string DESCONTO { get; set; } + public string TOTAL_SERVICOS { get; set; } + public string TOTAL_PECAS { get; set; } + public string TOTAL_IMPOSTOS { get; set; } + public string VENCIMENTO { get; set; } + public string TOTAL_GERAL { get; set; } + public string SITUACAO { get; set; } + public string CLIENTE_CAD { get; set; } + public string CLIENTE_NOME { get; set; } + public string OBS { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrdens.cs b/MLL/ModeloOrdens.cs new file mode 100644 index 0000000..afad194 --- /dev/null +++ b/MLL/ModeloOrdens.cs @@ -0,0 +1,126 @@ +using System; + +namespace MLL +{ + public class ModeloOrdens + { + public ModeloOrdens(int iD_ORDENS, string cODIGO, string cOD_CLIENTE, string eNTRADA, string pRONTO, + string sAIDA, string gARANTIA, string sITUACAO, string v_MAO, string v_PECAS, string v_DESLOCA, + string v_TERCEIRO, string v_OUTROS, string cOD_EQUIP, string aPARELHO, string mARCA, string mODELO, + string sERIE, string pATRIMONIO, string aCESSORIO, string dEFEITO, string oBS_SERVICO, string lAUDO, + string oBS_APARELHO, string kILOMET, string eM_USO, string nF_NUMERO, string oS_REABERTA, string oS_OUTROS, + string oS_OUTROS_EMIT, string oS_SINAL, string pRIOR, string oS_NF_REMESSA, string oS_NF_VALOR, string oS_NF_EMIT, + string oS_GARANTIDOR, string oS_GARANTIDOR_SN, string wEB_CHAVE, string wEB_SENHA, string uSER_MICRO, string oRCA_FORMAS, + string oS_FABRICANTE, string aLERTA_ABANDONO, string tECNICO_FIXO, string nFC_NUMERO, string pREVISTO, string aTENDENTE, string nFS_NUMERO) + { + ID_ORDENS = iD_ORDENS; + CODIGO = cODIGO; + COD_CLIENTE = cOD_CLIENTE; + ENTRADA = eNTRADA; + PRONTO = pRONTO; + SAIDA = sAIDA; + GARANTIA = gARANTIA; + SITUACAO = sITUACAO; + V_MAO = v_MAO; + V_PECAS = v_PECAS; + V_DESLOCA = v_DESLOCA; + V_TERCEIRO = v_TERCEIRO; + V_OUTROS = v_OUTROS; + COD_EQUIP = cOD_EQUIP; + APARELHO = aPARELHO; + MARCA = mARCA; + MODELO = mODELO; + SERIE = sERIE; + PATRIMONIO = pATRIMONIO; + ACESSORIO = aCESSORIO; + DEFEITO = dEFEITO; + OBS_SERVICO = oBS_SERVICO; + LAUDO = lAUDO; + OBS_APARELHO = oBS_APARELHO; + KILOMET = kILOMET; + EM_USO = eM_USO; + NF_NUMERO = nF_NUMERO; + OS_REABERTA = oS_REABERTA; + OS_OUTROS = oS_OUTROS; + OS_OUTROS_EMIT = oS_OUTROS_EMIT; + OS_SINAL = oS_SINAL; + PRIOR = pRIOR; + OS_NF_REMESSA = oS_NF_REMESSA; + OS_NF_VALOR = oS_NF_VALOR; + OS_NF_EMIT = oS_NF_EMIT; + OS_GARANTIDOR = oS_GARANTIDOR; + OS_GARANTIDOR_SN = oS_GARANTIDOR_SN; + WEB_CHAVE = wEB_CHAVE; + WEB_SENHA = wEB_SENHA; + USER_MICRO = uSER_MICRO; + ORCA_FORMAS = oRCA_FORMAS; + OS_FABRICANTE = oS_FABRICANTE; + ALERTA_ABANDONO = aLERTA_ABANDONO; + TECNICO_FIXO = tECNICO_FIXO; + NFC_NUMERO = nFC_NUMERO; + PREVISTO = pREVISTO; + ATENDENTE = aTENDENTE; + NFS_NUMERO = nFS_NUMERO; + } + + public int ID_ORDENS { get; set; } + public string CODIGO { get; set; } + public string COD_CLIENTE { get; set; } + public string ENTRADA { get; set; } + public string PRONTO { get; set; } + public string SAIDA { get; set; } + public string GARANTIA { get; set; } + public string SITUACAO { get; set; } + + public string V_MAO { get; set; } + public string V_PECAS { get; set; } + public string V_DESLOCA { get; set; } + public string V_TERCEIRO { get; set; } + public string V_OUTROS { get; set; } + + public string COD_EQUIP { get; set; } + public string APARELHO { get; set; } + public string MARCA { get; set; } + public string MODELO { get; set; } + public string SERIE { get; set; } + public string PATRIMONIO { get; set; } + public string ACESSORIO { get; set; } + + public string DEFEITO { get; set; } + public string OBS_SERVICO { get; set; } + public string LAUDO { get; set; } + public string OBS_APARELHO { get; set; } + + public string KILOMET { get; set; } + public string EM_USO { get; set; } + + public string NF_NUMERO { get; set; } + public string OS_REABERTA { get; set; } + public string OS_OUTROS { get; set; } + public string OS_OUTROS_EMIT { get; set; } + public string OS_SINAL { get; set; } + + public string PRIOR { get; set; } + public string OS_NF_REMESSA { get; set; } + public string OS_NF_VALOR { get; set; } + public string OS_NF_EMIT { get; set; } + + public string OS_GARANTIDOR { get; set; } + public string OS_GARANTIDOR_SN { get; set; } + + public string WEB_CHAVE { get; set; } + public string WEB_SENHA { get; set; } + + public string USER_MICRO { get; set; } + public string ORCA_FORMAS { get; set; } + + public string OS_FABRICANTE { get; set; } + public string ALERTA_ABANDONO { get; set; } + public string TECNICO_FIXO { get; set; } + + public string NFC_NUMERO { get; set; } + public string PREVISTO { get; set; } + public string ATENDENTE { get; set; } + public string NFS_NUMERO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrdensContato.cs b/MLL/ModeloOrdensContato.cs new file mode 100644 index 0000000..a782e9b --- /dev/null +++ b/MLL/ModeloOrdensContato.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloOrdensContato + { + public ModeloOrdensContato(int iD_ORDENS_CONTATO, string cODIGO, string cOD_ORDEM, string dESCRICAO, string qUEM, string uSUARIO, string dATA_CADASTRO) + { + ID_ORDENS_CONTATO = iD_ORDENS_CONTATO; + CODIGO = cODIGO; + COD_ORDEM = cOD_ORDEM; + DESCRICAO = dESCRICAO; + QUEM = qUEM; + USUARIO = uSUARIO; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_ORDENS_CONTATO { get; set; } + public string CODIGO { get; set; } + public string COD_ORDEM { get; set; } + public string DESCRICAO { get; set; } + public string QUEM { get; set; } + public string USUARIO { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrdensDeslocamento.cs b/MLL/ModeloOrdensDeslocamento.cs new file mode 100644 index 0000000..4e9a2b4 --- /dev/null +++ b/MLL/ModeloOrdensDeslocamento.cs @@ -0,0 +1,42 @@ +using System; + +namespace MLL +{ + public class ModeloOrdensDeslocamento + { + public ModeloOrdensDeslocamento(int iD_ORDENS_DESLOCAMENTO, string cODIGO, string cOD_ORDEM, string dIA, string hORA_SAI, string kM_SAI, string hORA_CHEGA, string kM_CHEGA, string hORA_VOLTA_SAI, string kM_VOLTA_SAI, string hORA_VOLTA, string kM_VOLTA, string aLIMENTA, string hOSPEDA, string dATA_CADASTRO) + { + ID_ORDENS_DESLOCAMENTO = iD_ORDENS_DESLOCAMENTO; + CODIGO = cODIGO; + COD_ORDEM = cOD_ORDEM; + DIA = dIA; + HORA_SAI = hORA_SAI; + KM_SAI = kM_SAI; + HORA_CHEGA = hORA_CHEGA; + KM_CHEGA = kM_CHEGA; + HORA_VOLTA_SAI = hORA_VOLTA_SAI; + KM_VOLTA_SAI = kM_VOLTA_SAI; + HORA_VOLTA = hORA_VOLTA; + KM_VOLTA = kM_VOLTA; + ALIMENTA = aLIMENTA; + HOSPEDA = hOSPEDA; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_ORDENS_DESLOCAMENTO { get; set; } + public string CODIGO { get; set; } + public string COD_ORDEM { get; set; } + public string DIA { get; set; } + public string HORA_SAI { get; set; } + public string KM_SAI { get; set; } + public string HORA_CHEGA { get; set; } + public string KM_CHEGA { get; set; } + public string HORA_VOLTA_SAI { get; set; } + public string KM_VOLTA_SAI { get; set; } + public string HORA_VOLTA { get; set; } + public string KM_VOLTA { get; set; } + public string ALIMENTA { get; set; } + public string HOSPEDA { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloOrdensInsumos.cs b/MLL/ModeloOrdensInsumos.cs new file mode 100644 index 0000000..342825b --- /dev/null +++ b/MLL/ModeloOrdensInsumos.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloOrdensInsumos + { + public ModeloOrdensInsumos(int iD_ORDENS_INSUMOS, string cODIGO, string cOD_OS, string cOD_ITEM, string qTD, string cUSTO_UNIT, string cUSTO, string oBSERVACOES) + { + ID_ORDENS_INSUMOS = iD_ORDENS_INSUMOS; + CODIGO = cODIGO; + COD_OS = cOD_OS; + COD_ITEM = cOD_ITEM; + QTD = qTD; + CUSTO_UNIT = cUSTO_UNIT; + CUSTO = cUSTO; + OBSERVACOES = oBSERVACOES; + } + + public int ID_ORDENS_INSUMOS { get; set; } + public string CODIGO { get; set; } + public string COD_OS { get; set; } + public string COD_ITEM { get; set; } + public string QTD { get; set; } + public string CUSTO_UNIT { get; set; } + public string CUSTO { get; set; } + public string OBSERVACOES { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloParametros.cs b/MLL/ModeloParametros.cs new file mode 100644 index 0000000..fd4c8fb --- /dev/null +++ b/MLL/ModeloParametros.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloParametros + { + public ModeloParametros(int iD_PARAMETROS, string cODIGO, string nOME_PAR, string dESCRICAO, string pX, string pY, string cAMPO, string aTIVO) + { + ID_PARAMETROS = iD_PARAMETROS; + CODIGO = cODIGO; + NOME_PAR = nOME_PAR; + DESCRICAO = dESCRICAO; + PX = pX; + PY = pY; + CAMPO = cAMPO; + ATIVO = aTIVO; + } + + public int ID_PARAMETROS { get; set; } + public string CODIGO { get; set; } + public string NOME_PAR { get; set; } + public string DESCRICAO { get; set; } + public string PX { get; set; } + public string PY { get; set; } + public string CAMPO { get; set; } + public string ATIVO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloPedidos.cs b/MLL/ModeloPedidos.cs new file mode 100644 index 0000000..307547c --- /dev/null +++ b/MLL/ModeloPedidos.cs @@ -0,0 +1,85 @@ +using System; + +namespace MLL +{ + public class ModeloPedidos + { + public ModeloPedidos(int iD_PEDIDOS, string cODIGO, string tIPO, string dATA_PEDIDO, string fORMA_PGTO, + string eNTREGA_DIA, string eNTREGA_CONTATO, string eNTREGA_ENDERECO, string eNTREGA_CIDADE, + string eNTREGA_UF, string eNTREGA_CEP, string eNTREGA_TELEFONE, string dATA_ENVIO, string oBSERVACOES, + string fORNECEDOR, string tRANSPORTADOR, string vENDEDOR, string vALOR, string sITUACAO, string dESCONTO, + string nUM_NF_PED, string v_FRETE, string v_SEGURO, string v_OUTROS, string pED_PRAZO, string pED_FORMA, + string pED_OBS, string cHAVE_NFE_COMPRA, string pAGAMENTO_PEDIDO, string pAGAMENTO_FRETE, string rASTREIO_FRETE) + { + ID_PEDIDOS = iD_PEDIDOS; + CODIGO = cODIGO; + TIPO = tIPO; + DATA_PEDIDO = dATA_PEDIDO; + FORMA_PGTO = fORMA_PGTO; + ENTREGA_DIA = eNTREGA_DIA; + ENTREGA_CONTATO = eNTREGA_CONTATO; + ENTREGA_ENDERECO = eNTREGA_ENDERECO; + ENTREGA_CIDADE = eNTREGA_CIDADE; + ENTREGA_UF = eNTREGA_UF; + ENTREGA_CEP = eNTREGA_CEP; + ENTREGA_TELEFONE = eNTREGA_TELEFONE; + DATA_ENVIO = dATA_ENVIO; + OBSERVACOES = oBSERVACOES; + FORNECEDOR = fORNECEDOR; + TRANSPORTADOR = tRANSPORTADOR; + VENDEDOR = vENDEDOR; + VALOR = vALOR; + SITUACAO = sITUACAO; + DESCONTO = dESCONTO; + NUM_NF_PED = nUM_NF_PED; + V_FRETE = v_FRETE; + V_SEGURO = v_SEGURO; + V_OUTROS = v_OUTROS; + PED_PRAZO = pED_PRAZO; + PED_FORMA = pED_FORMA; + PED_OBS = pED_OBS; + CHAVE_NFE_COMPRA = cHAVE_NFE_COMPRA; + PAGAMENTO_PEDIDO = pAGAMENTO_PEDIDO; + PAGAMENTO_FRETE = pAGAMENTO_FRETE; + RASTREIO_FRETE = rASTREIO_FRETE; + } + + public int ID_PEDIDOS { get; set; } + public string CODIGO { get; set; } + public string TIPO { get; set; } + public string DATA_PEDIDO { get; set; } + public string FORMA_PGTO { get; set; } + + public string ENTREGA_DIA { get; set; } + public string ENTREGA_CONTATO { get; set; } + public string ENTREGA_ENDERECO { get; set; } + public string ENTREGA_CIDADE { get; set; } + public string ENTREGA_UF { get; set; } + public string ENTREGA_CEP { get; set; } + public string ENTREGA_TELEFONE { get; set; } + + public string DATA_ENVIO { get; set; } + public string OBSERVACOES { get; set; } + public string FORNECEDOR { get; set; } + public string TRANSPORTADOR { get; set; } + public string VENDEDOR { get; set; } + + public string VALOR { get; set; } + public string SITUACAO { get; set; } + public string DESCONTO { get; set; } + public string NUM_NF_PED { get; set; } + + public string V_FRETE { get; set; } + public string V_SEGURO { get; set; } + public string V_OUTROS { get; set; } + + public string PED_PRAZO { get; set; } + public string PED_FORMA { get; set; } + public string PED_OBS { get; set; } + + public string CHAVE_NFE_COMPRA { get; set; } + public string PAGAMENTO_PEDIDO { get; set; } + public string PAGAMENTO_FRETE { get; set; } + public string RASTREIO_FRETE { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloPerfil.cs b/MLL/ModeloPerfil.cs new file mode 100644 index 0000000..3ea0768 --- /dev/null +++ b/MLL/ModeloPerfil.cs @@ -0,0 +1,19 @@ +public class ModeloPerfil +{ + public ModeloPerfil(int id, int empresaId, string nome, string descricao, bool ativo) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Descricao = descricao; + Ativo = ativo; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string Descricao { get; set; } + + public bool Ativo { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloPerfilPermissoes.cs b/MLL/ModeloPerfilPermissoes.cs new file mode 100644 index 0000000..0d88ee8 --- /dev/null +++ b/MLL/ModeloPerfilPermissoes.cs @@ -0,0 +1,18 @@ +using System; + +namespace MLL +{ + public class ModeloPerfilPermissoes + { + public ModeloPerfilPermissoes(int id, int perfilId, int permissaoId) + { + Id = id; + PerfilId = perfilId; + PermissaoId = permissaoId; + } + + public int Id { get; set; } + public int PerfilId { get; set; } + public int PermissaoId { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloPerfis.cs b/MLL/ModeloPerfis.cs new file mode 100644 index 0000000..8bc55a9 --- /dev/null +++ b/MLL/ModeloPerfis.cs @@ -0,0 +1,22 @@ +using System; + +namespace MLL +{ + public class ModeloPerfis + { + public ModeloPerfis(int id, int empresaId, string nome, string descricao, bool ativo) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Descricao = descricao; + Ativo = ativo; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public string Nome { get; set; } + public string Descricao { get; set; } + public bool Ativo { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloPermissao.cs b/MLL/ModeloPermissao.cs new file mode 100644 index 0000000..26a5053 --- /dev/null +++ b/MLL/ModeloPermissao.cs @@ -0,0 +1,14 @@ +public class ModeloPermissao +{ + public ModeloPermissao(int id, string nome, string descricao) + { + Id = id; + Nome = nome; + Descricao = descricao; + } + + public int Id { get; set; } + + public string Nome { get; set; } + public string Descricao { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloPermissoes.cs b/MLL/ModeloPermissoes.cs new file mode 100644 index 0000000..ac66dc7 --- /dev/null +++ b/MLL/ModeloPermissoes.cs @@ -0,0 +1,18 @@ +using System; + +namespace MLL +{ + public class ModeloPermissoes + { + public ModeloPermissoes(int id, string nome, string descricao) + { + Id = id; + Nome = nome; + Descricao = descricao; + } + + public int Id { get; set; } + public string Nome { get; set; } + public string Descricao { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloPlanoDeContas.cs b/MLL/ModeloPlanoDeContas.cs new file mode 100644 index 0000000..83d16b0 --- /dev/null +++ b/MLL/ModeloPlanoDeContas.cs @@ -0,0 +1,31 @@ +public class ModeloPlanoDeContas +{ + public ModeloPlanoDeContas(int id, int empresaId, int? contaPaiId, string nome, string codigo, string tipo, bool aceitaLancamento, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + ContaPaiId = contaPaiId; + Nome = nome; + Codigo = codigo; + Tipo = tipo; + AceitaLancamento = aceitaLancamento; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public int? ContaPaiId { get; set; } + + public string Nome { get; set; } + public string Codigo { get; set; } + public string Tipo { get; set; } + + public bool AceitaLancamento { get; set; } + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloPlanos.cs b/MLL/ModeloPlanos.cs new file mode 100644 index 0000000..1a213ac --- /dev/null +++ b/MLL/ModeloPlanos.cs @@ -0,0 +1,26 @@ +using System; + +namespace MLL +{ + public class ModeloPlanos + { + public ModeloPlanos(int iD_PLANOS, string cODIGO, string nOME, string nIVEL, string dEBITO, string cODIGO_PAI, string cODIGO_FILHO) + { + ID_PLANOS = iD_PLANOS; + CODIGO = cODIGO; + NOME = nOME; + NIVEL = nIVEL; + DEBITO = dEBITO; + CODIGO_PAI = cODIGO_PAI; + CODIGO_FILHO = cODIGO_FILHO; + } + + public int ID_PLANOS { get; set; } + public string CODIGO { get; set; } + public string NOME { get; set; } + public string NIVEL { get; set; } + public string DEBITO { get; set; } + public string CODIGO_PAI { get; set; } + public string CODIGO_FILHO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloSatFiscalConsumidor.cs b/MLL/ModeloSatFiscalConsumidor.cs new file mode 100644 index 0000000..847e034 --- /dev/null +++ b/MLL/ModeloSatFiscalConsumidor.cs @@ -0,0 +1,109 @@ +using System; + +namespace MLL +{ + public class ModeloSatFiscalConsumidor + { + public ModeloSatFiscalConsumidor(int iD_SAT_FISCAL_CONSU, string cODIGO, string pRODUCAO, string sERIE, string nATUREZA, string eMISSAO, string dEST_NOME, string dEST_EMAIL, string dEST_CPF_CNPJ, string dEST_IDESTRANGEIRO, string dEST_xLgr, string dEST_CPL, string dEST_nro, string dEST_xBairro, string dEST_cMun, string dEST_xMun, string dEST_UF, string dEST_CEP, string dEST_cPais, string dEST_xPais, string dEST_fone, string fRETE_MODALIDADE, string fRETE_xCNPJ_CPF, string fRETE_xNome, string nFC_PRONTA, string nFC_infCpl, string tOTAL_vBC, string tOTAL_vICMS, string tOTAL_vBCST, string tOTAL_vST, string tOTAL_vProd, string tOTAL_vFrete, string tOTAL_vSeg, string tOTAL_vDesc, string tOTAL_vII, string tOTAL_vIPI, string tOTAL_vPIS, string tOTAL_vCOFINS, string tOTAL_vOutro, string tOTAL_vNF, string tERMINAL, string cHAVE_NFC, string pROTOCOLO, string pROTOCOLO_CANCELA, string sITUACAO, string dATA_CADASTRO) + { + ID_SAT_FISCAL_CONSU = iD_SAT_FISCAL_CONSU; + CODIGO = cODIGO; + PRODUCAO = pRODUCAO; + SERIE = sERIE; + NATUREZA = nATUREZA; + EMISSAO = eMISSAO; + DEST_NOME = dEST_NOME; + DEST_EMAIL = dEST_EMAIL; + DEST_CPF_CNPJ = dEST_CPF_CNPJ; + DEST_IDESTRANGEIRO = dEST_IDESTRANGEIRO; + DEST_xLgr = dEST_xLgr; + DEST_CPL = dEST_CPL; + DEST_nro = dEST_nro; + DEST_xBairro = dEST_xBairro; + DEST_cMun = dEST_cMun; + DEST_xMun = dEST_xMun; + DEST_UF = dEST_UF; + DEST_CEP = dEST_CEP; + DEST_cPais = dEST_cPais; + DEST_xPais = dEST_xPais; + DEST_fone = dEST_fone; + FRETE_MODALIDADE = fRETE_MODALIDADE; + FRETE_xCNPJ_CPF = fRETE_xCNPJ_CPF; + FRETE_xNome = fRETE_xNome; + NFC_PRONTA = nFC_PRONTA; + NFC_infCpl = nFC_infCpl; + TOTAL_vBC = tOTAL_vBC; + TOTAL_vICMS = tOTAL_vICMS; + TOTAL_vBCST = tOTAL_vBCST; + TOTAL_vST = tOTAL_vST; + TOTAL_vProd = tOTAL_vProd; + TOTAL_vFrete = tOTAL_vFrete; + TOTAL_vSeg = tOTAL_vSeg; + TOTAL_vDesc = tOTAL_vDesc; + TOTAL_vII = tOTAL_vII; + TOTAL_vIPI = tOTAL_vIPI; + TOTAL_vPIS = tOTAL_vPIS; + TOTAL_vCOFINS = tOTAL_vCOFINS; + TOTAL_vOutro = tOTAL_vOutro; + TOTAL_vNF = tOTAL_vNF; + TERMINAL = tERMINAL; + CHAVE_NFC = cHAVE_NFC; + PROTOCOLO = pROTOCOLO; + PROTOCOLO_CANCELA = pROTOCOLO_CANCELA; + SITUACAO = sITUACAO; + DATA_CADASTRO = dATA_CADASTRO; + } + + public int ID_SAT_FISCAL_CONSU { get; set; } + public string CODIGO { get; set; } + public string PRODUCAO { get; set; } + public string SERIE { get; set; } + public string NATUREZA { get; set; } + public string EMISSAO { get; set; } + + public string DEST_NOME { get; set; } + public string DEST_EMAIL { get; set; } + public string DEST_CPF_CNPJ { get; set; } + public string DEST_IDESTRANGEIRO { get; set; } + public string DEST_xLgr { get; set; } + public string DEST_CPL { get; set; } + public string DEST_nro { get; set; } + public string DEST_xBairro { get; set; } + public string DEST_cMun { get; set; } + public string DEST_xMun { get; set; } + public string DEST_UF { get; set; } + public string DEST_CEP { get; set; } + public string DEST_cPais { get; set; } + public string DEST_xPais { get; set; } + public string DEST_fone { get; set; } + + public string FRETE_MODALIDADE { get; set; } + public string FRETE_xCNPJ_CPF { get; set; } + public string FRETE_xNome { get; set; } + + public string NFC_PRONTA { get; set; } + public string NFC_infCpl { get; set; } + + public string TOTAL_vBC { get; set; } + public string TOTAL_vICMS { get; set; } + public string TOTAL_vBCST { get; set; } + public string TOTAL_vST { get; set; } + public string TOTAL_vProd { get; set; } + public string TOTAL_vFrete { get; set; } + public string TOTAL_vSeg { get; set; } + public string TOTAL_vDesc { get; set; } + public string TOTAL_vII { get; set; } + public string TOTAL_vIPI { get; set; } + public string TOTAL_vPIS { get; set; } + public string TOTAL_vCOFINS { get; set; } + public string TOTAL_vOutro { get; set; } + public string TOTAL_vNF { get; set; } + + public string TERMINAL { get; set; } + public string CHAVE_NFC { get; set; } + public string PROTOCOLO { get; set; } + public string PROTOCOLO_CANCELA { get; set; } + public string SITUACAO { get; set; } + public string DATA_CADASTRO { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloSatFiscalConsumidorFormas.cs b/MLL/ModeloSatFiscalConsumidorFormas.cs new file mode 100644 index 0000000..5dd1c13 --- /dev/null +++ b/MLL/ModeloSatFiscalConsumidorFormas.cs @@ -0,0 +1,28 @@ +using System; + +namespace MLL +{ + public class ModeloSatFiscalConsumidorFormas + { + public ModeloSatFiscalConsumidorFormas(int iD_SAT_FISCAL_CONS_FORMAS, string cODIGO, string cOD_NFCE, string fORMA, string vALOR, string dATA_CADASTRO, string cNPJ_OPERADORA, string tBand) + { + ID_SAT_FISCAL_CONS_FORMAS = iD_SAT_FISCAL_CONS_FORMAS; + CODIGO = cODIGO; + COD_NFCE = cOD_NFCE; + FORMA = fORMA; + VALOR = vALOR; + DATA_CADASTRO = dATA_CADASTRO; + CNPJ_OPERADORA = cNPJ_OPERADORA; + this.tBand = tBand; + } + + public int ID_SAT_FISCAL_CONS_FORMAS { get; set; } + public string CODIGO { get; set; } + public string COD_NFCE { get; set; } + public string FORMA { get; set; } + public string VALOR { get; set; } + public string DATA_CADASTRO { get; set; } + public string CNPJ_OPERADORA { get; set; } + public string tBand { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloSatFiscalConsumidorItens.cs b/MLL/ModeloSatFiscalConsumidorItens.cs new file mode 100644 index 0000000..91e41c7 --- /dev/null +++ b/MLL/ModeloSatFiscalConsumidorItens.cs @@ -0,0 +1,148 @@ +using System; + +namespace MLL +{ + public class ModeloSatFiscalConsumidorItens + { + public ModeloSatFiscalConsumidorItens(int iD_SAT_FISCAL_CONS_ITENS, string cODIGO, string cOD_NFCE, string iTEM_TIPO, + string iTEM_CEAN, string iTEM_CPROD, string iTEM_XPROD, string iTEM_INF_ADIC, string iTEM_CFOP, + string iTEM_NCM, string iTEM_UNCOM, string iTEM_QCOM, string iTEM_VPROD, string iTEM_VOUTRO, + string iTEM_VFRETE, string iTEM_VSEG, string iTEM_VDESC, string iTEM_vTotTrib, string iTEM_ORIGEM, + string iTEM_CST, string dATA_CADASTRO, string iTEM_ICMS_modBC, string iTEM_ICMS_pRedBC, string iTEM_ICMS_vBC, + string iTEM_ICMS_pICMS, string iTEM_ICMS_vICMS, string iTEM_ICMS_vICMSDeson, string iTEM_ICMS_motDesICMS, + string iTEM_ICMS_modBCST, string iTEM_ICMS_pMVAST, string iTEM_ICMS_pRedBCST, string iTEM_ICMS_vBCST, string iTEM_ICMS_pICMSST, + string iTEM_ICMS_vICMSST, string iTEM_cProdANP, string iTEM_CEST, string cBenef, string iTEM_pFCP, string iTEM_vFCP, string iTEM_vBCFCP, + string iTEM_vBCFCPST, string iTEM_pFCPST, string iTEM_vFCPST, string iTEM_pST, string iTEM_vBCFCPSTRet, string iTEM_pFCPSTRet, string iTEM_vFCPSTRet, + string iTEM_PIS_CST, string iTEM_PIS_vBC, string iTEM_PIS_pPIS, string iTEM_PIS_vPIS, string iTEM_COFINS_CST, string iTEM_COFINS_vBC, + string iTEM_COFINS_pCOFINS, string iTEM_COFINS_vCOFINS, string vICMSSubstituto, string pRedBCEfet, string vBCEfet, string pICMSEfet, string vICMSEfet) + { + ID_SAT_FISCAL_CONS_ITENS = iD_SAT_FISCAL_CONS_ITENS; + CODIGO = cODIGO; + COD_NFCE = cOD_NFCE; + ITEM_TIPO = iTEM_TIPO; + ITEM_CEAN = iTEM_CEAN; + ITEM_CPROD = iTEM_CPROD; + ITEM_XPROD = iTEM_XPROD; + ITEM_INF_ADIC = iTEM_INF_ADIC; + ITEM_CFOP = iTEM_CFOP; + ITEM_NCM = iTEM_NCM; + ITEM_UNCOM = iTEM_UNCOM; + ITEM_QCOM = iTEM_QCOM; + ITEM_VPROD = iTEM_VPROD; + ITEM_VOUTRO = iTEM_VOUTRO; + ITEM_VFRETE = iTEM_VFRETE; + ITEM_VSEG = iTEM_VSEG; + ITEM_VDESC = iTEM_VDESC; + ITEM_vTotTrib = iTEM_vTotTrib; + ITEM_ORIGEM = iTEM_ORIGEM; + ITEM_CST = iTEM_CST; + DATA_CADASTRO = dATA_CADASTRO; + ITEM_ICMS_modBC = iTEM_ICMS_modBC; + ITEM_ICMS_pRedBC = iTEM_ICMS_pRedBC; + ITEM_ICMS_vBC = iTEM_ICMS_vBC; + ITEM_ICMS_pICMS = iTEM_ICMS_pICMS; + ITEM_ICMS_vICMS = iTEM_ICMS_vICMS; + ITEM_ICMS_vICMSDeson = iTEM_ICMS_vICMSDeson; + ITEM_ICMS_motDesICMS = iTEM_ICMS_motDesICMS; + ITEM_ICMS_modBCST = iTEM_ICMS_modBCST; + ITEM_ICMS_pMVAST = iTEM_ICMS_pMVAST; + ITEM_ICMS_pRedBCST = iTEM_ICMS_pRedBCST; + ITEM_ICMS_vBCST = iTEM_ICMS_vBCST; + ITEM_ICMS_pICMSST = iTEM_ICMS_pICMSST; + ITEM_ICMS_vICMSST = iTEM_ICMS_vICMSST; + ITEM_cProdANP = iTEM_cProdANP; + ITEM_CEST = iTEM_CEST; + this.cBenef = cBenef; + ITEM_pFCP = iTEM_pFCP; + ITEM_vFCP = iTEM_vFCP; + ITEM_vBCFCP = iTEM_vBCFCP; + ITEM_vBCFCPST = iTEM_vBCFCPST; + ITEM_pFCPST = iTEM_pFCPST; + ITEM_vFCPST = iTEM_vFCPST; + ITEM_pST = iTEM_pST; + ITEM_vBCFCPSTRet = iTEM_vBCFCPSTRet; + ITEM_pFCPSTRet = iTEM_pFCPSTRet; + ITEM_vFCPSTRet = iTEM_vFCPSTRet; + ITEM_PIS_CST = iTEM_PIS_CST; + ITEM_PIS_vBC = iTEM_PIS_vBC; + ITEM_PIS_pPIS = iTEM_PIS_pPIS; + ITEM_PIS_vPIS = iTEM_PIS_vPIS; + ITEM_COFINS_CST = iTEM_COFINS_CST; + ITEM_COFINS_vBC = iTEM_COFINS_vBC; + ITEM_COFINS_pCOFINS = iTEM_COFINS_pCOFINS; + ITEM_COFINS_vCOFINS = iTEM_COFINS_vCOFINS; + this.vICMSSubstituto = vICMSSubstituto; + this.pRedBCEfet = pRedBCEfet; + this.vBCEfet = vBCEfet; + this.pICMSEfet = pICMSEfet; + this.vICMSEfet = vICMSEfet; + } + + public int ID_SAT_FISCAL_CONS_ITENS { get; set; } + public string CODIGO { get; set; } + public string COD_NFCE { get; set; } + public string ITEM_TIPO { get; set; } + public string ITEM_CEAN { get; set; } + public string ITEM_CPROD { get; set; } + public string ITEM_XPROD { get; set; } + public string ITEM_INF_ADIC { get; set; } + public string ITEM_CFOP { get; set; } + public string ITEM_NCM { get; set; } + public string ITEM_UNCOM { get; set; } + public string ITEM_QCOM { get; set; } + public string ITEM_VPROD { get; set; } + public string ITEM_VOUTRO { get; set; } + public string ITEM_VFRETE { get; set; } + public string ITEM_VSEG { get; set; } + public string ITEM_VDESC { get; set; } + public string ITEM_vTotTrib { get; set; } + public string ITEM_ORIGEM { get; set; } + public string ITEM_CST { get; set; } + public string DATA_CADASTRO { get; set; } + + public string ITEM_ICMS_modBC { get; set; } + public string ITEM_ICMS_pRedBC { get; set; } + public string ITEM_ICMS_vBC { get; set; } + public string ITEM_ICMS_pICMS { get; set; } + public string ITEM_ICMS_vICMS { get; set; } + public string ITEM_ICMS_vICMSDeson { get; set; } + public string ITEM_ICMS_motDesICMS { get; set; } + public string ITEM_ICMS_modBCST { get; set; } + public string ITEM_ICMS_pMVAST { get; set; } + public string ITEM_ICMS_pRedBCST { get; set; } + public string ITEM_ICMS_vBCST { get; set; } + public string ITEM_ICMS_pICMSST { get; set; } + public string ITEM_ICMS_vICMSST { get; set; } + + public string ITEM_cProdANP { get; set; } + public string ITEM_CEST { get; set; } + public string cBenef { get; set; } + + public string ITEM_pFCP { get; set; } + public string ITEM_vFCP { get; set; } + public string ITEM_vBCFCP { get; set; } + public string ITEM_vBCFCPST { get; set; } + public string ITEM_pFCPST { get; set; } + public string ITEM_vFCPST { get; set; } + public string ITEM_pST { get; set; } + public string ITEM_vBCFCPSTRet { get; set; } + public string ITEM_pFCPSTRet { get; set; } + public string ITEM_vFCPSTRet { get; set; } + + public string ITEM_PIS_CST { get; set; } + public string ITEM_PIS_vBC { get; set; } + public string ITEM_PIS_pPIS { get; set; } + public string ITEM_PIS_vPIS { get; set; } + + public string ITEM_COFINS_CST { get; set; } + public string ITEM_COFINS_vBC { get; set; } + public string ITEM_COFINS_pCOFINS { get; set; } + public string ITEM_COFINS_vCOFINS { get; set; } + + public string vICMSSubstituto { get; set; } + public string pRedBCEfet { get; set; } + public string vBCEfet { get; set; } + public string pICMSEfet { get; set; } + public string vICMSEfet { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloServico.cs b/MLL/ModeloServico.cs new file mode 100644 index 0000000..43260bf --- /dev/null +++ b/MLL/ModeloServico.cs @@ -0,0 +1,37 @@ +public class ModeloServico +{ + public ModeloServico(int id, int empresaId, string nome, string descricao, decimal valorPadrao, decimal? custo, string tipoComissao, decimal valorComissao, int? tempoEstimado, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Descricao = descricao; + ValorPadrao = valorPadrao; + Custo = custo; + TipoComissao = tipoComissao; + ValorComissao = valorComissao; + TempoEstimado = tempoEstimado; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string Descricao { get; set; } + + public decimal ValorPadrao { get; set; } + public decimal? Custo { get; set; } + + public string TipoComissao { get; set; } + public decimal ValorComissao { get; set; } + + public int? TempoEstimado { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloServicos.cs b/MLL/ModeloServicos.cs new file mode 100644 index 0000000..8527f22 --- /dev/null +++ b/MLL/ModeloServicos.cs @@ -0,0 +1,36 @@ +using System; + +namespace MLL +{ + public class ModeloServicos + { + public ModeloServicos(int id, int empresaId, string nome, string descricao, decimal valorPadrao, decimal? custo, string tipoComissao, decimal valorComissao, int? tempoEstimado, bool ativo, DateTime? criadoEm, DateTime? atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Descricao = descricao; + ValorPadrao = valorPadrao; + Custo = custo; + TipoComissao = tipoComissao; + ValorComissao = valorComissao; + TempoEstimado = tempoEstimado; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public string Nome { get; set; } + public string Descricao { get; set; } + public decimal ValorPadrao { get; set; } + public decimal? Custo { get; set; } + public string TipoComissao { get; set; } + public decimal ValorComissao { get; set; } + public int? TempoEstimado { get; set; } + public bool Ativo { get; set; } + public DateTime? CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloSituacoes.cs b/MLL/ModeloSituacoes.cs new file mode 100644 index 0000000..506657f --- /dev/null +++ b/MLL/ModeloSituacoes.cs @@ -0,0 +1,36 @@ +using System; + +namespace MLL +{ + public class ModeloSituacoes + { + public ModeloSituacoes(int iD_SITUACOES, string cODIGO, string nOME, string eTAPA1, string eTAPA2, string eTAPA3, string eTAPA3_PG, string pRONTO, string sUBGRUPO, string cOR_FONTE, string cOR_FUNDO, string pLANO_CONTA) + { + ID_SITUACOES = iD_SITUACOES; + CODIGO = cODIGO; + NOME = nOME; + ETAPA1 = eTAPA1; + ETAPA2 = eTAPA2; + ETAPA3 = eTAPA3; + ETAPA3_PG = eTAPA3_PG; + PRONTO = pRONTO; + SUBGRUPO = sUBGRUPO; + COR_FONTE = cOR_FONTE; + COR_FUNDO = cOR_FUNDO; + PLANO_CONTA = pLANO_CONTA; + } + + public int ID_SITUACOES { get; set; } + public string CODIGO { get; set; } + public string NOME { get; set; } + public string ETAPA1 { get; set; } + public string ETAPA2 { get; set; } + public string ETAPA3 { get; set; } + public string ETAPA3_PG { get; set; } + public string PRONTO { get; set; } + public string SUBGRUPO { get; set; } + public string COR_FONTE { get; set; } + public string COR_FUNDO { get; set; } + public string PLANO_CONTA { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloSituacoesOS.cs b/MLL/ModeloSituacoesOS.cs new file mode 100644 index 0000000..66603d2 --- /dev/null +++ b/MLL/ModeloSituacoesOS.cs @@ -0,0 +1,40 @@ +using System; + +namespace MLL +{ + public class ModeloSituacoesOS + { + public ModeloSituacoesOS(int id, int empresaId, string descricao, string tipo, bool consideraAberta, bool consideraFechada, bool marcaComoPronto, string corFundo, string corFonte, int? planoContasId, int? ordem, bool ativo, DateTime? criadoEm, DateTime? atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Descricao = descricao; + Tipo = tipo; + ConsideraAberta = consideraAberta; + ConsideraFechada = consideraFechada; + MarcaComoPronto = marcaComoPronto; + CorFundo = corFundo; + CorFonte = corFonte; + PlanoContasId = planoContasId; + Ordem = ordem; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public string Descricao { get; set; } + public string Tipo { get; set; } + public bool ConsideraAberta { get; set; } + public bool ConsideraFechada { get; set; } + public bool MarcaComoPronto { get; set; } + public string CorFundo { get; set; } + public string CorFonte { get; set; } + public int? PlanoContasId { get; set; } + public int? Ordem { get; set; } + public bool Ativo { get; set; } + public DateTime? CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloTransportadora.cs b/MLL/ModeloTransportadora.cs new file mode 100644 index 0000000..023965f --- /dev/null +++ b/MLL/ModeloTransportadora.cs @@ -0,0 +1,60 @@ +public class ModeloTransportadora +{ + public ModeloTransportadora(int id, int empresaId, string razaoSocial, string nomeFantasia, string cNPJ, string telefone, string celular, string whatsapp, string email, string cep, string endereco, int? numero, string complemento, string bairro, string cidade, string uF, string tipoFrete, int? prazoEntrega, decimal? valorFretePadrao, string observacoes, bool ativo, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + RazaoSocial = razaoSocial; + NomeFantasia = nomeFantasia; + CNPJ = cNPJ; + Telefone = telefone; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + TipoFrete = tipoFrete; + PrazoEntrega = prazoEntrega; + ValorFretePadrao = valorFretePadrao; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string RazaoSocial { get; set; } + public string NomeFantasia { get; set; } + public string CNPJ { get; set; } + + public string Telefone { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int? Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + + public string TipoFrete { get; set; } + public int? PrazoEntrega { get; set; } + public decimal? ValorFretePadrao { get; set; } + + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloTransportadoras.cs b/MLL/ModeloTransportadoras.cs new file mode 100644 index 0000000..034a711 --- /dev/null +++ b/MLL/ModeloTransportadoras.cs @@ -0,0 +1,61 @@ +using System; + +namespace MLL +{ + public class ModeloTransportadoras + { + public ModeloTransportadoras(int id, int empresaId, string razaoSocial, string nomeFantasia, string cNPJ, string telefone, string celular, string whatsapp, string email, string cep, string endereco, int? numero, string complemento, string bairro, string cidade, string uF, string tipoFrete, int? prazoEntrega, decimal? valorFretePadrao, string observacoes, bool ativo, DateTime? criadoEm, DateTime? atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + RazaoSocial = razaoSocial; + NomeFantasia = nomeFantasia; + CNPJ = cNPJ; + Telefone = telefone; + Celular = celular; + Whatsapp = whatsapp; + Email = email; + Cep = cep; + Endereco = endereco; + Numero = numero; + Complemento = complemento; + Bairro = bairro; + Cidade = cidade; + UF = uF; + TipoFrete = tipoFrete; + PrazoEntrega = prazoEntrega; + ValorFretePadrao = valorFretePadrao; + Observacoes = observacoes; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public string RazaoSocial { get; set; } + public string NomeFantasia { get; set; } + public string CNPJ { get; set; } + public string Telefone { get; set; } + public string Celular { get; set; } + public string Whatsapp { get; set; } + public string Email { get; set; } + + public string Cep { get; set; } + public string Endereco { get; set; } + public int? Numero { get; set; } + public string Complemento { get; set; } + public string Bairro { get; set; } + public string Cidade { get; set; } + public string UF { get; set; } + + public string TipoFrete { get; set; } + public int? PrazoEntrega { get; set; } + public decimal? ValorFretePadrao { get; set; } + public string Observacoes { get; set; } + + public bool Ativo { get; set; } + public DateTime? CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloUsuario.cs b/MLL/ModeloUsuario.cs new file mode 100644 index 0000000..936c7ae --- /dev/null +++ b/MLL/ModeloUsuario.cs @@ -0,0 +1,30 @@ +public class ModeloUsuario +{ + public ModeloUsuario(int id, int empresaId, string nome, string email, string usuario, string senhaHash, bool ativo, DateTime? ultimoLogin, DateTime criadoEm, DateTime atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Email = email; + Usuario = usuario; + SenhaHash = senhaHash; + Ativo = ativo; + UltimoLogin = ultimoLogin; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + + public string Nome { get; set; } + public string Email { get; set; } + public string Usuario { get; set; } + public string SenhaHash { get; set; } + + public bool Ativo { get; set; } + public DateTime? UltimoLogin { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime AtualizadoEm { get; set; } +} \ No newline at end of file diff --git a/MLL/ModeloUsuarioPerfis.cs b/MLL/ModeloUsuarioPerfis.cs new file mode 100644 index 0000000..ac30763 --- /dev/null +++ b/MLL/ModeloUsuarioPerfis.cs @@ -0,0 +1,18 @@ +using System; + +namespace MLL +{ + public class ModeloUsuarioPerfis + { + public ModeloUsuarioPerfis(int id, int usuarioId, int perfilId) + { + Id = id; + UsuarioId = usuarioId; + PerfilId = perfilId; + } + + public int Id { get; set; } + public int UsuarioId { get; set; } + public int PerfilId { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloUsuarios.cs b/MLL/ModeloUsuarios.cs new file mode 100644 index 0000000..b7b0164 --- /dev/null +++ b/MLL/ModeloUsuarios.cs @@ -0,0 +1,32 @@ +using System; + +namespace MLL +{ + public class ModeloUsuarios + { + public ModeloUsuarios(int id, int empresaId, string nome, string email, string usuario, string senhaHash, bool ativo, DateTime? ultimoLogin, DateTime? criadoEm, DateTime? atualizadoEm) + { + Id = id; + EmpresaId = empresaId; + Nome = nome; + Email = email; + Usuario = usuario; + SenhaHash = senhaHash; + Ativo = ativo; + UltimoLogin = ultimoLogin; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + public int EmpresaId { get; set; } + public string Nome { get; set; } + public string Email { get; set; } + public string Usuario { get; set; } + public string SenhaHash { get; set; } + public bool Ativo { get; set; } + public DateTime? UltimoLogin { get; set; } + public DateTime? CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} \ No newline at end of file diff --git a/MLL/ModeloVendas.cs b/MLL/ModeloVendas.cs new file mode 100644 index 0000000..ceb9ee7 --- /dev/null +++ b/MLL/ModeloVendas.cs @@ -0,0 +1,66 @@ +using System; + +namespace MLL +{ + public class ModeloVendas + { + public ModeloVendas(int iD_VENDAS, string cODIGO, string oPERADOR, string tOTAL, string dIA, string cOMISSAO, string cLIENTE, string dESCONTO, string tOTAL_GERAL, string tOTAL_SERVICOS, string tOTAL_PECAS, string tOTAL_IMPOSTOS, string tOTAL_FRETE, string tRANSPORTADORA, string nF_TIPO, string sITUACAO_V, string nF_NUMERO, string oBS_VENDA, string gEROU_CONTA, string cUPOM_NUM, string oPERADOR2, string cOMISSAO_FIXA, string rASTREIO, string oBS_VENDA_INTERNA, string cANCELADA, string nFC_NUMERO, string nFS_NUMERO) + { + ID_VENDAS = iD_VENDAS; + CODIGO = cODIGO; + OPERADOR = oPERADOR; + TOTAL = tOTAL; + DIA = dIA; + COMISSAO = cOMISSAO; + CLIENTE = cLIENTE; + DESCONTO = dESCONTO; + TOTAL_GERAL = tOTAL_GERAL; + TOTAL_SERVICOS = tOTAL_SERVICOS; + TOTAL_PECAS = tOTAL_PECAS; + TOTAL_IMPOSTOS = tOTAL_IMPOSTOS; + TOTAL_FRETE = tOTAL_FRETE; + TRANSPORTADORA = tRANSPORTADORA; + NF_TIPO = nF_TIPO; + SITUACAO_V = sITUACAO_V; + NF_NUMERO = nF_NUMERO; + OBS_VENDA = oBS_VENDA; + GEROU_CONTA = gEROU_CONTA; + CUPOM_NUM = cUPOM_NUM; + OPERADOR2 = oPERADOR2; + COMISSAO_FIXA = cOMISSAO_FIXA; + RASTREIO = rASTREIO; + OBS_VENDA_INTERNA = oBS_VENDA_INTERNA; + CANCELADA = cANCELADA; + NFC_NUMERO = nFC_NUMERO; + NFS_NUMERO = nFS_NUMERO; + } + + public int ID_VENDAS { get; set; } + public string CODIGO { get; set; } + public string OPERADOR { get; set; } + public string TOTAL { get; set; } + public string DIA { get; set; } + public string COMISSAO { get; set; } + public string CLIENTE { get; set; } + public string DESCONTO { get; set; } + public string TOTAL_GERAL { get; set; } + public string TOTAL_SERVICOS { get; set; } + public string TOTAL_PECAS { get; set; } + public string TOTAL_IMPOSTOS { get; set; } + public string TOTAL_FRETE { get; set; } + public string TRANSPORTADORA { get; set; } + public string NF_TIPO { get; set; } + public string SITUACAO_V { get; set; } + public string NF_NUMERO { get; set; } + public string OBS_VENDA { get; set; } + public string GEROU_CONTA { get; set; } + public string CUPOM_NUM { get; set; } + public string OPERADOR2 { get; set; } + public string COMISSAO_FIXA { get; set; } + public string RASTREIO { get; set; } + public string OBS_VENDA_INTERNA { get; set; } + public string CANCELADA { get; set; } + public string NFC_NUMERO { get; set; } + public string NFS_NUMERO { get; set; } + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/TLL/Certificadohelper.cs b/TLL/Certificadohelper.cs new file mode 100644 index 0000000..056fa31 --- /dev/null +++ b/TLL/Certificadohelper.cs @@ -0,0 +1,213 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using MLL; + +namespace TLL +{ + /// + /// Gera um certificado autoassinado com os dados da empresa. + /// Salva .pfx (com chave privada) e .cer (chave pública) em C:\LevelCode\LevelOS\Cert + /// Validade: 1 ano a partir da geração. + /// + public static class CertificadoHelper + { + private static readonly string PastaDestino = @"C:\LevelCode\LevelOS\Cert"; + + // ══════════════════════════════════════════════════════════════════════ + // GERAR CERTIFICADO + // ══════════════════════════════════════════════════════════════════════ + public static CertificadoResultado Gerar(ModeloEmpresa empresa, string senhaPfx) + { + try + { + // Garante que a pasta existe + Directory.CreateDirectory(PastaDestino); + + // Limpa campos nulos antes de usar + string nome = empresa.Nome?.Trim() ?? "Empresa"; + string uf = empresa.UF?.Trim() ?? "BR"; + string cidade = empresa.Cidade?.Trim() ?? ""; + string email = empresa.Email?.Trim() ?? ""; + string cnpjLimpo = empresa.CNPJ? + .Replace(".", "").Replace("/", "").Replace("-", "").Trim() ?? "empresa"; + + // ── Monta o Distinguished Name (DN) ──────────────────────────── + var dn = new X500DistinguishedName( + $"CN={nome}, " + + $"O={nome}, " + + $"OU=LevelOS, " + + $"C=BR, " + + $"ST={uf}, " + + $"L={cidade}, " + + $"SERIALNUMBER={cnpjLimpo}"); + + // ── Gera chave RSA 2048 bits ─────────────────────────────────── + using var rsa = RSA.Create(2048); + + // ── Configura o certificado ──────────────────────────────────── + var request = new CertificateRequest(dn, rsa, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + + // Extensões + request.CertificateExtensions.Add( + new X509BasicConstraintsExtension(false, false, 0, true)); + + request.CertificateExtensions.Add( + new X509KeyUsageExtension( + X509KeyUsageFlags.DigitalSignature | + X509KeyUsageFlags.NonRepudiation | + X509KeyUsageFlags.KeyEncipherment, + true)); + + request.CertificateExtensions.Add( + new X509EnhancedKeyUsageExtension(new OidCollection + { + new Oid("1.3.6.1.5.5.7.3.2"), // Client Authentication + new Oid("1.3.6.1.5.5.7.3.4") // Email Protection + }, false)); + + // Compatível com .NET 8 + request.CertificateExtensions.Add( + new X509SubjectKeyIdentifierExtension(request.PublicKey, false)); + + // ── Validade: hoje até 1 ano ─────────────────────────────────── + var agora = DateTimeOffset.UtcNow; + var expira = agora.AddYears(1); + + // ── Gera o certificado autoassinado ──────────────────────────── + var cert = request.CreateSelfSigned(agora, expira); + + // ── Caminhos dos arquivos ────────────────────────────────────── + string nomePfx = Path.Combine(PastaDestino, $"{cnpjLimpo}.pfx"); + string nomeCer = Path.Combine(PastaDestino, $"{cnpjLimpo}.cer"); + + // ── Exporta .pfx (chave pública + privada, protegido por senha) + byte[] pfxBytes = cert.Export(X509ContentType.Pfx, senhaPfx); + File.WriteAllBytes(nomePfx, pfxBytes); + + // ── Exporta .cer (somente chave pública) ────────────────────── + byte[] cerBytes = cert.Export(X509ContentType.Cert); + File.WriteAllBytes(nomeCer, cerBytes); + + return new CertificadoResultado + { + Sucesso = true, + CaminhoPfx = nomePfx, + CaminhoCer = nomeCer, + Thumbprint = cert.Thumbprint, + ValidoAte = expira.LocalDateTime, + Mensagem = "Certificado gerado com sucesso!" + }; + } + catch (Exception ex) + { + return new CertificadoResultado + { + Sucesso = false, + Mensagem = $"Erro ao gerar certificado: {ex.Message}" + }; + } + } + + // ══════════════════════════════════════════════════════════════════════ + // CARREGAR CERTIFICADO EXISTENTE + // ══════════════════════════════════════════════════════════════════════ + public static X509Certificate2? Carregar(string cnpj, string senhaPfx) + { + try + { + string cnpjLimpo = cnpj?.Replace(".", "").Replace("/", "").Replace("-", "") ?? ""; + string caminho = Path.Combine(PastaDestino, $"{cnpjLimpo}.pfx"); + + if (!File.Exists(caminho)) return null; + + var collection = new X509Certificate2Collection(); + collection.Import(caminho, senhaPfx, X509KeyStorageFlags.DefaultKeySet); + return collection.Count > 0 ? collection[0] : null; + } + catch + { + return null; + } + } + + // ══════════════════════════════════════════════════════════════════════ + // VERIFICAR SE CERTIFICADO EXISTE E ESTÁ VÁLIDO + // ══════════════════════════════════════════════════════════════════════ + public static StatusCertificado VerificarStatus(string cnpj, string senhaPfx) + { + try + { + string cnpjLimpo = cnpj?.Replace(".", "").Replace("/", "").Replace("-", "") ?? ""; + string caminho = Path.Combine(PastaDestino, $"{cnpjLimpo}.pfx"); + + if (!File.Exists(caminho)) + return new StatusCertificado + { + Existe = false, + Mensagem = "Certificado não encontrado." + }; + + var collection = new X509Certificate2Collection(); + collection.Import(caminho, senhaPfx, X509KeyStorageFlags.DefaultKeySet); + + if (collection.Count == 0) + return new StatusCertificado + { + Existe = false, + Mensagem = "Certificado inválido ou vazio." + }; + + var cert = collection[0]; + var expira = cert.NotAfter; + var diasRestantes = (expira - DateTime.Now).Days; + + return new StatusCertificado + { + Existe = true, + Valido = DateTime.Now <= expira, + Thumbprint = cert.Thumbprint, + ValidoAte = expira, + DiasRestantes = diasRestantes, + Mensagem = diasRestantes > 0 + ? $"Certificado válido por mais {diasRestantes} dias." + : "Certificado expirado!" + }; + } + catch (Exception ex) + { + return new StatusCertificado + { + Existe = true, + Valido = false, + Mensagem = $"Erro ao ler o certificado: {ex.Message}" + }; + } + } + } + + // ══════════════════════════════════════════════════════════════════════════ + // MODELOS DE RETORNO + // ══════════════════════════════════════════════════════════════════════════ + public class CertificadoResultado + { + public bool Sucesso { get; set; } + public string Mensagem { get; set; } = string.Empty; + public string? CaminhoPfx { get; set; } + public string? CaminhoCer { get; set; } + public string? Thumbprint { get; set; } + public DateTime ValidoAte { get; set; } + } + + public class StatusCertificado + { + public bool Existe { get; set; } + public bool Valido { get; set; } + public string Mensagem { get; set; } = string.Empty; + public string? Thumbprint { get; set; } + public DateTime ValidoAte { get; set; } + public int DiasRestantes { get; set; } + } +} \ No newline at end of file diff --git a/TLL/DatabaseHelper.cs b/TLL/DatabaseHelper.cs new file mode 100644 index 0000000..addebb1 --- /dev/null +++ b/TLL/DatabaseHelper.cs @@ -0,0 +1,122 @@ +using DAL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; + +namespace TLL +{ + public static class DatabaseHelper + { + // ===== SALVAR ===== + public static void Salvar(string caminhoArquivo, string senha) + { + var config = new ConfigBanco + { + Host = DadosDaConexao.Host, + Port = DadosDaConexao.Port, + Banco = DadosDaConexao.Banco, + Usuario = DadosDaConexao.Usuario, + Senha = DadosDaConexao.Senha, + ConnectTimeout = DadosDaConexao.ConnectTimeout, + Encrypt = DadosDaConexao.Encrypt, + TrustServerCertificate = DadosDaConexao.TrustServerCertificate + }; + + string json = JsonSerializer.Serialize(config); + byte[] dados = Criptografar(json, senha); + + File.WriteAllBytes(caminhoArquivo, dados); + } + + // ===== CARREGAR ===== + public static void Carregar(string caminhoArquivo, string senha) + { + if (!File.Exists(caminhoArquivo)) + return; + + byte[] dados = File.ReadAllBytes(caminhoArquivo); + string json = Descriptografar(dados, senha); + + var config = JsonSerializer.Deserialize(json); + + if (config == null) + return; + + // Preenche a classe static + DadosDaConexao.Host = config.Host; + DadosDaConexao.Port = config.Port; + DadosDaConexao.Banco = config.Banco; + DadosDaConexao.Usuario = config.Usuario; + DadosDaConexao.Senha = config.Senha; + DadosDaConexao.ConnectTimeout = config.ConnectTimeout; + DadosDaConexao.Encrypt = config.Encrypt; + DadosDaConexao.TrustServerCertificate = config.TrustServerCertificate; + } + + // ===== CRIPTO ===== + private static byte[] Criptografar(string texto, string senha) + { + using var aes = Aes.Create(); + + aes.Key = GerarChave(senha); + aes.GenerateIV(); + + using var encryptor = aes.CreateEncryptor(aes.Key, aes.IV); + using var ms = new MemoryStream(); + + // salva IV no início + ms.Write(aes.IV, 0, aes.IV.Length); + + using (var cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write)) + using (var sw = new StreamWriter(cs)) + { + sw.Write(texto); + } + + return ms.ToArray(); + } + + private static string Descriptografar(byte[] dados, string senha) + { + using var aes = Aes.Create(); + + aes.Key = GerarChave(senha); + + byte[] iv = new byte[16]; + Array.Copy(dados, iv, iv.Length); + aes.IV = iv; + + using var decryptor = aes.CreateDecryptor(aes.Key, aes.IV); + using var ms = new MemoryStream(dados, iv.Length, dados.Length - iv.Length); + using var cs = new CryptoStream(ms, decryptor, CryptoStreamMode.Read); + using var sr = new StreamReader(cs); + + return sr.ReadToEnd(); + } + + private static byte[] GerarChave(string senha) + { + using var sha = SHA256.Create(); + return sha.ComputeHash(Encoding.UTF8.GetBytes(senha)); + } + + + // ===== MODEL INTERNO ===== + private class ConfigBanco + { + public string Host { get; set; } + public int Port { get; set; } + public string Banco { get; set; } + public string Usuario { get; set; } + public string Senha { get; set; } + public int ConnectTimeout { get; set; } + public bool Encrypt { get; set; } + public bool TrustServerCertificate { get; set; } + } + } + +} diff --git a/TLL/FichaFuncionarioPDF.cs b/TLL/FichaFuncionarioPDF.cs new file mode 100644 index 0000000..04b4009 --- /dev/null +++ b/TLL/FichaFuncionarioPDF.cs @@ -0,0 +1,251 @@ +using System; +using System.IO; +using MLL; +using QuestPDF.Fluent; +using QuestPDF.Helpers; +using QuestPDF.Infrastructure; +using Color = QuestPDF.Infrastructure.Color; + +namespace TLL +{ + public static class FichaFuncionarioPDF + { + static FichaFuncionarioPDF() + { + QuestPDF.Settings.License = LicenseType.Community; + } + + public static FichaPDFResultado GerarEAbrir(ModeloFuncionarios f, string? pastaDestino = null) + { + var resultado = Gerar(f, pastaDestino); + + if (resultado.Sucesso && resultado.Caminho != null) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo + { + FileName = resultado.Caminho, + UseShellExecute = true + }); + } + + return resultado; + } + + public static FichaPDFResultado Gerar(ModeloFuncionarios f, string? pastaDestino = null) + { + try + { + pastaDestino ??= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Docs"); + Directory.CreateDirectory(pastaDestino); + + string nomeLimpo = f.NOME?.Replace(" ", "_") ?? "funcionario"; + string caminho = Path.Combine(pastaDestino, + $"Funcionario_{nomeLimpo}_{DateTime.Now:yyyyMMdd_HHmmss}.pdf"); + + // ── Conversões antecipadas ──────────────────────────────────── + string demitido = f.DEMITIDO ? "SIM" : "NÃO"; + string masterUser = f.MASTERUSER ? "SIM" : "NÃO"; + string vendedor = f.VENDEDOR ? "SIM" : "NÃO"; + string tecnico = f.TECNICO ? "SIM" : "NÃO"; + + string dataAdm = f.DATA_ADM?.ToString("dd/MM/yyyy") ?? "—"; + string dataDem = f.DATA_DEM?.ToString("dd/MM/yyyy") ?? "—"; + string aniver = f.ANIVER?.ToString("dd/MM/yyyy") ?? "—"; + + Document.Create(container => + { + container.Page(page => + { + page.Size(PageSizes.A4); + page.Margin(2, Unit.Centimetre); + page.DefaultTextStyle(x => x.FontSize(10).FontFamily("Arial")); + + // ── HEADER ──────────────────────────────────────────── + page.Header().Column(col => + { + col.Item().Row(row => + { + row.RelativeItem().Column(c => + { + c.Item().Text("FICHA DO FUNCIONÁRIO") + .FontSize(16).Bold() + .FontColor(Color.FromHex("#2563EB")); + + c.Item().Text(f.NOME ?? "") + .FontSize(13).Bold() + .FontColor(Color.FromHex("#1E293B")); + + c.Item().Text($"CPF: {f.CPF ?? ""}") + .FontSize(9) + .FontColor(Color.FromHex("#64748B")); + }); + + row.ConstantItem(120).AlignRight().Column(c => + { + c.Item().Text("Status") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + + c.Item().Text(f.DEMITIDO ? "DEMITIDO" : "ATIVO") + .FontSize(10).Bold() + .FontColor(f.DEMITIDO + ? Color.FromHex("#DC2626") + : Color.FromHex("#16A34A")); + + c.Item().Text(DateTime.Now.ToString("dd/MM/yyyy HH:mm")) + .FontSize(8) + .FontColor(Color.FromHex("#64748B")); + }); + }); + + col.Item().PaddingTop(6).LineHorizontal(1) + .LineColor(Color.FromHex("#E2E8F0")); + }); + + // ── CONTENT ─────────────────────────────────────────── + page.Content().PaddingTop(10).Column(col => + { + Secao(col, "DADOS PESSOAIS"); + Grid(col, new (string, string?, string, string?)[] + { + ("Código", f.CODIGO, "Nome", f.NOME), + ("CPF", f.CPF, "RG", f.CI), + ("Pai", f.PAI, "Mãe", f.MAE), + ("Estado Civil", f.ECIVIL, "Regime", f.REGIME) + }); + + Secao(col, "DOCUMENTOS"); + Grid(col, new (string, string?, string, string?)[] + { + ("CTPS", f.CTPS, "CNH", f.CNH), + ("Categoria CNH", f.CAT_CNH, "", null) + }); + + Secao(col, "ENDEREÇO"); + Grid(col, new (string, string?, string, string?)[] + { + ("Endereço", f.ENDERECO, "Bairro", f.BAIRRO), + ("Cidade", f.CIDADE, "UF", f.UF) + }); + + Secao(col, "CONTATO"); + Grid(col, new (string, string?, string, string?)[] + { + ("Telefone", f.TELEFONE, "", null) + }); + + Secao(col, "BANCÁRIO"); + Grid(col, new (string, string?, string, string?)[] + { + ("Banco", f.BANCO, "Agência", f.AGENCIA), + ("Conta", f.CONTA, "", null) + }); + + Secao(col, "FUNÇÕES"); + Grid(col, new (string, string?, string, string?)[] + { + ("Master User", masterUser, "Vendedor", vendedor), + ("Técnico", tecnico, "Demitido", demitido) + }); + + Secao(col, "DATAS"); + Grid(col, new (string, string?, string, string?)[] + { + ("Admissão", dataAdm, "Demissão", dataDem), + ("Aniversário", aniver, "", null) + }); + + if (!string.IsNullOrWhiteSpace(f.OBSERV)) + { + Secao(col, "OBSERVAÇÕES"); + col.Item() + .Background(Color.FromHex("#F8FAFC")) + .Padding(8) + .Border(0.5f) + .BorderColor(Color.FromHex("#E2E8F0")) + .Text(f.OBSERV) + .FontSize(9) + .FontColor(Color.FromHex("#475569")); + } + + Secao(col, "REGISTRO"); + Grid(col, new (string, string?, string, string?)[] + { + ("ID", f.ID_FUNCIONARIO.ToString(), "", null) + }); + }); + + // ── FOOTER ──────────────────────────────────────────── + page.Footer().AlignCenter().Text(text => + { + text.Span("LevelOS • Documento gerado em ") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + + text.Span(DateTime.Now.ToString("dd/MM/yyyy HH:mm")) + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + }); + }); + }).GeneratePdf(caminho); + + return new FichaPDFResultado + { + Sucesso = true, + Caminho = caminho, + Mensagem = "Ficha gerada com sucesso!" + }; + } + catch (Exception ex) + { + return new FichaPDFResultado + { + Sucesso = false, + Mensagem = ex.Message + }; + } + } + + private static void Secao(ColumnDescriptor col, string titulo) + { + col.Item().PaddingTop(10).Text(titulo) + .FontSize(9).Bold() + .FontColor(Color.FromHex("#2563EB")); + + col.Item().LineHorizontal(0.5f) + .LineColor(Color.FromHex("#E2E8F0")); + } + + private static void Grid(ColumnDescriptor col, + (string l1, string? v1, string l2, string? v2)[] linhas) + { + foreach (var (l1, v1, l2, v2) in linhas) + { + col.Item().PaddingTop(4).Row(row => + { + row.RelativeItem().Column(c => + { + c.Item().Text(l1) + .FontSize(7) + .FontColor(Color.FromHex("#94A3B8")); + + c.Item().Text(v1 ?? "—") + .FontSize(10) + .FontColor(Color.FromHex("#1E293B")); + }); + + if (!string.IsNullOrEmpty(l2)) + { + row.RelativeItem().Column(c => + { + c.Item().Text(l2) + .FontSize(7) + .FontColor(Color.FromHex("#94A3B8")); + + c.Item().Text(v2 ?? "—") + .FontSize(10) + .FontColor(Color.FromHex("#1E293B")); + }); + } + }); + } + } + } +} \ No newline at end of file diff --git a/TLL/Fichaempresapdf.cs b/TLL/Fichaempresapdf.cs new file mode 100644 index 0000000..9c128ed --- /dev/null +++ b/TLL/Fichaempresapdf.cs @@ -0,0 +1,267 @@ +// ══════════════════════════════════════════════════════════════════════════════ +// DEPENDÊNCIA — adicionar no TLL.csproj: +// +// +// Ou via Package Manager Console: +// Install-Package QuestPDF +// ══════════════════════════════════════════════════════════════════════════════ + +using System; +using System.IO; +using MLL; +using QuestPDF.Fluent; +using QuestPDF.Helpers; +using QuestPDF.Infrastructure; +using Color = QuestPDF.Infrastructure.Color; + +namespace TLL +{ + /// + /// Gera a ficha cadastral da empresa em PDF. + /// Uso: FichaEmpresaPDF.Gerar(empresa, @"C:\LevelCode\LevelOS\Fichas"); + /// + public static class FichaEmpresaPDF + { + static FichaEmpresaPDF() + { + // Licença community (gratuita para projetos não comerciais ou até $1M receita) + QuestPDF.Settings.License = LicenseType.Community; + } + + // ══════════════════════════════════════════════════════════════════════ + // GERAR PDF + // ══════════════════════════════════════════════════════════════════════ + public static FichaPDFResultado Gerar(ModeloEmpresa empresa, string? pastaDestino = null) + { + try + { + pastaDestino ??= @"C:\LevelCode\LevelOS\Docs"; + Directory.CreateDirectory(pastaDestino); + + string cnpjLimpo = empresa.CNPJ? + .Replace(".", "").Replace("/", "").Replace("-", "") ?? "empresa"; + + string caminho = Path.Combine(pastaDestino, + $"Ficha_{cnpjLimpo}_{DateTime.Now:yyyyMMdd_HHmmss}.pdf"); + + Document.Create(container => + { + container.Page(page => + { + page.Size(PageSizes.A4); + page.Margin(2, Unit.Centimetre); + page.DefaultTextStyle(x => x.FontSize(10).FontFamily("Arial")); + + // ── CABEÇALHO ────────────────────────────────────────── + page.Header().Column(col => + { + col.Item().Row(row => + { + row.RelativeItem().Column(c => + { + c.Item().Text("FICHA CADASTRAL DA EMPRESA") + .FontSize(16).Bold() + .FontColor(Color.FromHex("#2563EB")); + + c.Item().Text(empresa.Nome ?? "") + .FontSize(12).Bold() + .FontColor(Color.FromHex("#1E293B")); + + c.Item().Text($"CNPJ: {empresa.CNPJ ?? ""}") + .FontSize(10) + .FontColor(Color.FromHex("#64748B")); + }); + + row.ConstantItem(120).AlignRight().Column(c => + { + c.Item().Text($"Emitido em:") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + c.Item().Text(DateTime.Now.ToString("dd/MM/yyyy HH:mm")) + .FontSize(8).Bold() + .FontColor(Color.FromHex("#64748B")); + c.Item().Text($"Situação:") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + c.Item().Text(empresa.Ativo ? "ATIVA" : "INATIVA") + .FontSize(9).Bold() + .FontColor(empresa.Ativo + ? Color.FromHex("#16A34A") + : Color.FromHex("#DC2626")); + }); + }); + + col.Item().PaddingTop(6).LineHorizontal(2) + .LineColor(Color.FromHex("#2563EB")); + }); + + // ── CONTEÚDO ─────────────────────────────────────────── + page.Content().PaddingTop(12).Column(col => + { + // 1. IDENTIFICAÇÃO + Secao(col, "IDENTIFICAÇÃO DA EMPRESA"); + Grade(col, new[] + { + ("Tipo de Empresa", empresa.TipoEmpresa, "Regime Tributário", empresa.RegimeTributario), + ("CNAE", empresa.CNAE, "Inscrição Estadual", empresa.InscricaoEstadual), + ("Inscrição Municipal", empresa.InscricaoMunicipal, "", ""), + }); + + // 2. ENDEREÇO + col.Item().PaddingTop(10); + Secao(col, "ENDEREÇO"); + Grade(col, new[] + { + ("CEP", empresa.Cep, "Logradouro", empresa.Endereco), + ("Número", empresa.Numero.ToString(), "Complemento", empresa.Complemento), + ("Bairro", empresa.Bairro, "Cidade", empresa.Cidade), + ("UF", empresa.UF, "País", empresa.Pais), + }); + + // 3. CONTATOS + col.Item().PaddingTop(10); + Secao(col, "CONTATOS E COMUNICAÇÃO"); + Grade(col, new[] + { + ("Telefone 1", empresa.Telefone1, "Telefone 2", empresa.Telefone2), + ("Celular", empresa.Celular, "WhatsApp", empresa.Whatsapp), + ("E-mail", empresa.Email, "Site", empresa.Site), + }); + + // 4. CONTADOR + col.Item().PaddingTop(10); + Secao(col, "DADOS DO CONTADOR"); + Grade(col, new[] + { + ("CPF/CNPJ do Contador", empresa.CNPJCPF_Contador, "Nome do Contador", empresa.Nome_Contador), + }); + + // 5. OUTROS + if (!string.IsNullOrWhiteSpace(empresa.TextoParaRecibo)) + { + col.Item().PaddingTop(10); + Secao(col, "TEXTO PARA RECIBO"); + col.Item().PaddingTop(4) + .Border(0.5f).BorderColor(Color.FromHex("#E2E8F0")) + .Padding(8) + .Text(empresa.TextoParaRecibo) + .FontSize(9).FontColor(Color.FromHex("#475569")); + } + + // 6. INFORMAÇÕES DO REGISTRO + col.Item().PaddingTop(10); + Secao(col, "INFORMAÇÕES DO REGISTRO"); + Grade(col, new[] + { + ("ID", empresa.Id.ToString(), "Criado Em", empresa.CriadoEm.ToString("dd/MM/yyyy")), + ("Atualizado Em",empresa.AtualizadoEm.ToString("dd/MM/yyyy"), "", ""), + }); + }); + + // ── RODAPÉ ───────────────────────────────────────────── + page.Footer().AlignCenter().Text(text => + { + text.Span("LevelOS — Documento gerado automaticamente em ") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + text.Span(DateTime.Now.ToString("dd/MM/yyyy HH:mm")) + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + text.Span(" — Página ") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + text.CurrentPageNumber() + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + text.Span(" de ") + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + text.TotalPages() + .FontSize(8).FontColor(Color.FromHex("#94A3B8")); + }); + }); + }).GeneratePdf(caminho); + + return new FichaPDFResultado + { + Sucesso = true, + Caminho = caminho, + Mensagem = "Ficha gerada com sucesso!" + }; + } + catch (Exception ex) + { + return new FichaPDFResultado + { + Sucesso = false, + Mensagem = $"Erro ao gerar ficha: {ex.Message}" + }; + } + } + + // ══════════════════════════════════════════════════════════════════════ + // GERAR E ABRIR AUTOMATICAMENTE + // ══════════════════════════════════════════════════════════════════════ + public static FichaPDFResultado GerarEAbrir(ModeloEmpresa empresa, string? pastaDestino = null) + { + var resultado = Gerar(empresa, pastaDestino); + + if (resultado.Sucesso && resultado.Caminho != null) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo + { + FileName = resultado.Caminho, + UseShellExecute = true + }); + } + + return resultado; + } + + // ── HELPERS INTERNOS ────────────────────────────────────────────────── + + private static void Secao(ColumnDescriptor col, string titulo) + { + col.Item().Column(c => + { + c.Item().Text(titulo) + .FontSize(9).Bold() + .FontColor(Color.FromHex("#2563EB")); + c.Item().LineHorizontal(0.5f) + .LineColor(Color.FromHex("#E2E8F0")); + }); + } + + private static void Grade(ColumnDescriptor col, + (string label1, string? val1, string label2, string? val2)[] linhas) + { + foreach (var (label1, val1, label2, val2) in linhas) + { + col.Item().PaddingTop(4).Row(row => + { + // Coluna esquerda + row.RelativeItem().Column(c => + { + c.Item().Text(label1) + .FontSize(7.5f).FontColor(Color.FromHex("#94A3B8")); + c.Item().Text(val1 ?? "—") + .FontSize(9).FontColor(Color.FromHex("#1E293B")); + }); + + // Coluna direita + if (!string.IsNullOrEmpty(label2)) + { + row.RelativeItem().Column(c => + { + c.Item().Text(label2) + .FontSize(7.5f).FontColor(Color.FromHex("#94A3B8")); + c.Item().Text(val2 ?? "—") + .FontSize(9).FontColor(Color.FromHex("#1E293B")); + }); + } + }); + } + } + } + + // ── MODELO DE RETORNO ───────────────────────────────────────────────────── + public class FichaPDFResultado + { + public bool Sucesso { get; set; } + public string Mensagem { get; set; } = string.Empty; + public string? Caminho { get; set; } + } +} \ No newline at end of file diff --git a/TLL/FormHelper.cs b/TLL/FormHelper.cs new file mode 100644 index 0000000..755744e --- /dev/null +++ b/TLL/FormHelper.cs @@ -0,0 +1,73 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace UI +{ + /// + /// Abre qualquer UserControl dentro de um Form genérico, + /// sem precisar criar uma classe Form para cada tela. + /// + public static class FormHelper + { + // ══════════════════════════════════════════════════════════════════════ + // ABRE UM USERCONTROL GENÉRICO + // Uso: FormHelper.Show("Agenda"); + // ══════════════════════════════════════════════════════════════════════ + public static void Show( + string titulo, + int width = 1150, + int height = 780, + Action? configure = null) // opcional: configurar o painel antes de abrir + where TPanel : UserControl, new() + { + using var form = BuildForm(titulo, width, height); + var panel = new TPanel(); + configure?.Invoke(panel); + form.Controls.Add(panel); + form.ShowDialog(); + } + + // ══════════════════════════════════════════════════════════════════════ + // ABRE UM USERCONTROL JÁ INSTANCIADO (útil quando precisa passar dados) + // Uso: FormHelper.Show(new AgendaCadastroPanel(), "Agenda"); + // ══════════════════════════════════════════════════════════════════════ + public static void Show( + UserControl panel, + string titulo, + int width = 1150, + int height = 780) + { + using var form = BuildForm(titulo, width, height); + form.Controls.Add(panel); + form.ShowDialog(); + } + + // ══════════════════════════════════════════════════════════════════════ + // ABRE UM FORM QUALQUER (mantém compatibilidade com o showForms) + // Uso: FormHelper.ShowForm(); + // ══════════════════════════════════════════════════════════════════════ + public static void ShowForm() + where TForm : Form, new() + { + using var form = new TForm(); + form.StartPosition = FormStartPosition.CenterScreen; + form.ShowDialog(); + } + + // ── BUILDER INTERNO ─────────────────────────────────────────────────── + private static Form BuildForm(string titulo, int width, int height) + { + return new Form + { + Text = titulo, + Size = new Size(width, height), + StartPosition = FormStartPosition.CenterScreen, + BackColor = Color.White, + MinimumSize = new Size(800, 500), + Icon = System.Drawing.Icon.ExtractAssociatedIcon( + System.Reflection.Assembly.GetEntryAssembly()!.Location) + }; + } + } +} \ No newline at end of file diff --git a/TLL/JsonHelper.cs b/TLL/JsonHelper.cs new file mode 100644 index 0000000..079b1cc --- /dev/null +++ b/TLL/JsonHelper.cs @@ -0,0 +1,72 @@ +using System; +using System.IO; +using System.Text.Json; + +public static class JsonHelper +{ + private static readonly JsonSerializerOptions _options = new JsonSerializerOptions + { + WriteIndented = true // JSON bonito + }; + + // 🔹 SALVAR JSON + public static void Salvar(T objeto, string caminho) + { + try + { + string json = JsonSerializer.Serialize(objeto, _options); + + // Garante que a pasta existe + string pasta = Path.GetDirectoryName(caminho); + if (!Directory.Exists(pasta)) + Directory.CreateDirectory(pasta); + + File.WriteAllText(caminho, json); + } + catch (Exception ex) + { + throw new Exception("Erro ao salvar JSON: " + ex.Message); + } + }//Salvar + public static bool SalvarBoolean(T objeto, string caminho) + { + try + { + string json = JsonSerializer.Serialize(objeto, _options); + + string pasta = Path.GetDirectoryName(caminho); + + if (!string.IsNullOrWhiteSpace(pasta) && !Directory.Exists(pasta)) + Directory.CreateDirectory(pasta); + + File.WriteAllText(caminho, json); + + return true; + } + catch + { + return false; + } + } + + // 🔹 LER JSON + public static T Ler(string caminho) where T : new() + { + try + { + if (!File.Exists(caminho)) + return new T(); + + string json = File.ReadAllText(caminho); + + if (string.IsNullOrWhiteSpace(json)) + return new T(); + + return JsonSerializer.Deserialize(json) ?? new T(); + } + catch (Exception ex) + { + throw new Exception("Erro ao ler JSON: " + ex.Message); + } + } +} \ No newline at end of file diff --git a/TLL/TLL.csproj b/TLL/TLL.csproj new file mode 100644 index 0000000..fdf2d6a --- /dev/null +++ b/TLL/TLL.csproj @@ -0,0 +1,15 @@ + + + net8.0-windows + true + enable + enable + + + + + + + + + \ No newline at end of file diff --git a/TLL/VerifyCep.cs b/TLL/VerifyCep.cs new file mode 100644 index 0000000..cd45d38 --- /dev/null +++ b/TLL/VerifyCep.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TLL +{ + public static class VerifyCep + { + static public String cep = ""; + static public String cidade = ""; + static public String estado = ""; + static public String endereco = ""; + static public String bairro = ""; + + public static Boolean verificaCEP(String CEP) + { + bool flag = false; + try + { + DataSet ds = new DataSet(); + string xml = "http://cep.republicavirtual.com.br/web_cep.php?cep=@cep&formato=xml".Replace("@cep", CEP); + ds.ReadXml(xml); + endereco = ds.Tables[0].Rows[0]["logradouro"].ToString(); + bairro = ds.Tables[0].Rows[0]["bairro"].ToString(); + cidade = ds.Tables[0].Rows[0]["cidade"].ToString(); + estado = ds.Tables[0].Rows[0]["uf"].ToString(); + cep = CEP; + flag = true; + } + catch (Exception ex) + { + endereco = ""; + bairro = ""; + cidade = ""; + estado = ""; + cep = ""; + } + return flag; + } + } +} diff --git a/UI/ArquivosAuxiliares/DadosAuxiliaresTabelaPermissoes.sql b/UI/ArquivosAuxiliares/DadosAuxiliaresTabelaPermissoes.sql new file mode 100644 index 0000000..715188e --- /dev/null +++ b/UI/ArquivosAuxiliares/DadosAuxiliaresTabelaPermissoes.sql @@ -0,0 +1,108 @@ +INSERT INTO Permissoes (Nome, Descricao) +VALUES + +-- ======================== +-- EMPRESA +-- ======================== +('EMPRESA_VER', 'Visualizar dados da empresa'), +('EMPRESA_EDITAR', 'Editar dados da empresa'), + +-- ======================== +-- CLIENTES +-- ======================== +('CLIENTE_VER', 'Visualizar clientes'), +('CLIENTE_CADASTRAR', 'Cadastrar clientes'), +('CLIENTE_EDITAR', 'Editar clientes'), +('CLIENTE_EXCLUIR', 'Excluir clientes'), + +-- ======================== +-- FORNECEDORES +-- ======================== +('FORNECEDOR_VER', 'Visualizar fornecedores'), +('FORNECEDOR_CADASTRAR', 'Cadastrar fornecedores'), +('FORNECEDOR_EDITAR', 'Editar fornecedores'), +('FORNECEDOR_EXCLUIR', 'Excluir fornecedores'), + +-- ======================== +-- FUNCIONARIOS +-- ======================== +('FUNCIONARIO_VER', 'Visualizar funcionrios'), +('FUNCIONARIO_CADASTRAR', 'Cadastrar funcionrios'), +('FUNCIONARIO_EDITAR', 'Editar funcionrios'), +('FUNCIONARIO_EXCLUIR', 'Excluir funcionrios'), + +-- ======================== +-- USUARIOS / SEGURANA +-- ======================== +('USUARIO_VER', 'Visualizar usurios'), +('USUARIO_CADASTRAR', 'Cadastrar usurios'), +('USUARIO_EDITAR', 'Editar usurios'), +('USUARIO_EXCLUIR', 'Excluir usurios'), +('PERMISSAO_GERENCIAR', 'Gerenciar permisses'), + +-- ======================== +-- SERVIOS +-- ======================== +('SERVICO_VER', 'Visualizar servios'), +('SERVICO_CADASTRAR', 'Cadastrar servios'), +('SERVICO_EDITAR', 'Editar servios'), +('SERVICO_EXCLUIR', 'Excluir servios'), + +-- ======================== +-- CONTRATOS +-- ======================== +('CONTRATO_VER', 'Visualizar contratos'), +('CONTRATO_CADASTRAR', 'Cadastrar contratos'), +('CONTRATO_EDITAR', 'Editar contratos'), +('CONTRATO_EXCLUIR', 'Excluir contratos'), + +-- ======================== +-- FINANCEIRO - RECEBER +-- ======================== +('RECEBER_VER', 'Visualizar contas a receber'), +('RECEBER_CADASTRAR', 'Cadastrar contas a receber'), +('RECEBER_EDITAR', 'Editar contas a receber'), +('RECEBER_BAIXAR', 'Dar baixa em contas a receber'), + +-- ======================== +-- FINANCEIRO - PAGAR +-- ======================== +('PAGAR_VER', 'Visualizar contas a pagar'), +('PAGAR_CADASTRAR', 'Cadastrar contas a pagar'), +('PAGAR_EDITAR', 'Editar contas a pagar'), +('PAGAR_BAIXAR', 'Dar baixa em contas a pagar'), + +-- ======================== +-- PLANO DE CONTAS +-- ======================== +('PLANO_CONTAS_VER', 'Visualizar plano de contas'), +('PLANO_CONTAS_CADASTRAR', 'Cadastrar plano de contas'), +('PLANO_CONTAS_EDITAR', 'Editar plano de contas'), +('PLANO_CONTAS_EXCLUIR', 'Excluir plano de contas'), + +-- ======================== +-- TRANSPORTADORAS +-- ======================== +('TRANSPORTADORA_VER', 'Visualizar transportadoras'), +('TRANSPORTADORA_CADASTRAR', 'Cadastrar transportadoras'), +('TRANSPORTADORA_EDITAR', 'Editar transportadoras'), +('TRANSPORTADORA_EXCLUIR', 'Excluir transportadoras'), + +-- ======================== +-- RELATORIOS +-- ======================== +('RELATORIO_FINANCEIRO', 'Acessar relatrios financeiros'), +('RELATORIO_CLIENTES', 'Acessar relatrios de clientes'), +('RELATORIO_GERAL', 'Acessar relatrios gerais'), + +-- ======================== +-- SISTEMA +-- ======================== +('SISTEMA_CONFIG', 'Alterar configuraes do sistema'), +('SISTEMA_LOGS', 'Visualizar logs do sistema'); + +INSERT INTO Permissoes (Nome, Descricao) +SELECT 'CLIENTE_VER', 'Visualizar clientes' +WHERE NOT EXISTS ( + SELECT 1 FROM Permissoes WHERE Nome = 'CLIENTE_VER' +); \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/DadosSistema.sql b/UI/ArquivosAuxiliares/DadosSistema.sql new file mode 100644 index 0000000..eeab4ec --- /dev/null +++ b/UI/ArquivosAuxiliares/DadosSistema.sql @@ -0,0 +1,74 @@ +-- ========================= +-- PEGAR EMPRESA +-- ========================= +DECLARE @EmpresaId INT; +SELECT TOP 1 @EmpresaId = Id FROM Empresa; + +-- ========================= +-- CRIAR USUARIO ADMIN +-- ========================= +IF NOT EXISTS (SELECT 1 FROM Usuarios WHERE Usuario = 'admin' AND EmpresaId = @EmpresaId) +BEGIN + INSERT INTO Usuarios ( + EmpresaId, Nome, Email, Usuario, SenhaHash, Ativo, CriadoEm + ) + VALUES ( + @EmpresaId, + 'Administrador do Sistema', + 'admin@levelcode.com.br', + 'admin', + CONVERT(VARCHAR(255), HASHBYTES('SHA2_256', 'Nad310311*##'), 2), + 1, + GETDATE() + ); +END + +-- ========================= +-- CRIAR PERFIL ADMIN +-- ========================= +IF NOT EXISTS (SELECT 1 FROM Perfis WHERE Nome = 'Administrador' AND EmpresaId = @EmpresaId) +BEGIN + INSERT INTO Perfis ( + EmpresaId, Nome, Descricao, Ativo + ) + VALUES ( + @EmpresaId, + 'Administrador', + 'Acesso total ao sistema', + 1 + ); +END + +-- ========================= +-- PEGAR IDS +-- ========================= +DECLARE @UsuarioId INT; +DECLARE @PerfilId INT; + +SELECT @UsuarioId = Id FROM Usuarios WHERE Usuario = 'admin' AND EmpresaId = @EmpresaId; +SELECT @PerfilId = Id FROM Perfis WHERE Nome = 'Administrador' AND EmpresaId = @EmpresaId; + +-- ========================= +-- VINCULAR USUARIO AO PERFIL +-- ========================= +IF NOT EXISTS ( + SELECT 1 FROM UsuarioPerfis + WHERE UsuarioId = @UsuarioId AND PerfilId = @PerfilId +) +BEGIN + INSERT INTO UsuarioPerfis (UsuarioId, PerfilId) + VALUES (@UsuarioId, @PerfilId); +END + +-- ========================= +-- DAR TODAS PERMISSES +-- ========================= +INSERT INTO PerfilPermissoes (PerfilId, PermissaoId) +SELECT + @PerfilId, + Id +FROM Permissoes +WHERE NOT EXISTS ( + SELECT 1 FROM PerfilPermissoes + WHERE PerfilId = @PerfilId AND PermissaoId = Permissoes.Id +); diff --git a/UI/ArquivosAuxiliares/Database.sql b/UI/ArquivosAuxiliares/Database.sql new file mode 100644 index 0000000..27e3c15 --- /dev/null +++ b/UI/ArquivosAuxiliares/Database.sql @@ -0,0 +1,674 @@ +-- ================================ +-- CRIAR DATABASE +-- ================================ +IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'LevelOS') +BEGIN + CREATE DATABASE LevelOS; +END +GO + +USE LevelOS; +GO + +-- ================================ +-- TABELA EMPRESA +-- ================================ +CREATE TABLE Empresa ( + Id INT IDENTITY(1,1) PRIMARY KEY, + + -- Dados bsicos + Nome VARCHAR(255) NOT NULL, + CNPJ VARCHAR(20) NOT NULL UNIQUE, + TipoEmpresa VARCHAR(20) NOT NULL, + RegimeTributario VARCHAR(30) NOT NULL, + CNAE VARCHAR(20) NOT NULL, + + -- Endereo + Cep VARCHAR(15) NOT NULL, + Endereco VARCHAR(255) NOT NULL, + Numero INT NOT NULL, + Complemento VARCHAR(255), + Bairro VARCHAR(255) NOT NULL, + Cidade VARCHAR(255) NOT NULL, + UF CHAR(2) NOT NULL, + Pais VARCHAR(50), + + -- Contatos + Telefone1 VARCHAR(20), + Telefone2 VARCHAR(20), + Celular VARCHAR(20), + Whatsapp VARCHAR(20), + Email VARCHAR(150) NOT NULL, + Site VARCHAR(255), + + -- Fiscal + InscricaoEstadual VARCHAR(20) UNIQUE, + InscricaoMunicipal VARCHAR(20) UNIQUE, + + -- Contador + CNPJCPF_Contador VARCHAR(20), + Nome_Contador VARCHAR(255), + + -- Sistema + TextoParaRecibo VARCHAR(MAX), + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE() +); +GO + +-- ================================ +-- CONFIGURAES +-- ================================ +CREATE TABLE Empresa_config ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Aparncia + NomeSistema VARCHAR(255), + CorPrimaria VARCHAR(20), + CorSecundaria VARCHAR(20), + Logo VARCHAR(255), + Favicon VARCHAR(255), + + -- OS + ExibirCPFCliente BIT DEFAULT 1, + ExibirTelefoneCliente BIT DEFAULT 1, + ExibirGarantia BIT DEFAULT 1, + DiasGarantiaPadrao INT DEFAULT 90, + + -- Financeiro + GerarReciboAutomatico BIT DEFAULT 1, + ExibirValoresOS BIT DEFAULT 1, + + -- Comunicao + EnviarEmailAutomatico BIT DEFAULT 0, + EnviarWhatsappAutomatico BIT DEFAULT 0, + + -- Sistema + ModoEscuro BIT DEFAULT 0, + PermitirEdicaoOSFinalizada BIT DEFAULT 0, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + CONSTRAINT FK_ConfigEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT UQ_ConfigEmpresa UNIQUE (EmpresaId) +); +GO + +-- ================================ +-- FUNCIONRIOS +-- ================================ +CREATE TABLE Funcionarios ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Dados pessoais + Nome VARCHAR(255) NOT NULL, + CPF VARCHAR(14), + DataNascimento DATE, + + -- Contato + Telefone VARCHAR(20), + Celular VARCHAR(20), + Email VARCHAR(150) NOT NULL, + + -- Login + Usuario VARCHAR(50) NOT NULL, + SenhaHash VARCHAR(255) NOT NULL, + + -- Permisso + TipoConta VARCHAR(20) NOT NULL DEFAULT 'Atendente', + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + UltimoLogin DATETIME, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Constraints + CONSTRAINT FK_FuncionarioEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT UQ_LoginEmpresa UNIQUE (EmpresaId, Usuario) +); +GO +-- ================================ +-- FORNECEDORES +-- ================================ + +CREATE TABLE Fornecedores ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Dados bsicos + Nome VARCHAR(255) NOT NULL, + TipoPessoa VARCHAR(2) NOT NULL, -- PF ou PJ + Documento VARCHAR(20) NOT NULL, -- CPF ou CNPJ + + -- Contato + Telefone VARCHAR(20), + Celular VARCHAR(20), + Whatsapp VARCHAR(20), + Email VARCHAR(150), + + -- Endereo + Cep VARCHAR(15), + Endereco VARCHAR(255), + Numero INT, + Complemento VARCHAR(255), + Bairro VARCHAR(255), + Cidade VARCHAR(255), + UF CHAR(2), + + -- Dados adicionais + NomeFantasia VARCHAR(255), + InscricaoEstadual VARCHAR(20), + Site VARCHAR(255), + Observacoes VARCHAR(MAX), + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_FornecedorEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + -- Evita duplicidade por empresa + CONSTRAINT UQ_Fornecedor_Doc UNIQUE (EmpresaId, Documento) +); +GO + +-- ================================ +-- TRANSPORTADORAS +-- ================================ +CREATE TABLE Transportadoras ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Dados bsicos + RazaoSocial VARCHAR(255) NOT NULL, + NomeFantasia VARCHAR(255), + CNPJ VARCHAR(20) NOT NULL, + + -- Contato + Telefone VARCHAR(20), + Celular VARCHAR(20), + Whatsapp VARCHAR(20), + Email VARCHAR(150), + + -- Endereo + Cep VARCHAR(15), + Endereco VARCHAR(255), + Numero INT, + Complemento VARCHAR(255), + Bairro VARCHAR(255), + Cidade VARCHAR(255), + UF CHAR(2), + + -- Dados de transporte + TipoFrete VARCHAR(20), -- CIF / FOB / etc + PrazoEntrega INT, -- em dias + ValorFretePadrao DECIMAL(10,2), + + -- Sistema + Observacoes VARCHAR(MAX), + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_TransportadoraEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + -- Evita duplicidade + CONSTRAINT UQ_Transportadora_CNPJ UNIQUE (EmpresaId, CNPJ) +); +GO +-- ================================ +-- CLIENTES +-- ================================ +CREATE TABLE Clientes ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Dados principais + Nome VARCHAR(255) NOT NULL, + NomeFantasia VARCHAR(255), + TipoPessoa VARCHAR(2) NOT NULL, -- PF / PJ + Documento VARCHAR(20) NOT NULL, -- CPF/CNPJ + RG VARCHAR(20), + InscricaoMunicipal VARCHAR(20), + DataNascimento DATE, + + -- Contato + Contato VARCHAR(255), + Telefone1 VARCHAR(20), + Telefone2 VARCHAR(20), + Celular VARCHAR(20), + Whatsapp VARCHAR(20), + Email VARCHAR(150), + EmailNFe VARCHAR(150), + Site VARCHAR(255), + + -- Classificao + Grupo VARCHAR(100), + + -- Endereo + Cep VARCHAR(15), + Endereco VARCHAR(255), + Numero INT, + Complemento VARCHAR(255), + Bairro VARCHAR(255), + Cidade VARCHAR(255), + UF CHAR(2), + Pais VARCHAR(50), + + -- Financeiro + LimiteCredito DECIMAL(10,2) DEFAULT 0, + Bloqueado BIT DEFAULT 0, + ObservacoesCobranca VARCHAR(MAX), + + -- Vendas / OS + VendedorPadraoId INT NULL, + TipoConsumidor VARCHAR(50), -- Consumidor final, revenda etc + + -- Sistema + Observacoes VARCHAR(MAX), + + -- Extras (campos custom) + CampoExtra1 VARCHAR(255), + CampoExtra2 VARCHAR(255), + CampoExtra3 VARCHAR(255), + + -- Carteiras virtuais + Bitcoin VARCHAR(255), + Ethereum VARCHAR(255), + Litecoin VARCHAR(255), + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + UltimaCompra DATETIME, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_ClienteEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + -- Evita duplicidade + CONSTRAINT UQ_Cliente_Doc UNIQUE (EmpresaId, Documento) +); +GO + +-- ================================ +-- SERVIOS +-- ================================ +CREATE TABLE Servicos ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Dados bsicos + Nome VARCHAR(255) NOT NULL, + Descricao VARCHAR(MAX), + + -- Valores + ValorPadrao DECIMAL(10,2) NOT NULL, + Custo DECIMAL(10,2), + + -- Comisso + TipoComissao VARCHAR(10) NOT NULL DEFAULT 'Percentual', -- Percentual ou Fixo + ValorComissao DECIMAL(10,2) NOT NULL DEFAULT 0, + + -- Tempo + TempoEstimado INT, -- em minutos + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_ServicoEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE +); +GO +-- ================================ +-- Situao OS +-- ================================ +CREATE TABLE SituacoesOS ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Identificao + Descricao VARCHAR(255) NOT NULL, + + -- Classificao (os 3 grupos da tela) + Tipo VARCHAR(20) NOT NULL, + -- Entrada | Oficina | Saida + + -- Regras da OS + ConsideraAberta BIT NOT NULL DEFAULT 1, + ConsideraFechada BIT NOT NULL DEFAULT 0, + MarcaComoPronto BIT NOT NULL DEFAULT 0, + + -- Aparncia (igual na tela) + CorFundo VARCHAR(20), + CorFonte VARCHAR(20), + + -- Financeiro (opcional) + PlanoContasId INT NULL, + + -- Controle + Ordem INT DEFAULT 0, -- ordem de exibio + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_SituacaoEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE +); +GO +-- ================================ +-- CONTRATOS +-- ================================ +CREATE TABLE Contratos ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + ClienteId INT NOT NULL, + + -- Dados principais + Descricao VARCHAR(255), + Observacoes VARCHAR(MAX), + + Valor DECIMAL(10,2) NOT NULL, + DataInicio DATE, + DataValidade DATE, + + -- Controle de franquia (ex: horas inclusas) + FranquiaTempo INT, -- minutos ou horas (voc define padro) + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamentos + CONSTRAINT FK_ContratoEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT FK_ContratoCliente + FOREIGN KEY (ClienteId) REFERENCES Clientes(Id) +); +GO +-- ================================ +-- CONTRATOS - EQUIPAMENTOS +-- ================================ +CREATE TABLE ContratoEquipamentos ( + Id INT IDENTITY(1,1) PRIMARY KEY, + ContratoId INT NOT NULL, + + -- Dados do equipamento + Modelo VARCHAR(255), + Marca VARCHAR(255), + Operadora VARCHAR(100), + Serial VARCHAR(100), + NumeroPatrimonio VARCHAR(100), + + Observacoes VARCHAR(MAX), + + -- Relacionamento + CONSTRAINT FK_ContratoEquipamento + FOREIGN KEY (ContratoId) REFERENCES Contratos(Id) ON DELETE CASCADE +); +GO +-- ================================ +-- PLANO DE CONTAS +-- ================================ +CREATE TABLE PlanoDeContas ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + -- Hierarquia + ContaPaiId INT NULL, + + -- Identificao + Nome VARCHAR(255) NOT NULL, + Codigo VARCHAR(50), -- Ex: 1.01.02 + Tipo VARCHAR(20) NOT NULL, -- Receita / Despesa + + -- Controle + AceitaLancamento BIT NOT NULL DEFAULT 1, -- se pode lanar direto + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamentos + CONSTRAINT FK_PlanoContaEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT FK_PlanoContaPai + FOREIGN KEY (ContaPaiId) REFERENCES PlanoDeContas(Id) +); +GO +-- ================================ +-- CONTAS A PAGAR +-- ================================ +CREATE TABLE ContasReceber ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + ClienteId INT NOT NULL, + + -- Classificao + PlanoContaId INT NOT NULL, + + -- Origem (contrato, venda futura, etc) + ContratoId INT NULL, + + -- Dados financeiros + Descricao VARCHAR(255), + Valor DECIMAL(10,2) NOT NULL, + DataEmissao DATE, + DataVencimento DATE NOT NULL, + DataPagamento DATE, + + -- Controle + Status VARCHAR(20) NOT NULL DEFAULT 'Pendente', + -- Pendente / Pago / Cancelado / Atrasado + + ValorPago DECIMAL(10,2), + Juros DECIMAL(10,2) DEFAULT 0, + Multa DECIMAL(10,2) DEFAULT 0, + Desconto DECIMAL(10,2) DEFAULT 0, + + -- Observaes + Observacoes VARCHAR(MAX), + + -- Controle sistema + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamentos + CONSTRAINT FK_ReceberEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT FK_ReceberCliente + FOREIGN KEY (ClienteId) REFERENCES Clientes(Id), + + CONSTRAINT FK_ReceberPlano + FOREIGN KEY (PlanoContaId) REFERENCES PlanoDeContas(Id), + + CONSTRAINT FK_ReceberContrato + FOREIGN KEY (ContratoId) REFERENCES Contratos(Id) +); +GO +-- ================================ +-- CONTAS A PAGAR +-- ================================ +CREATE TABLE ContasPagar ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + FornecedorId INT NOT NULL, + + -- Classificao + PlanoContaId INT NOT NULL, + + -- Dados financeiros + Descricao VARCHAR(255), + Valor DECIMAL(10,2) NOT NULL, + DataEmissao DATE, + DataVencimento DATE NOT NULL, + DataPagamento DATE, + + -- Controle + Status VARCHAR(20) NOT NULL DEFAULT 'Pendente', + + ValorPago DECIMAL(10,2), + Juros DECIMAL(10,2) DEFAULT 0, + Multa DECIMAL(10,2) DEFAULT 0, + Desconto DECIMAL(10,2) DEFAULT 0, + + -- Observaes + Observacoes VARCHAR(MAX), + + -- Controle sistema + Ativo BIT NOT NULL DEFAULT 1, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamentos + CONSTRAINT FK_PagarEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + CONSTRAINT FK_PagarFornecedor + FOREIGN KEY (FornecedorId) REFERENCES Fornecedores(Id), + + CONSTRAINT FK_PagarPlano + FOREIGN KEY (PlanoContaId) REFERENCES PlanoDeContas(Id) +); +GO + +-- ================================ +-- USURIOS DO SISTEMA +-- ================================ +CREATE TABLE Usuarios ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + Nome VARCHAR(255) NOT NULL, + Email VARCHAR(150) NOT NULL, + Usuario VARCHAR(50) NOT NULL, + SenhaHash VARCHAR(255) NOT NULL, + + -- Controle + Ativo BIT NOT NULL DEFAULT 1, + UltimoLogin DATETIME, + + -- Auditoria + CriadoEm DATETIME DEFAULT GETDATE(), + AtualizadoEm DATETIME DEFAULT GETDATE(), + + -- Relacionamento + CONSTRAINT FK_UsuarioEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE, + + -- Evita login duplicado por empresa + CONSTRAINT UQ_Usuario_Login UNIQUE (EmpresaId, Usuario) +); +GO +-- ================================ +-- PERFIS DE USURIO +-- ================================ +CREATE TABLE Perfis ( + Id INT IDENTITY(1,1) PRIMARY KEY, + EmpresaId INT NOT NULL, + + Nome VARCHAR(100) NOT NULL, -- Admin, Tcnico, etc + Descricao VARCHAR(255), + + Ativo BIT NOT NULL DEFAULT 1, + + CONSTRAINT FK_PerfilEmpresa + FOREIGN KEY (EmpresaId) REFERENCES Empresa(Id) ON DELETE CASCADE +); +GO +-- ================================ +-- PERMISSES DE USURIO +-- ================================ +CREATE TABLE Permissoes ( + Id INT IDENTITY(1,1) PRIMARY KEY, + + Nome VARCHAR(100) NOT NULL, -- Ex: CLIENTE_CADASTRAR + Descricao VARCHAR(255) +); +GO +-- ================================ +-- PERFIL - PERMISSES +-- ================================ +CREATE TABLE PerfilPermissoes ( + Id INT IDENTITY(1,1) PRIMARY KEY, + PerfilId INT NOT NULL, + PermissaoId INT NOT NULL, + + CONSTRAINT FK_PerfilPermissao_Perfil + FOREIGN KEY (PerfilId) REFERENCES Perfis(Id) ON DELETE CASCADE, + + CONSTRAINT FK_PerfilPermissao_Permissao + FOREIGN KEY (PermissaoId) REFERENCES Permissoes(Id) ON DELETE CASCADE, + + CONSTRAINT UQ_PerfilPermissao UNIQUE (PerfilId, PermissaoId) +); +GO +-- ================================ +-- USURIO - PERFIL +-- ================================ +CREATE TABLE UsuarioPerfis ( + Id INT IDENTITY(1,1) PRIMARY KEY, + UsuarioId INT NOT NULL, + PerfilId INT NOT NULL, + + CONSTRAINT FK_UsuarioPerfil_Usuario + FOREIGN KEY (UsuarioId) + REFERENCES Usuarios(Id) + ON DELETE CASCADE, + + CONSTRAINT FK_UsuarioPerfil_Perfil + FOREIGN KEY (PerfilId) + REFERENCES Perfis(Id) + ON DELETE NO ACTION, + + CONSTRAINT UQ_UsuarioPerfil UNIQUE (UsuarioId, PerfilId) +); +GO \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ExemploUSO.txt b/UI/ArquivosAuxiliares/ExemploUSO.txt new file mode 100644 index 0000000..4adeae9 --- /dev/null +++ b/UI/ArquivosAuxiliares/ExemploUSO.txt @@ -0,0 +1,95 @@ +using DALL; +using System.Data; + +// ============================================= +// Configuração da connection string +// ============================================= +var connectionString = "Server=206.42.13.180;Database=Levelcode-LevelOS;User Id=sa;Password=suasenha;TrustServerCertificate=True;"; + +var backupService = new DALLBackupService(connectionString); + +// ============================================= +// Backup FULL +// ============================================= +var resultadoFull = backupService.ExecutarBackupFull(); + +if (resultadoFull.Sucesso) + Console.WriteLine($"✅ Backup FULL concluído em {resultadoFull.Duracao.TotalSeconds:F1}s"); +else + Console.WriteLine($"❌ Erro no Backup FULL: {resultadoFull.Erro}"); + +// ============================================= +// Backup DIFERENCIAL +// ============================================= +var resultadoDiff = backupService.ExecutarBackupDiferencial(); + +if (resultadoDiff.Sucesso) + Console.WriteLine($"✅ Backup DIFERENCIAL concluído em {resultadoDiff.Duracao.TotalSeconds:F1}s"); +else + Console.WriteLine($"❌ Erro no Backup DIFERENCIAL: {resultadoDiff.Erro}"); + +// ============================================= +// Limpeza de backups antigos +// ============================================= +var resultadoLimpeza = backupService.ExecutarLimpeza(); + +if (resultadoLimpeza.Sucesso) + Console.WriteLine($"✅ Limpeza concluída em {resultadoLimpeza.Duracao.TotalSeconds:F1}s"); +else + Console.WriteLine($"❌ Erro na Limpeza: {resultadoLimpeza.Erro}"); + +// ============================================= +// Listar histórico de backups +// ============================================= +var historico = backupService.ListarHistoricoBackups(); + +Console.WriteLine("\n📋 Histórico de Backups:"); +Console.WriteLine($"{"Tipo",-15} {"TamanhoMB",-12} {"Inicio",-22} {"Arquivo"}"); +Console.WriteLine(new string('-', 90)); + +foreach (DataRow row in historico.Rows) +{ + Console.WriteLine($"{row["Tipo"],-15} {row["TamanhoMB"],-12} {row["Inicio"],-22} {row["Arquivo"]}"); +} + +// ============================================= +// Restauração FULL + DIFERENCIAL +// ============================================= + +// Pega o arquivo mais recente do histórico automaticamente +string arquivoFull = ""; +string arquivoDiff = ""; + +foreach (DataRow row in historico.Rows) +{ + if (row["Tipo"].ToString() == "FULL" && string.IsNullOrEmpty(arquivoFull)) + arquivoFull = row["Arquivo"].ToString()!; + + if (row["Tipo"].ToString() == "DIFERENCIAL" && string.IsNullOrEmpty(arquivoDiff)) + arquivoDiff = row["Arquivo"].ToString()!; + + if (!string.IsNullOrEmpty(arquivoFull) && !string.IsNullOrEmpty(arquivoDiff)) + break; +} + +// Restaura FULL +Console.WriteLine($"\n🔁 Restaurando FULL: {arquivoFull}"); +var r1 = backupService.RestaurarBackup(arquivoFull, TipoRestauracao.Full); + +if (r1.Sucesso) +{ + Console.WriteLine($"✅ FULL restaurado em {r1.Duracao.TotalSeconds:F1}s"); + + // Aplica DIFERENCIAL após o FULL + Console.WriteLine($"🔁 Aplicando DIFERENCIAL: {arquivoDiff}"); + var r2 = backupService.RestaurarBackup(arquivoDiff, TipoRestauracao.Diferencial); + + if (r2.Sucesso) + Console.WriteLine($"✅ DIFERENCIAL aplicado em {r2.Duracao.TotalSeconds:F1}s — Banco online!"); + else + Console.WriteLine($"❌ Erro no DIFERENCIAL: {r2.Erro}"); +} +else +{ + Console.WriteLine($"❌ Erro no FULL: {r1.Erro}"); +} \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/InsertsLotes.sql b/UI/ArquivosAuxiliares/InsertsLotes.sql new file mode 100644 index 0000000..3dac05e --- /dev/null +++ b/UI/ArquivosAuxiliares/InsertsLotes.sql @@ -0,0 +1,157 @@ +INSERT INTO Bancos (NUMERO, NOME) VALUES +(1,'Banco do Brasil S/A'), +(2,'Banco Central do Brasil'), +(3,'Banco da Amazonia S/A'), +(4,'Banco do Nordeste do Brasil S/A'), +(8,'Banco Santander Meridional S/A'), +(21,'BANESTES S/A - Banco Est.Esp.Santo'), +(22,'CREDIREAL'), +(24,'Banco de Pernambuco S/A - BANDEPE'), +(25,'Banco Alfa S/A'), +(27,'Banco Estado Santa Catarina S/A'), +(28,'BANEB'), +(29,'Banco BANERJ S/A'), +(30,'PARAIBAN - Banco da Paraiba S/A'), +(31,'Banco BEG S/A'), +(33,'SANTANDER'), +(34,'Banco BEA S/A'), +(35,'Banco do Estado do Ceara S/A - BEC'), +(36,'Banco do Estado do Maranhao S/A'), +(37,'Banco do Estado do Para S/A'), +(38,'Banco BANESTADO S/A'), +(39,'Banco do Estado do Piaui S/A'), +(40,'Banco Cargill S/A'), +(41,'Banco Est. Rio Grande do Sul S/A'), +(44,'Banco BVA S/A'), +(45,'Banco OPPORTUNITY S/A'), +(47,'Banco Est. de Sergipe S/A'), +(48,'Banco BENGE S/A'), +(63,'IBIBANK S/A - Banco Multiplo'), +(65,'LEMON BANK Banco Multiplo S/A'), +(66,'Banco MORGAN S. D. Witter S/A'), +(67,'Banco BANEB S/A'), +(68,'Banco BEA S/A'), +(70,'BRB-Banco de Brasilia S/A'), +(89,'CREDISAN'), +(104,'Caixa Economica Federal'), +(106,'Banco Itabanco S/A'), +(107,'Banco BBM S/A'), +(109,'CREDIBANCO S/A'), +(116,'Banco BNL do Brasil S/A'), +(148,'Bank Of America Brasil S/A'), +(151,'Banco Nossa Caixa S/A'), +(175,'Banco Finasa S/A'), +(184,'Banco BBA Creditanstalt S/A'), +(204,'BCO Inter American Express S/A'), +(208,'Banco Pactual S/A'), +(210,'DRESDNER Bank Lateinamerika A.'), +(212,'Banco Matone S/A'), +(213,'Banco ARBI S/A'), +(214,'Banco DIBENS S/A'), +(215,'Banco Com e Invest Sudameris'), +(216,'Banco Regional MALCON S/A'), +(217,'Banco JOHN DEERE S/A'), +(218,'Banco Bonsucesso S/A'), +(219,'Banco ZOGBI S/A'), +(222,'BCO Credit Lyonnais Brasil S/A'), +(224,'Banco Fibra S/A'), +(225,'Banco Brascan S/A'), +(229,'Banco Cruzeiro do Sul S/A'), +(230,'Banco Bandeirantes S/A'), +(231,'Banco Boavista interatlantico S/A'), +(233,'Banco GE Capital S/A'), +(237,'Banco Bradesco S/A'), +(240,'Banco de Credito Real de M.G. S/A'), +(241,'Banco Classico S/A'), +(243,'Banco STOCK Maxima S/A'), +(244,'Banco Cidade S/A'), +(246,'Banco ABC-Brasil S/A'), +(247,'UBS WARBURG S/A'), +(249,'Banco Investcred UNIBANCO S/A'), +(250,'Banco SCHAHIN S/A'), +(252,'Banco FININVEST S/A'), +(254,'PARANA Banco S/A'), +(263,'Banco CACIQUE S/A'), +(265,'Banco Fator S/A'), +(266,'Banco Cedula S/A'), +(275,'Banco ABN AMRO Real S/A'), +(291,'Banco de Cred. Nacional S/A'), +(294,'BCR'), +(300,'Banco de LA Nacion Argentina'), +(318,'Banco BMG S/A'), +(320,'Banco Ind. e Com. S/A'), +(341,'Banco Itau S/A'), +(346,'Banco BFB'), +(347,'Banco Sudameris Brasil S/A'), +(351,'Banco Bozano Simonsen S/A'), +(353,'Banco Santander S/A'), +(356,'Banco ABN AMRO S/A'), +(366,'Banco Societe Generale Bras. S/A'), +(370,'Banco Westlb do Brasil S/A'), +(376,'Banco CHASE Manhattan S/A'), +(389,'Banco Mercantil do Brasil S/A'), +(392,'Banco Mercantil de Sao Paulo S/A'), +(394,'Banco BMC S/A'), +(399,'HSBC Bank Brasil S/A'), +(409,'Unibanco Uniao de Bancos Bras. S/A'), +(412,'Banco Capital S/A'), +(422,'Banco Safra S/A'), +(424,'Banco Santander Nordeste S/A'), +(453,'Banco Rural S/A'), +(456,'Banco de Tokio Mitsubishi BR S/A'), +(464,'Banco Sumitomo Mitsui Bras. S/A'), +(472,'LLOYDS Bank PLC'), +(473,'Banco Financial Portugues S/A'), +(477,'Banco Citibank N/A'), +(479,'Bankboston Banco Multiplo S/A'), +(487,'Deutsche Bank S/A'), +(488,'Morgan G. Trust Company of NY'), +(492,'ING Bank N.V.'), +(493,'Banco Union - Brasil S/A'), +(494,'Banco de La Rep. Or.Del Uruguai'), +(495,'Banco de La Provinc.Buenos Aires'), +(496,'Banco Uno-E Brasil S/A'), +(505,'Banco Credit S. F. Boston S/A'), +(600,'Banco Luso Brasileiro S/A'), +(604,'Banco Industrial Brasileiro S/A'), +(610,'Banco VR S/A'), +(611,'Banco Paulista S/A'), +(612,'Banco Guanabara S/A'), +(613,'Banco Pecunia S/A'), +(623,'Banco Panamericano S/A'), +(626,'Banco FICSA S/A'), +(630,'Banco Intercap S/A'), +(633,'Banco Rendimento S/A'), +(634,'Banco Triangulo S/A'), +(637,'Banco SOFISA S/A'), +(638,'Banco Prosper S/A'), +(641,'Banco Bilbao Vizcaya Argentaria Brasil S/A'), +(643,'Banco Pine S/A'), +(650,'Banco PEBB S/A'), +(652,'Banco Frances e Brasileiro S/A'), +(653,'Banco Indusval S/A'), +(654,'Banco A. J. RENNER S/A'), +(655,'Banco Votorantim S/A'), +(702,'Banco Santos S/A'), +(707,'Banco Daycoval S/A'), +(719,'Banco Banif Primus S/A'), +(721,'Banco Credibel S/A'), +(733,'Banco das Nacoes S/A'), +(734,'Banco Gerdau S/A'), +(735,'Banco Pottencial S/A'), +(738,'Banco Morada S/A'), +(739,'Banco BGN S/A'), +(740,'Banco BARCLAYS S/A'), +(741,'Banco Ribeirao Preto S/A'), +(743,'Banco Emblema S/A'), +(744,'Bankboston N.A.'), +(745,'Banco Citibank S/A'), +(746,'Banco Modal S/A'), +(747,'Banco Rabobank INT Brasil S/A'), +(748,'Banco Coop. Sic. S/A BANSICREDI'), +(749,'BR Banco Mercantil S/A'), +(751,'DRESDNER Bank Brasil S/A'), +(752,'Banco BNP Paribas Brasil S/A'), +(753,'Banco Comercial Uruguai S/A'), +(756,'Banco Cooperativo do Brasil S/A'), +(757,'Banco KEB do Brasil S/A'); \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ProcedureBKP-DIFF_AUTO.sql b/UI/ArquivosAuxiliares/ProcedureBKP-DIFF_AUTO.sql new file mode 100644 index 0000000..ad63822 --- /dev/null +++ b/UI/ArquivosAuxiliares/ProcedureBKP-DIFF_AUTO.sql @@ -0,0 +1,44 @@ +USE [msdb] +GO + +-- ============================================= +-- Job: Backup DIFERENCIAL - a cada 6 horas +-- ============================================= +EXEC sp_add_job @job_name = N'Backup DIFERENCIAL - Levelcode-LevelOS'; + +EXEC sp_add_jobstep + @job_name = N'Backup DIFERENCIAL - Levelcode-LevelOS', + @step_name = N'Executar Backup DIFERENCIAL', + @command = N'EXEC [Levelcode-LevelOS].[dbo].[sp_BackupDiferencial]', + @database_name = N'Levelcode-LevelOS'; + +EXEC sp_add_schedule + @schedule_name = N'A cada 6 horas', + @freq_type = 4, -- diário + @freq_interval = 1, + @freq_subday_type = 8, -- a cada X horas + @freq_subday_interval = 6, -- 6 horas + @active_start_time = 080000; -- começa às 08:00 + +EXEC sp_attach_schedule + @job_name = N'Backup DIFERENCIAL - Levelcode-LevelOS', + @schedule_name = N'A cada 6 horas'; + +EXEC sp_add_jobserver + @job_name = N'Backup DIFERENCIAL - Levelcode-LevelOS'; +GO + +-- Confirma os jobs criados +SELECT + j.name AS Job, + s.name AS Schedule, + s.active_start_time, + CASE s.freq_subday_type + WHEN 8 THEN CAST(s.freq_subday_interval AS VARCHAR) + 'h em ' + CAST(s.freq_subday_interval AS VARCHAR) + 'h' + ELSE 'Diário fixo' + END AS Frequencia +FROM msdb.dbo.sysjobs j +JOIN msdb.dbo.sysjobschedules js ON j.job_id = js.job_id +JOIN msdb.dbo.sysschedules s ON js.schedule_id = s.schedule_id +WHERE j.name LIKE '%Levelcode%' +ORDER BY j.name; \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ProcedureBKP-FULL_AUTO.sql b/UI/ArquivosAuxiliares/ProcedureBKP-FULL_AUTO.sql new file mode 100644 index 0000000..01251e3 --- /dev/null +++ b/UI/ArquivosAuxiliares/ProcedureBKP-FULL_AUTO.sql @@ -0,0 +1,25 @@ +USE [msdb] +GO + +-- Job: Backup FULL - toda madrugada às 02:00 +EXEC sp_add_job @job_name = N'Backup FULL - Levelcode-LevelOS'; + +EXEC sp_add_jobstep + @job_name = N'Backup FULL - Levelcode-LevelOS', + @step_name = N'Executar Backup FULL', + @command = N'EXEC [Levelcode-LevelOS].[dbo].[sp_BackupFull]', + @database_name = N'Levelcode-LevelOS'; + +EXEC sp_add_schedule + @schedule_name = N'Diario 02:00', + @freq_type = 4, -- diário + @freq_interval = 1, + @active_start_time = 020000; -- 02:00:00 + +EXEC sp_attach_schedule + @job_name = N'Backup FULL - Levelcode-LevelOS', + @schedule_name = N'Diario 02:00'; + +EXEC sp_add_jobserver + @job_name = N'Backup FULL - Levelcode-LevelOS'; +GO \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ProcedureBackups.sql b/UI/ArquivosAuxiliares/ProcedureBackups.sql new file mode 100644 index 0000000..5214bd6 --- /dev/null +++ b/UI/ArquivosAuxiliares/ProcedureBackups.sql @@ -0,0 +1,61 @@ +USE [Levelcode-LevelOS] +GO + +DROP PROCEDURE IF EXISTS [dbo].[sp_BackupFull] +GO + +CREATE PROCEDURE [dbo].[sp_BackupFull] +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @Caminho NVARCHAR(500); + + SET @Caminho = '/var/opt/mssql/backups/Levelcode-LevelOS_FULL_' + + FORMAT(GETDATE(), 'yyyyMMdd_HHmmss') + '.bak'; + + BACKUP DATABASE [Levelcode-LevelOS] + TO DISK = @Caminho + WITH FORMAT, + INIT, + NAME = 'Backup FULL - Levelcode-LevelOS', + STATS = 10; +END +GO + +-- Confirma criação +SELECT name, create_date, modify_date +FROM sys.procedures +WHERE name = 'sp_BackupFull'; + + +USE [Levelcode-LevelOS] +GO + +DROP PROCEDURE IF EXISTS [dbo].[sp_BackupDiferencial] +GO + +CREATE PROCEDURE [dbo].[sp_BackupDiferencial] +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @Caminho NVARCHAR(500); + + SET @Caminho = '/var/opt/mssql/backups/Levelcode-LevelOS_DIFF_' + + FORMAT(GETDATE(), 'yyyyMMdd_HHmmss') + '.bak'; + + BACKUP DATABASE [Levelcode-LevelOS] + TO DISK = @Caminho + WITH DIFFERENTIAL, + INIT, + NAME = 'Backup DIFERENCIAL - Levelcode-LevelOS', + STATS = 10; +END +GO + +-- Confirma ambas criadas +SELECT name, create_date, modify_date +FROM sys.procedures +WHERE name IN ('sp_BackupFull', 'sp_BackupDiferencial') +ORDER BY name; \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ProcedureRestaurarBanco.sql b/UI/ArquivosAuxiliares/ProcedureRestaurarBanco.sql new file mode 100644 index 0000000..cbd51ec --- /dev/null +++ b/UI/ArquivosAuxiliares/ProcedureRestaurarBanco.sql @@ -0,0 +1,128 @@ +USE [master] +GO + +DROP PROCEDURE IF EXISTS [dbo].[sp_RestaurarBackup] +GO + +CREATE PROCEDURE [dbo].[sp_RestaurarBackup] + @Arquivo NVARCHAR(500) = NULL, + @Tipo CHAR(1) = 'F' -- 'F' = FULL | 'D' = DIFERENCIAL +AS +BEGIN + SET NOCOUNT ON; + + -- ============================================= + -- Se não informar arquivo, lista os disponíveis + -- ============================================= + IF @Arquivo IS NULL + BEGIN + PRINT '>>> Backups disponíveis no histórico:'; + + SELECT + ROW_NUMBER() OVER (ORDER BY bs.backup_finish_date DESC) AS N, + CASE bs.type + WHEN 'D' THEN 'FULL' + WHEN 'I' THEN 'DIFERENCIAL' + END AS Tipo, + bmf.physical_device_name AS Arquivo, + bs.backup_start_date AS Inicio, + bs.backup_finish_date AS Fim, + CAST(bs.backup_size / 1024.0 / 1024.0 AS DECIMAL(10,2)) AS TamanhoMB + FROM msdb.dbo.backupset bs + JOIN msdb.dbo.backupmediafamily bmf + ON bs.media_set_id = bmf.media_set_id + WHERE bs.database_name = 'Levelcode-LevelOS' + ORDER BY bs.backup_finish_date DESC; + + PRINT '>>> Copie o caminho do arquivo desejado e execute:'; + PRINT '>>> EXEC sp_RestaurarBackup @Arquivo = ''caminho_aqui'', @Tipo = ''F'''; + RETURN; + END + + -- ============================================= + -- Verifica o arquivo com RESTORE HEADERONLY + -- ============================================= + BEGIN TRY + RESTORE HEADERONLY FROM DISK = @Arquivo; + END TRY + BEGIN CATCH + RAISERROR('Arquivo não encontrado ou inválido: %s', 16, 1, @Arquivo); + RETURN; + END CATCH + + -- ============================================= + -- Coloca o banco em SINGLE_USER + -- ============================================= + PRINT '>>> Preparando banco para restauração...'; + + BEGIN TRY + ALTER DATABASE [Levelcode-LevelOS] + SET SINGLE_USER WITH ROLLBACK IMMEDIATE; + END TRY + BEGIN CATCH + PRINT '>>> Aviso: ' + ERROR_MESSAGE(); + END CATCH + + -- ============================================= + -- Restauração FULL + -- ============================================= + IF @Tipo = 'F' + BEGIN + PRINT '>>> Restaurando FULL: ' + @Arquivo; + + RESTORE DATABASE [Levelcode-LevelOS] + FROM DISK = @Arquivo + WITH REPLACE, + NORECOVERY, + STATS = 10; + + ALTER DATABASE [Levelcode-LevelOS] SET MULTI_USER; + + PRINT '>>> FULL restaurado com sucesso!'; + PRINT '>>> Se tiver diferencial execute: EXEC sp_RestaurarBackup @Arquivo = ''caminho_diff'', @Tipo = ''D'''; + PRINT '>>> Se não tiver diferencial execute: RESTORE DATABASE [Levelcode-LevelOS] WITH RECOVERY;'; + END + + -- ============================================= + -- Restauração DIFERENCIAL + -- ============================================= + IF @Tipo = 'D' + BEGIN + PRINT '>>> Aplicando DIFERENCIAL: ' + @Arquivo; + + RESTORE DATABASE [Levelcode-LevelOS] + FROM DISK = @Arquivo + WITH RECOVERY, + STATS = 10; + + ALTER DATABASE [Levelcode-LevelOS] SET MULTI_USER; + + PRINT '>>> Banco restaurado e online!'; + END +END +GO + +--Como usar -- +-- 1. Lista os backups disponíveis +EXEC [master].[dbo].[sp_RestaurarBackup]; + +-- 2. Restaura apenas o FULL (sem diferencial) +EXEC [master].[dbo].[sp_RestaurarBackup] + @Arquivo = '/var/opt/mssql/backups/Levelcode-LevelOS_FULL_20260413_020000.bak', + @Tipo = 'F'; + +-- Finaliza o banco após o FULL sem diferencial +RESTORE DATABASE [Levelcode-LevelOS] WITH RECOVERY; + +-- 3. Restaura FULL + DIFERENCIAL (sequência completa) +EXEC [master].[dbo].[sp_RestaurarBackup] + @Arquivo = '/var/opt/mssql/backups/Levelcode-LevelOS_FULL_20260413_020000.bak', + @Tipo = 'F'; + +EXEC [master].[dbo].[sp_RestaurarBackup] + @Arquivo = '/var/opt/mssql/backups/Levelcode-LevelOS_DIFF_20260413_080000.bak', + @Tipo = 'D'; + +EXEC [master].[dbo].[sp_RestaurarBackup] + @Arquivo = '/var/opt/mssql/backups/Levelcode-LevelOS_FULL_20260413_072013.bak', + @Tipo = 'F'; \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/Procedure_LIMPEZA15DIAS.sql b/UI/ArquivosAuxiliares/Procedure_LIMPEZA15DIAS.sql new file mode 100644 index 0000000..437ff4d --- /dev/null +++ b/UI/ArquivosAuxiliares/Procedure_LIMPEZA15DIAS.sql @@ -0,0 +1,77 @@ +USE [Levelcode-LevelOS] +GO + +-- ============================================= +-- Procedure: Limpeza de backups antigos (+15 dias) +-- ============================================= +DROP PROCEDURE IF EXISTS [dbo].[sp_LimpezaBackups] +GO + +CREATE PROCEDURE [dbo].[sp_LimpezaBackups] +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @DataCorte DATETIME = DATEADD(DAY, -15, GETDATE()); + DECLARE @Comando NVARCHAR(500); + DECLARE @Arquivo NVARCHAR(500); + + -- Cursor nos backups com mais de 15 dias + DECLARE cur CURSOR FOR + SELECT DISTINCT bmf.physical_device_name + FROM msdb.dbo.backupset bs + JOIN msdb.dbo.backupmediafamily bmf + ON bs.media_set_id = bmf.media_set_id + WHERE bs.database_name = 'Levelcode-LevelOS' + AND bs.backup_finish_date < @DataCorte + AND bmf.physical_device_name LIKE '/var/opt/mssql/backups/%'; + + OPEN cur; + FETCH NEXT FROM cur INTO @Arquivo; + + WHILE @@FETCH_STATUS = 0 + BEGIN + -- Deleta o arquivo físico no Linux + SET @Comando = 'rm -f ' + @Arquivo; + EXEC xp_cmdshell @Comando; + + -- Remove o histórico do msdb + PRINT 'Removido: ' + @Arquivo; + + FETCH NEXT FROM cur INTO @Arquivo; + END + + CLOSE cur; + DEALLOCATE cur; + + -- Limpa o histórico do msdb também + EXEC msdb.dbo.sp_delete_backuphistory @oldest_date = @DataCorte; + + PRINT 'Limpeza concluída. Backups anteriores a ' + + CONVERT(NVARCHAR(20), @DataCorte, 120) + ' removidos.'; +END +GO +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +USE [Levelcode-LevelOS] +GO + +-- ============================================= +-- Procedure: Limpeza do HISTÓRICO (msdb) +15 dias +-- ============================================= +DROP PROCEDURE IF EXISTS [dbo].[sp_LimpezaBackups] +GO + +CREATE PROCEDURE [dbo].[sp_LimpezaBackups] +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @DataCorte DATETIME = DATEADD(DAY, -15, GETDATE()); + + -- Limpa apenas o histórico do msdb (não precisa de xp_cmdshell) + EXEC msdb.dbo.sp_delete_backuphistory @oldest_date = @DataCorte; + + PRINT 'Histórico de backups anteriores a ' + + CONVERT(NVARCHAR(20), @DataCorte, 120) + ' removido do msdb.'; +END +GO \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/ScriptLimpezaServidor.sh b/UI/ArquivosAuxiliares/ScriptLimpezaServidor.sh new file mode 100644 index 0000000..1af4c44 --- /dev/null +++ b/UI/ArquivosAuxiliares/ScriptLimpezaServidor.sh @@ -0,0 +1,32 @@ +# Cria o script de limpeza +cat > /var/opt/mssql/backups/limpar_backups.sh << 'EOF' +#!/bin/bash +# Deleta arquivos .bak com mais de 15 dias +find /var/opt/mssql/backups/ -name "*.bak" -mtime +15 -delete +echo "[$(date)] Limpeza concluída." >> /var/opt/mssql/backups/limpeza.log +EOF + +# Dá permissão de execução +chmod +x /var/opt/mssql/backups/limpar_backups.sh + +# Agenda no cron todo domingo às 03:00 +(crontab -l 2>/dev/null; echo "0 3 * * 0 /var/opt/mssql/backups/limpar_backups.sh") | crontab - + +# Confirma o cron +crontab -l + +#------------------------------------------------------------------------------------------------- +cat > /var/opt/mssql/backups/limpar_backups.sh << 'EOF' +#!/bin/bash +find /var/opt/mssql/backups/ -name "*.bak" -mtime +15 -delete +echo "[$(date)] Limpeza concluída." >> /var/opt/mssql/backups/limpeza.log +EOF + +#Dar permissão +chmod +x /var/opt/mssql/backups/limpar_backups.sh +# Executar script +/var/opt/mssql/backups/limpar_backups.sh && cat /var/opt/mssql/backups/limpeza.log +# Agendar JOB +(crontab -l 2>/dev/null; echo "0 3 * * 0 /var/opt/mssql/backups/limpar_backups.sh") | crontab - +# confirmar agendamento +crontab -l \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/TriggerFuncionarios.sql b/UI/ArquivosAuxiliares/TriggerFuncionarios.sql new file mode 100644 index 0000000..bb68135 --- /dev/null +++ b/UI/ArquivosAuxiliares/TriggerFuncionarios.sql @@ -0,0 +1,14 @@ +--Gatilhos para a tabela funcionarios-- +CREATE OR ALTER TRIGGER TR_Funcionarios_GerarCodigo +ON Funcionarios +AFTER INSERT +AS +BEGIN + SET NOCOUNT ON; + + UPDATE F + SET CODIGO = CAST(100 + ((F.ID_FUNCIONARIO - 1) * 100) AS VARCHAR) + FROM Funcionarios F + INNER JOIN inserted I ON F.ID_FUNCIONARIO = I.ID_FUNCIONARIO; +END +GO \ No newline at end of file diff --git a/UI/ArquivosAuxiliares/Trigger_AgendaCodigoAuto.sql b/UI/ArquivosAuxiliares/Trigger_AgendaCodigoAuto.sql new file mode 100644 index 0000000..1778b25 --- /dev/null +++ b/UI/ArquivosAuxiliares/Trigger_AgendaCodigoAuto.sql @@ -0,0 +1,13 @@ +CREATE OR ALTER TRIGGER TR_Agenda_GerarCodigo +ON Agenda +AFTER INSERT +AS +BEGIN + SET NOCOUNT ON; + + UPDATE A + SET CODIGO = 'AG' + RIGHT('0000' + CAST(A.ID_AGENDA AS VARCHAR), 4) + FROM Agenda A + INNER JOIN inserted I ON A.ID_AGENDA = I.ID_AGENDA; +END +GO \ No newline at end of file diff --git a/UI/ControlesCustom.cs b/UI/ControlesCustom.cs new file mode 100644 index 0000000..de894d4 --- /dev/null +++ b/UI/ControlesCustom.cs @@ -0,0 +1,151 @@ +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace UI +{ + public class RoundTextBox : UserControl + { + private TextBox _textBox = null!; + public int Radius { get; set; } = 4; + public Color BorderColor { get; set; } = Color.LightGray; + public Color FocusColor { get; set; } = Color.Blue; + private bool _focused; + + public bool ReadOnly + { + get => _textBox.ReadOnly; + set => _textBox.ReadOnly = value; + } + public char PasswordChar + { + get => _textBox.PasswordChar; + set => _textBox.PasswordChar = value; + } + + // ── Adiciona isso aqui ── + public int SelectionStart + { + get => _textBox.SelectionStart; + set => _textBox.SelectionStart = value; + } + public new event KeyEventHandler? KeyDown + { + add => _textBox.KeyDown += value; + remove => _textBox.KeyDown -= value; + } + + public bool Multiline + { + get => _textBox.Multiline; + set + { + _textBox.Multiline = value; + _textBox.ScrollBars = value ? ScrollBars.Vertical : ScrollBars.None; + AjustarTextBox(); + } + } + + public override string Text + { + get => _textBox.Text; + set => _textBox.Text = value; + } + + public new Color BackColor + { + get => base.BackColor; + set { base.BackColor = value; if (_textBox != null) _textBox.BackColor = value; } + } + + //public RoundTextBox() + //{ + // DoubleBuffered = true; + // base.BackColor = Color.White; + // _textBox = new TextBox + // { + // BorderStyle = BorderStyle.None, + // Font = new Font("Segoe UI", 9f), + // Location = new Point(6, 6), + // Width = Width - 12, + // Height = Height - 12, + // BackColor = Color.White + // }; + // _textBox.GotFocus += (s, e) => { _focused = true; Invalidate(); }; + // _textBox.LostFocus += (s, e) => { _focused = false; Invalidate(); }; + // Controls.Add(_textBox); + // SizeChanged += (s, e) => AjustarTextBox(); + //} + public RoundTextBox() + { + DoubleBuffered = true; + base.BackColor = Color.White; + _textBox = new TextBox + { + BorderStyle = BorderStyle.None, + Font = new Font("Segoe UI", 9f), + Location = new Point(6, 6), + Width = Width - 12, + Height = Height - 12, + BackColor = Color.White + }; + + _textBox.GotFocus += (s, e) => { _focused = true; Invalidate(); }; + _textBox.LostFocus += (s, e) => { _focused = false; Invalidate(); }; + _textBox.TextChanged += (s, e) => OnTextChanged(e); // ← adiciona essa + _textBox.Leave += (s, e) => OnLeave(e); // ← e essa + + Controls.Add(_textBox); + SizeChanged += (s, e) => AjustarTextBox(); + } + + // Ajusta largura e altura do TextBox interno conforme Multiline + private void AjustarTextBox() + { + _textBox.Width = Width - 12; + _textBox.Height = _textBox.Multiline ? Height - 12 : _textBox.PreferredHeight; + // Recentraliza verticalmente quando não é multiline + if (!_textBox.Multiline) + _textBox.Location = new Point(6, (Height - _textBox.PreferredHeight) / 2); + else + _textBox.Location = new Point(6, 6); + } + + protected override void OnPaint(PaintEventArgs e) + { + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + using var path = GetPath(new Rectangle(0, 0, Width - 1, Height - 1), Radius); + using var brush = new SolidBrush(BackColor); + e.Graphics.FillPath(brush, path); + using var pen = new Pen(_focused ? FocusColor : BorderColor, _focused ? 1.5f : 1f); + e.Graphics.DrawPath(pen, path); + } + + private static GraphicsPath GetPath(Rectangle r, int rad) + { + var path = new GraphicsPath(); + int d = rad * 2; + path.AddArc(r.X, r.Y, d, d, 180, 90); + path.AddArc(r.Right - d, r.Y, d, d, 270, 90); + path.AddArc(r.Right - d, r.Bottom - d, d, d, 0, 90); + path.AddArc(r.X, r.Bottom - d, d, d, 90, 90); + path.CloseFigure(); + return path; + } + } + + public class RoundButton : Button + { + [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] + private static extern IntPtr CreateRoundRectRgn(int nL, int nT, int nR, int nB, int nW, int nH); + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 8, 8)); + FlatStyle = FlatStyle.Flat; + FlatAppearance.BorderSize = 0; + } + } +} \ No newline at end of file diff --git a/UI/ControlesCustom.resx b/UI/ControlesCustom.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/ControlesCustom.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/AgendaCadastroPanel.cs b/UI/Dashboards/Cadastros/AgendaCadastroPanel.cs new file mode 100644 index 0000000..d884975 --- /dev/null +++ b/UI/Dashboards/Cadastros/AgendaCadastroPanel.cs @@ -0,0 +1,887 @@ +using BLL; +using CustomMessageBox; +using DAL; +using MLL; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace UI +{ + public class AgendaCadastroPanel : UserControl + { + string _cx = DadosDaConexao.ObterConexao(); + // ── CORES ───────────────────────────────────────────────────────────── + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + private readonly Color GreenColor = Color.FromArgb(34, 197, 94); + private readonly Color AmberColor = Color.FromArgb(245, 158, 11); + private readonly Color RedColor = Color.FromArgb(239, 68, 68); + private readonly Color MutedGray = Color.FromArgb(148, 163, 184); + private readonly Color SurfaceColor = Color.FromArgb(248, 250, 252); + private readonly Color DisabledBack = Color.FromArgb(241, 245, 249); + + // ── LAYOUT ──────────────────────────────────────────────────────────── + private Panel pnlToolbar = null!; + private Panel pnlLeft = null!; + private Panel pnlRight = null!; + private Panel pnlEventList = null!; + private Panel pnlSplit = null!; + private Panel pnlDias = null!; + + // ── TOOLBAR ─────────────────────────────────────────────────────────── + private RoundButton btnNovo = null!; + private RoundButton btnAlterar = null!; + private RoundButton btnExcluir = null!; + private RoundButton btnLocalizar = null!; + private RoundButton btnSalvar = null!; + private RoundButton btnCancelar = null!; + + // ── CAMPOS DO FORMULÁRIO ────────────────────────────────────────────── + private RoundTextBox txtId = null!; + private RoundTextBox txtCodigo = null!; + private RoundTextBox txtCompromisso = null!; + private RoundTextBox txtData = null!; + private RoundTextBox txtDia = null!; + private RoundTextBox txtHora = null!; + private RoundTextBox txtFunc = null!; + private RoundTextBox txtAvisar = null!; + private RoundTextBox txtOsVinc = null!; + private CheckBox chkRealizado = null!; + + // ── INFO (readonly) ─────────────────────────────────────────────────── + private RoundTextBox txtCriadoEm = null!; + private RoundTextBox txtAtualizadoEm = null!; + + // ── CALENDÁRIO ──────────────────────────────────────────────────────── + private Label lblMesAno = null!; + private Button btnPrev = null!; + private Button btnNext = null!; + + // ── ESTADO ──────────────────────────────────────────────────────────── + private DateTime _currentMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); + private DateTime? _selectedDate = null; + private List _eventos = new(); + private int _nextId = 1; + + // ── CONSTRUTOR ──────────────────────────────────────────────────────── + public AgendaCadastroPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + + InitializeLayout(); + SetCampos(false); + //CarregarDadosFake(); + CarregarDadosDoBanco(); + RenderCalendario(); + RenderListaEventos(); + } + + // ══════════════════════════════════════════════════════════════════════ + // LAYOUT + // ══════════════════════════════════════════════════════════════════════ + private void InitializeLayout() + { + Controls.Clear(); + + // ── TOOLBAR ─────────────────────────────────────────────────────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = SurfaceColor + }; + + var flow = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + btnNovo = CreateToolbarButton("Novo", GreenColor); + btnAlterar = CreateToolbarButton("Alterar", AmberColor); + btnExcluir = CreateToolbarButton("Excluir", RedColor); + btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + btnCancelar = CreateToolbarButton("Cancelar", MutedGray); + + btnNovo.Click += (_, _) => BtnNovo_Click(); + btnAlterar.Click += (_, _) => BtnAlterar_Click(); + btnExcluir.Click += (_, _) => BtnExcluir_Click(); + btnLocalizar.Click += (_, _) => BtnLocalizar_Click(); + btnSalvar.Click += (_, _) => BtnSalvar_Click(); + btnCancelar.Click += (_, _) => BtnCancelar_Click(); + + flow.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar, btnCancelar }); + + pnlToolbar.Controls.Add(flow); + Controls.Add(pnlToolbar); + + // ── SPLIT ───────────────────────────────────────────────────────── + pnlSplit = new Panel { Dock = DockStyle.Fill, BackColor = Color.White }; + Controls.Add(pnlSplit); + pnlSplit.BringToFront(); + + // RIGHT ─ calendário + lista + pnlRight = new Panel + { + Dock = DockStyle.Right, + Width = 340, + BackColor = Color.White, + Padding = new Padding(10, 10, 10, 10) + }; + pnlSplit.Controls.Add(pnlRight); + BuildCalendario(); // preenche pnlRight + + // Divider + var divider = new Panel + { + Dock = DockStyle.Right, + Width = 1, + BackColor = BorderColor + }; + pnlSplit.Controls.Add(divider); + + // LEFT ─ formulário + pnlLeft = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White + }; + pnlSplit.Controls.Add(pnlLeft); + BuildFormulario(); + } + + // ── FORMULÁRIO ──────────────────────────────────────────────────────── + private void BuildFormulario() + { + var content = new Panel { Width = 800, BackColor = Color.White }; + pnlLeft.Controls.Add(content); + + const int rowH = 52; + const int secH = 28; + const int secGap = 10; + const int inputH = 28; + int y = 10; + + // IDENTIFICAÇÃO + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO", y)); + y += secH + 4; + + txtId = AddInput(content, "ID", 20, y, 60, inputH, readOnly: true); + txtCodigo = AddInput(content, "Código", 90, y, 120, inputH); + txtCompromisso = AddInput(content, "Compromisso", 220, y, 520, inputH); + y += rowH; + + // DATA E HORA + y += secGap; + content.Controls.Add(CreateSectionHeader("DATA E HORA", y)); + y += secH + 4; + + txtData = AddInput(content, "Data", 20, y, 130, inputH, readOnly: true); + txtDia = AddInput(content, "Dia", 160, y, 150, inputH, readOnly: true); + txtHora = AddInput(content, "Hora", 320, y, 100, inputH); + y += rowH; + + // RESPONSÁVEL E AVISO + y += secGap; + content.Controls.Add(CreateSectionHeader("RESPONSÁVEL E AVISO", y)); + y += secH + 4; + + txtFunc = AddInput(content, "Funcionário", 20, y, 280, inputH); + txtAvisar = AddInput(content, "Avisar", 310, y, 180, inputH); + txtOsVinc = AddInput(content, "OS Vinculada", 500, y, 140, inputH); + y += rowH; + + // SITUAÇÃO + y += secGap; + content.Controls.Add(CreateSectionHeader("SITUAÇÃO", y)); + y += secH + 4; + + chkRealizado = new CheckBox + { + Text = "Realizado", + Location = new Point(20, y + 4), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + content.Controls.Add(chkRealizado); + y += rowH; + + // INFORMAÇÕES DO REGISTRO + y += secGap; + content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO REGISTRO", y)); + y += secH + 4; + + txtCriadoEm = AddInput(content, "Criado Em", 20, y, 175, inputH, readOnly: true); + txtAtualizadoEm = AddInput(content, "Atualizado Em", 205, y, 175, inputH, readOnly: true); + y += rowH; + + content.Height = y + 10; + } + + // ── CALENDÁRIO ──────────────────────────────────────────────────────── + // ATENÇÃO: No WinForms, DockStyle.Fill deve ser adicionado ANTES dos + // DockStyle.Top — a ordem de inserção em Controls é invertida visualmente. + private void BuildCalendario() + { + // 1º — Lista de eventos (Fill) → adicionada PRIMEIRO + pnlEventList = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White, + Padding = new Padding(0, 4, 0, 0) + }; + pnlRight.Controls.Add(pnlEventList); // ← PRIMEIRO + + // 2º — Grid dos dias (Top) → adicionado DEPOIS do Fill + pnlDias = new Panel + { + Dock = DockStyle.Top, + Height = 215, + BackColor = Color.White + }; + pnlRight.Controls.Add(pnlDias); // ← SEGUNDO + + // 3º — Cabeçalho mês/ano (Top) → adicionado POR ÚLTIMO (aparece no topo) + var pnlCalHeader = new Panel + { + Dock = DockStyle.Top, + Height = 38, + BackColor = Color.White + }; + + btnPrev = new Button + { + Text = "‹", + Size = new Size(28, 26), + Location = new Point(0, 6), + FlatStyle = FlatStyle.Flat, + Font = new Font("Segoe UI", 13f), + ForeColor = AccentBlue, + BackColor = Color.White, + Cursor = Cursors.Hand + }; + btnPrev.FlatAppearance.BorderColor = BorderColor; + btnPrev.Click += (_, _) => + { + _currentMonth = _currentMonth.AddMonths(-1); + RenderCalendario(); + RenderListaEventos(); + }; + + btnNext = new Button + { + Text = "›", + Size = new Size(28, 26), + Location = new Point(290, 6), + FlatStyle = FlatStyle.Flat, + Font = new Font("Segoe UI", 13f), + ForeColor = AccentBlue, + BackColor = Color.White, + Cursor = Cursors.Hand + }; + btnNext.FlatAppearance.BorderColor = BorderColor; + btnNext.Click += (_, _) => + { + _currentMonth = _currentMonth.AddMonths(1); + RenderCalendario(); + RenderListaEventos(); + }; + + lblMesAno = new Label + { + AutoSize = false, + TextAlign = ContentAlignment.MiddleCenter, + Font = new Font("Segoe UI", 10f, FontStyle.Bold), + ForeColor = TextDark, + Size = new Size(256, 26), + Location = new Point(32, 6) + }; + + pnlCalHeader.Controls.AddRange(new Control[] { btnPrev, lblMesAno, btnNext }); + pnlRight.Controls.Add(pnlCalHeader); // ← ÚLTIMO (fica no topo visualmente) + } + + // ══════════════════════════════════════════════════════════════════════ + // RENDER CALENDÁRIO + // ══════════════════════════════════════════════════════════════════════ + private void RenderCalendario() + { + pnlDias.Controls.Clear(); + + lblMesAno.Text = _currentMonth.ToString("MMMM yyyy", + new System.Globalization.CultureInfo("pt-BR")).ToUpper(); + + string[] dowLabels = { "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" }; + int cellW = 44; + int cellH = 26; + int startX = 2; + + // Cabeçalho dias da semana + for (int i = 0; i < 7; i++) + { + pnlDias.Controls.Add(new Label + { + Text = dowLabels[i], + Size = new Size(cellW, 18), + Location = new Point(startX + i * cellW, 0), + TextAlign = ContentAlignment.MiddleCenter, + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = MutedGray + }); + } + + int firstDow = (int)new DateTime(_currentMonth.Year, _currentMonth.Month, 1).DayOfWeek; + int daysInMonth = DateTime.DaysInMonth(_currentMonth.Year, _currentMonth.Month); + var datesWithEvts = GetDatesWithEvents(); + DateTime today = DateTime.Today; + int col = firstDow, row = 0; + + for (int d = 1; d <= daysInMonth; d++) + { + var date = new DateTime(_currentMonth.Year, _currentMonth.Month, d); + bool isToday = date == today; + bool isSelected = _selectedDate.HasValue && date == _selectedDate.Value; + bool hasEvent = datesWithEvts.Contains(date.Date); + + var btn = new Button + { + Text = hasEvent ? $"{d} •" : d.ToString(), + Size = new Size(cellW - 2, cellH), + Location = new Point(startX + col * cellW, 22 + row * (cellH + 2)), + FlatStyle = FlatStyle.Flat, + Font = new Font("Segoe UI", 8f, + isToday || isSelected ? FontStyle.Bold : FontStyle.Regular), + Cursor = Cursors.Hand, + Tag = date + }; + + if (isSelected) + { + btn.BackColor = AccentBlue; + btn.ForeColor = Color.White; + btn.FlatAppearance.BorderColor = AccentBlue; + } + else if (isToday) + { + btn.BackColor = Color.White; + btn.ForeColor = AccentBlue; + btn.FlatAppearance.BorderColor = AccentBlue; + } + else + { + btn.BackColor = Color.White; + btn.ForeColor = TextDark; + btn.FlatAppearance.BorderColor = BorderColor; + } + + btn.Click += (s, _) => + { + if (s is Button b && b.Tag is DateTime dt) + { + _selectedDate = dt; + if (txtData.Enabled) + { + txtData.Text = dt.ToString("dd/MM/yyyy"); + txtDia.Text = new System.Globalization.CultureInfo("pt-BR") + .DateTimeFormat.GetDayName(dt.DayOfWeek); + } + RenderCalendario(); + RenderListaEventos(); + } + }; + + pnlDias.Controls.Add(btn); + + col++; + if (col == 7) { col = 0; row++; } + } + } + + // ══════════════════════════════════════════════════════════════════════ + // RENDER LISTA DE EVENTOS + // ══════════════════════════════════════════════════════════════════════ + private void RenderListaEventos() + { + pnlEventList.Controls.Clear(); + + var filtrados = _selectedDate.HasValue + ? _eventos.Where(e => ParseData(e.dDATA).Date == _selectedDate.Value.Date).ToList() + : _eventos.Where(e => ParseData(e.dDATA).Month == _currentMonth.Month + && ParseData(e.dDATA).Year == _currentMonth.Year).ToList(); + + filtrados = filtrados.OrderBy(e => e.HORA).ToList(); + + // Largura real do painel (com fallback para evitar 0) + int listW = pnlEventList.ClientSize.Width > 0 + ? pnlEventList.ClientSize.Width + : pnlRight.Width - pnlRight.Padding.Horizontal - 20; + + int y = 0; + + // ── Título ──────────────────────────────────────────────────────── + string titulo = _selectedDate.HasValue + ? $"COMPROMISSOS — {_selectedDate.Value:dd/MM/yyyy}" + : $"COMPROMISSOS — {_currentMonth.ToString("MMMM/yyyy", new System.Globalization.CultureInfo("pt-BR")).ToUpper()}"; + + pnlEventList.Controls.Add(new Label + { + Text = titulo, + AutoSize = false, + Width = listW, + Height = 18, + Location = new Point(0, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = MutedGray + }); + y += 6; + + // Linha separadora + pnlEventList.Controls.Add(new Panel + { + Location = new Point(0, y + 14), + Size = new Size(listW, 1), + BackColor = BorderColor + }); + y += 22; + + // ── Vazio ───────────────────────────────────────────────────────── + if (!filtrados.Any()) + { + pnlEventList.Controls.Add(new Label + { + Text = "Nenhum compromisso encontrado.", + Location = new Point(0, y + 8), + AutoSize = true, + Font = new Font("Segoe UI", 8.5f), + ForeColor = MutedGray + }); + return; + } + + // ── Cards ───────────────────────────────────────────────────────── + foreach (var ev in filtrados) + { + bool realizado = ev.REALIZADO?.ToUpper() == "S"; + + var card = new Panel + { + Location = new Point(0, y), + Width = listW, + Height = 72, + BackColor = Color.White, + BorderStyle = BorderStyle.None, + Cursor = Cursors.Hand, + Tag = ev + }; + + // Borda esquerda colorida + card.Controls.Add(new Panel + { + Location = new Point(0, 0), + Size = new Size(3, 72), + BackColor = realizado ? GreenColor : AmberColor + }); + + card.Controls.Add(new Label + { + Text = $"{ev.HORA} — {ev.dDATA}", + Location = new Point(10, 5), + AutoSize = true, + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = AccentBlue + }); + card.Controls.Add(new Label + { + Text = ev.COMPROMISSO, + Location = new Point(10, 21), + AutoSize = true, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark + }); + card.Controls.Add(new Label + { + Text = string.IsNullOrWhiteSpace(ev.FUNC) ? "—" : ev.FUNC, + Location = new Point(10, 39), + AutoSize = true, + Font = new Font("Segoe UI", 8f), + ForeColor = MutedGray + }); + card.Controls.Add(new Label + { + Text = realizado ? "✔ Realizado" : "⏳ Pendente", + Location = new Point(10, 55), + AutoSize = true, + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = realizado + ? Color.FromArgb(22, 101, 52) + : Color.FromArgb(146, 64, 14) + }); + + // Borda do card via Paint + card.Paint += (_, pe) => + { + using var pen = new Pen(BorderColor); + pe.Graphics.DrawRectangle(pen, 0, 0, card.Width - 1, card.Height - 1); + }; + + // Clique em qualquer parte do card (inclusive labels filhos) + var evLocal = ev; + EventHandler clickHandler = (_, _) => CarregarEvento(evLocal); + card.Click += clickHandler; + foreach (Control child in card.Controls) + child.Click += clickHandler; + + pnlEventList.Controls.Add(card); + y += 78; + } + } + + // ══════════════════════════════════════════════════════════════════════ + // EVENTOS DOS BOTÕES + // ══════════════════════════════════════════════════════════════════════ + private void BtnNovo_Click() + { + + LimparCampos(); + SetCampos(true); + txtCriadoEm.Text = DateTime.Now.ToString("dd/MM/yyyy"); + + + } + + private void BtnAlterar_Click() + { + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + MessageBox.Show("Nenhum registro selecionado para alterar.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + SetCampos(true); + } + + private void BtnExcluir_Click() + { + BLLAgenda _agendaBLL = new BLLAgenda(this._cx); + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + NT_MessageBox.Show("Nenhum registro selecionado para excluir.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + var confirm = NT_MessageBox.Show("Confirma a exclusão deste registro?", + "Confirmar Exclusão", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + + if (confirm == DialogResult.Yes) + { + int id = int.Parse(txtId.Text); + + bool sucesso = _agendaBLL.Excluir(id); + + if (!sucesso) + { + NT_MessageBox.Show("Erro ao excluir o registro.", + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // 🔹 Atualiza lista do banco + _eventos.Clear(); + _eventos.AddRange(_agendaBLL.Listar()); + + LimparCampos(); + SetCampos(false); + RenderCalendario(); + RenderListaEventos(); + + NT_MessageBox.Show("Registro excluído com sucesso!", + "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + }//Excluir registro selecionado + + private void BtnLocalizar_Click() + { + FormHelper.Show("Agenda de Compromissos"); + } + + private void BtnSalvar_Click() + { + //if (string.IsNullOrWhiteSpace(txtData.Text) || + // string.IsNullOrWhiteSpace(txtCompromisso.Text)) + //{ + // MessageBox.Show("Preencha ao menos Data e Compromisso.", + // "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + // return; + //} + + //bool isNew = string.IsNullOrWhiteSpace(txtId.Text); + //int id = isNew ? _nextId++ : int.Parse(txtId.Text); + + //var agenda = new MLL.ModeloAgenda( + // iD_AGENDA: id, + // cODIGO: txtCodigo.Text, + // cOMPROMISSO: txtCompromisso.Text, + // dDATA: txtData.Text, + // aVISAR: txtAvisar.Text, + // fUNC: txtFunc.Text, + // dIA: txtDia.Text, + // hORA: txtHora.Text, + // rEALIZADO: chkRealizado.Checked ? "S" : "N", + // oS_VINC: txtOsVinc.Text + //); + + //if (isNew) + //{ + // _eventos.Add(agenda); + // txtId.Text = id.ToString(); + //} + //else + //{ + // int idx = _eventos.FindIndex(e => e.ID_AGENDA == id); + // if (idx >= 0) _eventos[idx] = agenda; + //} + + //txtAtualizadoEm.Text = DateTime.Now.ToString("dd/MM/yyyy"); + //SetCampos(false); + //RenderCalendario(); + //RenderListaEventos(); + + //MessageBox.Show("Registro salvo com sucesso!", "Sucesso", + // MessageBoxButtons.OK, MessageBoxIcon.Information); + BLLAgenda _agendaBLL = new BLLAgenda(_cx); + if (string.IsNullOrWhiteSpace(txtData.Text) || + string.IsNullOrWhiteSpace(txtCompromisso.Text)) + { + MessageBox.Show("Preencha ao menos Data e Compromisso.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + bool isNew = string.IsNullOrWhiteSpace(txtId.Text); + + var agenda = new MLL.ModeloAgenda( + iD_AGENDA: isNew ? 0 : int.Parse(txtId.Text), + cODIGO: txtCodigo.Text, + cOMPROMISSO: txtCompromisso.Text, + dDATA: txtData.Text, + aVISAR: txtAvisar.Text, + fUNC: txtFunc.Text, + dIA: txtDia.Text, + hORA: txtHora.Text, + rEALIZADO: chkRealizado.Checked ? "S" : "N", + oS_VINC: txtOsVinc.Text + ); + + bool sucesso; + + if (isNew) + { + sucesso = _agendaBLL.Inserir(agenda); + } + else + { + sucesso = _agendaBLL.Alterar(agenda); + } + + if (!sucesso) + { + MessageBox.Show("Erro ao salvar no banco de dados.", + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // 🔹 Recarrega dados do banco + _eventos = _agendaBLL.Listar(); + + // 🔹 Atualiza UI + txtAtualizadoEm.Text = DateTime.Now.ToString("dd/MM/yyyy"); + SetCampos(false); + RenderCalendario(); + RenderListaEventos(); + + MessageBox.Show("Registro salvo com sucesso!", "Sucesso", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void BtnCancelar_Click() + { + LimparCampos(); + SetCampos(false); + } + + // ══════════════════════════════════════════════════════════════════════ + // HELPERS + // ══════════════════════════════════════════════════════════════════════ + private void SetCampos(bool enabled) + { + var campos = new[] { txtCodigo, txtCompromisso, txtHora, txtFunc, txtAvisar, txtOsVinc }; + foreach (var c in campos) + { + c.Enabled = enabled; + c.BackColor = enabled ? Color.White : DisabledBack; + } + chkRealizado.Enabled = enabled; + txtData.BackColor = enabled ? Color.FromArgb(239, 246, 255) : DisabledBack; + } + + private void LimparCampos() + { + txtId.Text = txtCodigo.Text = txtCompromisso.Text = string.Empty; + txtData.Text = txtDia.Text = txtHora.Text = string.Empty; + txtFunc.Text = txtAvisar.Text = txtOsVinc.Text = string.Empty; + txtCriadoEm.Text = txtAtualizadoEm.Text = string.Empty; + chkRealizado.Checked = false; + _selectedDate = null; + } + + private void CarregarEvento(MLL.ModeloAgenda ev) + { + txtId.Text = ev.ID_AGENDA.ToString(); + txtCodigo.Text = ev.CODIGO; + txtCompromisso.Text = ev.COMPROMISSO; + txtData.Text = ev.dDATA; + txtDia.Text = ev.DIA; + txtHora.Text = ev.HORA; + txtFunc.Text = ev.FUNC; + txtAvisar.Text = ev.AVISAR; + txtOsVinc.Text = ev.OS_VINC; + txtCriadoEm.Text = ev.dDATA; + txtAtualizadoEm.Text = DateTime.Now.ToString("dd/MM/yyyy"); + chkRealizado.Checked = ev.REALIZADO?.ToUpper() == "S"; + + var dt = ParseData(ev.dDATA); + if (dt != DateTime.MinValue) + { + _selectedDate = dt; + _currentMonth = new DateTime(dt.Year, dt.Month, 1); + } + + SetCampos(false); + RenderCalendario(); + RenderListaEventos(); + } + + private HashSet GetDatesWithEvents() + { + var set = new HashSet(); + foreach (var ev in _eventos) + { + var dt = ParseData(ev.dDATA); + if (dt != DateTime.MinValue) set.Add(dt.Date); + } + return set; + } + + private static DateTime ParseData(string? value) + { + if (string.IsNullOrWhiteSpace(value)) return DateTime.MinValue; + if (DateTime.TryParseExact(value, "dd/MM/yyyy", + System.Globalization.CultureInfo.InvariantCulture, + System.Globalization.DateTimeStyles.None, out var dt)) + return dt; + if (DateTime.TryParse(value, out dt)) return dt; + return DateTime.MinValue; + } + + private void CarregarDadosFake() + { + var hoje = DateTime.Today; + _eventos.AddRange(new[] + { + new MLL.ModeloAgenda(1, "AG001", "Reunião com cliente", + hoje.ToString("dd/MM/yyyy"), "30 minutos antes", + "Carlos Silva", DiaSemana(hoje), "09:00", "S", "OS-1042"), + + new MLL.ModeloAgenda(2, "AG002", "Visita técnica", + hoje.ToString("dd/MM/yyyy"), "1 hora antes", + "Ana Souza", DiaSemana(hoje), "14:00", "N", "OS-1055"), + + new MLL.ModeloAgenda(3, "AG003", "Entrega de equipamento", + hoje.AddDays(4).ToString("dd/MM/yyyy"), "1 dia antes", + "Pedro Lima", DiaSemana(hoje.AddDays(4)), "10:30", "N", ""), + }); + _nextId = 4; + }//Carregar dados fake (Não usa mais) + private void CarregarDadosDoBanco() + { + BLLAgenda _agendaBLL = new BLLAgenda(_cx); + _eventos.Clear(); + _eventos.AddRange(_agendaBLL.Listar()); + }// Método auxiliar para obter os dados da agenda no banco de dados e preencher a lista de eventos. + + private static string DiaSemana(DateTime d) => + new System.Globalization.CultureInfo("pt-BR").DateTimeFormat.GetDayName(d.DayOfWeek); + + // ── UI HELPERS ──────────────────────────────────────────────────────── + private Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 760, Height = 26 }; + pnl.Controls.Add(new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true, + Location = new Point(0, 0) + }); + pnl.Controls.Add(new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 740, + Location = new Point(0, 20) + }); + return pnl; + } + + private RoundTextBox AddInput(Control parent, string label, + int x, int y, int width, int height, + bool readOnly = false) + { + parent.Controls.Add(new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }); + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + Radius = 4, + BorderColor = readOnly ? Color.FromArgb(203, 213, 225) : BorderColor, + FocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? DisabledBack : Color.White + }; + parent.Controls.Add(txt); + return txt; + } + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/AgendaCadastroPanel.resx b/UI/Dashboards/Cadastros/AgendaCadastroPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Cadastros/AgendaCadastroPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ClienteCadastroPanel.cs b/UI/Dashboards/Cadastros/ClienteCadastroPanel.cs new file mode 100644 index 0000000..baab19b --- /dev/null +++ b/UI/Dashboards/Cadastros/ClienteCadastroPanel.cs @@ -0,0 +1,530 @@ +using BLL; +using CustomMessageBox; +using DAL; +using System.Drawing; +using System.Windows.Forms; + +namespace UI +{ + public class ClienteCadastroPanel : UserControl + { + private string _connectionString = DadosDaConexao.ObterConexao(); + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + + private Panel pnlToolbar = null!; + private Panel mainScroll = null!; + private Panel content = null!; + + // Identificação + private RoundTextBox txtId = null!, txtEmpresaId = null!, txtNome = null!, txtNomeFantasia = null!; + private RoundTextBox txtTipoPessoa = null!, txtDocumento = null!, txtRG = null!; + private RoundTextBox txtInscricaoMunicipal = null!, txtDataNascimento = null!; + private RoundTextBox txtGrupo = null!, txtTipoConsumidor = null!; + + // Contatos + private RoundTextBox txtContato = null!, txtTelefone1 = null!, txtTelefone2 = null!; + private RoundTextBox txtCelular = null!, txtWhatsapp = null!, txtEmail = null!, txtEmailNFe = null!, txtSite = null!; + + // Endereço + private RoundTextBox txtCep = null!, txtEndereco = null!, txtNumero = null!, txtComplemento = null!; + private RoundTextBox txtBairro = null!, txtCidade = null!, txtUF = null!, txtPais = null!; + + // Financeiro + private RoundTextBox txtLimiteCredito = null!, txtVendedorPadraoId = null!, txtObservacoesCobranca = null!; + private CheckBox chkBloqueado = null!, chkAtivo = null!; + + // Carteiras + private RoundTextBox txtBitcoin = null!, txtEthereum = null!, txtLitecoin = null!; + + // Extras + private RoundTextBox txtObservacoes = null!; + private RoundTextBox txtCampoExtra1 = null!, txtCampoExtra2 = null!, txtCampoExtra3 = null!; + + // Info (readonly) + private RoundTextBox txtUltimaCompra = null!, txtCriadoEm = null!, txtAtualizadoEm = null!; + + //Funções Auxiliares + private void CarregarConfiguracoesSistema() + { + BLLEmpresaConfig empresaConfig = new BLLEmpresaConfig(_connectionString); + int codEmpresa = empresaConfig.ObterEmpresaAtivaId(); + + this.txtEmpresaId.Text = codEmpresa.ToString(); + } + private DateTime? ConverterData(string texto) + { + if (string.IsNullOrWhiteSpace(texto)) + return null; + + if (DateTime.TryParse(texto, out DateTime data)) + return data; + + return null; + } + private RoundTextBox[] TodosOsCampos() => new[] + { + txtId, txtEmpresaId, txtNome, txtNomeFantasia, + txtTipoPessoa, txtDocumento, txtRG, + txtInscricaoMunicipal, txtDataNascimento, + txtGrupo, txtTipoConsumidor, + txtContato, txtTelefone1, txtTelefone2, + txtCelular, txtWhatsapp, txtEmail, txtEmailNFe, txtSite, + txtCep, txtEndereco, txtNumero, txtComplemento, + txtBairro, txtCidade, txtUF, txtPais, + txtLimiteCredito, txtVendedorPadraoId, txtObservacoesCobranca, + txtBitcoin, txtEthereum, txtLitecoin, + txtObservacoes, txtCampoExtra1, txtCampoExtra2, txtCampoExtra3 + }; + + private void SetCampos(bool enabled) + { + foreach (var campo in TodosOsCampos()) + { + campo.Enabled = enabled; + campo.BackColor = enabled ? Color.White : Color.FromArgb(241, 245, 249); + } + chkBloqueado.Enabled = enabled; + chkAtivo.Enabled = enabled; + } + + public ClienteCadastroPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + InitializeLayout(); + SetCampos(false); + } + + private void InitializeLayout() + { + this.Controls.Clear(); + + // ── TOOLBAR ─────────────────────────────────────────────────────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = Color.FromArgb(248, 250, 252), + BorderStyle = BorderStyle.None + }; + + var flowButtons = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + var btnNovo = CreateToolbarButton("Novo", Color.FromArgb(34, 197, 94)); + var btnAlterar = CreateToolbarButton("Alterar", Color.FromArgb(245, 158, 11)); + var btnExcluir = CreateToolbarButton("Excluir", Color.FromArgb(239, 68, 68)); + var btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + var btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + var btnCancelar = CreateToolbarButton("Cancelar", Color.FromArgb(148, 163, 184)); + + btnNovo.Click += (s, e) => BtnNovo_Click(); + btnAlterar.Click += (s, e) => BtnAlterar_Click(); + btnExcluir.Click += (s, e) => BtnExcluir_Click(); + btnLocalizar.Click += (s, e) => BtnLocalizar_Click(); + btnSalvar.Click += (s, e) => BtnSalvar_Click(); + btnCancelar.Click += (s, e) => BtnCancelar_Click(); + + flowButtons.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar, btnCancelar }); + pnlToolbar.Controls.Add(flowButtons); + this.Controls.Add(pnlToolbar); + + // ── SCROLL + CONTENT ────────────────────────────────────────────── + mainScroll = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White + }; + this.Controls.Add(mainScroll); + mainScroll.BringToFront(); + + content = new Panel + { + Width = 1100, + Height = 900, + Location = new Point(0, 0), + BackColor = Color.White + }; + mainScroll.Controls.Add(content); + + const int rowH = 52; + const int secGap = 10; + const int secH = 28; + const int inputH = 28; + + int y = 10; + + // ── 1. IDENTIFICAÇÃO DO CLIENTE ─────────────────────────────────── + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO CLIENTE", y)); + y += secH + 4; + + txtId = AddInput(content, "ID", 20, y, 60, inputH); + txtEmpresaId = AddInput(content, "Empresa ID", 90, y, 80, inputH); + txtNome = AddInput(content, "Nome / Razão Social", 180, y, 390, inputH); + txtNomeFantasia = AddInput(content, "Nome Fantasia", 580, y, 360, inputH); + y += rowH; + + txtDocumento = AddInput(content, "CPF/CNPJ", 20, y, 170, inputH); + DocumentoHelper.Registrar(txtDocumento); + txtRG = AddInput(content, "RG / Insc. Estadual", 200, y, 170, inputH); + txtInscricaoMunicipal = AddInput(content, "Insc. Municipal", 380, y, 130, inputH); + txtDataNascimento = AddInput(content, "Dt. Nascimento", 520, y, 130, inputH); + txtTipoPessoa = AddInput(content, "Tipo Pessoa", 660, y, 110, inputH); + txtGrupo = AddInput(content, "Grupo", 780, y, 110, inputH); + txtTipoConsumidor = AddInput(content, "Tipo Consumidor", 900, y, 140, inputH); + y += rowH; + + // ── 2. CONTATOS E COMUNICAÇÃO ───────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("CONTATOS E COMUNICAÇÃO", y)); + y += secH + 4; + + txtContato = AddInput(content, "Contato", 20, y, 180, inputH); + txtEmail = AddInput(content, "E-mail", 210, y, 230, inputH); + txtEmailNFe = AddInput(content, "E-mail XML/NFe", 450, y, 230, inputH); + txtSite = AddInput(content, "Site", 690, y, 250, inputH); + y += rowH; + + txtTelefone1 = AddInput(content, "Telefone 1", 20, y, 155, inputH); + txtTelefone2 = AddInput(content, "Telefone 2", 185, y, 155, inputH); + txtCelular = AddInput(content, "Celular", 350, y, 155, inputH); + txtWhatsapp = AddInput(content, "WhatsApp", 515, y, 155, inputH); + y += rowH; + + // ── 3. ENDEREÇO COMPLETO ────────────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("ENDEREÇO COMPLETO", y)); + y += secH + 4; + + txtCep = AddInput(content, "CEP", 20, y, 95, inputH); + txtCep.Leave += (s, e) => + { + string cep = txtCep.Text.Trim().Replace("-", ""); + + if (cep.Length != 8) return; + + if (TLL.VerifyCep.verificaCEP(cep)) + { + txtEndereco.Text = TLL.VerifyCep.endereco; + txtBairro.Text = TLL.VerifyCep.bairro; + txtCidade.Text = TLL.VerifyCep.cidade; + txtUF.Text = TLL.VerifyCep.estado; + + // Formata o CEP com hífen + txtCep.Text = $"{cep[..5]}-{cep[5..]}"; + } + else + { + NT_MessageBox.Show("CEP não encontrado.", "CEP", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + };//cep + txtEndereco = AddInput(content, "Logradouro", 125, y, 370, inputH); + txtNumero = AddInput(content, "Nº", 505, y, 60, inputH); + txtComplemento = AddInput(content, "Complemento", 575, y, 175, inputH); + txtBairro = AddInput(content, "Bairro", 760, y, 180, inputH); + y += rowH; + + txtCidade = AddInput(content, "Cidade", 20, y, 280, inputH); + txtUF = AddInput(content, "UF", 310, y, 55, inputH); + txtPais = AddInput(content, "País", 375, y, 150, inputH); + y += rowH; + + // ── 4. FINANCEIRO ───────────────────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("FINANCEIRO", y)); + y += secH + 4; + + txtLimiteCredito = AddInput(content, "Limite de Crédito", 20, y, 150, inputH); + txtVendedorPadraoId = AddInput(content, "Vendedor Padrão ID", 180, y, 120, inputH); + txtObservacoesCobranca = AddInput(content, "Obs. de Cobrança", 310, y, 380, inputH); + + chkBloqueado = CreateCheckBox("Bloqueado", 705, y + 18); + chkAtivo = CreateCheckBox("Ativo", 805, y + 18); + content.Controls.Add(chkBloqueado); + content.Controls.Add(chkAtivo); + y += rowH; + + // ── 5. CARTEIRAS DIGITAIS ───────────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("CARTEIRAS DIGITAIS", y)); + y += secH + 4; + + txtBitcoin = AddInput(content, "Bitcoin (BTC)", 20, y, 290, inputH); + txtEthereum = AddInput(content, "Ethereum (ETH)", 320, y, 290, inputH); + txtLitecoin = AddInput(content, "Litecoin (LTC)", 620, y, 290, inputH); + y += rowH; + + // ── 6. CAMPOS EXTRAS ────────────────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("CAMPOS EXTRAS", y)); + y += secH + 4; + + txtCampoExtra1 = AddInput(content, "Campo Extra 1", 20, y, 290, inputH); + txtCampoExtra2 = AddInput(content, "Campo Extra 2", 320, y, 290, inputH); + txtCampoExtra3 = AddInput(content, "Campo Extra 3", 620, y, 290, inputH); + y += rowH; + + // ── 7. OBSERVAÇÕES ──────────────────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES", y)); + y += secH + 4; + + txtObservacoes = AddInput(content, "Observações Internas", 20, y, 920, inputH); + y += rowH; + + // ── 8. INFORMAÇÕES DO REGISTRO ──────────────────────────────────── + y += secGap; + content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO REGISTRO", y)); + y += secH + 4; + + txtUltimaCompra = AddInput(content, "Última Compra", 20, y, 175, inputH, readOnly: true); + txtCriadoEm = AddInput(content, "Criado Em", 205, y, 175, inputH, readOnly: true); + txtAtualizadoEm = AddInput(content, "Atualizado Em", 390, y, 175, inputH, readOnly: true); + y += rowH; + + content.Height = y + 10; + } + + // ── EVENTOS ─────────────────────────────────────────────────────────── + + private void BtnNovo_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + chkBloqueado.Checked = false; + chkAtivo.Checked = true; + + SetCampos(true); + txtId.Enabled = false; + txtId.BackColor = Color.FromArgb(241, 245, 249); + this.CarregarConfiguracoesSistema(); + txtEmpresaId.Enabled = false; + txtEmpresaId.BackColor = Color.FromArgb(241, 245, 249); + } + + private void BtnAlterar_Click() + { + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + MessageBox.Show( + "Nenhum registro selecionado para alterar.", + "Atenção", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + + SetCampos(true); + txtId.Enabled = false; + txtId.BackColor = Color.FromArgb(241, 245, 249); + txtEmpresaId.Enabled = false; + txtEmpresaId.BackColor = Color.FromArgb(241, 245, 249); + } + + private void BtnExcluir_Click() + { + // Solicita confirmação e exclui o registro atual + } + + private void BtnLocalizar_Click() + { + // Abre tela/diálogo de busca e preenche os campos + } + + private void BtnSalvar_Click() + { + var bll = new BLLClientes(_connectionString); + + // 🔒 validação básica front + if (string.IsNullOrWhiteSpace(txtNome.Text) || + string.IsNullOrWhiteSpace(txtDocumento.Text)) + { + NT_MessageBox.Show("Preencha ao menos Nome e Documento.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + bool isNew = string.IsNullOrWhiteSpace(txtId.Text); + + var cliente = new ModeloCliente + { + Id = isNew ? 0 : int.Parse(txtId.Text), + EmpresaId = int.TryParse(txtEmpresaId.Text, out var emp) ? emp : 0, + + Nome = txtNome.Text, + NomeFantasia = txtNomeFantasia.Text, + TipoPessoa = txtTipoPessoa.Text, + Documento = txtDocumento.Text, + + RG = txtRG.Text, + InscricaoMunicipal = txtInscricaoMunicipal.Text, + DataNascimento = ConverterData(txtDataNascimento.Text), + + Contato = txtContato.Text, + Telefone1 = txtTelefone1.Text, + Telefone2 = txtTelefone2.Text, + Celular = txtCelular.Text, + Whatsapp = txtWhatsapp.Text, + Email = txtEmail.Text, + EmailNFe = txtEmailNFe.Text, + Site = txtSite.Text, + + Grupo = txtGrupo.Text, + + Cep = txtCep.Text, + Endereco = txtEndereco.Text, + Numero = int.TryParse(txtNumero.Text, out var num) ? num : null, + Complemento = txtComplemento.Text, + Bairro = txtBairro.Text, + Cidade = txtCidade.Text, + UF = txtUF.Text, + Pais = txtPais.Text, + + LimiteCredito = decimal.TryParse(txtLimiteCredito.Text, out var lim) ? lim : 0, + Bloqueado = chkBloqueado.Checked, + ObservacoesCobranca = txtObservacoesCobranca.Text, + + VendedorPadraoId = int.TryParse(txtVendedorPadraoId.Text, out var vend) ? vend : null, + TipoConsumidor = txtTipoConsumidor.Text, + + Observacoes = txtObservacoes.Text, + + CampoExtra1 = txtCampoExtra1.Text, + CampoExtra2 = txtCampoExtra2.Text, + CampoExtra3 = txtCampoExtra3.Text, + + Bitcoin = txtBitcoin.Text, + Ethereum = txtEthereum.Text, + Litecoin = txtLitecoin.Text, + + Ativo = chkAtivo.Checked, + UltimaCompra = ConverterData(txtUltimaCompra.Text), + + // 🔥 esses o banco já gera, mas mantém compatível + CriadoEm = DateTime.Now, + AtualizadoEm = DateTime.Now + }; + + bool sucesso = false; + + try + { + sucesso = isNew + ? bll.Inserir(cliente) + : bll.Alterar(cliente); + } + catch (Exception ex) + { + NT_MessageBox.Show(ex.Message, + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (!sucesso) + { + NT_MessageBox.Show("Erro ao salvar cliente.", + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + SetCampos(false); + + NT_MessageBox.Show("Cliente salvo com sucesso!", + "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void BtnCancelar_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + chkBloqueado.Checked = false; + chkAtivo.Checked = false; + + SetCampos(false); + } + + // ── HELPERS ─────────────────────────────────────────────────────────── + + private Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 1000, Height = 26 }; + var lbl = new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true, + Location = new Point(0, 0) + }; + var line = new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 980, + Location = new Point(0, 20) + }; + pnl.Controls.Add(lbl); + pnl.Controls.Add(line); + return pnl; + } + + private RoundTextBox AddInput(Control parent, string label, + int x, int y, int width, int height, + bool readOnly = false) + { + var lbl = new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }; + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + Radius = 4, + BorderColor = readOnly ? Color.FromArgb(203, 213, 225) : BorderColor, + FocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? Color.FromArgb(241, 245, 249) : Color.White + }; + parent.Controls.Add(lbl); + parent.Controls.Add(txt); + return txt; + } + + private CheckBox CreateCheckBox(string text, int x, int y) => new CheckBox + { + Text = text, + Location = new Point(x, y), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ClienteCadastroPanel.resx b/UI/Dashboards/Cadastros/ClienteCadastroPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Cadastros/ClienteCadastroPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/EmpresaCadastroPanel.cs b/UI/Dashboards/Cadastros/EmpresaCadastroPanel.cs new file mode 100644 index 0000000..06d01ad --- /dev/null +++ b/UI/Dashboards/Cadastros/EmpresaCadastroPanel.cs @@ -0,0 +1,526 @@ +using BLL; +using CustomMessageBox; +using DAL; +using MLL; +using System.Drawing; +using System.Windows.Forms; + +namespace UI +{ + public class EmpresaCadastroPanel : UserControl + { + private string _cx = DadosDaConexao.ObterConexao(); + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + + private Panel pnlToolbar = null!; + private Panel mainScroll = null!; + private Panel content = null!; + + // Identificação + private RoundTextBox txtId = null!, txtNome = null!, txtCNPJ = null!; + private RoundTextBox txtTipoEmpresa = null!, txtRegimeTributario = null!, txtCNAE = null!; + + // Endereço + private RoundTextBox txtCep = null!, txtEndereco = null!, txtNumero = null!, txtComplemento = null!; + private RoundTextBox txtBairro = null!, txtCidade = null!, txtUF = null!, txtPais = null!; + + // Contatos + private RoundTextBox txtTelefone1 = null!, txtTelefone2 = null!, txtCelular = null!, txtWhatsapp = null!; + private RoundTextBox txtEmail = null!, txtSite = null!; + + // Fiscal + private RoundTextBox txtInscricaoEstadual = null!, txtInscricaoMunicipal = null!; + + // Contador + private RoundTextBox txtCNPJCPF_Contador = null!, txtNome_Contador = null!; + + // Outros + private RoundTextBox txtTextoParaRecibo = null!; + private CheckBox chkAtivo = null!; + + // Info (readonly) + private RoundTextBox txtCriadoEm = null!, txtAtualizadoEm = null!; + + //Carregar dados da empresa atual, se houver no banco de dados + private void CarregarEmpresaAtiva() + { + var bll = new BLLEmpresa(_cx); + var empresa = bll.CarregarEmpresaAtiva(); + + if (empresa == null) + { + MessageBox.Show("Nenhuma empresa ativa encontrada.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + // Preenche todos os campos do formulário + txtId.Text = empresa.Id.ToString(); + txtNome.Text = empresa.Nome; + txtCNPJ.Text = empresa.CNPJ; + txtTipoEmpresa.Text = empresa.TipoEmpresa; + txtRegimeTributario.Text = empresa.RegimeTributario; + txtCNAE.Text = empresa.CNAE; + txtInscricaoEstadual.Text = empresa.InscricaoEstadual; + txtInscricaoMunicipal.Text = empresa.InscricaoMunicipal; + txtCep.Text = empresa.Cep; + txtEndereco.Text = empresa.Endereco; + txtNumero.Text = empresa.Numero.ToString(); + txtComplemento.Text = empresa.Complemento; + txtBairro.Text = empresa.Bairro; + txtCidade.Text = empresa.Cidade; + txtUF.Text = empresa.UF; + txtPais.Text = empresa.Pais; + txtTelefone1.Text = empresa.Telefone1; + txtTelefone2.Text = empresa.Telefone2; + txtCelular.Text = empresa.Celular; + txtWhatsapp.Text = empresa.Whatsapp; + txtEmail.Text = empresa.Email; + txtSite.Text = empresa.Site; + txtCNPJCPF_Contador.Text = empresa.CNPJCPF_Contador; + txtNome_Contador.Text = empresa.Nome_Contador; + txtTextoParaRecibo.Text = empresa.TextoParaRecibo; + chkAtivo.Checked = empresa.Ativo; + txtCriadoEm.Text = empresa.CriadoEm.ToString("dd/MM/yyyy"); + txtAtualizadoEm.Text = empresa.AtualizadoEm.ToString("dd/MM/yyyy"); + } + public EmpresaCadastroPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + InitializeLayout(); + // Carregar dados da empresa atual, se houver + CarregarEmpresaAtiva(); + } + + private void InitializeLayout() + { + this.Controls.Clear(); + + // ── TOOLBAR ─────────────────────────────────────────────────────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = Color.FromArgb(248, 250, 252), + BorderStyle = BorderStyle.None + }; + + var flowButtons = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + var btnNovo = CreateToolbarButton("Novo", Color.FromArgb(34, 197, 94)); + var btnAlterar = CreateToolbarButton("Alterar", Color.FromArgb(245, 158, 11)); + var btnExcluir = CreateToolbarButton("Excluir", Color.FromArgb(239, 68, 68)); + var btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + var btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + var btnCancelar = CreateToolbarButton("Cancelar", Color.FromArgb(148, 163, 184)); + var btnCriarCert = CreateToolbarButton("Certificado", Color.FromArgb(148, 160, 184)); + var btnGerarFichaPDF = CreateToolbarButton("Ficha Tecnica", Color.FromArgb(255, 0, 0)); + + btnNovo.Click += (s, e) => BtnNovo_Click(); + btnAlterar.Click += (s, e) => BtnAlterar_Click(); + btnExcluir.Click += (s, e) => BtnExcluir_Click(); + btnLocalizar.Click += (s, e) => BtnLocalizar_Click(); + btnSalvar.Click += (s, e) => BtnSalvar_Click(); + btnCancelar.Click += (s, e) => BtnCancelar_Click(); + btnCriarCert.Click += (s, e) => BtnGerarCertificado_Click(); + btnGerarFichaPDF.Click += (s, e) => BtnFicha_Click(); + + flowButtons.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar, btnCancelar,btnCriarCert,btnGerarFichaPDF }); + pnlToolbar.Controls.Add(flowButtons); + this.Controls.Add(pnlToolbar); + + // ── SCROLL + CONTENT ────────────────────────────────────────────── + mainScroll = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White + }; + this.Controls.Add(mainScroll); + mainScroll.BringToFront(); + + content = new Panel + { + Width = 1100, + Height = 900, + Location = new Point(0, 0), + BackColor = Color.White + }; + mainScroll.Controls.Add(content); + + const int rowH = 52; + const int secGap = 10; + const int secH = 28; + const int inputH = 28; + + int y = 10; + + // ── 1. IDENTIFICAÇÃO DA EMPRESA ─────────────────────────────────── + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DA EMPRESA", y)); + y += secH + 4; + + txtId = AddInput(content, "ID", 20, y, 60, inputH, readOnly: true); + txtNome = AddInput(content, "Nome / Razão Social", 90, y, 450, inputH); + txtCNPJ = AddInput(content, "CNPJ", 550, y, 180, inputH); + DocumentoHelper.Registrar(txtCNPJ); + txtTipoEmpresa = AddInput(content, "Tipo Empresa", 740, y, 200, inputH); + y += rowH; + + txtRegimeTributario = AddInput(content, "Regime Tributário", 20, y, 200, inputH); + txtCNAE = AddInput(content, "CNAE", 230, y, 150, inputH); + txtInscricaoEstadual = AddInput(content, "Inscrição Estadual", 390, y, 200, inputH); + txtInscricaoMunicipal = AddInput(content, "Inscrição Municipal", 600, y, 200, inputH); + + // ── 2. ENDEREÇO COMPLETO ────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("ENDEREÇO COMPLETO", y)); + y += secH + 4; + + txtCep = AddInput(content, "CEP", 20, y, 95, inputH); + // No InitializeLayout(), após criar o txtCep + txtCep.Leave += (s, e) => + { + string cep = txtCep.Text.Trim().Replace("-", ""); + + if (cep.Length != 8) return; + + if (TLL.VerifyCep.verificaCEP(cep)) + { + txtEndereco.Text = TLL.VerifyCep.endereco; + txtBairro.Text = TLL.VerifyCep.bairro; + txtCidade.Text = TLL.VerifyCep.cidade; + txtUF.Text = TLL.VerifyCep.estado; + txtPais.Text = "Brasil"; + + // Formata o CEP com hífen + txtCep.Text = $"{cep[..5]}-{cep[5..]}"; + } + else + { + NT_MessageBox.Show("CEP não encontrado.", "CEP", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + }; + txtEndereco = AddInput(content, "Logradouro", 125, y, 370, inputH); + txtNumero = AddInput(content, "Nº", 505, y, 60, inputH); + txtComplemento = AddInput(content, "Complemento", 575, y, 175, inputH); + txtBairro = AddInput(content, "Bairro", 760, y, 180, inputH); + y += rowH; + + txtCidade = AddInput(content, "Cidade", 20, y, 280, inputH); + txtUF = AddInput(content, "UF", 310, y, 55, inputH); + txtPais = AddInput(content, "País", 375, y, 150, inputH); + + // ── 3. CONTATOS E COMUNICAÇÃO ───────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("CONTATOS E COMUNICAÇÃO", y)); + y += secH + 4; + + txtTelefone1 = AddInput(content, "Telefone 1", 20, y, 155, inputH); + txtTelefone2 = AddInput(content, "Telefone 2", 185, y, 155, inputH); + txtCelular = AddInput(content, "Celular", 350, y, 155, inputH); + txtWhatsapp = AddInput(content, "WhatsApp", 515, y, 155, inputH); + y += rowH; + + txtEmail = AddInput(content, "E-mail", 20, y, 350, inputH); + txtSite = AddInput(content, "Site", 380, y, 290, inputH); + + // ── 4. DADOS DO CONTADOR ────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("DADOS DO CONTADOR", y)); + y += secH + 4; + + txtCNPJCPF_Contador = AddInput(content, "CPF/CNPJ do Contador", 20, y, 200, inputH); + DocumentoHelper.Registrar(txtCNPJCPF_Contador); + txtNome_Contador = AddInput(content, "Nome do Contador", 230, y, 400, inputH); + + // ── 5. OUTROS ───────────────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("OUTROS", y)); + y += secH + 4; + + txtTextoParaRecibo = AddInput(content, "Texto para Recibo", 20, y, 920, inputH); + y += rowH; + txtTextoParaRecibo.Multiline = true; + + + chkAtivo = CreateCheckBox("Ativo", 20, y); + content.Controls.Add(chkAtivo); + + // ── 6. INFORMAÇÕES DO REGISTRO ──────────────────────────────────── + y += 35 + secGap; + content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO REGISTRO", y)); + y += secH + 4; + + txtCriadoEm = AddInput(content, "Criado Em", 20, y, 175, inputH, readOnly: true); + txtAtualizadoEm = AddInput(content, "Atualizado Em", 205, y, 175, inputH, readOnly: true); + y += rowH; + + content.Height = y + 10; + + SetCampos(false); + } + + // ── CAMPOS ──────────────────────────────────────────────────────────── + + private RoundTextBox[] TodosOsCampos() => new[] + { + txtNome, txtCNPJ, txtTipoEmpresa, txtRegimeTributario, txtCNAE, + txtInscricaoEstadual, txtInscricaoMunicipal, + txtCep, txtEndereco, txtNumero, txtComplemento, + txtBairro, txtCidade, txtUF, txtPais, + txtTelefone1, txtTelefone2, txtCelular, txtWhatsapp, + txtEmail, txtSite, + txtCNPJCPF_Contador, txtNome_Contador, + txtTextoParaRecibo + }; + + private void SetCampos(bool enabled) + { + foreach (var campo in TodosOsCampos()) + { + campo.Enabled = enabled; + campo.BackColor = enabled ? Color.White : Color.FromArgb(241, 245, 249); + } + chkAtivo.Enabled = enabled; + } + + // ── EVENTOS ─────────────────────────────────────────────────────────── + + private void BtnNovo_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + chkAtivo.Checked = true; + SetCampos(true); + } + + private void BtnAlterar_Click() + { + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + MessageBox.Show( + "Nenhum registro selecionado para alterar.", + "Atenção", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + + SetCampos(true); + txtId.Enabled = false; + txtId.BackColor = Color.FromArgb(241, 245, 249); + } + // Evento + private void BtnFicha_Click() + { + var bll = new BLLEmpresa(_cx); + var empresa = bll.CarregarEmpresaAtiva(); + + if (empresa == null) + { + MessageBox.Show("Nenhuma empresa ativa encontrada."); + return; + } + + var resultado = TLL.FichaEmpresaPDF.GerarEAbrir(empresa); + + if (!resultado.Sucesso) + MessageBox.Show(resultado.Mensagem, "Erro", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + private void BtnExcluir_Click() + { + // Solicita confirmação e exclui o registro atual + } + + private void BtnLocalizar_Click() + { + // Abre tela/diálogo de busca e preenche os campos + } + private void BtnGerarCertificado_Click() + { + ModeloEmpresa empresa = new ModeloEmpresa(); + // Após salvar a empresa com sucesso... + var resultado = TLL.CertificadoHelper.Gerar(empresa, "Nike12122020*##"); + + if (resultado.Sucesso) + NT_MessageBox.Show( + $"Certificado gerado!\nVálido até: {resultado.ValidoAte:dd/MM/yyyy}\n" + + $"Thumbprint: {resultado.Thumbprint}", + "Certificado", MessageBoxButtons.OK, MessageBoxIcon.Information); + else + NT_MessageBox.Show(resultado.Mensagem, "Erro", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + private void BtnVerificarCert_Click() + { + ModeloEmpresa empresa = new ModeloEmpresa(); + var status = TLL.CertificadoHelper.VerificarStatus(empresa.CNPJ, "Nike12122020*##"); + + if (!status.Valido) + NT_MessageBox.Show("Certificado expirado! Gere um novo.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + private void BtnSalvar_Click() + { + BLLEmpresa _empresaBLL = new BLLEmpresa(_cx); + + if (string.IsNullOrWhiteSpace(txtNome.Text) || + string.IsNullOrWhiteSpace(txtCNPJ.Text) || + string.IsNullOrWhiteSpace(txtEmail.Text)) + { + NT_MessageBox.Show("Preencha ao menos Nome, CNPJ e Email.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + bool isNew = string.IsNullOrWhiteSpace(txtId.Text); + + var empresa = new MLL.ModeloEmpresa( + id: isNew ? 0 : int.Parse(txtId.Text), + nome: txtNome.Text, + cNPJ: txtCNPJ.Text, + tipoEmpresa: txtTipoEmpresa.Text, + regimeTributario: txtRegimeTributario.Text, + cNAE: txtCNAE.Text, + cep: txtCep.Text, + endereco: txtEndereco.Text, + numero: string.IsNullOrWhiteSpace(txtNumero.Text) ? 0 : int.Parse(txtNumero.Text), + complemento: txtComplemento.Text, + bairro: txtBairro.Text, + cidade: txtCidade.Text, + uF: txtUF.Text, + pais: txtPais.Text, + telefone1: txtTelefone1.Text, + telefone2: txtTelefone2.Text, + celular: txtCelular.Text, + whatsapp: txtWhatsapp.Text, + email: txtEmail.Text, + site: txtSite.Text, + inscricaoEstadual: txtInscricaoEstadual.Text, + inscricaoMunicipal: txtInscricaoMunicipal.Text, + cNPJCPF_Contador: txtCNPJCPF_Contador.Text, + nome_Contador: txtNome_Contador.Text, + textoParaRecibo: txtTextoParaRecibo.Text, + ativo: chkAtivo.Checked, + criadoEm: DateTime.Now, + atualizadoEm: DateTime.Now + ); + + bool sucesso; + + if (isNew) + sucesso = _empresaBLL.Inserir(empresa); + else + sucesso = _empresaBLL.Alterar(empresa); + + if (!sucesso) + { + NT_MessageBox.Show("Erro ao salvar empresa.", + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // 🔹 Atualiza UI + txtAtualizadoEm.Text = DateTime.Now.ToString("dd/MM/yyyy"); + SetCampos(false); + + NT_MessageBox.Show("Empresa salva com sucesso!", "Sucesso", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void BtnCancelar_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + chkAtivo.Checked = false; + SetCampos(false); + } + + // ── HELPERS ─────────────────────────────────────────────────────────── + + private Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 1000, Height = 26 }; + var lbl = new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true, + Location = new Point(0, 0) + }; + var line = new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 980, + Location = new Point(0, 20) + }; + pnl.Controls.Add(lbl); + pnl.Controls.Add(line); + return pnl; + } + + private RoundTextBox AddInput(Control parent, string label, + int x, int y, int width, int height, + bool readOnly = false) + { + var lbl = new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }; + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + Radius = 4, + BorderColor = readOnly ? Color.FromArgb(203, 213, 225) : BorderColor, + FocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? Color.FromArgb(241, 245, 249) : Color.White + }; + parent.Controls.Add(lbl); + parent.Controls.Add(txt); + return txt; + } + + private CheckBox CreateCheckBox(string text, int x, int y) => new CheckBox + { + Text = text, + Location = new Point(x, y), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/EmpresaCadastroPanel.resx b/UI/Dashboards/Cadastros/EmpresaCadastroPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Cadastros/EmpresaCadastroPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.cs b/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.cs new file mode 100644 index 0000000..16f4a1e --- /dev/null +++ b/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.cs @@ -0,0 +1,591 @@ +using BLL; +using CCH; +using CustomMessageBox; +using DAL; +using System.Drawing; +using System.IO; +using System.Windows.Forms; + +namespace UI +{ + public class EmpresaConfiguracoesPanel : UserControl + { + //Variaveis de ambiente + private int _idEmpresa; + private int _idConfig; + private string _connectionString = DadosDaConexao.ObterConexao(); + + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + + private Panel pnlToolbar = null!; + private Panel mainScroll = null!; + private Panel content = null!; + + private RoundTextBox txtId = null!, txtEmpresaId = null!, txtNomeSistema = null!; + private RoundTextBox txtCorPrimaria = null!, txtCorSecundaria = null!; + private RoundTextBox txtLogo = null!, txtFavicon = null!; + private RoundTextBox txtDiasGarantiaPadrao = null!; + + private CheckBox chkExibirCPF = null!, chkExibirTelefone = null!, chkExibirGarantia = null!; + private CheckBox chkGerarRecibo = null!, chkExibirValoresOS = null!; + private CheckBox chkEmailAuto = null!, chkWhatsAuto = null!, chkModoEscuro = null!; + private CheckBox chkPermitirEdicaoOS = null!; + + private RoundTextBox txtCriadoEm = null!, txtAtualizadoEm = null!; + + public EmpresaConfiguracoesPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + InitializeLayout(); + this.CarregarConfig(); + + } + + private void InitializeLayout() + { + this.Controls.Clear(); + + // ── TOOLBAR ─────────────────────────────────────────────────────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = Color.FromArgb(248, 250, 252) + }; + var flowButtons = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0) + }; + + var btnNovo = CreateToolbarButton("Novo", Color.FromArgb(34, 197, 94)); + var btnAlterar = CreateToolbarButton("Alterar", Color.FromArgb(245, 158, 11)); + var btnExcluir = CreateToolbarButton("Excluir", Color.FromArgb(239, 68, 68)); + var btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + var btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + var btnCancelar = CreateToolbarButton("Cancelar", Color.FromArgb(148, 163, 184)); + var btnConfigEmpresa = CreateToolbarButton("Gerar Config", Color.FromArgb(148, 163, 184)); + + btnNovo.Click += (s, e) => BtnNovo_Click(); + btnAlterar.Click += (s, e) => BtnAlterar_Click(); + btnExcluir.Click += (s, e) => BtnExcluir_Click(); + btnLocalizar.Click += (s, e) => BtnLocalizar_Click(); + btnSalvar.Click += (s, e) => BtnSalvar_Click(); + btnCancelar.Click += (s, e) => BtnCancelar_Click(); + btnConfigEmpresa.Click += (s, e) => BtnGerarConfig_Click(); + + flowButtons.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar,btnConfigEmpresa,btnCancelar }); + pnlToolbar.Controls.Add(flowButtons); + this.Controls.Add(pnlToolbar); + + // ── SCROLL + CONTENT ────────────────────────────────────────────── + mainScroll = new Panel { Dock = DockStyle.Fill, AutoScroll = true }; + this.Controls.Add(mainScroll); + mainScroll.BringToFront(); + + content = new Panel { Width = 1100, Height = 850, Location = new Point(0, 0) }; + mainScroll.Controls.Add(content); + + int y = 10; + const int rowH = 52; + + // ── 1. IDENTIDADE DO SISTEMA ────────────────────────────────────── + content.Controls.Add(CreateSectionHeader("IDENTIDADE DO SISTEMA", y)); + y += 32; + + txtId = AddInput(content, "ID", 20, y, 60, 28, readOnly: true); + txtEmpresaId = AddInput(content, "Empresa ID", 90, y, 80, 28); + txtNomeSistema = AddInput(content, "Nome Personalizado do Sistema", 180, y, 350, 28); + y += rowH; + + txtCorPrimaria = AddInput(content, "Cor Primária (Hex)", 20, y, 150, 28); + txtCorSecundaria = AddInput(content, "Cor Secundária (Hex)", 180, y, 150, 28); + + // Logo com botão lupa + txtLogo = AddInput(content, "Caminho da Logo", 340, y, 260, 28); + var btnLogo = CreateIconButton("🔍", 608, y + 16); + btnLogo.Click += (s, e) => SelecionarImagem(txtLogo, "Logo"); + content.Controls.Add(btnLogo); + + // Favicon com botão lupa + txtFavicon = AddInput(content, "Caminho do Favicon", 650, y, 240, 28); + var btnFavicon = CreateIconButton("🔍", 898, y + 16); + btnFavicon.Click += (s, e) => SelecionarImagem(txtFavicon, "Favicon"); + content.Controls.Add(btnFavicon); + + // ── 2. REGRAS DE NEGÓCIO E EXIBIÇÃO ────────────────────────────── + y += rowH + 15; + content.Controls.Add(CreateSectionHeader("REGRAS DE NEGÓCIO E EXIBIÇÃO", y)); + y += 32; + + chkExibirCPF = CreateCheckBox("Exibir CPF Cliente na OS", 20, y + 15); + chkExibirTelefone = CreateCheckBox("Exibir Telefone na OS", 230, y + 15); + chkExibirValoresOS = CreateCheckBox("Exibir Valores na OS", 460, y + 15); + content.Controls.AddRange(new Control[] { chkExibirCPF, chkExibirTelefone, chkExibirValoresOS }); + y += rowH; + + chkExibirGarantia = CreateCheckBox("Utilizar Garantia", 20, y + 15); + txtDiasGarantiaPadrao = AddInput(content, "Dias Garantia (Padrão)", 180, y, 120, 28); + content.Controls.Add(chkExibirGarantia); + + // ── 3. AUTOMAÇÕES E COMUNICAÇÃO ─────────────────────────────────── + y += rowH + 15; + content.Controls.Add(CreateSectionHeader("AUTOMAÇÕES E COMUNICAÇÃO", y)); + y += 32; + + chkGerarRecibo = CreateCheckBox("Gerar Recibo Automático", 20, y + 15); + chkEmailAuto = CreateCheckBox("Enviar E-mail Automático", 230, y + 15); + chkWhatsAuto = CreateCheckBox("Enviar WhatsApp Automático", 460, y + 15); + content.Controls.AddRange(new Control[] { chkGerarRecibo, chkEmailAuto, chkWhatsAuto }); + + // ── 4. PREFERÊNCIAS TÉCNICAS ────────────────────────────────────── + y += rowH + 15; + content.Controls.Add(CreateSectionHeader("PREFERÊNCIAS TÉCNICAS", y)); + y += 32; + + chkModoEscuro = CreateCheckBox("Habilitar Modo Escuro", 20, y + 15); + chkPermitirEdicaoOS = CreateCheckBox("Permitir Edição de OS Finalizada", 230, y + 15); + content.Controls.AddRange(new Control[] { chkModoEscuro, chkPermitirEdicaoOS }); + + // ── 5. INFORMAÇÕES DO REGISTRO ──────────────────────────────────── + y += rowH + 15; + content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO REGISTRO", y)); + y += 32; + + txtCriadoEm = AddInput(content, "Criado Em", 20, y, 180, 28, readOnly: true); + txtAtualizadoEm = AddInput(content, "Atualizado Em", 210, y, 180, 28, readOnly: true); + y += rowH; + + content.Height = y + 20; + + SetCamposStatus(false); + } + + // ── SELEÇÃO DE IMAGEM ───────────────────────────────────────────────── + + //private void SelecionarImagem(RoundTextBox destino, string tipo) + //{ + // using var dlg = new OpenFileDialog + // { + // Title = $"Selecionar {tipo}", + // Filter = "Imagens|*.png;*.jpg;*.jpeg;*.bmp;*.ico;*.gif|Todos os arquivos|*.*" + // }; + + // if (dlg.ShowDialog() == DialogResult.OK) + // { + // var arquivo = dlg.FileName; + // destino.Text = arquivo; + + // // Valida tamanho máximo (2MB) + // var info = new FileInfo(arquivo); + // if (info.Length > 2 * 1024 * 1024) + // { + // MessageBox.Show( + // $"O arquivo selecionado para {tipo} é maior que 2MB.\nRecomendamos imagens menores para melhor desempenho.", + // "Atenção", + // MessageBoxButtons.OK, + // MessageBoxIcon.Warning); + // } + // } + //} + private void SelecionarImagem(RoundTextBox destino, string tipo) + { + using var dlg = new OpenFileDialog + { + Title = $"Selecionar {tipo}", + Filter = "Imagens|*.png;*.jpg;*.jpeg;*.bmp;*.ico;*.gif|Todos os arquivos|*.*" + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + try + { + var arquivoOriginal = dlg.FileName; + + // 📁 Pasta destino fixa + string pastaDestino = @"C:\Levelcode\LevelOS\Uploads\Images"; + + // Cria a pasta se não existir + if (!Directory.Exists(pastaDestino)) + Directory.CreateDirectory(pastaDestino); + + // 🔥 Gera nome único (evita sobrescrever) + string extensao = Path.GetExtension(arquivoOriginal); + string nomeNovo = $"{tipo}_{Guid.NewGuid()}{extensao}"; + string caminhoFinal = Path.Combine(pastaDestino, nomeNovo); + + // Copia o arquivo + File.Copy(arquivoOriginal, caminhoFinal, false); + + // Atualiza o campo + destino.Text = caminhoFinal; + + // ⚠️ Valida tamanho (2MB) + var info = new FileInfo(caminhoFinal); + if (info.Length > 2 * 1024 * 1024) + { + MessageBox.Show( + $"O arquivo selecionado para {tipo} é maior que 2MB.\nRecomendamos imagens menores para melhor desempenho.", + "Atenção", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + } + } + catch (Exception ex) + { + MessageBox.Show( + "Erro ao copiar imagem: " + ex.Message, + "Erro", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + }//Copiar com mais precisão + + // ── EVENTOS DOS BOTÕES ──────────────────────────────────────────────── + + private void BtnNovo_Click() + { + LimparFormulario(); + SetCamposStatus(true); + txtNomeSistema.Focus(); + BLLEmpresaConfig empresaConfig = new BLLEmpresaConfig(_connectionString); + this.txtEmpresaId.Text = empresaConfig.ObterEmpresaAtivaId().ToString(); + } + + private void BtnAlterar_Click() + { + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + MessageBox.Show( + "Nenhum registro selecionado para alterar.", + "Atenção", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + SetCamposStatus(true); + } + + private void BtnExcluir_Click() + { + // Solicita confirmação e exclui o registro + } + + private void BtnLocalizar_Click() + { + // Abre tela de busca e preenche os campos + } + private void BtnGerarConfig_Click() + { + var config = new ModeloEmpresaConfig + { + IdEmpresaConfig = Convert.ToInt32(txtId.Text), // você precisa ter isso carregado + IdEmpresa = Convert.ToInt32(txtEmpresaId.Text), // idem (empresa logada) + + NomeSistema = txtNomeSistema.Text, + CorPrimaria = txtCorPrimaria.Text, + CorSecundaria = txtCorSecundaria.Text, + Logo = txtLogo.Text, + Favicon = txtFavicon.Text, + + ExibirCPFCliente = chkExibirCPF.Checked, + ExibirTelefoneCliente = chkExibirTelefone.Checked, + ExibirGarantia = chkExibirGarantia.Checked, + DiasGarantiaPadrao = Convert.ToInt32(txtDiasGarantiaPadrao.Text), + + GerarReciboAutomatico = chkGerarRecibo.Checked, + ExibirValoresOS = chkExibirValoresOS.Checked, + + EnviarEmailAutomatico = chkEmailAuto.Checked, + EnviarWhatsappAutomatico = chkWhatsAuto.Checked, + + ModoEscuro = chkModoEscuro.Checked, + PermitirEdicaoOSFinalizada = chkPermitirEdicaoOS.Checked + }; + bool result = JsonHelper.SalvarBoolean(config, AppFileSystem.AppFileConfigEmpresa); + if (result) + { + NT_MessageBox.Show("Arquivo de configuração gerado com sucesso.","Arquivo gerado",MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + NT_MessageBox.Show("Não foi possivel gerar o arquivo de configuração", "falha ao gerar arquivo", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void BtnSalvar_Click() + { + try + { + // Valida campos obrigatórios + if (string.IsNullOrWhiteSpace(txtNomeSistema.Text)) + { + MessageBox.Show( + "O campo 'Nome do Sistema' é obrigatório.", + "Atenção", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + txtNomeSistema.Focus(); + return; + } + + // Valida cores HEX + if (!string.IsNullOrWhiteSpace(txtCorPrimaria.Text) && !ValidarHex(txtCorPrimaria.Text)) + { + MessageBox.Show("Cor Primária inválida. Ex: #3B82F6", "Atenção"); + txtCorPrimaria.Focus(); + return; + } + + if (!string.IsNullOrWhiteSpace(txtCorSecundaria.Text) && !ValidarHex(txtCorSecundaria.Text)) + { + MessageBox.Show("Cor Secundária inválida. Ex: #64748B", "Atenção"); + txtCorSecundaria.Focus(); + return; + } + + // Valida arquivos + if (!string.IsNullOrWhiteSpace(txtLogo.Text) && !File.Exists(txtLogo.Text)) + { + MessageBox.Show("Logo não encontrada.", "Atenção"); + return; + } + + if (!string.IsNullOrWhiteSpace(txtFavicon.Text) && !File.Exists(txtFavicon.Text)) + { + MessageBox.Show("Favicon não encontrado.", "Atenção"); + return; + } + + // 🔥 Monta o modelo + var config = new ModeloEmpresaConfig + { + IdEmpresaConfig = Convert.ToInt32(txtId.Text), // você precisa ter isso carregado + IdEmpresa = Convert.ToInt32(txtEmpresaId.Text), // idem (empresa logada) + + NomeSistema = txtNomeSistema.Text, + CorPrimaria = txtCorPrimaria.Text, + CorSecundaria = txtCorSecundaria.Text, + Logo = txtLogo.Text, + Favicon = txtFavicon.Text, + + ExibirCPFCliente = chkExibirCPF.Checked, + ExibirTelefoneCliente = chkExibirTelefone.Checked, + ExibirGarantia = chkExibirGarantia.Checked, + DiasGarantiaPadrao =Convert.ToInt32(txtDiasGarantiaPadrao.Text), + + GerarReciboAutomatico = chkGerarRecibo.Checked, + ExibirValoresOS = chkExibirValoresOS.Checked, + + EnviarEmailAutomatico = chkEmailAuto.Checked, + EnviarWhatsappAutomatico = chkWhatsAuto.Checked, + + ModoEscuro = chkModoEscuro.Checked, + PermitirEdicaoOSFinalizada = chkPermitirEdicaoOS.Checked + }; + + var bll = new BLLEmpresaConfig(_connectionString); + + // 🔥 Decide se cria ou atualiza + _idConfig = Convert.ToInt32(txtId.Text); + if (_idConfig == 0 || _idConfig == null) + { + bll.Inserir(config); + JsonHelper.Salvar(config, AppFileSystem.AppFileConfigEmpresa); + } + else + { + + bll.Alterar(config); + JsonHelper.Salvar(config, AppFileSystem.AppFileConfigEmpresa); + } + + MessageBox.Show( + "Configurações salvas com sucesso!", + "LevelOS", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + + SetCamposStatus(false); + } + catch (Exception ex) + { + MessageBox.Show( + ex.Message, + "Erro", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void BtnCancelar_Click() + { + LimparFormulario(); + SetCamposStatus(false); + } + + // ── HELPERS DE ESTADO ───────────────────────────────────────────────── + + private void SetCamposStatus(bool active) + { + var campos = new Control[] + { + txtEmpresaId, txtNomeSistema, txtCorPrimaria, txtCorSecundaria, + txtLogo, txtFavicon, txtDiasGarantiaPadrao, + chkExibirCPF, chkExibirTelefone, chkExibirGarantia, chkGerarRecibo, + chkExibirValoresOS, chkEmailAuto, chkWhatsAuto, chkModoEscuro, chkPermitirEdicaoOS + }; + + foreach (var c in campos) + { + c.Enabled = active; + if (c is RoundTextBox r) + r.BackColor = active ? Color.White : Color.FromArgb(241, 245, 249); + } + + // ID e datas nunca editáveis + txtId.Enabled = false; + txtId.BackColor = Color.FromArgb(241, 245, 249); + txtCriadoEm.Enabled = false; + txtAtualizadoEm.Enabled = false; + } + + private void LimparFormulario() + { + var todos = new RoundTextBox[] + { + txtId, txtEmpresaId, txtNomeSistema, txtCorPrimaria, txtCorSecundaria, + txtLogo, txtFavicon, txtDiasGarantiaPadrao, txtCriadoEm, txtAtualizadoEm + }; + foreach (var t in todos) t.Text = string.Empty; + + foreach (Control c in content.Controls) + if (c is CheckBox chk) chk.Checked = false; + } + + private static bool ValidarHex(string valor) + { + var v = valor.TrimStart('#'); + return v.Length == 6 && System.Text.RegularExpressions.Regex.IsMatch(v, @"^[0-9A-Fa-f]{6}$"); + } + + // ── HELPERS DE UI ───────────────────────────────────────────────────── + + private Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 1000, Height = 26 }; + pnl.Controls.Add(new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true + }); + pnl.Controls.Add(new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 980, + Location = new Point(0, 20) + }); + return pnl; + } + + private RoundTextBox AddInput(Control parent, string label, + int x, int y, int w, int h, + bool readOnly = false) + { + parent.Controls.Add(new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }); + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(w, h), + Radius = 4, + BorderColor = readOnly ? Color.FromArgb(203, 213, 225) : BorderColor, + FocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? Color.FromArgb(241, 245, 249) : Color.White + }; + parent.Controls.Add(txt); + return txt; + } + + private Button CreateIconButton(string icon, int x, int y) => new Button + { + Text = icon, + Location = new Point(x, y), + Size = new Size(28, 28), + FlatStyle = FlatStyle.Flat, + Font = new Font("Segoe UI", 10f), + Cursor = Cursors.Hand, + FlatAppearance = { BorderColor = BorderColor, BorderSize = 1 }, + BackColor = Color.FromArgb(241, 245, 249) + }; + + private CheckBox CreateCheckBox(string text, int x, int y) => new CheckBox + { + Text = text, + Location = new Point(x, y), + Font = new Font("Segoe UI", 8.25f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + + private void CarregarConfig() + { + BLLEmpresaConfig empresaConfig = new BLLEmpresaConfig(_connectionString); + int codEmpresa = empresaConfig.ObterEmpresaAtivaId(); + if (codEmpresa > 0) + { + ModeloEmpresaConfig modelo = empresaConfig.ObterPorEmpresa(codEmpresa); + this.txtId.Text = modelo.IdEmpresaConfig.ToString(); + this.txtEmpresaId.Text = modelo.IdEmpresa.ToString(); + this.txtNomeSistema.Text = modelo.NomeSistema; + this.txtCorPrimaria.Text = modelo.CorPrimaria; + this.txtCorSecundaria.Text = modelo.CorSecundaria; + this.txtLogo.Text = modelo.Logo; + this.txtFavicon.Text = modelo.Favicon; + this.txtDiasGarantiaPadrao.Text = modelo.DiasGarantiaPadrao.ToString(); + this.chkExibirCPF.Checked = modelo.ExibirCPFCliente; + this.chkExibirTelefone.Checked = modelo.ExibirTelefoneCliente; + this.chkExibirGarantia.Checked = modelo.ExibirGarantia; + this.chkGerarRecibo.Checked = modelo.GerarReciboAutomatico; + this.chkExibirValoresOS.Checked = modelo.ExibirValoresOS; + this.chkEmailAuto.Checked = modelo.EnviarEmailAutomatico; + this.chkWhatsAuto.Checked = modelo.EnviarWhatsappAutomatico; + this.chkModoEscuro.Checked = modelo.ModoEscuro; + this.chkPermitirEdicaoOS.Checked = modelo.PermitirEdicaoOSFinalizada; + this.txtCriadoEm.Text = modelo.CriadoEm.ToString(); + this.txtAtualizadoEm.Text = modelo.AtualizadoEm.ToString(); + } + else + { + NT_MessageBox.Show("Erro ao recuperar configuração da empresa, por favor contacte o administrador do sistema","Erro",MessageBoxButtons.OK,MessageBoxIcon.Error); + } + } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.resx b/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Cadastros/EmpresaConfiguracoesPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.cs b/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.cs new file mode 100644 index 0000000..8a5958a --- /dev/null +++ b/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.cs @@ -0,0 +1,947 @@ +using BLL; +using CustomMessageBox; +using DAL; +using MLL; +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Windows.Forms; +using AForge.Video; +using AForge.Video.DirectShow; + +namespace UI +{ + public class FuncionariosCadastroPanel : UserControl + { + private int idBanco = 0; + private string _cx = DadosDaConexao.ObterConexao(); + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + + private Panel pnlToolbar = null!; + private Panel mainScroll = null!; + private Panel content = null!; + + // Identificação + private RoundTextBox txtId = null!, txtCodigo = null!, txtNome = null!; + private RoundTextBox txtCPF = null!, txtCI = null!, txtCTPS = null!; + private RoundTextBox txtCNH = null!, txtCatCNH = null!; + private RoundTextBox txtECivil = null!, txtRegime = null!; + + // Filiação + private RoundTextBox txtPai = null!, txtMae = null!; + + // Endereço + private RoundTextBox txtcep=null!, txtEndereco = null!,txtEndNumero=null!, txtBairro = null!, txtCidade = null!, txtUF = null!; + + // Dados Bancários + private RoundTextBox txtBanco = null!, txtAgencia = null!, txtConta = null!; + private RoundComboBox cbBanco = null!; + + // Contato + private RoundTextBox txtTelefone = null!; + + // Acesso + private RoundTextBox txtPass = null!; + private CheckBox chkMasterUser = null!, chkVendedor = null!, chkTecnico = null!; + private CheckBox chkDemitido = null!, chkContador = null!, chkOutros = null!; + + // Outros + private RoundTextBox txtFPath = null!, txtObserv = null!; + + // Datas + private RoundTextBox txtDataAdm = null!, txtDataDem = null!, txtAniver = null!; + + // ── CARREGAR FUNCIONÁRIO ────────────────────────────────────────────── + + private void CarregarFuncionario(int id) + { + //var bll = new BLLFuncionarios(_cx); + //var f = bll.CarregarPorId(id); + + //if (f == null) + //{ + // NT_MessageBox.Show("Funcionário não encontrado.", + // "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + // return; + //} + + //PreencherCampos(f); + } + + private void PreencherCampos(ModeloFuncionarios f) + { + txtId.Text = f.ID_FUNCIONARIO.ToString(); + txtCodigo.Text = f.CODIGO; + txtNome.Text = f.NOME; + txtPai.Text = f.PAI; + txtMae.Text = f.MAE; + txtCPF.Text = f.CPF; + txtCI.Text = f.CI; + txtCTPS.Text = f.CTPS; + txtCNH.Text = f.CNH; + txtCatCNH.Text = f.CAT_CNH; + txtECivil.Text = f.ECIVIL; + txtRegime.Text = f.REGIME; + txtEndereco.Text = f.ENDERECO; + txtBairro.Text = f.BAIRRO; + txtCidade.Text = f.CIDADE; + txtUF.Text = f.UF; + txtBanco.Text = f.BANCO; + txtAgencia.Text = f.AGENCIA; + txtConta.Text = f.CONTA; + txtTelefone.Text = f.TELEFONE; + txtPass.Text = f.PASS; + txtFPath.Text = f.FPATH; + txtObserv.Text = f.OBSERV; + //txtDataAdm.Text = f.DATA_ADM; + //txtDataDem.Text = f.DATA_DEM; + //txtAniver.Text = f.ANIVER; + + //chkMasterUser.Checked = f.MASTERUSER == "S"; + //chkVendedor.Checked = f.VENDEDOR == "S"; + //chkTecnico.Checked = f.TECNICO == "S"; + //chkDemitido.Checked = f.DEMITIDO == "S"; + //chkContador.Checked = f.FTECNICO == "S"; + //chkOutros.Checked = f.FVENDEDOR == "S"; + } + private Control[] TodosOsControles() => new Control[]{ + txtCodigo, txtNome, + txtCPF, txtCI, txtCTPS, txtCNH, txtCatCNH, + txtECivil, txtRegime, + txtPai, txtMae, + txtcep, txtEndereco, txtEndNumero, txtBairro, txtCidade, txtUF, + + // 👇 ComboBox entra aqui + cbBanco, + + txtAgencia, txtConta, + txtTelefone, + txtPass, + txtFPath, txtObserv, + txtDataAdm, txtDataDem, txtAniver +};//todos os controles + private void SetCamposAtulizado(bool enabled) + { + foreach (var ctrl in TodosOsControles()) + { + ctrl.Enabled = enabled; + + // 🎨 Se for TextBox + if (ctrl is RoundTextBox txt) + { + txt.BackColor = enabled + ? Color.White + : Color.FromArgb(241, 245, 249); + } + + // 🎨 Se for ComboBox + else if (ctrl is RoundComboBox cmb) + { + cmb.BackColor = enabled + ? Color.White + : Color.FromArgb(241, 245, 249); + } + } + + foreach (var chk in TodosOsChecks()) + chk.Enabled = enabled; + }//SetCampos + private void CarregarComboBoxAtualizada() + { + BLLBancos bLLBancos = new BLLBancos(_cx); + + var tabela = bLLBancos.LocalizarTodos(); + + // 🔥 cria coluna personalizada + tabela.Columns.Add("EXIBICAO", typeof(string), "NUMERO + ' - ' + NOME"); + + cbBanco.DataSource = tabela; + cbBanco.DisplayMember = "EXIBICAO"; // 👈 aqui + cbBanco.ValueMember = "ID_BANCOS"; + + if (cbBanco.SelectedValue != null) + this.idBanco = Convert.ToInt32(cbBanco.SelectedValue); + }//CarregarComboBoxAtualizada + private DateTime? ConverterData(string texto) + { + if (string.IsNullOrWhiteSpace(texto)) + return null; + + if (DateTime.TryParse(texto, out DateTime data)) + return data; + + return null; + }//ConverterData + + public FuncionariosCadastroPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + InitializeLayout(); + this.CarregarComboBoxAtualizada(); + } + + private void InitializeLayout() + { + this.Controls.Clear(); + + // ── TOOLBAR ─────────────────────────────────────────────────────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = Color.FromArgb(248, 250, 252), + BorderStyle = BorderStyle.None + }; + + var flowButtons = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + var btnNovo = CreateToolbarButton("Novo", Color.FromArgb(34, 197, 94)); + var btnAlterar = CreateToolbarButton("Alterar", Color.FromArgb(245, 158, 11)); + var btnExcluir = CreateToolbarButton("Excluir", Color.FromArgb(239, 68, 68)); + var btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + var btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + var btnGerarFicha = CreateToolbarButton("Gerar Ficha", Color.FromArgb(255,0,0)); + var btnCancelar = CreateToolbarButton("Cancelar", Color.FromArgb(148, 163, 184)); + + btnNovo.Click += (s, e) => BtnNovo_Click(); + btnAlterar.Click += (s, e) => BtnAlterar_Click(); + btnExcluir.Click += (s, e) => BtnExcluir_Click(); + btnLocalizar.Click += (s, e) => BtnLocalizar_Click(); + btnSalvar.Click += (s, e) => BtnSalvar_Click(); + btnCancelar.Click += (s, e) => BtnCancelar_Click(); + btnGerarFicha.Click += (s, e) => BtnFichaFuncionario_Click(); + flowButtons.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar,btnGerarFicha,btnCancelar }); + pnlToolbar.Controls.Add(flowButtons); + this.Controls.Add(pnlToolbar); + + // ── SCROLL + CONTENT ────────────────────────────────────────────── + mainScroll = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White + }; + this.Controls.Add(mainScroll); + mainScroll.BringToFront(); + + content = new Panel + { + Width = 1100, + Height = 900, + Location = new Point(0, 0), + BackColor = Color.White + }; + mainScroll.Controls.Add(content); + + const int rowH = 52; + const int secGap = 10; + const int secH = 28; + const int inputH = 28; + + int y = 10; + + // ── 1. IDENTIFICAÇÃO DO FUNCIONÁRIO ─────────────────────────────── + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO FUNCIONÁRIO", y)); + y += secH + 4; + + txtId = AddInput(content, "ID", 20, y, 60, inputH, readOnly: true); + txtCodigo = AddInput(content, "Código", 90, y, 100, inputH, readOnly: true); + txtNome = AddInput(content, "Nome", 200, y, 450, inputH); + y += rowH; + + txtCPF = AddInput(content, "CPF", 20, y, 160, inputH); + DocumentoHelper.Registrar(txtCPF); + txtCI = AddInput(content, "RG / CI", 190, y, 160, inputH); + txtCTPS = AddInput(content, "CTPS", 360, y, 140, inputH); + txtCNH = AddInput(content, "CNH", 510, y, 160, inputH); + txtCatCNH = AddInput(content, "Cat. CNH", 680, y, 90, inputH); + y += rowH; + + txtECivil = AddInput(content, "Estado Civil", 20, y, 160, inputH); + txtRegime = AddInput(content, "Regime", 190, y, 160, inputH); + + // ── 2. FILIAÇÃO ─────────────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("FILIAÇÃO", y)); + y += secH + 4; + + txtPai = AddInput(content, "Nome do Pai", 20, y, 400, inputH); + txtMae = AddInput(content, "Nome da Mãe", 430, y, 400, inputH); + + + // ── 3. ENDEREÇO ───────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("ENDEREÇO", y)); + y += secH + 4; + + // LINHA ÚNICA + txtcep = AddInput(content, "CEP", 20, y, 80, inputH); + txtcep.Leave += (s, e) => + { + string cep = txtcep.Text.Trim().Replace("-", ""); + + if (cep.Length != 8) return; + + if (TLL.VerifyCep.verificaCEP(cep)) + { + txtEndereco.Text = TLL.VerifyCep.endereco; + txtBairro.Text = TLL.VerifyCep.bairro; + txtCidade.Text = TLL.VerifyCep.cidade; + txtUF.Text = TLL.VerifyCep.estado; + + // Formata o CEP com hífen + txtcep.Text = $"{cep[..5]}-{cep[5..]}"; + } + else + { + NT_MessageBox.Show("CEP não encontrado.", "CEP", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + };//cep + txtEndereco = AddInput(content, "Logradouro", 110, y, 260, inputH); + txtEndNumero = AddInput(content, "Nº", 380, y, 70, inputH); + txtBairro = AddInput(content, "Bairro", 460, y, 150, inputH); + txtCidade = AddInput(content, "Cidade", 620, y, 150, inputH); + txtUF = AddInput(content, "UF", 780, y, 60, inputH); + + // ── 4. DADOS BANCÁRIOS ──────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("DADOS BANCÁRIOS", y)); + y += secH + 4; + + //txtBanco = AddInput(content, "Banco", 20, y, 280, inputH); + cbBanco = AddComboBox(content, "Banco", 20, y, 200, inputH); + txtAgencia = AddInput(content, "Agência", 310, y, 160, inputH); + txtConta = AddInput(content, "Conta", 480, y, 160, inputH); + + // ── 5. CONTATO ──────────────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("CONTATO", y)); + y += secH + 4; + + txtTelefone = AddInput(content, "Telefone", 20, y, 200, inputH); + + // ── 6. ACESSO AO SISTEMA ────────────────────────────────────────── + y += rowH + secGap; + content.Controls.Add(CreateSectionHeader("ACESSO AO SISTEMA", y)); + y += secH + 4; + + txtPass = AddInput(content, "Senha", 20, y, 200, inputH); + txtPass.PasswordChar = '*'; + y += rowH; + + chkMasterUser = CreateCheckBox("Master User", 20, y); + chkVendedor = CreateCheckBox("Vendedor", 160, y); + chkTecnico = CreateCheckBox("Técnico", 290, y); + chkOutros = CreateCheckBox("Outros", 420, y); + chkContador = CreateCheckBox("Contador", 560, y); + chkDemitido = CreateCheckBox("Demitido", 690, y); + + content.Controls.AddRange(new Control[] + { chkMasterUser, chkVendedor, chkTecnico, chkOutros, chkContador, chkDemitido }); + + // ── 7. OUTROS ───────────────────────────────────────────────────── + y += 35 + secGap; + content.Controls.Add(CreateSectionHeader("OUTROS", y)); + y += secH + 4; + + // Label da foto + var lblFoto = new Label + { + Text = "Caminho da Foto (FPATH)", + Location = new Point(20, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + content.Controls.Add(lblFoto); + + // Campo de texto da foto (menor para dar espaço ao botão lupa) + txtFPath = new RoundTextBox + { + Location = new Point(20, y + 16), + Size = new Size(560, inputH), + Radius = 4, + BorderColor = BorderColor, + FocusColor = AccentBlue, + BackColor = Color.White + }; + content.Controls.Add(txtFPath); + + // Botão lupa 🔍 + var btnFoto = new Button + { + Text = "🔍", + Location = new Point(588, y + 16), + Size = new Size(36, inputH), + FlatStyle = FlatStyle.Flat, + BackColor = Color.FromArgb(37, 99, 235), + ForeColor = Color.White, + Font = new Font("Segoe UI", 11f), + Cursor = Cursors.Hand, + TabStop = false + }; + btnFoto.FlatAppearance.BorderSize = 0; + btnFoto.Click += (s, e) => BtnFoto_Click(); + content.Controls.Add(btnFoto); + + y += rowH; + + txtObserv = AddInput(content, "Observações", 20, y, 920, inputH); + txtObserv.Multiline = true; + txtObserv.Height = 60; + + // ── 8. DATAS ────────────────────────────────────────────────────── + y += 70 + secGap; + content.Controls.Add(CreateSectionHeader("DATAS", y)); + y += secH + 4; + + txtDataAdm = AddInput(content, "Data de Admissão", 20, y, 175, inputH); + txtDataDem = AddInput(content, "Data de Demissão", 205, y, 175, inputH); + txtAniver = AddInput(content, "Aniversário", 390, y, 175, inputH); + y += rowH; + + content.Height = y + 10; + + //SetCampos(false); + SetCamposAtulizado(false); + } + + // ── FOTO: LUPA ──────────────────────────────────────────────────────── + + private void BtnFoto_Click() + { + using var dlg = new FotoOrigemDialog(); + if (dlg.ShowDialog() != DialogResult.OK) return; + + string? caminhoSalvo = dlg.UsarWebcam + ? CapturarDaWebcam() + : SelecionarDoComputador(); + + if (!string.IsNullOrEmpty(caminhoSalvo)) + txtFPath.Text = caminhoSalvo; + } + + private string? SelecionarDoComputador() + { + using var ofd = new OpenFileDialog + { + Title = "Selecionar Foto do Funcionário", + Filter = "Imagens|*.jpg;*.jpeg;*.png;*.bmp|Todos os arquivos|*.*" + }; + + if (ofd.ShowDialog() != DialogResult.OK) return null; + + return SalvarFoto(ofd.FileName); + } + + private string? CapturarDaWebcam() + { + using var webcamForm = new WebcamCaptureForm(); + if (webcamForm.ShowDialog() != DialogResult.OK) return null; + if (webcamForm.ImagemCapturada == null) return null; + + string temp = Path.Combine(Path.GetTempPath(), $"webcam_{Guid.NewGuid()}.jpg"); + webcamForm.ImagemCapturada.Save(temp, ImageFormat.Jpeg); + return SalvarFoto(temp); + } + + private string SalvarFoto(string origem) + { + const string pasta = @"C:\Levelcode\LevelOS\Uploads\Images\Funcionarios"; + Directory.CreateDirectory(pasta); + + // Nome: NomeFuncionario_yyyyMMdd_HHmmss.jpg + string nomeBase = string.IsNullOrWhiteSpace(txtNome.Text) + ? "Funcionario" + : txtNome.Text.Trim().Replace(" ", "_"); + + string nomeArq = $"{nomeBase}_{DateTime.Now:yyyyMMdd_HHmmss}.jpg"; + string destino = Path.Combine(pasta, nomeArq); + + File.Copy(origem, destino, overwrite: true); + return destino; + } + + // ── CAMPOS ──────────────────────────────────────────────────────────── + + private RoundTextBox[] TodosOsCampos() => new[] + { + txtCodigo, txtNome, + txtCPF, txtCI, txtCTPS, txtCNH, txtCatCNH, + txtECivil, txtRegime, + txtPai, txtMae, + txtcep,txtEndereco,txtEndNumero, txtBairro, txtCidade, txtUF, + /*txtBanco,*/ txtAgencia, txtConta, + txtTelefone, + txtPass, + txtFPath, txtObserv, + txtDataAdm, txtDataDem, txtAniver + }; + + private CheckBox[] TodosOsChecks() => new[] + { + chkMasterUser, chkVendedor, chkTecnico, + chkDemitido, chkContador, chkOutros + }; + + private void SetCampos(bool enabled) + { + foreach (var campo in TodosOsCampos()) + { + campo.Enabled = enabled; + campo.BackColor = enabled ? Color.White : Color.FromArgb(241, 245, 249); + } + foreach (var chk in TodosOsChecks()) + chk.Enabled = enabled; + } + + // ── EVENTOS ─────────────────────────────────────────────────────────── + + private void BtnNovo_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + foreach (var chk in TodosOsChecks()) + chk.Checked = false; + + //SetCampos(true); + SetCamposAtulizado(true); + } + + private void BtnAlterar_Click() + { + if (string.IsNullOrWhiteSpace(txtId.Text)) + { + NT_MessageBox.Show( + "Nenhum registro selecionado para alterar.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + //SetCampos(true); + SetCamposAtulizado(true); + txtId.Enabled = false; + txtId.BackColor = Color.FromArgb(241, 245, 249); + } + + private void BtnExcluir_Click() + { + + } + + private void BtnLocalizar_Click() + { + // Abre tela/diálogo de busca e preenche os campos + } + + private void BtnSalvar_Click() + { + var bll = new BLLFuncionarios(_cx); + + if (string.IsNullOrWhiteSpace(txtNome.Text) || + string.IsNullOrWhiteSpace(txtCPF.Text)) + { + NT_MessageBox.Show("Preencha ao menos Nome e CPF.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + bool isNew = string.IsNullOrWhiteSpace(txtId.Text); + + var funcionario = new ModeloFuncionarios + { + ID_FUNCIONARIO = isNew ? 0 : int.Parse(txtId.Text), + + CODIGO = txtCodigo.Text, + NOME = txtNome.Text, + PAI = txtPai.Text, + MAE = txtMae.Text, + CPF = txtCPF.Text, + CI = txtCI.Text, + CTPS = txtCTPS.Text, + CNH = txtCNH.Text, + CAT_CNH = txtCatCNH.Text, + ECIVIL = txtECivil.Text, + REGIME = txtRegime.Text, + + CEP = txtcep.Text, + ENDERECO = txtEndereco.Text, + ENDNUMERO = txtEndNumero.Text, + BAIRRO = txtBairro.Text, + CIDADE = txtCidade.Text, + UF = txtUF.Text, + + // 🔥 BANCO vindo do ComboBox + BANCO = cbBanco.SelectedValue?.ToString(), + + AGENCIA = txtAgencia.Text, + CONTA = txtConta.Text, + TELEFONE = txtTelefone.Text, + PASS = txtPass.Text, + + // 🔥 BOOL correto + MASTERUSER = chkMasterUser.Checked, + VENDEDOR = chkVendedor.Checked, + TECNICO = chkTecnico.Checked, + DEMITIDO = chkDemitido.Checked, + + FTECNICO = chkContador.Checked ? "1" : null, + FVENDEDOR = chkOutros.Checked ? "1" : null, + + FPATH = txtFPath.Text, + OBSERV = txtObserv.Text, + + // 🔥 DATAS + DATA_ADM = ConverterData(txtDataAdm.Text), + DATA_DEM = ConverterData(txtDataDem.Text), + ANIVER = ConverterData(txtAniver.Text) + }; + + bool sucesso = isNew + ? bll.Inserir(funcionario) + : bll.Alterar(funcionario); + + if (!sucesso) + { + NT_MessageBox.Show("Erro ao salvar funcionário.", + "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + SetCampos(false); + + NT_MessageBox.Show("Funcionário salvo com sucesso!", "Sucesso", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void BtnFichaFuncionario_Click() + { + var bll = new BLLFuncionarios(_cx); + + var funcionario = bll.CarregarPorCodigo("100"); + + if (funcionario == null) + { + MessageBox.Show("Funcionário não encontrado."); + return; + } + + var resultado = TLL.FichaFuncionarioPDF.GerarEAbrir(funcionario); + + if (!resultado.Sucesso) + MessageBox.Show(resultado.Mensagem, "Erro", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + private void BtnCancelar_Click() + { + foreach (var campo in TodosOsCampos()) + campo.Text = string.Empty; + + foreach (var chk in TodosOsChecks()) + chk.Checked = false; + + //SetCampos(false); + SetCamposAtulizado(false); + //this.cbBanco.Enabled = false; + + } + + // ── HELPERS ─────────────────────────────────────────────────────────── + + private Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 1000, Height = 26 }; + var lbl = new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true, + Location = new Point(0, 0) + }; + var line = new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 980, + Location = new Point(0, 20) + }; + pnl.Controls.Add(lbl); + pnl.Controls.Add(line); + return pnl; + } + + private RoundTextBox AddInput(Control parent, string label, + int x, int y, int width, int height, + bool readOnly = false) + { + var lbl = new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }; + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + Radius = 4, + BorderColor = readOnly ? Color.FromArgb(203, 213, 225) : BorderColor, + FocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? Color.FromArgb(241, 245, 249) : Color.White + }; + parent.Controls.Add(lbl); + parent.Controls.Add(txt); + return txt; + } + private RoundComboBox AddComboBox(Control parent, string label, + int x, int y, int width, int height) + { + var lbl = new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + var cb = new RoundComboBox + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + Radius = 4, + BorderColor = BorderColor, + FocusColor = AccentBlue, + BackColor = Color.White + }; + parent.Controls.Add(lbl); + parent.Controls.Add(cb); + return cb; + } + + private CheckBox CreateCheckBox(string text, int x, int y) => new CheckBox + { + Text = text, + Location = new Point(x, y), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + } + + // ══════════════════════════════════════════════════════════════════════════ + // DIALOG: Escolher origem da foto (Computador ou Webcam) + // ══════════════════════════════════════════════════════════════════════════ + + public class FotoOrigemDialog : Form + { + public bool UsarWebcam { get; private set; } + + public FotoOrigemDialog() + { + Text = "Selecionar Foto"; + Size = new Size(340, 160); + StartPosition = FormStartPosition.CenterParent; + FormBorderStyle = FormBorderStyle.FixedDialog; + MaximizeBox = false; + MinimizeBox = false; + BackColor = Color.White; + + var lbl = new Label + { + Text = "Como deseja adicionar a foto?", + Font = new Font("Segoe UI", 9.5f), + Location = new Point(20, 18), + AutoSize = true + }; + + var btnComputador = new Button + { + Text = "📁 Do Computador", + Location = new Point(20, 55), + Size = new Size(140, 38), + FlatStyle = FlatStyle.Flat, + BackColor = Color.FromArgb(37, 99, 235), + ForeColor = Color.White, + Font = new Font("Segoe UI", 9f), + Cursor = Cursors.Hand + }; + btnComputador.FlatAppearance.BorderSize = 0; + btnComputador.Click += (s, e) => + { + UsarWebcam = false; + DialogResult = DialogResult.OK; + Close(); + }; + + var btnWebcam = new Button + { + Text = "📷 Webcam", + Location = new Point(172, 55), + Size = new Size(140, 38), + FlatStyle = FlatStyle.Flat, + BackColor = Color.FromArgb(16, 185, 129), + ForeColor = Color.White, + Font = new Font("Segoe UI", 9f), + Cursor = Cursors.Hand + }; + btnWebcam.FlatAppearance.BorderSize = 0; + btnWebcam.Click += (s, e) => + { + UsarWebcam = true; + DialogResult = DialogResult.OK; + Close(); + }; + + Controls.AddRange(new Control[] { lbl, btnComputador, btnWebcam }); + } + } + + // ══════════════════════════════════════════════════════════════════════════ + // FORM: Captura pela Webcam usando AForge + // ══════════════════════════════════════════════════════════════════════════ + + public class WebcamCaptureForm : Form + { + public Bitmap? ImagemCapturada { get; private set; } + + private PictureBox picPreview = null!; + private VideoCaptureDevice? _camera; + private Bitmap? _frameAtual; + + public WebcamCaptureForm() + { + Text = "Capturar Foto pela Webcam"; + Size = new Size(680, 560); + StartPosition = FormStartPosition.CenterParent; + FormBorderStyle = FormBorderStyle.FixedDialog; + MaximizeBox = false; + BackColor = Color.FromArgb(15, 23, 42); + + picPreview = new PictureBox + { + Location = new Point(20, 20), + Size = new Size(628, 440), + SizeMode = PictureBoxSizeMode.Zoom, + BackColor = Color.Black + }; + Controls.Add(picPreview); + + var btnCapturar = new Button + { + Text = "📷 Capturar", + Location = new Point(20, 475), + Size = new Size(200, 38), + FlatStyle = FlatStyle.Flat, + BackColor = Color.FromArgb(37, 99, 235), + ForeColor = Color.White, + Font = new Font("Segoe UI", 9.5f), + Cursor = Cursors.Hand + }; + btnCapturar.FlatAppearance.BorderSize = 0; + btnCapturar.Click += BtnCapturar_Click; + Controls.Add(btnCapturar); + + var btnCancelar = new Button + { + Text = "Cancelar", + Location = new Point(234, 475), + Size = new Size(120, 38), + FlatStyle = FlatStyle.Flat, + BackColor = Color.FromArgb(100, 116, 139), + ForeColor = Color.White, + Font = new Font("Segoe UI", 9.5f), + Cursor = Cursors.Hand + }; + btnCancelar.FlatAppearance.BorderSize = 0; + btnCancelar.Click += (s, e) => { PararCamera(); DialogResult = DialogResult.Cancel; Close(); }; + Controls.Add(btnCancelar); + + FormClosing += (s, e) => PararCamera(); + + IniciarCamera(); + } + + private void IniciarCamera() + { + var cameras = new FilterInfoCollection(FilterCategory.VideoInputDevice); + + if (cameras.Count == 0) + { + MessageBox.Show("Nenhuma webcam encontrada.", "Webcam", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + DialogResult = DialogResult.Cancel; + Close(); + return; + } + + _camera = new VideoCaptureDevice(cameras[0].MonikerString); + _camera.NewFrame += Camera_NewFrame; + _camera.Start(); + } + + private void Camera_NewFrame(object sender, NewFrameEventArgs e) + { + _frameAtual?.Dispose(); + _frameAtual = (Bitmap)e.Frame.Clone(); + + picPreview.Invoke((MethodInvoker)(() => + { + picPreview.Image?.Dispose(); + picPreview.Image = (Bitmap)_frameAtual.Clone(); + })); + } + + private void BtnCapturar_Click(object? sender, EventArgs e) + { + if (_frameAtual == null) + { + MessageBox.Show("Aguarde a câmera inicializar.", "Atenção", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + ImagemCapturada = (Bitmap)_frameAtual.Clone(); + PararCamera(); + DialogResult = DialogResult.OK; + Close(); + } + + private void PararCamera() + { + if (_camera != null && _camera.IsRunning) + { + _camera.SignalToStop(); + _camera.WaitForStop(); + } + } + } +} diff --git a/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.resx b/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Cadastros/FuncionariosCadastroPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Configurações/Database/FrmConfigBanco.cs b/UI/Dashboards/Configurações/Database/FrmConfigBanco.cs new file mode 100644 index 0000000..6914ab6 --- /dev/null +++ b/UI/Dashboards/Configurações/Database/FrmConfigBanco.cs @@ -0,0 +1,338 @@ +using CCH; +using CustomMessageBox; +using DAL; +using Microsoft.Data.SqlClient; // Certifique-se de ter este pacote NuGet instalado +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; +using TLL; + +namespace UI +{ + public class FrmConfigBanco : Form + { + // ── Cores LevelOS ────────────────────────────────────────────────── + private static readonly Color Surface = Color.White; + private static readonly Color Surface2 = Color.FromArgb(241, 245, 249); + private static readonly Color BorderCol = Color.FromArgb(226, 232, 240); + private static readonly Color TextPri = Color.FromArgb(15, 23, 42); + private static readonly Color TextSec = Color.FromArgb(71, 85, 105); + private static readonly Color TextMuted = Color.FromArgb(148, 163, 184); + private static readonly Color Blue = Color.FromArgb(37, 99, 235); + private static readonly Color Green = Color.FromArgb(22, 163, 74); + private static readonly Color Red = Color.FromArgb(220, 38, 38); + private static readonly Color NavyDark = Color.FromArgb(15, 30, 60); + + // ── Controles ────────────────────────────────────────────────────── + private readonly TextBox txtHost = new(); + private readonly TextBox txtPort = new(); + private readonly TextBox txtBanco = new(); + private readonly TextBox txtUsuario = new(); + private readonly TextBox txtSenha = new(); + private readonly TextBox txtTimeout = new(); + private readonly CheckBox chkEncrypt = new(); + private readonly CheckBox chkTrust = new(); + private readonly Button btnSalvar = new(); + private readonly Button btnTestar = new(); + private readonly Button btnCancelar = new(); + private readonly Label lblStatus = new(); + + public FrmConfigBanco() + { + Text = "LevelOS — Configuração do Banco de Dados"; + Size = new Size(660, 680); + StartPosition = FormStartPosition.CenterScreen; + BackColor = Surface2; + FormBorderStyle = FormBorderStyle.FixedDialog; + MaximizeBox = false; + + BuildLayout(); + CarregarValores(); + + // ── Eventos ────────────────────────────────────────────────── + btnSalvar.Click += BtnSalvar_Click; + btnTestar.Click += BtnTestar_Click; + btnCancelar.Click += (s, e) => Close(); + + //Carregar dados + if (!File.Exists(AppFileSystem.AppFileDBSystem)) + { + NT_MessageBox.Show("Arquivo de configuração do banco de dados ausente, por favor contacte o administrador do sistema para solucionar o problema", "Erro de SQL:101", + MessageBoxButtons.OK,MessageBoxIcon.Error); + } + else + { + DatabaseHelper.Carregar(AppFileSystem.AppFileDBSystem, AppInfoSystem.AppKeyMasterCrip); + this.txtHost.Text = DadosDaConexao.Host; + this.txtPort.Text = DadosDaConexao.Port.ToString(); + this.txtBanco.Text = DadosDaConexao.Banco; + this.txtUsuario.Text = DadosDaConexao.Usuario; + this.txtSenha.Text = DadosDaConexao.Senha; + this.chkEncrypt.Checked = DadosDaConexao.Encrypt; + this.txtTimeout.Text = DadosDaConexao.ConnectTimeout.ToString(); + this.chkTrust.Checked = DadosDaConexao.TrustServerCertificate; + } + } + + private void BuildLayout() + { + // 1. TOPBAR + var topbar = new Panel { Dock = DockStyle.Top, Height = 75, BackColor = NavyDark }; + topbar.Paint += DrawTopbar; + Controls.Add(topbar); + + // 2. RODAPÉ + var footer = new Panel { Dock = DockStyle.Bottom, Height = 65, BackColor = Surface }; + footer.Paint += (s, e) => e.Graphics.DrawLine(new Pen(BorderCol), 0, 0, footer.Width, 0); + Controls.Add(footer); + + StyleButton(btnCancelar, "Cancelar", Surface, TextSec, BorderCol); + btnCancelar.SetBounds(20, 15, 100, 35); + btnCancelar.Anchor = AnchorStyles.Left; + footer.Controls.Add(btnCancelar); + + StyleButton(btnSalvar, "✔ Salvar", Blue, Color.White); + btnSalvar.SetBounds(footer.Width - 120, 15, 100, 35); + btnSalvar.Anchor = AnchorStyles.Right; + footer.Controls.Add(btnSalvar); + + StyleButton(btnTestar, "Testar conexão", Surface, TextPri, BorderCol); + btnTestar.SetBounds(btnSalvar.Left - 145, 15, 135, 35); + btnTestar.Anchor = AnchorStyles.Right; + footer.Controls.Add(btnTestar); + + lblStatus.SetBounds(130, 15, 250, 35); + lblStatus.TextAlign = ContentAlignment.MiddleLeft; + lblStatus.Font = new Font("Segoe UI", 9f); + lblStatus.Anchor = AnchorStyles.Left | AnchorStyles.Right; + footer.Controls.Add(lblStatus); + + // 3. CONTAINER DE CONTEÚDO + var pnlContainer = new Panel { Dock = DockStyle.Fill, AutoScroll = true, Padding = new Padding(0, 10, 0, 20) }; + Controls.Add(pnlContainer); + pnlContainer.BringToFront(); + + // 4. CARD BRANCO + var card = new Panel { BackColor = Surface, Width = 560, Left = 40, Top = 20 }; + pnlContainer.Controls.Add(card); + + int cy = 30; + + cy = AddSection(card, "SERVIDOR", cy); + AddLabel(card, "Host / IP", 30, cy); + AddLabel(card, "Porta", 430, cy); + cy += 20; + StyleInput(txtHost, "ex: localhost ou 192.168.0.1"); + txtHost.SetBounds(30, cy, 385, 30); card.Controls.Add(txtHost); + StyleInput(txtPort, "1433"); + txtPort.SetBounds(430, cy, 100, 30); card.Controls.Add(txtPort); + cy += 45; + + cy = AddSection(card, "BANCO DE DADOS", cy); + AddLabel(card, "Nome do Banco", 30, cy); + cy += 20; + StyleInput(txtBanco, "ex: LevelOS_DB"); + txtBanco.SetBounds(30, cy, 500, 30); card.Controls.Add(txtBanco); + cy += 45; + + cy = AddSection(card, "AUTENTICAÇÃO", cy); + AddLabel(card, "Usuário", 30, cy); + AddLabel(card, "Senha", 285, cy); + cy += 20; + StyleInput(txtUsuario, "sa"); + txtUsuario.SetBounds(30, cy, 245, 30); card.Controls.Add(txtUsuario); + StyleInput(txtSenha, "••••••••"); + txtSenha.SetBounds(285, cy, 245, 30); txtSenha.PasswordChar = '●'; card.Controls.Add(txtSenha); + cy += 45; + + cy = AddSection(card, "AVANÇADO", cy); + AddLabel(card, "Timeout de conexão (segundos)", 30, cy); + cy += 20; + StyleInput(txtTimeout, "3"); + txtTimeout.SetBounds(30, cy, 100, 30); card.Controls.Add(txtTimeout); + cy += 40; + + StyleCheckbox(chkEncrypt, "Encrypt Connection"); + chkEncrypt.SetBounds(30, cy, 250, 25); card.Controls.Add(chkEncrypt); + cy += 30; + StyleCheckbox(chkTrust, "Trust Server Certificate"); + chkTrust.SetBounds(30, cy, 250, 25); card.Controls.Add(chkTrust); + cy += 40; + + card.Height = cy; + } + + // ── Lógica de Negócio ────────────────────────────────────────────── + + private void CarregarValores() + { + txtHost.Text = DbConfig.Host; + txtPort.Text = DbConfig.Port.ToString(); + txtBanco.Text = DbConfig.Banco; + txtUsuario.Text = DbConfig.Usuario; + txtSenha.Text = DbConfig.Senha; + txtTimeout.Text = DbConfig.ConnectTimeout.ToString(); + chkEncrypt.Checked = DbConfig.Encrypt; + chkTrust.Checked = DbConfig.TrustServerCertificate; + } + + private void BtnSalvar_Click(object? sender, EventArgs e) + { + if (!Validar()) return; + + DbConfig.Host = txtHost.Text.Trim(); + DbConfig.Port = int.TryParse(txtPort.Text, out int p) ? p : 1433; + DbConfig.Banco = txtBanco.Text.Trim(); + DbConfig.Usuario = txtUsuario.Text.Trim(); + DbConfig.Senha = txtSenha.Text; + DbConfig.ConnectTimeout = int.TryParse(txtTimeout.Text, out int t) ? t : 3; + DbConfig.Encrypt = chkEncrypt.Checked; + DbConfig.TrustServerCertificate = chkTrust.Checked; + + //Preenchendo dados da conexao + DadosDaConexao.Host = DbConfig.Host; + DadosDaConexao.Port = DbConfig.Port; + DadosDaConexao.Banco =DbConfig.Banco; + DadosDaConexao.Usuario = DbConfig.Usuario; + DadosDaConexao.Senha = DbConfig.Senha; + DadosDaConexao.ConnectTimeout = DbConfig.ConnectTimeout; + DadosDaConexao.Encrypt = chkEncrypt.Checked; + DadosDaConexao.TrustServerCertificate = chkTrust.Checked; + //salvar em arquivo criptografado + DatabaseHelper.Salvar(AppFileSystem.AppFileDBSystem, AppInfoSystem.AppKeyMasterCrip); + + + SetStatus("✔ Configurações salvas!", Green); + } + + private void BtnTestar_Click(object? sender, EventArgs e) + { + if (!Validar()) return; + + SetStatus("⏳ Testando...", TextMuted); + btnTestar.Enabled = false; + Application.DoEvents(); // Força a interface a atualizar o status + + try + { + using var conn = new SqlConnection(BuildConnStr()); + conn.Open(); + SetStatus($"✔ Conectado! SQL {conn.ServerVersion}", Green); + } + catch (Exception ex) + { + SetStatus($"✖ Erro: {ex.Message}", Red); + } + finally + { + btnTestar.Enabled = true; + } + } + + private string BuildConnStr() + { + SqlConnectionStringBuilder builder = new() + { + DataSource = $"{txtHost.Text.Trim()},{txtPort.Text.Trim()}", + InitialCatalog = txtBanco.Text.Trim(), + UserID = txtUsuario.Text.Trim(), + Password = txtSenha.Text, + ConnectTimeout = int.TryParse(txtTimeout.Text, out int t) ? t : 3, + Encrypt = chkEncrypt.Checked, + TrustServerCertificate = chkTrust.Checked + }; + return builder.ConnectionString; + } + + private bool Validar() + { + if (string.IsNullOrWhiteSpace(txtHost.Text)) { SetStatus("✖ Informe o Host.", Red); txtHost.Focus(); return false; } + if (string.IsNullOrWhiteSpace(txtBanco.Text)) { SetStatus("✖ Informe o Banco.", Red); txtBanco.Focus(); return false; } + if (string.IsNullOrWhiteSpace(txtUsuario.Text)) { SetStatus("✖ Informe o Usuário.", Red); txtUsuario.Focus(); return false; } + return true; + } + + private void SetStatus(string msg, Color color) + { + lblStatus.Text = msg; + lblStatus.ForeColor = color; + } + + // ── Helpers de UI ────────────────────────────────────────────────── + + private void DrawTopbar(object sender, PaintEventArgs e) + { + var g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + var rect = new Rectangle(25, 20, 34, 34); + using var path = RoundRectPath(rect, 8); + g.FillPath(new SolidBrush(Blue), path); + g.DrawString("S", new Font("Segoe UI", 14, FontStyle.Bold), Brushes.White, rect, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); + g.DrawString("Configuração do Banco", new Font("Segoe UI Semibold", 12.5f), Brushes.White, 70, 18); + g.DrawString("Defina os parâmetros de conexão com o SQL Server", new Font("Segoe UI", 9), new SolidBrush(Color.FromArgb(148, 163, 184)), 70, 40); + } + + private int AddSection(Panel p, string title, int y) + { + var line = new Panel { BackColor = BorderCol, Height = 1, Width = p.Width - 60, Left = 30, Top = y }; + p.Controls.Add(line); + var lbl = new Label { Text = title, Font = new Font("Segoe UI", 7, FontStyle.Bold), ForeColor = TextMuted, Top = y - 7, Left = 35, AutoSize = true, BackColor = Surface }; + p.Controls.Add(lbl); + lbl.BringToFront(); + return y + 20; + } + + private void AddLabel(Panel p, string txt, int x, int y) + { + p.Controls.Add(new Label { Text = txt, Font = new Font("Segoe UI Semibold", 9), ForeColor = TextSec, Left = x, Top = y, AutoSize = true }); + } + + private void StyleInput(TextBox t, string placeholder) + { + t.BorderStyle = BorderStyle.FixedSingle; + t.Font = new Font("Segoe UI", 10); + t.PlaceholderText = placeholder; + t.BackColor = Color.FromArgb(250, 251, 253); + } + + private void StyleCheckbox(CheckBox chk, string text) + { + chk.Text = text; chk.Font = new Font("Segoe UI", 9.5f); + chk.ForeColor = TextSec; chk.Cursor = Cursors.Hand; + } + + private void StyleButton(Button b, string txt, Color bg, Color fg, Color? borda = null) + { + b.Text = txt; b.FlatStyle = FlatStyle.Flat; b.BackColor = bg; b.ForeColor = fg; b.Cursor = Cursors.Hand; + b.Font = new Font("Segoe UI Semibold", 9.5f); + b.FlatAppearance.BorderSize = borda.HasValue ? 1 : 0; + if (borda.HasValue) b.FlatAppearance.BorderColor = borda.Value; + } + + private static GraphicsPath RoundRectPath(Rectangle r, int radius) + { + var path = new GraphicsPath(); + int d = radius * 2; + path.AddArc(r.X, r.Y, d, d, 180, 90); + path.AddArc(r.Right - d, r.Y, d, d, 270, 90); + path.AddArc(r.Right - d, r.Bottom - d, d, d, 0, 90); + path.AddArc(r.X, r.Bottom - d, d, d, 90, 90); + path.CloseFigure(); + return path; + } + } + + // ── Dados (DbConfig) ────────────────────────────────────────────────── + public static class DbConfig + { + public static string Host { get; set; } = "localhost"; + public static int Port { get; set; } = 1433; + public static string Banco { get; set; } = ""; + public static string Usuario { get; set; } = "sa"; + public static string Senha { get; set; } = ""; + public static int ConnectTimeout { get; set; } = 3; + public static bool Encrypt { get; set; } = true; + public static bool TrustServerCertificate { get; set; } = true; + } +} \ No newline at end of file diff --git a/UI/Dashboards/Configurações/Database/FrmConfigBanco.resx b/UI/Dashboards/Configurações/Database/FrmConfigBanco.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Configurações/Database/FrmConfigBanco.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Consultas/AgendaConsultaPanel.cs b/UI/Dashboards/Consultas/AgendaConsultaPanel.cs new file mode 100644 index 0000000..b1d23fb --- /dev/null +++ b/UI/Dashboards/Consultas/AgendaConsultaPanel.cs @@ -0,0 +1,431 @@ +using BLL; +using DAL; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace UI +{ + public class AgendaConsultaPanel : UserControl + { + // ── CORES ───────────────────────────────────────────────────────────── + private readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private readonly Color TextDark = Color.FromArgb(30, 41, 59); + private readonly Color BorderColor = Color.FromArgb(226, 232, 240); + private readonly Color GreenColor = Color.FromArgb(34, 197, 94); + private readonly Color MutedGray = Color.FromArgb(148, 163, 184); + private readonly Color SurfaceColor = Color.FromArgb(248, 250, 252); + + // ── CONTROLES ───────────────────────────────────────────────────────── + private Panel pnlToolbar = null!; + private Panel pnlFiltros = null!; + private Panel pnlRodape = null!; + private DataGridView dgvAgenda = null!; + private Label lblTotal = null!; + + // ── FILTROS ─────────────────────────────────────────────────────────── + private RoundTextBox txtFiltroCompromisso = null!; + private RoundTextBox txtFiltroFunc = null!; + private RoundTextBox txtFiltroOsVinc = null!; + private RoundTextBox txtDataInicio = null!; + private RoundTextBox txtDataFim = null!; + private ComboBox cmbSituacao = null!; + + // ── DADOS ───────────────────────────────────────────────────────────── + private List _todos = new(); + private List _filtrados = new(); + + // ── EVENTO: abre cadastro com o registro selecionado ────────────────── + public event Action? OnAbrirCadastro; + + //Carrega a string conexao com o banco de dados, para ser usada no repositório + private string _conexao = DadosDaConexao.ObterConexao(); + + // ── CONSTRUTOR ──────────────────────────────────────────────────────── + public AgendaConsultaPanel() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + + InitializeLayout(); + //CarregarDadosFake(); + CarregarDadosDoBanco(); + AplicarFiltros(); + } + + // ══════════════════════════════════════════════════════════════════════ + // LAYOUT + // + // REGRA WINFORMS — ordem de adição ao Controls é INVERSA à exibição: + // 1º adicionar → Fill (ocupa o centro) + // 2º adicionar → Bottom + // 3º adicionar → Top (empurra o Fill para baixo; último = mais alto) + // + // ══════════════════════════════════════════════════════════════════════ + private void InitializeLayout() + { + Controls.Clear(); + + // ── 1º: GRID (Fill) ─────────────────────────────────────────────── + BuildGrid(); + Controls.Add(dgvAgenda); + + // ── 2º: RODAPÉ (Bottom) ─────────────────────────────────────────── + pnlRodape = new Panel + { + Dock = DockStyle.Bottom, + Height = 30, + BackColor = SurfaceColor + }; + lblTotal = new Label + { + AutoSize = true, + Location = new Point(16, 7), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = MutedGray, + Text = "0 registros encontrados" + }; + pnlRodape.Controls.Add(lblTotal); + Controls.Add(pnlRodape); + + // ── 3º: FILTROS (Top) ───────────────────────────────────────────── + pnlFiltros = new Panel + { + Dock = DockStyle.Top, + Height = 95, + BackColor = SurfaceColor, + Padding = new Padding(16, 8, 16, 8) + }; + BuildFiltros(); + Controls.Add(pnlFiltros); + + // ── 4º: TOOLBAR (Top) — por último = fica acima dos filtros ─────── + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = SurfaceColor + }; + + var flow = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + var btnPesquisar = CreateToolbarButton("Pesquisar", AccentBlue); + var btnLimpar = CreateToolbarButton("Limpar", MutedGray); + var btnAbrir = CreateToolbarButton("Abrir", GreenColor); + var btnExportar = CreateToolbarButton("Exportar", Color.FromArgb(99, 102, 241)); + + btnPesquisar.Click += (_, _) => AplicarFiltros(); + btnLimpar.Click += (_, _) => LimparFiltros(); + btnAbrir.Click += (_, _) => AbrirRegistroSelecionado(); + btnExportar.Click += (_, _) => ExportarCSV(); + + flow.Controls.AddRange(new Control[] { btnPesquisar, btnLimpar, btnAbrir, btnExportar }); + pnlToolbar.Controls.Add(flow); + Controls.Add(pnlToolbar); // ← último Top = aparece no topo + } + + // ── FILTROS ─────────────────────────────────────────────────────────── + private void BuildFiltros() + { + // Linha 1 + txtFiltroCompromisso = AddFiltroInput(pnlFiltros, "Compromisso", 0, 8, 260); + txtFiltroFunc = AddFiltroInput(pnlFiltros, "Funcionário", 270, 8, 200); + txtFiltroOsVinc = AddFiltroInput(pnlFiltros, "OS Vinculada", 480, 8, 130); + + // Linha 2 + txtDataInicio = AddFiltroInput(pnlFiltros, "Data Início", 0, 50, 130); + txtDataFim = AddFiltroInput(pnlFiltros, "Data Fim", 140, 50, 130); + + pnlFiltros.Controls.Add(new Label + { + Text = "Situação", + Location = new Point(280, 50), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }); + + cmbSituacao = new ComboBox + { + Location = new Point(280, 66), + Size = new Size(160, 26), + DropDownStyle = ComboBoxStyle.DropDownList, + Font = new Font("Segoe UI", 8.5f), + FlatStyle = FlatStyle.Flat + }; + cmbSituacao.Items.AddRange(new object[] { "Todos", "Pendente", "Realizado" }); + cmbSituacao.SelectedIndex = 0; + pnlFiltros.Controls.Add(cmbSituacao); + + foreach (var txt in new[] { txtFiltroCompromisso, txtFiltroFunc, txtFiltroOsVinc, txtDataInicio, txtDataFim }) + txt.KeyDown += (_, e) => { if (e.KeyCode == Keys.Enter) AplicarFiltros(); }; + } + + private RoundTextBox AddFiltroInput(Control parent, string label, int x, int y, int width) + { + parent.Controls.Add(new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }); + var txt = new RoundTextBox + { + Location = new Point(x, y + 16), + Size = new Size(width, 26), + Radius = 4, + BorderColor = BorderColor, + FocusColor = AccentBlue, + BackColor = Color.White + }; + parent.Controls.Add(txt); + return txt; + } + + // ── GRID ────────────────────────────────────────────────────────────── + private void BuildGrid() + { + dgvAgenda = new DataGridView + { + Dock = DockStyle.Fill, + BackgroundColor = Color.White, + BorderStyle = BorderStyle.None, + CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal, + ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single, + GridColor = BorderColor, + RowHeadersVisible = false, + AllowUserToAddRows = false, + AllowUserToDeleteRows = false, + ReadOnly = true, + SelectionMode = DataGridViewSelectionMode.FullRowSelect, + MultiSelect = false, + Font = new Font("Segoe UI", 8.5f), + AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill, + ColumnHeadersHeight = 36, + ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing, + RowTemplate = { Height = 32 } + }; + + dgvAgenda.ColumnHeadersDefaultCellStyle = new DataGridViewCellStyle + { + BackColor = SurfaceColor, + ForeColor = TextDark, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + Alignment = DataGridViewContentAlignment.MiddleLeft, + Padding = new Padding(8, 0, 0, 0), + SelectionBackColor = SurfaceColor, + SelectionForeColor = TextDark + }; + + dgvAgenda.DefaultCellStyle = new DataGridViewCellStyle + { + ForeColor = TextDark, + BackColor = Color.White, + SelectionBackColor = Color.FromArgb(239, 246, 255), + SelectionForeColor = AccentBlue, + Padding = new Padding(8, 0, 0, 0) + }; + + dgvAgenda.AlternatingRowsDefaultCellStyle = new DataGridViewCellStyle + { + BackColor = SurfaceColor, + SelectionBackColor = Color.FromArgb(239, 246, 255), + SelectionForeColor = AccentBlue + }; + + dgvAgenda.Columns.AddRange(new DataGridViewColumn[] + { + new DataGridViewTextBoxColumn { Name = "colId", HeaderText = "ID", FillWeight = 5 }, + new DataGridViewTextBoxColumn { Name = "colCodigo", HeaderText = "Código", FillWeight = 8 }, + new DataGridViewTextBoxColumn { Name = "colCompromisso", HeaderText = "Compromisso", FillWeight = 26 }, + new DataGridViewTextBoxColumn { Name = "colData", HeaderText = "Data", FillWeight = 10 }, + new DataGridViewTextBoxColumn { Name = "colHora", HeaderText = "Hora", FillWeight = 7 }, + new DataGridViewTextBoxColumn { Name = "colDia", HeaderText = "Dia", FillWeight = 10 }, + new DataGridViewTextBoxColumn { Name = "colFunc", HeaderText = "Funcionário", FillWeight = 16 }, + new DataGridViewTextBoxColumn { Name = "colAvisar", HeaderText = "Avisar", FillWeight = 12 }, + new DataGridViewTextBoxColumn { Name = "colOs", HeaderText = "OS Vinc.", FillWeight = 8 }, + new DataGridViewTextBoxColumn { Name = "colSituacao", HeaderText = "Situação", FillWeight = 10 }, + }); + + dgvAgenda.CellDoubleClick += (_, e) => + { + if (e.RowIndex >= 0) AbrirRegistroSelecionado(); + }; + + dgvAgenda.CellFormatting += (_, e) => + { + if (e.RowIndex < 0 || e.ColumnIndex < 0) return; + if (dgvAgenda.Columns[e.ColumnIndex].Name != "colSituacao") return; + + bool realizado = e.Value?.ToString() == "Realizado"; + e.CellStyle.ForeColor = realizado ? Color.FromArgb(22, 101, 52) : Color.FromArgb(146, 64, 14); + e.CellStyle.Font = new Font("Segoe UI", 8f, FontStyle.Bold); + e.CellStyle.SelectionForeColor = e.CellStyle.ForeColor; + e.FormattingApplied = true; + }; + } + + // ══════════════════════════════════════════════════════════════════════ + // LÓGICA + // ══════════════════════════════════════════════════════════════════════ + private void AplicarFiltros() + { + _filtrados = _todos.ToList(); + + var termComp = txtFiltroCompromisso.Text.Trim().ToLower(); + if (!string.IsNullOrEmpty(termComp)) + _filtrados = _filtrados.Where(e => e.COMPROMISSO?.ToLower().Contains(termComp) == true).ToList(); + + var termFunc = txtFiltroFunc.Text.Trim().ToLower(); + if (!string.IsNullOrEmpty(termFunc)) + _filtrados = _filtrados.Where(e => e.FUNC?.ToLower().Contains(termFunc) == true).ToList(); + + var termOs = txtFiltroOsVinc.Text.Trim().ToLower(); + if (!string.IsNullOrEmpty(termOs)) + _filtrados = _filtrados.Where(e => e.OS_VINC?.ToLower().Contains(termOs) == true).ToList(); + + if (DateTime.TryParseExact(txtDataInicio.Text.Trim(), "dd/MM/yyyy", + System.Globalization.CultureInfo.InvariantCulture, + System.Globalization.DateTimeStyles.None, out var dtIni)) + _filtrados = _filtrados.Where(e => ParseData(e.dDATA) >= dtIni).ToList(); + + if (DateTime.TryParseExact(txtDataFim.Text.Trim(), "dd/MM/yyyy", + System.Globalization.CultureInfo.InvariantCulture, + System.Globalization.DateTimeStyles.None, out var dtFim)) + _filtrados = _filtrados.Where(e => ParseData(e.dDATA) <= dtFim).ToList(); + + var sit = cmbSituacao.SelectedItem?.ToString(); + if (sit == "Realizado") _filtrados = _filtrados.Where(e => e.REALIZADO?.ToUpper() == "S").ToList(); + else if (sit == "Pendente") _filtrados = _filtrados.Where(e => e.REALIZADO?.ToUpper() != "S").ToList(); + + PreencherGrid(); + } + + private void LimparFiltros() + { + txtFiltroCompromisso.Text = string.Empty; + txtFiltroFunc.Text = string.Empty; + txtFiltroOsVinc.Text = string.Empty; + txtDataInicio.Text = string.Empty; + txtDataFim.Text = string.Empty; + cmbSituacao.SelectedIndex = 0; + AplicarFiltros(); + } + + private void PreencherGrid() + { + dgvAgenda.Rows.Clear(); + + foreach (var ev in _filtrados.OrderBy(e => ParseData(e.dDATA)).ThenBy(e => e.HORA)) + { + dgvAgenda.Rows.Add( + ev.ID_AGENDA, ev.CODIGO, ev.COMPROMISSO, + ev.dDATA, ev.HORA, ev.DIA, ev.FUNC, ev.AVISAR, ev.OS_VINC, + ev.REALIZADO?.ToUpper() == "S" ? "Realizado" : "Pendente" + ); + } + + int total = _filtrados.Count; + lblTotal.Text = total == 1 ? "1 registro encontrado" : $"{total} registros encontrados"; + } + + private void AbrirRegistroSelecionado() + { + if (dgvAgenda.SelectedRows.Count == 0) + { + MessageBox.Show("Selecione um registro na lista.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + var row = dgvAgenda.SelectedRows[0]; + if (row.Cells["colId"].Value is int id) + { + var ev = _filtrados.FirstOrDefault(e => e.ID_AGENDA == id); + if (ev != null) OnAbrirCadastro?.Invoke(ev); + } + } + + private void ExportarCSV() + { + if (!_filtrados.Any()) + { + MessageBox.Show("Nenhum registro para exportar.", + "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + using var dlg = new SaveFileDialog + { + Filter = "CSV (*.csv)|*.csv", + FileName = $"Agenda_{DateTime.Today:yyyyMMdd}.csv" + }; + if (dlg.ShowDialog() != DialogResult.OK) return; + + var sb = new System.Text.StringBuilder(); + sb.AppendLine("ID;Código;Compromisso;Data;Hora;Dia;Funcionário;Avisar;OS Vinculada;Situação"); + foreach (var ev in _filtrados.OrderBy(e => ParseData(e.dDATA)).ThenBy(e => e.HORA)) + sb.AppendLine($"{ev.ID_AGENDA};{ev.CODIGO};{ev.COMPROMISSO};{ev.dDATA};" + + $"{ev.HORA};{ev.DIA};{ev.FUNC};{ev.AVISAR};{ev.OS_VINC};" + + $"{(ev.REALIZADO?.ToUpper() == "S" ? "Realizado" : "Pendente")}"); + + System.IO.File.WriteAllText(dlg.FileName, sb.ToString(), System.Text.Encoding.UTF8); + MessageBox.Show($"Exportado com sucesso!\n{dlg.FileName}", "Exportar", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + // ── DADOS FAKE — substituir pelo repositório ────────────────────────── + private void CarregarDadosFake() + { + var hoje = DateTime.Today; + _todos = new List + { + new(1, "AG001", "Reunião com cliente", hoje.ToString("dd/MM/yyyy"), "30 minutos antes", "Carlos Silva", DiaSemana(hoje), "09:00", "S", "OS-1042"), + new(2, "AG002", "Visita técnica", hoje.ToString("dd/MM/yyyy"), "1 hora antes", "Ana Souza", DiaSemana(hoje), "14:00", "N", "OS-1055"), + new(3, "AG003", "Entrega de equipamento", hoje.AddDays(4).ToString("dd/MM/yyyy"), "1 dia antes", "Pedro Lima", DiaSemana(hoje.AddDays(4)), "10:30", "N", ""), + new(4, "AG004", "Manutenção preventiva", hoje.AddDays(-2).ToString("dd/MM/yyyy"), "30 minutos antes", "Carlos Silva", DiaSemana(hoje.AddDays(-2)), "08:00", "S", "OS-1030"), + new(5, "AG005", "Treinamento equipe", hoje.AddDays(7).ToString("dd/MM/yyyy"), "1 dia antes", "Ana Souza", DiaSemana(hoje.AddDays(7)), "13:00", "N", ""), + }; + }//Carregar dados fakes para ixibição + private void CarregarDadosDoBanco() + { + BLLAgenda _agendaBLL = new BLLAgenda(_conexao); + _todos.Clear(); + _todos.AddRange(_agendaBLL.Listar()); + }//Carregar dados reais do banco de dados usando o repositório + + private static DateTime ParseData(string? value) + { + if (string.IsNullOrWhiteSpace(value)) return DateTime.MinValue; + if (DateTime.TryParseExact(value, "dd/MM/yyyy", + System.Globalization.CultureInfo.InvariantCulture, + System.Globalization.DateTimeStyles.None, out var dt)) return dt; + if (DateTime.TryParse(value, out dt)) return dt; + return DateTime.MinValue; + } + + private static string DiaSemana(DateTime d) => + new System.Globalization.CultureInfo("pt-BR").DateTimeFormat.GetDayName(d.DayOfWeek); + + private RoundButton CreateToolbarButton(string text, Color color) => new RoundButton + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand + }; + } +} \ No newline at end of file diff --git a/UI/Dashboards/Consultas/AgendaConsultaPanel.resx b/UI/Dashboards/Consultas/AgendaConsultaPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Consultas/AgendaConsultaPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Dashmain/DashboardPanel.cs b/UI/Dashboards/Dashmain/DashboardPanel.cs new file mode 100644 index 0000000..98ca3b9 --- /dev/null +++ b/UI/Dashboards/Dashmain/DashboardPanel.cs @@ -0,0 +1,368 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; +using System.Globalization; +namespace UI +{ + // ═══════════════════════════════════════════════════════════════════════ + // DashboardPanel — painel principal com KPI cards + tabela de OS + // ═══════════════════════════════════════════════════════════════════════ + public class DashboardPanel : UserControl + { + // ── Paleta ───────────────────────────────────────────────────────── + private static readonly Color Surface = Color.FromArgb(255, 255, 255); + private static readonly Color Surface2 = Color.FromArgb(248, 250, 252); + private static readonly Color Border = Color.FromArgb(226, 232, 240); + private static readonly Color TextPri = Color.FromArgb(15, 23, 42); + private static readonly Color TextSec = Color.FromArgb(71, 85, 105); + private static readonly Color TextMuted = Color.FromArgb(148, 163, 184); + + private static readonly Color Blue = Color.FromArgb(37, 99, 235); + private static readonly Color BlueLight = Color.FromArgb(219, 234, 254); + private static readonly Color Green = Color.FromArgb(22, 163, 74); + private static readonly Color GreenL = Color.FromArgb(220, 252, 231); + private static readonly Color Amber = Color.FromArgb(217, 119, 6); + private static readonly Color AmberL = Color.FromArgb(254, 243, 199); + private static readonly Color Red = Color.FromArgb(220, 38, 38); + private static readonly Color RedL = Color.FromArgb(254, 226, 226); + private static readonly Color Orange = Color.FromArgb(234, 88, 12); + private static readonly Color OrangeL = Color.FromArgb(255, 237, 213); + + // ── Dados de OS ──────────────────────────────────────────────────── + private readonly List _ordens = new() + { + new OsRow("#0001", "João Silva", "Notebook Dell", OsStatus.EmAndamento, "07/04"), + new OsRow("#0002", "Maria Souza", "PC Gamer", OsStatus.Concluida, "07/04"), + new OsRow("#0003", "Carlos Mota", "Impressora HP", OsStatus.Aguardando, "08/04"), + new OsRow("#0004", "Ana Lima", "iPhone 14", OsStatus.EmAndamento, "08/04"), + new OsRow("#0005", "Pedro Rocha", "Monitor LG", OsStatus.Pendente, "09/04"), + }; + + // ── KPI cards ────────────────────────────────────────────────────── + // CORRIGIDO: instanciação posicional explícita (sem parâmetros nomeados) + private readonly KpiCard[] _kpis; + + // ── Layout ───────────────────────────────────────────────────────── + private const int Pad = 24; + private const int KpiH = 110; + private const int KpiGap = 14; + private const int CardRad = 10; + private const int TopbarH = 56; + private const int RowH = 38; + + private readonly Font _fLabel; + private readonly Font _fValue; + private readonly Font _fDelta; + private readonly Font _fHead; + private readonly Font _fCell; + private readonly Font _fColHead; + private readonly Font _fMono; + private readonly Font _fBtn; + private readonly Font _fTopTitle; + private readonly Font _fTopSub; + + private Rectangle _btnNovaOS; + private int _hoverRow = -1; + + public DashboardPanel() + { + // CORRIGIDO: inicialização dos campos Font no construtor + // (evita o aviso "campo não anulável precisa conter valor não nulo") + _fLabel = new Font("Segoe UI", 8.5f); + _fValue = new Font("Segoe UI Semibold", 18f); + _fDelta = new Font("Segoe UI", 9f); + _fHead = new Font("Segoe UI Semibold", 10.5f); + _fCell = new Font("Segoe UI", 10f); + _fColHead = new Font("Segoe UI", 8f); + _fMono = new Font("Consolas", 9.5f); + _fBtn = new Font("Segoe UI Semibold", 10f); + _fTopTitle = new Font("Segoe UI Semibold", 13f); + _fTopSub = new Font("Segoe UI", 9f); + + // CORRIGIDO: KpiCard instanciado com construtor posicional explícito + _kpis = new[] + { + new KpiCard("OS Abertas", "12", "↑ 4 essa semana", true, BlueLight, Blue), + new KpiCard("OS Concluídas", "45", "↑ 12% vs mês", true, GreenL, Green), + new KpiCard("Faturamento", "22.5k", "↑ R$ 2.100", true, AmberL, Amber), + new KpiCard("Pendências", "3", "↓ aguardando", false, RedL, Red), + }; + + BackColor = Surface2; + DoubleBuffered = true; + SetStyle(ControlStyles.AllPaintingInWmPaint | + ControlStyles.OptimizedDoubleBuffer | + ControlStyles.ResizeRedraw, true); + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _fLabel.Dispose(); _fValue.Dispose(); _fDelta.Dispose(); + _fHead.Dispose(); _fCell.Dispose(); _fColHead.Dispose(); + _fMono.Dispose(); _fBtn.Dispose(); _fTopTitle.Dispose(); + _fTopSub.Dispose(); + } + base.Dispose(disposing); + } + + // ── Paint ────────────────────────────────────────────────────────── + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; + + DrawTopbar(g); + int y = TopbarH + Pad; + DrawKpiRow(g, y); + y += KpiH + 20; + DrawOsCard(g, y); + } + + // ── Topbar ───────────────────────────────────────────────────────── + private void DrawTopbar(Graphics g) + { + g.FillRectangle(new SolidBrush(Surface), 0, 0, Width, TopbarH); + g.DrawLine(new Pen(Border, 1), 0, TopbarH, Width, TopbarH); + + g.DrawString("Home", _fTopTitle, new SolidBrush(TextPri), Pad, 12); + //g.DrawString("Quinta, 09 de abril de 2026", _fTopSub, + g.DrawString( + DateTime.Now.ToString("dd 'de' MMMM 'de' yyyy", new CultureInfo("pt-BR")), _fTopSub, + new SolidBrush(TextMuted), Pad, 32); + + int bw = 110, bh = 32; + int bx = Width - Pad - bw; + int by = (TopbarH - bh) / 2; + _btnNovaOS = new Rectangle(bx, by, bw, bh); + FillRoundRect(g, new SolidBrush(Blue), _btnNovaOS, 6); + + var sf = new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center + }; + g.DrawString("+ Nova OS", _fBtn, new SolidBrush(Color.White), _btnNovaOS, sf); + } + + // ── KPI Row ──────────────────────────────────────────────────────── + private void DrawKpiRow(Graphics g, int y) + { + int totalGap = KpiGap * (_kpis.Length - 1); + int kpiW = (Width - Pad * 2 - totalGap) / _kpis.Length; + + for (int i = 0; i < _kpis.Length; i++) + { + int x = Pad + i * (kpiW + KpiGap); + DrawKpiCard(g, _kpis[i], new Rectangle(x, y, kpiW, KpiH)); + } + } + + private void DrawKpiCard(Graphics g, KpiCard kpi, Rectangle r) + { + FillRoundRect(g, new SolidBrush(Surface), r, CardRad); + DrawRoundBorder(g, r, CardRad, Border); + + int dotSize = 36; + var dotRect = new Rectangle(r.Right - 16 - dotSize, r.Y + 16, dotSize, dotSize); + FillRoundRect(g, new SolidBrush(kpi.DotBg), dotRect, 8); + + g.DrawString(kpi.Label, _fLabel, new SolidBrush(TextMuted), r.X + 16, r.Y + 18); + g.DrawString(kpi.Value, _fValue, new SolidBrush(TextPri), r.X + 14, r.Y + 36); + + var deltaColor = kpi.DeltaUp ? Green : Red; + g.DrawString(kpi.Delta, _fDelta, new SolidBrush(deltaColor), r.X + 16, r.Y + 76); + } + + // ── OS Card ──────────────────────────────────────────────────────── + private void DrawOsCard(Graphics g, int y) + { + string[] cols = { "OS", "Cliente", "Equipamento", "Status", "Data" }; + float[] colW = { 0.08f, 0.22f, 0.28f, 0.22f, 0.10f }; + + int cardH = 28 + RowH + RowH * _ordens.Count + 16; + var card = new Rectangle(Pad, y, Width - Pad * 2, cardH); + + FillRoundRect(g, new SolidBrush(Surface), card, CardRad); + DrawRoundBorder(g, card, CardRad, Border); + + g.DrawString("Ordens de Serviço Recentes", _fHead, + new SolidBrush(TextPri), card.X + 18, card.Y + 16); + + int tableY = card.Y + 44; + g.DrawLine(new Pen(Border, 0.5f), card.X, tableY, card.Right, tableY); + + int cx = card.X; + for (int c = 0; c < cols.Length; c++) + { + int cw = (int)(card.Width * colW[c]); + var sf = new StringFormat { LineAlignment = StringAlignment.Center }; + g.DrawString(cols[c].ToUpperInvariant(), _fColHead, + new SolidBrush(TextMuted), cx + 10, tableY + 2, sf); + cx += cw; + } + + for (int i = 0; i < _ordens.Count; i++) + { + int ry = tableY + RowH + i * RowH; + var row = _ordens[i]; + + if (i == _hoverRow) + g.FillRectangle(new SolidBrush(Surface2), + card.X + 1, ry, card.Width - 2, RowH); + + g.DrawLine(new Pen(Border, 0.5f), card.X, ry, card.Right, ry); + + cx = card.X; + int[] cws = GetColWidths(card.Width, colW); + + g.DrawString(row.OS, _fMono, + new SolidBrush(TextMuted), cx + 10, ry + (RowH - 14) / 2); + cx += cws[0]; + + g.DrawString(row.Cliente, _fCell, + new SolidBrush(TextPri), cx + 8, ry + (RowH - 14) / 2); + cx += cws[1]; + + g.DrawString(row.Equipamento, _fCell, + new SolidBrush(TextSec), cx + 8, ry + (RowH - 14) / 2); + cx += cws[2]; + + DrawBadge(g, row.Status, cx + 8, ry + (RowH - 20) / 2); + cx += cws[3]; + + g.DrawString(row.Data, _fCell, + new SolidBrush(TextMuted), cx + 8, ry + (RowH - 14) / 2); + } + } + + private static int[] GetColWidths(int total, float[] ratios) + { + var ws = new int[ratios.Length]; + for (int i = 0; i < ratios.Length; i++) + ws[i] = (int)(total * ratios[i]); + return ws; + } + + private void DrawBadge(Graphics g, OsStatus status, int x, int y) + { + var (label, bg, fg) = status switch + { + OsStatus.Concluida => ("Concluída", GreenL, Color.FromArgb(22, 101, 52)), + OsStatus.EmAndamento => ("Em andamento", AmberL, Color.FromArgb(146, 64, 14)), + OsStatus.Aguardando => ("Aguardando", BlueLight, Color.FromArgb(30, 64, 175)), + OsStatus.Pendente => ("Pendente", RedL, Color.FromArgb(153, 27, 27)), + _ => ("—", Border, TextMuted) + }; + + var sz = g.MeasureString(label, _fDelta); + int bw = (int)sz.Width + 16; + int bh = 20; + var badge = new Rectangle(x, y, bw, bh); + FillRoundRect(g, new SolidBrush(bg), badge, 10); + + var sf = new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center + }; + g.DrawString(label, _fDelta, new SolidBrush(fg), badge, sf); + } + + // ── Mouse ────────────────────────────────────────────────────────── + protected override void OnMouseMove(MouseEventArgs e) + { + int row = HitTestRow(e.Y); + if (row != _hoverRow) { _hoverRow = row; Invalidate(); } + Cursor = _btnNovaOS.Contains(e.Location) ? Cursors.Hand : Cursors.Default; + } + + protected override void OnMouseLeave(EventArgs e) + { + _hoverRow = -1; + Invalidate(); + } + + private int HitTestRow(int mouseY) + { + int tableY = TopbarH + Pad + KpiH + 20 + 44 + RowH; + for (int i = 0; i < _ordens.Count; i++) + { + int ry = tableY + i * RowH; + if (mouseY >= ry && mouseY < ry + RowH) return i; + } + return -1; + } + + // ── GDI Helpers ──────────────────────────────────────────────────── + private static void FillRoundRect(Graphics g, Brush brush, Rectangle r, int radius) + { + using var path = RoundRectPath(r, radius); + g.FillPath(brush, path); + } + + private static void DrawRoundBorder(Graphics g, Rectangle r, int radius, Color color) + { + using var path = RoundRectPath(r, radius); + g.DrawPath(new Pen(color, 0.5f), path); + } + + private static GraphicsPath RoundRectPath(Rectangle r, int radius) + { + var path = new GraphicsPath(); + path.AddArc(r.X, r.Y, radius * 2, radius * 2, 180, 90); + path.AddArc(r.Right - radius * 2, r.Y, radius * 2, radius * 2, 270, 90); + path.AddArc(r.Right - radius * 2, r.Bottom - radius * 2, radius * 2, radius * 2, 0, 90); + path.AddArc(r.X, r.Bottom - radius * 2, radius * 2, radius * 2, 90, 90); + path.CloseFigure(); + return path; + } + + // ── Modelos ──────────────────────────────────────────────────────── + // CORRIGIDO: usando classes simples em vez de records posicionais + // para compatibilidade com qualquer versão do compilador .NET 6+. + private class OsRow + { + public string OS { get; } + public string Cliente { get; } + public string Equipamento { get; } + public OsStatus Status { get; } + public string Data { get; } + + public OsRow(string os, string cliente, string equipamento, OsStatus status, string data) + { + OS = os; + Cliente = cliente; + Equipamento = equipamento; + Status = status; + Data = data; + } + } + + private class KpiCard + { + public string Label { get; } + public string Value { get; } + public string Delta { get; } + public bool DeltaUp { get; } + public Color DotBg { get; } + public Color DotFg { get; } + + public KpiCard(string label, string value, string delta, bool deltaUp, Color dotBg, Color dotFg) + { + Label = label; + Value = value; + Delta = delta; + DeltaUp = deltaUp; + DotBg = dotBg; + DotFg = dotFg; + } + } + + private enum OsStatus { Concluida, EmAndamento, Aguardando, Pendente } + } +} diff --git a/UI/Dashboards/Dashmain/DashboardPanel.resx b/UI/Dashboards/Dashmain/DashboardPanel.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Dashmain/DashboardPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Dashmain/MainForm.cs b/UI/Dashboards/Dashmain/MainForm.cs new file mode 100644 index 0000000..2f5d973 --- /dev/null +++ b/UI/Dashboards/Dashmain/MainForm.cs @@ -0,0 +1,147 @@ +using CCH; +using CustomMessageBox; +using DAL; +using System; +using System.Drawing; +using System.Windows.Forms; +using TLL; +namespace UI +{ + public class MainForm : Form + { + private readonly SidebarControl _sidebar; + private readonly DashboardPanel _dashboard; + + private readonly ClienteCadastroPanel _pClientes; + private readonly EmpresaCadastroPanel _pEmpresa; + private readonly EmpresaConfiguracoesPanel _pEmpresaConfig; + private readonly AgendaCadastroPanel _pAgendaCadastro; + private readonly AgendaConsultaPanel _pAgendaConsulta; + private readonly FuncionariosCadastroPanel _pfuncionariosCadastro ; + private readonly Panel _pOrdens; + private readonly Panel _pProdutos; + private readonly Panel _pEstoque; + private readonly Panel _pFinanceiro; + + public MainForm() + { + Text = "LevelOS — Sistema ERP"; + this.WindowState = FormWindowState.Maximized; + this.MinimumSize = new Size(1100, 750); + this.BackColor = Color.FromArgb(248, 250, 252); + + _sidebar = new SidebarControl { Dock = DockStyle.Left }; + _sidebar.NavItemClicked += OnNavItemClicked; + + _dashboard = new DashboardPanel { Dock = DockStyle.Fill }; + + _pClientes = new ClienteCadastroPanel { Dock = DockStyle.Fill, Visible = false }; + _pEmpresa = new EmpresaCadastroPanel { Dock = DockStyle.Fill, Visible = false }; + _pEmpresaConfig = new EmpresaConfiguracoesPanel { Dock = DockStyle.Fill, Visible = false }; + _pAgendaCadastro = new AgendaCadastroPanel { Dock = DockStyle.Fill, Visible = false }; + _pAgendaConsulta = new AgendaConsultaPanel { Dock = DockStyle.Fill, Visible = false }; + _pfuncionariosCadastro = new FuncionariosCadastroPanel { Dock = DockStyle.Fill, Visible = false }; + _pOrdens = PlaceholderPanel("Ordens de Serviço", Color.FromArgb(22, 163, 74)); + _pProdutos = PlaceholderPanel("Catálogo de Produtos", Color.FromArgb(217, 119, 6)); + _pEstoque = PlaceholderPanel("Controle de Estoque", Color.FromArgb(234, 88, 12)); + _pFinanceiro = PlaceholderPanel("Fluxo Financeiro", Color.FromArgb(124, 58, 237)); + + var mainContainer = new Panel { Dock = DockStyle.Fill }; + mainContainer.Controls.Add(_pFinanceiro); + mainContainer.Controls.Add(_pAgendaCadastro); + mainContainer.Controls.Add(_pAgendaConsulta); + mainContainer.Controls.Add(_pEstoque); + mainContainer.Controls.Add(_pProdutos); + mainContainer.Controls.Add(_pOrdens); + mainContainer.Controls.Add(_pEmpresa); + mainContainer.Controls.Add(_pEmpresaConfig); + mainContainer.Controls.Add(_pClientes); + mainContainer.Controls.Add(_dashboard); + mainContainer.Controls.Add(_pfuncionariosCadastro); + + Controls.Add(mainContainer); + Controls.Add(_sidebar); + + ShowPanel(_dashboard); + + } + + private void OnNavItemClicked(object? sender, int index) + { + /* Índices: + 0 = Dashboard + 2 = Ordens de Serviço + 4 = Produtos + 5 = Estoque + 9 = Financeiro + 99 = Submenu → Clientes + 98 = Submenu → Empresa + */ + switch (index) + { + case 0: ShowPanel(_dashboard); break; + case 2: ShowPanel(_pOrdens); break; + case 4: ShowPanel(_pProdutos); break; + case 5: ShowPanel(_pEstoque); break; + case 9: ShowPanel(_pFinanceiro); break; + case 99: ShowPanel(_pClientes); break; + case 103: ShowPanel(_pfuncionariosCadastro); break; + case 106: ShowPanel(_pEmpresa); break; + + + case 202: ShowPanel(_pEmpresaConfig); break; + case 300: ShowPanel(_pAgendaCadastro); break; + case 301: ShowPanel(_pAgendaConsulta); break; + + + } + } + + private void ShowPanel(Control panelToShow) + { + _dashboard.Visible = (panelToShow == _dashboard); + _pClientes.Visible = (panelToShow == _pClientes); + _pEmpresa.Visible = (panelToShow == _pEmpresa); + _pEmpresaConfig.Visible = (panelToShow == _pEmpresaConfig); + _pOrdens.Visible = (panelToShow == _pOrdens); + _pProdutos.Visible = (panelToShow == _pProdutos); + _pEstoque.Visible = (panelToShow == _pEstoque); + _pFinanceiro.Visible = (panelToShow == _pFinanceiro); + _pAgendaCadastro.Visible = (panelToShow == _pAgendaCadastro); + _pAgendaConsulta.Visible = (panelToShow == _pAgendaConsulta); + _pfuncionariosCadastro.Visible = (panelToShow == _pfuncionariosCadastro); + + if (panelToShow.Visible) + { + panelToShow.BringToFront(); + panelToShow.Focus(); + } + } + + private static Panel PlaceholderPanel(string titulo, Color cor) + { + var p = new Panel { Dock = DockStyle.Fill, Visible = false }; + p.Paint += (s, e) => + { + var g = e.Graphics; + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + var r = p.ClientRectangle; + g.Clear(Color.FromArgb(248, 250, 252)); + + var circle = new Rectangle(r.Width / 2 - 40, r.Height / 2 - 80, 80, 80); + g.FillEllipse(new SolidBrush(Color.FromArgb(20, cor)), circle); + + using var f1 = new Font("Segoe UI Semibold", 16f); + using var f2 = new Font("Segoe UI", 10f); + var sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; + + g.DrawString(titulo, f1, new SolidBrush(Color.FromArgb(30, 41, 59)), + new RectangleF(0, r.Height / 2f - 10, r.Width, 40), sf); + + g.DrawString("Este módulo está sendo integrado ao LevelOS", f2, new SolidBrush(Color.FromArgb(148, 163, 184)), + new RectangleF(0, r.Height / 2f + 25, r.Width, 30), sf); + }; + return p; + } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Dashmain/MainForm.resx b/UI/Dashboards/Dashmain/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Dashmain/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Dashmain/SidebarControl.cs b/UI/Dashboards/Dashmain/SidebarControl.cs new file mode 100644 index 0000000..6b5fbd8 --- /dev/null +++ b/UI/Dashboards/Dashmain/SidebarControl.cs @@ -0,0 +1,423 @@ +using CustomMessageBox; +using DAL; +using DALL; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace UI +{ + public class SidebarControl : UserControl + { + //Recebendo a conexao + string _cx = DadosDaConexao.ObterConexao(); + + // ── Cores do Tema LevelOS ────────────────────────────────────────── + private static readonly Color NavyDark = Color.FromArgb(15, 30, 60); + private static readonly Color NavyMid = Color.FromArgb(26, 45, 80); + private static readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + private static readonly Color TextLight = Color.FromArgb(255, 255, 255); + private static readonly Color TextMuted = Color.FromArgb(148, 163, 184); + private static readonly Color Divider = Color.FromArgb(40, 255, 255, 255); + + // ── Estado e Escalonamento (DPI) ─────────────────────────────────── + private float _scale = 1.0f; + private int _activeIndex = 0; + private int _hoverIndex = -1; + + // Propriedades Scaled (Ajustam-se ao monitor) + private int ScaledWidth => (int)(220 * _scale); + private int ScaledLogoH => (int)(55 * _scale); + private int ScaledSectionH => (int)(32 * _scale); + private int ScaledItemH => (int)(40 * _scale); + private int ScaledItemPadX => (int)(12 * _scale); + private int ScaledFooterH => (int)(50 * _scale); + private int ScaledIconSize => (int)(16 * _scale); + + // ── Submenus ─────────────────────────────────────────────────────── + private ContextMenuStrip _subMenuBanco, _subMenuConfiguracao, + _subMenuAjuda, _subMenuOrdemServico, _subMenuFinanceiro,_subMenuCadastro, _subMenuAgenda; + + public string UserName = "Levelcode", UserFunction = "Administrador"; + public event EventHandler? NavItemClicked; + + private readonly List _items = new() + { + new NavItem("Dashboard", SvgIcon.Grid, "Principal", null), + new NavItem("Cadastro", SvgIcon.UserPlus, null, "3"), + new NavItem("Ordens de Serviço", SvgIcon.FileText, null, "12"), + new NavItem("Agenda", SvgIcon.Calendar, null, null), + new NavItem("Produtos", SvgIcon.Package, "Gestão", null), + new NavItem("Estoque", SvgIcon.Inventory, null, null), + //new NavItem("Serviços", SvgIcon.Briefcase, null, null), + //new NavItem("Transportadoras", SvgIcon.Truck, null, null), + new NavItem("Financeiro", SvgIcon.DollarSign, null, null), + new NavItem("Banco de Dados", SvgIcon.Database, "Sistema", null), + new NavItem("Configurações", SvgIcon.Settings, null, null), + new NavItem("Suporte Técnico", SvgIcon.Support, "Ajuda", null), + }; + + public void backupFull(string conexao) + { + var backupService = new DALLBackupService(conexao); + var resultadoFull = backupService.ExecutarBackupFull(); + + if (resultadoFull.Sucesso) + NT_MessageBox.Show($"✅ Backup FULL concluído em {resultadoFull.Duracao.TotalSeconds:F1}s","Backup do banco de dados",MessageBoxButtons.OK, MessageBoxIcon.Information); + else + NT_MessageBox.Show($"❌ Erro no Backup FULL: {resultadoFull.Erro}","Erro ao tentar executar backup do sistema.",MessageBoxButtons.OK,MessageBoxIcon.Error); + }//Criar backup full + + public void backupDifrencial(string conexao) + { + var backupService = new DALLBackupService(conexao); + var resultadoDiff = backupService.ExecutarBackupDiferencial(); + + if (resultadoDiff.Sucesso) + NT_MessageBox.Show($"✅ Backup DIFERENCIAL concluído em {resultadoDiff.Duracao.TotalSeconds:F1}s","Backup diferencial concluido", MessageBoxButtons.OK, MessageBoxIcon.Information); + else + NT_MessageBox.Show($"❌ Erro no Backup DIFERENCIAL: {resultadoDiff.Erro}","Erro ao tentar executar backup diferencial no sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); + }//Criar backup diferencial + + + + public SidebarControl() + { + BackColor = NavyDark; + DoubleBuffered = true; + this.SetStyle(ControlStyles.ResizeRedraw, true); + } + + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + using (Graphics g = this.CreateGraphics()) { _scale = g.DpiX / 96f; } + this.Width = ScaledWidth; + SetupSubMenus(); + } + + private void SetupSubMenus() + { + //Submenu Cadastro + _subMenuCadastro = CreateStyledMenu(); + _subMenuCadastro.Items.Add("👤 Clientes", null, (s, e) => {NavItemClicked?.Invoke(this, 99);}); + _subMenuCadastro.Items.Add("💻 Equipamentos", null, (s, e) => { NavItemClicked?.Invoke(this, 100); }); + _subMenuCadastro.Items.Add("📜 Contratos", null, (s, e) => { NavItemClicked?.Invoke(this, 101); }); + _subMenuCadastro.Items.Add("🏭 Fornecedores", null, (s, e) => { NavItemClicked?.Invoke(this, 102); }); + _subMenuCadastro.Items.Add("👔 Funcionários", null, (s, e) => { NavItemClicked?.Invoke(this, 103); }); + _subMenuCadastro.Items.Add("🚚 Transportadoras", null, (s, e) => { NavItemClicked?.Invoke(this, 104); }); + _subMenuCadastro.Items.Add("🛠️ Serviços", null, (s, e) => { NavItemClicked?.Invoke(this, 105); }); + _subMenuCadastro.Items.Add("🏢 Empresa", null, (s, e) => { NavItemClicked?.Invoke(this, 106); }); + _subMenuCadastro.Items.Add("🔑 Usuários do Sistema", null, (s, e) => { NavItemClicked?.Invoke(this, 107); }); + + _subMenuBanco = CreateStyledMenu(); + _subMenuBanco.Items.Add("⚙️ Configuração Database", null, (s, e) => showForms
()); // Substitua pelo seu Form + _subMenuBanco.Items.Add("💾 Backup de Dados (FULL)", null, (s, e) => backupFull(this._cx)); + _subMenuBanco.Items.Add("⚡ Backup de Dados (DIFF)", null, (s, e) => backupDifrencial(this._cx)); + _subMenuBanco.Items.Add("🔄 Restaurar Banco"); + + + //submenu Configurações + _subMenuConfiguracao = CreateStyledMenu(); + _subMenuConfiguracao.Items.Add("🖼️ Personalização de OS"); + _subMenuConfiguracao.Items.Add("🖥️ Personalização de Sistema"); + _subMenuConfiguracao.Items.Add(" Configuração Empresa", null, (s, e) => { NavItemClicked?.Invoke(this, 202); }); + _subMenuConfiguracao.Items.Add(new ToolStripSeparator()); + _subMenuConfiguracao.Items.Add("📂 FTP-Cliente"); // Pasta para arquivos + _subMenuConfiguracao.Items.Add("💬 Telegram-Cliente"); // Balão de conversa + _subMenuConfiguracao.Items.Add("📩 SMTP-Cliente"); // Envelope de saída + _subMenuConfiguracao.Items.Add(new ToolStripSeparator()); + // Automação + _subMenuConfiguracao.Items.Add("⏰ Backups Automáticos"); // Relógio para agendamento + _subMenuConfiguracao.Items.Add("☁️ Backup em Nuvem"); + + _subMenuAjuda = CreateStyledMenu(); + _subMenuAjuda.Items.Add("💬 Atendimento Online"); + _subMenuAjuda.Items.Add("📖 Manual do Sistema"); + + _subMenuOrdemServico = CreateStyledMenu(); + + _subMenuOrdemServico.Items.Add("✚ Abrir nova O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("✎ Alterar O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("🔒 Encerrar O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("🔍 Localizar O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("📋 Orçamento de O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("📜 Histórico de O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("📊 Relatório de O.S", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("🖨 Imprimir", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("⚠️ Chamado Técnico", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("🌐 OS WEB", null, (s, e) => { /* Lógica */ }); + _subMenuOrdemServico.Items.Add("🔓 Reabrir OS", null, (s, e) => { /* Lógica */ }); + + _subMenuFinanceiro = CreateStyledMenu(); + + _subMenuFinanceiro.Items.Add("💳 Contas", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("📈 Contas a receber", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("📉 Contas a pagar", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add(new ToolStripSeparator()); // Linha divisória + _subMenuFinanceiro.Items.Add("🛒 Compras", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("💰 Vendas", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("🧾 Notas Fiscais", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add(new ToolStripSeparator()); // Linha divisória + _subMenuFinanceiro.Items.Add("📂 Arquivo Contador", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("🏦 Dados Bancários", null, (s, e) => { /* Lógica */ }); + _subMenuFinanceiro.Items.Add("🕒 Histórico Financeiro", null, (s, e) => { /* Lógica */ }); + + + // private ContextMenuStrip _subMenuAgenda; + _subMenuAgenda = CreateStyledMenu(); + //_subMenuAgenda.Items.Add("➕ Novo compromisso", null, (s, e) => {showForms();}); + _subMenuAgenda.Items.Add("➕ Novo compromisso", null, (s, e) => { NavItemClicked?.Invoke(this, 300); }); + _subMenuAgenda.Items.Add("🔍 Consultar compromissos", null, (s, e) => { NavItemClicked?.Invoke(this, 301); }); + _subMenuAgenda.Items.Add("✏️ Alterar compromisso", null, (s, e) => { /* Lógica de edição */ }); + _subMenuAgenda.Items.Add("🖨️ Imprimir", null, (s, e) => { /* Lógica de relatório */ }); + } + + private ContextMenuStrip CreateStyledMenu() + { + return new ContextMenuStrip + { + BackColor = NavyMid, + ForeColor = TextLight, + ShowImageMargin = false, + Font = new Font("Segoe UI", 10f * _scale), + Renderer = new ToolStripProfessionalRenderer(new SubMenuColorTable()) + }; + } + + private void showForms() where T : Form, new() + { + using (T form = new T()) + { + form.StartPosition = FormStartPosition.CenterScreen; + form.ShowDialog(); + } + } + //Abrir agenda + // AgendaForm.cs + public class AgendaForm : Form + { + public AgendaForm() + { + Text = "Agenda de Compromissos"; + Size = new Size(1150, 780); + StartPosition = FormStartPosition.CenterScreen; + BackColor = Color.White; + + var panel = new AgendaCadastroPanel(); + Controls.Add(panel); + } + }//abrir agenda de compromissos + + protected override void OnPaint(PaintEventArgs e) + { + var g = e.Graphics; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; + + DrawLogo(g); + DrawNavItems(g, ScaledLogoH + (int)(8 * _scale)); + DrawFooter(g); + } + + private void DrawNavItems(Graphics g, int startY) + { + int y = startY; + using var fSection = new Font("Segoe UI", 8f * _scale, FontStyle.Bold); + using var fItem = new Font("Segoe UI", 10f * _scale); + using var fItemSel = new Font("Segoe UI Semibold", 10f * _scale); + + for (int i = 0; i < _items.Count; i++) + { + var item = _items[i]; + if (item.Section != null) + { + y += (int)(10 * _scale); + g.DrawString(item.Section.ToUpper(), fSection, new SolidBrush(Color.FromArgb(120, TextMuted)), ScaledItemPadX + (int)(8 * _scale), y); + y += ScaledSectionH; + } + + bool isActive = (i == _activeIndex); + bool isHover = (i == _hoverIndex && !isActive); + var itemRect = new Rectangle(ScaledItemPadX, y, Width - ScaledItemPadX * 2, ScaledItemH); + + if (isActive) FillRoundRect(g, new SolidBrush(AccentBlue), itemRect, (int)(6 * _scale)); + else if (isHover) FillRoundRect(g, new SolidBrush(Color.FromArgb(20, 255, 255, 255)), itemRect, (int)(6 * _scale)); + + var color = isActive ? TextLight : Color.FromArgb(200, TextLight); + DrawIcon(g, item.Icon, ScaledItemPadX + (int)(10 * _scale), y + (ScaledItemH - ScaledIconSize) / 2, ScaledIconSize, color); + g.DrawString(item.Label, isActive ? fItemSel : fItem, new SolidBrush(color), ScaledItemPadX + (int)(36 * _scale), y + (ScaledItemH - (int)(16 * _scale)) / 2); + + if (HasSubMenu(item.Label)) + g.DrawString("›", fItem, new SolidBrush(Color.FromArgb(100, TextLight)), Width - (int)(30 * _scale), y + (ScaledItemH - (int)(18 * _scale)) / 2); + + y += ScaledItemH + (int)(2 * _scale); + } + } + + // Adicione "Cadastro" na verificação + private bool HasSubMenu(string label) => + label == "Cadastro" || // <-- Adicionado aqui + label == "Banco de Dados" || + label == "Financeiro" || + label == "Ordens de Serviço" || + label == "Configurações" || + label == "Suporte Técnico" || + label == "Agenda" + ; + + protected override void OnMouseClick(MouseEventArgs e) + { + int hit = HitTest(e.Y); + if (hit >= 0) + { + _activeIndex = hit; Invalidate(); + string label = _items[hit].Label; + Point menuPos = new Point(Width + 2, e.Y - (int)(15 * _scale)); + + if (label == "Banco de Dados") _subMenuBanco.Show(this, menuPos); + else if (label == "Financeiro") _subMenuFinanceiro.Show(this, menuPos); + else if(label == "Agenda") _subMenuAgenda.Show(this, menuPos); + else if (label == "Ordens de Serviço") _subMenuOrdemServico.Show(this, menuPos); + else if (label == "Configurações") _subMenuConfiguracao.Show(this, menuPos); + else if (label == "Suporte Técnico") _subMenuAjuda.Show(this, menuPos); + else if (label == "Cadastro") _subMenuCadastro.Show(this, menuPos); + else NavItemClicked?.Invoke(this, hit); + } + } + + private int HitTest(int mouseY) + { + int y = ScaledLogoH + (int)(8 * _scale); + for (int i = 0; i < _items.Count; i++) + { + if (_items[i].Section != null) y += (int)(10 * _scale) + ScaledSectionH; + if (mouseY >= y && mouseY < y + ScaledItemH) return i; + y += ScaledItemH + (int)(2 * _scale); + } + return -1; + } + + protected override void OnMouseMove(MouseEventArgs e) { int hit = HitTest(e.Y); if (hit != _hoverIndex) { _hoverIndex = hit; Invalidate(); } } + protected override void OnMouseLeave(EventArgs e) { _hoverIndex = -1; Invalidate(); } + + private void DrawLogo(Graphics g) + { + var iconRect = new Rectangle((int)(16 * _scale), (int)(18 * _scale), (int)(34 * _scale), (int)(34 * _scale)); + FillRoundRect(g, new SolidBrush(AccentBlue), iconRect, (int)(8 * _scale)); + using var fIcon = new Font("Segoe UI", 14f * _scale, FontStyle.Bold); + DrawCenteredString(g, "S", fIcon, TextLight, iconRect); + g.DrawString("LevelOS", new Font("Segoe UI Semibold", 13f * _scale), new SolidBrush(TextLight), 58 * _scale, 20 * _scale); + g.DrawString("SISTEMA ERP", new Font("Segoe UI", 8f * _scale), new SolidBrush(TextMuted), 59 * _scale, 38 * _scale); + g.DrawLine(new Pen(Divider), 0, ScaledLogoH, Width, ScaledLogoH); + } + + private void DrawFooter(Graphics g) + { + int fy = Height - ScaledFooterH; + g.DrawLine(new Pen(Divider), 0, fy, Width, fy); + var avRect = new Rectangle((int)(16 * _scale), fy + (int)(14 * _scale), (int)(32 * _scale), (int)(32 * _scale)); + g.FillEllipse(new SolidBrush(AccentBlue), avRect); + DrawCenteredString(g, "AD", new Font("Segoe UI Semibold", 10f * _scale), TextLight, avRect); + g.DrawString(UserName, new Font("Segoe UI Semibold", 11f * _scale), new SolidBrush(TextLight), 56 * _scale, fy + (14 * _scale)); + g.DrawString(UserFunction, new Font("Segoe UI", 9f * _scale), new SolidBrush(TextMuted), 57 * _scale, fy + (30 * _scale)); + } + + // ── MOTOR DE ÍCONES COMPLETO (GDI+) ──────────────────────────────── + private void DrawIcon(Graphics g, SvgIcon icon, int x, int y, int size, Color color) + { + using var p = new Pen(color, 1.6f * _scale) { StartCap = LineCap.Round, EndCap = LineCap.Round, LineJoin = LineJoin.Round }; + float s = size / 24f; + g.TranslateTransform(x, y); g.ScaleTransform(s, s); + + switch (icon) + { + case SvgIcon.Grid: + g.DrawRectangle(p, 3, 3, 7, 7); g.DrawRectangle(p, 14, 3, 7, 7); g.DrawRectangle(p, 3, 14, 7, 7); g.DrawRectangle(p, 14, 14, 7, 7); break; + case SvgIcon.Users: + g.DrawEllipse(p, 5, 3, 8, 8); g.DrawArc(p, 2, 13, 14, 8, 180, 180); g.DrawArc(p, 15, 8, 6, 6, 270, 180); break; + case SvgIcon.FileText: + g.DrawLines(p, new PointF[] { new(6, 2), new(6, 22), new(18, 22), new(18, 8), new(14, 2), new(6, 2) }); g.DrawLine(p, 14, 2, 14, 8); g.DrawLine(p, 14, 8, 18, 8); break; + case SvgIcon.Package: + g.DrawLines(p, new PointF[] { new(12, 2), new(2, 7), new(12, 12), new(22, 7), new(12, 2) }); g.DrawLine(p, 2, 7, 2, 17); g.DrawLine(p, 22, 7, 22, 17); g.DrawLine(p, 12, 12, 12, 22); break; + case SvgIcon.DollarSign: + g.DrawLine(p, 12, 2, 12, 22); g.DrawArc(p, 7, 5, 10, 7, 110, 250); g.DrawArc(p, 7, 12, 10, 7, 270, 250); break; + case SvgIcon.Database: + g.DrawEllipse(p, 4, 3, 16, 6); g.DrawLine(p, 4, 6, 4, 18); g.DrawLine(p, 20, 6, 20, 18); g.DrawArc(p, 4, 15, 16, 6, 0, 180); break; + case SvgIcon.Calendar: + g.DrawRectangle(p, 3, 4, 18, 17); g.DrawLine(p, 3, 9, 21, 9); g.DrawLine(p, 8, 2, 8, 6); g.DrawLine(p, 16, 2, 16, 6); break; + case SvgIcon.Truck: + g.DrawRectangle(p, 1, 5, 13, 11); g.DrawLines(p, new PointF[] { new(14, 16), new(14, 8), new(19, 8), new(23, 12), new(23, 16) }); + g.DrawEllipse(p, 3, 15, 4, 4); g.DrawEllipse(p, 17, 15, 4, 4); break; + case SvgIcon.Factory: + g.DrawRectangle(p, 2, 10, 20, 11); g.DrawLines(p, new PointF[] { new(2, 10), new(2, 5), new(8, 10), new(8, 5), new(14, 10) }); break; + case SvgIcon.Briefcase: + g.DrawRectangle(p, 3, 7, 18, 13); g.DrawArc(p, 9, 3, 6, 8, 180, 180); break; + case SvgIcon.Support: + g.DrawArc(p, 4, 4, 16, 16, 180, 180); g.DrawRectangle(p, 3, 13, 3, 5); g.DrawRectangle(p, 18, 13, 3, 5); break; + case SvgIcon.Inventory: + g.DrawRectangle(p, 3, 3, 18, 8); g.DrawRectangle(p, 3, 13, 18, 8); break; + case SvgIcon.Settings: + g.DrawEllipse(p, 9, 9, 6, 6); + for (int a = 0; a < 360; a += 45) + { + float r = a * (float)Math.PI / 180f; + g.DrawLine(p, 12 + (float)Math.Cos(r) * 8, 12 + (float)Math.Sin(r) * 8, 12 + (float)Math.Cos(r) * 11, 12 + (float)Math.Sin(r) * 11); + } + break; + case SvgIcon.User: g.DrawEllipse(p, 8, 2, 8, 8); g.DrawArc(p, 3, 14, 18, 8, 180, 180); break; + case SvgIcon.UserCheck: g.DrawEllipse(p, 8, 3, 8, 8); g.DrawArc(p, 3, 14, 18, 8, 180, 180); g.DrawRectangle(p, 10, 15, 4, 3); break; + case SvgIcon.UserPlus: + // Desenha o corpo do usuário (círculo e arco) + g.DrawEllipse(p, 4, 4, 8, 8); // Cabeça + g.DrawArc(p, 1, 14, 14, 8, 180, 180); // Ombros + + // Desenha o sinal de "+" ao lado + // Vertical + g.DrawLine(p, 19, 7, 19, 15); + // Horizontal + g.DrawLine(p, 15, 11, 23, 11); + break; + + + } + g.ResetTransform(); + } + + // ── Helpers ── + private static void FillRoundRect(Graphics g, Brush b, Rectangle r, int rad) { using var path = RoundRectPath(r, rad); g.FillPath(b, path); } + private static GraphicsPath RoundRectPath(Rectangle r, int rad) + { + var path = new GraphicsPath(); int d = Math.Max(rad * 2, 1); + path.AddArc(r.X, r.Y, d, d, 180, 90); path.AddArc(r.Right - d, r.Y, d, d, 270, 90); + path.AddArc(r.Right - d, r.Bottom - d, d, d, 0, 90); path.AddArc(r.X, r.Bottom - d, d, d, 90, 90); + path.CloseFigure(); return path; + } + private static void DrawCenteredString(Graphics g, string t, Font f, Color c, Rectangle r) + { + var sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; + g.DrawString(t, f, new SolidBrush(c), r, sf); + } + + private class NavItem + { + public string Label { get; } + public SvgIcon Icon { get; } + public string? Section { get; } + public string? Badge { get; } + public NavItem(string l, SvgIcon i, string? s, string? b) { Label = l; Icon = i; Section = s; Badge = b; } + } + private class SubMenuColorTable : ProfessionalColorTable + { + public override Color ToolStripDropDownBackground => NavyMid; + public override Color MenuItemSelected => AccentBlue; + public override Color MenuItemBorder => Color.Transparent; + public override Color MenuItemSelectedGradientBegin => AccentBlue; + public override Color MenuItemSelectedGradientEnd => AccentBlue; + } + } + + public enum SvgIcon { Grid, Users, FileText, Package, DollarSign, User, Settings, Database, Truck, Factory, UserCheck, Briefcase, Support, Inventory, Wallet, ShoppingCart, ShoppingBag, Calendar , UserPlus} +} \ No newline at end of file diff --git a/UI/Dashboards/Dashmain/SidebarControl.resx b/UI/Dashboards/Dashmain/SidebarControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Dashboards/Dashmain/SidebarControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Dashboards/Main/Dash_main.Designer.cs b/UI/Dashboards/Main/Dash_main.Designer.cs new file mode 100644 index 0000000..af35c5b --- /dev/null +++ b/UI/Dashboards/Main/Dash_main.Designer.cs @@ -0,0 +1,132 @@ +namespace UI +{ + 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() + { + lbltest = new Label(); + lV_button1 = new CPM.LV_BUTTON(); + lV_button2 = new CPM.LV_BUTTON(); + lV_button3 = new CPM.LV_BUTTON(); + SuspendLayout(); + // + // lbltest + // + lbltest.AutoSize = true; + lbltest.Location = new Point(12, 9); + lbltest.Name = "lbltest"; + lbltest.Size = new Size(38, 15); + lbltest.TabIndex = 0; + lbltest.Text = "label1"; + // + // lV_button1 + // + lV_button1.BackColor = Color.MediumSlateBlue; + lV_button1.BackgroundColor = Color.MediumSlateBlue; + lV_button1.BorderColor = Color.PaleVioletRed; + lV_button1.BorderRadius = 0; + lV_button1.BorderSize = 0; + lV_button1.ClickColor = Color.DarkBlue; + lV_button1.FlatAppearance.BorderSize = 0; + lV_button1.FlatStyle = FlatStyle.Flat; + lV_button1.ForeColor = Color.White; + lV_button1.HoverColor = Color.LightBlue; + lV_button1.Location = new Point(734, 12); + lV_button1.Name = "lV_button1"; + lV_button1.Size = new Size(148, 32); + lV_button1.TabIndex = 1; + lV_button1.Text = "FrmConfigDB"; + lV_button1.TextColor = Color.White; + lV_button1.UseVisualStyleBackColor = false; + lV_button1.Click += lV_button1_Click; + // + // lV_button2 + // + lV_button2.BackColor = Color.MediumSlateBlue; + lV_button2.BackgroundColor = Color.MediumSlateBlue; + lV_button2.BorderColor = Color.PaleVioletRed; + lV_button2.BorderRadius = 0; + lV_button2.BorderSize = 0; + lV_button2.ClickColor = Color.DarkBlue; + lV_button2.FlatAppearance.BorderSize = 0; + lV_button2.FlatStyle = FlatStyle.Flat; + lV_button2.ForeColor = Color.White; + lV_button2.HoverColor = Color.LightBlue; + lV_button2.Location = new Point(734, 50); + lV_button2.Name = "lV_button2"; + lV_button2.Size = new Size(148, 32); + lV_button2.TabIndex = 2; + lV_button2.Text = "Dashmain"; + lV_button2.TextColor = Color.White; + lV_button2.UseVisualStyleBackColor = false; + lV_button2.Click += lV_button2_Click; + // + // lV_button3 + // + lV_button3.BackColor = Color.MediumSlateBlue; + lV_button3.BackgroundColor = Color.MediumSlateBlue; + lV_button3.BorderColor = Color.PaleVioletRed; + lV_button3.BorderRadius = 0; + lV_button3.BorderSize = 0; + lV_button3.ClickColor = Color.DarkBlue; + lV_button3.FlatAppearance.BorderSize = 0; + lV_button3.FlatStyle = FlatStyle.Flat; + lV_button3.ForeColor = Color.White; + lV_button3.HoverColor = Color.LightBlue; + lV_button3.Location = new Point(734, 88); + lV_button3.Name = "lV_button3"; + lV_button3.Size = new Size(148, 32); + lV_button3.TabIndex = 3; + lV_button3.Text = "Arquivo Encryptado"; + lV_button3.TextColor = Color.White; + lV_button3.UseVisualStyleBackColor = false; + lV_button3.Click += lV_button3_Click; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(894, 474); + Controls.Add(lV_button3); + Controls.Add(lV_button2); + Controls.Add(lV_button1); + Controls.Add(lbltest); + Name = "Form1"; + Text = "Form1"; + Load += Form1_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label lbltest; + private CPM.LV_BUTTON lV_button1; + private CPM.LV_BUTTON lV_button2; + private CPM.LV_BUTTON lV_button3; + } +} diff --git a/UI/Dashboards/Main/Dash_main.cs b/UI/Dashboards/Main/Dash_main.cs new file mode 100644 index 0000000..a942080 --- /dev/null +++ b/UI/Dashboards/Main/Dash_main.cs @@ -0,0 +1,75 @@ +using CAB; +using CCH; +using CPM; +using CPT; +using CustomMessageBox; +using DAL; +using TLL; +using static CPT.SecurityManager; + +namespace UI +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + string caminhoIcone = AppFileSystem.AppFileIconSystem; + + if (File.Exists(caminhoIcone)) + { + this.Icon = new Icon(caminhoIcone); + } + + } + + private void Form1_Load(object sender, EventArgs e) + { + DadosDaConexao.Host = "206.42.13.180"; + DadosDaConexao.Port = 1433; + DadosDaConexao.Banco = "Levelcode-LevelOS"; + DadosDaConexao.Usuario = "nicolas"; + DadosDaConexao.Senha = "Nike12122020*##"; + DadosDaConexao.ConnectTimeout = 1000; + DadosDaConexao.Encrypt = false; + DadosDaConexao.TrustServerCertificate = false; + + DatabaseHelper.Salvar(AppFileSystem.AppFileDBSystem, AppInfoSystem.AppKeyMasterCrip); + DatabaseHelper.Carregar(AppFileSystem.AppFileDBSystem, AppInfoSystem.AppKeyMasterCrip); + this.lbltest.Text = DadosDaConexao.Host; + if (DadosDaConexao.TestarConexao()) + { + NT_MessageBox.Show("Conexão com o banco de dados concluida com sucesso!", "Teste de conexão"); + } + } + + private void lV_button1_Click(object sender, EventArgs e) + { + FrmConfigBanco f = new FrmConfigBanco(); + f.ShowDialog(); + } + + private void lV_button2_Click(object sender, EventArgs e) + { + MainForm main = new MainForm(); + main.ShowDialog(); + } + + private void lV_button3_Click(object sender, EventArgs e) + { + string caminhoKey = @"C:\Levelcode\LevelOS\Config\config.json"; + DadosDaConexao.Host = "206.42.13.180"; + DadosDaConexao.Port = 1433; + DadosDaConexao.Banco = "Levelcode-LevelOS"; + DadosDaConexao.Usuario = "nicolas"; + DadosDaConexao.Senha = "Nike12122020*##"; + DadosDaConexao.ConnectTimeout = 1000; + DadosDaConexao.Encrypt = false; + DadosDaConexao.TrustServerCertificate = false; + DatabaseHelperCPT.Salvar(caminhoKey); + string conectionString = DatabaseHelperCPT.Carregar(caminhoKey); + NT_MessageBox.Show(conectionString); + + } + } +} diff --git a/UI/Dashboards/Main/Dash_main.resx b/UI/Dashboards/Main/Dash_main.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/UI/Dashboards/Main/Dash_main.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Documentohelper.cs b/UI/Documentohelper.cs new file mode 100644 index 0000000..4f67270 --- /dev/null +++ b/UI/Documentohelper.cs @@ -0,0 +1,67 @@ +using System.Windows.Forms; + +namespace UI +{ + /// + /// Formata CPF ou CNPJ automaticamente enquanto o usuário digita. + /// Uso: DocumentoHelper.Registrar(txtDocumento); + /// + public static class DocumentoHelper + { + public static void Registrar(RoundTextBox txt) + { + bool formatando = false; + + txt.TextChanged += (_, _) => + { + // Evita loop: TextChanged → altera Text → TextChanged → ... + if (formatando) return; + formatando = true; + + try + { + // 1. Extrai só os dígitos + string digits = new string(txt.Text.Where(char.IsDigit).ToArray()); + + // 2. Limita ao tamanho máximo do CNPJ + if (digits.Length > 14) digits = digits[..14]; + + // 3. Formata conforme o tamanho + string formatado = digits.Length <= 11 + ? FormatarCPF(digits) + : FormatarCNPJ(digits); + + // 4. Só atualiza se realmente mudou + if (txt.Text != formatado) + { + txt.Text = formatado; + txt.SelectionStart = formatado.Length; // cursor no final + } + } + finally + { + formatando = false; + } + }; + } + + // CPF: 000.000.000-00 + private static string FormatarCPF(string d) => d.Length switch + { + <= 3 => d, + <= 6 => $"{d[..3]}.{d[3..]}", + <= 9 => $"{d[..3]}.{d[3..6]}.{d[6..]}", + _ => $"{d[..3]}.{d[3..6]}.{d[6..9]}-{d[9..]}" + }; + + // CNPJ: 00.000.000/0000-00 + private static string FormatarCNPJ(string d) => d.Length switch + { + <= 2 => d, + <= 5 => $"{d[..2]}.{d[2..]}", + <= 8 => $"{d[..2]}.{d[2..5]}.{d[5..]}", + <= 12 => $"{d[..2]}.{d[2..5]}.{d[5..8]}/{d[8..]}", + _ => $"{d[..2]}.{d[2..5]}.{d[5..8]}/{d[8..12]}-{d[12..]}" + }; + } +} \ No newline at end of file diff --git a/UI/ModeloPanel/Formulariomodelo.cs b/UI/ModeloPanel/Formulariomodelo.cs new file mode 100644 index 0000000..7a1d784 --- /dev/null +++ b/UI/ModeloPanel/Formulariomodelo.cs @@ -0,0 +1,254 @@ +using CPM; +using DAL; +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace LevelOS +{ + /// + /// Modelo base para todos os formulários do sistema. + /// Herde esta classe e implemente os membros abstratos. + /// + public abstract class FormularioModelo : UserControl + { + // ── CONEXÃO ─────────────────────────────────────────────────────────── + protected string _cx = DadosDaConexao.ObterConexao(); + + // ── CORES DO SISTEMA ────────────────────────────────────────────────── + protected readonly Color AccentBlue = Color.FromArgb(37, 99, 235); + protected readonly Color TextDark = Color.FromArgb(30, 41, 59); + protected readonly Color BorderColor = Color.FromArgb(226, 232, 240); + protected readonly Color BgLight = Color.FromArgb(248, 250, 252); + protected readonly Color ReadOnlyBg = Color.FromArgb(241, 245, 249); + protected readonly Color ReadOnlyBorder = Color.FromArgb(203, 213, 225); + + // ── PAINÉIS ESTRUTURAIS ─────────────────────────────────────────────── + protected Panel pnlToolbar = null!; + protected Panel pnlTitulo = null!; + protected Panel mainScroll = null!; + protected Panel content = null!; + + // ── BOTÕES DA TOOLBAR ───────────────────────────────────────────────── + protected Button btnNovo = null!; + protected Button btnAlterar = null!; + protected Button btnExcluir = null!; + protected Button btnLocalizar = null!; + protected Button btnSalvar = null!; + protected Button btnCancelar = null!; + + // ── TÍTULO ──────────────────────────────────────────────────────────── + private Label lblTitulo = null!; + + /// Título exibido no cabeçalho do formulário. + public string Titulo + { + get => lblTitulo.Text; + set => lblTitulo.Text = value; + } + + // ── CONSTRUTOR ──────────────────────────────────────────────────────── + protected FormularioModelo() + { + Dock = DockStyle.Fill; + BackColor = Color.White; + DoubleBuffered = true; + + BuildToolbar(); + BuildTitulo(); + BuildScrollArea(); + + // Liga os eventos abstratos + btnNovo.Click += (s, e) => OnNovo(); + btnAlterar.Click += (s, e) => OnAlterar(); + btnExcluir.Click += (s, e) => OnExcluir(); + btnLocalizar.Click += (s, e) => OnLocalizar(); + btnSalvar.Click += (s, e) => OnSalvar(); + btnCancelar.Click += (s, e) => OnCancelar(); + } + + // ── CONSTRUÇÃO DA INTERFACE ─────────────────────────────────────────── + + private void BuildToolbar() + { + pnlToolbar = new Panel + { + Dock = DockStyle.Top, + Height = 55, + BackColor = Color.FromArgb(248, 250, 252) + }; + + var flow = new FlowLayoutPanel + { + Dock = DockStyle.Fill, + Padding = new Padding(12, 10, 0, 0), + BackColor = Color.Transparent + }; + + btnNovo = CreateToolbarButton("Novo", Color.FromArgb(34, 197, 94)); + btnAlterar = CreateToolbarButton("Alterar", Color.FromArgb(245, 158, 11)); + btnExcluir = CreateToolbarButton("Excluir", Color.FromArgb(239, 68, 68)); + btnLocalizar = CreateToolbarButton("Localizar", AccentBlue); + btnSalvar = CreateToolbarButton("Salvar", AccentBlue); + btnCancelar = CreateToolbarButton("Cancelar", Color.FromArgb(148, 163, 184)); + + flow.Controls.AddRange(new Control[] + { btnNovo, btnAlterar, btnExcluir, btnLocalizar, btnSalvar, btnCancelar }); + + pnlToolbar.Controls.Add(flow); + this.Controls.Add(pnlToolbar); + } + + private void BuildTitulo() + { + pnlTitulo = new Panel + { + Dock = DockStyle.Top, + Height = 42, + BackColor = Color.White + }; + + // Linha separadora no topo do título + var linha = new Panel + { + Dock = DockStyle.Top, + Height = 1, + BackColor = BorderColor + }; + + lblTitulo = new Label + { + Dock = DockStyle.Fill, + Text = "Título do Formulário", + Font = new Font("Segoe UI", 13f, FontStyle.Bold), + ForeColor = AccentBlue, + TextAlign = ContentAlignment.MiddleLeft, + Padding = new Padding(16, 0, 0, 0) + }; + + pnlTitulo.Controls.Add(lblTitulo); + pnlTitulo.Controls.Add(linha); + this.Controls.Add(pnlTitulo); + } + + private void BuildScrollArea() + { + mainScroll = new Panel + { + Dock = DockStyle.Fill, + AutoScroll = true, + BackColor = Color.White + }; + + content = new Panel + { + Width = 1100, + Height = 900, + Location = new Point(0, 0), + BackColor = Color.White + }; + + mainScroll.Controls.Add(content); + this.Controls.Add(mainScroll); + mainScroll.BringToFront(); + } + + // ── HELPERS DISPONÍVEIS PARA AS SUBCLASSES ──────────────────────────── + + /// Cria um cabeçalho de seção com linha separadora. + protected Panel CreateSectionHeader(string title, int y) + { + var pnl = new Panel { Location = new Point(20, y), Width = 1000, Height = 26 }; + + var lbl = new Label + { + Text = title, + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = AccentBlue, + AutoSize = true, + Location = new Point(0, 0) + }; + + var line = new Panel + { + BackColor = BorderColor, + Height = 1, + Width = 980, + Location = new Point(0, 20) + }; + + pnl.Controls.Add(lbl); + pnl.Controls.Add(line); + return pnl; + } + + /// Cria um campo LV_TEXTBOX1 com label acima. + protected LV_TEXTBOX1 AddInput(Control parent, string label, + int x, int y, int width, int height, + bool readOnly = false) + { + var lbl = new Label + { + Text = label, + Location = new Point(x, y), + Font = new Font("Segoe UI", 7.5f, FontStyle.Bold), + ForeColor = readOnly ? Color.Gray : TextDark, + AutoSize = true + }; + + var txt = new LV_TEXTBOX1 + { + Location = new Point(x, y + 16), + Size = new Size(width, height), + BorderColor = readOnly ? ReadOnlyBorder : BorderColor, + BorderFocusColor = AccentBlue, + ReadOnly = readOnly, + BackColor = readOnly ? ReadOnlyBg : Color.White + }; + + parent.Controls.Add(lbl); + parent.Controls.Add(txt); + return txt; + } + + /// Cria um CheckBox padrão do sistema. + protected CheckBox CreateCheckBox(string text, int x, int y) => new CheckBox + { + Text = text, + Location = new Point(x, y), + Font = new Font("Segoe UI", 8.5f, FontStyle.Bold), + ForeColor = TextDark, + AutoSize = true + }; + + /// Cria um botão extra para a toolbar (ex: Ficha PDF, Certificado). + protected Button CreateToolbarButton(string text, Color color) => new Button + { + Text = text, + Size = new Size(95, 32), + BackColor = color, + ForeColor = Color.White, + Font = new Font("Segoe UI Semibold", 8.5f), + Margin = new Padding(0, 0, 6, 0), + Cursor = Cursors.Hand, + FlatStyle = FlatStyle.Flat, + FlatAppearance = { BorderSize = 0 } + }; + + /// Adiciona um botão extra na toolbar (após os padrões). + protected void AddToolbarButton(Button btn) + { + var flow = pnlToolbar.Controls[0] as FlowLayoutPanel; + flow?.Controls.Add(btn); + } + + // ── EVENTOS ABSTRATOS (cada formulário implementa o seu) ────────────── + + protected abstract void OnNovo(); + protected abstract void OnAlterar(); + protected abstract void OnExcluir(); + protected abstract void OnLocalizar(); + protected abstract void OnSalvar(); + protected abstract void OnCancelar(); + } +} \ No newline at end of file diff --git a/UI/Program.cs b/UI/Program.cs new file mode 100644 index 0000000..aa757f5 --- /dev/null +++ b/UI/Program.cs @@ -0,0 +1,20 @@ +using CCH; + +namespace UI +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + AppFolderSystem.CriarEstruturaPastas(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/UI/README.md b/UI/README.md new file mode 100644 index 0000000..e69de29 diff --git a/UI/RoundComboBox.cs b/UI/RoundComboBox.cs new file mode 100644 index 0000000..015e1ad --- /dev/null +++ b/UI/RoundComboBox.cs @@ -0,0 +1,125 @@ +using System.Drawing.Drawing2D; + +namespace UI +{ + public class RoundComboBox : UserControl + { + private ComboBox _comboBox = null!; + public int Radius { get; set; } = 4; + public Color BorderColor { get; set; } = Color.LightGray; + public Color FocusColor { get; set; } = Color.Blue; + private bool _focused; + + public ComboBoxStyle DropDownStyle + { + get => _comboBox.DropDownStyle; + set => _comboBox.DropDownStyle = value; + } + + public ComboBox.ObjectCollection Items => _comboBox.Items; + + public object? SelectedItem + { + get => _comboBox.SelectedItem; + set => _comboBox.SelectedItem = value; + } + + public int SelectedIndex + { + get => _comboBox.SelectedIndex; + set => _comboBox.SelectedIndex = value; + } + + public override string Text + { + get => _comboBox.Text; + set => _comboBox.Text = value; + } + + public new Color BackColor + { + get => base.BackColor; + set { base.BackColor = value; if (_comboBox != null) _comboBox.BackColor = value; } + } + + public new event EventHandler? SelectedIndexChanged + { + add => _comboBox.SelectedIndexChanged += value; + remove => _comboBox.SelectedIndexChanged -= value; + } + + public RoundComboBox() + { + DoubleBuffered = true; + base.BackColor = Color.White; + + _comboBox = new ComboBox + { + //BorderStyle = BorderStyle.None, + Font = new Font("Segoe UI", 9f), + BackColor = Color.White, + DropDownStyle = ComboBoxStyle.DropDownList, + FlatStyle = FlatStyle.Flat + }; + + _comboBox.GotFocus += (s, e) => { _focused = true; Invalidate(); }; + _comboBox.LostFocus += (s, e) => { _focused = false; Invalidate(); }; + _comboBox.TextChanged += (s, e) => OnTextChanged(e); + _comboBox.Leave += (s, e) => OnLeave(e); + + Controls.Add(_comboBox); + SizeChanged += (s, e) => AjustarComboBox(); + } + + private void AjustarComboBox() + { + _comboBox.Width = Width - 12; + _comboBox.Location = new Point(6, (Height - _comboBox.PreferredHeight) / 2); + } + public object? DataSource + { + get => _comboBox.DataSource; + set => _comboBox.DataSource = value; + } + + public string DisplayMember + { + get => _comboBox.DisplayMember; + set => _comboBox.DisplayMember = value; + } + + public string ValueMember + { + get => _comboBox.ValueMember; + set => _comboBox.ValueMember = value; + } + + public object? SelectedValue + { + get => _comboBox.SelectedValue; + set => _comboBox.SelectedValue = value; + } + + protected override void OnPaint(PaintEventArgs e) + { + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + using var path = GetPath(new Rectangle(0, 0, Width - 1, Height - 1), Radius); + using var brush = new SolidBrush(BackColor); + e.Graphics.FillPath(brush, path); + using var pen = new Pen(_focused ? FocusColor : BorderColor, _focused ? 1.5f : 1f); + e.Graphics.DrawPath(pen, path); + } + + private static GraphicsPath GetPath(Rectangle r, int rad) + { + var path = new GraphicsPath(); + int d = rad * 2; + path.AddArc(r.X, r.Y, d, d, 180, 90); + path.AddArc(r.Right - d, r.Y, d, d, 270, 90); + path.AddArc(r.Right - d, r.Bottom - d, d, d, 0, 90); + path.AddArc(r.X, r.Bottom - d, d, d, 90, 90); + path.CloseFigure(); + return path; + } + } +} diff --git a/UI/UI.csproj b/UI/UI.csproj new file mode 100644 index 0000000..d6968f4 --- /dev/null +++ b/UI/UI.csproj @@ -0,0 +1,28 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UI/UI.sln b/UI/UI.sln new file mode 100644 index 0000000..98d7aab --- /dev/null +++ b/UI/UI.sln @@ -0,0 +1,79 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 18 +VisualStudioVersion = 18.4.11626.88 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI", "UI.csproj", "{344A1172-B978-A3CB-44BF-B15E6902C6C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLL", "..\MLL\MLL.csproj", "{BD112D2C-C31D-4DC4-A3C8-2C5808C17D53}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCH", "..\CCH\CCH.csproj", "{AD6AD8F1-7AE1-4BFC-A7EB-5F5B37EFE4C0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLL", "..\TLL\TLL.csproj", "{A5F3E468-7A97-4C71-8E75-CD2CAF8B477C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPT", "..\CPT\CPT.csproj", "{970FFDEE-6F66-49FD-B41F-EBC8F50C547C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL", "..\DAL\DAL.csproj", "{9696C45A-97A2-445E-BE10-BB3EE320BFDF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLL", "..\BLL\BLL.csproj", "{68B73E29-9E25-4BCA-B077-400F6B2B450B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPM", "..\CPM\CPM.csproj", "{20B46C82-119A-F5E9-8B57-A756A827F265}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CAB", "..\CAB\CAB.csproj", "{19039AC1-EE08-460B-821B-0277442D04D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMB", "..\CMB\CMB.csproj", "{766E76F2-BAFF-4352-B376-15F6DE8BE4D9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {344A1172-B978-A3CB-44BF-B15E6902C6C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {344A1172-B978-A3CB-44BF-B15E6902C6C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {344A1172-B978-A3CB-44BF-B15E6902C6C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {344A1172-B978-A3CB-44BF-B15E6902C6C7}.Release|Any CPU.Build.0 = Release|Any CPU + {BD112D2C-C31D-4DC4-A3C8-2C5808C17D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD112D2C-C31D-4DC4-A3C8-2C5808C17D53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD112D2C-C31D-4DC4-A3C8-2C5808C17D53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD112D2C-C31D-4DC4-A3C8-2C5808C17D53}.Release|Any CPU.Build.0 = Release|Any CPU + {AD6AD8F1-7AE1-4BFC-A7EB-5F5B37EFE4C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD6AD8F1-7AE1-4BFC-A7EB-5F5B37EFE4C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD6AD8F1-7AE1-4BFC-A7EB-5F5B37EFE4C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD6AD8F1-7AE1-4BFC-A7EB-5F5B37EFE4C0}.Release|Any CPU.Build.0 = Release|Any CPU + {A5F3E468-7A97-4C71-8E75-CD2CAF8B477C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5F3E468-7A97-4C71-8E75-CD2CAF8B477C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5F3E468-7A97-4C71-8E75-CD2CAF8B477C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5F3E468-7A97-4C71-8E75-CD2CAF8B477C}.Release|Any CPU.Build.0 = Release|Any CPU + {970FFDEE-6F66-49FD-B41F-EBC8F50C547C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {970FFDEE-6F66-49FD-B41F-EBC8F50C547C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {970FFDEE-6F66-49FD-B41F-EBC8F50C547C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {970FFDEE-6F66-49FD-B41F-EBC8F50C547C}.Release|Any CPU.Build.0 = Release|Any CPU + {9696C45A-97A2-445E-BE10-BB3EE320BFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9696C45A-97A2-445E-BE10-BB3EE320BFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9696C45A-97A2-445E-BE10-BB3EE320BFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9696C45A-97A2-445E-BE10-BB3EE320BFDF}.Release|Any CPU.Build.0 = Release|Any CPU + {68B73E29-9E25-4BCA-B077-400F6B2B450B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68B73E29-9E25-4BCA-B077-400F6B2B450B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68B73E29-9E25-4BCA-B077-400F6B2B450B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68B73E29-9E25-4BCA-B077-400F6B2B450B}.Release|Any CPU.Build.0 = Release|Any CPU + {20B46C82-119A-F5E9-8B57-A756A827F265}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20B46C82-119A-F5E9-8B57-A756A827F265}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20B46C82-119A-F5E9-8B57-A756A827F265}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20B46C82-119A-F5E9-8B57-A756A827F265}.Release|Any CPU.Build.0 = Release|Any CPU + {19039AC1-EE08-460B-821B-0277442D04D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19039AC1-EE08-460B-821B-0277442D04D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19039AC1-EE08-460B-821B-0277442D04D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19039AC1-EE08-460B-821B-0277442D04D1}.Release|Any CPU.Build.0 = Release|Any CPU + {766E76F2-BAFF-4352-B376-15F6DE8BE4D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {766E76F2-BAFF-4352-B376-15F6DE8BE4D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {766E76F2-BAFF-4352-B376-15F6DE8BE4D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {766E76F2-BAFF-4352-B376-15F6DE8BE4D9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {15E7E724-DCEE-49C0-90C5-A55F1E2F06BD} + EndGlobalSection +EndGlobal