예제 #1
0
        static void AddTasks(SqlConnection conn)
        {
            int    id, idProject;
            string title, note, type, mail;

            conn.Open();
            SqlCommand cmd = new SqlCommand(
                "SELECT * FROM Tarefa AS T INNER JOIN Estado as E ON " +
                "T.Estado_idEstado = E.idEstado INNER JOIN Trabalho AS " +
                "P ON T.Trabalho_idTrabalho = P.idTrabalho INNER JOIN " +
                "Profissional AS PR ON P.Profissional_idProfissional = PR.idProfissional", conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                id        = reader.GetInt32(0);
                title     = reader.GetString(1);
                note      = reader.GetString(2);
                idProject = reader.GetInt32(4);
                type      = reader.GetString(6);
                mail      = reader.GetString(15);
                reporterAssist.AddTask(id, idProject, title, note, type, mail);
            }
            reader.Close();
            conn.Close();
        }
예제 #2
0
        partial void AdicionarTarefa(NSObject sender)
        {
            Dictionary <int, Project> projetos = reporter.Projects;
            bool teste = false;


            foreach (Project proj in projetos.Values)
            {
                if (proj.Title.Equals(tituloUsado))
                {
                    foreach (Task task in proj.Tasks.Values)
                    {
                        if (task.Title.Equals(NovaTarefaTitulo.StringValue))
                        {
                            AddTarefaLabel.StringValue = "Título de inválido";
                            teste = true;
                            break;
                        }
                    }
                    break;
                }
            }
            if (!teste)
            {
                int idProject = 0;
                foreach (Project proj in projetos.Values)
                {
                    if (tituloUsado.Equals(proj.Title))
                    {
                        idProject = proj.Id;
                        reporter.AddTask(idProject, NovaTarefaTitulo.StringValue, NovaTarefaDescricao.StringValue, "nao concluido");
                        AddTarefaLabel.StringValue = "Tarefa adicionado com sucesso";
                        break;
                    }
                }
                updateTarefasPop();
            }
            AddTarefaLabel.Hidden = false;
        }