public CadastrarNiveisAcessoViewModel()
 {
     CriarEnabled = true;
     CancelarEnabled = true;
     ActionCommandCriar = new RelayCommand();
     ActionCommandCancelar = new RelayCommand();
 }
 public CadastrarPeriodoViewModel()
 {
     CriarEnabled = true;
     CancelarEnabled = true;
     ActionCommandCriar = new RelayCommand();
     ActionCommandCancelar = new RelayCommand();
 }
        public ConsultarGradeViewModel()
        {
            ActionCommand = new RelayCommand();

            new Task(() =>
            {
                Status = "Consultando Cursos...";
                var model = new ConsultarCursosPeriodosSemestresModel();
                model.Execute(new ConsultarCursosPeriodosSemestresRequest());

                if (model.Response.Status == ExecutionStatus.Success)
                {
                    ListaCursos = from c in model.Response.Cursos
                                  select new DisplayCurso()
                                          {
                                              DisplayName = string.Concat(c.Nome, " (", c.Periodo.NomePeriodo, ")"),
                                              CodCurso = c.Codigo,
                                              CodPeriodo = c.Periodo.Codigo
                                          };
                    ListaSemestres = model.Response.Semestres;
                    ListaDias = model.Response.DiasSemana;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show(string.Concat("Erro ao consultar dados:\n", model.Response.ErrorMessage));
                }

                Status = string.Empty;
            }).Start();
        }
        public CadastrarGradeViewModel()
        {
            ActionCommand = new RelayCommand();
            ActionCommandHorarios = new RelayCommand();
            ActionCommandCursos = new RelayCommand();

            ListaHorarios = new List<DisplayHorario>();

            new Task(() =>
            {
                Status = "Consultando dados...";
                var model = new ConsultarParametrosCadastroGradeModel();
                model.Execute(new ConsultarParametrosCadastroGradeRequest());

                if (model.Response.Status == ExecutionStatus.Success)
                {
                    ListaCursos = from c in model.Response.Cursos
                                  select new DisplayCurso()
                                  {
                                      DisplayName = string.Concat(c.Nome, " (", c.Periodo.NomePeriodo, ")"),
                                      CodCurso = c.Codigo,
                                      CodPeriodo = c.Periodo.Codigo
                                  };
                    ListaDias = model.Response.Dias;
                    ListaMaterias = model.Response.Materias;
                    ListaProfessores = model.Response.Professores;
                    ListaSemestres = model.Response.Semestres;
                }
                else
                    MessageBox.Show(string.Concat("Erro ao consultar dados:\n", model.Response.ErrorMessage));

                Status = string.Empty;
            }).Start();
        }
        public CadastrarUsuarioViewModel()
        {
            CriarEnabled = true;
            CancelarEnabled = true;
            ActionCommandCriar = new RelayCommand();
            ActionCommandCancelar = new RelayCommand();

            new Task(() =>
            {
                Status = "Consultando níveis de acesso...";
                var model = new ConsultarNiveisAcessoModel();
                model.Execute(new ConsultarNiveisAcessoRequest());

                if (model.Response.Status == ExecutionStatus.Success) Lista = model.Response.Niveis;
                else MessageBox.Show(string.Concat("Erro ao consultar os períodos:\n", model.Response.ErrorMessage));

                Status = string.Empty;
            }).Start();
        }
        public CadastrarHorarioViewModel()
        {
            CriarEnabled = true;
            CancelarEnabled = true;
            ActionCommandCriar = new RelayCommand();
            ActionCommandCancelar = new RelayCommand();

            new Task(() =>
            {
                Status = "Consultando dias da semana...";
                var model = new ConsultarDiasPeriodosModel();
                model.Execute(new ConsultarDiasPeriodosRequest());

                if (model.Response.Status == ExecutionStatus.Success)
                {
                    ListaDia = model.Response.Dias;
                    ListaPeriodo = model.Response.Periodos; 
                }
                else MessageBox.Show(string.Concat("Erro ao consultar dias da semana:\n", model.Response.ErrorMessage));

                Status = string.Empty;
            }).Start();
        }
 public LoginViewModel()
 {
     LoginEnabled = true;
     ActionCommandLogin = new RelayCommand();
     ActionCommandCancelar = new RelayCommand();
 }