static void Main(string[] args)
        {
            string errorMSG = " ";
            //Teste ao metodo associa tarefa a utilizador
            DateTime         dtTime        = new DateTime(2017, 05, 05);
            DateTime         dtTimeII      = new DateTime(2017, 08, 15);
            Atividade        act           = new Atividade(dtTime, " ", true);
            List <Atividade> conjAtividade = new List <Atividade>();

            conjAtividade.Add(act);


            List <Trabalhador> trabalhadores = null;
            Tarefa             t             = new Tarefa(conjAtividade, trabalhadores, dtTime, dtTimeII);

            //GereTarefa tar = new GereTarefa();
            try
            {
                if (GereTarefa.AdicionaTarefa(t, out errorMSG) == false)
                {
                    throw new NullReferenceException("Não foi possivel adicionar tarefa");
                }
            }

            catch (ImposssivelAdicionarTarefa ex)
            {
                Console.WriteLine("Impossivel adicionar tarefa");
            }

            catch (NullReferenceException ex)
            {
                Console.WriteLine("Impossivel adicionar tarefa");
            }
        }
Exemple #2
0
        public bool AdicionaTarefa(Tarefa t, out string mensagem)
        {
            string msg = string.Empty;

            try
            {
                GereTarefa.AdicionaTarefa(t, out msg);
                result = true;
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            mensagem = msg;
            return(result);
        }
Exemple #3
0
        public bool ProcurarTarefa(Tarefa t, out string mensagem)
        {
            string msg;

            try
            {
                if (GereTarefa.ConsultarTarefa(t, out msg) == true)
                {
                    result = true;
                }
            }
            catch (ImposssivelAdicionarUtilizador ex)
            {
                msg    = ex.Message;
                result = false;
            }
            mensagem = msg;
            return(result);
        }
Exemple #4
0
        public bool EliminaTarefa(Tarefa t, out string mensagem)
        {
            string msg;

            try
            {
                if (GereTarefa.RemoveTarefa(t, out msg))
                {
                    t.SituacaoRelativaATarefa = EstadoTarefa.Removida;
                    result = true;
                }
            }
            catch (ImposssivelAdicionarUtilizador ex)
            {
                msg    = ex.Message;
                result = false;
            }
            mensagem = msg;
            return(result);
        }