Esempio n. 1
0
        public Schedule(Formulario Padre, MySQL_DB Connection, int ID)
        {
            InitializeComponent();
            this.Padre       = Padre;
            this.Connection  = Connection;
            this.schedule_ID = ID;

            Connection.ChangeTable("HOR_HORARIOS", null);
            Connection.ChangeSelect("SELECT * FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
            if (Connection.Conectar())
            {
                LBL_HORARIO.Content = Connection.getData(0, 2) + " - " + Connection.getData(0, 3);
                LBL_DIAS.Content    = set_Days(Connection.getData(0, 4));
                Connection.Desconectar();
                Connection.ChangeSelect("SELECT ASG_CUR_ID_PK,ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + Connection.getData(0, 1));
                Connection.ChangeTable("ASG_ASIGNATURAS", null);
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                LBL_ASIGNATURA.Content = Connection.getData(0, 1);
                Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_ID_PK = " + Connection.getData(0, 0));
                Connection.ChangeTable("CUR_CURSOS", null);
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                LBL_CURSO.Content = Connection.getData(0, 0);
            }
        }
Esempio n. 2
0
        public Today(Formulario Padre, MySQL_DB Connection)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;

            LBL_FECHA.Content = "Hoy es " + DateTime.Now.ToLongDateString();
            string fecha_hoy = DateTime.Now.ToString("yyyyMMdd");

            Connection.ChangeTable("TAR_TAREAS", null);
            Connection.ChangeSelect("SELECT COUNT(*) FROM TAR_TAREAS WHERE TAR_F_OBJETIVO = " + fecha_hoy + " AND TAR_USR_ID_PK = " + Padre.getUsrID().ToString());
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            LBL_NUM_TAREAS.Content = Connection.getData(0, 0);

            Connection.ChangeTable("HOR_HORARIOS", null);
            Connection.ChangeSelect("SELECT HOR_ID_PK, HOR_D_SEMANA FROM HOR_HORARIOS, ASG_ASIGNATURAS, CUR_CURSOS WHERE HOR_ASG_ID_PK = ASG_ID_PK AND ASG_CUR_ID_PK = CUR_ID_PK AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY HOR_F_COMIENZO ASC");
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            int count = 0;

            LISTA.Children.Add(new TaskBlankSpace());
            if (Connection.countRows() > 0)
            {
                int iterations = Connection.countRows();
                for (int x = 0; x < iterations; x++)
                {
                    Connection.ChangeTable("HOR_HORARIOS", null);
                    Connection.ChangeSelect("SELECT HOR_ID_PK, HOR_D_SEMANA FROM HOR_HORARIOS, ASG_ASIGNATURAS, CUR_CURSOS WHERE HOR_ASG_ID_PK = ASG_ID_PK AND ASG_CUR_ID_PK = CUR_ID_PK AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY HOR_F_COMIENZO ASC");
                    if (Connection.Conectar())
                    {
                        Connection.Desconectar();
                    }
                    if (isToday(Connection.getData(x, 1)))
                    {
                        LISTA.Children.Add(new TodaySchedule(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                        count++;
                    }
                }
            }
            LISTA.Children.Add(new TaskBlankSpace());
            LBL_INFO_CLASES.Content = "Hoy tienes " + count.ToString() + " clases";
            if (count == 0)
            {
                LBL_NOTFOUND.Visibility = Visibility.Visible;
            }

            this.Padre.Size                     = new System.Drawing.Size(476, 503);
            this.Padre.BTN_Exit.Visible         = true;
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 3
0
 private void BTN_CREARCURSO_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(string.IsNullOrEmpty(TXT_NOMBRE.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_DESCRIPCION.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_F_COMIENZO.Text)) && !(string.IsNullOrEmpty(TXT_F_FINALIZACION.Text)))
     {
         Regex regex = new Regex(@"^(((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((20[0-9][0-9]))|((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((19[0-9][0-9]))|(29/02/20(([02468][048])|([13579][26])))|(29/02/19(([02468][048])|([13579][26]))))$");
         Match result_match_f_inicio = regex.Match(TXT_F_COMIENZO.Text);
         Match result_match_f_fin    = regex.Match(TXT_F_FINALIZACION.Text);
         if (result_match_f_inicio.Success && result_match_f_fin.Success)
         {
             string fecha_inicio = DateTime.Parse(TXT_F_COMIENZO.Text).ToString("yyyyMMdd");
             string fecha_fin    = DateTime.Parse(TXT_F_FINALIZACION.Text).ToString("yyyyMMdd");
             if (course_ID != -1)
             {
                 Connection.ChangeTable("CUR_CURSOS", null);
                 Connection.ChangeSelect("SELECT * FROM CUR_CURSOS WHERE CUR_ID_PK = " + this.course_ID.ToString());
                 if (Connection.Conectar())
                 {
                     Connection.Update_String("UPDATE CUR_CURSOS SET CUR_NOMBRE='" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "',CUR_DESCRIPCION='" + TXT_DESCRIPCION.Text.Trim().Replace('\'', ' ') +
                                              "',CUR_F_COMIENZO='" + fecha_inicio + "',CUR_F_FINAL='" + fecha_fin + "' WHERE CUR_ID_PK = " + this.course_ID.ToString());
                     Connection.Update_Execute();
                     Connection.Desconectar();
                 }
             }
             else
             {
                 Connection.ChangeTable("USR_USUARIOS", null);
                 Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
                 if (Connection.Conectar())
                 {
                     Connection.Insert_String("INSERT INTO CUR_CURSOS (CUR_USR_ID_PK,CUR_NOMBRE,CUR_DESCRIPCION,CUR_F_COMIENZO,CUR_F_FINAL) VALUES (" +
                                              Connection.getData(0, 0) + "," + "'" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "'," + "'" + TXT_DESCRIPCION.Text.Trim().Replace('\'', ' ') + "'," + "'" + fecha_inicio + "'," + "'" + fecha_fin + "')");
                     Connection.Insert_Execute();
                     Connection.Desconectar();
                 }
             }
             Padre.elementHost.Child = new OrganizerCourses(Padre, Connection, false);
         }
         else
         {
             MessageBox.Show("¡Debes rellenar todos los datos!", "Información");
         }
     }
     else
     {
         MessageBox.Show("Por favor, introduce correctamente ambas fechas.\nFormato: (DD/MM/AAAA)", "Información");
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 4
0
        public Profile(Formulario Padre, MySQL_DB Connection)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            Connection.ChangeTable("USR_USUARIOS", "USR_ID_PK");
            Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
            if (Connection.Conectar())
            {
                TXT_EMAIL.Text      = Connection.getData(0, 5);
                TXT_ESTADO.Text     = Connection.getData(0, 9);
                TXT_F_REGISTRO.Text = DateTime.Parse(Connection.getData(0, 6)).ToShortDateString();
                TXT_ID.Text         = Connection.getData(0, 0);
                TXT_NICK.Text       = Connection.getData(0, 1);
                TXT_NOMBRE.Text     = Connection.getData(0, 4);
                if (int.Parse(Connection.getData(0, 3)) == 1)
                {
                    TXT_TIPO.Text = "Usuario registrado";
                }
                else if (int.Parse(Connection.getData(0, 3)) == 2)
                {
                    TXT_TIPO.Text = "Administrador";
                }

                Connection.Desconectar();
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 5
0
        public OrganizerNewCourse(Formulario Padre, MySQL_DB Connection, int ID)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.course_ID  = ID;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            if (course_ID != -1)
            {
                this.BTN_CREARCURSO.Content = "Guardar los cambios";
                this.BTN_BORRAR.Visibility  = System.Windows.Visibility.Visible;

                Connection.ChangeTable("CUR_CURSOS", null);
                Connection.ChangeSelect("SELECT * FROM CUR_CURSOS WHERE CUR_ID_PK = " + this.course_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_NOMBRE.Text         = Connection.getData(0, 2);
                TXT_DESCRIPCION.Text    = Connection.getData(0, 3);
                TXT_F_COMIENZO.Text     = DateTime.Parse(Connection.getData(0, 4)).ToShortDateString();
                TXT_F_FINALIZACION.Text = DateTime.Parse(Connection.getData(0, 5)).ToShortDateString();
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 6
0
 private void BTN_CHANGEPASS_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(string.IsNullOrEmpty(TXT_OLDPASS.Password.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_NEWPASS.Password.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_RE_NEWPASS.Password.Trim().Replace('\'', ' '))))
     {
         Connection.ChangeTable("USR_USUARIOS", "USR_ID_PK");
         Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
         Connection.Update_String("UPDATE USR_USUARIOS SET USR_PASSWORD = '******'\'', ' ')) + "' WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
         Connection.Conectar();
         if ((Connection.getData(0, 2) == EncriptarMD5.Encript(TXT_OLDPASS.Password.Trim().Replace('\'', ' '))) && (TXT_NEWPASS.Password.Trim().Replace('\'', ' ') == TXT_RE_NEWPASS.Password.Trim().Replace('\'', ' ')))
         {
             Connection.Update_Execute();
             Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                      "'ChangePass','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "'," + Padre.getUsrID() + ")");
             Connection.Insert_Execute();
             Connection.Desconectar();
             MessageBox.Show("Contraseña cambiada correctamente !", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
             Padre.elementHost.Child = new Profile(Padre, Connection);
         }
         else
         {
             Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                      "'Bad ChangePass','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "'," + Padre.getUsrID() + ")");
             Connection.Insert_Execute();
             Connection.Desconectar();
             MessageBox.Show("Error, comprueba si has escrito bien las contraseñas !", "Información", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Error, debes rellenar todos los campos !", "Información", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 7
0
        private void BTN_ELIMINAR_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            if (MessageBox.Show("¡Atención!\n¿Estás seguro de que quieres borrar el curso?\nTen en cuenta que todas las asignaturas, horarios y tareas vinculadas con el mismo también se borrarán !", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                Connection.ChangeTable("CUR_CURSOS", null);
                Connection.ChangeSelect("SELECT * FROM CUR_CURSOS WHERE CUR_ID_PK = " + this.course_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Delete_String("DELETE FROM CUR_CURSOS WHERE CUR_ID_PK = " + this.course_ID.ToString());
                    Connection.Delete_Execute();
                    Connection.Desconectar();
                }
                Connection.ChangeTable("ASG_ASIGNATURAS", null);
                Connection.ChangeSelect("SELECT ASG_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK = " + this.course_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int iterations = Connection.countRows();
                if (iterations > 0)
                {
                    for (int x = 0; x < iterations; x++)
                    {
                        Connection.ChangeTable("ASG_ASIGNATURAS", null);
                        Connection.ChangeSelect("SELECT ASG_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK = " + this.course_ID.ToString());
                        if (Connection.Conectar())
                        {
                            string asg_ID = Connection.getData(0, 0);

                            Connection.Delete_String("DELETE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + asg_ID);
                            Connection.Delete_Execute();
                            Connection.Delete_String("DELETE FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK = " + asg_ID);
                            Connection.Delete_Execute();
                            Connection.Delete_String("DELETE FROM TAR_TAREAS WHERE TAR_ASG_ID_PK = " + asg_ID);
                            Connection.Delete_Execute();

                            Connection.Desconectar();
                        }
                    }
                }
                Padre.elementHost.Child             = new OrganizerCourses(Padre, Connection, false);
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 8
0
 private void BTN_COMPLETADO_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (MessageBox.Show("¿Estás seguro de que quieres completar la tarea?", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Connection.ChangeTable("TAR_TAREAS", null);
         Connection.ChangeSelect("SELECT * FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString());
         if (Connection.Conectar())
         {
             Connection.Update_String("UPDATE TAR_TAREAS SET TAR_F_COMPLETADA='" + DateTime.Now.ToString("yyyyMMdd") + "' WHERE TAR_ID_PK = " + this.task_ID.ToString());
             Connection.Update_Execute();
             Connection.Desconectar();
         }
         Padre.elementHost.Child = new TaskList(Padre, Connection, 0);
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 9
0
        public OrganizerNewSubjects(Formulario Padre, MySQL_DB Connection, int ID)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.subject_ID = ID;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            Connection.ChangeTable("CUR_CURSOS", null);
            Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString());
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            for (int x = 0; x < Connection.countRows(); x++)
            {
                TXT_COMBO_CURSO.Items.Add(Connection.getData(x, 0));
            }

            if (subject_ID != -1)
            {
                this.BTN_CREARASIGNATURA.Content = "Guardar los cambios";
                this.BTN_BORRAR.Visibility       = System.Windows.Visibility.Visible;

                Connection.ChangeTable("ASG_ASIGNATURAS", null);
                Connection.ChangeSelect("SELECT * FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + this.subject_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_NOMBRE.Text = Connection.getData(0, 2);
                TXT_LUGAR.Text  = Connection.getData(0, 3);
                Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_ID_PK = " + Connection.getData(0, 1));
                Connection.ChangeTable("CUR_CURSOS", null);
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_COMBO_CURSO.Text = Connection.getData(0, 0);
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 10
0
        public Task(Formulario Padre, MySQL_DB Connection, int ID)
        {
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.task_ID    = ID;

            Connection.ChangeTable("TAR_TAREAS", null);
            Connection.ChangeSelect("SELECT * FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString());
            if (Connection.Conectar())
            {
                if (!(string.IsNullOrEmpty(Connection.getData(0, 4))))
                {
                    BTN_COMPLETADO.Visibility = System.Windows.Visibility.Hidden;
                }
                LBL_TITULO.Content = Connection.getData(0, 1);
                char[] del = { '\n' }; int len = Connection.getData(0, 2).Split(del, StringSplitOptions.None).GetValue(0).ToString().Length;
                LBL_PREVIEW.Content = Connection.getData(0, 2).Split(del, StringSplitOptions.None).GetValue(0).ToString().Substring(0, (len >= 50 ? 50 : len)); if (len > 50)
                {
                    LBL_PREVIEW.Content += "...";
                }
                for (int x = 0; x < int.Parse(Connection.getData(0, 6)); x++)
                {
                    LBL_PRIORIDAD.Content += "!";
                }
                Connection.Desconectar();
                LBL_ASIGNATURA.Content = "";
                if (int.Parse(Connection.getData(0, 5)) != -1)
                {
                    Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + Connection.getData(0, 5));
                    Connection.ChangeTable("ASG_ASIGNATURAS", null);
                    if (Connection.Conectar())
                    {
                        Connection.Desconectar();
                    }
                    LBL_ASIGNATURA.Content = Connection.getData(0, 0);
                }
            }
        }
Esempio n. 11
0
 private void BTN_CREARASIGNATURA_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(TXT_COMBO_CURSO.SelectedIndex == -1) && !(string.IsNullOrEmpty(TXT_NOMBRE.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_LUGAR.Text.Trim().Replace('\'', ' '))))
     {
         if (subject_ID != -1)
         {
             Connection.ChangeTable("ASG_ASIGNATURAS", null);
             Connection.ChangeSelect("SELECT * FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + this.subject_ID.ToString());
             if (Connection.Conectar())
             {
                 Connection.Update_String("UPDATE ASG_ASIGNATURAS SET ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" +
                                          TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + "), ASG_NOMBRE = '" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "', ASG_LUGAR = '" + TXT_LUGAR.Text.Trim().Replace('\'', ' ') + "' WHERE ASG_ID_PK = " + this.subject_ID.ToString());
                 Connection.Update_Execute();
                 Connection.Desconectar();
             }
         }
         else
         {
             Connection.ChangeTable("USR_USUARIOS", null);
             Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
             if (Connection.Conectar())
             {
                 Connection.Insert_String("INSERT INTO ASG_ASIGNATURAS (ASG_CUR_ID_PK,ASG_NOMBRE,ASG_LUGAR) VALUES (" +
                                          "(SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ")," +
                                          "'" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "','" + TXT_LUGAR.Text.Trim().Replace('\'', ' ') + "')");
                 Connection.Insert_Execute();
                 Connection.Desconectar();
             }
         }
         Padre.elementHost.Child = new OrganizerSubjects(Padre, Connection, -1);
     }
     else
     {
         MessageBox.Show("¡Debes rellenar todos los datos!", "Información");
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 12
0
 private void BTN_CREARHORARIO_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(TXT_COMBO_ASIGNATURA.SelectedIndex == -1) && !(string.IsNullOrEmpty(TXT_H_COMIENZO.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_H_FINALIZACION.Text.Trim().Replace('\'', ' '))) && check_Days())
     {
         if (schedule_ID != -1)
         {
             Connection.ChangeTable("HOR_HORARIOS", null);
             Connection.ChangeSelect("SELECT * FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
             if (Connection.Conectar())
             {
                 Connection.Update_String("UPDATE HOR_HORARIOS SET HOR_ASG_ID_PK = (SELECT ASG_ID_PK FROM ASG_ASIGNATURAS,CUR_CURSOS WHERE ASG_NOMBRE LIKE '" +
                                          TXT_COMBO_ASIGNATURA.Items[TXT_COMBO_ASIGNATURA.SelectedIndex].ToString() + "' AND ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ") AND ASG_CUR_ID_PK = CUR_ID_PK), HOR_F_COMIENZO = '" + TXT_H_COMIENZO.Text.Trim().Replace('\'', ' ') + "', HOR_F_FINAL = '" + TXT_H_FINALIZACION.Text.Trim().Replace('\'', ' ') + "', HOR_D_SEMANA= '" + get_Days() + "' WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
                 Connection.Update_Execute();
                 Connection.Desconectar();
             }
         }
         else
         {
             Connection.ChangeTable("USR_USUARIOS", null);
             Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
             if (Connection.Conectar())
             {
                 Connection.Insert_String("INSERT INTO HOR_HORARIOS (HOR_ASG_ID_PK,HOR_F_COMIENZO,HOR_F_FINAL,HOR_D_SEMANA) VALUES (" +
                                          "(SELECT ASG_ID_PK FROM ASG_ASIGNATURAS,CUR_CURSOS WHERE ASG_NOMBRE LIKE '" + TXT_COMBO_ASIGNATURA.Items[TXT_COMBO_ASIGNATURA.SelectedIndex].ToString() + "' AND ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ") AND ASG_CUR_ID_PK = CUR_ID_PK)," +
                                          "'" + TXT_H_COMIENZO.Text.Trim().Replace('\'', ' ') + "','" + TXT_H_FINALIZACION.Text.Trim().Replace('\'', ' ') + "','" + get_Days() + "')");
                 Connection.Insert_Execute();
                 Connection.Desconectar();
             }
         }
         Padre.elementHost.Child = new OrganizerSchedules(Padre, Connection, -1);
     }
     else
     {
         MessageBox.Show("¡Debes rellenar todos los datos!", "Información");
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 13
0
        public Subject(Formulario Padre, MySQL_DB Connection, int ID)
        {
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.subject_ID = ID;

            Connection.ChangeTable("ASG_ASIGNATURAS", null);
            Connection.ChangeSelect("SELECT * FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + this.subject_ID.ToString());
            if (Connection.Conectar())
            {
                LBL_ASIGNATURA.Content = Connection.getData(0, 2);
                LBL_LUGAR.Content      = Connection.getData(0, 3);
                Connection.Desconectar();
                Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_ID_PK = " + Connection.getData(0, 1));
                Connection.ChangeTable("CUR_CURSOS", null);
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                LBL_CURSO.Content = Connection.getData(0, 0);
            }
        }
Esempio n. 14
0
        public Course(Formulario Padre, MySQL_DB Connection, int ID)
        {
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.course_ID  = ID;

            Connection.ChangeTable("CUR_CURSOS", null);
            Connection.ChangeSelect("SELECT * FROM CUR_CURSOS WHERE CUR_ID_PK = " + this.course_ID.ToString());
            if (Connection.Conectar())
            {
                LBL_TITULO.Content = Connection.getData(0, 2);
                LBL_FECHAS.Content = DateTime.Parse(Connection.getData(0, 4)).ToShortDateString() + " - " + DateTime.Parse(Connection.getData(0, 5)).ToShortDateString();
                Connection.Desconectar();
            }
        }
Esempio n. 15
0
 private void BTN_ELIMINAR_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (MessageBox.Show("¿Estás seguro de que quieres borrar el horario?", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Connection.ChangeTable("HOR_HORARIOS", null);
         Connection.ChangeSelect("SELECT * FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
         if (Connection.Conectar())
         {
             Connection.Delete_String("DELETE FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
             Connection.Delete_Execute();
             Connection.Desconectar();
         }
         Padre.elementHost.Child = new OrganizerSchedules(Padre, Connection, -1);
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 16
0
        public TodaySchedule(Formulario Padre, MySQL_DB Connection, int ID)
        {
            InitializeComponent();
            this.Padre       = Padre;
            this.Connection  = Connection;
            this.schedule_ID = ID;

            Connection.ChangeTable("HOR_HORARIOS", null);
            Connection.ChangeSelect("SELECT HOR_F_COMIENZO,HOR_F_FINAL,ASG_NOMBRE,ASG_LUGAR FROM HOR_HORARIOS,ASG_ASIGNATURAS WHERE HOR_ID_PK = " + this.schedule_ID.ToString() + " AND HOR_ASG_ID_PK = ASG_ID_PK");
            if (Connection.Conectar())
            {
                LBL_HORARIO.Content    = Connection.getData(0, 0) + " - " + Connection.getData(0, 1);
                LBL_ASIGNATURA.Content = Connection.getData(0, 2);
                LBL_LUGAR.Content      = Connection.getData(0, 3);
                Connection.Desconectar();
            }
        }
Esempio n. 17
0
 private void FILTRO_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!first_time)
     {
         Connection.ChangeTable("CUR_CURSOS", null);
         Connection.ChangeSelect("SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + FILTRO.Items[FILTRO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString());
         if (Connection.Conectar())
         {
             Connection.Desconectar();
         }
         Padre.elementHost.Child             = new OrganizerSubjects(Padre, Connection, int.Parse(Connection.getData(0, 0)));
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
     }
     else
     {
         FILTRO.SelectedIndex = -1;
         first_time           = false;
     }
 }
Esempio n. 18
0
 private void FILTRO_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!first_time)
     {
         Connection.ChangeTable("ASG_ASIGNATURAS", null);
         Connection.ChangeSelect("SELECT ASG_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_NOMBRE LIKE '" + FILTRO.Items[FILTRO.SelectedIndex].ToString() + "'");
         if (Connection.Conectar())
         {
             Connection.Desconectar();
         }
         Padre.elementHost.Child             = new OrganizerSchedules(Padre, Connection, int.Parse(Connection.getData(0, 0)));
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
     }
     else
     {
         FILTRO.SelectedIndex = -1;
         first_time           = false;
     }
 }
Esempio n. 19
0
 private void BTN_ELIMINAR_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (MessageBox.Show("¡Atención!\n¿Estás seguro de que quieres borrar la asignatura?\nTen en cuenta que todos los horarios y tareas vinculadas con la misma también se borrarán !", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Connection.ChangeTable("ASG_ASIGNATURAS", null);
         Connection.ChangeSelect("SELECT * FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + this.subject_ID.ToString());
         if (Connection.Conectar())
         {
             Connection.Delete_String("DELETE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + this.subject_ID.ToString());
             Connection.Delete_Execute();
             Connection.Delete_String("DELETE FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK = " + this.subject_ID.ToString());
             Connection.Delete_Execute();
             Connection.Delete_String("DELETE FROM TAR_TAREAS WHERE TAR_ASG_ID_PK = " + this.subject_ID.ToString());
             Connection.Delete_Execute();
             Connection.Desconectar();
         }
         Padre.elementHost.Child = new OrganizerSubjects(Padre, Connection, -1);
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 20
0
 private void BTN_ACTUALIZAR_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(string.IsNullOrEmpty(TXT_NOMBRE.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_EMAIL.Text.Trim().Replace('\'', ' '))))
     {
         Connection.ChangeTable("USR_USUARIOS", "USR_ID_PK");
         Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
         Connection.Update_String("UPDATE USR_USUARIOS SET USR_NOMBRE = '" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "', USR_EMAIL = '" + TXT_EMAIL.Text.Trim().Replace('\'', ' ') + "' WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
         Connection.Conectar();
         Connection.Update_Execute();
         Connection.Update_Execute();
         Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                  "'UpdateProfile','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "'," + Padre.getUsrID() + ")");
         Connection.Insert_Execute();
         Connection.Desconectar();
         MessageBox.Show("Datos modificados correctamente !", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MessageBox.Show("Debes introducir tu nombre y tu email !", "Información", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 21
0
 private void BTN_CREARTAREA_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (!(string.IsNullOrEmpty(TXT_TITULO.Text.Trim().Replace('\'', ' '))))
     {
         Regex  regex = new Regex(@"^(((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((20[0-9][0-9]))|((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0[13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((19[0-9][0-9]))|(29/02/20(([02468][048])|([13579][26])))|(29/02/19(([02468][048])|([13579][26]))))$");
         Match  result_match_f_objetivo = regex.Match(TXT_F_OBJETIVO.Text);
         string asg_ID = "-1";
         if (TXT_COMBO_ASIGNATURA.SelectedIndex != -1)
         {
             asg_ID = "(SELECT ASG_ID_PK FROM ASG_ASIGNATURAS,CUR_CURSOS WHERE ASG_NOMBRE LIKE '" + TXT_COMBO_ASIGNATURA.Items[TXT_COMBO_ASIGNATURA.SelectedIndex].ToString() + "' AND ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "' AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ") AND ASG_CUR_ID_PK = CUR_ID_PK)";
         }
         string fecha_objetivo = "NULL";
         bool   continuar      = true;
         if (!(string.IsNullOrEmpty(TXT_F_OBJETIVO.Text)))
         {
             if (result_match_f_objetivo.Success)
             {
                 fecha_objetivo = "'" + DateTime.Parse(TXT_F_OBJETIVO.Text).ToString("yyyyMMdd") + "'";
             }
             else
             {
                 MessageBox.Show("Por favor, introduce correctamente la fecha.\nFormato: (DD/MM/AAAA)", "Información");
                 continuar = false;
             }
         }
         if (continuar)
         {
             if (task_ID != -1)
             {
                 Connection.ChangeTable("TAR_TAREAS", null);
                 Connection.ChangeSelect("SELECT * FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString());
                 if (Connection.Conectar())
                 {
                     Connection.Update_String("UPDATE TAR_TAREAS SET TAR_TITULO='" + TXT_TITULO.Text.Trim().Replace('\'', ' ') + "',TAR_DESCRIPCION='" + TXT_DESCRIPCION.Text.Replace('\'', ' ') + "',TAR_F_OBJETIVO=" +
                                              fecha_objetivo + ",TAR_ASG_ID_PK=" + asg_ID + ",TAR_PRIORIDAD=" + TXT_COMBO_PRIORIDAD.SelectedIndex + ",TAR_TIPO=" + TXT_COMBO_TIPO.SelectedIndex + " WHERE TAR_ID_PK = " + this.task_ID.ToString());
                     Connection.Update_Execute();
                     Connection.Desconectar();
                 }
             }
             else
             {
                 Connection.ChangeTable("USR_USUARIOS", null);
                 Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + Padre.TXT_USUARIO.Text + "'");
                 if (Connection.Conectar())
                 {
                     Connection.Insert_String("INSERT INTO TAR_TAREAS (TAR_TITULO,TAR_DESCRIPCION,TAR_F_OBJETIVO,TAR_ASG_ID_PK,TAR_PRIORIDAD,TAR_TIPO,TAR_USR_ID_PK) VALUES (" +
                                              "'" + TXT_TITULO.Text.Trim().Replace('\'', ' ') + "','" + TXT_DESCRIPCION.Text.Replace('\'', ' ') + "'," + fecha_objetivo + "," + asg_ID + "," + TXT_COMBO_PRIORIDAD.SelectedIndex + "," + TXT_COMBO_TIPO.SelectedIndex + "," + Padre.getUsrID().ToString() + ")");
                     Connection.Insert_Execute();
                     Connection.Desconectar();
                 }
             }
             Padre.elementHost.Child = new TaskList(Padre, Connection, 0);
         }
     }
     else
     {
         MessageBox.Show("¡Debes introducir un título!", "Información");
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }
Esempio n. 22
0
        public TaskNew(Formulario Padre, MySQL_DB Connection, int ID)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.task_ID    = ID;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            Connection.ChangeTable("CUR_CURSOS", null);
            Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString());
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            for (int x = 0; x < Connection.countRows(); x++)
            {
                TXT_COMBO_CURSO.Items.Add(Connection.getData(x, 0));
            }

            if (task_ID != -1)
            {
                this.BTN_CREARTAREA.Content = "Guardar los cambios";
                this.BTN_BORRAR.Visibility  = System.Windows.Visibility.Visible;

                Connection.ChangeTable("TAR_TAREAS", null);
                Connection.ChangeSelect("SELECT * FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }

                TXT_TITULO.Text      = Connection.getData(0, 1);
                TXT_DESCRIPCION.Text = Connection.getData(0, 2);
                if (!(string.IsNullOrEmpty(Connection.getData(0, 3))))
                {
                    TXT_F_OBJETIVO.Text = DateTime.Parse(Connection.getData(0, 3)).ToShortDateString();
                }
                TXT_COMBO_PRIORIDAD.SelectedIndex = int.Parse(Connection.getData(0, 6));
                TXT_COMBO_TIPO.SelectedIndex      = int.Parse(Connection.getData(0, 7));

                if (int.Parse(Connection.getData(0, 5)) != -1)
                {
                    string asg_ID = Connection.getData(0, 5);
                    Connection.ChangeTable("CUR_CURSOS", null);
                    Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_ID_PK = (SELECT ASG_CUR_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + asg_ID + ")");
                    if (Connection.Conectar())
                    {
                        Connection.Desconectar();
                    }
                    TXT_COMBO_CURSO.Text = Connection.getData(0, 0);
                    TXT_COMBO_ASIGNATURA.Items.Clear();
                    Connection.ChangeTable("ASG_ASIGNATURAS", null);
                    Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "')");
                    if (Connection.Conectar())
                    {
                        Connection.Desconectar();
                    }
                    for (int x = 0; x < Connection.countRows(); x++)
                    {
                        TXT_COMBO_ASIGNATURA.Items.Add(Connection.getData(x, 0));
                    }
                    Connection.ChangeTable("ASG_ASIGNATURAS", null);
                    Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = (SELECT TAR_ASG_ID_PK FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString() + ")");
                    if (Connection.Conectar())
                    {
                        Connection.Desconectar();
                    }
                    TXT_COMBO_ASIGNATURA.Text = Connection.getData(0, 0);
                }
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 23
0
        public OrganizerSchedules(Formulario Padre, MySQL_DB Connection, int subject_ID)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.subject_ID = subject_ID;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            Connection.ChangeTable("ASG_ASIGNATURAS", null);
            Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK IN (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ")");
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            for (int x = 0; x < Connection.countRows(); x++)
            {
                FILTRO.Items.Add(Connection.getData(x, 0));
            }

            LISTA.Children.Add(new TaskBlankSpace());
            if (subject_ID == -1)
            {
                Connection.ChangeTable("HOR_HORARIOS", null);
                Connection.ChangeSelect("SELECT HOR_ID_PK FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK IN (SELECT ASG_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK IN (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ")) ORDER BY HOR_ASG_ID_PK ASC, HOR_F_COMIENZO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_schedules = Connection.countRows();
                if (num_schedules > 0)
                {
                    for (int x = 0; x < num_schedules; x++)
                    {
                        Connection.ChangeTable("HOR_HORARIOS", null);
                        Connection.ChangeSelect("SELECT HOR_ID_PK FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK IN (SELECT ASG_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK IN (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + ")) ORDER BY HOR_ASG_ID_PK ASC, HOR_F_COMIENZO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        LISTA.Children.Add(new Schedule(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
            }
            else
            {
                Connection.ChangeTable("HOR_HORARIOS", null);
                Connection.ChangeSelect("SELECT HOR_ID_PK FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK = " + this.subject_ID + " ORDER BY HOR_ASG_ID_PK ASC, HOR_F_COMIENZO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_subjects = Connection.countRows();
                if (num_subjects > 0)
                {
                    for (int x = 0; x < num_subjects; x++)
                    {
                        Connection.ChangeTable("HOR_HORARIOS", null);
                        Connection.ChangeSelect("SELECT HOR_ID_PK FROM HOR_HORARIOS WHERE HOR_ASG_ID_PK = " + this.subject_ID + " ORDER BY HOR_ASG_ID_PK ASC, HOR_F_COMIENZO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        LISTA.Children.Add(new Schedule(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
            }
            LISTA.Children.Add(new TaskBlankSpace());
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 24
0
        public OrganizerCourses(Formulario Padre, MySQL_DB Connection, bool old_courses)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre       = Padre;
            this.Connection  = Connection;
            this.old_courses = old_courses;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            LISTA.Children.Add(new TaskBlankSpace());
            if (old_courses)
            {
                BTN_OLDCOURSES.Content = "Cursos actuales";
                Connection.ChangeTable("CUR_CURSOS", null);
                Connection.ChangeSelect("SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_F_FINAL < DATE_FORMAT(NOW(),'%Y-%m-%d') AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY CUR_NOMBRE ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_courses = Connection.countRows();
                if (num_courses > 0)
                {
                    for (int x = 0; x < num_courses; x++)
                    {
                        Connection.ChangeTable("CUR_CURSOS", null);
                        Connection.ChangeSelect("SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_F_FINAL < DATE_FORMAT(NOW(),'%Y-%m-%d') AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY CUR_NOMBRE ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        LISTA.Children.Add(new Course(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
            }
            else
            {
                Connection.ChangeTable("CUR_CURSOS", null);
                Connection.ChangeSelect("SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_F_FINAL >= DATE_FORMAT(NOW(),'%Y-%m-%d') AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY CUR_NOMBRE ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_courses = Connection.countRows();
                if (num_courses > 0)
                {
                    for (int x = 0; x < num_courses; x++)
                    {
                        Connection.ChangeTable("CUR_CURSOS", null);
                        Connection.ChangeSelect("SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_F_FINAL >= DATE_FORMAT(NOW(),'%Y-%m-%d') AND CUR_USR_ID_PK = " + Padre.getUsrID().ToString() + " ORDER BY CUR_NOMBRE ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        LISTA.Children.Add(new Course(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
            }
            LISTA.Children.Add(new TaskBlankSpace());
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 25
0
        private void BTN_Identificarse_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            if (Connection.testConnection())
            {
                if (!(string.IsNullOrEmpty(TXT_USUARIO.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_PASSWORD.Password.Trim().Replace('\'', ' '))))
                {
                    Connection.ChangeTable("USR_USUARIOS", null);
                    Connection.ChangeSelect("SELECT * FROM USR_USUARIOS WHERE BINARY USR_NICK = '" + TXT_USUARIO.Text.Trim().Replace('\'', ' ') + "' AND BINARY USR_PASSWORD  = '******'\'', ' ')) + "'");
                    if (Connection.Conectar())
                    {
                        if (Connection.countRows() == 1)
                        {
                            if (Connection.getData(0, 9) == "Activo")
                            {
                                Padre.menuHoy.Visible          = true;
                                Padre.menuTareas.Visible       = true;
                                Padre.menuPlanificador.Visible = true;
                                Padre.menuPerfil.Visible       = true;
                                Padre.TXT_USUARIO.Text         = TXT_USUARIO.Text.Trim().Replace('\'', ' ');
                                Padre.setUsrID(int.Parse(Connection.getData(0, 0)));

                                Connection.Update_String("UPDATE USR_USUARIOS SET USR_F_ULTIMA_V = '" + DateTime.Now.ToString("yyyyMMdd") + "', USR_LAST_IP = '" + ObtenerIP.ExternalIPAddress.ToString() + "' WHERE USR_ID_PK = " + Padre.getUsrID());
                                Connection.Update_Execute();

                                Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                                         "'Login','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "'," + Padre.getUsrID() + ")");
                                Connection.Insert_Execute();

                                Padre.elementHost.Child = new Today(Padre, Connection);
                            }
                            else
                            {
                                Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                                         "'Inactive Login','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "'," + Connection.getData(0, 0) + ")");
                                Connection.Insert_Execute();
                                MessageBox.Show("Error, tu cuenta de usuario no está activada.\nSolicita a un administrador su activación", "Información");
                            }
                        }
                        else
                        {
                            Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                                     "'Bad Login','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "', 0)");
                            Connection.Insert_Execute();
                            MessageBox.Show("Error, usuario y/o contraseña incorrectos.\nRecuerda que ambos campos son sensibles a mayúsculas y minúsculas.", "Información");
                            TXT_PASSWORD.Password = "";
                        }
                        Connection.Desconectar();
                    }
                }
                else
                {
                    MessageBox.Show("¡Debes introducir el usuario y la contraseña!", "Información");
                }
            }
            else
            {
                MessageBox.Show("Error, no se ha podido establecer conexión con el servidor", "Información");
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 26
0
        public OrganizerNewSchedule(Formulario Padre, MySQL_DB Connection, int ID)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre       = Padre;
            this.Connection  = Connection;
            this.schedule_ID = ID;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            Connection.ChangeTable("CUR_CURSOS", null);
            Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_USR_ID_PK = " + Padre.getUsrID().ToString());
            if (Connection.Conectar())
            {
                Connection.Desconectar();
            }
            for (int x = 0; x < Connection.countRows(); x++)
            {
                TXT_COMBO_CURSO.Items.Add(Connection.getData(x, 0));
            }

            if (schedule_ID != -1)
            {
                this.BTN_CREARHORARIO.Content = "Guardar los cambios";
                this.BTN_BORRAR.Visibility    = System.Windows.Visibility.Visible;

                Connection.ChangeTable("HOR_HORARIOS", null);
                Connection.ChangeSelect("SELECT * FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString());
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_H_COMIENZO.Text     = Connection.getData(0, 2);
                TXT_H_FINALIZACION.Text = Connection.getData(0, 3);
                set_Days(Connection.getData(0, 4));

                string asg_ID = Connection.getData(0, 1);
                Connection.ChangeTable("CUR_CURSOS", null);
                Connection.ChangeSelect("SELECT CUR_NOMBRE FROM CUR_CURSOS WHERE CUR_ID_PK = (SELECT ASG_CUR_ID_PK FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = " + asg_ID + ")");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_COMBO_CURSO.Text = Connection.getData(0, 0);
                TXT_COMBO_ASIGNATURA.Items.Clear();
                Connection.ChangeTable("ASG_ASIGNATURAS", null);
                Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_CUR_ID_PK = (SELECT CUR_ID_PK FROM CUR_CURSOS WHERE CUR_NOMBRE LIKE '" + TXT_COMBO_CURSO.Items[TXT_COMBO_CURSO.SelectedIndex].ToString() + "')");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                for (int x = 0; x < Connection.countRows(); x++)
                {
                    TXT_COMBO_ASIGNATURA.Items.Add(Connection.getData(x, 0));
                }
                Connection.ChangeTable("ASG_ASIGNATURAS", null);
                Connection.ChangeSelect("SELECT ASG_NOMBRE FROM ASG_ASIGNATURAS WHERE ASG_ID_PK = (SELECT HOR_ASG_ID_PK FROM HOR_HORARIOS WHERE HOR_ID_PK = " + this.schedule_ID.ToString() + ")");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                TXT_COMBO_ASIGNATURA.Text = Connection.getData(0, 0);
            }
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 27
0
        public TaskList(Formulario Padre, MySQL_DB Connection, int ID_Filtro)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            InitializeComponent();
            this.Padre      = Padre;
            this.Connection = Connection;
            this.ID_Filtro  = ID_Filtro;

            this.Padre.Size = new System.Drawing.Size(476, 503);

            LISTA.Children.Add(new TaskBlankSpace());
            switch (ID_Filtro)
            {
            case 0:         //Fecha-Limite
                Connection.ChangeTable("TAR_TAREAS", null);
                Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_F_OBJETIVO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_task = Connection.countRows();
                if (num_task > 0)
                {
                    string separatordate = "Sin fecha";
                    if (!(string.IsNullOrEmpty(Connection.getData(0, 1))))
                    {
                        separatordate = DateTime.Parse(Connection.getData(0, 1)).ToLongDateString();
                        if (DateTime.Parse(separatordate).CompareTo(DateTime.Now.Date) == 0)
                        {
                            LISTA.Children.Add(new TaskSeparator("Hoy, " + separatordate));
                        }
                        else
                        {
                            LISTA.Children.Add(new TaskSeparator(separatordate));
                        }
                    }
                    else
                    {
                        LISTA.Children.Add(new TaskSeparator(separatordate));
                    }
                    for (int x = 0; x < num_task; x++)
                    {
                        Connection.ChangeTable("TAR_TAREAS", null);
                        Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_F_OBJETIVO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        if (!(string.IsNullOrEmpty(Connection.getData(x, 1))))
                        {
                            if (separatordate != DateTime.Parse(Connection.getData(x, 1)).ToLongDateString())
                            {
                                separatordate = DateTime.Parse(Connection.getData(x, 1)).ToLongDateString();
                                LISTA.Children.Add(new TaskBlankSpace());
                                if (DateTime.Parse(separatordate).CompareTo(DateTime.Now.Date) == 0)
                                {
                                    LISTA.Children.Add(new TaskSeparator("Hoy, " + separatordate));
                                }
                                else
                                {
                                    LISTA.Children.Add(new TaskSeparator(separatordate));
                                }
                            }
                        }
                        LISTA.Children.Add(new Task(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
                break;

            case 1:         //Asignatura
                Connection.ChangeTable("TAR_TAREAS", null);
                Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO,ASG_NOMBRE FROM TAR_TAREAS LEFT OUTER JOIN ASG_ASIGNATURAS ON ASG_ID_PK = TAR_ASG_ID_PK WHERE TAR_USR_ID_PK =  " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY ASG_NOMBRE ASC, TAR_F_OBJETIVO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                num_task = Connection.countRows();
                if (num_task > 0)
                {
                    string separatorcourse = Connection.getData(0, 2);
                    if (string.IsNullOrEmpty(separatorcourse))
                    {
                        LISTA.Children.Add(new TaskSeparator("Otras tareas"));
                    }
                    else
                    {
                        LISTA.Children.Add(new TaskSeparator(Connection.getData(0, 2)));
                    }
                    for (int x = 0; x < num_task; x++)
                    {
                        Connection.ChangeTable("TAR_TAREAS", null);
                        Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO,ASG_NOMBRE FROM TAR_TAREAS LEFT OUTER JOIN ASG_ASIGNATURAS ON ASG_ID_PK = TAR_ASG_ID_PK WHERE TAR_USR_ID_PK =  " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY ASG_NOMBRE ASC, TAR_F_OBJETIVO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        if (separatorcourse != Connection.getData(x, 2))
                        {
                            separatorcourse = Connection.getData(x, 2);
                            LISTA.Children.Add(new TaskBlankSpace());
                            if (string.IsNullOrEmpty(separatorcourse))
                            {
                                LISTA.Children.Add(new TaskSeparator("Otras tareas"));
                            }
                            else
                            {
                                LISTA.Children.Add(new TaskSeparator(separatorcourse));
                            }
                        }
                        LISTA.Children.Add(new Task(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
                break;

            case 2:         //Prioridad
                Connection.ChangeTable("TAR_TAREAS", null);
                Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_PRIORIDAD FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_PRIORIDAD DESC, TAR_F_OBJETIVO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                num_task = Connection.countRows();
                if (num_task > 0)
                {
                    string separatorprioridad = Connection.getData(0, 1);
                    switch (int.Parse(separatorprioridad))
                    {
                    case 2:
                        LISTA.Children.Add(new TaskSeparator("Prioridad Alta"));
                        break;

                    case 1:
                        LISTA.Children.Add(new TaskSeparator("Prioridad Media"));
                        break;

                    case 0:
                        LISTA.Children.Add(new TaskSeparator("Prioridad Baja"));
                        break;
                    }
                    for (int x = 0; x < num_task; x++)
                    {
                        Connection.ChangeTable("TAR_TAREAS", null);
                        Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_PRIORIDAD FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_PRIORIDAD DESC, TAR_F_OBJETIVO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        if (separatorprioridad != Connection.getData(x, 1))
                        {
                            separatorprioridad = Connection.getData(x, 1);
                            LISTA.Children.Add(new TaskBlankSpace());
                            switch (int.Parse(separatorprioridad))
                            {
                            case 2:
                                LISTA.Children.Add(new TaskSeparator("Prioridad Alta"));
                                break;

                            case 1:
                                LISTA.Children.Add(new TaskSeparator("Prioridad Media"));
                                break;

                            case 0:
                                LISTA.Children.Add(new TaskSeparator("Prioridad Baja"));
                                break;
                            }
                        }
                        LISTA.Children.Add(new Task(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
                break;

            case 3:         //Completadas
                BTN_COMPLETADAS.Content = "Ver Pendientes";
                Connection.ChangeTable("TAR_TAREAS", null);
                Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND NOT ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_F_OBJETIVO ASC");
                if (Connection.Conectar())
                {
                    Connection.Desconectar();
                }
                int num_task_completed = Connection.countRows();
                if (num_task_completed > 0)
                {
                    string separatordate = "Sin fecha";
                    if (!(string.IsNullOrEmpty(Connection.getData(0, 1))))
                    {
                        separatordate = DateTime.Parse(Connection.getData(0, 1)).ToLongDateString();
                        if (DateTime.Parse(separatordate).CompareTo(DateTime.Now.Date) == 0)
                        {
                            LISTA.Children.Add(new TaskSeparator("Hoy, " + separatordate));
                        }
                        else
                        {
                            LISTA.Children.Add(new TaskSeparator(separatordate));
                        }
                    }
                    else
                    {
                        LISTA.Children.Add(new TaskSeparator(separatordate));
                    }
                    for (int x = 0; x < num_task_completed; x++)
                    {
                        Connection.ChangeTable("TAR_TAREAS", null);
                        Connection.ChangeSelect("SELECT TAR_ID_PK,TAR_F_OBJETIVO FROM TAR_TAREAS WHERE TAR_USR_ID_PK = " + Padre.getUsrID().ToString() + " AND NOT ISNULL(TAR_F_COMPLETADA) ORDER BY TAR_F_OBJETIVO ASC");
                        if (Connection.Conectar())
                        {
                            Connection.Desconectar();
                        }
                        if (!(string.IsNullOrEmpty(Connection.getData(x, 1))))
                        {
                            if (separatordate != DateTime.Parse(Connection.getData(x, 1)).ToLongDateString())
                            {
                                separatordate = DateTime.Parse(Connection.getData(x, 1)).ToLongDateString();
                                LISTA.Children.Add(new TaskBlankSpace());
                                if (DateTime.Parse(separatordate).CompareTo(DateTime.Now.Date) == 0)
                                {
                                    LISTA.Children.Add(new TaskSeparator("Hoy, " + separatordate));
                                }
                                else
                                {
                                    LISTA.Children.Add(new TaskSeparator(separatordate));
                                }
                            }
                        }
                        LISTA.Children.Add(new Task(Padre, Connection, int.Parse(Connection.getData(x, 0))));
                    }
                }
                else
                {
                    LBL_NOTFOUND.Content    = "No tienes tareas completadas";
                    LBL_NOTFOUND.Visibility = Visibility.Visible;
                }
                break;
            }
            LISTA.Children.Add(new TaskBlankSpace());
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 28
0
 private void BTN_CREATE_ACCOUNT_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     if (Connection.testConnection())
     {
         if (!(string.IsNullOrEmpty(TXT_NICK.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_PASSWORD.Password.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_RE_PASSWORD.Password.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_NOMBRE.Text.Trim().Replace('\'', ' '))) && !(string.IsNullOrEmpty(TXT_EMAIL.Text.Trim().Replace('\'', ' '))))
         {
             if (TXT_PASSWORD.Password.Trim().Replace('\'', ' ') == TXT_RE_PASSWORD.Password.Trim().Replace('\'', ' '))
             {
                 Connection.ChangeTable("USR_USUARIOS", null);
                 Connection.ChangeSelect("SELECT USR_NICK FROM USR_USUARIOS WHERE BINARY UPPER(USR_NICK) = '" + TXT_NICK.Text.ToUpper().Trim().Replace('\'', ' ') + "'");
                 if (Connection.Conectar())
                 {
                     Connection.Desconectar();
                 }
                 if (!(Connection.countRows() > 0))
                 {
                     Connection.Conectar();
                     Connection.Insert_String("INSERT INTO USR_USUARIOS (USR_NICK,USR_PASSWORD,USR_NOMBRE,USR_EMAIL,USR_F_REGISTRO,USR_F_ULTIMA_V,USR_LAST_IP) VALUES (" +
                                              "'" + TXT_NICK.Text.Trim().Replace('\'', ' ') + "','" + EncriptarMD5.Encript(TXT_PASSWORD.Password.Trim().Replace('\'', ' ')) + "','" + TXT_NOMBRE.Text.Trim().Replace('\'', ' ') + "','" + TXT_EMAIL.Text.Trim().Replace('\'', ' ') + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + ObtenerIP.ExternalIPAddress.ToString() + "')");
                     Connection.Insert_Execute();
                     Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                              "'Register User','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "', 0)");
                     Connection.Insert_Execute();
                     Connection.Desconectar();
                     MessageBox.Show("¡Cuenta creada!\nRecuerda que es necesario que un administrador la active para poder usarla", "Información");
                     Padre.elementHost.Child = new Login(Padre, Connection);
                 }
                 else
                 {
                     if (Connection.Conectar())
                     {
                         Connection.Insert_String("INSERT INTO LOG_REGISTROS (LOG_TIPO,LOG_DESCRIPCION,LOG_IP,LOG_FECHA,LOG_USR_ID_PK) VALUES (" +
                                                  "'Bad Register User','USR: "******"','" + ObtenerIP.ExternalIPAddress.ToString() + "','" + DateTime.Now.ToString("yyyyMMdd") + "', 0)");
                         Connection.Insert_Execute();
                         Connection.Desconectar();
                     }
                     MessageBox.Show("Lo siento, ese nick ya está siendo utilizado", "Información");
                     TXT_NICK.Text            = "";
                     TXT_PASSWORD.Password    = "";
                     TXT_RE_PASSWORD.Password = "";
                 }
             }
             else
             {
                 MessageBox.Show("¡No has introducido correctamente ambas contraseñas!", "Información");
                 TXT_PASSWORD.Password    = "";
                 TXT_RE_PASSWORD.Password = "";
             }
         }
         else
         {
             MessageBox.Show("¡Debes rellenar todos los datos!", "Información");
             TXT_PASSWORD.Password    = "";
             TXT_RE_PASSWORD.Password = "";
         }
     }
     else
     {
         MessageBox.Show("Error, no se ha podido establecer conexión con el servidor", "Información");
     }
     System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
 }