sc 4 years ago
parent
commit
3c052000e3
  1. 2
      Models/SQL_Ti.edmx.diagram
  2. 4
      Models/UserAccountProvide.cs
  3. 24
      ViewModel/LogViewModel.cs
  4. 32
      Windows/LogWindow.xaml.cs

2
Models/SQL_Ti.edmx.diagram

@ -4,7 +4,7 @@
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="89d520d3675442b5b0979c510546a2e9" Name="Diagram1" ZoomLevel="70">
<Diagram DiagramId="89d520d3675442b5b0979c510546a2e9" Name="Diagram1" ZoomLevel="49">
<EntityTypeShape EntityType="TicketModel.Product" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="TicketModel.ProductInventory" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="TicketModel.ProductUsed" Width="1.5" PointX="2.75" PointY="3.75" IsExpanded="true" />

4
Models/UserAccountProvide.cs

@ -8,6 +8,8 @@ namespace Models
{
public class UserAccountProvide : IProvider<UserAccount>
{
private TicketEntities db = new TicketEntities();
public int Delete(UserAccount t)
{
throw new NotImplementedException();
@ -20,7 +22,7 @@ namespace Models
public List<UserAccount> Select()
{
throw new NotImplementedException();
return db.UserAccount.ToList();
}
public int Update(UserAccount t)

24
ViewModel/LogViewModel.cs

@ -12,23 +12,19 @@ namespace Audit.ViewModel
{
public class LogViewModel : ViewModelBase
{
public UserAccount UserAccount { get; set; } = AuditData.Instance.UserAccount;
// public UserAccount UserAccount { get; private set; } = AuditData.Instance.UserAccount;
private RelayCommand logCommand;
public RelayCommand LogCommand
//登录命令绑定
/* public RelayCommand LogCommand
{
get { return logCommand; }
set { logCommand = value; }
}
public LogViewModel()
{
logCommand = new RelayCommand(() =>
get
{
MessageBox.Show("成功");
});
return new RelayCommand(() =>
{
});
}
}
*/
}
}

32
Windows/LogWindow.xaml.cs

@ -1,4 +1,6 @@
using MahApps.Metro.Controls;
using GalaSoft.MvvmLight.Command;
using MahApps.Metro.Controls;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
@ -24,19 +26,17 @@ namespace Audit.Windows
{
InitializeComponent();
}
private void Exit(object sender, RoutedEventArgs e)//退出按钮
{
Application.Current.Shutdown();//关闭窗口
}
private void Log(object sender, RoutedEventArgs e)//登录按钮
{
string user = this.users.Text;
string passwd = this.Passwds.Text;
if (user == "setup")
{
if (this.users.Text == "sunlight")
{
if (passwd == "setup")
if (this.Passwds.Text == "sunlight")
{
MessageBox.Show("警告:进入设置模式请您明确操作目的及可能需承担的后果");
Windows.Set_up setup = new Windows.Set_up();
@ -45,12 +45,26 @@ namespace Audit.Windows
}
else
{
MessageBox.Show("ERR01:拒绝认证");//设置密码错误
MessageBox.Show("ERR.01:拒绝登录");//设置密码错误
}
}
else
{
UserAccountProvide UserAccountProvide = new UserAccountProvide();
var user = UserAccountProvide.Select()
.FirstOrDefault(item => item.UserCode == AuditData.Instance.UserAccount.UserCode
&& item.PassWord == AuditData.Instance.UserAccount.PassWord);
if (user == null)
{
MessageBox.Show("ERR.00:用户名或密码错误");
}
else
{
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
this.Close();
}
}
}
}

Loading…
Cancel
Save