using Gestor.Application.Componentes; using Gestor.Application.Helpers; using Gestor.Application.ViewModels.Drawer.Ajuda; using Gestor.Application.ViewModels.Generic; using Gestor.Application.Views.Ferramentas; using Gestor.Application.Views.Generic; using Gestor.Model.API; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Seguros; using MaterialDesignThemes.Wpf; using mshtml; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; 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 Xceed.Wpf.AvalonDock.Controls; namespace Gestor.Application.Views.Ajuda { public class AtendimentosView : BaseUserControl, IComponentConnector, IStyleConnector { internal AtendimentosViewModel ViewModel; internal ComboBox StatusCbo; internal DataGrid AtendimentosGrid; internal DataGridTextColumn SolucaoColumn; internal TextBox NomeBox; internal TextBox Ddd; internal TextBox TelefoneBox; internal TextBox ValorBox; internal TextBox AssuntoBox; internal TextBox IdAcessoBox; internal TextBox SenhaBox; internal Gestor.Application.Componentes.WebEditor WebEditor; private bool _contentLoaded; [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] internal Delegate _CreateDelegate(Type delegateType, string handler) { return Delegate.CreateDelegate(delegateType, this, handler); } public AtendimentosView() { this.ViewModel = new AtendimentosViewModel(); base.DataContext = this.ViewModel; this.InitializeComponent(); this.ViewModel.Head = string.Concat(Recursos.Usuario.get_Nome(), " - ", Recursos.Empresa.get_Nome(), ", VOCÊ ESTÁ EM ATENDIMENTOS"); this.StatusCbo.SelectedIndex = 0; this.ViewModel.IsVisible = System.Windows.Visibility.Visible; } private void AbrirAntendimento_OnClick(object sender, RoutedEventArgs e) { this.AtendimentosGrid.SelectedItem = null; this.ViewModel.LimparComponentes(); if (this.WebEditor.WebBrowserEditor.HtmlDocument.body != null) { this.WebEditor.WebBrowserEditor.HtmlDocument.body.innerHTML = string.Empty; } this.ViewModel.AtendimentoVisibility = System.Windows.Visibility.Collapsed; this.ViewModel.EnvioEmailVisibility = System.Windows.Visibility.Visible; this.ViewModel.IsEnabled = false; } private void AcessoRemoto_OnClick(object sender, RoutedEventArgs e) { string str = "c:\\AggerSeguros\\Remoto.exe"; if (File.Exists(str)) { Process.Start(str); return; } Parameters parameter = new Parameters(); parameter.set_Beta(false); parameter.set_Type(99); parameter.set_Application("Remoto.exe"); parameter.set_Directory(""); parameter.set_Run(true); (new DownloadWindow(parameter)).Show(); } private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.Anexar(); } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.IsEnabled = true; this.ViewModel.SelecionaAtendimento(); } private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) { Chip chip = sender as Chip; if (chip == null) { return; } ListBox listBox = Extentions.FindVisualAncestor(chip); Gestor.Model.Domain.Common.ArquivoDigital item = (Gestor.Model.Domain.Common.ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; if (item == null) { return; } this.ViewModel.Delete(item); } private async void Enviar_OnClick(object sender, RoutedEventArgs e) { bool flag; this.ViewModel.Loading(true); this.ViewModel.Corpo = this.WebEditor.GetHtml(); List> keyValuePairs = await this.ViewModel.Enviar(); flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0); if (keyValuePairs != null) { List> keyValuePairs1 = keyValuePairs; if (keyValuePairs1.Any>((KeyValuePair x) => x.Key == "fail")) { List> keyValuePairs2 = keyValuePairs; List> keyValuePairs3 = keyValuePairs; keyValuePairs2.Remove(keyValuePairs3.First>((KeyValuePair x) => x.Key == "fail")); } } this.ValidateFields(keyValuePairs, true); this.ViewModel.Loading(false); if (flag) { await this.ViewModel.ShowMessage("SOLICITAÇÃO ENVIADA PARA AGGER, POR FAVOR AGUARDE NOSSO RETORNO!", "OK", "", false); this.WebEditor.Body = ""; } else { await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); } } [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/ajuda/atendimentosview.xaml", UriKind.Relative)); } private void SelectedStatus_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.StatusCbo.SelectedItem == null) { return; } this.ViewModel.WorkOnSelectedStatus(this.StatusCbo.SelectedItem.ToString()); this.SolucaoColumn.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); } [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.StatusCbo = (ComboBox)target; this.StatusCbo.SelectionChanged += new SelectionChangedEventHandler(this.SelectedStatus_OnSelectionChanged); return; } case 2: { ((Button)target).Click += new RoutedEventHandler(this.AbrirAntendimento_OnClick); return; } case 3: { this.AtendimentosGrid = (DataGrid)target; return; } case 4: { this.SolucaoColumn = (DataGridTextColumn)target; return; } case 5: { ((Button)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); return; } case 6: { ((Button)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick); return; } case 7: { ((Button)target).Click += new RoutedEventHandler(this.Enviar_OnClick); return; } case 8: { this.NomeBox = (TextBox)target; return; } case 9: { this.Ddd = (TextBox)target; AtendimentosView atendimentosView = this; this.Ddd.PreviewTextInput += new TextCompositionEventHandler(atendimentosView.SomenteNumeros); return; } case 10: { this.TelefoneBox = (TextBox)target; AtendimentosView atendimentosView1 = this; this.TelefoneBox.LostFocus += new RoutedEventHandler(atendimentosView1.FormatarTelefone); AtendimentosView atendimentosView2 = this; this.TelefoneBox.PreviewTextInput += new TextCompositionEventHandler(atendimentosView2.SomenteNumeros); return; } case 11: { this.ValorBox = (TextBox)target; return; } case 12: { this.AssuntoBox = (TextBox)target; return; } case 13: { this.IdAcessoBox = (TextBox)target; return; } case 14: { this.SenhaBox = (TextBox)target; return; } case 15: { ((Button)target).Click += new RoutedEventHandler(this.AcessoRemoto_OnClick); return; } case 16: { this._contentLoaded = true; return; } case 17: { this.WebEditor = (Gestor.Application.Componentes.WebEditor)target; return; } default: { this._contentLoaded = true; return; } } } [DebuggerNonUserCode] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) { if (connectionId == 16) { ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick)); } } } }