public void SelectProject()
        // Provides a form with a grid populated with
        //   the collection of SAP PS Projects.
        //   This is a starting point for working with
        //   a PS Project.
        //      - On the form OK button event the Project data is loaded.
        //      - Only one SAP Project can be opened at a time.
        //--------------------------------------------------------------------------------------------
        {
            Cursor.Current = Cursors.WaitCursor;

            oApplication.StatusBar = oSAPInterface.Login();
            // Close any open project ( only one SAP project is opened at a time )
            oProject.DeleteTasks();
            if (oProject.Name != "SAPProject")  // No project has been saved. This is the global template.
            {
                oApplication.FileClose(Microsoft.Office.Interop.MSProject.PjSaveType.pjPromptSave, false);
            }
            frmPrjSelection = new frmProjectSelection(ref oApplication, ref oSAPInterface);
            frmPrjSelection.Show();

            Cursor.Current = Cursors.Default;
        }
Example #2
0
        public IEnumerable <Prueba> GetAllPruebas()
        {
            /* try
             * {*/
            //cadenas de construcción de conexión a servidor
            string          connStr = "Server=10.48.13.154;Database=integracion;Uid=userInt;Pwd=userInt123456";
            MySqlConnection conn    = new MySqlConnection(connStr);

            /*}
             * catch (Exception errosql)
             * {
             * MessageBox.Show("Error en conexion a la base de datos\n\n" + errosql.Message);
             * }*/
            double[]   request_id          = new double[50];
            string[]   ms_project          = new string[50];
            string[]   act_trello_name     = new string[50];
            DateTime[] act_init_date       = new DateTime[50];
            DateTime[] act_init_real_date  = new DateTime[50];
            DateTime[] act_end_date        = new DateTime[50];
            DateTime[] act_real_end_date   = new DateTime[50];
            double[]   act_estimated_hours = new double[50];
            double[]   act_time_loaded     = new double[50];
            double[]   act_porcent         = new double[50];
            int        contador            = 0;
            int        contador1           = 0;

            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM request WHERE req_cargar='true';";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    request_id[contador1] = reader.GetDouble(0);
                    ms_project[contador1] = reader.GetString(4);
                    contador1++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                Pruebas[0] = new Prueba {
                    Resultados = "Error en la consulta\n\n" + errosql.Message
                };
            }
            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM activities WHERE act_title = 'false';";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    act_trello_name[contador] = reader.GetString(2);
                    //MessageBox.Show(act_trello_name[contador]);
                    act_init_date[contador] = reader.GetDateTime(5);

                    act_init_real_date[contador] = reader.GetDateTime(6);

                    act_end_date[contador] = reader.GetDateTime(7);

                    act_real_end_date[contador] = reader.GetDateTime(8);

                    act_estimated_hours[contador] = reader.GetDouble(9);

                    act_time_loaded[contador] = reader.GetDouble(17);
                    //MessageBox.Show(act_time_loaded[contador].ToString());
                    act_porcent[contador] = reader.GetDouble(19);
                    //MessageBox.Show(act_porcent[contador].ToString());
                    contador++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                Pruebas[1] = new Prueba {
                    Resultados = "Error en la consulta\n\n" + errosql.Message
                };
            }

            ArrayList tasks = new ArrayList(); // se declara array de las tareas

            // creamos un objeto de tipo aplicacion MSProject
            MSProject.Application app = null;
            app = new MSProject.Application();
            int cont = 0;

            foreach (String project in ms_project)
            {
                if (project != null)
                {
                    try
                    {
                        // Si no hay problemas para abrir el project entrará en la condición
                        // Fijense en la info que da FileOpen pues aqui indicarás especificas como lo quieres abrir (escritura/lectura) y la ruta, como está aqui es de la forma que se pueda escribir y leer en él
                        if (app.FileOpen("C:/Home/Intelix/Mayoreo/00-Control-Solicitudes/" + project + "", false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSProject.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing))
                        {
                            //Se recorren los proyectos activos
                            foreach (MSProject.Project proj in app.Projects)
                            {
                                //Se recorre las tareas
                                foreach (MSProject.Task task in proj.Tasks)
                                {
                                    for (int i = 0; i < act_trello_name.Length; i++)
                                    {
                                        if (act_trello_name[i] == task.Name && task.Rollup.ToString() == "False")
                                        {
                                            task.Number11 = act_time_loaded[i];
                                            task.Start10  = act_init_real_date[i];
                                            task.Finish10 = act_real_end_date[i];
                                            task.Number10 = act_porcent[i]; //actualizamos en el project el porcentaje
                                            if (cont % 10 == 0 && cont != 0)
                                            {
                                            }
                                            cont++;
                                            continue;
                                        }
                                    }
                                }
                                app.FileClose(Microsoft.Office.Interop.MSProject.PjSaveType.pjSave, false); //cerramos el fichero
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        Pruebas[2] = new Prueba {
                            Resultados = "Error en el proyecto\n\n" + err.Message
                        };
                    }
                }
            }
            return(Pruebas);
        }
Example #3
0
        public IEnumerable <Prueba> GetAllPruebas()
        {
            string          connStr = "Server=10.48.13.154;Database=integracion;Uid=userInt;Pwd=userInt123456";
            MySqlConnection conn    = new MySqlConnection(connStr);

            Pruebas[0] = new Prueba {
                Resultados = "Todo bien\n\n"
            };
            //}
            //catch (Exception errosql)
            //{
            // MessageBox.Show("Error en conexion a la base de datos\n\n" + errosql.Message);
            //}
            double[] request_id     = new double[50];
            double[] act_request_id = new double[50];
            string[] ms_project     = new string[3];

            string act_trello_name;
            string act_init_date;
            string act_mail;
            string act_end_date;
            string act_trello_user;
            double act_estimated_hours;
            double act_time_loaded;
            double act_porcent;
            int    contador  = 0;
            int    contador1 = 0;

            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM request WHERE req_cargar='true';";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    request_id[contador1] = reader.GetDouble(0);
                    //MessageBox.Show(request_id[contador1].ToString());
                    ms_project[contador1] = reader.GetString(4);
                    contador1++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                Pruebas[1] = new Prueba {
                    Resultados = "Error en la consulta\n\n" + errosql.Message
                };
            }
            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM activities;";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    //act_trello_name[contador] = reader.GetString(2);
                    act_request_id[contador1] = reader.GetDouble(1);
                    //MessageBox.Show(act_request_id[contador1].ToString());
                    contador++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                Pruebas[2] = new Prueba {
                    Resultados = "Error en la consulta1\n\n" + errosql.Message
                };
            }

            ArrayList tasks = new ArrayList(); // se declara array de las tareas
                                               // creamos un objeto de tipo aplicacion MSProject
            int cont  = 0;
            int cont1 = 0;

            string[] task_names       = new string[50];
            MSProject.Application app = null;
            app        = new MSProject.Application();
            Pruebas[3] = new Prueba {
                arr = ms_project
            };
            foreach (String project in ms_project)
            {
                if (project != null)
                {
                    try
                    {
                        // Si no hay problemas para abrir el project entrará en la condición
                        // Fijense en la info que da FileOpen pues aqui indicarás especificas como lo quieres abrir (escritura/lectura) y la ruta, como está aqui es de la forma que se pueda escribir y leer en él
                        if (app.FileOpen("C:/Home/Intelix/Mayoreo/00-Control-Solicitudes/" + project + "", false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSProject.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing))
                        {
                            foreach (MSProject.Project proj in app.Projects)
                            {
                                //Se recorre las tareas
                                foreach (MSProject.Task task in proj.Tasks)
                                {
                                    if (task.Rollup.ToString() == "False")
                                    {
                                        act_trello_name     = task.Name;
                                        act_time_loaded     = task.ActualWork / 60;
                                        act_estimated_hours = task.Work / 60;
                                        act_init_date       = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Start);
                                        act_end_date        = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Finish);
                                        act_trello_user     = task.ResourceNames;
                                        act_mail            = task.Text10;
                                        act_porcent         = task.Number10;
                                        if (cont % 10 == 0 && cont != 0)
                                        {
                                        }


                                        try
                                        {
                                            //MessageBox.Show("INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'false', '" + act_trello_user + "', '" + act_mail + "')");
                                            conn.Open();
                                            MySqlDataReader reader;

                                            MySqlCommand command1;

                                            string commandStr1 = "INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'false', '" + act_trello_user + "', '" + act_mail + "')";

                                            command1 = new MySqlCommand(commandStr1, conn);
                                            reader   = command1.ExecuteReader();
                                            reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                                            conn.Close();
                                            cont++;
                                        }
                                        catch (Exception errosql)
                                        {
                                            Pruebas[4] = new Prueba {
                                                Resultados = "Error en la consulta\n\n" + errosql.Message
                                            };
                                        }


                                        //continue;
                                    }
                                    else
                                    {
                                        act_trello_name     = task.Name;
                                        act_time_loaded     = task.Number11 / 60;
                                        act_estimated_hours = task.Work / 60;
                                        act_init_date       = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Start);
                                        act_end_date        = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Finish);
                                        act_porcent         = task.Number10;

                                        if (cont % 10 == 0 && cont != 0)
                                        {
                                        }


                                        try
                                        {
                                            //MessageBox.Show("INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'true', '', '')");
                                            conn.Open();
                                            MySqlDataReader reader;

                                            MySqlCommand command1;

                                            string commandStr1 = "INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'true', '', '')";

                                            command1 = new MySqlCommand(commandStr1, conn);
                                            reader   = command1.ExecuteReader();
                                            reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                                            conn.Close();
                                            cont++;
                                        }
                                        catch (Exception errosql)
                                        {
                                            Pruebas[5] = new Prueba {
                                                Resultados = "Error en la consulta\n\n" + errosql.Message
                                            };
                                        }
                                    }
                                }
                            }


                            app.FileClose(Microsoft.Office.Interop.MSProject.PjSaveType.pjSave, false); //cerramos el fichero
                        }

                        //}
                    }
                    catch (Exception err)
                    {
                        Pruebas[6] = new Prueba {
                            Resultados = "Error en la consulta\n\n" + err.Message
                        };
                    }
                    cont1++;
                }
            }
            return(Pruebas);
        }
