using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Windows.Navigation; using System.Text.RegularExpressions; using System.Net; using System.Xaml; using System.Xml; using System.Xml.Linq; using System.Data.SqlClient; using System.Data; using System.Timers; namespace Login_WPF { /// /// Interaction logic for Welcome.xaml /// public partial class Welcome : Window { public Welcome() { InitializeComponent(); //Main Controls MainWindows.MenuPrincipal.Iniciado.idle idle = new MainWindows.MenuPrincipal.Iniciado.idle(); stackpanel.Children.Add(idle); } private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.DragMove(); } public void Button_Click_2(object sender, RoutedEventArgs e) { //stackpanel.Children.Add(Eliminar); stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Agregar_o_Eliminar.Agregar Agregar = new MainWindows.MenuPrincipal.Agregar_o_Eliminar.Agregar(); MainWindows.MenuPrincipal.Agregar_o_Eliminar.Eliminar Eliminar = new MainWindows.MenuPrincipal.Agregar_o_Eliminar.Eliminar(); stackpanel.Children.Add(Agregar); } private void Button_Click_3(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Buscarclase.Buscar Buscar = new MainWindows.MenuPrincipal.Buscarclase.Buscar(); stackpanel.Children.Add(Buscar); } private void Button_Click_4(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Semana.Semana Semana = new MainWindows.MenuPrincipal.Semana.Semana(); stackpanel.Children.Add(Semana); } private void Button_Click_5(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Horario_detallado.Horariodetallado Horariodetall = new MainWindows.MenuPrincipal.Horario_detallado.Horariodetallado(); stackpanel.Children.Add(Horariodetall); } private void Button_Click_6(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Calendario.Calendario Calendario = new MainWindows.MenuPrincipal.Calendario.Calendario(); stackpanel.Children.Add(Calendario); } private void Button_Click_7(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Historial.Historial Historial = new MainWindows.MenuPrincipal.Historial.Historial(); stackpanel.Children.Add(Historial); } private void Button_Click_8(object sender, RoutedEventArgs e) { stackpanel.Children.Clear(); MainWindows.MenuPrincipal.Proyecciones.Proyecciones Proyecciones = new MainWindows.MenuPrincipal.Proyecciones.Proyecciones(); stackpanel.Children.Add(Proyecciones); } private void Button_Click_9(object sender, RoutedEventArgs e) { Profile.Profile Profile = new Profile.Profile(); Profile.Show(); } public void Window_Loaded_1(object sender, RoutedEventArgs e) { //Timers DateTime localDateTime = DateTime.Now; localDateTime = localDateTime.ToLocalTime(); //this.ServerDate.Text = localDateTime.ToString(); // ateTime utcDateTime = localDateTime.ToUniversalTime(); //LastconnDate.Text = utcDateTime.ToString(); } private void Button_Click_1(object sender, RoutedEventArgs e) { Login login = new Login(); login.Show(); this.Close(); } private void Button_Click(object sender, RoutedEventArgs e) { } void OnLoad(object sender, RoutedEventArgs e) { } private void Dev_Click(object sender, RoutedEventArgs e) { Emergency.Popups.Popupad Pupopad = new Emergency.Popups.Popupad(); Pupopad.Show(); this.Close(); } private void Tool_Click(object sender, RoutedEventArgs e) { } public void OnClosed(object sender, EventArgs e) { string matr = Matricula.Text; DateTime localDateTime = DateTime.Now; DateTime utcDateTime = localDateTime.ToUniversalTime(); LastconnDate.Text = utcDateTime.ToString(); SqlConnection con = new SqlConnection("Data Source=ESTUDIANTE-PC; Initial Catalog=UniversityDB2; Integrated Security=True;"); con.Open(); string Update; string Update2; //Formando el comando SQL Update = "UPDATE UNStudents SET Last_Connection= " + utcDateTime + " WHERE ID=" + matr; Update2 = "UPDATE UNStudents SET UNStatus= "+0+" WHERE id=" + matr; SqlCommand Updatecommand = new SqlCommand(Update, con); SqlCommand Updatecommand2 = new SqlCommand(Update2, con); //Ejecucion del comando en el servidor de BD Updatecommand.ExecuteNonQuery(); Updatecommand2.ExecuteNonQuery(); } } }