diff options
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs new file mode 100644 index 0000000..87c487a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs @@ -0,0 +1,162 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogCopiaViewModel : BaseViewModel +{ + private List<string> _tipoCopia = new List<string> { "CÓPIA COMUM", "CÓPIA OCULTA" }; + + private string _tipo; + + private string _copiarPara; + + private Copia _copia; + + private string _erro; + + private ObservableCollection<string> _copiasComuns; + + private ObservableCollection<string> _copiasOcultas; + + public List<string> TipoCopia + { + get + { + return _tipoCopia; + } + set + { + _tipoCopia = value; + OnPropertyChanged("TipoCopia"); + } + } + + public string Tipo + { + get + { + return _tipo; + } + set + { + _tipo = value; + OnPropertyChanged("Tipo"); + } + } + + public string CopiarPara + { + get + { + return _copiarPara; + } + set + { + _copiarPara = value; + OnPropertyChanged("CopiarPara"); + } + } + + public Copia Copia + { + get + { + return _copia; + } + set + { + _copia = value; + OnPropertyChanged("Copia"); + } + } + + public string Erro + { + get + { + return _erro; + } + set + { + _erro = value; + OnPropertyChanged("Erro"); + } + } + + public ObservableCollection<string> CopiasComuns + { + get + { + return _copiasComuns; + } + set + { + _copiasComuns = value; + OnPropertyChanged("CopiasComuns"); + } + } + + public ObservableCollection<string> CopiasOcultas + { + get + { + return _copiasOcultas; + } + set + { + _copiasOcultas = value; + OnPropertyChanged("CopiasOcultas"); + } + } + + public DialogCopiaViewModel(Copia copia) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + Tipo = TipoCopia.First(); + Copia = (Copia)(((object)copia) ?? ((object)new Copia + { + CopiaOculta = new List<string>(), + CopiaComum = new List<string>() + })); + CopiasComuns = new ObservableCollection<string>(Copia.CopiaComum); + CopiasOcultas = new ObservableCollection<string>(Copia.CopiaOculta); + } + + public void AdicionarCopia() + { + if (!ValidationHelper.ValidacaoEmail(CopiarPara)) + { + Erro = "E-MAIL INVÁLIDO"; + return; + } + if (Copia.CopiaOculta.Contains(CopiarPara)) + { + Erro = "E-MAIL JÁ ADICIONADO"; + return; + } + Copia.CopiaOculta.Add(CopiarPara); + CopiasOcultas = new ObservableCollection<string>(Copia.CopiaOculta); + CopiarPara = string.Empty; + Erro = "E-MAIL ADICIONADO COM SUCESSO"; + } + + public void ExcluirCopia(string tipo, string copia) + { + if (!(tipo == "CÓPIA OCULTA")) + { + Copia.CopiaComum.Remove(copia); + } + else + { + Copia.CopiaOculta.Remove(copia); + } + CopiasComuns = new ObservableCollection<string>(Copia.CopiaComum); + CopiasOcultas = new ObservableCollection<string>(Copia.CopiaOculta); + } +} |