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 --- .../Drawers/AdiantamentoDrawerView.cs | 243 ------ Gestor.Application/Drawers/AgendaDrawer.cs | 563 -------------- .../Drawers/Ajuda/BoletosNotasDrawerView.cs | 174 ----- .../Drawers/Ajuda/ContratosDrawerView.cs | 69 -- .../Drawers/Ajuda/InstalacaoDrawerView.cs | 181 ----- Gestor.Application/Drawers/ArquivoDigitalDrawer.cs | 835 --------------------- .../Drawers/Configuracoes/ConfiguracoesDrawer.cs | 159 ---- Gestor.Application/Drawers/ExpedicaoDrawer.cs | 265 ------- Gestor.Application/Drawers/ExtratosDrawer.cs | 281 ------- Gestor.Application/Drawers/ImpostoDrawer.cs | 296 -------- .../Drawers/InclusaoArquivoDigitalDrawer.cs | 186 ----- Gestor.Application/Drawers/InfoDrawer.cs | 219 ------ Gestor.Application/Drawers/LogDrawer.cs | 90 --- Gestor.Application/Drawers/LogEmailDrawer.cs | 75 -- Gestor.Application/Drawers/LogSistemaAntigo.cs | 67 -- Gestor.Application/Drawers/LogUtilizacaoDrawer.cs | 65 -- Gestor.Application/Drawers/MetaSeguradoraView.cs | 224 ------ Gestor.Application/Drawers/MetaVendedorView.cs | 226 ------ Gestor.Application/Drawers/ObservacoesDrawer.cs | 265 ------- .../Drawers/PermissaoUsuarioDrawer.cs | 672 ----------------- .../Drawers/Relatorios/ConfiguracaoRelatorio.cs | 421 ----------- .../Drawers/Relatorios/FiltroRelatorio.cs | 152 ---- Gestor.Application/Drawers/TarefaDrawer.cs | 631 ---------------- Gestor.Application/Drawers/ValoresApoliceDrawer.cs | 63 -- Gestor.Application/Drawers/ValoresParcelaDrawer.cs | 70 -- .../Drawers/VinculoVendedorDrawer.cs | 124 --- 26 files changed, 6616 deletions(-) delete mode 100644 Gestor.Application/Drawers/AdiantamentoDrawerView.cs delete mode 100644 Gestor.Application/Drawers/AgendaDrawer.cs delete mode 100644 Gestor.Application/Drawers/Ajuda/BoletosNotasDrawerView.cs delete mode 100644 Gestor.Application/Drawers/Ajuda/ContratosDrawerView.cs delete mode 100644 Gestor.Application/Drawers/Ajuda/InstalacaoDrawerView.cs delete mode 100644 Gestor.Application/Drawers/ArquivoDigitalDrawer.cs delete mode 100644 Gestor.Application/Drawers/Configuracoes/ConfiguracoesDrawer.cs delete mode 100644 Gestor.Application/Drawers/ExpedicaoDrawer.cs delete mode 100644 Gestor.Application/Drawers/ExtratosDrawer.cs delete mode 100644 Gestor.Application/Drawers/ImpostoDrawer.cs delete mode 100644 Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs delete mode 100644 Gestor.Application/Drawers/InfoDrawer.cs delete mode 100644 Gestor.Application/Drawers/LogDrawer.cs delete mode 100644 Gestor.Application/Drawers/LogEmailDrawer.cs delete mode 100644 Gestor.Application/Drawers/LogSistemaAntigo.cs delete mode 100644 Gestor.Application/Drawers/LogUtilizacaoDrawer.cs delete mode 100644 Gestor.Application/Drawers/MetaSeguradoraView.cs delete mode 100644 Gestor.Application/Drawers/MetaVendedorView.cs delete mode 100644 Gestor.Application/Drawers/ObservacoesDrawer.cs delete mode 100644 Gestor.Application/Drawers/PermissaoUsuarioDrawer.cs delete mode 100644 Gestor.Application/Drawers/Relatorios/ConfiguracaoRelatorio.cs delete mode 100644 Gestor.Application/Drawers/Relatorios/FiltroRelatorio.cs delete mode 100644 Gestor.Application/Drawers/TarefaDrawer.cs delete mode 100644 Gestor.Application/Drawers/ValoresApoliceDrawer.cs delete mode 100644 Gestor.Application/Drawers/ValoresParcelaDrawer.cs delete mode 100644 Gestor.Application/Drawers/VinculoVendedorDrawer.cs (limited to 'Gestor.Application/Drawers') diff --git a/Gestor.Application/Drawers/AdiantamentoDrawerView.cs b/Gestor.Application/Drawers/AdiantamentoDrawerView.cs deleted file mode 100644 index 46e4dde..0000000 --- a/Gestor.Application/Drawers/AdiantamentoDrawerView.cs +++ /dev/null @@ -1,243 +0,0 @@ -using CurrencyTextBoxControl; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class AdiantamentoDrawerView : BaseUserControl, IComponentConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal DataGrid AdiantamentoGrid; - - internal CurrencyTextBox RendaMensalBox; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public AdiantamentoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public AdiantamentoDrawerView(Vendedor vendedor) - { - this.ViewModel = new AdiantamentoViewModel(vendedor); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(36, this.ViewModel.SelectedAdiantamento.get_Id()); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - this.ToggleSnackBar("ADIANTAMENTO EXCLUÍDO COM SUCESSO", true); - } - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - } - - [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/drawers/adiantamentodrawerview.xaml", UriKind.Relative)); - } - - private async void MenuList_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - ListBox listBox = (ListBox)sender; - if (listBox.SelectedItem != null) - { - await this.ViewModel.CarregarAdiantamento(listBox.SelectedIndex); - } - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.AdiantamentoGrid.Items.Refresh(); - this.ViewModel.Carregando = false; - this.ViewModel.Loading(false); - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("ADIANTAMENTO SALVO COM SUCESSO", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((ListBox)target).SelectionChanged += new SelectionChangedEventHandler(this.MenuList_OnSelectionChanged); - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.AdiantamentoGrid = (DataGrid)target; - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 11: - { - ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - return; - } - case 12: - { - this.RendaMensalBox = (CurrencyTextBox)target; - return; - } - case 13: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 14: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/AgendaDrawer.cs b/Gestor.Application/Drawers/AgendaDrawer.cs deleted file mode 100644 index d60001d..0000000 --- a/Gestor.Application/Drawers/AgendaDrawer.cs +++ /dev/null @@ -1,563 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Common.Helpers; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Drawers -{ - public class AgendaDrawer : BaseUserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal DataGrid AgendaGrid; - - internal MenuItem MaisOpcoesButton; - - internal TextBox NomeBox; - - internal TextBox CepBox; - - internal System.Windows.Controls.ProgressBar ProgressCep; - - internal TextBox EnderecoBox; - - internal TextBox BairroBox; - - internal TextBox CidadeBox; - - internal TextBox EstadoBox; - - internal TextBox ObsBox; - - internal ListBox TelefoneListBox; - - internal ListBox EmailListBox; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - private AgendaViewModel ViewModel - { - get; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public AgendaDrawer() - { - this.ViewModel = new AgendaViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(34, this.ViewModel.SelectedAgenda.get_Id()); - } - - private async void AgendaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - object obj; - DataGrid dataGrid = (DataGrid)sender; - if (dataGrid == null || dataGrid.SelectedIndex >= 0) - { - AgendaViewModel viewModel = this.ViewModel; - obj = (dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null); - await viewModel.SelecionaAgenda((Agenda)obj); - } - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelAgenda = (Agenda)this.ViewModel.SelectedAgenda.Clone(); - this.ViewModel.Alterar(true); - } - - private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text())) - { - return; - } - this.ViewModel.FiltrarAgenda(""); - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private void ContentLoad() - { - this.AgendaGrid.SelectedIndex = 0; - this.AgendaGrid.SelectionChanged += new SelectionChangedEventHandler(this.AgendaGrid_OnSelectionChanged); - this.AgendaGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => { - }); - this.ViewModel.PermissaoWhatsapp = this.ViewModel.Restricao(32); - } - - private void CopyEmailToClipBoard_Click(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - EmailBase item = (EmailBase)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - item.get_Email().CopyToClipboard(); - this.ToggleSnackBar(string.Concat("COPIADO - ", item.get_Email()), true); - } - - private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - TelefoneBase item = (TelefoneBase)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - string.Concat(item.get_Prefixo(), ValidationHelper.OnlyNumber(item.get_Numero())).CopyToClipboard(); - this.ToggleSnackBar(string.Concat("COPIADO - ", item.get_Prefixo(), ValidationHelper.OnlyNumber(item.get_Numero())), true); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - this.ToggleSnackBar("AGENDA EXCLUÍDA COM SUCESSO", true); - } - } - - private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - if (button == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(button); - AgendaEmail item = (AgendaEmail)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - this.ViewModel.ExcluirEmail(item); - } - - private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - if (button == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(button); - AgendaTelefone item = (AgendaTelefone)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - this.ViewModel.ExcluirTelefone(item); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - List> keyValuePairs = this.ViewModel.SelectedAgenda.Validate(); - this.ValidateFields(keyValuePairs, true); - } - - private void IncluirEmail_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.IncluirEmail(); - } - - private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.IncluirTelefone(); - } - - [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/drawers/agendadrawer.xaml", UriKind.Relative)); - } - - private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) - { - string str = ValidationHelper.FormatPostCode(((TextBox)sender).Text); - this.CepBox.Text = str; - if (ValidationHelper.ValidatePostCode(str)) - { - EnderecoBase enderecoBase = await this.ViewModel.BuscaCep(str); - if (enderecoBase != null) - { - this.EnderecoBox.Text = enderecoBase.get_Endereco(); - this.CidadeBox.Text = enderecoBase.get_Cidade(); - this.EstadoBox.Text = enderecoBase.get_Estado(); - this.BairroBox.Text = enderecoBase.get_Bairro(); - } - } - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("AGENDA SALVA COM SUCESSO", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, AgendaDrawer.AutoCompleteBox_Populating)); - ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged)); - return; - } - case 4: - { - this.AgendaGrid = (DataGrid)target; - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 10: - { - this.MaisOpcoesButton = (MenuItem)target; - return; - } - case 11: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 12: - { - this.NomeBox = (TextBox)target; - return; - } - case 13: - { - this.CepBox = (TextBox)target; - this.CepBox.LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus); - AgendaDrawer agendaDrawer = this; - this.CepBox.PreviewTextInput += new TextCompositionEventHandler(agendaDrawer.SomenteNumeros); - return; - } - case 14: - { - this.ProgressCep = (System.Windows.Controls.ProgressBar)target; - return; - } - case 15: - { - this.EnderecoBox = (TextBox)target; - return; - } - case 16: - { - this.BairroBox = (TextBox)target; - return; - } - case 17: - { - this.CidadeBox = (TextBox)target; - return; - } - case 18: - { - this.EstadoBox = (TextBox)target; - return; - } - case 19: - { - this.ObsBox = (TextBox)target; - return; - } - case 20: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTelefone_OnClick); - return; - } - case 21: - { - this.TelefoneListBox = (ListBox)target; - return; - } - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 30: - case 31: - { - this._contentLoaded = true; - return; - } - case 28: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirEmail_OnClick); - return; - } - case 29: - { - this.EmailListBox = (ListBox)target; - return; - } - case 32: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 33: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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) - { - switch (connectionId) - { - case 22: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.TipoComboBox_OnSelectionChanged); - return; - } - case 23: - { - AgendaDrawer agendaDrawer = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(agendaDrawer.SomenteNumeros); - return; - } - case 24: - { - AgendaDrawer agendaDrawer1 = this; - ((TextBox)target).LostFocus += new RoutedEventHandler(agendaDrawer1.FormatarTelefone); - AgendaDrawer agendaDrawer2 = this; - ((TextBox)target).PreviewTextInput += new TextCompositionEventHandler(agendaDrawer2.SomenteNumeros); - return; - } - case 25: - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirTelefone_OnClick); - return; - } - case 26: - { - ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); - return; - } - case 27: - { - ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); - return; - } - case 28: - case 29: - { - return; - } - case 30: - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirEmail_OnClick); - return; - } - case 31: - { - ((Button)target).Click += new RoutedEventHandler(this.CopyEmailToClipBoard_Click); - return; - } - default: - { - return; - } - } - } - - private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - int num; - ComboBox comboBox = (ComboBox)sender; - CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor(comboBox); - if (customIsReadOnlyControl == null) - { - return; - } - WrapPanel wrapPanel = Extentions.FindVisualAncestor(customIsReadOnlyControl); - ListBox listBox = Extentions.FindVisualAncestor(wrapPanel); - ContentPresenter contentPresenter = FindVisualChild.Find((ListBoxItem)listBox.ItemContainerGenerator.ContainerFromIndex(listBox.Items.IndexOf(wrapPanel.DataContext))); - DataTemplate contentTemplate = contentPresenter.ContentTemplate; - CustomItemValidation customItemValidation = (CustomItemValidation)contentTemplate.FindName("Prefixo", contentPresenter); - CustomItemValidation customItemValidation1 = (CustomItemValidation)contentTemplate.FindName("Telefone", contentPresenter); - TextBox textBox = ViewHelper.FindChildren(customItemValidation).FirstOrDefault(); - TextBox textBox1 = ViewHelper.FindChildren(customItemValidation1).FirstOrDefault(); - if (textBox == null || textBox1 == null) - { - return; - } - if ((TipoTelefone)comboBox.SelectedValue == 8) - { - customItemValidation.Visibility = System.Windows.Visibility.Collapsed; - textBox1.MaxLength = 20; - return; - } - customItemValidation.Visibility = System.Windows.Visibility.Visible; - textBox1.MaxLength = 10; - num = (textBox1.Text.Length >= 10 ? 10 : textBox1.Text.Length); - textBox1.Text = textBox1.Text.Substring(0, num); - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - - private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) - { - string str; - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - TelefoneBase item = (TelefoneBase)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - str = (!item.get_Tipo().HasValue || item.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", item.get_Prefixo(), item.get_Numero().Clear()) : string.Concat(item.get_Prefixo(), item.get_Numero()).Clear()); - if (!str.EnviarWhatsapp(null)) - { - 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); - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Ajuda/BoletosNotasDrawerView.cs b/Gestor.Application/Drawers/Ajuda/BoletosNotasDrawerView.cs deleted file mode 100644 index 5426bb0..0000000 --- a/Gestor.Application/Drawers/Ajuda/BoletosNotasDrawerView.cs +++ /dev/null @@ -1,174 +0,0 @@ -using Agger.Registro; -using Gestor.Application.Helpers; -using Gestor.Application.Model.Ajuda; -using Gestor.Application.ViewModels.Drawer.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers.Ajuda -{ - public class BoletosNotasDrawerView : BaseUserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal ComboBox StatusCbo; - - internal DataGrid BoletosGrid; - - internal DataGridTemplateColumn BaixarBoletoColumn; - - internal DataGridTextColumn PagamentoColumn; - - internal ItemsControl BoletoDisponivel; - - internal TextBlock TxtBoletoDisponivel; - - private bool _contentLoaded; - - public BoletosNotasViewModel ViewModel - { - get; - set; - } - - public BoletosNotasDrawerView() - { - this.ViewModel = new BoletosNotasViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - this.StatusCbo.SelectedIndex = 0; - } - - private void ExibirBoleto_OnClick(object sender, RoutedEventArgs e) - { - Boleto selectedItem = (Boleto)this.BoletosGrid.SelectedItem; - if ((selectedItem.Vencimento - Funcoes.GetNetworkTime()).TotalDays > 10) - { - return; - } - Process.Start(string.Format("{0}billet/id/{1}", Address.get_ApiBoletoAgger(), selectedItem.IdBoleto)); - } - - private void ExibirNota_OnClick(object sender, RoutedEventArgs e) - { - Process.Start(((Boleto)this.BoletosGrid.SelectedItem).Nota ?? ""); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/ajuda/boletosnotasdrawerview.xaml", UriKind.Relative)); - } - - private void SelectedStatus_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (this.StatusCbo.SelectedItem == null) - { - return; - } - this.ViewModel.WorkOnSelectedStatus(this.StatusCbo.SelectedItem.ToString()); - this.PagamentoColumn.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); - this.BaixarBoletoColumn.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.BoletoDisponivel.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - this.StatusCbo = (ComboBox)target; - this.StatusCbo.SelectionChanged += new SelectionChangedEventHandler(this.SelectedStatus_OnSelectionChanged); - return; - } - case 4: - { - this.BoletosGrid = (DataGrid)target; - return; - } - case 5: - { - this.BaixarBoletoColumn = (DataGridTemplateColumn)target; - return; - } - case 6: - case 7: - { - this._contentLoaded = true; - return; - } - case 8: - { - this.PagamentoColumn = (DataGridTextColumn)target; - return; - } - case 9: - { - this.BoletoDisponivel = (ItemsControl)target; - return; - } - case 10: - { - this.TxtBoletoDisponivel = (TextBlock)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 == 6) - { - ((Button)target).Click += new RoutedEventHandler(this.ExibirBoleto_OnClick); - return; - } - if (connectionId != 7) - { - return; - } - ((Button)target).Click += new RoutedEventHandler(this.ExibirNota_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Ajuda/ContratosDrawerView.cs b/Gestor.Application/Drawers/Ajuda/ContratosDrawerView.cs deleted file mode 100644 index 3a3c153..0000000 --- a/Gestor.Application/Drawers/Ajuda/ContratosDrawerView.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Gestor.Application.ViewModels.Drawer.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers.Ajuda -{ - public class ContratosDrawerView : BaseUserControl, IComponentConnector - { - internal DataGrid ContratosGrid; - - private bool _contentLoaded; - - public ContratosViewModel ViewModel - { - get; - set; - } - - public ContratosDrawerView() - { - this.ViewModel = new ContratosViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/ajuda/contratosdrawerview.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId == 1) - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - if (connectionId != 2) - { - this._contentLoaded = true; - return; - } - this.ContratosGrid = (DataGrid)target; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Ajuda/InstalacaoDrawerView.cs b/Gestor.Application/Drawers/Ajuda/InstalacaoDrawerView.cs deleted file mode 100644 index 9721288..0000000 --- a/Gestor.Application/Drawers/Ajuda/InstalacaoDrawerView.cs +++ /dev/null @@ -1,181 +0,0 @@ -using Gestor.Application.Model.Ajuda; -using Gestor.Application.ViewModels.Drawer.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Common.Validation; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers.Ajuda -{ - public class InstalacaoDrawerView : BaseUserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal DataGrid GestorGrid; - - internal DataGrid AggilizadorGrid; - - private bool _contentLoaded; - - public InstalacaoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public InstalacaoDrawerView() - { - this.ViewModel = new InstalacaoViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text())) - { - return; - } - this.ViewModel.FiltrarInstalacao(""); - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - e.set_Cancel(true); - this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { - if (searchResult.Result == null) - { - return; - } - AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; - autoCompleteBox.set_ItemsSource(searchResult.Result); - autoCompleteBox.PopulateComplete(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - private async void ExcluirInstalacaoAggilizadorGrid_OnClick(object sender, RoutedEventArgs e) - { - Instalacao selectedItem; - if (this.AggilizadorGrid.SelectedItem != null) - { - selectedItem = (Instalacao)this.AggilizadorGrid.SelectedItem; - if (await this.ViewModel.ShowMessage(string.Concat("DESEJA REALMENTE EXCLUIR A INSTALAÇÃO DA MÁQUINA ", selectedItem.Maquina.ToUpper()), "SIM", "NÃO", false)) - { - this.ViewModel.Excluir(selectedItem.Id); - } - } - selectedItem = null; - } - - private async void ExcluirInstalacaoGestorGrid_OnClick(object sender, RoutedEventArgs e) - { - Instalacao selectedItem; - if (this.GestorGrid.SelectedItem != null) - { - selectedItem = (Instalacao)this.GestorGrid.SelectedItem; - if (await this.ViewModel.ShowMessage(string.Concat("DESEJA REALMENTE EXCLUIR A INSTALAÇÃO DA MÁQUINA ", selectedItem.Maquina.ToUpper()), "SIM", "NÃO", false)) - { - this.ViewModel.Excluir(selectedItem.Id); - } - } - selectedItem = null; - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/ajuda/instalacaodrawerview.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, InstalacaoDrawerView.AutoCompleteBox_Populating)); - ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged)); - return; - } - case 4: - { - this.GestorGrid = (DataGrid)target; - return; - } - case 5: - { - this._contentLoaded = true; - return; - } - case 6: - { - this.AggilizadorGrid = (DataGrid)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 == 5) - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirInstalacaoGestorGrid_OnClick); - return; - } - if (connectionId != 7) - { - return; - } - ((Button)target).Click += new RoutedEventHandler(this.ExcluirInstalacaoAggilizadorGrid_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ArquivoDigitalDrawer.cs b/Gestor.Application/Drawers/ArquivoDigitalDrawer.cs deleted file mode 100644 index 04ffb9a..0000000 --- a/Gestor.Application/Drawers/ArquivoDigitalDrawer.cs +++ /dev/null @@ -1,835 +0,0 @@ -using Gestor.Application; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Ferramentas; -using Gestor.Application.Views.Generic; -using Gestor.Common.Security; -using Gestor.Common.Validation; -using Gestor.Model.API; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.MalaDireta; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.License; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Drawers -{ - public class ArquivoDigitalDrawer : UserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal TextBlock TitleBox; - - internal DataGrid ArquivoGrid; - - internal TextBox DocumentoBox; - - internal Snackbar SnackbarArquivoDigital; - - private bool _contentLoaded; - - private FiltroArquivoDigital Filtro - { - get; - } - - public ArquivoDigitalViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ArquivoDigitalDrawer(FiltroArquivoDigital filtro) - { - long? nullable; - long? nullable1; - string description; - string str; - long? nullable2; - string description1; - string str1; - long num; - this.ViewModel = new ArquivoDigitalViewModel(filtro); - this.Filtro = filtro; - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher != null) - { - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - else - { - } - ArquivoDigitalViewModel viewModel = this.ViewModel; - if (filtro != null) - { - description = ValidationHelper.GetDescription(filtro.get_Tipo()); - } - else - { - description = null; - } - if ((filtro != null ? filtro.get_Id() != (long)0 : true)) - { - if (filtro != null) - { - nullable1 = new long?(filtro.get_Id()); - } - else - { - nullable = null; - nullable1 = nullable; - } - str = string.Format(" DO DOCUMENTO DE ID \"{0}\"", nullable1); - } - else - { - str = ""; - } - string str2 = string.Concat("ACESSOU ARQUIVO DIGITAL DE ", description, str); - num = (filtro != null ? filtro.get_Id() : (long)0); - TipoTela? nullable3 = new TipoTela?(6); - if (filtro != null) - { - description1 = ValidationHelper.GetDescription(filtro.get_Tipo()); - } - else - { - description1 = null; - } - if ((filtro != null ? filtro.get_Id() != (long)0 : true)) - { - if (filtro != null) - { - nullable2 = new long?(filtro.get_Id()); - } - else - { - nullable = null; - nullable2 = nullable; - } - str1 = string.Format("\nID APÓLICE: {0}", nullable2); - } - else - { - str1 = ""; - } - viewModel.RegistrarAcao(str2, num, nullable3, string.Concat("TIPO: ", description1, str1)); - } - - private void Abrir_OnClick(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - if (button == null) - { - return; - } - this.ViewModel.Activated = false; - DataGrid dataGrid = Extentions.FindVisualAncestor(button); - IndiceArquivoDigital item = (IndiceArquivoDigital)dataGrid.Items[dataGrid.Items.IndexOf(button.DataContext)]; - this.ViewModel.Baixar(item, true); - this.ViewModel.Activated = true; - } - - private void AlteraEventoAssinarOnClick(Button assinarButton, bool adiciona = true) - { - if (adiciona) - { - assinarButton.Click += new RoutedEventHandler(this.Assinar_OnClick); - return; - } - assinarButton.Click -= new RoutedEventHandler(this.Assinar_OnClick); - } - - private void AlteraEventoEnviarOnClick(MenuItem enviarMenu, bool adiciona = true) - { - if (adiciona) - { - enviarMenu.Click += new RoutedEventHandler(this.Enviar_OnClick); - return; - } - enviarMenu.Click -= new RoutedEventHandler(this.Enviar_OnClick); - } - - private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Anexar(); - } - - private void ArquivoGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) - { - string path; - if (e.EditAction != DataGridEditAction.Commit) - { - return; - } - DataGridBoundColumn column = e.Column as DataGridBoundColumn; - if (column == null) - { - return; - } - Binding binding = column.Binding as Binding; - if (binding != null) - { - path = binding.Path.Path; - } - else - { - path = null; - } - if (path != "Descricao") - { - return; - } - int index = e.Row.GetIndex(); - TextBox editingElement = e.EditingElement as TextBox; - if (editingElement == null) - { - return; - } - editingElement.Text = editingElement.Text.ToUpper(); - IndiceArquivoDigital item = (IndiceArquivoDigital)this.ArquivoGrid.Items[index]; - if (item.get_Descricao() == editingElement.Text) - { - return; - } - item.Initialize(); - item.set_Descricao(editingElement.Text); - this.ViewModel.Editar(item); - } - - private async void Assinar_OnClick(object sender, RoutedEventArgs e) - { - object obj; - Button button = (Button)sender; - this.AlteraEventoAssinarOnClick(button, false); - if (!this.ViewModel.Restricao(60)) - { - List produtos = LicenseHelper.Produtos; - if (!produtos.All((Licenca x) => x.get_Produto() != 86)) - { - await this.ViewModel.EnviarParaAssinatura(); - this.AlteraEventoAssinarOnClick(button, true); - } - else - { - Token token = new Token(); - object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Id(), null }; - obj = (ApplicationHelper.Beta ? "1" : "0"); - numeroSerial[3] = obj; - string str = token.Encrypt(string.Format("{0}:{1}:{2}:{3}", 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(str); - parameter.set_Run(true); - (new DownloadWindow(parameter)).Show(); - this.AlteraEventoAssinarOnClick(button, true); - } - } - else - { - await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ASSINATURA.", "OK", "", false); - this.AlteraEventoAssinarOnClick(button, true); - } - button = null; - } - - private void Baixar_OnClick(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - if (button == null) - { - return; - } - DataGrid dataGrid = Extentions.FindVisualAncestor(button); - IndiceArquivoDigital item = (IndiceArquivoDigital)dataGrid.Items[dataGrid.Items.IndexOf(button.DataContext)]; - this.ViewModel.Baixar(item, false); - } - - private async void BaixarTodos_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Activated = false; - if (await this.ViewModel.BaixarTodos()) - { - await this.ViewModel.ShowMessage("ARQUIVOS BAIXADOS COM SUCESSO!", "OK", "", false); - } - this.ViewModel.Activated = true; - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Toggle("", false))); - } - - private void ContentLoad() - { - this.ArquivoGrid.CellEditEnding += new EventHandler(this.ArquivoGrid_CellEditEnding); - this.DocumentoBox.LostFocus += new RoutedEventHandler(ArquivoDigitalDrawer.DocumentBox_OnLostFocus); - this.DocumentoBox.PreviewTextInput += new TextCompositionEventHandler(ArquivoDigitalDrawer.SomenteNumeros); - } - - private void CopiarLinkAssinatura_OnClick(object sender, RoutedEventArgs e) - { - IndiceArquivoDigital dataContext = (IndiceArquivoDigital)((Button)sender).DataContext; - if (dataContext == null || string.IsNullOrWhiteSpace(dataContext.get_UrlAssinatura())) - { - return; - } - dataContext.get_UrlAssinatura().CopyToClipboard(); - this.Toggle(string.Concat("LINK COPIADO - ", dataContext.get_UrlAssinatura()), true); - } - - private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - ClienteTelefone item = (ClienteTelefone)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - string.Concat(item.get_Prefixo(), item.get_Numero()).CopyToClipboard(); - this.Toggle(string.Concat("COPIADO - ", item.get_Prefixo(), ValidationHelper.OnlyNumber(item.get_Numero())), true); - } - - private async Task CreateWhatsappMessage(IndiceArquivoDigital indice) - { - string str; - string str1; - Uri uri = await this.ViewModel.CreateLink(indice); - StringBuilder stringBuilder = new StringBuilder(uri.ToString()); - if (indice.get_Assinado()) - { - str = ""; - } - else if (indice.get_EnviadoAssinatura()) - { - string[] newLine = new string[] { "LINK PARA ASSINATURA", Environment.NewLine, indice.get_UrlAssinatura(), Environment.NewLine, Environment.NewLine }; - str = string.Concat(newLine); - } - else - { - str = ""; - } - StringBuilder stringBuilder1 = new StringBuilder(str); - foreach (IndiceArquivoDigital arquivo in this.ViewModel.Arquivos) - { - if (arquivo.get_Selecionado() && arquivo.get_IdArquivoDigital() != indice.get_IdArquivoDigital()) - { - if (stringBuilder.Length > 0) - { - stringBuilder.AppendLine("\r\n"); - stringBuilder1.AppendLine(); - } - StringBuilder stringBuilder2 = stringBuilder; - uri = await this.ViewModel.CreateLink(arquivo); - stringBuilder2.AppendLine(uri.ToString()); - stringBuilder2 = null; - StringBuilder stringBuilder3 = stringBuilder1; - if (arquivo.get_Assinado()) - { - str1 = ""; - } - else if (arquivo.get_EnviadoAssinatura()) - { - string[] strArrays = new string[] { "LINK PARA ASSINATURA", Environment.NewLine, arquivo.get_UrlAssinatura(), Environment.NewLine, Environment.NewLine }; - str1 = string.Concat(strArrays); - } - else - { - str1 = ""; - } - stringBuilder3.AppendLine(str1); - } - } - string str2 = this.ViewModel.CarregarMensagem().Replace("[*LINK*]", string.Format("LINK(S) PARA BAIXAR O(S) DOCUMENTO(S) (VÁLIDO(S) POR 7 DIAS){0}{1}", Environment.NewLine, stringBuilder)).Replace("<|LINKASSINATURA|>", stringBuilder1.ToString()); - stringBuilder = null; - stringBuilder1 = null; - return str2; - } - - private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) - { - Chip chip = sender as Chip; - if (chip == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(chip); - Gestor.Model.Domain.Common.ArquivoDigital item = (Gestor.Model.Domain.Common.ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; - if (item == null) - { - return; - } - this.ViewModel.Delete(item); - } - - private static void DocumentBox_OnLostFocus(object sender, RoutedEventArgs e) - { - TextBox textBox = (TextBox)sender; - if (textBox.Text == string.Empty) - { - return; - } - textBox.Text = ValidationHelper.FormatDocument(textBox.Text); - } - - private async void Enviar_OnClick(object sender, RoutedEventArgs e) - { - object obj; - MenuItem menuItem = (MenuItem)sender; - this.AlteraEventoEnviarOnClick(menuItem, false); - if (!this.ViewModel.Restricao(60)) - { - ObservableCollection arquivosTela = this.ViewModel.ArquivosTela; - if (arquivosTela.Any((IndiceArquivoDigital x) => x.get_Assinar())) - { - List produtos = LicenseHelper.Produtos; - if (produtos.All((Licenca x) => x.get_Produto() != 86)) - { - Token token = new Token(); - object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Id(), null }; - obj = (ApplicationHelper.Beta ? "1" : "0"); - numeroSerial[3] = obj; - string str = token.Encrypt(string.Format("{0}:{1}:{2}:{3}", 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(str); - parameter.set_Run(true); - (new DownloadWindow(parameter)).Show(); - this.AlteraEventoEnviarOnClick(menuItem, true); - menuItem = null; - return; - } - else if (!await this.ViewModel.EnviarParaAssinatura()) - { - this.AlteraEventoEnviarOnClick(menuItem, true); - menuItem = null; - return; - } - } - } - else - { - await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ASSINATURA.\nCONTINUANDO COM O ENVIO APENAS.", "OK", "", false); - } - MalaDireta malaDiretum = await this.ViewModel.PrepararEnvio(); - if (malaDiretum != null) - { - if (Funcoes.IsWindowOpen("ENVIO DE E-MAIL")) - { - Funcoes.Destroy("ENVIO DE E-MAIL"); - } - List malaDiretas = new List() - { - malaDiretum - }; - (new HosterWindow(new MalaDiretaView(malaDiretas, this.ViewModel.Assunto, this.ViewModel.Corpo, this.Filtro), "ENVIO DE E-MAIL", new double?((double)1200), new double?((double)600), true)).Show(); - this.AlteraEventoEnviarOnClick(menuItem, true); - } - else - { - this.AlteraEventoEnviarOnClick(menuItem, true); - } - menuItem = null; - } - - private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e) - { - string str; - if (!this.ViewModel.Restricao(32)) - { - Button button = (Button)sender; - if (button.DataContext != null) - { - ClienteTelefone dataContext = button.DataContext as ClienteTelefone; - if (dataContext != null) - { - str = (!dataContext.get_Tipo().HasValue || dataContext.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", dataContext.get_Prefixo(), dataContext.get_Numero().Clear()) : string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).Clear()); - if (!str.EnviarWhatsapp(this.ViewModel.Anotacoes)) - { - 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 async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - IndiceArquivoDigital item; - Button button = sender as Button; - if (button != null) - { - DataGrid dataGrid = Extentions.FindVisualAncestor(button); - item = (IndiceArquivoDigital)dataGrid.Items[dataGrid.Items.IndexOf(button.DataContext)]; - if (item != null) - { - this.ViewModel.VerificarEnables(new long?(item.get_Id())); - if (!this.ViewModel.EnableExcluir) - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ARQUIVO DIGITAL DO TIPO ", ValidationHelper.GetDescription(this.Filtro.get_Tipo()), "!"), "OK", "", false); - } - else if (item.get_NaoExcluir()) - { - await this.ViewModel.ShowMessage(string.Concat("O ARQUIVO ", item.get_Descricao(), " NÃO PODE SER EXCLUÍDO!"), "OK", "", false); - } - else if (await this.ViewModel.ShowMessage(string.Concat("DESEJA REALMENTE EXCLUIR O ARQUIVO ", item.get_Descricao()), "SIM", "NÃO", false)) - { - await this.ViewModel.Excluir(item); - } - } - } - item = null; - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/arquivodigitaldrawer.xaml", UriKind.Relative)); - } - - private void LimparLista_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.LimparAnexos(); - } - - private void Log_OnClick(object sender, RoutedEventArgs e) - { - Button button = sender as Button; - if (button == null) - { - return; - } - IndiceArquivoDigital dataContext = (IndiceArquivoDigital)button.DataContext; - if (dataContext != null && dataContext.get_Id() != 0) - { - this.ViewModel.AbrirLog(6, dataContext.get_Id()); - } - } - - private async void PopupBox_OnOpened(object sender, RoutedEventArgs e) - { - if (this.ViewModel.Telefones.Count == 0) - { - ObservableCollection telefones = this.ViewModel.Telefones; - ClienteTelefone clienteTelefone = new ClienteTelefone(); - clienteTelefone.set_Prefixo(Recursos.Empresa.get_PrimeiroPrefixo()); - clienteTelefone.set_Numero(Recursos.Empresa.get_PrimeiroTelefone()); - telefones.Add(clienteTelefone); - } - IndiceArquivoDigital dataContext = (IndiceArquivoDigital)((PopupBox)sender).DataContext; - ArquivoDigitalViewModel viewModel = this.ViewModel; - viewModel.Anotacoes = await this.CreateWhatsappMessage(dataContext); - viewModel = null; - } - - private async void SalvarAnexos_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.SalvarAnexos(); - } - - public void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) - { - ScrollViewer scrollViewer = (ScrollViewer)sender; - scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - (double)e.Delta); - e.Handled = true; - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.SnackbarArquivoDigital.set_IsActive(false); - } - - private static void SomenteNumeros(object sender, TextCompositionEventArgs e) - { - Regex regex = new Regex("[^0-9]+"); - e.Handled = regex.IsMatch(e.Text); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((ScrollViewer)target).PreviewMouseWheel += new MouseWheelEventHandler(this.ScrollViewer_PreviewMouseWheel); - return; - } - case 2: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.TitleBox = (TextBlock)target; - return; - } - case 5: - case 6: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 21: - { - this._contentLoaded = true; - return; - } - case 7: - { - ((TextBox)target).TextChanged += new TextChangedEventHandler(this.TextBoxBase_OnTextChanged); - return; - } - case 8: - { - this.ArquivoGrid = (DataGrid)target; - return; - } - case 16: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick); - return; - } - case 17: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.BaixarTodos_OnClick); - return; - } - case 18: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Enviar_OnClick); - return; - } - case 19: - { - this.DocumentoBox = (TextBox)target; - return; - } - case 20: - { - ((Button)target).Click += new RoutedEventHandler(this.Assinar_OnClick); - return; - } - case 22: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarAnexos_OnClick); - return; - } - case 23: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.LimparLista_OnClick); - return; - } - case 24: - { - this.SnackbarArquivoDigital = (Snackbar)target; - return; - } - case 25: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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) - { - switch (connectionId) - { - case 5: - { - ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); - return; - } - case 6: - { - ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); - return; - } - case 7: - case 8: - case 16: - case 17: - case 18: - case 19: - case 20: - { - return; - } - case 9: - { - ((Button)target).Click += new RoutedEventHandler(this.CopiarLinkAssinatura_OnClick); - return; - } - case 10: - { - ((PopupBox)target).add_Opened(new RoutedEventHandler(this.PopupBox_OnOpened)); - return; - } - case 11: - { - ((Button)target).Click += new RoutedEventHandler(this.EnviarPorWhatsApp_OnClick); - return; - } - case 12: - { - ((Button)target).Click += new RoutedEventHandler(this.Abrir_OnClick); - return; - } - case 13: - { - ((Button)target).Click += new RoutedEventHandler(this.Baixar_OnClick); - return; - } - case 14: - { - ((Button)target).Click += new RoutedEventHandler(this.Log_OnClick); - return; - } - case 15: - { - ((Button)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 21: - { - ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick)); - return; - } - default: - { - return; - } - } - } - - private void TextBoxBase_OnTextChanged(object sender, TextChangedEventArgs e) - { - string text = ((TextBox)sender).Text; - if (text.Length < 3) - { - this.ViewModel.ArquivosTela = this.ViewModel.Arquivos; - return; - } - List list = ( - from x in this.ViewModel.Arquivos - where x.get_Descricao().Contains(text) - select x).ToList(); - if (list.Count <= 0) - { - this.ViewModel.ArquivosTela = new ObservableCollection(); - return; - } - this.ViewModel.ArquivosTela = new ObservableCollection(); - list.ForEach((IndiceArquivoDigital x) => this.ViewModel.ArquivosTela.Add(x)); - } - - public void Toggle(string message, bool active = true) - { - this.SnackbarArquivoDigital.get_Message().Content = message; - this.SnackbarArquivoDigital.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - - private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) - { - string str; - if (!this.ViewModel.Restricao(32)) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - ClienteTelefone item = (ClienteTelefone)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - str = (!item.get_Tipo().HasValue || item.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", item.get_Prefixo(), item.get_Numero().Clear()) : string.Concat(item.get_Prefixo(), item.get_Numero()).Clear()); - if (!str.EnviarWhatsapp(null)) - { - 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); - } - } - else - { - await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ESSE MENU.", "OK", "", false); - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Configuracoes/ConfiguracoesDrawer.cs b/Gestor.Application/Drawers/Configuracoes/ConfiguracoesDrawer.cs deleted file mode 100644 index 84a2223..0000000 --- a/Gestor.Application/Drawers/Configuracoes/ConfiguracoesDrawer.cs +++ /dev/null @@ -1,159 +0,0 @@ -using Gestor.Application.ViewModels.Configuracoes; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Domain.Configuracoes; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers.Configuracoes -{ - public class ConfiguracoesDrawer : UserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal DataGrid VendedorGrid; - - private bool _contentLoaded; - - private ConfiguracoesViewModel ViewModel - { - get; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ConfiguracoesDrawer() - { - this.ViewModel = new ConfiguracoesViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(50, (long)0); - } - - private async void AdicionarConfiguracao_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Carregando = true; - if (this.ViewModel.SelectedConfiguracao == 15 || this.ViewModel.SelectedConfiguracao == 26 || this.ViewModel.SelectedConfiguracao == 34 || this.ViewModel.SelectedConfiguracao == 53) - { - bool? nullable = await this.ViewModel.ShowSenha("OPÇÃO RESTRITA A ADMINISTRADORES DO SISTEMA, PREENCHA A SENHA ADM PARA PROSSEGUIR."); - if (!nullable.HasValue) - { - this.ViewModel.Carregando = false; - return; - } - else if (!nullable.GetValueOrDefault()) - { - await this.ViewModel.ShowMessage("SENHA INVÁLIDA", "OK", "", false); - this.ViewModel.Carregando = false; - return; - } - } - await this.ViewModel.Salvar(); - this.ViewModel.Carregando = false; - } - - private async void ContentLoad() - { - this.ViewModel.Carregando = true; - await this.ViewModel.BuscarConfiguracoes(); - this.ViewModel.Carregando = false; - } - - private async void ExcluirConfiguracao_OnClick(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - if (button != null && button.DataContext != null) - { - this.ViewModel.Carregando = true; - await this.ViewModel.Excluir((ConfiguracaoSistema)button.DataContext); - this.ViewModel.Carregando = false; - } - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/configuracoes/configuracoesdrawer.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 4: - { - ((Button)target).Click += new RoutedEventHandler(this.AdicionarConfiguracao_OnClick); - return; - } - case 5: - { - this.VendedorGrid = (DataGrid)target; - return; - } - } - this._contentLoaded = true; - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) - { - if (connectionId == 6) - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirConfiguracao_OnClick); - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ExpedicaoDrawer.cs b/Gestor.Application/Drawers/ExpedicaoDrawer.cs deleted file mode 100644 index 50ab8e8..0000000 --- a/Gestor.Application/Drawers/ExpedicaoDrawer.cs +++ /dev/null @@ -1,265 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class ExpedicaoDrawer : BaseUserControl, IComponentConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal TextBox DocumentoBox; - - internal TextBox DestinoBox; - - internal DatePicker EnvioBox; - - internal DatePicker RecebimentoBox; - - internal TextBox ResponsavelBox; - - internal DataGrid ExpedicaoGrid; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public ExpedicaoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ExpedicaoDrawer(Documento documento) - { - this.ViewModel = new ExpedicaoViewModel(documento); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private void ContentLoad() - { - this.EnvioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.EnvioBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.RecebimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.RecebimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - this.ToggleSnackBar("EXPEDIÇÃO EXCLUÍDA COM SUCESSO", true); - } - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - } - - [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/drawers/expedicaodrawer.xaml", UriKind.Relative)); - } - - private void Log_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(46, this.ViewModel.SelectedExpedicao.get_Id()); - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ExpedicaoGrid.Items.Refresh(); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("EXPEDIÇÃO SALVA COM SUCESSO", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Log_OnClick); - return; - } - case 9: - { - this.DocumentoBox = (TextBox)target; - return; - } - case 10: - { - this.DestinoBox = (TextBox)target; - return; - } - case 11: - { - this.EnvioBox = (DatePicker)target; - this.EnvioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.EnvioBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.EnvioBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 12: - { - this.RecebimentoBox = (DatePicker)target; - this.RecebimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.RecebimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); - this.RecebimentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 13: - { - this.ResponsavelBox = (TextBox)target; - return; - } - case 14: - { - this.ExpedicaoGrid = (DataGrid)target; - return; - } - case 15: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 16: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ExtratosDrawer.cs b/Gestor.Application/Drawers/ExtratosDrawer.cs deleted file mode 100644 index 890eaec..0000000 --- a/Gestor.Application/Drawers/ExtratosDrawer.cs +++ /dev/null @@ -1,281 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class ExtratosDrawer : BaseUserControl, IComponentConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal StackPanel Tipo; - - internal StackPanel Cliente; - - internal ToggleButton ClienteToggle; - - internal StackPanel Documento; - - internal StackPanel Endosso; - - internal StackPanel Item; - - internal StackPanel Perfil; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - private static List Clientes - { - get; - set; - } - - private static List Documentos - { - get; - set; - } - - private static List Prospeccoes - { - get; - set; - } - - private static List Selecionados - { - get; - set; - } - - private static List SelecionadosPros - { - get; - set; - } - - private static Relatorio? TipoRelatorio - { - get; - set; - } - - public ExtratosViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ExtratosDrawer(List clientes = null, List documentos = null, Relatorio? tipoRelatorio = null, List selecionados = null, List selecionadosPros = null, List prospeccaos = null) - { - ExtratosDrawer.Documentos = documentos; - ExtratosDrawer.Prospeccoes = prospeccaos; - ExtratosDrawer.Selecionados = selecionados; - ExtratosDrawer.Clientes = clientes; - ExtratosDrawer.TipoRelatorio = tipoRelatorio; - ExtratosDrawer.SelecionadosPros = selecionadosPros; - this.ViewModel = new ExtratosViewModel() - { - TipoDeRelatorio = tipoRelatorio - }; - if (!tipoRelatorio.HasValue) - { - this.ViewModel.TipoExtratoEnabled = true; - this.ViewModel.ClientePorPaginaVisibility = System.Windows.Visibility.Collapsed; - } - else - { - switch (tipoRelatorio.GetValueOrDefault()) - { - case 0: - { - this.ViewModel.TipoExtratoEnabled = false; - this.ViewModel.SelectedTipoExtrato = 0; - this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; - break; - } - case 1: - case 3: - { - this.ViewModel.SelectedTipoExtrato = 1; - this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; - this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; - break; - } - case 2: - case 4: - { - this.ViewModel.TipoExtratoEnabled = false; - this.ViewModel.SelectedTipoExtrato = 1; - this.ViewModel.ClientePorPaginaVisibility = System.Windows.Visibility.Visible; - this.ViewModel.SelecionarItensVisibility = System.Windows.Visibility.Collapsed; - break; - } - default: - { - goto case 3; - } - } - } - if (this.ViewModel.SelectedTipoExtrato == null) - { - this.ViewModel.EsconderResumido = true; - this.ViewModel.ClienteVisibility = true; - } - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private async void Gerar_OnClick(object sender, RoutedEventArgs e) - { - if (ExtratosDrawer.Clientes != null) - { - await this.ViewModel.PrepararExtrato(ExtratosDrawer.Clientes, null, null, ExtratosDrawer.TipoRelatorio, null, null, false); - } - else if (ExtratosDrawer.Documentos != null || ExtratosDrawer.Prospeccoes != null) - { - await this.ViewModel.PrepararExtrato(null, ExtratosDrawer.Documentos, ExtratosDrawer.Prospeccoes, ExtratosDrawer.TipoRelatorio, ExtratosDrawer.Selecionados, ExtratosDrawer.SelecionadosPros, false); - } - } - - private async void GerarPDF_OnClick(object sender, RoutedEventArgs e) - { - if (ExtratosDrawer.Clientes != null) - { - await this.ViewModel.PrepararExtrato(ExtratosDrawer.Clientes, null, null, ExtratosDrawer.TipoRelatorio, null, null, true); - } - else if (ExtratosDrawer.Documentos != null || ExtratosDrawer.Prospeccoes != null) - { - await this.ViewModel.PrepararExtrato(null, ExtratosDrawer.Documentos, ExtratosDrawer.Prospeccoes, ExtratosDrawer.TipoRelatorio, ExtratosDrawer.Selecionados, ExtratosDrawer.SelecionadosPros, true); - } - } - - [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/drawers/extratosdrawer.xaml", UriKind.Relative)); - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((ScrollViewer)target).PreviewMouseWheel += new MouseWheelEventHandler(this.ScrollViewer_PreviewMouseWheel); - return; - } - case 2: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.Tipo = (StackPanel)target; - return; - } - case 5: - { - this.Cliente = (StackPanel)target; - return; - } - case 6: - { - this.ClienteToggle = (ToggleButton)target; - return; - } - case 7: - { - this.Documento = (StackPanel)target; - return; - } - case 8: - { - this.Endosso = (StackPanel)target; - return; - } - case 9: - { - this.Item = (StackPanel)target; - return; - } - case 10: - { - this.Perfil = (StackPanel)target; - return; - } - case 11: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Gerar_OnClick); - return; - } - case 12: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.GerarPDF_OnClick); - return; - } - case 13: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 14: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ImpostoDrawer.cs b/Gestor.Application/Drawers/ImpostoDrawer.cs deleted file mode 100644 index 648e160..0000000 --- a/Gestor.Application/Drawers/ImpostoDrawer.cs +++ /dev/null @@ -1,296 +0,0 @@ -using Gestor.Application; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Domain.Generic; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class ImpostoDrawer : UserControl, IComponentConnector - { - private readonly int _tipo; - - private readonly long _id; - - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal TextBlock TitleBox; - - internal ComboBox SeguradoraBox; - - internal ComboBox SeguradoraAlternativaBox; - - internal ComboBox RamoBox; - - internal DataGrid ArquivoGrid; - - internal Snackbar SnackbarImposto; - - private bool _contentLoaded; - - public ImpostoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ImpostoDrawer(int tipo, long id) - { - this._tipo = tipo; - this._id = id; - this.ViewModel = new ImpostoViewModel(); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AlterarImposto(); - } - - private async void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Cancelar(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Toggle("", false))); - } - - private async void ContentLoad() - { - this.ViewModel.Carregando = true; - await this.ViewModel.Carregar(this._tipo, this._id); - this.SeguradoraBox.SelectionChanged += new SelectionChangedEventHandler(this.Indice_OnSelectionChanged); - this.SeguradoraAlternativaBox.SelectionChanged += new SelectionChangedEventHandler(this.Indice_OnSelectionChanged); - this.RamoBox.SelectionChanged += new SelectionChangedEventHandler(this.Indice_OnSelectionChanged); - this.ViewModel.Carregando = false; - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - } - - private async void Indice_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (!this.ViewModel.Carregando) - { - this.ViewModel.Carregando = true; - await this.ViewModel.Carregar((long)0); - this.ViewModel.Carregando = false; - } - } - - [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/drawers/impostodrawer.xaml", UriKind.Relative)); - } - - private void Log_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(56, this.ViewModel.SelectedImposto.get_Id()); - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.Toggle("PARÂMETRO SALVO COM SUCESSO.", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.SnackbarImposto.set_IsActive(false); - } - - private async void Status_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - bool? nullable; - string str; - ListBox listBox = (ListBox)sender; - if (listBox.SelectedItem != null) - { - ImpostoViewModel viewModel = this.ViewModel; - if (listBox.SelectedIndex == 0) - { - nullable = new bool?(true); - } - else if (listBox.SelectedIndex == 1) - { - nullable = new bool?(false); - } - else - { - nullable = null; - } - viewModel.Ativo = nullable; - TextBlock titleBox = this.TitleBox; - if (listBox.SelectedIndex == 0) - { - str = "IMPOSTOS ATIVOS"; - } - else - { - str = (listBox.SelectedIndex == 1 ? "IMPOSTOS INATIVOS" : "TODOS IMPOSTOS"); - } - titleBox.Text = str; - await this.ViewModel.Carregar((long)0); - } - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((ListBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Status_OnSelectionChanged); - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.TitleBox = (TextBlock)target; - return; - } - case 5: - { - this.SeguradoraBox = (ComboBox)target; - return; - } - case 6: - { - this.SeguradoraAlternativaBox = (ComboBox)target; - return; - } - case 7: - { - this.RamoBox = (ComboBox)target; - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 11: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 12: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Log_OnClick); - return; - } - case 13: - { - this.ArquivoGrid = (DataGrid)target; - return; - } - case 14: - { - this.SnackbarImposto = (Snackbar)target; - return; - } - case 15: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - - public void Toggle(string message, bool active = true) - { - this.SnackbarImposto.get_Message().Content = message; - this.SnackbarImposto.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs b/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs deleted file mode 100644 index e8013e2..0000000 --- a/Gestor.Application/Drawers/InclusaoArquivoDigitalDrawer.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Gestor.Application; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using System.Windows.Threading; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Drawers -{ - public class InclusaoArquivoDigitalDrawer : UserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal Snackbar SnackbarArquivoDigital; - - private bool _contentLoaded; - - public TarefaDrawerViewModel ViewModel - { - get; - set; - } - - public InclusaoArquivoDigitalDrawer(TarefaDrawerViewModel viewModel) - { - this.ViewModel = viewModel; - base.DataContext = this.ViewModel; - this.InitializeComponent(); - this.ViewModel.RegistrarAcao("ACESSOU ANEXO ARQUIVO DIGITAL", (long)0, new TipoTela?(6), null); - } - - private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Anexar(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Toggle("", false))); - } - - private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) - { - Chip chip = sender as Chip; - if (chip == null) - { - return; - } - ListBox listBox = Extentions.FindVisualAncestor(chip); - ArquivoDigital item = (ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; - if (item == null) - { - return; - } - this.ViewModel.Delete(item); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/inclusaoarquivodigitaldrawer.xaml", UriKind.Relative)); - } - - private void LimparLista_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.LimparAnexos(); - } - - private void SalvarAnexos_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.SalvarAnexos(); - this.ViewModel.CloseDrawer(); - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.SnackbarArquivoDigital.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick); - return; - } - case 4: - { - this._contentLoaded = true; - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarAnexos_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.LimparLista_OnClick); - return; - } - case 7: - { - this.SnackbarArquivoDigital = (Snackbar)target; - return; - } - case 8: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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 == 4) - { - ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick)); - } - } - - public void Toggle(string message, bool active = true) - { - this.SnackbarArquivoDigital.get_Message().Content = message; - this.SnackbarArquivoDigital.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/InfoDrawer.cs b/Gestor.Application/Drawers/InfoDrawer.cs deleted file mode 100644 index f21deb5..0000000 --- a/Gestor.Application/Drawers/InfoDrawer.cs +++ /dev/null @@ -1,219 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Drawers -{ - public class InfoDrawer : BaseUserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal DataGrid ParcelaGrid; - - internal DataGridTextColumn ParcelasValorColumn; - - internal DataGridTextColumn ParcelasRealizadoColumn; - - internal DataGridTextColumn ParcelasComissaoColumn; - - internal DataGridTextColumn ParcelasReciboColumn; - - internal DataGrid ItemGrid; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public InfoViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public InfoDrawer(Documento documento, bool ocultarInfos = false) - { - long? nullable; - string str; - this.ViewModel = new InfoViewModel(documento, ocultarInfos); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - InfoViewModel viewModel = this.ViewModel; - if ((documento != null ? documento.get_Id() != (long)0 : true)) - { - if (documento != null) - { - nullable = new long?(documento.get_Id()); - } - else - { - nullable = null; - } - str = string.Format(" DO DOCUMENTO DE ID \"{0}\"", nullable); - } - else - { - str = ""; - } - viewModel.RegistrarAcao(string.Concat("ACESSOU INFORMAÇÕES", str), (documento != null ? documento.get_Id() : (long)0), new TipoTela?(2), this.ViewModel.GerarObs(documento)); - } - - private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - Contato item = (Contato)listBox.Items[listBox.Items.IndexOf(button.DataContext)]; - item.get_Numero().CopyToClipboard(); - this.ViewModel.ToggleSnackBar(string.Concat("COPIADO - ", item.get_Numero()), true); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/infodrawer.xaml", UriKind.Relative)); - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - case 4: - { - this._contentLoaded = true; - return; - } - case 5: - { - this.ParcelaGrid = (DataGrid)target; - return; - } - case 6: - { - this.ParcelasValorColumn = (DataGridTextColumn)target; - return; - } - case 7: - { - this.ParcelasRealizadoColumn = (DataGridTextColumn)target; - return; - } - case 8: - { - this.ParcelasComissaoColumn = (DataGridTextColumn)target; - return; - } - case 9: - { - this.ParcelasReciboColumn = (DataGridTextColumn)target; - return; - } - case 10: - { - this.ItemGrid = (DataGrid)target; - return; - } - case 11: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 12: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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 == 3) - { - ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); - return; - } - if (connectionId != 4) - { - return; - } - ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); - } - - private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Restricao(32)) - { - Button button = (Button)sender; - ListBox listBox = Extentions.FindVisualAncestor(button); - if (!string.Concat("55", ((Contato)listBox.Items[listBox.Items.IndexOf(button.DataContext)]).get_Numero().Clear()).EnviarWhatsapp(null)) - { - 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); - } - } - else - { - await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP", "OK", "", false); - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/LogDrawer.cs b/Gestor.Application/Drawers/LogDrawer.cs deleted file mode 100644 index 5e1cec9..0000000 --- a/Gestor.Application/Drawers/LogDrawer.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Assinador.Infrastructure.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Common; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class LogDrawer : BaseUserControl, IComponentConnector - { - private bool _contentLoaded; - - public LogViewModel ViewModel - { - get; - set; - } - - public LogDrawer(TipoTela tela, long id, List parcelas = null, int numParcela = 0) - { - this.ViewModel = new LogViewModel(tela, id, parcelas, numParcela); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - string description = Functions.GetDescription(tela); - this.ViewModel.RegistrarAcao(string.Format("ACESSOU LOG DE ALTERAÇÕES DE {0} DO ID \"{1}\"", description, id), id, new TipoTela?(tela), string.Format("ID ENTIDADE: {0}\nTIPO: {1}", id, description)); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Imprimir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Imprimir(); - } - - [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/drawers/logdrawer.xaml", UriKind.Relative)); - } - - private void MostrarCampos_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.MostrarCampos(); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Imprimir_OnClick); - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.MostrarCampos_OnClick); - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/LogEmailDrawer.cs b/Gestor.Application/Drawers/LogEmailDrawer.cs deleted file mode 100644 index 5dd6981..0000000 --- a/Gestor.Application/Drawers/LogEmailDrawer.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Assinador.Infrastructure.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Common; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class LogEmailDrawer : BaseUserControl, IComponentConnector - { - private bool _contentLoaded; - - public LogEmailViewModel ViewModel - { - get; - set; - } - - public LogEmailDrawer(TipoTela tela, long id, bool singleMode = false) - { - this.ViewModel = new LogEmailViewModel(tela, id, singleMode); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - this.ViewModel.RegistrarAcao(string.Format("ACESSOU LOG DE E-MAIL DE {0} DO ID \"{1}\"", Functions.GetDescription(tela), id), id, new TipoTela?(tela), string.Format("ID ENTIDADE: {0}\nTIPO: {1}", id, Functions.GetDescription(tela))); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Imprimir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Imprimir(); - } - - [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/drawers/logemaildrawer.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId == 1) - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - if (connectionId != 2) - { - this._contentLoaded = true; - return; - } - ((Button)target).Click += new RoutedEventHandler(this.Imprimir_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/LogSistemaAntigo.cs b/Gestor.Application/Drawers/LogSistemaAntigo.cs deleted file mode 100644 index 051493e..0000000 --- a/Gestor.Application/Drawers/LogSistemaAntigo.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class LogSistemaAntigo : UserControl, IComponentConnector - { - private readonly LogSistemaAntigoViewModel _viewModel; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public LogSistemaAntigo(long id, string log) - { - this._viewModel = new LogSistemaAntigoViewModel(); - base.DataContext = this._viewModel; - this.InitializeComponent(); - this._viewModel.Descricao = string.Format("LOG DO DOCUMENTO {0}", id); - this._viewModel.Log = log; - this._viewModel.RegistrarAcao(string.Format("ACESSOU LOG DO SISTEMA ANTIGO DO ID \"{0}\"", id), id, new TipoTela?(2), string.Format("ID ENTIDADE: {0}", id)); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this._viewModel.CloseDrawer(); - } - - [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/drawers/logsistemaantigo.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId != 1) - { - this._contentLoaded = true; - return; - } - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/LogUtilizacaoDrawer.cs b/Gestor.Application/Drawers/LogUtilizacaoDrawer.cs deleted file mode 100644 index 6fc62db..0000000 --- a/Gestor.Application/Drawers/LogUtilizacaoDrawer.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class LogUtilizacaoDrawer : UserControl, IComponentConnector - { - private readonly LogAcaoViewModel _viewModel; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public LogUtilizacaoDrawer(RegistroAcao registro, Relatorio relatorio) - { - this._viewModel = new LogAcaoViewModel(registro, relatorio); - base.DataContext = this._viewModel; - this.InitializeComponent(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this._viewModel.CloseDrawer(); - } - - [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/drawers/logutilizacaodrawer.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId != 1) - { - this._contentLoaded = true; - return; - } - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/MetaSeguradoraView.cs b/Gestor.Application/Drawers/MetaSeguradoraView.cs deleted file mode 100644 index b8e8a21..0000000 --- a/Gestor.Application/Drawers/MetaSeguradoraView.cs +++ /dev/null @@ -1,224 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class MetaSeguradoraView : BaseUserControl, IComponentConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal CustomItemValidation FaturaField; - - internal DataGrid MetasGrid; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public MetaSeguradoraViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public MetaSeguradoraView(Seguradora seguradora) - { - this.ViewModel = new MetaSeguradoraViewModel(seguradora); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - this.ViewModel.RegistrarAcao(string.Concat("ACESSOU METAS DE VENDA DA SEGURADORA \"", seguradora.get_Nome(), "\""), seguradora.get_Id(), new TipoTela?(31), string.Format("ID: {0}", seguradora.get_Id())); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - this.ToggleSnackBar("META DE VENDA EXCLUÍDA COM SUCESSO", true); - } - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - } - - [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/drawers/metaseguradoraview.xaml", UriKind.Relative)); - } - - private void Log_OnClick(object sender, RoutedEventArgs e) - { - if (this.ViewModel.SelectedMetaSeguradora != null) - { - this.ViewModel.AbrirLog(31, this.ViewModel.SelectedMetaSeguradora.get_Id()); - } - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.MetasGrid.Items.Refresh(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("META DE VENDA SALVA COM SUCESSO", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Log_OnClick); - return; - } - case 9: - { - this.FaturaField = (CustomItemValidation)target; - return; - } - case 10: - { - this.MetasGrid = (DataGrid)target; - return; - } - case 11: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 12: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/MetaVendedorView.cs b/Gestor.Application/Drawers/MetaVendedorView.cs deleted file mode 100644 index da25374..0000000 --- a/Gestor.Application/Drawers/MetaVendedorView.cs +++ /dev/null @@ -1,226 +0,0 @@ -using CurrencyTextBoxControl; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class MetaVendedorView : BaseUserControl, IComponentConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal CurrencyTextBox ValorMetaBox; - - internal TextBox AnoBox; - - internal DataGrid MetasGrid; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public MetaVendedorViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public MetaVendedorView(Vendedor vendedor) - { - this.ViewModel = new MetaVendedorViewModel(vendedor); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CancelarAlteracao(); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private async void Excluir_OnClick(object sender, RoutedEventArgs e) - { - if (await this.ViewModel.Excluir()) - { - this.ToggleSnackBar("META DE VENDA EXCLUÍDA COM SUCESSO", true); - } - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Incluir_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Incluir(); - } - - [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/drawers/metavendedorview.xaml", UriKind.Relative)); - } - - private void Log_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(30, this.ViewModel.SelectedMetaVendedor.get_Id()); - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - List> keyValuePairs = await this.ViewModel.Salvar(); - this.MetasGrid.Items.Refresh(); - this.ValidateFields(keyValuePairs, true); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("META DE VENDA SALVA COM SUCESSO", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); - return; - } - case 4: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Log_OnClick); - return; - } - case 9: - { - this.ValorMetaBox = (CurrencyTextBox)target; - return; - } - case 10: - { - this.AnoBox = (TextBox)target; - return; - } - case 11: - { - this.MetasGrid = (DataGrid)target; - return; - } - case 12: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 13: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - } - this._contentLoaded = true; - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ObservacoesDrawer.cs b/Gestor.Application/Drawers/ObservacoesDrawer.cs deleted file mode 100644 index 7c47563..0000000 --- a/Gestor.Application/Drawers/ObservacoesDrawer.cs +++ /dev/null @@ -1,265 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.Servicos.Generic; -using Gestor.Application.Servicos.Seguros; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class ObservacoesDrawer : UserControl, IComponentConnector - { - private readonly BaseSegurosViewModel _viewModel; - - private readonly long _id; - - private TipoTela _tipo; - - private ApoliceServico _apoliceServico; - - private ParcelaServico _parcelaServico; - - private ClienteServico _clienteServico; - - internal Grid GridMainObservacao; - - internal TextBlock Observacaotxt; - - internal TextBox ObservacaoBox; - - private bool _contentLoaded; - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ObservacoesDrawer(long id, TipoTela tipo) - { - this._apoliceServico = new ApoliceServico(); - this._parcelaServico = new ParcelaServico(); - this._clienteServico = new ClienteServico(); - this._viewModel = new BaseSegurosViewModel(); - base.DataContext = this._viewModel; - this.InitializeComponent(); - this._id = id; - this._tipo = tipo; - double windowHeight = this._viewModel.GetWindowHeight(); - this.GridMainObservacao.Height = windowHeight; - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this._viewModel.Alterar(true); - } - - private void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - this._viewModel.Alterar(false); - this._viewModel.Anotacoes = string.Empty; - } - - private async void ContentLoad() - { - await this.LoadObservacao(this._id, this._tipo, false); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this._viewModel.CloseDrawer(); - } - - [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/drawers/observacoesdrawer.xaml", UriKind.Relative)); - } - - private async Task LoadObservacao(long id, TipoTela tipo, bool salvar) - { - string str; - TextBox observacaoBox; - object[] nome = new object[] { Recursos.Usuario.get_Nome(), Recursos.Usuario.get_Id(), Funcoes.GetNetworkTime(), Environment.NewLine, this._viewModel.Anotacoes, Environment.NewLine, Environment.NewLine, this.ObservacaoBox.Text }; - string str1 = string.Format("{0}, ID: {1}, {2:g}{3}{4}{5}{6}{7}", nome); - this._viewModel.VerificarEnables(new long?(id)); - switch (tipo) - { - case 1: - { - this.Observacaotxt.Text = "OBSERVAÇÃO CLIENTE"; - if (salvar) - { - observacaoBox = this.ObservacaoBox; - str = await this._clienteServico.SalvarObservacoes(this._id, str1); - observacaoBox.Text = str; - observacaoBox = null; - if (!this._clienteServico.Sucesso) - { - goto case 4; - } - this.ObservacaoBox.Text = str1; - goto case 4; - } - else - { - observacaoBox = this.ObservacaoBox; - Cliente cliente = await this._clienteServico.BuscarClienteAsync(id); - observacaoBox.Text = cliente.get_Observacao(); - observacaoBox = null; - goto case 4; - } - } - case 2: - { - this.Observacaotxt.Text = "OBSERVAÇÃO APÓLICE"; - if (salvar) - { - str1 = await this._apoliceServico.Save(this._id, str1); - if (!this._apoliceServico.Sucesso) - { - goto case 4; - } - this.ObservacaoBox.Text = str1; - goto case 4; - } - else - { - observacaoBox = this.ObservacaoBox; - Documento documento = await this._apoliceServico.BuscarApoliceAsync(id, false, false); - observacaoBox.Text = documento.get_Observacao(); - observacaoBox = null; - goto case 4; - } - } - case 3: - case 4: - { - break; - } - case 5: - { - this.Observacaotxt.Text = "OBSERVAÇÃO PARCELA"; - if (salvar) - { - observacaoBox = this.ObservacaoBox; - str = await this._parcelaServico.SalvarObservacoes(this._id, str1); - observacaoBox.Text = str; - observacaoBox = null; - if (!this._parcelaServico.Sucesso) - { - goto case 4; - } - this.ObservacaoBox.Text = str1; - goto case 4; - } - else - { - observacaoBox = this.ObservacaoBox; - Parcela parcela = await this._parcelaServico.BuscarParcela(id); - observacaoBox.Text = parcela.get_Observacao(); - observacaoBox = null; - goto case 4; - } - } - default: - { - goto case 4; - } - } - str1 = null; - } - - private async void ObservacoesDrawer_OnLoaded(object sender, RoutedEventArgs e) - { - await this._viewModel.PermissaoTela(2); - this._viewModel.Alterar(false); - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(this._viewModel.Anotacoes)) - { - await this.LoadObservacao(this._id, this._tipo, true); - this._viewModel.Anotacoes = string.Empty; - this._viewModel.Alterar(false); - } - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((ObservacoesDrawer)target).Loaded += new RoutedEventHandler(this.ObservacoesDrawer_OnLoaded); - return; - } - case 2: - { - this.GridMainObservacao = (Grid)target; - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.Observacaotxt = (TextBlock)target; - return; - } - case 5: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 8: - { - this.ObservacaoBox = (TextBox)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/PermissaoUsuarioDrawer.cs b/Gestor.Application/Drawers/PermissaoUsuarioDrawer.cs deleted file mode 100644 index 859aa9d..0000000 --- a/Gestor.Application/Drawers/PermissaoUsuarioDrawer.cs +++ /dev/null @@ -1,672 +0,0 @@ -using Gestor.Application.Actions; -using Gestor.Application.Helpers; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers -{ - public class PermissaoUsuarioDrawer : BaseUserControl, IComponentConnector, IStyleConnector - { - public PermissaoUsuarioViewModel ViewModel; - - private bool _filtrado; - - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal ToggleButton AtivoBox; - - internal ScrollViewer ScrollPermissoes; - - internal MenuItem DesativarPermissoes; - - internal MenuItem AtivarPermissoes; - - internal MenuItem MaisOpcoesButton; - - internal DataGrid SegurosGrid; - - internal DataGrid FerramentasGrid; - - internal DataGrid ArquivoDigitalGrid; - - internal MenuItem AtivarRestricoes; - - internal MenuItem DesativarRestricoes; - - internal DataGrid RestricoesBiGrid; - - internal DataGrid RestricoesSegurosGrid; - - internal DataGrid RestricoesRelatoriosGrid; - - internal DataGrid RestricoesCamposRelatoriosGrid; - - internal DataGrid RestricoesTotalizacoesRelatoriosGrid; - - internal DataGrid RestricoesFinanceiroGrid; - - internal DataGrid RestricoesFerramentasGrid; - - internal DataGrid RestricoesAjudaGrid; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - public PermissaoUsuarioDrawer(Usuario usuario) - { - this.ViewModel = new PermissaoUsuarioViewModel(usuario); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - Gestor.Application.Actions.Actions.OcultarTogglesSeguros = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesSeguros, new Action(this.OcultarTogglesSeguros)); - Gestor.Application.Actions.Actions.OcultarTogglesFerramentas = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesFerramentas, new Action(this.OcultarTogglesFerramentas)); - Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital, new Action(PermissaoUsuarioDrawer.OcultarTogglesArquivoDigital)); - } - - private async Task AbrirCopiarPermiss() - { - Tuple, Usuario, List, List, List> tuple; - do - { - tuple = await this.ViewModel.ShowCopiarPermissaoDialog(); - if (tuple != null) - { - continue; - } - return; - } - while (!this.ViewModel.CopiarPermissoes(tuple)); - this.SegurosGrid.Items.Refresh(); - this.FerramentasGrid.Items.Refresh(); - this.ArquivoDigitalGrid.Items.Refresh(); - this.RestricoesBiGrid.Items.Refresh(); - this.RestricoesSegurosGrid.Items.Refresh(); - this.RestricoesFinanceiroGrid.Items.Refresh(); - this.RestricoesFerramentasGrid.Items.Refresh(); - this.RestricoesRelatoriosGrid.Items.Refresh(); - this.RestricoesTotalizacoesRelatoriosGrid.Items.Refresh(); - this.RestricoesCamposRelatoriosGrid.Items.Refresh(); - this.FerramentasGrid.EsconderToggles(18, TipoToggle.Incluir | TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(10, TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(12, TipoToggle.Incluir | TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(13, TipoToggle.Incluir | TipoToggle.Excluir); - this.SegurosGrid.EsconderToggles(21, TipoToggle.Incluir | TipoToggle.Alterar | TipoToggle.Excluir); - this.SegurosGrid.EsconderToggles(5, TipoToggle.Consultar); - } - - private async Task AbrirExportarPermiss() - { - bool flag; - do - { - List usuarios = await this.ViewModel.ShowExportarPermissaoDialog(this.ViewModel.SelectedUsuario.get_Id()); - if (usuarios != null) - { - this.ViewModel.Carregando = true; - flag = await this.ViewModel.ExportarPermissoes(usuarios); - this.ViewModel.Carregando = false; - } - else - { - return; - } - } - while (!flag); - this.ToggleSnackBar("PERMISSÕES/RESTRIÇÕES EXPORTADAS COM SUCESSO.", true); - } - - private void AbrirLogPermissoes_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(43, this.ViewModel.SelectedUsuario.get_Id()); - } - - private void AtivarDesativarPermissoes_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AtivarDesativarPermissoes(this.ViewModel.AtivarDesativarPermissoesBool); - } - - private void AtivarDesativarRestricoes_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AtivarDesativarRestricoes(this.ViewModel.AtivarDesativarRestricoesBool); - } - - private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) - { - if (((AutoCompleteBox)sender).get_Text().Length >= 3 || !this._filtrado) - { - return; - } - this._filtrado = false; - this.ViewModel.FiltrarRestricoesBis(""); - this.ViewModel.FiltrarRestricoesSeguros(""); - this.ViewModel.FiltrarRestricoesRelatorios(""); - this.ViewModel.FiltrarRestricoesTotalizacoesRelatorios(""); - this.ViewModel.FiltrarRestricoesCamposRelatorios(""); - this.ViewModel.FiltrarRestricoesFinanceiros(""); - this.ViewModel.FiltrarRestricoesFerramentas(""); - this.ViewModel.FiltrarRestricoesAjudas(""); - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Length < 3) - { - return; - } - this._filtrado = true; - e.set_Cancel(true); - this.ViewModel.FiltrarRestricoesBi(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesSeguro(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesRelatorio(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesTotalizacoesRelatorio(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesCamposRelatorio(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesFinanceiro(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesFerramenta(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - this.ViewModel.FiltrarRestricoesAjuda(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private async void CopiarUsuario_OnClick(object sender, RoutedEventArgs e) - { - await this.AbrirCopiarPermiss(); - } - - private async void ExportarUsuario_OnClick(object sender, RoutedEventArgs e) - { - await this.AbrirExportarPermiss(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - Action atualizaUsuario = Gestor.Application.Actions.Actions.AtualizaUsuario; - if (atualizaUsuario != null) - { - atualizaUsuario(); - } - else - { - } - this.ViewModel.CloseDrawer(); - } - - [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/drawers/permissaousuariodrawer.xaml", UriKind.Relative)); - } - - private static void OcultarTogglesArquivoDigital() - { - } - - private void OcultarTogglesFerramentas() - { - this.FerramentasGrid.EsconderToggles(18, TipoToggle.Incluir | TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(10, TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(12, TipoToggle.Incluir | TipoToggle.Excluir); - this.FerramentasGrid.EsconderToggles(13, TipoToggle.Excluir); - } - - private void OcultarTogglesSeguros() - { - this.SegurosGrid.EsconderToggles(21, TipoToggle.Incluir | TipoToggle.Alterar | TipoToggle.Excluir); - this.SegurosGrid.EsconderToggles(5, TipoToggle.Consultar); - } - - private void PermissoesGrid_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e) - { - this.ScrollPermissoes.ScrollToVerticalOffset(this.ScrollPermissoes.VerticalOffset - (double)e.Delta); - } - - private async void SalvarPermissoes_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Carregando = true; - if (await this.ViewModel.Salvar(null, true)) - { - this.ToggleSnackBar("PERMISSÕES/RESTRIÇÕES SALVAS COM SUCESSO.", true); - } - this.ViewModel.Carregando = false; - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 3: - { - this.AtivoBox = (ToggleButton)target; - return; - } - case 4: - { - this.ScrollPermissoes = (ScrollViewer)target; - return; - } - case 5: - { - this.DesativarPermissoes = (MenuItem)target; - this.DesativarPermissoes.Click += new RoutedEventHandler(this.AtivarDesativarPermissoes_OnClick); - return; - } - case 6: - { - this.AtivarPermissoes = (MenuItem)target; - this.AtivarPermissoes.Click += new RoutedEventHandler(this.AtivarDesativarPermissoes_OnClick); - return; - } - case 7: - { - this.MaisOpcoesButton = (MenuItem)target; - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogPermissoes_OnClick); - return; - } - case 9: - { - this.SegurosGrid = (DataGrid)target; - this.SegurosGrid.PreviewMouseWheel += new MouseWheelEventHandler(this.PermissoesGrid_OnPreviewMouseWheel); - return; - } - case 10: - case 11: - case 12: - case 13: - case 15: - case 16: - case 17: - case 18: - case 20: - case 21: - case 22: - { - this._contentLoaded = true; - return; - } - case 14: - { - this.FerramentasGrid = (DataGrid)target; - this.FerramentasGrid.PreviewMouseWheel += new MouseWheelEventHandler(this.PermissoesGrid_OnPreviewMouseWheel); - return; - } - case 19: - { - this.ArquivoDigitalGrid = (DataGrid)target; - this.ArquivoDigitalGrid.PreviewMouseWheel += new MouseWheelEventHandler(this.PermissoesGrid_OnPreviewMouseWheel); - return; - } - case 23: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, PermissaoUsuarioDrawer.AutoCompleteBox_Populating)); - ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged)); - return; - } - case 24: - { - this.AtivarRestricoes = (MenuItem)target; - this.AtivarRestricoes.Click += new RoutedEventHandler(this.AtivarDesativarRestricoes_OnClick); - return; - } - case 25: - { - this.DesativarRestricoes = (MenuItem)target; - this.DesativarRestricoes.Click += new RoutedEventHandler(this.AtivarDesativarRestricoes_OnClick); - return; - } - case 26: - { - this.RestricoesBiGrid = (DataGrid)target; - return; - } - case 27: - { - this.RestricoesSegurosGrid = (DataGrid)target; - return; - } - case 28: - { - this.RestricoesRelatoriosGrid = (DataGrid)target; - return; - } - case 29: - { - this.RestricoesCamposRelatoriosGrid = (DataGrid)target; - this.RestricoesCamposRelatoriosGrid.PreviewMouseWheel += new MouseWheelEventHandler(this.PermissoesGrid_OnPreviewMouseWheel); - return; - } - case 30: - { - this.RestricoesTotalizacoesRelatoriosGrid = (DataGrid)target; - return; - } - case 31: - { - this.RestricoesFinanceiroGrid = (DataGrid)target; - return; - } - case 32: - { - this.RestricoesFerramentasGrid = (DataGrid)target; - return; - } - case 33: - { - this.RestricoesAjudaGrid = (DataGrid)target; - return; - } - case 34: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 35: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - return; - } - case 36: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarPermissoes_OnClick); - return; - } - case 37: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.CopiarUsuario_OnClick); - return; - } - case 38: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.ExportarUsuario_OnClick); - 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) - { - EventSetter eventSetter; - switch (connectionId) - { - case 10: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.UncheckedEvent, - Handler = new RoutedEventHandler(this.UnToggleSeguros_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 11: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleSeguros_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 12: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleSeguros_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 13: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleSeguros_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 14: - case 19: - { - return; - } - case 15: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.UncheckedEvent, - Handler = new RoutedEventHandler(this.UnToggleFerramentas_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 16: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleFerramentas_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 17: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleFerramentas_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 18: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleFerramentas_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 20: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.UncheckedEvent, - Handler = new RoutedEventHandler(this.UnToggleArquivosDigitais_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 21: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleArquivosDigitais_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - case 22: - { - eventSetter = new EventSetter() - { - Event = ToggleButton.CheckedEvent, - Handler = new RoutedEventHandler(this.ToggleArquivosDigitais_OnChecked) - }; - ((System.Windows.Style)target).Setters.Add(eventSetter); - return; - } - default: - { - return; - } - } - } - - private void ToggleArquivosDigitais_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.HabilitarArquivoDigital((PermissaoArquivoDigital)dataGridCell.DataContext); - } - - private void ToggleFerramentas_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.HabilitarConsulta((PermissaoUsuario)dataGridCell.DataContext, "Ferramentas"); - } - - private void ToggleSeguros_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.HabilitarConsulta((PermissaoUsuario)dataGridCell.DataContext, "Seguros"); - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - - private void UnToggleArquivosDigitais_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.DesabilitarArquivoDigital((PermissaoArquivoDigital)dataGridCell.DataContext); - } - - private void UnToggleFerramentas_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.DesabilitarConsulta((PermissaoUsuario)dataGridCell.DataContext, "Ferramentas"); - } - - private void UnToggleSeguros_OnChecked(object sender, RoutedEventArgs e) - { - if (!this.ViewModel.Carregado) - { - return; - } - DataGridCell dataGridCell = (DataGridCell)sender; - if (dataGridCell == null) - { - return; - } - this.ViewModel.DesabilitarConsulta((PermissaoUsuario)dataGridCell.DataContext, "Seguros"); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Relatorios/ConfiguracaoRelatorio.cs b/Gestor.Application/Drawers/Relatorios/ConfiguracaoRelatorio.cs deleted file mode 100644 index acd3f1f..0000000 --- a/Gestor.Application/Drawers/Relatorios/ConfiguracaoRelatorio.cs +++ /dev/null @@ -1,421 +0,0 @@ -using Gestor.Application; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Relatorios; -using Gestor.Model.Domain.Relatorios; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Markup; -using System.Windows.Threading; - -namespace Gestor.Application.Drawers.Relatorios -{ - public class ConfiguracaoRelatorio : UserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal RadioButton CampoButton; - - internal RadioButton TotalizacaoButton; - - internal ComboBox CampoComboBox; - - internal ComboBox TotalizacaoComboBox; - - internal DataGrid ParametrosGrid; - - internal DataGrid TotalizacaoGrid; - - internal Snackbar SnackbarArquivoDigital; - - private bool _contentLoaded; - - public RelatorioViewModel ViewModel - { - get; - set; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public ConfiguracaoRelatorio(RelatorioViewModel viewModel) - { - this.ViewModel = viewModel; - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - - private void AdicionarParametro_OnClick(object sender, RoutedEventArgs e) - { - object item; - RelatorioViewModel viewModel = this.ViewModel; - ComboBox campoComboBox = this.CampoComboBox; - if (campoComboBox != null) - { - item = campoComboBox.Items[this.CampoComboBox.SelectedIndex]; - } - else - { - item = null; - } - viewModel.AdicionarParametro((ParametrosRelatorio)item); - } - - private void AdicionarTotalizacao_OnClick(object sender, RoutedEventArgs e) - { - object item; - RelatorioViewModel viewModel = this.ViewModel; - ComboBox totalizacaoComboBox = this.TotalizacaoComboBox; - if (totalizacaoComboBox != null) - { - item = totalizacaoComboBox.Items[this.TotalizacaoComboBox.SelectedIndex]; - } - else - { - item = null; - } - viewModel.AdicionarTotalizacao((ParametrosTotalizacao)item); - } - - private void Campo_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsCampo = true; - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Toggle("", false))); - } - - private async void ContentLoad() - { - this.CampoButton.IsChecked = new bool?(this.ViewModel.IsCampo); - this.TotalizacaoButton.IsChecked = new bool?(!this.ViewModel.IsCampo); - this.CampoButton.Checked += new RoutedEventHandler(this.Campo_OnChecked); - this.TotalizacaoButton.Checked += new RoutedEventHandler(this.Totalizacao_OnChecked); - this.ViewModel.IsEnabled = false; - await this.ViewModel.CarregarConfiguracoes(); - this.ViewModel.IsEnabled = true; - } - - private void DescerParametro_OnClick(object sender, RoutedEventArgs e) - { - bool selectedIndex; - object item; - DataGrid parametrosGrid = this.ParametrosGrid; - if (parametrosGrid != null) - { - selectedIndex = parametrosGrid.SelectedIndex < 0; - } - else - { - selectedIndex = false; - } - if (selectedIndex) - { - return; - } - RelatorioViewModel viewModel = this.ViewModel; - DataGrid dataGrid = this.ParametrosGrid; - if (dataGrid != null) - { - item = dataGrid.Items[this.ParametrosGrid.SelectedIndex]; - } - else - { - item = null; - } - viewModel.DescerParametro((ParametrosRelatorio)item); - } - - private void ExcluirParametro_OnClick(object sender, RoutedEventArgs e) - { - bool selectedIndex; - object item; - DataGrid parametrosGrid = this.ParametrosGrid; - if (parametrosGrid != null) - { - selectedIndex = parametrosGrid.SelectedIndex < 0; - } - else - { - selectedIndex = false; - } - if (selectedIndex) - { - return; - } - RelatorioViewModel viewModel = this.ViewModel; - DataGrid dataGrid = this.ParametrosGrid; - if (dataGrid != null) - { - item = dataGrid.Items[this.ParametrosGrid.SelectedIndex]; - } - else - { - item = null; - } - viewModel.ExcluirParametro((ParametrosRelatorio)item); - } - - private void ExcluirTotalizacao_OnClick(object sender, RoutedEventArgs e) - { - bool selectedIndex; - object item; - DataGrid totalizacaoGrid = this.TotalizacaoGrid; - if (totalizacaoGrid != null) - { - selectedIndex = totalizacaoGrid.SelectedIndex < 0; - } - else - { - selectedIndex = false; - } - if (selectedIndex) - { - return; - } - RelatorioViewModel viewModel = this.ViewModel; - DataGrid dataGrid = this.TotalizacaoGrid; - if (dataGrid != null) - { - item = dataGrid.Items[this.TotalizacaoGrid.SelectedIndex]; - } - else - { - item = null; - } - viewModel.ExcluirTotalizacao((ParametrosTotalizacao)item); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/relatorios/configuracaorelatorio.xaml", UriKind.Relative)); - } - - private async void Salvar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.IsEnabled = false; - bool flag = await this.ViewModel.SalvarParametros(); - this.ViewModel.IsEnabled = true; - if (flag) - { - this.Toggle("CONFIGURAÇÕES SALVAS.", true); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.SnackbarArquivoDigital.set_IsActive(false); - } - - private void SubirParametro_OnClick(object sender, RoutedEventArgs e) - { - bool selectedIndex; - object item; - DataGrid parametrosGrid = this.ParametrosGrid; - if (parametrosGrid != null) - { - selectedIndex = parametrosGrid.SelectedIndex < 0; - } - else - { - selectedIndex = false; - } - if (selectedIndex) - { - return; - } - RelatorioViewModel viewModel = this.ViewModel; - DataGrid dataGrid = this.ParametrosGrid; - if (dataGrid != null) - { - item = dataGrid.Items[this.ParametrosGrid.SelectedIndex]; - } - else - { - item = null; - } - viewModel.SubirParametro((ParametrosRelatorio)item); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 2: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 3: - { - this.CampoButton = (RadioButton)target; - return; - } - case 4: - { - this.TotalizacaoButton = (RadioButton)target; - return; - } - case 5: - { - this.CampoComboBox = (ComboBox)target; - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarParametro_OnClick); - return; - } - case 7: - { - this.TotalizacaoComboBox = (ComboBox)target; - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarTotalizacao_OnClick); - return; - } - case 9: - { - this.ParametrosGrid = (DataGrid)target; - return; - } - case 10: - case 11: - case 12: - case 14: - { - this._contentLoaded = true; - return; - } - case 13: - { - this.TotalizacaoGrid = (DataGrid)target; - return; - } - case 15: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); - return; - } - case 16: - { - this.SnackbarArquivoDigital = (Snackbar)target; - return; - } - case 17: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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) - { - switch (connectionId) - { - case 10: - { - ((Button)target).Click += new RoutedEventHandler(this.SubirParametro_OnClick); - return; - } - case 11: - { - ((Button)target).Click += new RoutedEventHandler(this.DescerParametro_OnClick); - return; - } - case 12: - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirParametro_OnClick); - return; - } - case 13: - { - return; - } - case 14: - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirTotalizacao_OnClick); - return; - } - default: - { - return; - } - } - } - - public void Toggle(string message, bool active = true) - { - this.SnackbarArquivoDigital.get_Message().Content = message; - this.SnackbarArquivoDigital.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - - private void Totalizacao_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsCampo = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/Relatorios/FiltroRelatorio.cs b/Gestor.Application/Drawers/Relatorios/FiltroRelatorio.cs deleted file mode 100644 index 4c1f2a2..0000000 --- a/Gestor.Application/Drawers/Relatorios/FiltroRelatorio.cs +++ /dev/null @@ -1,152 +0,0 @@ -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Relatorios; -using Gestor.Model.Common; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers.Relatorios -{ - public class FiltroRelatorio : UserControl, IComponentConnector - { - private RelatorioViewModel ViewModel; - - internal MaterialDataGridTextColumn IdField; - - internal MaterialDataGridTextColumn NomeField; - - internal MaterialDataGridTextColumn ApelidoField; - - internal DataGrid RamosGrid; - - internal DataGrid VendedorGrid; - - internal DataGrid TipoSeguroGrid; - - internal DataGrid TipoVendedorGrid; - - internal DataGrid NegocioGrid; - - internal DataGrid ProdutoGrid; - - internal DataGrid EstipulanteGrid; - - private bool _contentLoaded; - - public FiltroRelatorio(RelatorioViewModel viewModel, Relatorio relatorio) - { - this.ViewModel = viewModel; - base.DataContext = this.ViewModel; - this.InitializeComponent(); - viewModel.ReloadVendedores(); - this.VendedorGrid.Visibility = (viewModel.Vendedores.Count > 0 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.EstipulanteGrid.Visibility = (viewModel.Estipulantes.Count > 0 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.ProdutoGrid.Visibility = (viewModel.Produtos.Count > 0 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.IdField.Visibility = (this.ViewModel.Apelido ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); - this.NomeField.Visibility = (this.ViewModel.Apelido ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); - this.ApelidoField.Visibility = (!this.ViewModel.Apelido ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); - if (relatorio == 19) - { - this.RamosGrid.Visibility = System.Windows.Visibility.Collapsed; - this.TipoSeguroGrid.Visibility = System.Windows.Visibility.Collapsed; - this.VendedorGrid.Visibility = System.Windows.Visibility.Collapsed; - this.EstipulanteGrid.Visibility = System.Windows.Visibility.Collapsed; - this.ProdutoGrid.Visibility = System.Windows.Visibility.Collapsed; - this.TipoVendedorGrid.Visibility = System.Windows.Visibility.Collapsed; - this.NegocioGrid.Visibility = System.Windows.Visibility.Collapsed; - } - this.ViewModel.EnableMenu = true; - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.Filtro = ""; - this.ViewModel.AdicionarFiltros(); - this.ViewModel.CloseDrawer(); - } - - [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/drawers/relatorios/filtrorelatorio.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 2: - { - this.IdField = (MaterialDataGridTextColumn)target; - return; - } - case 3: - { - this.NomeField = (MaterialDataGridTextColumn)target; - return; - } - case 4: - { - this.ApelidoField = (MaterialDataGridTextColumn)target; - return; - } - case 5: - { - this.RamosGrid = (DataGrid)target; - return; - } - case 6: - { - this.VendedorGrid = (DataGrid)target; - return; - } - case 7: - { - this.TipoSeguroGrid = (DataGrid)target; - return; - } - case 8: - { - this.TipoVendedorGrid = (DataGrid)target; - return; - } - case 9: - { - this.NegocioGrid = (DataGrid)target; - return; - } - case 10: - { - this.ProdutoGrid = (DataGrid)target; - return; - } - case 11: - { - this.EstipulanteGrid = (DataGrid)target; - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/TarefaDrawer.cs b/Gestor.Application/Drawers/TarefaDrawer.cs deleted file mode 100644 index 13b9bac..0000000 --- a/Gestor.Application/Drawers/TarefaDrawer.cs +++ /dev/null @@ -1,631 +0,0 @@ -using Gestor.Application.Componentes; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Configuracoes; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using MaterialDesignThemes.Wpf; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Threading; -using Xceed.Wpf.AvalonDock.Controls; - -namespace Gestor.Application.Drawers -{ - public class TarefaDrawer : UserControl, IComponentConnector, IStyleConnector - { - internal System.Windows.Controls.ProgressBar ProgressBar; - - internal TextBlock TitleBox; - - internal DatePicker AgendamentoBox; - - internal ToggleButton AtivoBox; - - internal RadioButton AnotacoesButton; - - internal RadioButton AnotacoesInternasButton; - - internal WebEditor Anotacoes; - - internal WebEditor Historico; - - internal WebEditor AnotacoesInternas; - - internal WebEditor HistoricoInterno; - - internal DatePicker ConclusaoBox; - - internal ComboBox CboResponsavel; - - internal MaterialDesignThemes.Wpf.Snackbar Snackbar; - - private bool _contentLoaded; - - private TarefaDrawerViewModel ViewModel - { - get; - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - internal Delegate _CreateDelegate(Type delegateType, string handler) - { - return Delegate.CreateDelegate(delegateType, this, handler); - } - - public TarefaDrawer(Tarefa tarefa, bool enableMenu = true) - { - long? nullable; - long? nullable1; - object description; - long? nullable2; - long? nullable3; - object obj; - object obj1; - long num; - this.ViewModel = new TarefaDrawerViewModel(tarefa, enableMenu); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; - if (dispatcher != null) - { - dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); - } - else - { - } - TarefaDrawerViewModel viewModel = this.ViewModel; - if (tarefa != null) - { - description = ValidationHelper.GetDescription(tarefa.get_Entidade()); - } - else - { - description = null; - } - if (tarefa != null) - { - nullable1 = new long?(tarefa.get_IdEntidade()); - } - else - { - nullable = null; - nullable1 = nullable; - } - string str = string.Format("ACESSOU TAREFA DE {0} DO DOCUMENTO DE ID \"{1}\"", description, nullable1); - num = (tarefa != null ? tarefa.get_IdEntidade() : (long)0); - TipoTela? nullable4 = new TipoTela?(38); - if (tarefa != null) - { - obj = ValidationHelper.GetDescription(tarefa.get_Entidade()); - } - else - { - obj = null; - } - if ((tarefa != null ? tarefa.get_IdCliente() != (long)0 : true)) - { - if (tarefa != null) - { - nullable2 = new long?(tarefa.get_IdCliente()); - } - else - { - nullable = null; - nullable2 = nullable; - } - obj1 = string.Format("\nID CLIENTE: {0}", nullable2); - } - else - { - obj1 = ""; - } - if (tarefa != null) - { - nullable3 = new long?(tarefa.get_IdEntidade()); - } - else - { - nullable = null; - nullable3 = nullable; - } - viewModel.RegistrarAcao(str, num, nullable4, string.Format("TIPO DE TAREFA: {0}{1}\nID DOCUMENTO: {2}", obj, obj1, nullable3)); - } - - private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AdcionarResponsavel(); - } - - private void Alterar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AlterarTarefa(); - this.Anotacoes.Initialize(null); - this.Validar(); - } - - private async void AnexoTarefa_OnClick(object sender, RoutedEventArgs e) - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 15).get_Consultar()) - { - Button button = (Button)sender; - if (button.DataContext != null) - { - Tarefa dataContext = (Tarefa)button.DataContext; - FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital(); - filtroArquivoDigital.set_Id(dataContext.get_Id()); - filtroArquivoDigital.set_Tipo(15); - filtroArquivoDigital.set_Parente(dataContext); - this.ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false); - } - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)15), "."), "OK", "", false); - } - } - - private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsAnotacoes = true; - } - - private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) - { - this.ViewModel.IsAnotacoes = false; - } - - private async void Cancelar_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Cancelar(); - this.Anotacoes.Initialize(null); - this.AnotacoesInternas.Initialize(null); - } - - private void CloseSlackBar() - { - Thread.Sleep(5000); - System.Windows.Threading.Dispatcher dispatcher = this.ProgressBar.Dispatcher; - if (dispatcher == null) - { - return; - } - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); - } - - private void ContentLoad() - { - this.AnotacoesButton.IsChecked = new bool?(this.ViewModel.IsAnotacoes); - this.AnotacoesInternasButton.IsChecked = new bool?(!this.ViewModel.IsAnotacoes); - this.AnotacoesButton.Checked += new RoutedEventHandler(this.Anotacoes_OnChecked); - this.AnotacoesInternasButton.Checked += new RoutedEventHandler(this.AnotacoesInternas_OnChecked); - } - - private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - if (button.DataContext != null) - { - TelefoneBase dataContext = button.DataContext as TelefoneBase; - if (dataContext != null) - { - string.Concat(dataContext.get_Prefixo(), ValidationHelper.OnlyNumber(dataContext.get_Numero())).CopyToClipboard(); - this.ToggleSnackBar(string.Concat("COPIADO - ", dataContext.get_Prefixo(), ValidationHelper.OnlyNumber(dataContext.get_Numero())), true); - return; - } - } - } - - private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) - { - ((DatePicker)sender).SelectedDate = new DateTime?(Funcoes.GetNetworkTime().Date); - } - - private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) - { - DatePicker datePicker = (DatePicker)sender; - datePicker.Text = ValidationHelper.FormatDate(datePicker.Text); - } - - private async void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) - { - Chip chip = sender as Chip; - if (chip != null) - { - if (await this.ViewModel.ValidaPermissaoParaEditarTarefa()) - { - ResponsavelTarefa dataContext = (ResponsavelTarefa)chip.DataContext; - if (dataContext != null) - { - this.ViewModel.Responsaveis.Remove(dataContext); - this.ViewModel.Usuarios.Add(dataContext.get_Usuario()); - TarefaDrawerViewModel viewModel = this.ViewModel; - ObservableCollection usuarios = this.ViewModel.Usuarios; - viewModel.Usuarios = new ObservableCollection( - from x in usuarios - orderby x.get_Nome() - select x); - } - } - else - { - await this.ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA EXCLUIR RESPONSÁVEL.", "OK", "", false); - } - } - chip = null; - } - - private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e) - { - Grid grid = Extentions.FindVisualAncestor((Button)sender); - ListBox listBox = Extentions.FindVisualAncestor(grid); - Tarefa item = (Tarefa)listBox.Items[listBox.Items.IndexOf(grid.DataContext)]; - if (!await this.ViewModel.ValidaPermissaoParaExcluirTarefa(item)) - { - await this.ViewModel.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA", "OK", "", false); - } - else if (await this.ViewModel.Excluir(item)) - { - this.ToggleSnackBar("TAREFA EXCLUÍDA COM SUCESSO.", true); - } - item = null; - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - private void Imprimir_OnClick(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - if (button.DataContext == null) - { - return; - } - Tarefa dataContext = (Tarefa)button.DataContext; - if (dataContext.get_Id() == 0) - { - return; - } - this.ViewModel.SelectedTarefa = dataContext; - this.ViewModel.Print(); - } - - private void IncluirTarefa_OnClick(object sender, RoutedEventArgs e) - { - this.AnotacoesButton.IsChecked = new bool?(true); - this.Anotacoes.Initialize(null); - this.AnotacoesInternas.Initialize(null); - this.ViewModel.Incluir(); - this.Validar(); - } - - [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/drawers/tarefadrawer.xaml", UriKind.Relative)); - } - - private void InxlusaoAnexoTarefa_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.ArquivosAnexados = new ObservableCollection(this.ViewModel.ArquivosFinais); - this.ViewModel.ShowDrawer(new InclusaoArquivoDigitalDrawer(this.ViewModel), 0, false); - } - - private async void MenuList_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - ListBox listBox = (ListBox)sender; - if (listBox.SelectedItem != null) - { - this.ViewModel.TituloTarefas = listBox.SelectedItem.ToString().Replace("System.Windows.Controls.ListBoxItem: ", ""); - await this.ViewModel.CarregarTarefas(listBox.SelectedIndex); - } - } - - private async void SalvarTarefa_OnClick(object sender, RoutedEventArgs e) - { - bool flag; - this.ViewModel.Carregando = true; - this.ViewModel.SelectedTarefa.set_Anotacoes(this.Anotacoes.GetHtml()); - this.ViewModel.SelectedTarefa.set_AnotacoesInternas(this.AnotacoesInternas.GetHtml()); - List> keyValuePairs = await this.ViewModel.Salvar(this.Anotacoes.GetText(), this.AnotacoesInternas.GetText()); - flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); - this.ViewModel.Carregando = false; - if (!flag) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - else - { - this.ToggleSnackBar("TAREFA SALVA COM SUCESSO.", true); - this.ViewModel.Alterar(false); - this.Anotacoes.Initialize(null); - this.AnotacoesInternas.Initialize(null); - } - } - - private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) - { - this.Snackbar.set_IsActive(false); - } - - private void Status_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - ComboBox comboBox = (ComboBox)sender; - if (comboBox == null || comboBox.SelectedItem == null) - { - return; - } - this.ViewModel.Concluido = (StatusTarefa)comboBox.SelectedItem == 2; - if ((StatusTarefa)comboBox.SelectedItem == 2) - { - DatePicker conclusaoBox = this.ConclusaoBox; - DateTime? conclusao = this.ViewModel.SelectedTarefa.get_Conclusao(); - conclusaoBox.SelectedDate = new DateTime?((conclusao.HasValue ? conclusao.GetValueOrDefault() : Funcoes.GetNetworkTime())); - } - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.ProgressBar = (System.Windows.Controls.ProgressBar)target; - return; - } - case 2: - { - ((ListBox)target).SelectionChanged += new SelectionChangedEventHandler(this.MenuList_OnSelectionChanged); - return; - } - case 3: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 4: - { - this.TitleBox = (TextBlock)target; - return; - } - case 5: - case 6: - case 12: - case 13: - case 14: - case 27: - { - this._contentLoaded = true; - return; - } - case 7: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirTarefa_OnClick); - return; - } - case 8: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); - return; - } - case 9: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarTarefa_OnClick); - return; - } - case 10: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); - return; - } - case 11: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.InxlusaoAnexoTarefa_OnClick); - return; - } - case 15: - { - this.AgendamentoBox = (DatePicker)target; - this.AgendamentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.AgendamentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 16: - { - this.AtivoBox = (ToggleButton)target; - return; - } - case 17: - { - this.AnotacoesButton = (RadioButton)target; - return; - } - case 18: - { - this.AnotacoesInternasButton = (RadioButton)target; - return; - } - case 19: - { - this.Anotacoes = (WebEditor)target; - return; - } - case 20: - { - this.Historico = (WebEditor)target; - return; - } - case 21: - { - this.AnotacoesInternas = (WebEditor)target; - return; - } - case 22: - { - this.HistoricoInterno = (WebEditor)target; - return; - } - case 23: - { - ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.Status_OnSelectionChanged); - return; - } - case 24: - { - this.ConclusaoBox = (DatePicker)target; - this.ConclusaoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); - this.ConclusaoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); - return; - } - case 25: - { - this.CboResponsavel = (ComboBox)target; - return; - } - case 26: - { - ((Button)target).Click += new RoutedEventHandler(this.AdicionarResponsavel_OnClick); - return; - } - case 28: - { - this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; - return; - } - case 29: - { - ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); - 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 <= 6) - { - if (connectionId == 5) - { - ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); - return; - } - if (connectionId != 6) - { - return; - } - ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); - return; - } - switch (connectionId) - { - case 12: - { - ((Button)target).Click += new RoutedEventHandler(this.ExcluirTarefa_OnClick); - return; - } - case 13: - { - ((Button)target).Click += new RoutedEventHandler(this.AnexoTarefa_OnClick); - return; - } - case 14: - { - ((Button)target).Click += new RoutedEventHandler(this.Imprimir_OnClick); - return; - } - default: - { - if (connectionId == 27) - { - break; - } - else - { - return; - } - } - } - ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirResponsavel_OnClick)); - } - - public void ToggleSnackBar(string message, bool active = true) - { - this.Snackbar.get_Message().Content = message; - this.Snackbar.set_IsActive(active); - if (!active) - { - return; - } - Task.Factory.StartNew(new Action(this.CloseSlackBar)); - } - - private void Validar() - { - if (this.ViewModel.SelectedTarefa == null) - { - return; - } - this.ViewModel.SelectedTarefa.set_AgendamentoRetroativo(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 45)); - List> keyValuePairs = this.ViewModel.SelectedTarefa.Validate(); - this.ValidateFields(keyValuePairs, false); - } - - private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) - { - string str; - Button button = (Button)sender; - if (button.DataContext != null) - { - TelefoneBase dataContext = button.DataContext as TelefoneBase; - if (dataContext != null) - { - str = (!dataContext.get_Tipo().HasValue || dataContext.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", dataContext.get_Prefixo(), dataContext.get_Numero().Clear()) : string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).Clear()); - if (!str.EnviarWhatsapp(null)) - { - 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; - } - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ValoresApoliceDrawer.cs b/Gestor.Application/Drawers/ValoresApoliceDrawer.cs deleted file mode 100644 index f11ad64..0000000 --- a/Gestor.Application/Drawers/ValoresApoliceDrawer.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class ValoresApoliceDrawer : BaseUserControl, IComponentConnector - { - private bool _contentLoaded; - - public ValoresApoliceViewModel ViewModel - { - get; - set; - } - - public ValoresApoliceDrawer(Documento documento) - { - this.ViewModel = new ValoresApoliceViewModel(documento); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/valoresapolicedrawer.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId != 1) - { - this._contentLoaded = true; - return; - } - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/ValoresParcelaDrawer.cs b/Gestor.Application/Drawers/ValoresParcelaDrawer.cs deleted file mode 100644 index 2e5979d..0000000 --- a/Gestor.Application/Drawers/ValoresParcelaDrawer.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class ValoresParcelaDrawer : BaseUserControl, IComponentConnector - { - internal DockPanel pnlStatusParcelaExtrato; - - private bool _contentLoaded; - - public ValoresParcelaViewModel ViewModel - { - get; - set; - } - - public ValoresParcelaDrawer(Parcela parcela, Documento documento) - { - this.ViewModel = new ValoresParcelaViewModel(parcela, documento); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/valoresparceladrawer.xaml", UriKind.Relative)); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - if (connectionId == 1) - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - if (connectionId != 2) - { - this._contentLoaded = true; - return; - } - this.pnlStatusParcelaExtrato = (DockPanel)target; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/Drawers/VinculoVendedorDrawer.cs b/Gestor.Application/Drawers/VinculoVendedorDrawer.cs deleted file mode 100644 index 9b03e23..0000000 --- a/Gestor.Application/Drawers/VinculoVendedorDrawer.cs +++ /dev/null @@ -1,124 +0,0 @@ -using Gestor.Application.ViewModels.Drawer; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; - -namespace Gestor.Application.Drawers -{ - public class VinculoVendedorDrawer : BaseUserControl, IComponentConnector - { - public VinculoVendedorViewModel ViewModel; - - internal DataGrid VendedorGrid; - - internal DataGrid VinculadoGrid; - - private bool _contentLoaded; - - public VinculoVendedorDrawer(Usuario usuario) - { - this.ViewModel = new VinculoVendedorViewModel(usuario); - base.DataContext = this.ViewModel; - this.InitializeComponent(); - } - - private void AbrirLog_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.AbrirLog(45, this.ViewModel.SelectedUsuario.get_Id()); - } - - private async void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) - { - if (((AutoCompleteBox)sender).get_Text() == string.Empty) - { - await this.ViewModel.BuscarVinculoVendedor(""); - } - } - - private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) - { - if (e.get_Parameter().Length < 3) - { - return; - } - e.set_Cancel(true); - this.ViewModel.BuscarVinculoVendedor(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task searchResult) => ((AutoCompleteBox)sender).PopulateComplete(), TaskScheduler.FromCurrentSynchronizationContext()); - } - - private void Fechar_OnClick(object sender, RoutedEventArgs e) - { - this.ViewModel.CloseDrawer(); - } - - [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/drawers/vinculovendedordrawer.xaml", UriKind.Relative)); - } - - private async void SalvarVinculo_OnClick(object sender, RoutedEventArgs e) - { - await this.ViewModel.Salvar(); - this.ViewModel.ToggleSnackBar("VÍNCULO DE USUÁRIO SALVO COM SUCESSO.", true); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); - return; - } - case 2: - { - ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, VinculoVendedorDrawer.AutoCompleteBox_Populating)); - ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged)); - return; - } - case 3: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick); - return; - } - case 4: - { - this.VendedorGrid = (DataGrid)target; - return; - } - case 5: - { - this.VinculadoGrid = (DataGrid)target; - return; - } - case 6: - { - ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarVinculo_OnClick); - return; - } - } - this._contentLoaded = true; - } - } -} \ No newline at end of file -- cgit v1.2.3