summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs
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/ViewModels/Generic/DialogTarefaViewModel.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs296
1 files changed, 0 insertions, 296 deletions
diff --git a/Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs b/Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs
deleted file mode 100644
index 9041cd3..0000000
--- a/Gestor.Application/ViewModels/Generic/DialogTarefaViewModel.cs
+++ /dev/null
@@ -1,296 +0,0 @@
-using CsQuery.ExtensionMethods.Internal;
-using Gestor.Application.Helpers;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Windows;
-
-namespace Gestor.Application.ViewModels.Generic
-{
- public class DialogTarefaViewModel : BaseSegurosViewModel
- {
- private bool _showPublica;
-
- private bool _nota;
-
- private Visibility _cabecalho;
-
- private Visibility _agendamento;
-
- private Visibility _status;
-
- private List<TelefoneBase> _telefones;
-
- private ObservableCollection<Usuario> _usuarios;
-
- private Gestor.Model.Domain.Ferramentas.Tarefa _tarefa;
-
- private DateTime _dataAgendamento = Funcoes.GetNetworkTime();
-
- private DateTime _horaAgendamento = Funcoes.GetNetworkTime();
-
- private ObservableCollection<Usuario> _responsaveis = new ObservableCollection<Usuario>();
-
- private Usuario _selectedUsuario;
-
- private bool _isAnotacoes = true;
-
- public Visibility Agendamento
- {
- get
- {
- return this._agendamento;
- }
- set
- {
- this._agendamento = value;
- this.MutateVerbose<Visibility>(ref this._agendamento, value, this.OnRaisePropertyChanged(), "Agendamento");
- }
- }
-
- public Visibility Cabecalho
- {
- get
- {
- return this._cabecalho;
- }
- set
- {
- this._cabecalho = value;
- this.MutateVerbose<Visibility>(ref this._cabecalho, value, this.OnRaisePropertyChanged(), "Cabecalho");
- }
- }
-
- public DateTime DataAgendamento
- {
- get
- {
- return this._dataAgendamento;
- }
- set
- {
- this._dataAgendamento = value;
- if (this.Tarefa != null)
- {
- this.Tarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", value, this.Tarefa.get_Agendamento())));
- }
- this.MutateVerbose<DateTime>(ref this._dataAgendamento, value, this.OnRaisePropertyChanged(), "DataAgendamento");
- }
- }
-
- public DateTime HoraAgendamento
- {
- get
- {
- return this._horaAgendamento;
- }
- set
- {
- this._horaAgendamento = value;
- if (this.Tarefa != null)
- {
- this.Tarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", this.Tarefa.get_Agendamento(), value)));
- }
- this.MutateVerbose<DateTime>(ref this._horaAgendamento, value, this.OnRaisePropertyChanged(), "HoraAgendamento");
- }
- }
-
- public bool IsAnotacoes
- {
- get
- {
- return this._isAnotacoes;
- }
- set
- {
- this._isAnotacoes = value;
- base.OnPropertyChanged("IsAnotacoes");
- }
- }
-
- public bool Nota
- {
- get
- {
- return this._nota;
- }
- set
- {
- this._nota = value;
- if (!value)
- {
- return;
- }
- this.Cabecalho = Visibility.Collapsed;
- this.Status = Visibility.Collapsed;
- }
- }
-
- public ObservableCollection<Usuario> Responsaveis
- {
- get
- {
- return this._responsaveis;
- }
- set
- {
- this._responsaveis = value;
- base.OnPropertyChanged("Responsaveis");
- }
- }
-
- public Usuario SelectedUsuario
- {
- get
- {
- return this._selectedUsuario;
- }
- set
- {
- this._selectedUsuario = value;
- base.OnPropertyChanged("SelectedUsuario");
- }
- }
-
- public bool ShowPublica
- {
- get
- {
- return this._showPublica;
- }
- set
- {
- this._showPublica = value;
- base.OnPropertyChanged("ShowPublica");
- }
- }
-
- public Visibility Status
- {
- get
- {
- return this._status;
- }
- set
- {
- this._status = value;
- this.MutateVerbose<Visibility>(ref this._status, value, this.OnRaisePropertyChanged(), "Status");
- }
- }
-
- public Gestor.Model.Domain.Ferramentas.Tarefa Tarefa
- {
- get
- {
- return this._tarefa;
- }
- set
- {
- DateTime networkTime = Funcoes.GetNetworkTime();
- this.DataAgendamento = (value != null ? value.get_Agendamento() : networkTime);
- this.HoraAgendamento = (value != null ? value.get_Agendamento() : networkTime);
- this.MutateVerbose<Gestor.Model.Domain.Ferramentas.Tarefa>(ref this._tarefa, value, this.OnRaisePropertyChanged(), "Tarefa");
- }
- }
-
- public List<TelefoneBase> Telefones
- {
- get
- {
- return this._telefones;
- }
- set
- {
- this._telefones = value;
- this.MutateVerbose<List<TelefoneBase>>(ref this._telefones, value, this.OnRaisePropertyChanged(), "Telefones");
- }
- }
-
- public ObservableCollection<Usuario> Usuarios
- {
- get
- {
- return this._usuarios;
- }
- set
- {
- this._usuarios = value;
- this.MutateVerbose<ObservableCollection<Usuario>>(ref this._usuarios, value, this.OnRaisePropertyChanged(), "Usuarios");
- }
- }
-
- public DialogTarefaViewModel(Gestor.Model.Domain.Ferramentas.Tarefa tarefa, List<TelefoneBase> telefones, bool nota = false, bool agendamento = false)
- {
- this.ShowPublica = (!nota ? false : tarefa.get_HabilitarPublica());
- this.Telefones = telefones;
- this.Usuarios = new ObservableCollection<Usuario>(Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>());
- this.Nota = nota;
- if (tarefa.get_Entidade() == 1)
- {
- tarefa.set_Anotacoes(tarefa.get_Descricao());
- tarefa.set_Descricao(string.Empty);
- }
- if (agendamento)
- {
- this.Agendamento = Visibility.Collapsed;
- }
- if (tarefa.get_UsuariosVinculados() != null)
- {
- ExtensionMethods.AddRange<Usuario>(this.Responsaveis, tarefa.get_UsuariosVinculados());
- }
- this.Responsaveis.ToList<Usuario>().ForEach((Usuario x) => this.Usuarios.Remove(this.Usuarios.FirstOrDefault<Usuario>((Usuario u) => u.get_Id() == x.get_Id())));
- this.Tarefa = tarefa;
- }
-
- public void AdcionarResponsavel()
- {
- if (this.SelectedUsuario == null || this.Responsaveis.Any<Usuario>((Usuario x) => (object)x == (object)this.SelectedUsuario))
- {
- return;
- }
- this.Responsaveis.Add(this.SelectedUsuario);
- this.Tarefa.set_UsuariosVinculados(this.Responsaveis.ToList<Usuario>());
- this.Usuarios.Remove(this.SelectedUsuario);
- this.SelectedUsuario = null;
- }
-
- private Action<PropertyChangedEventArgs> OnRaisePropertyChanged()
- {
- return (PropertyChangedEventArgs args) => {
- PropertyChangedEventHandler propertyChangedEventHandler = this.RaisePropertyChanged;
- if (propertyChangedEventHandler == null)
- {
- return;
- }
- propertyChangedEventHandler(this, args);
- };
- }
-
- public void RemoverResponsavel(Usuario selectedUsuario)
- {
- if (selectedUsuario == null)
- {
- return;
- }
- this.Responsaveis.Remove(selectedUsuario);
- this.Tarefa.set_UsuariosVinculados(this.Responsaveis.ToList<Usuario>());
- this.Usuarios.Add(selectedUsuario);
- selectedUsuario = null;
- }
-
- public event PropertyChangedEventHandler RaisePropertyChanged;
- }
-} \ No newline at end of file