Example #4
0
        //"Server=127.0.0.1;Database=dbgestionocupacion;Uid=root;Pwd=";
        //"Server=10.48.13.154;Database=dbgestionocupacion;Uid=userInt;Pwd=userInt123456";
        private void button1_Click(object sender, EventArgs e)
        {
            /* try
             * {*/
            MySqlConnection conn = new MySqlConnection(connStr);

            /*}
             * catch (Exception errosql)
             * {
             * MessageBox.Show("Error en conexion a la base de datos\n\n" + errosql.Message);
             * }*/
            //tabla Request
            List <int>    req_id     = new List <int>();
            List <String> ms_project = new List <String>();
            //Tabla activities
            List <String>   act_trello_name    = new List <String>();
            List <DateTime> act_init_date      = new List <DateTime>();
            List <DateTime> act_init_real_date = new List <DateTime>();
            List <DateTime> act_end_date       = new List <DateTime>();
            List <DateTime> act_real_end_date  = new List <DateTime>();
            List <String>   act_title          = new List <String>();
            List <String>   mails = new List <String>();
            List <double>   act_estimated_hours = new List <double>();
            List <double>   act_time_loaded     = new List <double>();
            List <double>   act_porcent         = new List <double>();
            List <bool>     used = new List <bool>();
            //Llaves
            List <int> for_req_id = new List <int>();

            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM request WHERE req_cargar='false' AND sta_id = 'open';";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    req_id.Add(reader.GetInt32(0));
                    ms_project.Add(reader.GetString(4));
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                MessageBox.Show("Error en la consulta\n\n" + errosql.Message);
            }
            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM activities ORDER BY act_id asc;";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    for_req_id.Add(getintNotNull(reader, 1));
                    act_trello_name.Add(getStringNotNull(reader, 2));
                    act_init_date.Add(getDateTimeNotNull(reader, 5));

                    act_init_real_date.Add(getDateTimeNotNull(reader, 6));

                    act_end_date.Add(getDateTimeNotNull(reader, 7));

                    act_real_end_date.Add(getDateTimeNotNull(reader, 8));

                    act_estimated_hours.Add(getdoubleNotNull(reader, 9));

                    act_time_loaded.Add(getdoubleNotNull(reader, 17));
                    act_porcent.Add(getdoubleNotNull(reader, 19));
                    act_title.Add(getStringNotNull(reader, 20));
                    mails.Add(getStringNotNull(reader, 21));
                    used.Add(false);
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                MessageBox.Show("Error en la consulta\n\n" + errosql.Message);
            }

            ArrayList tasks = new ArrayList(); // se declara array de las tareas

            // creamos un objeto de tipo aplicacion MSProject
            MSProject.Application app = null;
            app = new MSProject.Application();
            int  cont = 0;
            int  filteredListCount;
            bool test;

            for (int i = 0; i < ms_project.Count; i++)
            {
                if (ms_project[i] != null)
                {
                    MessageBox.Show("Nombre del Project: " + ms_project[i]);

                    try
                    {
                        // Si no hay problemas para abrir el project entrará en la condición
                        // Fijense en la info que da FileOpen pues aqui indicarás especificas como lo quieres abrir (escritura/lectura) y la ruta, como está aqui es de la forma que se pueda escribir y leer en él
                        if (app.FileOpen("C:/Home/Intelix/Mayoreo/00-Control-Solicitudes/" + ms_project[i] + "", false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSProject.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing))
                        {
                            //Se recorren los proyectos activos
                            foreach (MSProject.Project proj in app.Projects)
                            {
                                //MessageBox.Show(string.Join(",", for_req_id.ToArray()));
                                filteredListCount = for_req_id.Where(x => x == req_id[i]).ToList().Count;

                                if (proj.Tasks.Count < filteredListCount)
                                {
                                    MessageBox.Show("Para esta solicitud se añadieron cartas desde trello");
                                    //proj.Tasks.Add(act_trello_name[i], i + 1);
                                    for (int k = proj.Tasks.Count; k < filteredListCount; k++)
                                    {
                                        proj.Tasks.Add("", k + 1);
                                    }
                                }
                                //Se recorre las tareas
                                foreach (MSProject.Task task in proj.Tasks)
                                {
                                    //proj.Tasks.Add(act_trello_name[i], i + 1);
                                    for (int j = 0; j < act_trello_name.Count; j++)
                                    {
                                        test = ((act_trello_name[j] == task.Name || "" == task.Name) &&
                                                task.Rollup.ToString() == "False" &&
                                                act_title[j] == "false" &&
                                                req_id[i] == for_req_id[j] &&
                                                used[j] == false);
                                        if (test)
                                        {
                                            used[j]       = true;
                                            task.Name     = act_trello_name[j];
                                            task.Text10   = mails[j];
                                            task.Number11 = act_time_loaded[j];
                                            task.Start10  = act_init_real_date[j];
                                            task.Finish10 = act_real_end_date[j];
                                            task.Number10 = act_porcent[j];
                                            cont++;
                                            continue;
                                        }
                                        if (act_title[j] == "true" && used[j] == false)
                                        {
                                            used[j] = true;
                                        }
                                        if (task.Rollup.ToString() == "True")
                                        {
                                            continue;
                                        }
                                    }
                                }
                                MessageBox.Show(cont + " tareas actualizadas");
                                app.FileClose(Microsoft.Office.Interop.MSProject.PjSaveType.pjSave, false); //cerramos el fichero
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show("Error en el proyecto\n\n" + err.Message, "Error");
                    }
                }
            }
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            //inicializar
            //try
            //{
            MySqlConnection conn = new MySqlConnection(connStr);

            //}
            //catch (Exception errosql)
            //{
            // MessageBox.Show("Error en conexion a la base de datos\n\n" + errosql.Message);
            //}
            double[] request_id     = new double[50];
            double[] act_request_id = new double[50];
            string[] ms_project     = new string[3];

            string act_trello_name;
            string act_init_date;
            string act_mail;
            string act_end_date;
            string act_trello_user;
            double act_estimated_hours;
            double act_time_loaded;
            int    contador  = 0;
            int    contador1 = 0;

            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM (SELECT request.req_id, request.req_ms_project, COUNT(activities.req_id) AS act_count FROM request LEFT JOIN activities ON activities.req_id = request.req_id GROUP BY 1) AS src WHERE src.act_count = 0;";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();
                if (!reader.HasRows)
                {
                    MessageBox.Show("Error no hay solicitudes para cargar.\nVerifique que las solicitudes a cargar no tegan tareas ya inicializadas");
                }
                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    request_id[contador1] = reader.GetDouble(0);
                    //MessageBox.Show(request_id[contador1].ToString());
                    ms_project[contador1] = reader.GetString(1);
                    contador1++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                MessageBox.Show("Error en la consulta\n\n" + errosql.Message);
            }
            try
            {
                conn.Open();
                MySqlDataReader reader;
                MySqlCommand    command;
                string          commandStr = "SELECT * FROM activities;";
                command = new MySqlCommand(commandStr, conn);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    //MessageBox.Show("aqui\n\n");
                    //act_trello_name[contador] = reader.GetString(2);
                    act_request_id[contador1] = reader.GetDouble(1);
                    //MessageBox.Show(act_request_id[contador1].ToString());
                    contador++;
                }
                reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                conn.Close();
            }
            catch (Exception errosql)
            {
                MessageBox.Show("Error en la consulta1\n\n" + errosql.Message);
            }

            ArrayList tasks = new ArrayList(); // se declara array de las tareas
                                               // creamos un objeto de tipo aplicacion MSProject
            int contTask   = 0;
            int contTitle  = 0;
            int cont1      = 0;
            int contTaskT  = 0;
            int contTitleT = 0;

            string[] task_names       = new string[50];
            MSProject.Application app = null;
            app = new MSProject.Application();

            foreach (String project in ms_project)
            {
                if (project != null)
                {
                    try
                    {
                        contTask  = 0;
                        contTitle = 0;
                        // Si no hay problemas para abrir el project entrará en la condición
                        // Fijense en la info que da FileOpen pues aqui indicarás especificas como lo quieres abrir (escritura/lectura) y la ruta, como está aqui es de la forma que se pueda escribir y leer en él
                        if (app.FileOpen("C:/Home/Intelix/Mayoreo/00-Control-Solicitudes/" + project + "", false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSProject.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing))
                        {
                            foreach (MSProject.Project proj in app.Projects)
                            {
                                //Se recorre las tareas
                                foreach (MSProject.Task task in proj.Tasks)
                                {
                                    if (task.Rollup.ToString() == "False")
                                    {
                                        act_trello_name     = task.Name;
                                        act_time_loaded     = task.ActualWork / 60;
                                        act_estimated_hours = task.Work / 60;
                                        act_init_date       = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Start);
                                        act_end_date        = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Finish);
                                        act_trello_user     = task.ResourceNames;
                                        act_mail            = task.Text10;


                                        try
                                        {
                                            //MessageBox.Show("INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'false', '" + act_trello_user + "', '" + act_mail + "')");
                                            conn.Open();
                                            MySqlDataReader reader;

                                            MySqlCommand command1;

                                            string commandStr1 = "INSERT INTO activities (req_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",LTRIM(RTRIM('" + act_trello_name + "')),'" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + 0 + ", 'false', '" + act_trello_user + "', '" + act_mail + "')";

                                            command1 = new MySqlCommand(commandStr1, conn);
                                            reader   = command1.ExecuteReader();
                                            reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                                            conn.Close();
                                            contTask++;
                                            contTaskT++;
                                        }
                                        catch (Exception errosql)
                                        {
                                            MessageBox.Show("Error en la consulta1\n\n" + errosql.Message);
                                        }


                                        //continue;
                                    }
                                    else
                                    {
                                        act_trello_name     = task.Name;
                                        act_time_loaded     = task.Number11 / 60;
                                        act_estimated_hours = task.Work / 60;
                                        act_init_date       = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Start);
                                        act_end_date        = String.Format("{0:yyyy-MM-dd HH:mm:ss}", task.Finish);



                                        try
                                        {
                                            //MessageBox.Show("INSERT INTO activities (act_request_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",'" + act_trello_name + "','" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + act_porcent + ", 'true', '', '')");
                                            conn.Open();
                                            MySqlDataReader reader;

                                            MySqlCommand command1;

                                            string commandStr1 = "INSERT INTO activities (req_id, act_trello_name, act_init_date, act_end_date, act_estimated_hours, act_time_loaded ,act_porcent, act_title, act_trello_user, act_mail) VALUES (" + request_id[cont1] + ",LTRIM(RTRIM('" + act_trello_name + "')),'" + act_init_date + "', '" + act_end_date + "', " + act_estimated_hours + "," + act_time_loaded + ", " + 0 + ", 'true', '', '')";

                                            command1 = new MySqlCommand(commandStr1, conn);
                                            reader   = command1.ExecuteReader();
                                            reader.Close(); //importante cerrar el reader pues solo se puede tener uno abierto a la vez
                                            conn.Close();
                                            contTitle++;
                                            contTitleT++;
                                        }
                                        catch (Exception errosql)
                                        {
                                            MessageBox.Show("Error en la consulta1\n\n" + errosql.Message);
                                        }
                                    }
                                }
                            }

                            MessageBox.Show(contTask + " tareas agregadas a la base de datos.\n\n" + contTitle + " titulos agregados a la base de datos.\n\nCargadas desde: " + project);
                            app.FileClose(Microsoft.Office.Interop.MSProject.PjSaveType.pjSave, false); //cerramos el fichero
                        }

                        //}
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show("Error en el proyecto\n\n" + err.Message, "Error");
                    }
                    cont1++;
                }
            }
            MessageBox.Show("Se agrego un total de:\n\n\t- " + contTaskT + " tareas a la base de datos.\n\n\t- " + contTitleT + " titulos a la base de datos.");
        }