summaryrefslogtreecommitdiff
path: root/Gestor.Application/Views/Financeiro
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/Views/Financeiro
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Views/Financeiro')
-rw-r--r--Gestor.Application/Views/Financeiro/BancosContasView.cs371
-rw-r--r--Gestor.Application/Views/Financeiro/CentroDeCustoView.cs199
-rw-r--r--Gestor.Application/Views/Financeiro/ExtratoWindow.cs511
-rw-r--r--Gestor.Application/Views/Financeiro/FinanceiroView.cs1560
-rw-r--r--Gestor.Application/Views/Financeiro/FornecedorView.cs419
-rw-r--r--Gestor.Application/Views/Financeiro/InfoExtratoView.cs127
-rw-r--r--Gestor.Application/Views/Financeiro/PlanoView.cs117
-rw-r--r--Gestor.Application/Views/Financeiro/PlanosView.cs262
-rw-r--r--Gestor.Application/Views/Financeiro/Relatorios/FechamentoFinanceiroView.cs285
9 files changed, 0 insertions, 3851 deletions
diff --git a/Gestor.Application/Views/Financeiro/BancosContasView.cs b/Gestor.Application/Views/Financeiro/BancosContasView.cs
deleted file mode 100644
index fa40fe7..0000000
--- a/Gestor.Application/Views/Financeiro/BancosContasView.cs
+++ /dev/null
@@ -1,371 +0,0 @@
-using CurrencyTextBoxControl;
-using Gestor.Application.Helpers;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-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;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class BancosContasView : BaseUserControl, IComponentConnector, IStyleConnector
- {
- internal DataGrid BancosContasGrid;
-
- internal AutoCompleteBox AutoCompleteBanco;
-
- internal CurrencyTextBox ValorSaldoBox;
-
- private bool _contentLoaded;
-
- public BancosContasViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public BancosContasView()
- {
- base.Tag = "BANCOS E CONTAS";
- this.ViewModel = new BancosContasViewModel();
- base.DataContext = this.ViewModel;
- this.ViewModel.Alterar(false);
- 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(26, this.ViewModel.SelectedBancosContas.get_Id());
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelBancosContas = (BancosContas)this.ViewModel.SelectedBancosContas.Clone();
- this.ViewModel.Alterar(true);
- this.ViewModel.SelectedBancosContas.Initialize();
- }
-
- private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Banco>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteBancosContasBox_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<List<BancosContas>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarBancosContas("");
- }
-
- private void BancosContasGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- DataGrid dataGrid = (DataGrid)sender;
- if (dataGrid != null && dataGrid.SelectedIndex < 0)
- {
- return;
- }
- this.ViewModel.SelectedBancosContas = (BancosContas)((dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null));
- }
-
- private void Cancelar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelarAlteracao();
- }
-
- private void ContentLoad()
- {
- this.BancosContasGrid.SelectedIndex = 0;
- this.BancosContasGrid.SelectionChanged += new SelectionChangedEventHandler(this.BancosContasGrid_OnSelectionChanged);
- this.BancosContasGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => {
- });
- }
-
- private void Excluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Excluir();
- }
-
- private void ExcluirSaldo_OnClick(object sender, RoutedEventArgs e)
- {
- ((MenuItem)sender).Click -= new RoutedEventHandler(this.ExcluirSaldo_OnClick);
- this.ViewModel.ExcluirSaldo();
- ((MenuItem)sender).Click += new RoutedEventHandler(this.ExcluirSaldo_OnClick);
- }
-
- private async void FechamentoBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
- {
- DateTime dateTime;
- DatePicker datePicker = (DatePicker)sender;
- datePicker.Text = ValidationHelper.FormatDate(datePicker.Text);
- if (DateTime.TryParse(datePicker.Text, out dateTime))
- {
- CurrencyTextBox valorSaldoBox = this.ValorSaldoBox;
- valorSaldoBox.set_Number(await this.ViewModel.CalcularValor());
- valorSaldoBox = null;
- }
- }
-
- private async void FecharSaldo_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- TimeSpan? nullable;
- bool flag1;
- DateTime? dataFinal = this.ViewModel.SelectedSaldo.get_DataFinal();
- if (dataFinal.HasValue)
- {
- dataFinal = this.ViewModel.SelectedSaldo.get_DataInicio();
- DateTime? dataFinal1 = this.ViewModel.SelectedSaldo.get_DataFinal();
- DateTime value = dataFinal1.Value;
- flag = (dataFinal.HasValue ? dataFinal.GetValueOrDefault() >= value : false);
- if (!flag)
- {
- dataFinal1 = this.ViewModel.SelectedSaldo.get_DataFinal();
- value = dataFinal1.Value;
- dataFinal = this.ViewModel.SelectedSaldo.get_DataInicio();
- if (dataFinal.HasValue)
- {
- nullable = new TimeSpan?(value - dataFinal.GetValueOrDefault());
- }
- else
- {
- nullable = null;
- }
- TimeSpan? nullable1 = nullable;
- if (!nullable1.HasValue)
- {
- flag1 = false;
- }
- else
- {
- flag1 = (nullable1.Value.TotalDays < 28 ? true : nullable1.Value.TotalDays > 31);
- }
- bool flag2 = flag1;
- if (flag2)
- {
- flag2 = !await this.ViewModel.ShowMessage("O INTERVALO DE FECHAMENTO É RECOMENDADO 1 MÊS. DESEJA CONTINUAR?", "SIM", "NÃO", false);
- }
- if (!flag2)
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.FecharSaldo();
- this.ViewModel.Loading(false);
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("A DATA DE FECHAMENTO DEVE SER MAIOR QUE A DATA DE ABERTURA DO SALDO.", "OK", "", false);
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("NECESSÁRIO PREENCHER A DATA DE FECHAMENTO.", "OK", "", false);
- }
- }
-
- private void Incluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Incluir();
- this.AutoCompleteBanco.set_Text("");
- List<KeyValuePair<string, string>> keyValuePairs = this.ViewModel.SelectedBancosContas.Validate();
- this.ValidateFields(keyValuePairs, true);
- }
-
- private void InfoExtrato_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = (Button)sender;
- if (button == null || button.DataContext == null)
- {
- return;
- }
- (new HosterWindow(new InfoExtratoView((Saldo)button.DataContext, true), "INFORMAÇÕES DO EXTRATO", new double?((double)800), new double?((double)450), false)).ShowDialog();
- this.ViewModel.Loading(true);
- this.ViewModel.CarregarSaldos(this.ViewModel.SelectedBancosContas);
- this.ViewModel.Loading(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/views/financeiro/bancoscontasview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, BancosContasView.AutoCompleteBancosContasBox_Populating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
- return;
- }
- case 2:
- {
- this.BancosContasGrid = (DataGrid)target;
- 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.AbrirLog_OnClick);
- return;
- }
- case 9:
- {
- this.AutoCompleteBanco = (AutoCompleteBox)target;
- this.AutoCompleteBanco.add_Populating(new PopulatingEventHandler(this, BancosContasView.AutoCompleteBancoBox_Populating));
- return;
- }
- case 10:
- {
- ((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 11:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.FechamentoBox_OnLostKeyboardFocus);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- return;
- }
- case 12:
- {
- this.ValorSaldoBox = (CurrencyTextBox)target;
- return;
- }
- case 13:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.FecharSaldo_OnClick);
- return;
- }
- case 14:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirSaldo_OnClick);
- 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 == 15)
- {
- ((Button)target).Click += new RoutedEventHandler(this.InfoExtrato_OnClick);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/CentroDeCustoView.cs b/Gestor.Application/Views/Financeiro/CentroDeCustoView.cs
deleted file mode 100644
index 02dd796..0000000
--- a/Gestor.Application/Views/Financeiro/CentroDeCustoView.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-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;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class CentroDeCustoView : UserControl, IComponentConnector
- {
- private bool _seleciona = true;
-
- internal DataGrid CentroDeCustoGrid;
-
- private bool _contentLoaded;
-
- private CentroDeCustoViewmodel ViewModel
- {
- get;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public CentroDeCustoView()
- {
- base.Tag = "CENTRO DE CUSTO";
- this.ViewModel = new CentroDeCustoViewmodel();
- 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(29, this.ViewModel.SelectedCentro.get_Id());
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelCentro = (Centro)this.ViewModel.SelectedCentro.Clone();
- this.ViewModel.Alterar(true);
- this.ViewModel.SelectedCentro.Initialize();
- }
-
- private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarCentro("");
- }
-
- private void AutoCompleteBoxCentro_Populating(object sender, PopulatingEventArgs e)
- {
- e.set_Cancel(true);
- this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Centro>> searchResult) => {
- if (searchResult == 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 CentroDeCustoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (!this._seleciona)
- {
- return;
- }
- DataGrid dataGrid = (DataGrid)sender;
- if (dataGrid != null && dataGrid.SelectedIndex < 0)
- {
- return;
- }
- this.ViewModel.SelecionaCentroDeCusto((Centro)((dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null)));
- }
-
- private void ContentLoad()
- {
- this.CentroDeCustoGrid.SelectedIndex = 0;
- this.CentroDeCustoGrid.SelectionChanged += new SelectionChangedEventHandler(this.CentroDeCustoGrid_OnSelectionChanged);
- this.CentroDeCustoGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => {
- });
- }
-
- private void Incluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Incluir();
- List<KeyValuePair<string, string>> keyValuePairs = this.ViewModel.SelectedCentro.Validate();
- this.ValidateFields(keyValuePairs, 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/views/financeiro/centrodecustoview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, CentroDeCustoView.AutoCompleteBoxCentro_Populating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
- return;
- }
- case 2:
- {
- this.CentroDeCustoGrid = (DataGrid)target;
- 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.AbrirLog_OnClick);
- return;
- }
- }
- this._contentLoaded = true;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/ExtratoWindow.cs b/Gestor.Application/Views/Financeiro/ExtratoWindow.cs
deleted file mode 100644
index 9f75243..0000000
--- a/Gestor.Application/Views/Financeiro/ExtratoWindow.cs
+++ /dev/null
@@ -1,511 +0,0 @@
-using Gestor.Application;
-using Gestor.Application.Helpers;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Seguros;
-using MaterialDesignThemes.Wpf;
-using System;
-using System.CodeDom.Compiler;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Forms;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Shapes;
-using System.Windows.Shell;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class ExtratoWindow : Window, IComponentConnector
- {
- private bool _buttonClickable;
-
- public ExtratoContaViewModel ViewModel;
-
- internal System.Windows.Shell.WindowChrome WindowChrome;
-
- internal Grid MinimizeButton;
-
- internal Grid MaximizeButton;
-
- internal Grid CloseButton;
-
- internal System.Windows.Controls.ProgressBar ProgressRing;
-
- internal System.Windows.Controls.ComboBox ContaBox;
-
- internal DatePicker InicioBox;
-
- internal DatePicker FimBox;
-
- internal System.Windows.Controls.DataGrid LancamentoGrid;
-
- internal TextBlock NaoHaDados;
-
- internal MaterialDesignThemes.Wpf.Snackbar Snackbar;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public ExtratoWindow(long id = 0L)
- {
- this.ViewModel = new ExtratoContaViewModel(id);
- 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
- {
- }
- string str = ApplicationHelper.Versao.ToString();
- this.ViewModel.Head = string.Concat(new string[] { Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", VOCÊ ESTÁ EM RELATÓRIOS DE CONTA CORRENTE | VERSÃO GESTOR ", str });
- }
-
- public void CloseButton_Click()
- {
- base.Close();
- }
-
- private void CloseSlackBar()
- {
- Thread.Sleep(3000);
- System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher;
- if (dispatcher == null)
- {
- return;
- }
- dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false)));
- }
-
- private void ContentLoad()
- {
- this.MinimizeButton.MouseEnter += new System.Windows.Input.MouseEventHandler(ExtratoWindow.TopControls_OnMouseEnter);
- this.MinimizeButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave);
- this.MaximizeButton.MouseEnter += new System.Windows.Input.MouseEventHandler(ExtratoWindow.TopControls_OnMouseEnter);
- this.MaximizeButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave);
- this.CloseButton.MouseEnter += new System.Windows.Input.MouseEventHandler(ExtratoWindow.TopControls_OnMouseEnter);
- this.CloseButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TopControls_OnMouseLeave);
- this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.DatePicker_PreviewKeyDown);
- this.InicioBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.Periodo_OnSelectedDateChanged);
- this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.DatePicker_PreviewKeyDown);
- this.FimBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.Periodo_OnSelectedDateChanged);
- }
-
- 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 void DatePicker_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
- {
- if (e.Key != Key.Return)
- {
- return;
- }
- DatePicker str = (DatePicker)sender;
- DateTime date = Funcoes.GetNetworkTime().Date;
- str.Text = date.ToString("dd/MM/yyyy");
- }
-
- private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.GerarExcel();
- }
-
- private async void GerarResultados_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(this.InicioBox.Text)))
- {
- this.InicioBox.SelectedDate = new DateTime?(DateTime.Parse(ValidationHelper.FormatDate(this.InicioBox.Text)));
- }
- if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(this.FimBox.Text)))
- {
- this.FimBox.SelectedDate = new DateTime?(DateTime.Parse(ValidationHelper.FormatDate(this.FimBox.Text)));
- }
- DateTime? selectedDate = this.InicioBox.SelectedDate;
- if (selectedDate.HasValue)
- {
- selectedDate = this.FimBox.SelectedDate;
- if (selectedDate.HasValue)
- {
- selectedDate = this.InicioBox.SelectedDate;
- DateTime? nullable = this.FimBox.SelectedDate;
- flag = (selectedDate.HasValue & nullable.HasValue ? selectedDate.GetValueOrDefault() > nullable.GetValueOrDefault() : false);
- if (!flag)
- {
- this.ProgressRing.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.IsEnabled = false;
- await this.ViewModel.GerarRelatorio();
- this.ViewModel.IsEnabled = true;
- this.ProgressRing.Visibility = System.Windows.Visibility.Collapsed;
- return;
- }
- else
- {
- await this.ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO.", "OK", "", false);
- return;
- }
- }
- }
- await this.ViewModel.ShowMessage("NECESSÁRIO PREENCHER O PERIODO INICIAL E FINAL PARA O FILTRO.", "OK", "", false);
- }
-
- [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false)]
- private static extern bool GetCursorPos(out MainWindow.Point lpPoint);
-
- [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false)]
- private static extern bool GetMonitorInfo(IntPtr hMonitor, ExtratoWindow.Monitorinfo lpmi);
-
- private async void Imprimir_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.Print();
- }
-
- [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/views/financeiro/extratowindow.xaml", UriKind.Relative));
- }
-
- public void MaximizeButton_Click()
- {
- base.WindowState = (base.WindowState == System.Windows.WindowState.Normal ? System.Windows.WindowState.Maximized : System.Windows.WindowState.Normal);
- }
-
- public void MinimizeButton_Click()
- {
- base.WindowState = System.Windows.WindowState.Minimized;
- }
-
- [DllImport("user32.dll", CharSet=CharSet.None, ExactSpelling=false, SetLastError=true)]
- private static extern IntPtr MonitorFromPoint(MainWindow.Point pt, ExtratoWindow.MonitorOptions dwFlags);
-
- protected sealed override void OnStateChanged(EventArgs e)
- {
- object obj;
- base.BorderThickness = new Thickness((double)(base.WindowState != System.Windows.WindowState.Maximized));
- System.Windows.Shell.WindowChrome windowChrome = this.WindowChrome;
- if (base.WindowState == System.Windows.WindowState.Maximized)
- {
- obj = null;
- }
- else
- {
- obj = 4;
- }
- windowChrome.ResizeBorderThickness = new Thickness((double)obj);
- this.WindowChrome.CaptionHeight = (double)((base.WindowState == System.Windows.WindowState.Maximized ? 33 : 30));
- this.ViewModel.MaximizeRestore = (base.WindowState == System.Windows.WindowState.Maximized ? Geometry.Parse((string)System.Windows.Application.Current.Resources["Restore"]) : Geometry.Parse((string)System.Windows.Application.Current.Resources["Maximize"]));
- base.OnStateChanged(e);
- }
-
- private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.LimparRelatorio();
- }
-
- 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:
- {
- ((ExtratoWindow)target).Initialized += new EventHandler(this.Window_OnInitialized);
- return;
- }
- case 2:
- {
- this.WindowChrome = (System.Windows.Shell.WindowChrome)target;
- return;
- }
- case 3:
- {
- this.MinimizeButton = (Grid)target;
- this.MinimizeButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown);
- this.MinimizeButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp);
- return;
- }
- case 4:
- {
- this.MaximizeButton = (Grid)target;
- this.MaximizeButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown);
- this.MaximizeButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp);
- return;
- }
- case 5:
- {
- this.CloseButton = (Grid)target;
- this.CloseButton.MouseLeftButtonDown += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonDown);
- this.CloseButton.MouseLeftButtonUp += new MouseButtonEventHandler(this.TopControls_OnMouseLeftButtonUp);
- return;
- }
- case 6:
- {
- this.ProgressRing = (System.Windows.Controls.ProgressBar)target;
- return;
- }
- case 7:
- {
- this.ContaBox = (System.Windows.Controls.ComboBox)target;
- return;
- }
- case 8:
- {
- this.InicioBox = (DatePicker)target;
- this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 9:
- {
- this.FimBox = (DatePicker)target;
- this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 10:
- {
- ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.GerarResultados_OnClick);
- return;
- }
- case 11:
- {
- ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.Imprimir_OnClick);
- return;
- }
- case 12:
- {
- ((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.ExportarExcel_OnClick);
- return;
- }
- case 13:
- {
- this.LancamentoGrid = (System.Windows.Controls.DataGrid)target;
- return;
- }
- case 14:
- {
- this.NaoHaDados = (TextBlock)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));
- }
-
- private static void TopControls_OnMouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
- {
- ((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray));
- Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
- if (child != null)
- {
- child.Stroke = new SolidColorBrush(Colors.White);
- }
- }
-
- private void TopControls_OnMouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
- {
- this._buttonClickable = false;
- ((Grid)sender).Background = new SolidColorBrush(Colors.Transparent);
- Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
- if (child != null)
- {
- child.Stroke = new SolidColorBrush(Colors.White);
- }
- }
-
- private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- this._buttonClickable = true;
- ((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray));
- }
-
- private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- if (this._buttonClickable)
- {
- MethodInfo method = base.GetType().GetMethod(string.Concat(((Grid)sender).Name, "_Click"));
- if (method == null)
- {
- return;
- }
- method.Invoke(this, null);
- }
- }
-
- private void Window_OnInitialized(object sender, EventArgs e)
- {
- WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this);
- windowInteropHelper.EnsureHandle();
- HwndSource hwndSource = HwndSource.FromHwnd(windowInteropHelper.Handle);
- if (hwndSource == null)
- {
- return;
- }
- hwndSource.AddHook(new HwndSourceHook(this.WindowProc));
- }
-
- private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
- {
- if (msg == 36)
- {
- this.WmGetMinMaxInfo(lParam);
- }
- return IntPtr.Zero;
- }
-
- private void WmGetMinMaxInfo(IntPtr lParam)
- {
- MainWindow.Point point;
- System.Drawing.Rectangle workingArea = Screen.FromHandle((new WindowInteropHelper(this)).Handle).WorkingArea;
- base.MaxHeight = (double)workingArea.Height;
- ExtratoWindow.GetCursorPos(out point);
- IntPtr intPtr = ExtratoWindow.MonitorFromPoint(new MainWindow.Point(0, 0), ExtratoWindow.MonitorOptions.MonitorDefaulttoprimary);
- ExtratoWindow.Monitorinfo monitorinfo = new ExtratoWindow.Monitorinfo();
- if (!ExtratoWindow.GetMonitorInfo(intPtr, monitorinfo))
- {
- return;
- }
- IntPtr intPtr1 = ExtratoWindow.MonitorFromPoint(point, ExtratoWindow.MonitorOptions.MonitorDefaulttonearest);
- ExtratoWindow.Minmaxinfo structure = (ExtratoWindow.Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(ExtratoWindow.Minmaxinfo));
- if (!intPtr.Equals(intPtr1))
- {
- structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left;
- structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top;
- structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left;
- structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top;
- }
- else
- {
- structure.ptMaxPosition.X = monitorinfo.rcWork.Left;
- structure.ptMaxPosition.Y = monitorinfo.rcWork.Top;
- structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left;
- structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top;
- }
- Marshal.StructureToPtr<ExtratoWindow.Minmaxinfo>(structure, lParam, true);
- }
-
- private struct Minmaxinfo
- {
- private readonly MainWindow.Point ptReserved;
-
- public ExtratoWindow.Point ptMaxSize;
-
- public ExtratoWindow.Point ptMaxPosition;
-
- private readonly MainWindow.Point ptMinTrackSize;
-
- private readonly MainWindow.Point ptMaxTrackSize;
- }
-
- private class Monitorinfo
- {
- private readonly int cbSize;
-
- public readonly ExtratoWindow.Rect rcMonitor;
-
- public readonly ExtratoWindow.Rect rcWork;
-
- private readonly int dwFlags;
-
- public Monitorinfo()
- {
- }
- }
-
- private enum MonitorOptions : uint
- {
- MonitorDefaulttoprimary = 1,
- MonitorDefaulttonearest = 2
- }
-
- public struct Point
- {
- public int X;
-
- public int Y;
-
- public Point(int x, int y)
- {
- this.X = x;
- this.Y = y;
- }
- }
-
- public struct Rect
- {
- public int Left;
-
- public int Top;
-
- public int Right;
-
- public int Bottom;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/FinanceiroView.cs b/Gestor.Application/Views/Financeiro/FinanceiroView.cs
deleted file mode 100644
index 431e1d1..0000000
--- a/Gestor.Application/Views/Financeiro/FinanceiroView.cs
+++ /dev/null
@@ -1,1560 +0,0 @@
-using Gestor.Application.Actions;
-using Gestor.Application.Drawers;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-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.Reflection;
-using System.Runtime.CompilerServices;
-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 Xceed.Wpf.AvalonDock.Controls;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class FinanceiroView : BaseUserControl, IComponentConnector, IStyleConnector
- {
- private bool _selecionando;
-
- private List<ListSortDirection?> _sortDirections;
-
- private List<SortDescription> _sortDescriptions;
-
- internal AutoCompleteBox AutoCompleteFornecedor;
-
- internal MenuItem MenuFiltros;
-
- internal Grid GridFiltros;
-
- internal DataGrid LancamentoGrid;
-
- internal AutoCompleteBox AutoCompleteFornecedorInclusao;
-
- private bool _contentLoaded;
-
- private string OriginalValue
- {
- get;
- set;
- }
-
- private TipoPagamento? tipoPagamento
- {
- get;
- set;
- }
-
- public FinanceiroViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public FinanceiroView()
- {
- base.Tag = "CONSULTA DE FINANÇAS";
- this.ViewModel = new FinanceiroViewModel();
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- Gestor.Application.Actions.Actions.SortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SortLancamentos, new Action(this.SortLancamentos));
- Gestor.Application.Actions.Actions.SaveSortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SaveSortLancamentos, new Action(this.SaveSortLancamentos));
- }
-
- private async void AbrirLancamento(Lancamento lancamento)
- {
- if (this.ViewModel.SelectedLancamento == null)
- {
- await this.ViewModel.ShowMessage("SELECIONE UM LANCAMENTO ANTES DE PROSSEGUIR", "OK", "", false);
- }
- else if (lancamento.get_Id() <= (long)0 || lancamento.get_Controle().get_Plano() != null)
- {
- this.ViewModel.SelectedLancamento = lancamento;
- this.ViewModel.VencimentoAlterado = false;
- this.ViewModel.VencimentoAnt = this.ViewModel.SelectedLancamento.get_Vencimento();
- if (lancamento.get_Id() <= (long)0)
- {
- this.ViewModel.FiltrarLancamento(lancamento);
- }
- else
- {
- this.ViewModel.FiltrarLancamento(lancamento.get_Id());
- }
- this.ViewModel.Alterando = System.Windows.Visibility.Visible;
- this.ViewModel.BuscaHabilitada = false;
- this.ValidarLancamento();
- }
- }
-
- private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLog(25, this.ViewModel.SelectedLancamento.get_Id());
- }
-
- private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLogEmail(25, this.ViewModel.SelectedLancamento.get_Id());
- }
-
- private async Task AbrirVinculo()
- {
- Lancamento lancamento;
- if (this.ViewModel.LancamentosVinculo.Count != 0)
- {
- lancamento = await this.ViewModel.ShowVinculo(this.ViewModel);
- if (lancamento != null)
- {
- if (!await this.ViewModel.ShowMessage(string.Format("DESEJA VINCULAR O LANÇAMENTO {0} A MOVIMENTAÇÃO SELECIONADA?", this.ViewModel.LancamentoVinculo.get_Id()), "SIM", "NÃO", false))
- {
- await this.AbrirVinculo();
- }
- this.ViewModel.FeedImportando(lancamento);
- this.ViewModel.BindImportando();
- }
- }
- else
- {
- await this.ViewModel.ShowMessage("NÃO HÁ LANÇAMENTOS CRIADOS PARA O FORNECEDOR SELECIONADO.", "OK", "", false);
- }
- lancamento = null;
- }
-
- private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AdcionarFiltroPersonalizado();
- }
-
- private void AdicionarFiltros_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.LimparFiltros();
- this.ViewModel.AdicionarFiltros();
- this.ViewModel.IsExpanded = !this.ViewModel.IsExpanded;
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- Lancamento dataContext = (Lancamento)((Button)sender).DataContext;
- this.ViewModel.VisibilityFornecedor = (this.ViewModel.Importando ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
- this.ViewModel.BotaoSalvarVisibility = (this.ViewModel.Importando ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible);
- this.AbrirLancamento(dataContext);
- this.ViewModel.Loading(false);
- }
-
- private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e)
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 9).get_Consultar())
- {
- FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital();
- filtroArquivoDigital.set_Id(this.ViewModel.SelectedLancamento.get_Id());
- filtroArquivoDigital.set_Tipo(9);
- filtroArquivoDigital.set_Parente(this.ViewModel.SelectedLancamento);
- 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)9), "."), "OK", "", false);
- }
- }
-
- private void AutoCompleteBoxDetalhe_Populating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.FiltroPersonalizadoTask(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Gestor.Model.Domain.Financeiro.FiltroPersonalizado>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarFornecedor(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Fornecedor>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteFornecedorAtivo_OnPopulating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.BuscarFornecedorAtivo(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Fornecedor>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteLancamento_OnPopulating(object sender, PopulatingEventArgs e)
- {
- if (e.get_Parameter().Length < 3)
- {
- return;
- }
- e.set_Cancel(true);
- this.ViewModel.FiltrarLancamento(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<List<Lancamento>> searchResult) => {
- if (searchResult.Result == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void AutoCompleteLancamento_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.Filtrar("");
- }
-
- private void Baixados_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedStatusImportacao = 1;
- this.ViewModel.FiltroImportacao();
- }
-
- private async void Buscar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.Buscar();
- this.ViewModel.Loading(false);
- }
-
- private async void BuscarLancamentos_Click(object sender, RoutedEventArgs e)
- {
- if (this.ViewModel.FornecedorInclusao == null || this.ViewModel.FornecedorInclusao.get_Id() == 0)
- {
- await this.ViewModel.ShowMessage("É NECESSÁRIO PESQUISAR O FORNECEDOR AO LADO PARA VINCULAR UM LANÇAMENTO A ESSA MOVIMENTAÇÃO.", "OK", "", false);
- }
- else
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.BuscarLancamentosVinculo();
- this.ViewModel.Loading(false);
- await this.AbrirVinculo();
- }
- }
-
- private void CancelarAlteracao_OnClick(object sender, RoutedEventArgs e)
- {
- this.AutoCompleteFornecedorInclusao.set_Text(string.Empty);
- this.ViewModel.Alterando = System.Windows.Visibility.Collapsed;
- this.ViewModel.BuscaHabilitada = true;
- this.ViewModel.CancelarAlteracao();
- this.ViewModel.EnableIncluirNovo = false;
- }
-
- private async void CancelarImportacao_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Loading(true);
- this.ViewModel.Importando = false;
- await this.ViewModel.Buscar();
- this.ViewModel.Loading(false);
- }
-
- private void CheckBox_Checked(object sender, RoutedEventArgs e)
- {
- if (this._selecionando)
- {
- return;
- }
- this._selecionando = true;
- ((CheckBox)sender).IsChecked = new bool?(false);
- this.ViewModel.SelecionarTodos();
- this._selecionando = false;
- }
-
- private void CheckBoxFiltros_Checked(object sender, RoutedEventArgs e)
- {
- string name = ((CheckBox)sender).Name;
- if (name == "GridPlanos")
- {
- this.ViewModel.PlanosFiltro.ForEach((Planos x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.PlanosFiltro = new List<Planos>(this.ViewModel.PlanosFiltro);
- return;
- }
- if (name == "GridCentro")
- {
- this.ViewModel.CentroFiltro.ForEach((Centro x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.CentroFiltro = new List<Centro>(this.ViewModel.CentroFiltro);
- return;
- }
- if (name != "GridConta")
- {
- return;
- }
- this.ViewModel.ContaFiltro.ForEach((BancosContas x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.ContaFiltro = new List<BancosContas>(this.ViewModel.ContaFiltro);
- }
-
- private async void DataGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
- {
- string sortMemberPath;
- DateTime vencimento;
- DateTime? nullable;
- string str;
- DateTime? nullable1;
- DateTime? nullable2;
- string shortDateString;
- string text;
- TextBox editingElement;
- if (e.EditingElement is TextBox)
- {
- editingElement = e.EditingElement as TextBox;
- bool flag = true;
- string stringFormat = e.Column.ClipboardContentBinding.StringFormat;
- if (stringFormat == "d")
- {
- if (editingElement != null)
- {
- TextBox textBox = editingElement;
- if (string.IsNullOrEmpty(editingElement.Text))
- {
- str = null;
- }
- else
- {
- str = ValidationHelper.FormatDate(editingElement.Text);
- }
- textBox.Text = str;
- if (e.Column.SortMemberPath == "Vencimento" && string.IsNullOrWhiteSpace(editingElement.Text))
- {
- TextBox shortDateString1 = editingElement;
- vencimento = this.ViewModel.SelectedLancamento.get_Vencimento();
- shortDateString1.Text = vencimento.ToShortDateString();
- await this.ViewModel.ShowMessage("VENCIMENTO NÃO PODE SER EM BRANCO", "OK", "", false);
- editingElement = null;
- return;
- }
- else if (string.IsNullOrWhiteSpace(editingElement.Text) || ValidationHelper.ValidateDate(editingElement.Text))
- {
- sortMemberPath = e.Column.SortMemberPath;
- if (sortMemberPath != "Baixa")
- {
- if (sortMemberPath == "Pagamento")
- {
- if (this.OriginalValue != editingElement.Text)
- {
- if (!await this.ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO", false))
- {
- flag = false;
- }
- foreach (Lancamento lancamento in this.LancamentoGrid.Items.Cast<Lancamento>())
- {
- if (!(lancamento.get_Id() == ((Lancamento)this.LancamentoGrid.SelectedItem).get_Id() | flag))
- {
- continue;
- }
- Lancamento lancamento1 = lancamento;
- if (string.IsNullOrEmpty(editingElement.Text))
- {
- nullable = null;
- nullable2 = nullable;
- }
- else
- {
- nullable2 = new DateTime?(DateTime.Parse(editingElement.Text));
- }
- lancamento1.set_Pagamento(nullable2);
- }
- this.LancamentoGrid.Items.Refresh();
- }
- else
- {
- editingElement = null;
- return;
- }
- }
- }
- else if (this.OriginalValue != editingElement.Text)
- {
- if (!await this.ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO", false))
- {
- flag = false;
- }
- foreach (Lancamento lancamento2 in this.LancamentoGrid.Items.Cast<Lancamento>())
- {
- if (!(lancamento2.get_Id() == ((Lancamento)this.LancamentoGrid.SelectedItem).get_Id() | flag))
- {
- continue;
- }
- Lancamento lancamento3 = lancamento2;
- if (string.IsNullOrEmpty(editingElement.Text))
- {
- nullable = null;
- nullable1 = nullable;
- }
- else
- {
- nullable1 = new DateTime?(DateTime.Parse(editingElement.Text));
- }
- lancamento3.set_Baixa(nullable1);
- }
- this.LancamentoGrid.Items.Refresh();
- }
- else
- {
- editingElement = null;
- return;
- }
- }
- else
- {
- TextBox textBox1 = editingElement;
- if (e.Column.SortMemberPath == "Vencimento")
- {
- vencimento = this.ViewModel.SelectedLancamento.get_Vencimento();
- shortDateString = vencimento.ToShortDateString();
- }
- else
- {
- shortDateString = null;
- }
- textBox1.Text = shortDateString;
- await this.ViewModel.ShowMessage("DATA INVÁLIDA", "OK", "", false);
- editingElement = null;
- return;
- }
- }
- else
- {
- editingElement = null;
- return;
- }
- }
- else if (stringFormat != "c")
- {
- TextBox textBox2 = editingElement;
- if (textBox2 != null)
- {
- text = textBox2.Text;
- }
- else
- {
- text = null;
- }
- if (!string.IsNullOrEmpty(text))
- {
- sortMemberPath = e.Column.SortMemberPath;
- if (sortMemberPath != "Documento")
- {
- if (sortMemberPath != "Competencia")
- {
- if (sortMemberPath == "Complemento")
- {
- if (editingElement.Text.Length > 15)
- {
- editingElement.Text = "";
- await this.ViewModel.ShowMessage("LIMITE DE CARACTERES: 15", "OK", "", false);
- }
- else
- {
- editingElement = null;
- return;
- }
- }
- }
- else if (editingElement.Text.Length > 7)
- {
- editingElement.Text = "";
- await this.ViewModel.ShowMessage("LIMITE DE CARACTERES: 7", "OK", "", false);
- }
- else
- {
- editingElement.Text = ValidationHelper.FormatCompetencia(editingElement.Text);
- editingElement = null;
- return;
- }
- }
- else if (editingElement.Text.Length > 50)
- {
- editingElement.Text = string.Empty;
- await this.ViewModel.ShowMessage("LIMITE DE CARACTERES: 50", "OK", "", false);
- }
- else if (this.OriginalValue != editingElement.Text)
- {
- if (!await this.ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO", false))
- {
- flag = false;
- }
- foreach (Lancamento lancamento4 in this.LancamentoGrid.Items.Cast<Lancamento>())
- {
- if (!(lancamento4.get_Id() == ((Lancamento)this.LancamentoGrid.SelectedItem).get_Id() | flag))
- {
- continue;
- }
- lancamento4.set_Documento(editingElement.Text);
- }
- this.LancamentoGrid.Items.Refresh();
- editingElement = null;
- return;
- }
- else
- {
- editingElement = null;
- return;
- }
- }
- }
- else if (editingElement != null)
- {
- editingElement.Text = ValidationHelper.FormatCurrency(editingElement.Text);
- }
- }
- editingElement = null;
- }
-
- public new void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
- {
- DatePicker datePicker = (DatePicker)sender;
- datePicker.Text = ValidationHelper.FormatDate(datePicker.Text);
- }
-
- private new void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key != Key.Return)
- {
- return;
- }
- DatePicker str = (DatePicker)sender;
- DateTime date = Funcoes.GetNetworkTime().Date;
- str.Text = date.ToString("dd/MM/yyyy");
- }
-
- private void EsconderFiltros_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.VisibleFiltros = System.Windows.Visibility.Collapsed;
- this.ViewModel.VisibleOlho = System.Windows.Visibility.Visible;
- }
-
- private async void Excluir_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.Excluir();
- this.ViewModel.Alterando = System.Windows.Visibility.Collapsed;
- this.ViewModel.BuscaHabilitada = true;
- this.ViewModel.CancelarAlteracao();
- }
-
- private async void ExcluirBaixa_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ExcluirBaixa();
- }
-
- private async void ExcluirBaixaRange_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ExcluirBaixaRange();
- }
-
- private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e)
- {
- Chip chip = sender as Chip;
- if (chip == null)
- {
- return;
- }
- ListBox listBox = Extentions.FindVisualAncestor<ListBox>(chip);
- Gestor.Model.Domain.Relatorios.FiltroPersonalizado item = (Gestor.Model.Domain.Relatorios.FiltroPersonalizado)listBox.Items[listBox.Items.IndexOf(chip.DataContext)];
- if (item == null)
- {
- return;
- }
- this.ViewModel.PersonalizadoSelecionado.Remove(item);
- this.ViewModel.PesquisaPersonalizada();
- }
-
- private void ExcluirFiltro_onDeleteClick(object sender, RoutedEventArgs e)
- {
- Chip chip = sender as Chip;
- if (chip == null)
- {
- return;
- }
- ListBox listBox = Extentions.FindVisualAncestor<ListBox>(chip);
- Gestor.Model.Domain.Financeiro.FiltroPersonalizado item = (Gestor.Model.Domain.Financeiro.FiltroPersonalizado)listBox.Items[listBox.Items.IndexOf(chip.DataContext)];
- if (item == null)
- {
- return;
- }
- this.ViewModel.ExcluirFiltro(item);
- }
-
- private async void ExcluirRange_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.ExcluirRange();
- }
-
- private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e)
- {
- List<Lancamento> list = this.LancamentoGrid.Items.Cast<Lancamento>().ToList<Lancamento>();
- await this.ViewModel.GerarExcel(list);
- }
-
- private void ExtratoConta_OnClick(object sender, RoutedEventArgs e)
- {
- Button button = (Button)sender;
- if (button == null || button.DataContext == null)
- {
- return;
- }
- (new ExtratoWindow(((Saldo)button.DataContext).get_Conta().get_Id())).Show();
- }
-
- private void Fechar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IsExpanded = !this.ViewModel.IsExpanded;
- }
-
- private void Filtrar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IsExpanded = !this.ViewModel.IsExpanded;
- }
-
- private void FiltroDetalhes_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- if (autoCompleteBox == null || autoCompleteBox.get_SelectedItem() == null)
- {
- return;
- }
- if (!autoCompleteBox.get_IsDropDownOpen())
- {
- return;
- }
- this.ViewModel.AdicionarFiltro((Gestor.Model.Domain.Financeiro.FiltroPersonalizado)autoCompleteBox.get_SelectedItem());
- autoCompleteBox.set_Text(string.Empty);
- }
-
- private async Task ImportarOfx()
- {
- BancosContas bancosConta;
- if (this.ViewModel.ContasFiltradas == null || this.ViewModel.ContasFiltradas.Count == 0)
- {
- await this.ViewModel.ShowMessage("NÃO HÁ CONTAS CADASTRADAS PARA REALIZAR A IMPORTAÇÃO.", "OK", "", false);
- }
- else
- {
- if (this.ViewModel.ContasFiltradas.Count <= 1)
- {
- bancosConta = this.ViewModel.ContasFiltradas.First<BancosContas>();
- }
- else
- {
- bancosConta = await this.ViewModel.ShowContas(this.ViewModel.ContasFiltradas.ToList<BancosContas>());
- }
- BancosContas bancosConta1 = bancosConta;
- if (bancosConta1 != null)
- {
- this.ViewModel.Loading(true);
- await this.ViewModel.ParseOfx(bancosConta1);
- this.ViewModel.Loading(false);
- }
- }
- }
-
- private async void ImportarOfx_Click(object sender, RoutedEventArgs e)
- {
- await this.ImportarOfx();
- }
-
- private async void Imprimir_OnClick(object sender, RoutedEventArgs e)
- {
- List<Lancamento> list = this.LancamentoGrid.Items.Cast<Lancamento>().ToList<Lancamento>();
- if (await this.ViewModel.ShowMessage("DESEJA CONTINUAR COM A IMPRESSÃO?", "SIM", "NÃO", false))
- {
- bool flag = await this.ViewModel.ShowMessage("EM QUAL POSIÇÂO DESEJA IMPRIMIR?", "PAISAGEM (horizontal)", "RETRATO (vertical)", false);
- await this.ViewModel.Print(list, flag);
- }
- list = null;
- }
-
- private void Incluir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IncluirLancamento();
- this.ViewModel.IdLancamento = (long)0;
- this.ValidarLancamento();
- }
-
- private void IncluirParcela_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IncluirParcela();
- this.ValidarLancamento();
- }
-
- [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/views/financeiro/financeiroview.xaml", UriKind.Relative));
- }
-
- private void LancamentoGrid_OnPreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
- {
- if (e.Column.GetType().Name != "DataGridTextColumn")
- {
- this.LancamentoGrid.CancelEdit();
- this.LancamentoGrid.CancelEdit();
- }
- TextBox editingElement = e.EditingElement as TextBox;
- if (editingElement != null)
- {
- this.OriginalValue = editingElement.Text;
- }
- }
-
- private void LimparFiltros_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.LimparFiltros();
- this.ViewModel.FiltrarPersonalizado();
- }
-
- private void MostrarFiltros_Click(object sender, RoutedEventArgs e)
- {
- MenuItem menuItem = (MenuItem)sender;
- this.GridFiltros.Visibility = (this.GridFiltros.Visibility == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
- menuItem.Header = (this.GridFiltros.Visibility == System.Windows.Visibility.Collapsed ? "MOSTRAR FILTROS" : "ESCONDER FILTROS");
- }
-
- private void MostrarFiltros_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.VisibleFiltros = System.Windows.Visibility.Visible;
- this.ViewModel.VisibleOlho = System.Windows.Visibility.Collapsed;
- }
-
- private void OnChecked_OnHandler(object sender, RoutedEventArgs e)
- {
- DataGridCell dataGridCell = (DataGridCell)sender;
- if (this.LancamentoGrid.SelectedItem == null)
- {
- return;
- }
- Lancamento dataContext = dataGridCell.DataContext as Lancamento;
- if (dataContext != null)
- {
- if (dataContext.get_Selecionado())
- {
- return;
- }
- this.ViewModel.SelecionarLancamento(dataContext);
- this.LancamentoGrid.CommitEdit();
- this.LancamentoGrid.CommitEdit();
- CollectionViewSource.GetDefaultView(this.LancamentoGrid.ItemsSource).Refresh();
- }
- }
-
- private void Pendentes_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedStatusImportacao = 0;
- this.ViewModel.FiltroImportacao();
- }
-
- private void Saldos_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- if (this.ViewModel.SelectedSaldo == null)
- {
- return;
- }
- string str = string.Concat("INFORMAÇÕES DO EXTRATO - ", this.ViewModel.SelectedSaldo.get_Conta().get_Descricao());
- Window window = Funcoes.IsHosterOpen(str);
- if (window == null)
- {
- (new HosterWindow(new InfoExtratoView(this.ViewModel.SelectedSaldo, false), str, new double?((double)800), new double?((double)450), true)).Show();
- return;
- }
- window.WindowState = (window.WindowState == WindowState.Minimized ? WindowState.Maximized : window.WindowState);
- window.Activate();
- }
-
- private async Task Salvar(bool fechar)
- {
- bool flag;
- bool flag1;
- DatePickerTextBox focusedElement = Keyboard.FocusedElement as DatePickerTextBox;
- if (focusedElement != null)
- {
- ((DatePicker)focusedElement.TemplatedParent).SelectedDate = new DateTime?(ValidationHelper.ToDateTime(ValidationHelper.FormatDate(focusedElement.Text)));
- DateTime? selectedDate = ((DatePicker)focusedElement.TemplatedParent).SelectedDate;
- if (selectedDate.ToString() == "01/01/0001 00:00:00")
- {
- selectedDate = null;
- ((DatePicker)focusedElement.TemplatedParent).SelectedDate = selectedDate;
- }
- }
- flag = (!this.ViewModel.Importando ? false : this.ViewModel.Parcelas > 1);
- bool flag2 = flag;
- if (flag2)
- {
- flag2 = !await this.ViewModel.ShowMessage(string.Format("SERÁ CRIADO COM {0} PARCELAS, INICIADO POR ESSE LANÇAMENTO, DESEJA PROSSEGUIR?", this.ViewModel.Parcelas), "SIM", "NÃO", false);
- }
- if (!flag2)
- {
- this.ViewModel.Loading(true);
- if (!this.ViewModel.Importando)
- {
- this.ViewModel.Bind();
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- flag1 = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag1)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- else if (!fechar)
- {
- Fornecedor fornecedorInclusao = this.ViewModel.FornecedorInclusao;
- string historico = this.ViewModel.Historico;
- string documento = this.ViewModel.Documento;
- string competencia = this.ViewModel.Competencia;
- string complemento = this.ViewModel.Complemento;
- Planos plano = this.ViewModel.Plano;
- Centro centro = this.ViewModel.Centro;
- BancosContas conta = this.ViewModel.Conta;
- Sinal sinal = this.ViewModel.Sinal;
- int parcelas = this.ViewModel.Parcelas;
- int parcela = this.ViewModel.Parcela;
- DateTime vencimento = this.ViewModel.Vencimento;
- decimal valor = this.ViewModel.Valor;
- DateTime? baixa = this.ViewModel.Baixa;
- decimal? valorPago = this.ViewModel.ValorPago;
- DateTime? pagamento = this.ViewModel.Pagamento;
- TipoPagamento tipoPagamento = this.ViewModel.TipoPagamento;
- string observacao = this.ViewModel.Observacao;
- this.ViewModel.FornecedorInclusao = fornecedorInclusao;
- this.ViewModel.Historico = historico;
- this.ViewModel.Documento = documento;
- this.ViewModel.Competencia = competencia;
- this.ViewModel.Complemento = complemento;
- this.ViewModel.Plano = plano;
- this.ViewModel.Centro = centro;
- this.ViewModel.Conta = conta;
- this.ViewModel.Sinal = sinal;
- this.ViewModel.Parcelas = parcelas;
- this.ViewModel.Parcela = parcela;
- this.ViewModel.Vencimento = vencimento;
- this.ViewModel.Valor = valor;
- this.ViewModel.Baixa = baixa;
- this.ViewModel.ValorPago = valorPago;
- this.ViewModel.Pagamento = pagamento;
- this.ViewModel.TipoPagamento = tipoPagamento;
- this.ViewModel.Observacao = observacao;
- this.ViewModel.EnableIncluirNovo = true;
- }
- else
- {
- this.AutoCompleteFornecedorInclusao.set_Text(string.Empty);
- this.ViewModel.Alterando = System.Windows.Visibility.Collapsed;
- this.ViewModel.BuscaHabilitada = true;
- await this.ViewModel.Buscar();
- }
- }
- else
- {
- this.ViewModel.BindImportando();
- List<KeyValuePair<string, string>> keyValuePairs1 = this.ViewModel.SelectedLancamento.Validate();
- if (keyValuePairs1 == null)
- {
- keyValuePairs1 = new List<KeyValuePair<string, string>>();
- }
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- if (keyValuePairs2.Count <= 0)
- {
- this.ViewModel.LancamentosFiltrados = this.ViewModel.Lancamentos;
- this.AutoCompleteFornecedorInclusao.set_Text(string.Empty);
- this.ViewModel.Alterando = System.Windows.Visibility.Collapsed;
- this.ViewModel.BuscaHabilitada = true;
- this.ViewModel.Loading(false);
- }
- else
- {
- this.ViewModel.Loading(false);
- await this.ViewModel.ShowMessage(keyValuePairs2, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
- }
- }
-
- private async void SalvarImportacao_Click(object sender, RoutedEventArgs e)
- {
- if (await this.ViewModel.ShowMessage(string.Concat("DESEJA PROSSEGUIR COM A IMPORTAÇÃO?", Environment.NewLine, Environment.NewLine, "SOMENTE OS LANÇAMENTOS VÁLIDOS SERÃO ALTERADOS OU INCLUÍDOS"), "SIM", "NÃO", false))
- {
- this.ViewModel.Loading(true);
- ObservableCollection<Lancamento> lancamentos = this.ViewModel.Lancamentos;
- List<Lancamento> list = (
- from x in lancamentos
- where x.Validate().Count == 0
- select x).ToList<Lancamento>();
- if (await this.ViewModel.SalvarImportacao(list))
- {
- this.ViewModel.Importando = false;
- }
- this.ViewModel.Loading(false);
- }
- }
-
- private async void SalvarInclusao_Click(object sender, RoutedEventArgs e)
- {
- await this.Salvar(false);
- }
-
- private async void SalvarLancamento_OnClick(object sender, RoutedEventArgs e)
- {
- await this.Salvar(true);
- }
-
- private async void SalvarRange_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.Atualizar(this.LancamentoGrid.Items.Cast<Lancamento>().ToList<Lancamento>());
- this.LancamentoGrid.CommitEdit();
- this.LancamentoGrid.CommitEdit();
- CollectionViewSource.GetDefaultView(this.LancamentoGrid.ItemsSource).Refresh();
- }
-
- public void SaveSortLancamentos()
- {
- this._sortDirections = new List<ListSortDirection?>();
- this._sortDescriptions = new List<SortDescription>();
- foreach (DataGridColumn column in this.LancamentoGrid.Columns)
- {
- this._sortDirections.Add(column.SortDirection);
- }
- foreach (SortDescription sortDescription in this.LancamentoGrid.Items.SortDescriptions)
- {
- this._sortDescriptions.Add(sortDescription);
- }
- }
-
- private void Sintetizar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Sintetizar();
- }
-
- public void SortLancamentos()
- {
- if (this._sortDirections == null || this._sortDirections.Count != this.LancamentoGrid.Columns.Count)
- {
- return;
- }
- foreach (DataGridColumn column in this.LancamentoGrid.Columns)
- {
- column.SortDirection = this._sortDirections[this.LancamentoGrid.Columns.IndexOf(column)];
- }
- this.LancamentoGrid.Items.SortDescriptions.Clear();
- foreach (SortDescription _sortDescription in this._sortDescriptions)
- {
- this.LancamentoGrid.Items.SortDescriptions.Add(_sortDescription);
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(this.TipoFiltrosBox_OnSelectionChanged);
- return;
- }
- case 2:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 3:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 4:
- {
- this.AutoCompleteFornecedor = (AutoCompleteBox)target;
- this.AutoCompleteFornecedor.add_Populating(new PopulatingEventHandler(this, FinanceiroView.AutoCompleteFornecedor_OnPopulating));
- return;
- }
- case 5:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, FinanceiroView.AutoCompleteBoxDetalhe_Populating));
- ((AutoCompleteBox)target).add_SelectionChanged(new SelectionChangedEventHandler(this.FiltroDetalhes_OnSelectionChanged));
- return;
- }
- case 6:
- {
- ((Button)target).Click += new RoutedEventHandler(this.MostrarFiltros_OnClick);
- return;
- }
- case 7:
- {
- this.MenuFiltros = (MenuItem)target;
- this.MenuFiltros.Click += new RoutedEventHandler(this.MostrarFiltros_Click);
- return;
- }
- case 8:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Pendentes_Click);
- return;
- }
- case 9:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Baixados_Click);
- return;
- }
- case 10:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Todos_Click);
- return;
- }
- case 11:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarImportacao_Click);
- return;
- }
- case 12:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.CancelarImportacao_Click);
- return;
- }
- case 13:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Buscar_OnClick);
- return;
- }
- case 14:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Imprimir_OnClick);
- return;
- }
- case 15:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExportarExcel_OnClick);
- return;
- }
- case 16:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Sintetizar_OnClick);
- return;
- }
- case 17:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.TrocarFornecedor_OnClick);
- return;
- }
- case 18:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarRange_OnClick);
- return;
- }
- case 19:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 20:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirParcela_OnClick);
- return;
- }
- case 21:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirBaixaRange_OnClick);
- return;
- }
- case 22:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirRange_OnClick);
- return;
- }
- case 23:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Transferir_OnClick);
- return;
- }
- case 24:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
- return;
- }
- case 25:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick);
- return;
- }
- case 26:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ImportarOfx_Click);
- return;
- }
- case 27:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Filtrar_OnClick);
- return;
- }
- case 28:
- {
- this.GridFiltros = (Grid)target;
- return;
- }
- case 29:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 30:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 31:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AdicionarFiltro_OnClick);
- return;
- }
- case 32:
- case 33:
- case 37:
- case 38:
- case 39:
- case 40:
- case 41:
- case 44:
- case 45:
- case 46:
- case 60:
- {
- this._contentLoaded = true;
- return;
- }
- case 34:
- {
- ((Button)target).Click += new RoutedEventHandler(this.LimparFiltros_OnClick);
- return;
- }
- case 35:
- {
- ((Button)target).Click += new RoutedEventHandler(this.EsconderFiltros_OnClick);
- return;
- }
- case 36:
- {
- this.LancamentoGrid = (DataGrid)target;
- this.LancamentoGrid.CellEditEnding += new EventHandler<DataGridCellEditEndingEventArgs>(this.DataGrid_OnCellEditEnding);
- this.LancamentoGrid.PreparingCellForEdit += new EventHandler<DataGridPreparingCellForEditEventArgs>(this.LancamentoGrid_OnPreparingCellForEdit);
- return;
- }
- case 42:
- {
- ((Button)target).Click += new RoutedEventHandler(this.AdicionarFiltros_OnClick);
- return;
- }
- case 43:
- {
- ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick);
- return;
- }
- case 47:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 48:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarInclusao_Click);
- return;
- }
- case 49:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarLancamento_OnClick);
- return;
- }
- case 50:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.CancelarAlteracao_OnClick);
- return;
- }
- case 51:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExcluirBaixa_OnClick);
- return;
- }
- case 52:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick);
- return;
- }
- case 53:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ArquivoDigital_OnClick);
- return;
- }
- case 54:
- {
- this.AutoCompleteFornecedorInclusao = (AutoCompleteBox)target;
- this.AutoCompleteFornecedorInclusao.add_Populating(new PopulatingEventHandler(this, FinanceiroView.AutoCompleteFornecedorAtivo_OnPopulating));
- return;
- }
- case 55:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.BuscarLancamentos_Click);
- return;
- }
- case 56:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 57:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 58:
- {
- ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 59:
- {
- ((DataGrid)target).MouseDoubleClick += new MouseButtonEventHandler(this.Saldos_OnMouseDoubleClick);
- return;
- }
- case 61:
- {
- ((DataGrid)target).CellEditEnding += new EventHandler<DataGridCellEditEndingEventArgs>(this.DataGrid_OnCellEditEnding);
- 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 32:
- {
- ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirFiltro_OnClick));
- return;
- }
- case 33:
- {
- ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirFiltro_onDeleteClick));
- return;
- }
- case 34:
- case 35:
- case 36:
- case 42:
- case 43:
- {
- return;
- }
- case 37:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
- return;
- }
- case 38:
- {
- EventSetter eventSetter = new EventSetter()
- {
- Event = ToggleButton.CheckedEvent,
- Handler = new RoutedEventHandler(this.OnChecked_OnHandler)
- };
- ((System.Windows.Style)target).Setters.Add(eventSetter);
- eventSetter = new EventSetter()
- {
- Event = ToggleButton.UncheckedEvent,
- Handler = new RoutedEventHandler(this.Unchecked_OnHandler)
- };
- ((System.Windows.Style)target).Setters.Add(eventSetter);
- return;
- }
- case 39:
- {
- ((Button)target).Click += new RoutedEventHandler(this.ArquivoDigital_OnClick);
- return;
- }
- case 40:
- {
- ((Button)target).Click += new RoutedEventHandler(this.Alterar_OnClick);
- return;
- }
- case 41:
- {
- ((ComboBox)target).DropDownOpened += new EventHandler(this.TipoPagamento_DropDownOpened);
- ((ComboBox)target).DropDownClosed += new EventHandler(this.TipoPagamento_OnDropDownClosed);
- return;
- }
- case 44:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- return;
- }
- case 45:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- return;
- }
- case 46:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBoxFiltros_Checked);
- return;
- }
- default:
- {
- if (connectionId != 60)
- {
- return;
- }
- ((Button)target).Click += new RoutedEventHandler(this.ExtratoConta_OnClick);
- return;
- }
- }
- }
-
- private void TipoFiltrosBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- ComboBox comboBox = (ComboBox)sender;
- if (comboBox == null || comboBox.SelectedItem == null)
- {
- return;
- }
- this.ViewModel.IsvisibleStatus = System.Windows.Visibility.Visible;
- this.ViewModel.IsVisibleData = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsVisibleFornecedor = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsVisiblePersonalizado = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsVisibleFiltros = System.Windows.Visibility.Visible;
- this.ViewModel.LimparFiltros();
- this.ViewModel.SelectedFornecedor = null;
- if (this.AutoCompleteFornecedor != null)
- {
- this.AutoCompleteFornecedor.set_Text(string.Empty);
- }
- this.ViewModel.DropDownHeight = 0;
- switch ((FiltroLancamento)comboBox.SelectedItem)
- {
- case 1:
- case 2:
- {
- this.ViewModel.IsvisibleStatus = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsVisibleData = System.Windows.Visibility.Visible;
- return;
- }
- case 3:
- {
- this.ViewModel.IsVisibleFornecedor = System.Windows.Visibility.Visible;
- return;
- }
- case 5:
- {
- this.ViewModel.IsVisiblePersonalizado = System.Windows.Visibility.Visible;
- this.ViewModel.IsVisibleFiltros = System.Windows.Visibility.Collapsed;
- this.GridFiltros.Visibility = System.Windows.Visibility.Collapsed;
- this.MenuFiltros.Header = "MOSTRAR FILTROS";
- this.ViewModel.IsVisibleData = System.Windows.Visibility.Visible;
- this.ViewModel.DropDownHeight = 200;
- return;
- }
- default:
- {
- this.ViewModel.IsVisibleData = System.Windows.Visibility.Visible;
- return;
- }
- }
- }
-
- private void TipoPagamento_DropDownOpened(object sender, EventArgs e)
- {
- if (((ComboBox)sender).SelectedItem == null)
- {
- this.tipoPagamento = null;
- return;
- }
- this.tipoPagamento = new TipoPagamento?((TipoPagamento)((ComboBox)sender).SelectedItem);
- }
-
- private async void TipoPagamento_OnDropDownClosed(object sender, EventArgs e)
- {
- TipoPagamento? nullable = this.tipoPagamento;
- TipoPagamento selectedItem = (TipoPagamento)((ComboBox)sender).SelectedItem;
- if (nullable.GetValueOrDefault() == selectedItem & nullable.HasValue)
- {
- nullable = null;
- this.tipoPagamento = nullable;
- }
- else if (await this.ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO", false))
- {
- nullable = null;
- this.tipoPagamento = nullable;
- foreach (Lancamento lancamento in this.LancamentoGrid.Items.Cast<Lancamento>())
- {
- lancamento.set_TipoPagamento((TipoPagamento)((ComboBox)sender).SelectedItem);
- }
- this.LancamentoGrid.CommitEdit();
- this.LancamentoGrid.CommitEdit();
- this.LancamentoGrid.Items.Refresh();
- }
- }
-
- private void Todos_Click(object sender, RoutedEventArgs e)
- {
- this.ViewModel.SelectedStatusImportacao = 2;
- this.ViewModel.FiltroImportacao();
- }
-
- private async void Transferir_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- Transferencia transferencium = new Transferencia();
- transferencium.set_Data(Funcoes.GetNetworkTime().Date);
- Transferencia transferencium1 = transferencium;
- while (true)
- {
- transferencium1 = await this.ViewModel.ShowTransferencia(transferencium1);
- if (transferencium1 == null)
- {
- transferencium1 = null;
- return;
- }
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar(transferencium1);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (flag)
- {
- break;
- }
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- this.ViewModel.ToggleSnackBar("TRANSFERÊNCIA SALVA COM SUCESSO.", true);
- this.ViewModel.Alterar(false);
- transferencium1 = null;
- return;
- transferencium1 = null;
- }
-
- private void TrocarFornecedor_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Loading(true);
- this.AbrirLancamento(this.ViewModel.SelectedLancamento);
- this.ViewModel.VisibilityFornecedor = System.Windows.Visibility.Visible;
- this.ViewModel.Loading(false);
- }
-
- private void Unchecked_OnHandler(object sender, RoutedEventArgs e)
- {
- DataGridCell dataGridCell = (DataGridCell)sender;
- if (this.LancamentoGrid.SelectedItem == null)
- {
- return;
- }
- Lancamento dataContext = dataGridCell.DataContext as Lancamento;
- if (dataContext != null)
- {
- if (!dataContext.get_Selecionado())
- {
- return;
- }
- this.ViewModel.DeSelecionarLancamento(dataContext);
- this.LancamentoGrid.CommitEdit();
- this.LancamentoGrid.CommitEdit();
- CollectionViewSource.GetDefaultView(this.LancamentoGrid.ItemsSource).Refresh();
- }
- }
-
- private void ValidarLancamento()
- {
- if (this.ViewModel.SelectedLancamento == null)
- {
- return;
- }
- List<KeyValuePair<string, string>> keyValuePairs = this.ViewModel.SelectedLancamento.Validate();
- this.ValidateFields(keyValuePairs, false);
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/FornecedorView.cs b/Gestor.Application/Views/Financeiro/FornecedorView.cs
deleted file mode 100644
index 6825a38..0000000
--- a/Gestor.Application/Views/Financeiro/FornecedorView.cs
+++ /dev/null
@@ -1,419 +0,0 @@
-using Gestor.Application.Drawers;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.Servicos.Seguros;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-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.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Markup;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class FornecedorView : BaseUserControl, IComponentConnector
- {
- internal DataGrid FornecedorGrid;
-
- internal TextBox NomeBox;
-
- internal TextBox DocumentoPrincipalBox;
-
- internal ToggleButton AtivoBox;
-
- internal TextBox CepBox;
-
- internal ProgressBar ProgressCep;
-
- internal TextBox EnderecoBox;
-
- internal TextBox BairroBox;
-
- internal TextBox CidadeBox;
-
- internal TextBox EstadoBox;
-
- internal ComboBox PlanoBox;
-
- internal ComboBox CentroBox;
-
- internal ComboBox ContaBox;
-
- internal ComboBox TipoPagamentoBox;
-
- private bool _contentLoaded;
-
- public FornecedorViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public FornecedorView()
- {
- base.Tag = "CADASTRO DE FORNECEDORES";
- this.ViewModel = new FornecedorViewModel();
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- }
-
- private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e)
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 10).get_Consultar())
- {
- FiltroArquivoDigital filtroArquivoDigital = new FiltroArquivoDigital();
- filtroArquivoDigital.set_Id(this.ViewModel.SelectedFornecedor.get_Id());
- filtroArquivoDigital.set_Tipo(10);
- filtroArquivoDigital.set_Parente(this.ViewModel.SelectedFornecedor);
- 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)10), "."), "OK", "", false);
- }
- }
-
- private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLog(24, this.ViewModel.SelectedFornecedor.get_Id());
- }
-
- private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.AbrirLogEmail(24, this.ViewModel.SelectedFornecedor.get_Id());
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Alterar(true);
- this.ViewModel.SelectedFornecedor.Initialize();
- }
-
- private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarFornecedor("");
- }
-
- private void AutoCompleteFornecedor_OnPopulating(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<List<Fornecedor>> 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.CancelProduto = (Fornecedor)this.ViewModel.SelectedFornecedor.Clone();
- this.ViewModel.CancelarAlteracao();
- this.ScrollToItem();
- }
-
- private async void CopiarDados_OnClick(object sender, RoutedEventArgs e)
- {
- Cliente cliente = await this.ViewModel.ShowCopiarCliente();
- if (cliente != null)
- {
- this.ViewModel.Incluir();
- Cliente cliente1 = cliente;
- ObservableCollection<ClienteEndereco> observableCollection = await (new ClienteServico()).BuscarEnderecosAsync(cliente.get_Id());
- cliente1.set_Enderecos(observableCollection);
- cliente1 = null;
- cliente1 = cliente;
- ObservableCollection<ClienteTelefone> observableCollection1 = await (new ClienteServico()).BuscarTelefonesAsync(cliente.get_Id());
- cliente1.set_Telefones(observableCollection1);
- cliente1 = null;
- cliente1 = cliente;
- ObservableCollection<ClienteEmail> observableCollection2 = await (new ClienteServico()).BuscarEmailsAsync(cliente.get_Id());
- cliente1.set_Emails(observableCollection2);
- cliente1 = null;
- this.ViewModel.Copiar(cliente);
- }
- cliente = null;
- }
-
- private void DocumentoPrincipalBox_OnLostFocus(object sender, RoutedEventArgs e)
- {
- TextBox textBox = (TextBox)sender;
- textBox.Text = ValidationHelper.FormatDocument(textBox.Text);
- }
-
- private void Excel_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Excel();
- }
-
- private async void Excluir_OnClick(object sender, RoutedEventArgs e)
- {
- await this.ViewModel.Delete();
- this.ScrollToItem();
- }
-
- private void Imprimir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Imprimir();
- }
-
- 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/views/financeiro/fornecedorview.xaml", UriKind.Relative));
- }
-
- private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
- {
- TextBox textBox = (TextBox)sender;
- if (!string.IsNullOrWhiteSpace(textBox.Text))
- {
- string str = ValidationHelper.FormatPostCode(textBox.Text);
- if (ValidationHelper.ValidatePostCode(str))
- {
- this.CepBox.Text = 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.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- else
- {
- this.ScrollToItem();
- }
- }
-
- private void ScrollToItem()
- {
- if (this.FornecedorGrid.SelectedItem == null)
- {
- return;
- }
- this.FornecedorGrid.UpdateLayout();
- this.FornecedorGrid.ScrollIntoView(this.FornecedorGrid.SelectedItem);
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, FornecedorView.AutoCompleteFornecedor_OnPopulating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged));
- return;
- }
- case 2:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Imprimir_OnClick);
- return;
- }
- case 3:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Excel_OnClick);
- return;
- }
- case 4:
- {
- this.FornecedorGrid = (DataGrid)target;
- return;
- }
- case 5:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 6:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.CopiarDados_OnClick);
- return;
- }
- case 7:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick);
- return;
- }
- case 8:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
- return;
- }
- case 9:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick);
- return;
- }
- case 10:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Excluir_OnClick);
- return;
- }
- case 11:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirAquivoDigital_Click);
- return;
- }
- case 12:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
- return;
- }
- case 13:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLogEmail_OnClick);
- return;
- }
- case 14:
- {
- this.NomeBox = (TextBox)target;
- return;
- }
- case 15:
- {
- this.DocumentoPrincipalBox = (TextBox)target;
- FornecedorView fornecedorView = this;
- this.DocumentoPrincipalBox.PreviewTextInput += new TextCompositionEventHandler(fornecedorView.SomenteNumeros);
- this.DocumentoPrincipalBox.LostFocus += new RoutedEventHandler(this.DocumentoPrincipalBox_OnLostFocus);
- return;
- }
- case 16:
- {
- this.AtivoBox = (ToggleButton)target;
- return;
- }
- case 17:
- {
- this.CepBox = (TextBox)target;
- this.CepBox.LostFocus += new RoutedEventHandler(this.PostcodeBox_OnLostFocus);
- FornecedorView fornecedorView1 = this;
- this.CepBox.PreviewTextInput += new TextCompositionEventHandler(fornecedorView1.SomenteNumeros);
- return;
- }
- case 18:
- {
- this.ProgressCep = (ProgressBar)target;
- return;
- }
- case 19:
- {
- this.EnderecoBox = (TextBox)target;
- return;
- }
- case 20:
- {
- this.BairroBox = (TextBox)target;
- return;
- }
- case 21:
- {
- this.CidadeBox = (TextBox)target;
- return;
- }
- case 22:
- {
- this.EstadoBox = (TextBox)target;
- return;
- }
- case 23:
- {
- FornecedorView fornecedorView2 = this;
- ((TextBox)target).LostFocus += new RoutedEventHandler(fornecedorView2.FormatarTelefone);
- return;
- }
- case 24:
- {
- FornecedorView fornecedorView3 = this;
- ((TextBox)target).LostFocus += new RoutedEventHandler(fornecedorView3.FormatarTelefone);
- return;
- }
- case 25:
- {
- this.PlanoBox = (ComboBox)target;
- return;
- }
- case 26:
- {
- this.CentroBox = (ComboBox)target;
- return;
- }
- case 27:
- {
- this.ContaBox = (ComboBox)target;
- return;
- }
- case 28:
- {
- this.TipoPagamentoBox = (ComboBox)target;
- return;
- }
- }
- this._contentLoaded = true;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/InfoExtratoView.cs b/Gestor.Application/Views/Financeiro/InfoExtratoView.cs
deleted file mode 100644
index a666da9..0000000
--- a/Gestor.Application/Views/Financeiro/InfoExtratoView.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Model.Domain.Financeiro;
-using System;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Shapes;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class InfoExtratoView : BaseUserControl, IComponentConnector
- {
- private bool _buttonClickable;
-
- private bool _contentLoaded;
-
- public InfoExtratoViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public InfoExtratoView(Saldo saldo, bool telaBancos = false)
- {
- this.ViewModel = new InfoExtratoViewModel(telaBancos);
- base.DataContext = this.ViewModel;
- this.ViewModel.SelectedSaldo = saldo;
- this.InitializeComponent();
- }
-
- [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/views/financeiro/infoextratoview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [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;
- }
- ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
- }
-
- private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e)
- {
- ((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray));
- Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
- if (child != null)
- {
- child.Stroke = new SolidColorBrush(Colors.White);
- }
- }
-
- private void TopControls_OnMouseLeave(object sender, MouseEventArgs e)
- {
- this._buttonClickable = false;
- ((Grid)sender).Background = new SolidColorBrush(Colors.Transparent);
- Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
- if (child != null)
- {
- child.Stroke = new SolidColorBrush(Colors.White);
- }
- }
-
- private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- this._buttonClickable = true;
- ((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray));
- }
-
- private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- if (this._buttonClickable)
- {
- MethodInfo method = base.GetType().GetMethod(string.Concat(((Grid)sender).Name, "_Click"));
- if (method == null)
- {
- return;
- }
- method.Invoke(this, null);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/PlanoView.cs b/Gestor.Application/Views/Financeiro/PlanoView.cs
deleted file mode 100644
index 5d4bff5..0000000
--- a/Gestor.Application/Views/Financeiro/PlanoView.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-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.Markup;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class PlanoView : BaseUserControl, IComponentConnector
- {
- private bool _contentLoaded;
-
- public PlanoViewModel ViewModel
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public PlanoView(Plano plano)
- {
- this.ViewModel = new PlanoViewModel(plano);
- base.DataContext = this.ViewModel;
- this.InitializeComponent();
- }
-
- private void Alterar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Cancel = (Plano)this.ViewModel.SelectedPlano.Clone();
- this.ViewModel.Alterar(true);
- }
-
- private void Cancelar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Cancelar();
- }
-
- 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/views/financeiro/planoview.xaml", UriKind.Relative));
- }
-
- private async void Salvar_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick);
- return;
- }
- case 2:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick);
- return;
- }
- case 3:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
- return;
- }
- case 4:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick);
- return;
- }
- }
- this._contentLoaded = true;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/PlanosView.cs b/Gestor.Application/Views/Financeiro/PlanosView.cs
deleted file mode 100644
index e9b9fef..0000000
--- a/Gestor.Application/Views/Financeiro/PlanosView.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Financeiro;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-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.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;
-
-namespace Gestor.Application.Views.Financeiro
-{
- public class PlanosView : BaseUserControl, IComponentConnector
- {
- private bool _seleciona = true;
-
- public PlanosViewModel ViewModel;
-
- internal DataGrid PlanosGrid;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public PlanosView()
- {
- base.Tag = "PLANO DE CONTAS";
- this.ViewModel = new PlanosViewModel();
- 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(28, this.ViewModel.SelectedPlanos.get_Id());
- }
-
- private void AlterarPlanos_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.Alterar(true);
- this.ViewModel.SelectedPlanos.Initialize();
- }
-
- private void AutoCompleteBoxPlanos_OnTextChanged(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text()))
- {
- return;
- }
- this.ViewModel.FiltrarPlanos("");
- }
-
- private void AutoCompleteBoxPlanos_Populating(object sender, PopulatingEventArgs e)
- {
- e.set_Cancel(true);
- this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task<ObservableCollection<Planos>> searchResult) => {
- if (searchResult == null)
- {
- return;
- }
- AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender;
- autoCompleteBox.set_ItemsSource(searchResult.Result);
- autoCompleteBox.PopulateComplete();
- }, TaskScheduler.FromCurrentSynchronizationContext());
- }
-
- private void CancelarPlanos_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.CancelarAlteracao();
- }
-
- private async void ContentLoad()
- {
- this.PlanosGrid.SelectedIndex = 0;
- this.PlanosGrid.SelectionChanged += new SelectionChangedEventHandler(this.PlanosGrid_OnSelectionChanged);
- this.PlanosGrid.MouseDoubleClick += new MouseButtonEventHandler((object sender, MouseButtonEventArgs args) => {
- });
- PlanosViewModel viewModel = this.ViewModel;
- List<Plano> planos = await (new BaseServico()).BuscarPlanoAsync();
- PlanosViewModel observableCollection = viewModel;
- List<Plano> planos1 = planos;
- IOrderedEnumerable<Plano> ativo =
- from x in planos1
- orderby x.get_Ativo() descending
- select x;
- observableCollection.Plano = new ObservableCollection<Plano>(ativo.ThenBy<Plano, string>((Plano x) => x.get_Descricao()).ToList<Plano>());
- viewModel = null;
- }
-
- private void IncluirPlanos_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/views/financeiro/planosview.xaml", UriKind.Relative));
- }
-
- private async void PlanoButton_OnClick(object sender, RoutedEventArgs e)
- {
- PlanoView planoView = new PlanoView(this.ViewModel.SelectedPlanos.get_Plano());
- (new HosterWindow(planoView, "PLANO", new double?((double)500), new double?((double)200), false)).ShowDialog();
- this.ViewModel.Loading(true);
- if (planoView.ViewModel.SelectedPlano.get_Id() != 0)
- {
- PlanosViewModel viewModel = this.ViewModel;
- List<Plano> planos = await (new BaseServico()).BuscarPlanoAsync();
- PlanosViewModel observableCollection = viewModel;
- List<Plano> planos1 = planos;
- IOrderedEnumerable<Plano> ativo =
- from x in planos1
- orderby x.get_Ativo() descending
- select x;
- observableCollection.Plano = new ObservableCollection<Plano>(ativo.ThenBy<Plano, string>((Plano x) => x.get_Descricao()).ToList<Plano>());
- viewModel = null;
- List<Planos> planos2 = await (new BaseServico()).BuscarPlanosAsync();
- PlanosViewModel list = this.ViewModel;
- List<Planos> planos3 = planos2;
- IOrderedEnumerable<Planos> ativo1 =
- from x in planos3
- orderby x.get_Ativo() descending
- select x;
- IOrderedEnumerable<Planos> planos4 = ativo1.ThenBy<Planos, string>((Planos x) => {
- Plano plano = x.get_Plano();
- if (plano != null)
- {
- return plano.get_Descricao();
- }
- return null;
- });
- list.Planos = planos4.ThenBy<Planos, string>((Planos x) => x.get_Descricao()).ToList<Planos>();
- ObservableCollection<Planos> planosFiltrados = this.ViewModel.PlanosFiltrados;
- List<long> nums = (
- from p in planosFiltrados
- select p.get_Id()).ToList<long>();
- this.ViewModel.PlanosFiltrados = new ObservableCollection<Planos>(
- from x in this.ViewModel.Planos
- where nums.Contains(x.get_Id())
- select x);
- this._seleciona = false;
- this.PlanosGrid.SelectedItem = this.ViewModel.SelectedPlanos;
- this.ViewModel.SelectedPlano = this.ViewModel.Plano.First<Plano>((Plano x) => x.get_Id() == planoView.ViewModel.SelectedPlano.get_Id());
- this._seleciona = true;
- }
- this.ViewModel.Loading(false);
- }
-
- private async void PlanosGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- object obj;
- if (this._seleciona)
- {
- DataGrid dataGrid = (DataGrid)sender;
- if (dataGrid == null || dataGrid.SelectedIndex >= 0)
- {
- PlanosViewModel viewModel = this.ViewModel;
- obj = (dataGrid != null ? dataGrid.Items[dataGrid.SelectedIndex] : null);
- await viewModel.SelecionaPlanos((Planos)obj);
- }
- }
- }
-
- private async void SalvarPlanos_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.ViewModel.Loading(true);
- List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
- this.ValidateFields(keyValuePairs, true);
- flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
- this.ViewModel.Loading(false);
- if (!flag)
- {
- await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
- }
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, PlanosView.AutoCompleteBoxPlanos_Populating));
- ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBoxPlanos_OnTextChanged));
- return;
- }
- case 2:
- {
- this.PlanosGrid = (DataGrid)target;
- return;
- }
- case 3:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.IncluirPlanos_OnClick);
- return;
- }
- case 4:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AlterarPlanos_OnClick);
- return;
- }
- case 5:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.SalvarPlanos_OnClick);
- return;
- }
- case 6:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.CancelarPlanos_OnClick);
- return;
- }
- case 7:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.AbrirLog_OnClick);
- return;
- }
- case 8:
- {
- ((Button)target).Click += new RoutedEventHandler(this.PlanoButton_OnClick);
- return;
- }
- }
- this._contentLoaded = true;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Views/Financeiro/Relatorios/FechamentoFinanceiroView.cs b/Gestor.Application/Views/Financeiro/Relatorios/FechamentoFinanceiroView.cs
deleted file mode 100644
index 3c04339..0000000
--- a/Gestor.Application/Views/Financeiro/Relatorios/FechamentoFinanceiroView.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-using Gestor.Application.Componentes;
-using Gestor.Application.ViewModels.Financeiro.Relatorios;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Financeiro.Relatorios;
-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.Input;
-using System.Windows.Markup;
-using System.Windows.Threading;
-
-namespace Gestor.Application.Views.Financeiro.Relatorios
-{
- public class FechamentoFinanceiroView : BaseUserControl, IComponentConnector, IStyleConnector
- {
- public FechamentoFinanceiroViewModel ViewModel;
-
- internal ProgressBar ProgressRing;
-
- internal DatePicker InicioBox;
-
- internal DatePicker FimBox;
-
- internal Gestor.Application.Componentes.WebEditor WebEditor;
-
- internal TextBlock NaoHaDados;
-
- private bool _contentLoaded;
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- public FechamentoFinanceiroView()
- {
- this.ViewModel = new FechamentoFinanceiroViewModel();
- 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 CheckBox_Checked(object sender, RoutedEventArgs e)
- {
- string name = ((CheckBox)sender).Name;
- if (name == "GridPlanos")
- {
- this.ViewModel.Planos.ForEach((Planos x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.Planos = new List<Planos>(this.ViewModel.Planos);
- return;
- }
- if (name == "GridCentro")
- {
- this.ViewModel.Centro.ForEach((Centro x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.Centro = new List<Centro>(this.ViewModel.Centro);
- return;
- }
- if (name != "GridConta")
- {
- this.ViewModel.Plano.ForEach((Plano x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.Plano = new List<Plano>(this.ViewModel.Plano);
- return;
- }
- this.ViewModel.Conta.ForEach((BancosContas x) => x.set_Selecionado(!x.get_Selecionado()));
- this.ViewModel.Conta = new List<BancosContas>(this.ViewModel.Conta);
- }
-
- private void ContentLoad()
- {
- this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- this.InicioBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.Periodo_OnSelectedDateChanged);
- this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown);
- this.FimBox.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(this.Periodo_OnSelectedDateChanged);
- }
-
- private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e)
- {
- this.ProgressRing.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.IsEnabled = false;
- await this.ViewModel.GerarExcel();
- this.ProgressRing.Visibility = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsEnabled = true;
- }
-
- private void Fechar_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IsExpanded = !this.ViewModel.IsExpanded;
- }
-
- private void Filtros_OnClick(object sender, RoutedEventArgs e)
- {
- this.ViewModel.IsExpanded = !this.ViewModel.IsExpanded;
- }
-
- private async void GerarResultados_OnClick(object sender, RoutedEventArgs e)
- {
- bool flag;
- this.InicioBox.Text = ValidationHelper.FormatDate(this.InicioBox.Text);
- this.FimBox.Text = ValidationHelper.FormatDate(this.FimBox.Text);
- try
- {
- this.ViewModel.Inicio = new DateTime?(Convert.ToDateTime(this.InicioBox.Text));
- this.ViewModel.Fim = new DateTime?(Convert.ToDateTime(this.FimBox.Text));
- }
- catch (Exception exception)
- {
- return;
- }
- DateTime? inicio = this.ViewModel.Inicio;
- DateTime? fim = this.ViewModel.Fim;
- flag = (inicio.HasValue & fim.HasValue ? inicio.GetValueOrDefault() > fim.GetValueOrDefault() : false);
- if (!flag)
- {
- this.ProgressRing.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.IsEnabled = false;
- this.ViewModel.HtmlContent = string.Empty;
- this.ViewModel.Fechamento = new List<FechamentoFinanceiro>();
- await this.ViewModel.GerarRelatorio();
- if (this.ViewModel.HtmlContent == string.Empty)
- {
- this.NaoHaDados.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.IsEnabled = true;
- this.ProgressRing.Visibility = System.Windows.Visibility.Collapsed;
- }
- this.WebEditor.Initialize(this.ViewModel.HtmlContent);
- this.NaoHaDados.Visibility = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsEnabled = true;
- this.ProgressRing.Visibility = System.Windows.Visibility.Collapsed;
- }
- else
- {
- await this.ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO.", "OK", "", false);
- }
- }
-
- private async void Imprimir_OnClick(object sender, RoutedEventArgs e)
- {
- this.ProgressRing.Visibility = System.Windows.Visibility.Visible;
- this.ViewModel.IsEnabled = false;
- await this.ViewModel.Print();
- this.ProgressRing.Visibility = System.Windows.Visibility.Collapsed;
- this.ViewModel.IsEnabled = 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/views/financeiro/relatorios/fechamentofinanceiroview.xaml", UriKind.Relative));
- }
-
- private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e)
- {
- this.ViewModel.Fechamento = new List<FechamentoFinanceiro>();
- this.ViewModel.HtmlContent = string.Empty;
- this.WebEditor.Initialize("");
- }
-
- [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.ProgressRing = (ProgressBar)target;
- return;
- }
- case 2:
- {
- this.InicioBox = (DatePicker)target;
- this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.InicioBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 3:
- {
- this.FimBox = (DatePicker)target;
- this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus);
- this.FimBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick);
- return;
- }
- case 4:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.GerarResultados_OnClick);
- return;
- }
- case 5:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Filtros_OnClick);
- return;
- }
- case 6:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.Imprimir_OnClick);
- return;
- }
- case 7:
- {
- ((MenuItem)target).Click += new RoutedEventHandler(this.ExportarExcel_OnClick);
- return;
- }
- case 8:
- {
- this.WebEditor = (Gestor.Application.Componentes.WebEditor)target;
- return;
- }
- case 9:
- {
- this.NaoHaDados = (TextBlock)target;
- return;
- }
- case 10:
- {
- ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick);
- return;
- }
- }
- this._contentLoaded = true;
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 11:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
- return;
- }
- case 12:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
- return;
- }
- case 13:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
- return;
- }
- case 14:
- {
- ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked);
- ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked);
- return;
- }
- default:
- {
- return;
- }
- }
- }
- }
-} \ No newline at end of file