|
|
|
|
|
using CommonFunc;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
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 Xceed.Wpf.Toolkit.Core.Converters;
|
|
|
|
|
|
using XGL.Data;
|
|
|
|
|
|
using XGL.FormItem;
|
|
|
|
|
|
using XGL.Models;
|
|
|
|
|
|
namespace XGL
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// LoginPage.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class LoginPage : Window
|
|
|
|
|
|
{
|
|
|
|
|
|
public static LoginPage loginpage;
|
|
|
|
|
|
string UserCarNo = "";
|
|
|
|
|
|
public LoginPage()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
loginpage = this;
|
|
|
|
|
|
this.Hide();
|
|
|
|
|
|
Main mainWindow = new Main();
|
|
|
|
|
|
mainWindow.Show();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LoginUser();
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void rdoUserLogin_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (Convert.ToBoolean(rdoUserLogin.IsChecked))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// lblUserNm.Visibility = Visibility.Visible;
|
|
|
|
|
|
// txtPwd.Visibility = Visibility.Visible;
|
|
|
|
|
|
// txtUserNm.Visibility = Visibility.Visible;
|
|
|
|
|
|
// lblPwd.Visibility = Visibility.Visible;
|
|
|
|
|
|
// txtUserNm.Text = "";
|
|
|
|
|
|
// txtPwd.Password = "";
|
|
|
|
|
|
// txtPwd.Focusable = true;
|
|
|
|
|
|
// txtUserNm.Focusable = true;
|
|
|
|
|
|
// txtUserNm.Focus();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void rdoCardLogin_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (Convert.ToBoolean(rdoCardLogin.IsChecked))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// lblUserNm.Visibility = Visibility.Hidden;
|
|
|
|
|
|
// txtPwd.Visibility = Visibility.Hidden;
|
|
|
|
|
|
// txtUserNm.Visibility = Visibility.Hidden;
|
|
|
|
|
|
// lblPwd.Visibility = Visibility.Hidden;
|
|
|
|
|
|
// //txtCarNm.Visibility = Visibility.Visible;
|
|
|
|
|
|
// //btnSubmit.Focusable = false;
|
|
|
|
|
|
// txtPwd.Focusable = false;
|
|
|
|
|
|
// txtUserNm.Focusable = false;
|
|
|
|
|
|
// UserCarNo = "";
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// Application.Current.Shutdown();
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Window_KeyUp(object sender, KeyEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (e.Key.ToString().ToLower() == "return")
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// LoginUser();
|
|
|
|
|
|
// UserCarNo = "";
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// UserCarNo += e.Key.ToString().ToUpper().Replace("D", "");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void LoginUser()
|
|
|
|
|
|
{
|
|
|
|
|
|
//bool carLogin = false;
|
|
|
|
|
|
//if (Convert.ToBoolean(rdoCardLogin.IsChecked))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (string.IsNullOrWhiteSpace(UserCarNo))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// MessageBox.Show("请输入员工卡号", "提示", MessageBoxButton.OK);
|
|
|
|
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// carLogin = true;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (string.IsNullOrWhiteSpace(this.txtUserNm.Text))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// MessageBox.Show("请输入员工账号", "提示", MessageBoxButton.OK);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if (string.IsNullOrWhiteSpace(this.txtPwd.Password))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// MessageBox.Show("请输入员工密码", "提示", MessageBoxButton.OK);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
// using (common_auth_userDb userDb = new common_auth_userDb())
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
// List<common_auth_userModel> Items = userDb.GetList(" user_name='" + this.txtUserNm.Text + "' AND password='admin123'")
|
|
|
|
|
|
// /*List<common_auth_userModel> Items = userDb.GetList(" user_name='" + this.txtUserNm.Text + "' AND password='" + DESProvider.EncryptString(this.txtPwd.Password) + "'")*/;
|
|
|
|
|
|
// if (Items.Count > 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// using (common_auth_userroleDb userroleDB = new common_auth_userroleDb())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// userDb.InsertLoginlog(Items[0].LoginName, Items[0].FullName,int.Parse(Common.LineCode));
|
|
|
|
|
|
// this.Hide();
|
|
|
|
|
|
// Main mainWindow = new Main();
|
|
|
|
|
|
// mainWindow.Show();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// UserCarNo = "";
|
|
|
|
|
|
// MessageBox.Show("用户已失效或不存在,请联系管理员!", "提示", MessageBoxButton.OK);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// carLogin = false;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//try
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
|
|
|
|
// Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Label_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.txtUserNm.Text = "admin";
|
|
|
|
|
|
this.txtPwd.Password = "admin123";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|