FrmLogin.cs
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public partial class FrmLogin : FrmBase
{
private string UserName = "admin".ToUpper();
private string UserPwd = "123456".ToUpper();
public FrmLogin()
{
string aa = ConfigAppSettings.GetValue(Setting_Init.UserName);
string ww = ConfigAppSettings.GetValue(Setting_Init.UserPwd);
if (!aa.Equals(""))
{
UserName = aa.ToUpper();
}
if (!ww.Equals(""))
{
UserPwd = ww;
}
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
string userName = txtUserName.Text.Trim();
string pwd = txtPwd.Text.Trim();
if (userName.ToUpper().Equals(UserName) && UserPwd.Equals(pwd))
{
FrmStoreBox lineStore = new FrmStoreBox();
this.Hide();
lineStore.ShowDialog();
this.Close();
}
else
{
if (!(userName.ToUpper().Equals(UserName)))
{
MessageBox.Show("请输入正确的用户名!");
txtUserName.Text = "";
txtUserName.Focus();
}
else
{
MessageBox.Show("请输入正确的密码!");
txtPwd.Focus();
txtPwd.Text = "";
}
}
}
private void FrmLogin_Load(object sender, EventArgs e)
{
this.AcceptButton = btnLogin;
string title = OnlineStore.Common.ConfigAppSettings.GetValue(Setting_Init.App_Title);
this.Text = title;
txtUserName.Focus();
int sizeH = this.Size.Height;
int sizeW = this.Size.Width;
int locationH=((sizeH-panel1.Size.Height)/2);
int locationW = (sizeH - panel1.Size.Width) / 2;
panel1.Size = new Size(locationW, locationH);
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}