public void CarregarDadosCombosAgendamento(IList <Espaco> espacos, IList <FormaPagamento> formaPagamentos) { foreach (Periodo p in Enum.GetValues(typeof(Periodo))) { Periodos.Add(new ViewModelBase { Id = (int)p, Nome = ((Periodo)p).ToString() }); } foreach (var e in espacos) { Espacos.Add(new ViewModelBase { Id = e.Id, Nome = e.Nome }); } foreach (var fp in formaPagamentos) { FormasPagamento.Add(new ViewModelBase { Id = fp.Id, Nome = fp.Nome }); } }
private void AsyncMostrarDados(string _cca) { Task <mAmbulante> .Factory.StartNew(() => mdatacm.GetCAmbulante(_cca)) .ContinueWith(task => { if (task.IsCompleted) { try { if (task.Result != null) { Ambulante = task.Result; Situacao = Situações[Ambulante.Situacao].Nome; string[] _atv = task.Result.Atividades.Split(';'); foreach (string atv in _atv) { if (atv != string.Empty) { Atividades.Add(atv); } } if (task.Result.TipoInstalacoes.Contains("TENDA;")) { IsTenda = true; } if (task.Result.TipoInstalacoes.Contains("VEÍCULO;")) { IsVeiculo = true; } if (task.Result.TipoInstalacoes.Contains("CARRINHO;")) { IsCarrinho = true; } if (task.Result.TipoInstalacoes.Contains("TRAILER;")) { IsTrailer = true; } if (task.Result.TipoInstalacoes.Contains("OUTROS")) { IsOutros = true; string input = task.Result.TipoInstalacoes; string[] testing = System.Text.RegularExpressions.Regex.Matches(input, @"\[(.+?)\]") .Cast <System.Text.RegularExpressions.Match>() .Select(s => s.Groups[1].Value).ToArray(); Outros = testing[0]; } string[] _periodos = task.Result.PeridoTrabalho.Split('/'); foreach (string p in _periodos) { if (p != string.Empty) { Periodos.Add(p); } } if (Ambulante.TemLicenca) { TemLicencaView = Visibility.Visible; } else { TemLicencaView = Visibility.Collapsed; } } } catch (Exception ex) { MessageBox.Show(string.Format("Erro '{0}' inesperado, informe o Suporte!", ex.Message), "Sim.Alerta!"); } } }, System.Threading.CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); }
public bool inserirPeriodo(Periodo periodo) { Periodos.Add(periodo); return(true); }