Compare commits
No commits in common. "407b4b4b172d3c5ff4ad7aaac32a9eb8d0ba3af2" and "577e97245b8945b1bfd71ca7bb3971042d27d2a9" have entirely different histories.
407b4b4b17
...
577e97245b
14
.gitignore
vendored
@ -1,18 +1,6 @@
|
|||||||
.vs/
|
.vs/
|
||||||
<<<<<<< HEAD
|
|
||||||
**/.vs/
|
|
||||||
bin/
|
|
||||||
obj/
|
|
||||||
*.dll
|
|
||||||
*.exe
|
|
||||||
*.pdb
|
|
||||||
*.cache
|
|
||||||
*.user
|
|
||||||
*.suo
|
|
||||||
=======
|
|
||||||
bin/
|
bin/
|
||||||
obj/
|
obj/
|
||||||
*.user
|
*.user
|
||||||
*.suo
|
*.suo
|
||||||
*.cache
|
*.cache
|
||||||
>>>>>>> 577e97245b8945b1bfd71ca7bb3971042d27d2a9
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\DAL\DAL.csproj" />
|
|
||||||
<ProjectReference Include="..\MLL\MLL.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
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<ModeloAgenda> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
111
BLL/BLLBancos.cs
@ -1,111 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,149 +0,0 @@
|
|||||||
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<ModeloCliente> 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
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<ModeloEmpresa> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
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<ModeloEmpresaConfig> 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
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<ModeloFuncionarios> Listar()
|
|
||||||
{
|
|
||||||
return dal.Listar();
|
|
||||||
}//List<ModeloFuncionarios>
|
|
||||||
public List<ModeloFuncionarios> LocalizarOtimizado(ModeloFuncionarios filtro)
|
|
||||||
{
|
|
||||||
return dal.LocalizarOtimizado(filtro);
|
|
||||||
}//List<ModeloFuncionarios> 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/>
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
||||||
108
CAB/CAB.csproj
@ -1,108 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{19039AC1-EE08-460B-821B-0277442D04D1}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<RootNamespace>CAB</RootNamespace>
|
|
||||||
<AssemblyName>CAB</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Deployment" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Form1.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Form1.Designer.cs">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Form_Alert.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Form_Alert.Designer.cs">
|
|
||||||
<DependentUpon>Form_Alert.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<EmbeddedResource Include="Form1.resx">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Form_Alert.resx">
|
|
||||||
<DependentUpon>Form_Alert.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Compile>
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\error.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\icons8_cancel_25px.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\info.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\success.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\warning.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
||||||
131
CAB/Form1.Designer.cs
generated
@ -1,131 +0,0 @@
|
|||||||
namespace CAB
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
45
CAB/Form1.cs
@ -1,45 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
120
CAB/Form1.resx
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
100
CAB/Form_Alert.Designer.cs
generated
@ -1,100 +0,0 @@
|
|||||||
namespace CAB
|
|
||||||
{
|
|
||||||
partial class Form_Alert
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,139 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace CAB
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new Form1());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
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")]
|
|
||||||
113
CAB/Properties/Resources.Designer.cs
generated
@ -1,113 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace CAB.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc.
|
|
||||||
/// </summary>
|
|
||||||
// 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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retorna a instância de ResourceManager armazenada em cache usada por essa classe.
|
|
||||||
/// </summary>
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap error {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("error", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap icons8_cancel_25px {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("icons8_cancel_25px", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap info {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("info", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap success {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("success", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap warning {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("warning", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,136 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="icons8_cancel_25px" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\icons8_cancel_25px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="info" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="success" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\success.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
||||||
26
CAB/Properties/Settings.Designer.cs
generated
@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
||||||
|
Before Width: | Height: | Size: 815 B |
|
Before Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 778 B |
|
Before Width: | Height: | Size: 937 B |
|
Before Width: | Height: | Size: 771 B |
@ -1,33 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Resources.Extensions" Version="10.0.5" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TLL\TLL.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
227
CMB/FormMessageBox.Designer.cs
generated
@ -1,227 +0,0 @@
|
|||||||
|
|
||||||
namespace CMB
|
|
||||||
{
|
|
||||||
partial class FormMessageBox
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,298 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
113
CMB/Properties/Resources.Designer.cs
generated
@ -1,113 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace CMB.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc.
|
|
||||||
/// </summary>
|
|
||||||
// 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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retorna a instância de ResourceManager armazenada em cache usada por essa classe.
|
|
||||||
/// </summary>
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap chat {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("chat", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap error {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("error", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap exclamation {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("exclamation", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap information {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("information", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consulta um recurso localizado do tipo System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap question {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("question", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,136 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="chat" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\chat.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="exclamation" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\exclamation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="information" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="question" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 992 B |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 954 B |
|
Before Width: | Height: | Size: 822 B |
@ -1,177 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Imagens\calendarDark.png" />
|
|
||||||
<None Remove="Imagens\calendarWhite.png" />
|
|
||||||
<None Remove="Imagens\chat.png" />
|
|
||||||
<None Remove="Imagens\error.png" />
|
|
||||||
<None Remove="Imagens\exclamation.png" />
|
|
||||||
<None Remove="Imagens\information.png" />
|
|
||||||
<None Remove="Imagens\question.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Imagens\calendarDark.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\calendarWhite.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\chat.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\error.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\exclamation.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\information.png" />
|
|
||||||
<EmbeddedResource Include="Imagens\question.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
|
||||||
<Generator></Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,347 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,164 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
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; } }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 894 B |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 992 B |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 954 B |
|
Before Width: | Height: | Size: 822 B |
@ -1,322 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
62
CPM/MasktedTextbox/NT-MASKTEDTEXTBOX.Designer.cs
generated
@ -1,62 +0,0 @@
|
|||||||
namespace ControllsCustom.NT_MASKTEXTBOX
|
|
||||||
{
|
|
||||||
partial class LV_MASKTEDTEXTBOX
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Variável de designer necessária.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Limpar os recursos que estão sendo usados.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true se for necessário descartar os recursos gerenciados; caso contrário, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Código gerado pelo Designer de Componentes
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Método necessário para suporte ao Designer - não modifique
|
|
||||||
/// o conteúdo deste método com o editor de código.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,126 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,272 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
63
CPM/Properties/Resources.Designer.cs
generated
@ -1,63 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace CPM.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc.
|
|
||||||
/// </summary>
|
|
||||||
// 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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retorna a instância de ResourceManager armazenada em cache usada por essa classe.
|
|
||||||
/// </summary>
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 1.3
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">1.3</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1">this is my long string</data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
[base64 mime encoded serialized .NET Framework object]
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>1.3</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
}
|
|
||||||
45
CPM/Test/FrmTestComponents.Designer.cs
generated
@ -1,45 +0,0 @@
|
|||||||
namespace CPM.Test
|
|
||||||
{
|
|
||||||
partial class FrmTestComponents
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// FrmTestComponents
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(739, 605);
|
|
||||||
Name = "FrmTestComponents";
|
|
||||||
Text = "FrmTestComponents";
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@ -1,210 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
60
CPM/Textbox/LV_TEXTBOX1.Designer.cs
generated
@ -1,60 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,162 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="10.0.6" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\DAL\DAL.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
namespace CPT
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,144 +0,0 @@
|
|||||||
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 };
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Criptografa uma string usando DPAPI e retorna em Base64.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Descriptografa uma string Base64 vinda do DPAPI.
|
|
||||||
/// </summary>
|
|
||||||
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");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Salva a string de conexão criptografada no disco.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Lê do disco e retorna a string de conexão já descriptografada.
|
|
||||||
/// </summary>
|
|
||||||
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<AppConfig>(json);
|
|
||||||
|
|
||||||
// 3. Descriptografa e retorna
|
|
||||||
return SecurityManager.Decrypt(config.EncryptedConnectionString);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw new Exception("Erro ao carregar configuração: " + ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MLL\MLL.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
207
DAL/DALAgenda.cs
@ -1,207 +0,0 @@
|
|||||||
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<ModeloAgenda> Listar()
|
|
||||||
{
|
|
||||||
var lista = new List<ModeloAgenda>();
|
|
||||||
|
|
||||||
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<ModeloAgenda>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
210
DAL/DALBancos.cs
@ -1,210 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,277 +0,0 @@
|
|||||||
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<ModeloCliente> Listar()
|
|
||||||
{
|
|
||||||
var lista = new List<ModeloCliente>();
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,315 +0,0 @@
|
|||||||
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<ModeloEmpresa> Listar()
|
|
||||||
{
|
|
||||||
var lista = new List<ModeloEmpresa>();
|
|
||||||
|
|
||||||
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<ModeloEmpresa>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,250 +0,0 @@
|
|||||||
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<ModeloEmpresaConfig> LocalizarTodas()
|
|
||||||
{
|
|
||||||
List<ModeloEmpresaConfig> lista = new List<ModeloEmpresaConfig>();
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
@ -1,422 +0,0 @@
|
|||||||
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<ModeloFuncionarios> Listar()
|
|
||||||
{
|
|
||||||
List<ModeloFuncionarios> lista = new List<ModeloFuncionarios>();
|
|
||||||
|
|
||||||
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<ModeloFuncionarios>
|
|
||||||
public List<ModeloFuncionarios> LocalizarOtimizado(ModeloFuncionarios filtro)
|
|
||||||
{
|
|
||||||
List<ModeloFuncionarios> lista = new List<ModeloFuncionarios>();
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,174 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||