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; }
private void BTN_BORRAR_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; }
private void BTN_BORRAR_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 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.Delete_String("DELETE FROM TAR_TAREAS WHERE TAR_ID_PK = " + this.task_ID.ToString()); Connection.Delete_Execute(); Connection.Desconectar(); } Padre.elementHost.Child = new TaskList(Padre, Connection, 0); } System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; }
private void BTN_BORRAR_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; }