From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../ViewModels/Drawer/LogAcaoViewModel.cs | 262 +++++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 Codemerx/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs (limited to 'Codemerx/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs') diff --git a/Codemerx/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs b/Codemerx/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs new file mode 100644 index 0000000..dec7ea3 --- /dev/null +++ b/Codemerx/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs @@ -0,0 +1,262 @@ +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; + +namespace Gestor.Application.ViewModels.Drawer +{ + public class LogAcaoViewModel : BaseViewModel + { + private RegistroAcao _log; + + private string _obs; + + public RegistroAcao Log + { + get + { + return this._log; + } + set + { + this._log = value; + base.OnPropertyChanged("Log"); + } + } + + public string Obs + { + get + { + return this._obs; + } + set + { + this._obs = value; + base.OnPropertyChanged("Obs"); + } + } + + private Gestor.Model.Common.Relatorio Relatorio + { + get; + set; + } + + public LogAcaoViewModel(RegistroAcao registro, Gestor.Model.Common.Relatorio relatorio) + { + this.Relatorio = relatorio; + this.CarregarLog(registro); + } + + private void CarregarLog(RegistroAcao registro) + { + string str; + string str1; + string str2; + string str3; + string str4; + string str5; + string str6; + string str7; + string str8; + string str9; + string str10; + if (registro.get_Tela().HasValue || string.IsNullOrEmpty(registro.get_Observacao()) || this.Relatorio == 25) + { + this.Log = registro; + this.Obs = registro.get_Observacao(); + return; + } + this.Log = registro; + Filtros filtro = JsonConvert.DeserializeObject(registro.get_Observacao()); + if (filtro.get_Seguradoras() == null || filtro.get_Seguradoras().Count == 0) + { + str = ""; + } + else + { + string[] newLine = new string[] { "SEGURADORAS FILTRADAS: ", Environment.NewLine, null, null, null }; + newLine[2] = string.Join(Environment.NewLine, + from x in Recursos.Seguradoras + where filtro.get_Seguradoras().Contains(x.get_Id()) + select x.get_NomeSocial()); + newLine[3] = Environment.NewLine; + newLine[4] = Environment.NewLine; + str = string.Concat(newLine); + } + string str11 = str; + if (filtro.get_Status() == null || filtro.get_Status().Count == 0) + { + str1 = ""; + } + else + { + string[] strArrays = new string[] { "STATUS FILTRADOS: ", Environment.NewLine, null, null, null }; + strArrays[2] = string.Join(Environment.NewLine, + from x in filtro.get_Status() + select (int)x); + strArrays[3] = Environment.NewLine; + strArrays[4] = Environment.NewLine; + str1 = string.Concat(strArrays); + } + string str12 = str1; + if (filtro.get_Ramos() == null || filtro.get_Ramos().Count == 0) + { + str2 = ""; + } + else + { + string[] newLine1 = new string[] { "RAMOS FILTRADOS: ", Environment.NewLine, null, null, null }; + newLine1[2] = string.Join(Environment.NewLine, + from x in Recursos.Ramos + where filtro.get_Ramos().Contains(x.get_Id()) + select x.get_Nome()); + newLine1[3] = Environment.NewLine; + newLine1[4] = Environment.NewLine; + str2 = string.Concat(newLine1); + } + string str13 = str2; + if (filtro.get_Vendedores() == null || filtro.get_Vendedores().Count == 0) + { + str3 = ""; + } + else + { + string[] strArrays1 = new string[] { "VENDEDORES FILTRADOS: ", Environment.NewLine, null, null, null }; + strArrays1[2] = string.Join(Environment.NewLine, + from x in Recursos.Vendedores + where filtro.get_Vendedores().Contains(x.get_Id()) + select x.get_Nome()); + strArrays1[3] = Environment.NewLine; + strArrays1[4] = Environment.NewLine; + str3 = string.Concat(strArrays1); + } + string str14 = str3; + if (filtro.get_Estipulantes() == null || filtro.get_Estipulantes().Count == 0) + { + str4 = ""; + } + else + { + string[] newLine2 = new string[] { "ESTIPULANTES FILTRADOS: ", Environment.NewLine, null, null, null }; + newLine2[2] = string.Join(Environment.NewLine, + from x in Recursos.Estipulantes + where filtro.get_Estipulantes().Contains(x.get_Id()) + select x.get_Nome()); + newLine2[3] = Environment.NewLine; + newLine2[4] = Environment.NewLine; + str4 = string.Concat(newLine2); + } + string str15 = str4; + if (filtro.get_Produtos() == null || filtro.get_Produtos().Count == 0) + { + str5 = ""; + } + else + { + string[] strArrays2 = new string[] { "PRODUTOS FILTRADOS: ", Environment.NewLine, null, null, null }; + strArrays2[2] = string.Join(Environment.NewLine, + from x in Recursos.Produtos + where filtro.get_Produtos().Contains(x.get_Id()) + select x.get_Nome()); + strArrays2[3] = Environment.NewLine; + strArrays2[4] = Environment.NewLine; + str5 = string.Concat(strArrays2); + } + string str16 = str5; + if (filtro.get_Negocio() == null || filtro.get_Negocio().Count == 0) + { + str6 = ""; + } + else + { + string[] newLine3 = new string[] { "TIPOS DE NEGÓCIOS FILTRADOS: ", Environment.NewLine, null, null, null }; + newLine3[2] = string.Join(Environment.NewLine, + from x in filtro.get_Negocio() + select (int)x); + newLine3[3] = Environment.NewLine; + newLine3[4] = Environment.NewLine; + str6 = string.Concat(newLine3); + } + string str17 = str6; + if (filtro.get_Usuarios() == null || filtro.get_Usuarios().Count == 0) + { + str7 = ""; + } + else + { + string[] strArrays3 = new string[] { "USUÁRIOS FILTRADOS: ", Environment.NewLine, null, null, null }; + strArrays3[2] = string.Join(Environment.NewLine, + from x in Recursos.Usuarios + where filtro.get_Usuarios().Contains(x.get_Id()) + select x.get_Nome()); + strArrays3[3] = Environment.NewLine; + strArrays3[4] = Environment.NewLine; + str7 = string.Concat(strArrays3); + } + string str18 = str7; + if (filtro.get_Telas() == null || filtro.get_Telas().Count == 0) + { + str8 = ""; + } + else + { + string[] newLine4 = new string[] { "TELAS FILTRADAS: ", Environment.NewLine, null, null, null }; + newLine4[2] = string.Join(Environment.NewLine, + from x in filtro.get_Telas() + select (int)x); + newLine4[3] = Environment.NewLine; + newLine4[4] = Environment.NewLine; + str8 = string.Concat(newLine4); + } + string str19 = str8; + if (filtro.get_Relatorios() == null || filtro.get_Relatorios().Count == 0) + { + str9 = ""; + } + else + { + string[] strArrays4 = new string[] { "RELATÓRIOS FILTRADOS: ", Environment.NewLine, null, null, null }; + strArrays4[2] = string.Join(Environment.NewLine, + from x in filtro.get_Relatorios() + select (int)x); + strArrays4[3] = Environment.NewLine; + strArrays4[4] = Environment.NewLine; + str9 = string.Concat(strArrays4); + } + string str20 = str9; + if (filtro.get_ParcelasEspeciais() != null) + { + if (!filtro.get_ParcelasEspeciais().Any((FiltroTipoParcela x) => x.get_Selecionado())) + { + goto Label1; + } + string[] newLine5 = new string[] { "TIPOS DE PARCELAS FILTRADOS: ", Environment.NewLine, null, null, null }; + newLine5[2] = string.Join(Environment.NewLine, + from x in filtro.get_ParcelasEspeciais() + select x.get_Tipo()); + newLine5[3] = Environment.NewLine; + newLine5[4] = Environment.NewLine; + str10 = string.Concat(newLine5); + goto Label0; + } + Label1: + str10 = ""; + Label0: + string str21 = str10; + string str22 = (filtro.get_IdEmpresa() == 0 ? "" : string.Concat(new string[] { "EMPRESA: ", Environment.NewLine, Recursos.Empresas.Find((Empresa x) => x.get_Id() == filtro.get_IdEmpresa()).get_Nome(), Environment.NewLine, Environment.NewLine })); + string.Format("PERÍODO DE {0:d} ATÉ {1:d}", filtro.get_Inicio(), filtro.get_Fim()); + this.Obs = string.Concat(new string[] { ValidationHelper.GetDescription(registro.get_Relatorio()), Environment.NewLine, Environment.NewLine, str22, str11, str13, str16, str14, str15, str12, str17, str21, str18, str19, str20 }); + } + } +} \ No newline at end of file -- cgit v1.2.3