diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Ferramentas | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.tar.gz gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas')
19 files changed, 1545 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs new file mode 100644 index 0000000..9d71ebe --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Agenda : DomainBase, IDomain +{ + public string Nome { get; set; } + + public string Endereco { get; set; } + + public string Cep { get; set; } + + public string Numero { get; set; } + + public string Complemento { get; set; } + + public string Bairro { get; set; } + + public string Cidade { get; set; } + + public string Estado { get; set; } + + public string Observacao { get; set; } + + public ObservableCollection<AgendaTelefone> Telefones { get; set; } + + public ObservableCollection<AgendaEmail> Emails { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Nome)) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + list.Add(new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(Cep) ? "" : Cep, ""), + new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(Endereco) ? "" : Endereco, ""), + new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(Numero) ? "" : Numero, ""), + new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(Complemento) ? "" : Complemento, ""), + new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(Bairro) ? "" : Bairro, ""), + new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(Cidade) ? "" : Cidade, ""), + new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(Estado) ? "" : Estado, ""), + new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "") + } + }); + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TELEFONES$", "", "") + }; + foreach (AgendaTelefone telefone in Telefones) + { + observableCollection.Add(new Tuple<string, string, string>($" TELEFONE {Telefones.IndexOf(telefone) + 1}$", "", "")); + object item; + if (telefone.Tipo.HasValue) + { + TipoTelefone? tipo = telefone.Tipo; + item = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + observableCollection.Add(new Tuple<string, string, string>(" TIPO", (string)item, "")); + observableCollection.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper(), "")); + observableCollection.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero, "")); + observableCollection.Add(new Tuple<string, string, string>(" DESCRIÇÃO", string.IsNullOrWhiteSpace(telefone.Observacao) ? "" : telefone.Observacao, "")); + } + list.Add(new TupleList + { + Tuples = observableCollection + }); + ObservableCollection<Tuple<string, string, string>> observableCollection2 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("EMAILS$", "", "") + }; + foreach (AgendaEmail email in Emails) + { + observableCollection2.Add(new Tuple<string, string, string>($" EMAIL {Emails.IndexOf(email) + 1}$", "", "")); + observableCollection2.Add(new Tuple<string, string, string>(" ENDEREÇO DE EMAIL", string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email, "")); + } + list.Add(new TupleList + { + Tuples = observableCollection2 + }); + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaEmail.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaEmail.cs new file mode 100644 index 0000000..021bd75 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaEmail.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class AgendaEmail : EmailBase, IDomain +{ + public bool Selecionado { get; set; } + + public Agenda Agenda { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Email)) + { + list.AddValue("Email", Messages.Obrigatorio); + } + else if (base.Email.Length > 80) + { + list.AddValue("Email", string.Format(Messages.MaiorQueLimite, 80)); + } + else if (!base.Email.ValidacaoEmail()) + { + list.AddValue("Email", Messages.Invalido); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaTelefone.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaTelefone.cs new file mode 100644 index 0000000..59eb595 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/AgendaTelefone.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class AgendaTelefone : TelefoneBase, IDomain +{ + public Agenda Agenda { get; set; } + + public string Observacao { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + return ValidateBase(); + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/CategoriaTarefa.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/CategoriaTarefa.cs new file mode 100644 index 0000000..8200627 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/CategoriaTarefa.cs @@ -0,0 +1,8 @@ +using Gestor.Model.Domain.Generic; + +namespace Gestor.Model.Domain.Ferramentas; + +public class CategoriaTarefa : DomainBase +{ + public string Descricao { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Credencial.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Credencial.cs new file mode 100644 index 0000000..b6ef66d --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Credencial.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Text.RegularExpressions; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Credencial : DomainBase, IDomain +{ + private string _descricao; + + private string _assinatura; + + private string _header; + + private string _cabecalho; + + public long IdEmpresa { get; set; } + + public long IdUsuario { get; set; } + + [Log(true)] + public string Header + { + get + { + return _header; + } + set + { + _header = value; + } + } + + [Log(true)] + [Description("DESCRIÇÃO")] + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + } + } + + [Log(true)] + [Description("PORTA")] + public int? Porta { get; set; } + + [Log(true)] + [Description("E-MAIL")] + public string Email { get; set; } + + [Log(true)] + [Description("DOMÍNIO")] + public string Dominio { get; set; } + + [Log(true)] + [Description("SEGURO")] + public bool Seguro { get; set; } + + [Log(true)] + [Description("USUÁRIO")] + public string Usuario { get; set; } + + [Log(true)] + [Description("SENHA")] + public string Senha { get; set; } + + [Log(true)] + public TipoEmail Tipo { get; set; } + + public string Cabecalho + { + get + { + return _cabecalho; + } + set + { + _cabecalho = value ?? ""; + } + } + + [Log(true)] + [Description("ASSINATURA")] + public string Assinatura + { + get + { + return _assinatura; + } + set + { + _assinatura = value ?? ""; + } + } + + public string Replyto { get; set; } + + public bool Excluido { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrEmpty(Descricao)) + { + list.AddValue("Descricao|DESCRIÇÃO", Messages.Obrigatorio); + } + else if (Descricao.Length > 50) + { + list.AddValue("Descricao|DESCRIÇÃO", string.Format(Messages.MaiorQueLimite, 50)); + } + if (Tipo == TipoEmail.Outros) + { + if (!Porta.HasValue) + { + list.AddValue("Porta", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(Dominio)) + { + list.AddValue("Dominio|DOMÍNIO", Messages.Obrigatorio); + } + else if (Dominio.Length > 80) + { + list.AddValue("Dominio|DOMÍNIO", string.Format(Messages.MaiorQueLimite, 80)); + } + if (string.IsNullOrEmpty(Usuario)) + { + list.AddValue("Usuario|USUÁRIO", Messages.Obrigatorio); + } + else if (Usuario.Length > 50) + { + list.AddValue("Usuario|USUÁRIO", string.Format(Messages.MaiorQueLimite, 50)); + } + if (string.IsNullOrEmpty(Senha)) + { + list.AddValue("Senha", Messages.Obrigatorio); + } + else if (Senha.Length > 50) + { + list.AddValue("Senha", string.Format(Messages.MaiorQueLimite, 50)); + } + } + if (string.IsNullOrWhiteSpace(Email)) + { + list.AddValue("Email|E-MAIL", Messages.Obrigatorio); + } + else if (Email.Length > 80) + { + list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 80)); + } + else if (!Email.ValidacaoEmail()) + { + list.AddValue("Email|E-MAIL", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(Replyto) && !Replyto.ValidacaoEmail()) + { + list.AddValue("Replyto|RESPONDER PARA", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + Assinatura = new Regex("<title>.*<\\/title>").Replace(Assinatura, "").Trim(); + Assinatura = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(Assinatura, "").Trim(); + list.Add(new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("PORTA", (!Porta.HasValue) ? "" : Porta?.ToString(), ""), + new Tuple<string, string, string>("DOMÍNIO", string.IsNullOrWhiteSpace(Dominio) ? "" : Dominio, ""), + new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""), + new Tuple<string, string, string>("LOGIN", string.IsNullOrWhiteSpace(Usuario) ? "" : Usuario, ""), + new Tuple<string, string, string>("CERTIFICADO DE SEGURANÇA", Seguro ? "SIM" : "NÃO", ""), + new Tuple<string, string, string>("ASSINATURA", string.IsNullOrWhiteSpace(Assinatura) ? "" : Assinatura, "") + } + }); + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Destinatario.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Destinatario.cs new file mode 100644 index 0000000..7e2b60a --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Destinatario.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Destinatario : DomainBase +{ + public string Nome { get; set; } + + public string Sobrenome { get; set; } + + public string Email { get; set; } + + public List<string> Encaminhar { get; set; } + + public List<string> EncaminharOculto { get; set; } + + public string Assunto { get; set; } + + public string Corpo { get; set; } + + public List<ArquivoDigital> Anexos { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Fase.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Fase.cs new file mode 100644 index 0000000..b42f975 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Fase.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Fase : DomainBase +{ + public Trilha Trilha { get; set; } + + public string Titulo { get; set; } + + public string Descricao { get; set; } + + public DateTime? Expiracao { get; set; } + + public List<Tarefa> Tarefas { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs new file mode 100644 index 0000000..50b50be --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Imposto.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Imposto : DomainBase, IDomain +{ + public Seguradora Seguradora { get; set; } + + public Ramo Ramo { get; set; } + + public decimal Ir { get; set; } + + public decimal Iss { get; set; } + + public decimal Outros { get; set; } + + public decimal Desconto { get; set; } + + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Ir > 1m) + { + list.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MAIOR QUE 100%."); + } + if (Iss > 1m) + { + list.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MAIOR QUE 100%."); + } + if (Outros > 1m) + { + list.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MAIOR QUE 100%."); + } + if (Desconto > 1m) + { + list.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MAIOR QUE 100%."); + } + if (Ir < 0m) + { + list.AddValue("Ir|PORCENTAGEM IR", "O VALOR DE IR NÃO PODE SER MENOR QUE 0%."); + } + if (Iss < 0m) + { + list.AddValue("Iss|PORCENTAGEM ISS", "O VALOR DE ISS NÃO PODE SER MENOR QUE 0%."); + } + if (Outros < 0m) + { + list.AddValue("Outros|PORCENTAGEM OUTROS", "O VALOR DOS OUTROS DESCONTOS NÃO PODE SER MENOR QUE 0%."); + } + if (Desconto < 0m) + { + list.AddValue("Desconto|PORCENTAGEM DESCONTO", "O VALOR DE DESCONTO NÃO PODE SER MENOR QUE 0%."); + } + if (Ir + Iss + Outros + Desconto > 1m) + { + list.AddValue("Ir|PORCENTAGEM TOTAL", "NÃO É POSSÍVEL DEDUZIR MAIS QUE 100% DO TOTAL RECEBIDO."); + } + if (Ir + Iss + Outros + Desconto == 0m) + { + list.AddValue("Ir|PORCENTAGEM TOTAL", "A SOMA DOS IMPOSTOS DEVEM SER MAIOR QUE 0 (ZERO)."); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("RAMO", Ramo?.Nome ?? "", ""), + new Tuple<string, string, string>("SEGURADORA", Seguradora?.NomeSocial ?? Seguradora?.Nome ?? "", ""), + new Tuple<string, string, string>("IR", Ir.ToString("p"), ""), + new Tuple<string, string, string>("ISS", Iss.ToString("p"), ""), + new Tuple<string, string, string>("OUTROS", Outros.ToString("p"), ""), + new Tuple<string, string, string>("DESCONTO", Desconto.ToString("p"), ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEmail.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEmail.cs new file mode 100644 index 0000000..b713416 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEmail.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text.RegularExpressions; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Validation; + +namespace Gestor.Model.Domain.Ferramentas; + +public class LogEmail : DomainBase +{ + public Credencial Credencial { get; set; } + + public TipoTela Tela { get; set; } + + public Relatorio Relatorio { get; set; } + + public long EntityId { get; set; } + + public string Assunto { get; set; } + + public string Corpo { get; set; } + + public string Destinatarios { get; set; } + + public string Cco { get; set; } + + public string Anexos { get; set; } + + public Usuario Usuario { get; set; } + + public DateTime Data { get; set; } + + public string Versao { get; set; } + + public string NomeMaquina { get; set; } + + public string UsuarioMaquina { get; set; } + + public string Ip { get; set; } + + public List<TupleList> CriarLogEmail() + { + Corpo = new Regex("<title>.*<\\/title>").Replace(Corpo, "").Trim(); + Corpo = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(Corpo, "").Trim(); + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("ASSUNTO", string.IsNullOrWhiteSpace(Assunto) ? "" : Assunto, ""), + new Tuple<string, string, string>("CORPO", string.IsNullOrWhiteSpace(Corpo) ? "" : Corpo, ""), + new Tuple<string, string, string>("E-MAIL DE ENVIO", string.IsNullOrWhiteSpace(Credencial?.Email) ? "" : Credencial?.Email, ""), + new Tuple<string, string, string>("DESTINATÁRIOS", string.IsNullOrWhiteSpace(Destinatarios) ? "" : Destinatarios, ""), + new Tuple<string, string, string>("ANEXOS", string.IsNullOrWhiteSpace(Anexos) ? "" : Anexos, ""), + new Tuple<string, string, string>("CCO", string.IsNullOrWhiteSpace(Cco) ? "" : Cco, ""), + new Tuple<string, string, string>("RELATORIO", string.IsNullOrWhiteSpace(Relatorio.GetDescription()) ? "" : Relatorio.GetDescription(), "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEnvio.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEnvio.cs new file mode 100644 index 0000000..80cf9e0 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEnvio.cs @@ -0,0 +1,12 @@ +namespace Gestor.Model.Domain.Ferramentas; + +public class LogEnvio +{ + public bool Enviado { get; set; } + + public Credencial Credencial { get; set; } + + public Destinatario Destinatario { get; set; } + + public string Erro { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/ManutencaoPagamentos.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/ManutencaoPagamentos.cs new file mode 100644 index 0000000..d40d220 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/ManutencaoPagamentos.cs @@ -0,0 +1,298 @@ +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Gestor.Model.Attributes; +using Gestor.Model.Common; + +namespace Gestor.Model.Domain.Ferramentas; + +public class ManutencaoPagamentos : INotifyPropertyChanged +{ + private bool _isExpanded; + + private bool _selecionado; + + private string _nome; + + private string _empresa; + + private string _apolice; + + private string _endosso; + + private string _seguradora; + + private string _ramo; + + private string _produto; + + private SubTipo _tipo; + + private decimal _valorRepasse; + + private DateTime _pagamento; + + private DateTime _previsaoPagamento; + + private string _vendedor; + + private decimal _valor; + + private DateTime? _recebimento; + + private int _parcela; + + [Tipo("INVALID")] + public long Id { get; set; } + + [Tipo("INVALID")] + public long IdDocumento { get; set; } + + [Tipo("INVALID")] + public long IdParcela { get; set; } + + [Tipo("INVALID")] + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + [Tipo("INVALID")] + public bool Selecionado + { + get + { + return _selecionado; + } + set + { + _selecionado = value; + OnPropertyChanged("Selecionado"); + } + } + + [Description("EMPRESA")] + public string Empresa + { + get + { + return _empresa?.ToUpper(); + } + set + { + _empresa = value; + OnPropertyChanged("Empresa"); + } + } + + [Description("CLIENTE")] + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + [Description("APÓLICE")] + public string Apolice + { + get + { + return _apolice?.ToUpper(); + } + set + { + _apolice = value; + OnPropertyChanged("Apolice"); + } + } + + [Description("ENDOSSO")] + public string Endosso + { + get + { + return _endosso?.ToUpper(); + } + set + { + _endosso = value; + OnPropertyChanged("Endosso"); + } + } + + [Description("SEGURADORA")] + public string Seguradora + { + get + { + return _seguradora?.ToUpper(); + } + set + { + _seguradora = value; + OnPropertyChanged("Seguradora"); + } + } + + [Description("RAMO")] + public string Ramo + { + get + { + return _ramo?.ToUpper(); + } + set + { + _ramo = value; + OnPropertyChanged("Ramo"); + } + } + + [Description("PRODUTO")] + public string Produto + { + get + { + return _produto?.ToUpper(); + } + set + { + _produto = value; + OnPropertyChanged("Produto"); + } + } + + [Description("TIPO DA PARCELA")] + public SubTipo Tipo + { + get + { + return _tipo; + } + set + { + _tipo = value; + OnPropertyChanged("Tipo"); + } + } + + [Description("PARCELA")] + public int Parcela + { + get + { + return _parcela; + } + set + { + _parcela = value; + OnPropertyChanged("Parcela"); + } + } + + [Description("RECEBIMENTO")] + public DateTime? Recebimento + { + get + { + return _recebimento; + } + set + { + _recebimento = value; + OnPropertyChanged("Recebimento"); + } + } + + [Description("VALOR DA PARCELA")] + public decimal Valor + { + get + { + return _valor; + } + set + { + _valor = value; + OnPropertyChanged("Valor"); + } + } + + [Description("VENDEDOR")] + public string Vendedor + { + get + { + return _vendedor?.ToUpper(); + } + set + { + _vendedor = value; + OnPropertyChanged("Vendedor"); + } + } + + [Description("PREVISÃO DE PAGAMENTO")] + public DateTime PrevisaoPagamento + { + get + { + return _previsaoPagamento; + } + set + { + _previsaoPagamento = value; + OnPropertyChanged("PrevisaoPagamento"); + } + } + + [Description("DATA DE PAGAMENTO")] + public DateTime Pagamento + { + get + { + return _pagamento; + } + set + { + _pagamento = value; + OnPropertyChanged("Pagamento"); + } + } + + [Description("VALOR DE REPASSE")] + public decimal ValorRepasse + { + get + { + return _valorRepasse; + } + set + { + _valorRepasse = value; + OnPropertyChanged("ValorRepasse"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/NotaFiscal.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/NotaFiscal.cs new file mode 100644 index 0000000..93a2749 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/NotaFiscal.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class NotaFiscal : DomainBase +{ + private bool _selecionado; + + public bool Selecionado + { + get + { + return _selecionado; + } + set + { + if (value != _selecionado) + { + _selecionado = value; + OnPropertyChanged("Selecionado"); + } + } + } + + [Log(true)] + public long? IdExtrato { get; set; } + + [Log(true)] + public Seguradora Seguradora { get; set; } + + [Log(true)] + [Description("ISS")] + public decimal Iss { get; set; } + + [Log(true)] + [Description("VALOR LÍQUIDO")] + public decimal ValorLiquido { get; set; } + + [Log(true)] + [Description("VALOR BRUTO")] + public decimal ValorBruto { get; set; } + + [Log(true)] + [Description("DATA")] + public DateTime? Data { get; set; } + + [Log(true)] + [Description("OBS")] + public string Obs { get; set; } + + [Log(true)] + [Description("ESTIPULANTE")] + public Estipulante Estipulante { get; set; } + + [Log(true)] + [Description("EXTRATO")] + public string Extrato { get; set; } + + [Log(true)] + [Description("IR")] + public decimal Ir { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Seguradora == null || string.IsNullOrEmpty(Seguradora.Nome)) + { + list.AddValue("Seguradora", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("SEGURADORA", string.IsNullOrWhiteSpace(Seguradora.Nome) ? "" : Seguradora.Nome, ""), + new Tuple<string, string, string>("ESTIPULANTE", string.IsNullOrWhiteSpace(Estipulante?.Nome) ? "" : Estipulante?.Nome, ""), + new Tuple<string, string, string>("ISS", Iss.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""), + new Tuple<string, string, string>("VALOR LÍQUIDO", ValorLiquido.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""), + new Tuple<string, string, string>("VALOR BRUTO", ValorBruto.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""), + new Tuple<string, string, string>("DATA", (!Data.HasValue) ? "" : Data?.ToShortDateString(), "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/OrigemCliente.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/OrigemCliente.cs new file mode 100644 index 0000000..f03d8f4 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/OrigemCliente.cs @@ -0,0 +1,16 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Model.Domain.Ferramentas; + +public class OrigemCliente : DomainBase +{ + public Cliente Cliente { get; set; } + + public long TipoOrigem { get; set; } + + [Log(true)] + [Name(true)] + public string Nome { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs new file mode 100644 index 0000000..e02140e --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Recibo : DomainBase, IDomain +{ + [Log(true)] + public TipoRecibo? Tipo { get; set; } + + [Log(true)] + public TipoPagamento? Pagamento { get; set; } + + [Log(true)] + public decimal Valor { get; set; } + + [Log(true)] + [Description("DATA DO RECIBO")] + public DateTime? DataRecibo { get; set; } + + [Log(true)] + public string Pagante { get; set; } + + [Log(true)] + [Description("DOCUMENTO PAGANTE")] + public string DocumentoPagante { get; set; } + + [Log(true)] + public string Recebedor { get; set; } + + [Log(true)] + [Description("DOCUMENTO RECEBEDOR")] + public string DocumentoRecebedor { get; set; } + + [Log(true)] + public string Referente { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Referente)) + { + list.AddValue("Referente|REFERENTE À(AO)", Messages.Obrigatorio); + } + if (DataRecibo.HasValue && (DateTime.Compare(DataRecibo.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataRecibo.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("DataRecibo|DATA DO RECIBO", Messages.Obrigatorio); + } + if (!DataRecibo.HasValue) + { + list.AddValue("DataRecibo|DATA DO RECIBO", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(DocumentoPagante)) + { + list.AddValue("DocumentoPagante|DOCUMENTO DO PAGANTE", Messages.Obrigatorio); + } + else if (!DocumentoPagante.ValidacaoDocumento()) + { + list.AddValue("DocumentoPagante|DOCUMENTO DO PAGANTE", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(DocumentoRecebedor)) + { + list.AddValue("DocumentoRecebedor|DOCUMENTO DO RECEBEDOR", Messages.Obrigatorio); + } + else if (!DocumentoRecebedor.ValidacaoDocumento()) + { + list.AddValue("DocumentoRecebedor|DOCUMENTO DO RECEBEDOR", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(Recebedor)) + { + list.AddValue("Recebedor", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Pagante)) + { + list.AddValue("Pagante", Messages.Obrigatorio); + } + if (!Pagamento.HasValue) + { + list.AddValue("Pagamento|FORMA DE PAGAMENTO", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(Referente) && Referente.Length >= 255) + { + list.AddValue("Referente|REFERENTE À(AO)", string.Format(Messages.MaiorQueLimite, 255)); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + TupleList tupleList = new TupleList(); + ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("PAGANTE", string.IsNullOrWhiteSpace(Pagante) ? "" : Pagante, ""), + new Tuple<string, string, string>("DOCUMENTO PAGANTE", string.IsNullOrWhiteSpace(DocumentoPagante) ? "" : DocumentoPagante, ""), + new Tuple<string, string, string>("RECEBEDOR", string.IsNullOrWhiteSpace(Recebedor) ? "" : Recebedor, ""), + new Tuple<string, string, string>("DOCUMENTO", string.IsNullOrWhiteSpace(DocumentoRecebedor) ? "" : DocumentoRecebedor, ""), + new Tuple<string, string, string>("TIPO DO RECIBO", Tipo.GetDescription(), "") + }; + object item; + if (Pagamento.HasValue) + { + TipoPagamento? pagamento = Pagamento; + item = (pagamento.HasValue ? pagamento.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + obj.Add(new Tuple<string, string, string>("PAGAMENTO", (string)item, "")); + obj.Add(new Tuple<string, string, string>("VALOR", Valor.ToString(new CultureInfo("pt-BR")), "")); + obj.Add(new Tuple<string, string, string>("DATA DO RECIBO", DataRecibo?.ToShortDateString(), "")); + obj.Add(new Tuple<string, string, string>("PAGANTE", string.IsNullOrWhiteSpace(Pagante) ? "" : Pagante, "")); + obj.Add(new Tuple<string, string, string>("RECEBEDOR", string.IsNullOrWhiteSpace(Recebedor) ? "" : Recebedor, "")); + obj.Add(new Tuple<string, string, string>("REFERENTE", string.IsNullOrWhiteSpace(Referente) ? "" : Referente, "")); + tupleList.Tuples = obj; + list.Add(tupleList); + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/ResponsavelTarefa.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/ResponsavelTarefa.cs new file mode 100644 index 0000000..ea7cc10 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/ResponsavelTarefa.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class ResponsavelTarefa : DomainBase, IDomain +{ + public long IdTarefa { get; set; } + + public Usuario Usuario { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Usuario == null || Usuario.Id == 0L) + { + list.AddValue("Usuario", Messages.Obrigatorio); + } + if (IdTarefa == 0L) + { + list.AddValue("IdTarefa", Messages.Obrigatorio); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/StatusDeProspeccao.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/StatusDeProspeccao.cs new file mode 100644 index 0000000..2e77bef --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/StatusDeProspeccao.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class StatusDeProspeccao : DomainBase +{ + private string _nome; + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + } + } + + [Log(true)] + [Description("DESCRIÇÃO")] + public string Descricao { get; set; } + + [Log(true)] + public bool Ativo { get; set; } + + public bool Excluido { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Nome)) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + else if (Nome.Length > 60) + { + list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60)); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", ""), + new Tuple<string, string, string>("EXCLUÍDO", Excluido ? "SIM" : "NÃO", "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs new file mode 100644 index 0000000..51bb764 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text.RegularExpressions; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Tarefa : DomainBase, IDomain +{ + public bool Aberto { get; set; } + + public string Cliente { get; set; } + + public long IdCliente { get; set; } + + public Trilha Trilha { get; set; } + + public Fase Fase { get; set; } + + public TipoDeTarefa TipoDeTarefa { get; set; } + + public TipoTarefa Entidade { get; set; } + + public long IdEntidade { get; set; } + + public Usuario UsuarioCadastro { get; set; } + + public Usuario Usuario { get; set; } + + public List<Usuario> UsuariosVinculados { get; set; } + + public DateTime Agendamento { get; set; } + + public DateTime? Conclusao { get; set; } + + public string Titulo { get; set; } + + public string Anotacoes { get; set; } + + public string AnotacoesInternas { get; set; } + + public string Descricao { get; set; } + + public string DescricaoInterna { get; set; } + + public string Referencia { get; set; } + + public StatusTarefa Status { get; set; } + + public Documento Documento { get; set; } + + public CategoriaTarefa Categoria { get; set; } + + public bool? Restrito { get; set; } + + public List<ResponsavelTarefa> Responsaveis { get; set; } + + public bool HabilitarPublica { get; set; } + + public bool Publica { get; set; } + + public bool AgendamentoRetroativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Entidade != TipoTarefa.Notas) + { + if (IdEntidade == 0L && Trilha == null) + { + list.AddValue("IdEntidade", Messages.Obrigatorio); + } + if (!AgendamentoRetroativo && Status != StatusTarefa.Realizado && Agendamento < Funcoes.GetNetworkTime().AddMinutes(-15.0) && Trilha == null) + { + list.AddValue("Agendamento", Messages.Invalido); + } + } + if (Usuario == null) + { + list.AddValue("Usuario|RESPONSÁVEL", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Titulo)) + { + list.AddValue("Titulo|TÍTULO", Messages.Obrigatorio); + } + if (DateTime.Compare(Agendamento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Agendamento, new DateTime(9999, 12, 31)) > 0) + { + list.AddValue("Agendamento", string.Format(Messages.DataInvalida)); + } + if (Conclusao.HasValue && (DateTime.Compare(Conclusao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Conclusao.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Conclusao|CONCLUSÃO", string.Format(Messages.DataInvalida)); + } + if (Status == StatusTarefa.Realizado && !Conclusao.HasValue) + { + list.AddValue("Conclusao|CONCLUSÃO", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + Descricao = new Regex("<title>.*<\\/title>").Replace(Descricao, "").Trim(); + Descricao = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(Descricao, "").Trim(); + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TÍTULO", string.IsNullOrWhiteSpace(Titulo) ? "" : Titulo, ""), + new Tuple<string, string, string>("AGENDAMENTO", Agendamento.ToShortDateString(), ""), + new Tuple<string, string, string>("HORA", Agendamento.ToShortTimeString(), ""), + new Tuple<string, string, string>("RESPONSÁVEL", string.IsNullOrWhiteSpace(Usuario.Nome) ? "" : Usuario.Nome, ""), + new Tuple<string, string, string>("STATUS", Status.GetDescription(), ""), + new Tuple<string, string, string>("TIPO DE TAREFA", TipoDeTarefa?.Nome, ""), + new Tuple<string, string, string>("ANOTAÇÕES", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/TipoDeTarefa.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/TipoDeTarefa.cs new file mode 100644 index 0000000..9d697ed --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/TipoDeTarefa.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class TipoDeTarefa : DomainBase +{ + private string _nome; + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + } + } + + [Log(true)] + [Description("DESCRIÇÃO")] + public string Descricao { get; set; } + + [Log(true)] + public bool Ativo { get; set; } + + public bool Excluido { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Nome)) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + else if (Nome.Length > 60) + { + list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60)); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", ""), + new Tuple<string, string, string>("EXCLUÍDO", Excluido ? "SIM" : "NÃO", "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Trilha.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Trilha.cs new file mode 100644 index 0000000..f627dc5 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Trilha.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Trilha : DomainBase, IDomain +{ + public string Titulo { get; set; } + + public string Descricao { get; set; } + + public List<Fase> Fases { get; set; } + + public bool Ativo { get; set; } + + public TipoTrilha Tipo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Titulo)) + { + list.AddValue("Titulo", Messages.Obrigatorio); + } + if (Fases == null || Fases.Count == 0) + { + list.AddValue("Fases", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + list.Add(new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TÍTULO DA TRILHA", string.IsNullOrWhiteSpace(Titulo) ? "" : Titulo, ""), + new Tuple<string, string, string>("DESCRIÇÃO DA TRILHA", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "") + } + }); + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("FASES$", "", "") + }; + if (Fases != null) + { + foreach (Fase fase in Fases) + { + observableCollection.Add(new Tuple<string, string, string>($" FASE {Fases.IndexOf(fase) + 1}$", "", "")); + observableCollection.Add(new Tuple<string, string, string>(" TÍTULO DA FASE", string.IsNullOrWhiteSpace(fase.Titulo) ? "" : fase.Titulo, "")); + observableCollection.Add(new Tuple<string, string, string>(" DESCRIÇÃO DA FASE", string.IsNullOrWhiteSpace(fase.Descricao) ? "" : fase.Descricao, "")); + foreach (Tarefa tarefa in fase.Tarefas) + { + observableCollection.Add(new Tuple<string, string, string>($" TAREFA {fase.Tarefas.IndexOf(tarefa) + 1}$", "", "")); + observableCollection.Add(new Tuple<string, string, string>(" TÍTULO DA TAREFA", string.IsNullOrWhiteSpace(tarefa.Titulo) ? "" : tarefa.Titulo, "")); + _ = tarefa.Agendamento; + observableCollection.Add(new Tuple<string, string, string>(" AGENDAMENTO DA TAREFA", tarefa.Agendamento.ToShortDateString(), "")); + _ = tarefa.Agendamento; + observableCollection.Add(new Tuple<string, string, string>(" HORA DA TAREFA", tarefa.Agendamento.ToShortTimeString(), "")); + observableCollection.Add(new Tuple<string, string, string>(" ANOTAÇÕES DA TAREFA", string.IsNullOrWhiteSpace(tarefa.Anotacoes) ? "" : tarefa.Anotacoes, "")); + observableCollection.Add(new Tuple<string, string, string>(" STATUS DA TAREFA", tarefa.Status.GetDescription(), "")); + } + } + list.Add(new TupleList + { + Tuples = observableCollection + }); + } + return list; + } +} |