ab56a9bcf7
SVN-Revision: r240
94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using DevExpress.XtraEditors;
|
|
using Lskj.Control;
|
|
using Lskj.Core;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.Main
|
|
{
|
|
public partial class FrmVerify : XtraForm
|
|
{
|
|
public FrmVerify()
|
|
{
|
|
InitializeComponent();
|
|
this.OkBtn.Click += OkBtn_Click;
|
|
this.CancelBtn.Click += CancelBtn_Click;
|
|
this.txtPass.KeyDown += TxtPass_KeyDown;
|
|
}
|
|
|
|
private void TxtPass_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
OkBtn_Click(this.txtPass, null);
|
|
}
|
|
}
|
|
|
|
private void CancelBtn_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
private void OkBtn_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string password = this.txtPass.Text.Trim();
|
|
int keyHandle = ERPInfo.Instance.keyHandles[0];
|
|
int uPin1 = Convert.ToInt32("0x987F6BCD", 16);
|
|
int uPin2 = Convert.ToInt32("0xE193C5B2", 16);
|
|
int uPin3 = Convert.ToInt32("0xD507CC28", 16);
|
|
int uPin4 = Convert.ToInt32("0x4B125AF6", 16);
|
|
int rtn = SmartX1Api.SmartX1Open(keyHandle, uPin1, uPin2, uPin3, uPin4);
|
|
if (rtn == 0)
|
|
{
|
|
byte[] readBuffer = new byte[256];
|
|
int add = 0;
|
|
int len = 256;
|
|
int readPageRtn = SmartX1Api.SmartX1ReadPage(keyHandle, 0, add, ref len, readBuffer);
|
|
if (readPageRtn == 0)
|
|
{
|
|
string savePassword = Encoding.Default.GetString(readBuffer).Replace("\0", "");
|
|
if (savePassword.Equals(SHAHelper.EncryptPassword(password)))
|
|
{
|
|
ERPInfo.Instance.isDogVerifyPassword = false;
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("密码输入错误,请重试");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("U盾数据获取失败,请重试或联系管理员");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("U盾数据获取失败,请重试或联系管理员");
|
|
return;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void mainGroup_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
e.Graphics.Clear(this.BackColor);
|
|
}
|
|
}
|
|
}
|