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 --- Codemerx/Gestor.Application/MainWindow.cs | 3069 +++++++++++++++++++++++++++++ 1 file changed, 3069 insertions(+) create mode 100644 Codemerx/Gestor.Application/MainWindow.cs (limited to 'Codemerx/Gestor.Application/MainWindow.cs') diff --git a/Codemerx/Gestor.Application/MainWindow.cs b/Codemerx/Gestor.Application/MainWindow.cs new file mode 100644 index 0000000..a4ed795 --- /dev/null +++ b/Codemerx/Gestor.Application/MainWindow.cs @@ -0,0 +1,3069 @@ +using Agger.Application.Menu; +using Agger.Registro; +using Assinador.Model.Common; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.BI; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Financeiro; +using Gestor.Application.Views.Financeiro.Relatorios; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Menus; +using Gestor.Application.Views.Relatorios; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Helpers; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; +using QRCoder; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Sockets; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; + +namespace Gestor.Application +{ + public class MainWindow : Window, IComponentConnector, IStyleConnector + { + internal MainViewModel ViewModel; + + private bool _buttonClickable; + + private string _lastSearch; + + private DateTime? lastSearchTime; + + private System.Windows.Controls.TextBox _textBox; + + internal System.Windows.Shell.WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + internal HamburgerMenu MainMenu; + + internal HamburgerMenuItem CentralDeNegociosMenu; + + internal HamburgerMenuItem DashBoard; + + internal HamburgerMenuItem PainelBi; + + internal HamburgerMenuItem Prospeccao; + + internal HamburgerMenuItem SegurosMenu; + + internal HamburgerMenuItem Consulta; + + internal HamburgerMenuItem Clientes; + + internal HamburgerMenuItem Apolices; + + internal HamburgerMenuItem Itens; + + internal HamburgerMenuItem Sinistros; + + internal HamburgerMenuItem ImportPdf; + + internal HamburgerMenuItem CriticaPdf; + + internal HamburgerMenuItem Comissao; + + internal HamburgerMenuItem RelatoriosMenu; + + internal HamburgerMenuItem RelatoriosCliente; + + internal HamburgerMenuItem RelatoriosDocumentos; + + internal HamburgerMenuItem RelatoriosParcelas; + + internal HamburgerMenuItem RelatoriosSinistros; + + internal HamburgerMenuItem RelatoriosFechamento; + + internal HamburgerMenuItem RelatoriosExtrato; + + internal HamburgerMenuItem RelatoriosNotas; + + internal HamburgerMenuItem RelatoriosTarefas; + + internal HamburgerMenuItem RelatoriosLogs; + + internal HamburgerMenuItem ExtratoConta; + + internal HamburgerMenuItem FechamentoFinanceiro; + + internal HamburgerMenuItem Assinatura; + + internal HamburgerMenuItem Aggilizador; + + internal HamburgerMenuItem Epic; + + internal HamburgerMenuItem FinanceiroMenu; + + internal HamburgerMenuItem Conta; + + internal HamburgerMenuItem Centro; + + internal HamburgerMenuItem Fornecedor; + + internal HamburgerMenuItem Plano; + + internal HamburgerMenuItem FerramentasMenu; + + internal HamburgerMenuItem Emails; + + internal HamburgerMenuItem Empresa; + + internal HamburgerMenuItem Estipulantes; + + internal HamburgerMenuItem ManutencaoPagamentos; + + internal HamburgerMenuItem NotaFiscal; + + internal HamburgerMenuItem Parceiro; + + internal HamburgerMenuItem Produtos; + + internal HamburgerMenuItem Qualificacao; + + internal HamburgerMenuItem Ramos; + + internal HamburgerMenuItem Recibo; + + internal HamburgerMenuItem Seguradoras; + + internal HamburgerMenuItem Socio; + + internal HamburgerMenuItem Statuses; + + internal HamburgerMenuItem StatusProspeccao; + + internal HamburgerMenuItem TipoTarefa; + + internal HamburgerMenuItem TipoVendedor; + + internal HamburgerMenuItem Usuarios; + + internal HamburgerMenuItem Vendedores; + + internal RowDefinition Area; + + internal System.Windows.Controls.ComboBox Status; + + internal System.Windows.Controls.ComboBox FiltroClienteTipoBox; + + internal AutoCompleteBox PesquisaCliente; + + internal AutoCompleteBox PesquisaClienteNome; + + internal Loading LoadingAutoComplete; + + internal System.Windows.Controls.TextBox DocumentoPrincipalBox; + + internal System.Windows.Controls.Button ObservacaoApolice; + + internal System.Windows.Controls.MenuItem PesquisaAvancada; + + internal System.Windows.Controls.MenuItem Voltar; + + internal System.Windows.Controls.ContentControl ContentControl; + + internal PopupBox QrCode; + + internal System.Windows.Controls.Image ImageAppStore; + + internal System.Windows.Controls.Image ImageGooglePlay; + + internal TextBlock SessionNumber; + + internal PopupBox BoletoPopup; + + internal PopupBox HelpPopup; + + internal StackPanel TarefaPopup; + + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + internal Grid ProgressRing; + + internal MaterialDesignThemes.Wpf.DrawerHost DrawerHost; + + private bool _contentLoaded; + + public object _lastCustomer + { + get; + set; + } + + private AcessoApolice Acesso + { + get; + set; + } + + public static System.Windows.WindowState ApplicationState + { + get; + set; + } + + private Key? lastKey + { + get; + set; + } + + private string lastSearch + { + get + { + return this._lastSearch; + } + set + { + this._lastSearch = value; + this.lastSearchTime = new DateTime?(DateTime.Now); + } + } + + private Gestor.Model.Common.ManutencaoItem ManutencaoItem + { + get; + set; + } + + private string PipeName + { + get; + set; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public MainWindow() + { + this.ViewModel = new MainViewModel(); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + Gestor.Application.Actions.Actions.AcessaTela = new Action(this.AcessarTela); + Gestor.Application.Actions.Actions.IniciarAggilizador = new Action(this.IniciarAggilizador); + App.SnackBar = this.Snackbar; + App.ProgressRing = this.ProgressRing; + App.ProgressRing.Visibility = System.Windows.Visibility.Collapsed; + Gestor.Application.Actions.Actions.NomeTela = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.NomeTela, new Action(this.DefinirNomeTela)); + Gestor.Application.Actions.Actions.EnablePesquisarClientes = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.EnablePesquisarClientes, new Action(this.HabilitarPesquisarClientes)); + Gestor.Application.Actions.Actions.EnableMainMenu = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.EnableMainMenu, new Action(this.HabilitarMenu)); + Gestor.Application.Actions.Actions.AcessarHoster = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AcessarHoster, new Action(this.AcessarHoster)); + this.MinimizeButton.MouseEnter += new System.Windows.Input.MouseEventHandler(MainWindow.TopControls_OnMouseEnter); + this.MinimizeButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave); + this.MaximizeButton.MouseEnter += new System.Windows.Input.MouseEventHandler(MainWindow.TopControls_OnMouseEnter); + this.MaximizeButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave); + this.CloseButton.MouseEnter += new System.Windows.Input.MouseEventHandler(MainWindow.TopControls_OnMouseEnter); + this.CloseButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave); + this.ViewModel.Head = string.Concat("BEM VINDO, ", Recursos.Usuario.get_Nome()); + System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); + } + else + { + } + base.Icon = new BitmapImage(Address.IconeGestor); + } + + private void AbrirAtendimento() + { + if (Recursos.Usuario == null || Recursos.Usuario.get_Id() == 0) + { + return; + } + string str = (Gestor.Common.Validation.ValidationHelper.IsNotNullOrEmpty(Recursos.Usuario.get_SsoId()) ? string.Format("{0}:{1}:SSO", Recursos.Usuario.get_SsoId(), Recursos.Usuario.get_Id()) : EncryptionHelper.Encrypt(Recursos.Usuario.get_Senha())); + string str1 = EncryptionHelper.Encrypt(string.Format("{0}:{1}:{2}", ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Login(), str)); + Process.Start(Address.get_CentralAtendimento().Append(new string[] { "Acessar" }).AddQuery("id", str1).ToString()); + } + + private static void AbrirTarefas() + { + string str = string.Format("VOCÊ ESTÁ EM CONSULTA DE TAREFAS | VERSÃO GESTOR {0}", ApplicationHelper.Versao); + TarefaView tarefaView = new TarefaView(); + string[] nome = new string[] { "OLÁ, ", Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", ", str }; + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(tarefaView, string.Concat(nome), nullable1, nullable, false)).Show(); + } + + private async void AcessarHoster(PipeMessageResult pipeMessage) + { + HosterWindow hosterWindow = null; + if (pipeMessage.get_Funcao() == null) + { + Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(long.Parse(pipeMessage.get_Json()), false, false); + Documento documento1 = documento; + base.Dispatcher.Invoke(() => { + ApoliceView apoliceView = new ApoliceView(documento1, true, false, 0, (long)0, false); + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + hosterWindow = new HosterWindow(apoliceView, string.Concat("CADASTRO DE APÓLICES - ", documento1.get_Controle().get_Cliente().get_Nome()), nullable1, nullable, false); + hosterWindow.Show(); + }); + } + } + + private async void AcessarTela(TipoTela tela, string subTela = "") + { + string str; + TipoTela tipoTela = tela; + switch (tipoTela) + { + case 1: + { + TipoRestricao? nullable = null; + if (await this.VerificarLicenca(this.Clientes.get_Produto(), this.Clientes.get_Tela(), nullable)) + { + this.Clientes_OnClick(this.Clientes, new RoutedEventArgs()); + goto case 6; + } + else + { + break; + } + } + case 2: + { + bool acesso = this.Acesso != 0; + if (acesso) + { + acesso = !await this.VerificarDocumento(this.Apolices.get_Produto(), this.Apolices.get_Tela()); + } + bool flag = acesso; + if (!flag) + { + flag = !await this.VerificarCliente(this.Apolices.get_Produto(), this.Apolices.get_Tela()); + } + if (!flag) + { + str = subTela; + if (str == "Parcela") + { + this.Acesso = 1; + } + else if (str == "Renovar") + { + this.Acesso = 3; + } + else if (str == "Endossar") + { + this.Acesso = 2; + } + else + { + this.Acesso = 0; + } + this.Apolices_OnClick(this.Apolices, new RoutedEventArgs()); + goto case 6; + } + else + { + break; + } + } + case 3: + { + if (await this.VerificarDocumento(this.Itens.get_Produto(), this.Itens.get_Tela())) + { + str = subTela; + if (str == "Renovação") + { + Gestor.Model.Common.ManutencaoItem manutencaoItem = new Gestor.Model.Common.ManutencaoItem(); + manutencaoItem.set_Documento(ConsultaViewModel.DocumentoRenovado); + manutencaoItem.set_Tipo(0); + this.ManutencaoItem = manutencaoItem; + ConsultaViewModel.DocumentoRenovado = null; + } + else if (str == "Endosso") + { + Gestor.Model.Common.ManutencaoItem manutencaoItem1 = new Gestor.Model.Common.ManutencaoItem(); + manutencaoItem1.set_Documento(ConsultaViewModel.DocumentoSelecionado); + manutencaoItem1.set_Tipo(1); + this.ManutencaoItem = manutencaoItem1; + } + else if (str == "Manutencao") + { + Gestor.Model.Common.ManutencaoItem manutencaoItem2 = new Gestor.Model.Common.ManutencaoItem(); + manutencaoItem2.set_Documento(ConsultaViewModel.DocumentoSelecionado); + manutencaoItem2.set_Tipo(2); + this.ManutencaoItem = manutencaoItem2; + } + else + { + this.ManutencaoItem = null; + } + this.Itens_OnClick(this.Itens, new RoutedEventArgs()); + goto case 6; + } + else + { + break; + } + } + case 4: + case 5: + case 6: + { + break; + } + case 7: + { + if (await this.VerificarDocumento(this.Sinistros.get_Produto(), this.Sinistros.get_Tela())) + { + this.Sinistros_OnClick(this.Clientes, new RoutedEventArgs()); + goto case 6; + } + else + { + break; + } + } + default: + { + if (tipoTela != 21) + { + goto case 6; + } + this.Consultar_OnClick(this.SegurosMenu, new RoutedEventArgs()); + goto case 6; + } + } + } + + private async void AcessoRemoto_OnClick(object sender, RoutedEventArgs e) + { + if (!this.ViewModel.Restricao(58)) + { + string str = "c:\\AggerSeguros\\Remoto.exe"; + if (!File.Exists(str)) + { + Parameters parameter = new Parameters(); + parameter.set_Beta(false); + parameter.set_Type(99); + parameter.set_Application("Remoto.exe"); + parameter.set_Directory(""); + parameter.set_Run(true); + (new DownloadWindow(parameter)).Show(); + } + else + { + Process.Start(str); + } + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSO REMOTO.", "OK", "", false); + } + } + + private async void Agenda_OnClick(object sender, RoutedEventArgs e) + { + if (await this.ViewModel.VerificarPermissao(34, false)) + { + this.ViewModel.ShowDrawer(new AgendaDrawer(), 0, false); + } + } + + private async void Aggilizador_OnClick(object sender, RoutedEventArgs e) + { + long? permissaoAggilizador = Recursos.Usuario.get_PermissaoAggilizador(); + if (permissaoAggilizador.HasValue) + { + permissaoAggilizador = Recursos.Usuario.get_PermissaoAggilizador(); + long num = (long)0; + if (!(permissaoAggilizador.GetValueOrDefault() == num & permissaoAggilizador.HasValue)) + { + List produtos = LicenseHelper.Produtos; + if (!produtos.Any((Licenca produto) => produto.get_Produto() == 91)) + { + this.IniciarAggilizador(); + return; + } + else + { + Process.Start(Address.CalculoWeb.ToString()); + List licencas = LicenseHelper.Produtos; + if (licencas.Any((Licenca produto) => produto.get_Produto() != 77)) + { + this.IniciarAggilizador(); + } + return; + } + } + } + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O AGGILIZADOR", "OK", "", false); + } + + private void Apolices_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado == null) + { + return; + } + this.SetControl(typeof(ApoliceView), null); + this.Acesso = 0; + } + + private async void Assinatura_OnClick(object sender, RoutedEventArgs e) + { + string str; + object obj; + if (await this.ViewModel.ShowMessage("DESEJA ABRIR O SIGGNER PARA ASSINATURAS ELETRÔNICAS?", "SIM", "NÃO", false)) + { + str = ((new PipeServer()).CreateServer(this.PipeName) ? string.Concat(":", this.PipeName) : ""); + string str1 = str; + Token token = new Token(); + object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Id(), null, null }; + obj = (ApplicationHelper.Beta ? "1" : "0"); + numeroSerial[3] = obj; + numeroSerial[4] = str1; + string str2 = token.Encrypt(string.Format("{0}:{1}:{2}:{3}:{4}", numeroSerial)); + Parameters parameter = new Parameters(); + parameter.set_Beta(ApplicationHelper.Beta); + parameter.set_Type(8); + parameter.set_Application("Assinador.Application.exe"); + parameter.set_Directory("Assinador.Application"); + parameter.set_Arguments(str2); + parameter.set_Run(true); + (new DownloadWindow(parameter)).Show(); + } + } + + private async void Atendimentos_OnClick(object sender, RoutedEventArgs e) + { + if (!this.ViewModel.Restricao(54)) + { + this.AbrirAtendimento(); + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ATENDIMENTOS.", "OK", "", false); + } + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + this.lastSearch = e.get_Parameter().Trim(); + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Visible; + List list = ( + from vu in this.ViewModel.VendedorUsuario + select vu.get_Vendedor().get_Id()).ToList(); + if (this.ViewModel.SelectedFiltroCliente != 1) + { + this.ViewModel.SelectedFiltroCliente = (Regex.Replace(e.get_Parameter().Trim(), "[.\\-\\/]", "").All(new Func(char.IsDigit)) ? 2 : 0); + } + this.ViewModel.BuscarCliente(e.get_Parameter().Trim(), list, this.ViewModel.SelectedFiltroCliente).ContinueWith((Task> searchResult) => { + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Collapsed; + if (searchResult.Result == null) + { + return; + } + this.ViewModel.ClientesEncontrados = searchResult.Result; + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteCliente_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + Key? nullable; + Key? nullable1; + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + this.MainMenu.Close(); + if (string.IsNullOrEmpty(autoCompleteBox.get_Text())) + { + nullable = null; + nullable1 = nullable; + } + else if (autoCompleteBox.get_Text().ToArray().LastOrDefault().ToString() == " ") + { + nullable1 = new Key?(Key.Space); + } + else + { + nullable = null; + nullable1 = nullable; + } + this.lastKey = nullable1; + } + + private void AutoCompleteNomeBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + if (this.lastSearch != null && this.lastSearchTime.HasValue && e.get_Parameter().Trim().Contains(this.lastSearch) && (DateTime.Now - this.lastSearchTime.Value).TotalSeconds < 10) + { + AutoCompleteBox autoCompleteBox1 = (AutoCompleteBox)sender; + autoCompleteBox1.set_ItemsSource(this.ViewModel.FiltrarClientes(e.get_Parameter().Trim())); + autoCompleteBox1.PopulateComplete(); + return; + } + this.lastSearch = e.get_Parameter().Trim(); + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Visible; + List list = ( + from vu in this.ViewModel.VendedorUsuario + select vu.get_Vendedor().get_Id()).ToList(); + this.ViewModel.BuscarCliente(e.get_Parameter().Trim(), list, this.ViewModel.SelectedFiltroCliente).ContinueWith((Task> searchResult) => { + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Collapsed; + if (searchResult.Result == null) + { + return; + } + this.ViewModel.ClientesEncontrados = searchResult.Result; + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void Boleto_OnClick(object sender, RoutedEventArgs e) + { + System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender; + if (button == null || button.DataContext == null) + { + return; + } + Payment dataContext = (Payment)button.DataContext; + Process.Start(string.Format("{0}billet/id/{1}", Address.get_ApiBoletoAgger(), dataContext.get_Id())); + } + + private async void BoletosNotas_OnClick(object sender, RoutedEventArgs e) + { + if (!this.ViewModel.Restricao(55)) + { + this.AbrirAtendimento(); + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA BOLETOS E NOTAS.", "OK", "", false); + } + } + + private async void CartaoVisita_OnClick(object sender, RoutedEventArgs e) + { + Process.Start(string.Format("{0}{1}", Address.get_Card(), Recursos.Usuario.get_Id().GeraCartaoVisita())); + } + + private async void Centro_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + this.SetControl(typeof(CentroDeCustoView), null); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private void Clientes_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ClienteView), null); + } + + public async void CloseButton_Click() + { + string str; + if (await this.ViewModel.ShowMessage("DESEJA REALMENTE FECHAR O SISTEMA?", "SIM", "NÃO", false)) + { + if (Recursos.Usuario.get_Id() > (long)0) + { + DateTime networkTime = Funcoes.GetNetworkTime(); + RegistroLog registroLog = new RegistroLog(); + registroLog.set_Acao(0); + registroLog.set_Usuario(Recursos.Usuario); + registroLog.set_DataHora(networkTime); + registroLog.set_Descricao(string.Format("O USUÁRIO {0} SAIU DO SISTEMA, EM {1}.", Recursos.Usuario.get_Nome(), networkTime)); + registroLog.set_EntidadeId(Recursos.Usuario.get_Id()); + registroLog.set_Tela(49); + registroLog.set_Versao(LoginViewModel.VersaoAtual); + registroLog.set_NomeMaquina(Environment.MachineName); + registroLog.set_UsuarioMaquina(Environment.UserName); + IPAddress[] addressList = Dns.GetHostEntry(Dns.GetHostName()).AddressList; + IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork); + if (pAddress != null) + { + str = pAddress.ToString(); + } + else + { + str = null; + } + registroLog.set_Ip(str); + RegistroLog registroLog1 = registroLog; + using (UnitOfWork commited = Instancia.Commited) + { + (new BaseServico()).SaveLog(registroLog1, commited); + commited.Commit(); + } + } + Environment.Exit(0); + } + } + + private async void Comissao_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + this.SetControl(typeof(ComissaoView), null); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO A TELA DE COMISSÃO AUTOMÁTICA.", "OK", "", false); + } + } + + private void Consultar_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.PermissaoWhatsapp = this.ViewModel.Restricao(32); + this.SetControl(typeof(ConsultaOriginalView), null); + } + + private async void Conta_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + this.SetControl(typeof(BancosContasView), null); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private void ContentControl_GotFocus(object sender, RoutedEventArgs e) + { + this.MainMenu.Close(); + } + + private void ContentControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + this.MainMenu.Close(); + } + + private async void ContentLoad() + { + System.Windows.Visibility visibility; + Type type; + Type type1; + TipoRestricao? nullable = null; + if (await this.VerificarLicenca(new Gestor.Model.License.Produto?(1), new TipoTela?(21), nullable)) + { + this.ViewModel.PermissaoWhatsapp = this.ViewModel.Restricao(32); + TipoTelaInicial? telaInicial = Recursos.Usuario.get_TelaInicial(); + if (telaInicial.HasValue) + { + TipoTelaInicial valueOrDefault = telaInicial.GetValueOrDefault(); + if (valueOrDefault == 1) + { + MainWindow mainWindow = this; + type = (this.ViewModel.Restricao(47) ? typeof(ConsultaOriginalView) : typeof(PainelBiView)); + mainWindow.SetControl(type, null); + goto Label0; + } + else + { + if (valueOrDefault != 2) + { + goto Label1; + } + MainWindow mainWindow1 = this; + type1 = (this.ViewModel.Restricao(35) ? typeof(ConsultaOriginalView) : typeof(FinanceiroView)); + mainWindow1.SetControl(type1, null); + goto Label0; + } + } + Label1: + this.SetControl(typeof(ConsultaOriginalView), null); + Label0: + MainViewModel viewModel = this.ViewModel; + visibility = (Recursos.Usuario.get_Administrador() ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + viewModel.VisibleChaveInstalacao = visibility; + this.GerarQrCode(); + if (Recursos.Usuario.get_IdEmpresa() > (long)1) + { + this.Comissao.Visibility = System.Windows.Visibility.Collapsed; + this.FinanceiroMenu.Visibility = System.Windows.Visibility.Collapsed; + this.FechamentoFinanceiro.Visibility = System.Windows.Visibility.Collapsed; + this.ExtratoConta.Visibility = System.Windows.Visibility.Collapsed; + } + MainViewModel mainViewModel = this.ViewModel; + List vendedorUsuarios = await this.ViewModel.VerificaVinculoVendedor(Recursos.Usuario); + mainViewModel.VendedorUsuario = vendedorUsuarios; + mainViewModel = null; + await this.ViewModel.ShowDialogAdvertising(false); + } + } + + private async void Contratos_OnClick(object sender, RoutedEventArgs e) + { + if (!this.ViewModel.Restricao(56)) + { + this.AbrirAtendimento(); + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA CONTRATOS.", "OK", "", false); + } + } + + private void CopiarChave_OnClick(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(ApplicationHelper.NumeroSerial)) + { + return; + } + string numeroSerial = ApplicationHelper.NumeroSerial; + DateTime networkTime = Funcoes.GetNetworkTime(); + EncryptionHelper.Encrypt(string.Format("{0} {1:d}", numeroSerial, networkTime.Date)).CopyToClipboard(); + this.ViewModel.ToggleSnackBar("CHAVE DE INSTALAÇÃO COPIADA!", true); + } + + private void CopiarDocumento_Click(object sender, MouseButtonEventArgs e) + { + object text; + try + { + System.Windows.Controls.TextBox textBox = (System.Windows.Controls.TextBox)sender; + if (textBox != null) + { + text = textBox.Text; + } + else + { + text = null; + } + if (text == null) + { + text = string.Empty; + } + string str = (string)text; + if (!Gestor.Common.Validation.ValidationHelper.IsNullOrEmpty(str)) + { + str.CopyToClipboard(); + e.Handled = true; + this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", str), true); + } + } + catch (Exception exception) + { + } + } + + private void CopyCode_Click(object sender, RoutedEventArgs e) + { + this.ViewModel.Code.CopyToClipboard(); + this.ViewModel.ToggleSnackBar(string.Concat("CÓDIGO COPIADO - ", this.ViewModel.Code), true); + } + + private void CopyLink_OnClick(object sender, RoutedEventArgs e) + { + System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender; + if (button == null || button.DataContext == null) + { + return; + } + AjudaTela dataContext = (AjudaTela)button.DataContext; + string str = ""; + if (dataContext.get_Minuto() > 0 || dataContext.get_Segundo() > 0) + { + str = string.Format("&start={0}", dataContext.get_Minuto() * 60 + dataContext.get_Segundo()); + } + string.Concat(dataContext.get_Link(), str).CopyToClipboard(); + this.ViewModel.ToggleSnackBar("LINK COPIADO", true); + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender; + if (button.DataContext != null) + { + Contato dataContext = button.DataContext as Contato; + if (dataContext != null) + { + dataContext.get_Numero().CopyToClipboard(); + this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", dataContext.get_Numero()), true); + return; + } + } + } + + private void CriticaPdf_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(CriticaApoliceView), null); + } + + private void DashBoard_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(DashboardView), null); + } + + private void DefinirNomeTela(string tela) + { + this.ViewModel.Tela = tela; + } + + private void DocumentoPrincipal_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + try + { + ((System.Windows.Controls.TextBox)e.Source).SelectAll(); + } + catch + { + } + } + + private void Emails_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(CadastroEmailView), null); + } + + private void Empresa_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(EmpresaView), null); + } + + private void Epic_OnClick(object sender, RoutedEventArgs e) + { + Parameters parameter = new Parameters(); + parameter.set_Beta(false); + parameter.set_Type(5); + parameter.set_Application("Agger.Epic.exe"); + parameter.set_Directory("Agger.Epic"); + parameter.set_Arguments(string.Format("{0}|{1}", ApplicationHelper.NumeroSerial, Recursos.Usuario.get_Id())); + parameter.set_Run(true); + (new DownloadWindow(parameter)).Show(); + } + + private void Estipulantes_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(EstipulanteView), null); + } + + private void ExpandirMenu() + { + this.MainMenu.set_IsOpen(true); + this.CentralDeNegociosMenu.set_ContentVisible(System.Windows.Visibility.Visible); + this.SegurosMenu.set_ContentVisible(System.Windows.Visibility.Visible); + this.FerramentasMenu.set_ContentVisible(System.Windows.Visibility.Visible); + this.FinanceiroMenu.set_ContentVisible(System.Windows.Visibility.Visible); + } + + private async void ExtratoConta_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + (new ExtratoWindow((long)0)).Show(); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private async void FechamentoFinanceiro_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + string str = string.Format("VOCÊ ESTÁ EM FECHAMENTO FINANCEIRO | VERSÃO GESTOR {0}", ApplicationHelper.Versao); + FechamentoFinanceiroView fechamentoFinanceiroView = new FechamentoFinanceiroView(); + string[] nome = new string[] { "OLÁ, ", Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", ", str }; + (new HosterWindow(fechamentoFinanceiroView, string.Concat(nome), new double?((double)1024), new double?((double)600), true)).Show(); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + this.HelpPopup.set_IsPopupOpen(!this.HelpPopup.get_IsPopupOpen()); + } + + private async void FinanceiroMenu_OnClick(object sender, RoutedEventArgs e) + { + bool flag; + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + flag = (!this.MainMenu.get_IsOpen() || this.ViewModel.Content != null ? this.ViewModel.Content.GetType() != typeof(FinanceiroView) : true); + this.SetControl(typeof(FinanceiroView), null); + if (flag) + { + ((HamburgerMenuItem)sender).set_ContentVisible(System.Windows.Visibility.Visible); + } + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private async void Fornecedor_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + this.SetControl(typeof(FornecedorView), null); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private async void GerarQrCode() + { + BitmapImage bitmapImage; + int num = 0; + try + { + QRCodeGenerator qRCodeGenerator = new QRCodeGenerator(); + Usuario usuario = await (new UsuarioServico()).BuscarUsuarioPorId(Recursos.Usuario.get_Id()); + if (usuario != null) + { + MainViewModel viewModel = this.ViewModel; + object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, usuario.get_IdEmpresa(), usuario.get_Login(), (new Token()).AggerDecrypt(usuario.get_Senha()) }; + viewModel.Code = EncryptionHelper.Encrypt(string.Format("{0}:{1}:{2}:{3}", numeroSerial)); + Bitmap graphic = (new QRCode(qRCodeGenerator.CreateQrCode(this.ViewModel.Code, 2, false, false, 0, -1))).GetGraphic(20); + using (MemoryStream memoryStream = new MemoryStream()) + { + graphic.Save(memoryStream, ImageFormat.Png); + memoryStream.Position = (long)0; + bitmapImage = new BitmapImage(); + bitmapImage.BeginInit(); + bitmapImage.StreamSource = memoryStream; + bitmapImage.CacheOption = BitmapCacheOption.OnLoad; + bitmapImage.EndInit(); + } + this.ViewModel.QrCode = bitmapImage; + this.QrCode.Visibility = System.Windows.Visibility.Visible; + MainViewModel mainViewModel = this.ViewModel; + string str = ApplicationHelper.NumeroSerial; + if (str == null) + { + str = ""; + } + mainViewModel.Code = str; + qRCodeGenerator = null; + } + else + { + this.QrCode.Visibility = System.Windows.Visibility.Collapsed; + return; + } + } + catch (Exception exception) + { + num = 1; + } + if (num == 1) + { + await this.ViewModel.ShowMessage("ERRO AO GERAR QRCODE", "OK", "", false); + } + } + + [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false)] + private static extern bool GetCursorPos(out MainWindow.Point lpPoint); + + [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false)] + private static extern bool GetMonitorInfo(IntPtr hMonitor, MainWindow.Monitorinfo lpmi); + + private void HabilitarMenu(bool enable) + { + this.MainMenu.IsEnabled = enable; + this.Voltar.IsEnabled = enable; + } + + private void HabilitarPesquisarClientes(bool enable) + { + if (!(this.ViewModel.Content is ConsultaOriginalView) && !(this.ViewModel.Content is ClienteView)) + { + return; + } + this.ViewModel.EnableSeguros = enable; + } + + private async void HelpPopup_Opened(object sender, RoutedEventArgs e) + { + await this.ViewModel.CarregarAjuda(); + } + + private void ImageAppStore_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo("https://apps.apple.com/br/app/agger-mobile/id1463091598")); + } + + private void ImageGooglePlay_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo("https://play.google.com/store/apps/details?id=br.com.aggermobile&hl=pt&gl=US")); + } + + private async void ImportPdf_OnClick(object sender, RoutedEventArgs e) + { + Parameters parameter = new Parameters(); + parameter.set_Beta(false); + parameter.set_Type(4); + parameter.set_Application("Agger.ImportPDF.exe"); + parameter.set_Directory("Agger.Import"); + object[] id = new object[] { Recursos.Empresa.get_Id(), Recursos.Usuario.get_Id(), ApplicationHelper.Subkey, ApplicationHelper.NumeroSerial }; + parameter.set_Arguments(string.Format("{0} {1} NOVOGESTOR PERFIL:{2} SERIAL:{3}", id)); + parameter.set_Run(true); + Parameters parameter1 = parameter; + await (new ArquivoDigitalServico()).Criar(); + (new DownloadWindow(parameter1)).Show(); + parameter1 = null; + } + + private void IniciarAggilizador() + { + long id; + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder1 = new StringBuilder(); + Parameters parameter = new Parameters(); + parameter.set_Beta(false); + parameter.set_Type(4); + parameter.set_Application("Agger.ImportPDF.exe"); + parameter.set_Directory("Agger.Import"); + parameter.set_Arguments(string.Format("{0} {1} NOVOGESTOR", Recursos.Empresa.get_Id(), Recursos.Usuario.get_Id())); + parameter.set_Run(false); + (new DownloadWindow(parameter)).Show(); + Token token = new Token(); + long id1 = Recursos.Usuario.get_Id(); + if (id1 == 0) + { + Usuario usuario = Recursos.Usuarios.FirstOrDefault((Usuario x) => { + long? permissaoAggilizador = x.get_PermissaoAggilizador(); + long num = (long)1; + return permissaoAggilizador.GetValueOrDefault() == num & permissaoAggilizador.HasValue; + }); + if (usuario != null) + { + id = usuario.get_Id(); + } + else + { + id = (long)0; + } + id1 = id; + } + stringBuilder.Append(token.AggerEncrypt(id1.ToString())); + if (Recursos.Usuario.get_Id() != 0) + { + stringBuilder1.Append(token.AggerEncrypt(Recursos.Usuario.get_TokenSso())); + } + Parameters parameter1 = new Parameters(); + parameter1.set_Beta(false); + parameter1.set_Type(88); + parameter1.set_Application("Instalador.exe"); + parameter1.set_Directory(""); + parameter1.set_Arguments(string.Format("/CALCULATION {0} {1}", stringBuilder, (Recursos.Usuario.get_Id() == 0 ? "" : string.Format(" /SSO {0}", stringBuilder1)))); + parameter1.set_Run(true); + Parameters parameter2 = parameter1; + (new RegistryHelper("")).Write("NSP", EncryptionHelper.Encrypt(ApplicationHelper.NumeroSerial), true); + try + { + (new DownloadWindow(parameter2)).Show(); + } + catch (Exception exception) + { + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (this._contentLoaded) + { + return; + } + this._contentLoaded = true; + System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/mainwindow.xaml", UriKind.Relative)); + } + + private async void Instalacao_OnClick(object sender, RoutedEventArgs e) + { + if (!this.ViewModel.Restricao(57)) + { + this.AbrirAtendimento(); + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA INSTALAÇÕES.", "OK", "", false); + } + } + + private void Itens_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado == null) + { + return; + } + this.SetControl(typeof(MenuItensView), this.ManutencaoItem); + } + + private async void MainWindow_OnInitialized(object sender, EventArgs e) + { + WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this); + windowInteropHelper.EnsureHandle(); + HwndSource hwndSource = HwndSource.FromHwnd(windowInteropHelper.Handle); + if (hwndSource != null) + { + hwndSource.AddHook(new HwndSourceHook(this.WindowProc)); + } + else + { + } + this.ExpandirMenu(); + await (new BaseServico()).Sincronizar(Funcoes.GetNetworkTime(), null); + if (Recursos.Usuario.get_Administrador()) + { + MainViewModel viewModel = this.ViewModel; + List payments = await Gestor.Application.Helpers.Connection.Get>(string.Format("Billet/{0}", ApplicationHelper.IdFornecedor), true, false); + viewModel.Boletos = payments; + viewModel = null; + if (this.ViewModel.Boletos != null) + { + List boletos = this.ViewModel.Boletos; + if (boletos.Any((Payment x) => x.get_Vencimento() <= Funcoes.GetNetworkTime().Date.AddDays(7))) + { + this.BoletoPopup.Visibility = System.Windows.Visibility.Visible; + } + } + } + } + + private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e) + { + this.ViewModel.HeadMaxWidth = 300 + base.ActualWidth - 1024; + } + + private void Manutencao_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ManutencaoPagamentosView), null); + } + + public void MaximizeButton_Click() + { + base.WindowState = (base.WindowState == System.Windows.WindowState.Normal ? System.Windows.WindowState.Maximized : System.Windows.WindowState.Normal); + } + + private void Medalha_OnMouseDown(object sender, MouseButtonEventArgs e) + { + this.ViewModel.Medalha(); + } + + private void MenuGestorMobile_OnClick(object sender, RoutedEventArgs e) + { + this.QrCode.Visibility = (this.QrCode.Visibility == System.Windows.Visibility.Visible ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); + this.QrCode.set_IsPopupOpen(!this.QrCode.get_IsPopupOpen()); + } + + public void MinimizeButton_Click() + { + base.WindowState = System.Windows.WindowState.Minimized; + } + + [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false, SetLastError=true)] + private static extern IntPtr MonitorFromPoint(MainWindow.Point pt, MainWindow.MonitorOptions dwFlags); + + private void NotaFiscal_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(NotaFiscalView), null); + } + + private void Notas_OnClick(object sender, RoutedEventArgs e) + { + string str = string.Format("VOCÊ ESTÁ EM CADASTRO DE NOTAS | VERSÃO GESTOR {0}", ApplicationHelper.Versao); + NotasView notasView = new NotasView(); + string[] nome = new string[] { "OLÁ, ", Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", ", str }; + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(notasView, string.Concat(nome), nullable1, nullable, false)).Show(); + } + + private void Observacoes_OnClick(object sender, RoutedEventArgs e) + { + if (this.ViewModel.SelectedCliente == null || this.ViewModel.SelectedCliente.get_Id() == 0) + { + return; + } + this.ViewModel.ShowDrawer(new ObservacoesDrawer(this.ViewModel.SelectedCliente.get_Id(), 1), 0, true); + } + + private void OcultarAjuda_OnClick(object sender, RoutedEventArgs e) + { + this.HelpPopup.Visibility = System.Windows.Visibility.Collapsed; + } + + private void OcultarBoleto_OnClick(object sender, RoutedEventArgs e) + { + this.BoletoPopup.Visibility = System.Windows.Visibility.Collapsed; + } + + private void OcultarTarefas_OnClick(object sender, RoutedEventArgs e) + { + this.TarefaPopup.Visibility = System.Windows.Visibility.Collapsed; + } + + protected sealed override void OnStateChanged(EventArgs e) + { + object obj; + base.BorderThickness = new Thickness((double)(base.WindowState != System.Windows.WindowState.Maximized)); + System.Windows.Shell.WindowChrome windowChrome = this.WindowChrome; + if (base.WindowState == System.Windows.WindowState.Maximized) + { + obj = null; + } + else + { + obj = 4; + } + windowChrome.ResizeBorderThickness = new Thickness((double)obj); + this.WindowChrome.CaptionHeight = (double)((base.WindowState == System.Windows.WindowState.Maximized ? 32 : 29)); + this.ViewModel.MaximizeRestore = (base.WindowState == System.Windows.WindowState.Maximized ? Geometry.Parse((string)System.Windows.Application.Current.Resources["Restore"]) : Geometry.Parse((string)System.Windows.Application.Current.Resources["Maximize"])); + base.OnStateChanged(e); + } + + private void PainelBi_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(PainelBiView), null); + this.ViewModel.VisibleBi = System.Windows.Visibility.Visible; + } + + private void Parceiro_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(CadastroParceiroView), null); + } + + private async void PesquisaAvancada_OnClick(object sender, RoutedEventArgs e) + { + Gestor.Model.Domain.Common.PesquisaAvancada pesquisaAvancada = await this.ViewModel.ShowPesquisaAvancadaDialog(); + if (pesquisaAvancada != null) + { + this.ViewModel.Invoke = false; + this.ViewModel.SelectedCliente = null; + this.ViewModel.SelectedStatus = pesquisaAvancada.get_Status(); + this.ViewModel.PesquisaAvançada = true; + Cliente cliente = await (new ClienteServico()).BuscarCliente(pesquisaAvancada.get_IdCliente()); + this.ViewModel.ClientesFiltrados = new List() + { + cliente + }; + this.ViewModel.SelectedCliente = cliente; + this.ViewModel.PesquisaAvançada = false; + MainViewModel.ClienteSelecionado = this.ViewModel.SelectedCliente; + this.ViewModel.Pesquisa = this.ViewModel.SelectedCliente.get_NomeSocial(); + this.ViewModel.Invoke = true; + ((ConsultaOriginalView)this.ViewModel.Content).Pesquisar(pesquisaAvancada); + } + pesquisaAvancada = null; + } + + private void PesquisaCliente_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + System.Windows.Controls.TextBox textBox = this._textBox; + if (textBox == null) + { + return; + } + textBox.SelectAll(); + } + + private void PesquisaCliente_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == Key.Space && this.lastKey.HasValue && this.lastKey.Value == e.Key) + { + e.Handled = true; + } + this.lastKey = new Key?(e.Key); + if (e.OriginalSource.GetType() == typeof(System.Windows.Controls.TextBox)) + { + this._textBox = (System.Windows.Controls.TextBox)e.OriginalSource; + } + } + + private async void PesquisaCliente_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (this.ViewModel.SelectedCliente == null) + { + this._lastCustomer = null; + this.ViewModel.LimparDocumentos(); + } + else if (this._lastCustomer == null || this.ViewModel.Content is ClienteView) + { + this._lastCustomer = this.ViewModel.SelectedCliente; + await this.ViewModel.SelecionarCliente(this.ViewModel.SelectedCliente); + if (this.ViewModel.Content is DashboardView) + { + this.ViewModel.Content = new ConsultaOriginalView(this.ViewModel.ConsultaViewModel); + } + } + else + { + Cliente cliente = this._lastCustomer as Cliente; + this.ViewModel.SelectedCliente = cliente; + if (this.ViewModel.Content is DashboardView) + { + this.ViewModel.Content = new ConsultaOriginalView(this.ViewModel.ConsultaViewModel); + } + } + } + + private async void Plano_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.get_IdEmpresa() <= (long)1) + { + this.SetControl(typeof(PlanosView), null); + } + else + { + await this.ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO.", "OK", "", false); + } + } + + private void Play_Click(object sender, RoutedEventArgs e) + { + System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender; + if (button == null || button.DataContext == null) + { + return; + } + AjudaTela dataContext = (AjudaTela)button.DataContext; + string str = ""; + if (dataContext.get_Minuto() > 0 || dataContext.get_Segundo() > 0) + { + str = string.Format("&start={0}", dataContext.get_Minuto() * 60 + dataContext.get_Segundo()); + } + Process.Start(string.Concat(dataContext.get_Link(), str)); + } + + private async Task PostMonitor(string tela) + { + try + { + if (!Gestor.Common.Validation.ValidationHelper.IsNullOrEmpty(tela)) + { + using (HttpClient httpClient = new HttpClient()) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + httpClient.set_Timeout(TimeSpan.FromSeconds(10)); + TipoTela enumFromEntity = Gestor.Common.Validation.ValidationHelper.GetEnumFromEntity(tela); + object idFornecedor = ApplicationHelper.IdFornecedor; + object obj = (int)enumFromEntity; + DateTime universalTime = Funcoes.GetNetworkTime().ToUniversalTime(); + string str = string.Format("{0}:{1}:{2}", idFornecedor, obj, universalTime.Ticks).EncodeBase64(); + Uri apiMonitor = Address.get_ApiMonitor(); + string[] strArrays = new string[] { "screen" }; + Uri uri = apiMonitor.Append(strArrays).AddQuery("screenQuery", str); + await httpClient.GetAsync(uri); + } + httpClient = null; + } + else + { + return; + } + } + catch + { + } + } + + private void Produtos_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ProdutoView), null); + } + + private void Prospeccao_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ProspeccaoView), null); + } + + private void Protocolos_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ProtocoloDocumentosView), null); + } + + private void Qualificacao_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(QualificacaoView), null); + } + + private void Ramos_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(RamoView), null); + } + + private void Recibo_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(ReciboView), null); + } + + private void Relatorios_OnClick(object sender, RoutedEventArgs e) + { + string str = "DOCUMENTO"; + string name = ((HamburgerMenuItem)sender).Name; + if (name != null) + { + switch (name.Length) + { + case 14: + { + if (name == "RelatoriosLogs") + { + str = "LOGS"; + break; + } + else + { + break; + } + } + case 15: + { + if (name == "RelatoriosNotas") + { + str = "NOTA FISCAL"; + break; + } + else + { + break; + } + } + case 17: + { + char chr = name[10]; + if (chr == 'C') + { + if (name == "RelatoriosCliente") + { + str = "CLIENTE"; + break; + } + else + { + break; + } + } + else if (chr == 'E') + { + if (name == "RelatoriosExtrato") + { + str = "EXTRATO"; + break; + } + else + { + break; + } + } + else if (chr != 'T') + { + break; + } + else if (name == "RelatoriosTarefas") + { + str = "TAREFA"; + break; + } + else + { + break; + } + } + case 18: + { + if (name == "RelatoriosParcelas") + { + str = "PARCELA"; + break; + } + else + { + break; + } + } + case 19: + { + if (name == "RelatoriosSinistros") + { + str = "SINISTRO"; + break; + } + else + { + break; + } + } + case 20: + { + if (name == "RelatoriosFechamento") + { + str = "FECHAMENTO"; + break; + } + else + { + break; + } + } + } + } + string str1 = string.Format("VOCÊ ESTÁ EM RELATÓRIOS | VERSÃO GESTOR {0}", ApplicationHelper.Versao); + (new HosterWindow(new RelatorioView(str), string.Concat(new string[] { "OLÁ, ", Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", ", str1 }), new double?((double)1024), new double?((double)600), true)).Show(); + } + + private void Seguradoras_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(SeguradoraView), null); + } + + private void SetControl(Type tipo, object arguments = null) + { + System.Windows.Controls.UserControl apoliceView; + char chr; + bool? nullable; + string str; + IDisposable dataContext; + bool valueOrDefault; + bool? dashboard; + Task task; + IDisposable disposable; + Gestor.Application.Actions.Actions.AtualizaBadges(); + if (this.ViewModel.Content != null && this.ViewModel.Content.GetType() == tipo) + { + return; + } + this.lastSearch = null; + MainViewModel.ViewAberta = tipo.Name; + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Collapsed; + this.ViewModel.VisibilityVoltar = System.Windows.Visibility.Collapsed; + this.ViewModel.EnableBuscar = false; + this.ViewModel.EnableSeguros = false; + string name = tipo.Name; + if (name != null) + { + int length = name.Length; + switch (length) + { + case 11: + { + chr = name[0]; + if (chr == 'A') + { + if (name == "ApoliceView") + { + apoliceView = new ApoliceView(ConsultaViewModel.DocumentoSelecionado, false, true, this.Acesso, (long)0, false); + this.ViewModel.VisibilityVoltar = System.Windows.Visibility.Visible; + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Visible; + this.ViewModel.EnableBuscar = false; + this.ViewModel.EnableSeguros = false; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + else if (chr != 'C') + { + break; + } + else if (name == "ClienteView") + { + this.ViewModel.ClienteViewModel = new ClienteViewModel(null, true); + apoliceView = new ClienteView(this.ViewModel.SelectedCliente, false, this.ViewModel.ClienteViewModel); + this.ViewModel.VisibilityVoltar = System.Windows.Visibility.Visible; + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Visible; + this.ViewModel.EnableBuscar = false; + this.ViewModel.EnableSeguros = true; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + case 12: + { + if (name != "SinistroView") + { + break; + } + apoliceView = new SinistroView(null, true); + this.ViewModel.VisibilityVoltar = System.Windows.Visibility.Visible; + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Visible; + this.ViewModel.EnableBuscar = false; + this.ViewModel.EnableSeguros = false; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + case 13: + { + chr = name[0]; + if (chr == 'D') + { + if (name == "DashboardView") + { + if (this.ViewModel.DashboardViewModel == null) + { + this.ViewModel.DashboardViewModel = new DashboardViewModel(); + } + apoliceView = new DashboardView(this.ViewModel.DashboardViewModel); + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + else if (chr != 'M') + { + break; + } + else if (name == "MenuItensView") + { + apoliceView = new MenuItensView(this.ViewModel.SelectedRamo, (Gestor.Model.Common.ManutencaoItem)arguments); + this.ViewModel.VisibilityVoltar = System.Windows.Visibility.Visible; + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Visible; + this.ViewModel.EnableBuscar = false; + this.ViewModel.EnableSeguros = false; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + case 14: + { + if (name == "FinanceiroView") + { + this.ViewModel.FinanceiroView = new FinanceiroView(); + apoliceView = this.ViewModel.FinanceiroView; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + default: + { + if (length != 20) + { + break; + } + chr = name[1]; + if (chr == 'a') + { + if (name == "CadastroParceiroView") + { + apoliceView = new CadastroParceiroView(null); + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + else if (chr != 'o') + { + break; + } + else if (name == "ConsultaOriginalView") + { + if (this.ViewModel.ConsultaViewModel != null || this.ViewModel.Restricao(108)) + { + valueOrDefault = false; + } + else + { + Usuario usuario = Recursos.Usuario; + if (usuario != null) + { + dashboard = usuario.get_Dashboard(); + } + else + { + nullable = null; + dashboard = nullable; + } + nullable = dashboard; + valueOrDefault = nullable.GetValueOrDefault(); + } + this.ViewModel.ConsultaViewModel = new ConsultaViewModel(); + if (!valueOrDefault) + { + apoliceView = new ConsultaOriginalView(this.ViewModel.ConsultaViewModel); + } + else + { + this.ViewModel.DashboardViewModel = new DashboardViewModel(); + apoliceView = new DashboardView(this.ViewModel.DashboardViewModel); + } + this.ViewModel.VisibleSeguros = System.Windows.Visibility.Visible; + this.ViewModel.EnableBuscar = true; + this.ViewModel.EnableSeguros = true; + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + return; + } + else + { + break; + } + } + } + } + apoliceView = (System.Windows.Controls.UserControl)Activator.CreateInstance(tipo); + this.ShowHelp(tipo.Name); + str = (apoliceView.Tag == null ? "" : apoliceView.Tag.ToString()); + this.DefinirNomeTela(str); + task = this.PostMonitor(tipo.Name); + dataContext = this.ContentControl.DataContext as IDisposable; + if (dataContext != null) + { + dataContext.Dispose(); + } + else + { + disposable = dataContext; + } + this.ViewModel.Content = apoliceView; + } + + private async void ShowHelp(string name) + { + bool valueOrDefault; + if (await this.ViewModel.VerificarRestricao(61, true, false)) + { + TipoTela? nullable = Funcoes.ConvertTela(name); + if (!nullable.HasValue) + { + valueOrDefault = false; + } + else + { + TipoTela? nullable1 = nullable; + TipoTela tipoTela = 0; + valueOrDefault = !(nullable1.GetValueOrDefault() == tipoTela & nullable1.HasValue); + } + this.HelpPopup.Visibility = (valueOrDefault ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + this.ViewModel.TelaAberta = nullable; + } + else + { + this.HelpPopup.Visibility = System.Windows.Visibility.Collapsed; + } + } + + private void Sinistros_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado == null) + { + return; + } + this.SetControl(typeof(SinistroView), null); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.set_IsActive(false); + } + + private void Socio_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(SocioView), null); + } + + private void Status_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(StatusView), null); + } + + private void StatusProspeccao_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(StatusProspeccaoView), null); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 1: + { + ((MainWindow)target).Loaded += new RoutedEventHandler(this.Window_Loaded); + ((MainWindow)target).Initialized += new EventHandler(this.MainWindow_OnInitialized); + ((MainWindow)target).SizeChanged += new SizeChangedEventHandler(this.MainWindow_OnSizeChanged); + return; + } + case 2: + { + this.WindowChrome = (System.Windows.Shell.WindowChrome)target; + return; + } + case 3: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.CartaoVisita_OnClick); + return; + } + case 4: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Notas_OnClick); + return; + } + case 5: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Tarefas_OnClick); + return; + } + case 6: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Agenda_OnClick); + return; + } + case 7: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.MenuGestorMobile_OnClick); + return; + } + case 8: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Atendimentos_OnClick); + return; + } + case 9: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.BoletosNotas_OnClick); + return; + } + case 10: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Contratos_OnClick); + return; + } + case 11: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Instalacao_OnClick); + return; + } + case 12: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.CopiarChave_OnClick); + return; + } + case 13: + { + ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.AcessoRemoto_OnClick); + return; + } + case 14: + { + this.MinimizeButton = (Grid)target; + this.MinimizeButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown); + this.MinimizeButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp); + return; + } + case 15: + { + this.MaximizeButton = (Grid)target; + this.MaximizeButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown); + this.MaximizeButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp); + return; + } + case 16: + { + this.CloseButton = (Grid)target; + this.CloseButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown); + this.CloseButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp); + return; + } + case 17: + { + this.MainMenu = (HamburgerMenu)target; + return; + } + case 18: + { + this.CentralDeNegociosMenu = (HamburgerMenuItem)target; + return; + } + case 19: + { + this.DashBoard = (HamburgerMenuItem)target; + this.DashBoard.add_Click(new RoutedEventHandler(this.DashBoard_OnClick)); + return; + } + case 20: + { + this.PainelBi = (HamburgerMenuItem)target; + this.PainelBi.add_Click(new RoutedEventHandler(this.PainelBi_OnClick)); + return; + } + case 21: + { + this.Prospeccao = (HamburgerMenuItem)target; + this.Prospeccao.add_Click(new RoutedEventHandler(this.Prospeccao_OnClick)); + return; + } + case 22: + { + this.SegurosMenu = (HamburgerMenuItem)target; + this.SegurosMenu.add_DoubleClick(new RoutedEventHandler(this.Consultar_OnClick)); + return; + } + case 23: + { + this.Consulta = (HamburgerMenuItem)target; + this.Consulta.add_Click(new RoutedEventHandler(this.Consultar_OnClick)); + return; + } + case 24: + { + this.Clientes = (HamburgerMenuItem)target; + this.Clientes.add_Click(new RoutedEventHandler(this.Clientes_OnClick)); + return; + } + case 25: + { + this.Apolices = (HamburgerMenuItem)target; + this.Apolices.add_Click(new RoutedEventHandler(this.Apolices_OnClick)); + return; + } + case 26: + { + this.Itens = (HamburgerMenuItem)target; + this.Itens.add_Click(new RoutedEventHandler(this.Itens_OnClick)); + return; + } + case 27: + { + this.Sinistros = (HamburgerMenuItem)target; + this.Sinistros.add_Click(new RoutedEventHandler(this.Sinistros_OnClick)); + return; + } + case 28: + { + this.ImportPdf = (HamburgerMenuItem)target; + this.ImportPdf.add_Click(new RoutedEventHandler(this.ImportPdf_OnClick)); + return; + } + case 29: + { + this.CriticaPdf = (HamburgerMenuItem)target; + this.CriticaPdf.add_Click(new RoutedEventHandler(this.CriticaPdf_OnClick)); + return; + } + case 30: + { + this.Comissao = (HamburgerMenuItem)target; + this.Comissao.add_Click(new RoutedEventHandler(this.Comissao_OnClick)); + return; + } + case 31: + { + this.RelatoriosMenu = (HamburgerMenuItem)target; + return; + } + case 32: + { + this.RelatoriosCliente = (HamburgerMenuItem)target; + this.RelatoriosCliente.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 33: + { + this.RelatoriosDocumentos = (HamburgerMenuItem)target; + this.RelatoriosDocumentos.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 34: + { + this.RelatoriosParcelas = (HamburgerMenuItem)target; + this.RelatoriosParcelas.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 35: + { + this.RelatoriosSinistros = (HamburgerMenuItem)target; + this.RelatoriosSinistros.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 36: + { + this.RelatoriosFechamento = (HamburgerMenuItem)target; + this.RelatoriosFechamento.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 37: + { + this.RelatoriosExtrato = (HamburgerMenuItem)target; + this.RelatoriosExtrato.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 38: + { + this.RelatoriosNotas = (HamburgerMenuItem)target; + this.RelatoriosNotas.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 39: + { + this.RelatoriosTarefas = (HamburgerMenuItem)target; + this.RelatoriosTarefas.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 40: + { + this.RelatoriosLogs = (HamburgerMenuItem)target; + this.RelatoriosLogs.add_Click(new RoutedEventHandler(this.Relatorios_OnClick)); + return; + } + case 41: + { + this.ExtratoConta = (HamburgerMenuItem)target; + this.ExtratoConta.add_Click(new RoutedEventHandler(this.ExtratoConta_OnClick)); + return; + } + case 42: + { + this.FechamentoFinanceiro = (HamburgerMenuItem)target; + this.FechamentoFinanceiro.add_Click(new RoutedEventHandler(this.FechamentoFinanceiro_OnClick)); + return; + } + case 43: + { + this.Assinatura = (HamburgerMenuItem)target; + this.Assinatura.add_Click(new RoutedEventHandler(this.Assinatura_OnClick)); + return; + } + case 44: + { + this.Aggilizador = (HamburgerMenuItem)target; + this.Aggilizador.add_Click(new RoutedEventHandler(this.Aggilizador_OnClick)); + return; + } + case 45: + { + this.Epic = (HamburgerMenuItem)target; + this.Epic.add_Click(new RoutedEventHandler(this.Epic_OnClick)); + return; + } + case 46: + { + this.FinanceiroMenu = (HamburgerMenuItem)target; + this.FinanceiroMenu.add_Click(new RoutedEventHandler(this.FinanceiroMenu_OnClick)); + return; + } + case 47: + { + this.Conta = (HamburgerMenuItem)target; + this.Conta.add_Click(new RoutedEventHandler(this.Conta_OnClick)); + return; + } + case 48: + { + this.Centro = (HamburgerMenuItem)target; + this.Centro.add_Click(new RoutedEventHandler(this.Centro_OnClick)); + return; + } + case 49: + { + this.Fornecedor = (HamburgerMenuItem)target; + this.Fornecedor.add_Click(new RoutedEventHandler(this.Fornecedor_OnClick)); + return; + } + case 50: + { + this.Plano = (HamburgerMenuItem)target; + this.Plano.add_Click(new RoutedEventHandler(this.Plano_OnClick)); + return; + } + case 51: + { + this.FerramentasMenu = (HamburgerMenuItem)target; + return; + } + case 52: + { + this.Emails = (HamburgerMenuItem)target; + this.Emails.add_Click(new RoutedEventHandler(this.Emails_OnClick)); + return; + } + case 53: + { + this.Empresa = (HamburgerMenuItem)target; + this.Empresa.add_Click(new RoutedEventHandler(this.Empresa_OnClick)); + return; + } + case 54: + { + this.Estipulantes = (HamburgerMenuItem)target; + this.Estipulantes.add_Click(new RoutedEventHandler(this.Estipulantes_OnClick)); + return; + } + case 55: + { + this.ManutencaoPagamentos = (HamburgerMenuItem)target; + this.ManutencaoPagamentos.add_Click(new RoutedEventHandler(this.Manutencao_OnClick)); + return; + } + case 56: + { + this.NotaFiscal = (HamburgerMenuItem)target; + this.NotaFiscal.add_Click(new RoutedEventHandler(this.NotaFiscal_OnClick)); + return; + } + case 57: + { + this.Parceiro = (HamburgerMenuItem)target; + this.Parceiro.add_Click(new RoutedEventHandler(this.Parceiro_OnClick)); + return; + } + case 58: + { + this.Produtos = (HamburgerMenuItem)target; + this.Produtos.add_Click(new RoutedEventHandler(this.Produtos_OnClick)); + return; + } + case 59: + { + ((HamburgerMenuItem)target).add_Click(new RoutedEventHandler(this.Protocolos_OnClick)); + return; + } + case 60: + { + this.Qualificacao = (HamburgerMenuItem)target; + this.Qualificacao.add_Click(new RoutedEventHandler(this.Qualificacao_OnClick)); + return; + } + case 61: + { + this.Ramos = (HamburgerMenuItem)target; + this.Ramos.add_Click(new RoutedEventHandler(this.Ramos_OnClick)); + return; + } + case 62: + { + this.Recibo = (HamburgerMenuItem)target; + this.Recibo.add_Click(new RoutedEventHandler(this.Recibo_OnClick)); + return; + } + case 63: + { + this.Seguradoras = (HamburgerMenuItem)target; + this.Seguradoras.add_Click(new RoutedEventHandler(this.Seguradoras_OnClick)); + return; + } + case 64: + { + this.Socio = (HamburgerMenuItem)target; + this.Socio.add_Click(new RoutedEventHandler(this.Socio_OnClick)); + return; + } + case 65: + { + this.Statuses = (HamburgerMenuItem)target; + this.Statuses.add_Click(new RoutedEventHandler(this.Status_OnClick)); + return; + } + case 66: + { + this.StatusProspeccao = (HamburgerMenuItem)target; + this.StatusProspeccao.add_Click(new RoutedEventHandler(this.StatusProspeccao_OnClick)); + return; + } + case 67: + { + this.TipoTarefa = (HamburgerMenuItem)target; + this.TipoTarefa.add_Click(new RoutedEventHandler(this.TipoTarefa_OnClick)); + return; + } + case 68: + { + this.TipoVendedor = (HamburgerMenuItem)target; + this.TipoVendedor.add_Click(new RoutedEventHandler(this.TipoVendedor_OnClick)); + return; + } + case 69: + { + this.Usuarios = (HamburgerMenuItem)target; + this.Usuarios.add_Click(new RoutedEventHandler(this.Usuarios_OnClick)); + return; + } + case 70: + { + this.Vendedores = (HamburgerMenuItem)target; + this.Vendedores.add_Click(new RoutedEventHandler(this.Vendedores_OnClick)); + return; + } + case 71: + { + this.Area = (RowDefinition)target; + return; + } + case 72: + { + this.Status = (System.Windows.Controls.ComboBox)target; + return; + } + case 73: + { + ((PackIcon)target).MouseDown += new MouseButtonEventHandler(this.Medalha_OnMouseDown); + return; + } + case 74: + { + this.FiltroClienteTipoBox = (System.Windows.Controls.ComboBox)target; + return; + } + case 75: + { + this.PesquisaCliente = (AutoCompleteBox)target; + this.PesquisaCliente.add_Populating(new PopulatingEventHandler(this, MainWindow.AutoCompleteBox_Populating)); + this.PesquisaCliente.GotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.AutoCompleteCliente_OnGotKeyboardFocus); + this.PesquisaCliente.add_SelectionChanged(new SelectionChangedEventHandler(this.PesquisaCliente_SelectionChanged)); + this.PesquisaCliente.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.PesquisaCliente_PreviewKeyDown); + this.PesquisaCliente.MouseDoubleClick += new MouseButtonEventHandler(this.PesquisaCliente_MouseDoubleClick); + return; + } + case 76: + { + this.PesquisaClienteNome = (AutoCompleteBox)target; + this.PesquisaClienteNome.add_Populating(new PopulatingEventHandler(this, MainWindow.AutoCompleteNomeBox_Populating)); + this.PesquisaClienteNome.GotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.AutoCompleteCliente_OnGotKeyboardFocus); + this.PesquisaClienteNome.add_SelectionChanged(new SelectionChangedEventHandler(this.PesquisaCliente_SelectionChanged)); + this.PesquisaClienteNome.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.PesquisaCliente_PreviewKeyDown); + this.PesquisaClienteNome.MouseDoubleClick += new MouseButtonEventHandler(this.PesquisaCliente_MouseDoubleClick); + return; + } + case 77: + { + this.LoadingAutoComplete = (Loading)target; + return; + } + case 78: + { + this.DocumentoPrincipalBox = (System.Windows.Controls.TextBox)target; + this.DocumentoPrincipalBox.MouseDoubleClick += new MouseButtonEventHandler(this.DocumentoPrincipal_MouseDoubleClick); + this.DocumentoPrincipalBox.MouseRightButtonUp += new MouseButtonEventHandler(this.CopiarDocumento_Click); + return; + } + case 79: + { + this.ObservacaoApolice = (System.Windows.Controls.Button)target; + this.ObservacaoApolice.Click += new RoutedEventHandler(this.Observacoes_OnClick); + return; + } + case 80: + { + this.PesquisaAvancada = (System.Windows.Controls.MenuItem)target; + this.PesquisaAvancada.Click += new RoutedEventHandler(this.PesquisaAvancada_OnClick); + return; + } + case 81: + { + this.Voltar = (System.Windows.Controls.MenuItem)target; + this.Voltar.Click += new RoutedEventHandler(this.Voltar_OnClick); + return; + } + case 82: + case 83: + case 94: + case 98: + case 99: + { + this._contentLoaded = true; + return; + } + case 84: + { + this.ContentControl = (System.Windows.Controls.ContentControl)target; + this.ContentControl.GotFocus += new RoutedEventHandler(this.ContentControl_GotFocus); + this.ContentControl.MouseLeftButtonDown += new MouseButtonEventHandler(this.ContentControl_MouseLeftButtonDown); + return; + } + case 85: + { + this.QrCode = (PopupBox)target; + return; + } + case 86: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.MenuGestorMobile_OnClick); + return; + } + case 87: + { + this.ImageAppStore = (System.Windows.Controls.Image)target; + this.ImageAppStore.MouseLeftButtonUp += new MouseButtonEventHandler(this.ImageAppStore_OnMouseLeftButtonUp); + return; + } + case 88: + { + this.ImageGooglePlay = (System.Windows.Controls.Image)target; + this.ImageGooglePlay.MouseLeftButtonUp += new MouseButtonEventHandler(this.ImageGooglePlay_OnMouseLeftButtonUp); + return; + } + case 89: + { + this.SessionNumber = (TextBlock)target; + return; + } + case 90: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.CopyCode_Click); + return; + } + case 91: + { + this.BoletoPopup = (PopupBox)target; + return; + } + case 92: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.OcultarBoleto_OnClick); + return; + } + case 93: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); + return; + } + case 95: + { + this.HelpPopup = (PopupBox)target; + this.HelpPopup.add_Opened(new RoutedEventHandler(this.HelpPopup_Opened)); + return; + } + case 96: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.OcultarAjuda_OnClick); + return; + } + case 97: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); + return; + } + case 100: + { + this.TarefaPopup = (StackPanel)target; + return; + } + case 101: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Tarefas_OnClick); + return; + } + case 102: + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.OcultarTarefas_OnClick); + return; + } + case 103: + { + this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 104: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + return; + } + case 105: + { + this.ProgressRing = (Grid)target; + return; + } + case 106: + { + this.DrawerHost = (MaterialDesignThemes.Wpf.DrawerHost)target; + return; + } + default: + { + this._contentLoaded = true; + return; + } + } + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId <= 83) + { + if (connectionId == 82) + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); + return; + } + if (connectionId != 83) + { + return; + } + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); + return; + } + if (connectionId == 94) + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Boleto_OnClick); + return; + } + if (connectionId == 98) + { + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.CopyLink_OnClick); + return; + } + if (connectionId != 99) + { + return; + } + ((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.Play_Click); + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + if (await this.ViewModel.VerificarPermissao(38, false)) + { + this.ViewModel.MensagemTarefasVisibility = System.Windows.Visibility.Collapsed; + MainWindow.AbrirTarefas(); + } + } + + private void TipoTarefa_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(TipoTarefaView), null); + } + + private void TipoVendedor_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(TipoVendedorView), null); + } + + private static void TopControls_OnMouseEnter(object sender, System.Windows.Input.MouseEventArgs e) + { + ((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + System.Windows.Shapes.Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as System.Windows.Shapes.Path; + if (child != null) + { + child.Stroke = new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, System.Windows.Input.MouseEventArgs e) + { + this._buttonClickable = false; + ((Grid)sender).Background = new SolidColorBrush(Colors.Transparent); + System.Windows.Shapes.Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as System.Windows.Shapes.Path; + if (child != null) + { + child.Stroke = new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + this._buttonClickable = true; + if (((Grid)sender).Name != "CloseButton") + { + ((Grid)sender).Background = new SolidColorBrush(Colors.DimGray); + } + else + { + ((Grid)sender).Background = new SolidColorBrush(Colors.Red); + System.Windows.Shapes.Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as System.Windows.Shapes.Path; + if (child != null) + { + child.Stroke = new SolidColorBrush(Colors.Black); + return; + } + } + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + if (this._buttonClickable) + { + MethodInfo method = base.GetType().GetMethod(string.Concat(((Grid)sender).Name, "_Click")); + if (method == null) + { + return; + } + method.Invoke(this, null); + } + } + + private void Usuarios_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(UsuarioView), null); + } + + private void Vendedores_OnClick(object sender, RoutedEventArgs e) + { + this.SetControl(typeof(VendedorView), null); + } + + private async Task VerificarCliente(Gestor.Model.License.Produto? produto, TipoTela? tela) + { + bool flag; + if (MainViewModel.ClienteSelecionado == null || MainViewModel.ClienteSelecionado.get_Id() == 0) + { + flag = false; + } + else + { + flag = await this.VerificarLicenca(produto, tela, null); + } + return flag; + } + + private async Task VerificarComissao(Gestor.Model.License.Produto? produto = null, TipoTela? tela = null, TipoRestricao? restricao = null) + { + bool flag; + if (!tela.HasValue || tela.GetValueOrDefault() != 35 || !this.ViewModel.MatrizFilial || Recursos.Empresa.get_Id() <= (long)1) + { + flag = await this.VerificarLicenca(produto, tela, restricao); + } + else + { + await this.ViewModel.ShowMessage("FILIAL NÃO POSSUI AUTORIZAÇÃO PARA BAIXA DE COMISSÃO AUTOMÁTICA, TODA BAIXA DE COMISSÃO AUTOMÁTICA DEVE SER FEITA PELA MATRIZ.", "OK", "", false); + flag = false; + } + return flag; + } + + private async Task VerificarDocumento(Gestor.Model.License.Produto? produto, TipoTela? tela) + { + bool flag; + if (ConsultaViewModel.DocumentoSelecionado == null || ConsultaViewModel.DocumentoSelecionado.get_Id() == 0) + { + flag = false; + } + else + { + flag = await this.VerificarLicenca(produto, tela, null); + } + return flag; + } + + private async Task VerificarLicenca(Gestor.Model.License.Produto? produto = null, TipoTela? tela = null, TipoRestricao? restricao = null) + { + bool flag; + bool hasValue; + string str = await this.ViewModel.VerificarAcesso(Recursos.Usuario.get_Id()); + if (Recursos.Usuario.get_Id() == 0 || str == null) + { + if (produto.GetValueOrDefault() != 83 || produto.GetValueOrDefault() == 86) + { + hasValue = produto.HasValue; + if (hasValue) + { + hasValue = !await this.ViewModel.VerificarContrato(produto.Value, true, true); + } + if (hasValue) + { + flag = false; + return flag; + } + } + hasValue = restricao.HasValue; + if (hasValue) + { + hasValue = !await this.ViewModel.VerificarRestricao(restricao.Value, true, true); + } + if (!hasValue) + { + hasValue = tela.HasValue; + if (hasValue) + { + hasValue = !await this.ViewModel.VerificarPermissao(tela.Value, true); + } + if (!hasValue) + { + if (tela.GetValueOrDefault() == 58) + { + if (!Recursos.Usuario.get_Administrador() && Recursos.Usuario.get_Id() > (long)0) + { + await this.ViewModel.ShowMessage("VOCÊ PRECISA SER ADMINISTRADOR PARA ACESSAR ESSA TELA.", "OK", "", false); + flag = false; + return flag; + } + else if (await this.ViewModel.VerificaVinculoVendedor(Recursos.Usuario).Count > 0) + { + await this.ViewModel.ShowMessage("PARA ACESSAR ESSA TELA, REMOVA QUALQUER VÍNCULO DE VENDEDOR DO SEU USUÁRIO.", "OK", "", false); + flag = false; + return flag; + } + } + hasValue = restricao.GetValueOrDefault() == 44; + if (hasValue) + { + hasValue = !await this.ViewModel.VerificarPermissao(60, true); + } + flag = (!hasValue ? true : false); + } + else + { + flag = false; + } + } + else + { + flag = false; + } + } + else + { + await this.ViewModel.ShowMessage(string.Concat(str, " O SISTEMA SERÁ ENCERRADO."), "OK", "", false); + Environment.Exit(0); + flag = false; + } + return flag; + } + + private void Voltar_OnClick(object sender, RoutedEventArgs e) + { + this.VoltarAction(); + } + + private void VoltarAction() + { + this.ManutencaoItem = null; + this.Consultar_OnClick(this.SegurosMenu, new RoutedEventArgs()); + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + string str; + if (!this.ViewModel.Restricao(32)) + { + bool flag = await this.ViewModel.ShowMessage("DESEJA ENVIAR SEU CARTÃO DE VISITA ELETRÔNICO VIA WHATSAPP?", "SIM", "NÃO", false); + object[] nome = new object[] { this.ViewModel.SelectedCliente.get_Nome(), Environment.NewLine, Environment.NewLine, Address.get_Card(), Recursos.Usuario.get_Id().GeraCartaoVisita() }; + string str1 = string.Format("Prezado {0} abaixo o link para meu Cartão de Visita.{1}{2}{3}{4}", nome); + System.Windows.Controls.Button button = (System.Windows.Controls.Button)sender; + if (button.DataContext != null) + { + Contato dataContext = button.DataContext as Contato; + if (dataContext != null) + { + string str2 = string.Concat("55", dataContext.get_Numero().Clear()); + if (!flag) + { + str = null; + } + else + { + str = str1; + } + if (!str2.EnviarWhatsapp(str)) + { + await this.ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS", "OK", "", false); + } + return; + } + } + } + else + { + await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP", "OK", "", false); + } + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + EventManager.RegisterClassHandler(typeof(CustomItemValidation), UIElement.LostFocusEvent, new RoutedEventHandler(ViewHelper.ControlLostFocus)); + EventManager.RegisterClassHandler(typeof(CustomIsReadOnlyControl), UIElement.LostFocusEvent, new RoutedEventHandler(ViewHelper.ControlLostFocus)); + this.PipeName = string.Format("GESTORPIPE{0}{1}", ApplicationHelper.NumeroSerial, Recursos.Usuario.get_Id()); + (new PipeServer()).CreateServer(this.PipeName); + } + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + this.WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + MainWindow.Point point; + System.Drawing.Rectangle workingArea = Screen.FromHandle((new WindowInteropHelper(this)).Handle).WorkingArea; + base.MaxHeight = (double)workingArea.Height; + MainWindow.GetCursorPos(out point); + IntPtr intPtr = MainWindow.MonitorFromPoint(new MainWindow.Point(0, 0), MainWindow.MonitorOptions.MonitorDefaulttoprimary); + MainWindow.Monitorinfo monitorinfo = new MainWindow.Monitorinfo(); + if (!MainWindow.GetMonitorInfo(intPtr, monitorinfo)) + { + return; + } + IntPtr intPtr1 = MainWindow.MonitorFromPoint(point, MainWindow.MonitorOptions.MonitorDefaulttonearest); + MainWindow.Minmaxinfo structure = (MainWindow.Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(MainWindow.Minmaxinfo)); + if (!intPtr.Equals(intPtr1)) + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + Marshal.StructureToPtr(structure, lParam, true); + } + + private struct Minmaxinfo + { + private readonly MainWindow.Point ptReserved; + + public MainWindow.Point ptMaxSize; + + public MainWindow.Point ptMaxPosition; + + private readonly MainWindow.Point ptMinTrackSize; + + private readonly MainWindow.Point ptMaxTrackSize; + } + + private class Monitorinfo + { + private readonly int cbSize; + + public readonly MainWindow.Rect rcMonitor; + + public readonly MainWindow.Rect rcWork; + + private readonly int dwFlags; + + public Monitorinfo() + { + } + } + + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1, + MonitorDefaulttonearest = 2 + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + this.X = x; + this.Y = y; + } + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + } +} \ No newline at end of file -- cgit v1.2.3