示例#1
0
 public List<Alocacao> GetAlocacoes(Calendario cal, DateTime data, Secretario secretario)
 {
     return dao.GetAlocacoes(cal, data, secretario);
 }
示例#2
0
 public List<Alocacao> GetAlocacoesSemData(Calendario cal, Secretario secretario)
 {
     return dao.GetAlocacoesSemData(cal, secretario);
 }
示例#3
0
 public void InsertSecretario(Secretario secretario)
 {
     DbCommand cmd = _baseDados.GetStoredProcCommand("SecretariosInsere");
     _baseDados.AddInParameter(cmd, "@UserId", DbType.Guid, secretario.Id);
     _baseDados.AddInParameter(cmd, "@Nome", DbType.String, secretario.Nome);
     try
     {
         _baseDados.ExecuteNonQuery(cmd);
     }
     catch (SqlException ex)
     {
         throw new DataAccessException(ErroMessages.GetErrorMessage(ex.Number), ex);
     }
 }
示例#4
0
 public object Clone()
 {
     return(Secretario.GetSecretario(Id, (string)Matricula.Clone(), (string)Nome.Clone(), (string)Email.Clone()));
 }
示例#5
0
        public List<Alocacao> GetAlocacoesSemData(Calendario cal, Secretario secretario)
        {
            List<Alocacao> lista = new List<Alocacao>();

            DbCommand cmd = baseDados.GetStoredProcCommand("AlocacaoSelectByProfessorSemData");
            baseDados.AddInParameter(cmd, "@ProfessorId", DbType.Guid, secretario.Id);
            baseDados.AddInParameter(cmd, "@DataInicio", DbType.DateTime, cal.InicioG1);
            baseDados.AddInParameter(cmd, "@DataFim", DbType.DateTime, cal.FimG2);

            AulasDAO aulaDAO = new AulasDAO();
            EventoDAO eventoDAO = new EventoDAO();
            RecursosDAO recDAO = new RecursosDAO();

            using (IDataReader leitor = baseDados.ExecuteReader(cmd))
            {

                Alocacao aloc;

                while (leitor.Read())
                {
                    Aula au = null;
                    Recurso rec = null;
                    Evento evento = null;
                    DateTime dateTime = new DateTime();

                    rec = recDAO.GetRecurso(leitor.GetGuid(leitor.GetOrdinal("RecursoId")));

                    Guid? aulaId = leitor["AulaId"] as Guid?;
                    if (aulaId.HasValue)
                        au = aulaDAO.GetAula(leitor.GetGuid(leitor.GetOrdinal("AulaId")));

                    Guid? eventoId = leitor["EventoId"] as Guid?;
                    if (eventoId.HasValue)
                        evento = eventoDAO.GetEvento(leitor.GetGuid(leitor.GetOrdinal("EventoId")));

                    string hora = (string)leitor["Hora"];

                    dateTime = (DateTime)leitor["Data"];

                    aloc = new Alocacao(rec, dateTime, hora, au, evento);

                    lista.Add(aloc);
                }
            }
            return lista;
        }