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
{
/// <summary>
/// Interaction logic for Welcome.xaml
/// </summary>
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();
string utcDate = utcDateTime.ToString();
SqlConnection con = new SqlConnection("workstation id=UniversityDB.mssql.somee.com; packet size=4096; user id=Nevercome2_SQLLogin_1; pwd=5rzbfru5dj; data source=UniversityDB.mssql.somee.com; persist security info=False; initial catalog=UniversityDB");
con.Open();
string Update;
string Update2;
//Formando el comando SQL
Update = "UPDATE UNStudents SET Last_Connection= "+100000+" 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();
}
}
}