예제 #1
0
        private void AutomaticLogin()
        {
            DataTable ret = service.UserService.UserExists(txtName.Text, txtPassword.Text);

            if (ret.Rows.Count == 1)
            {
                string power = ret.Rows[0]["power"].ToString();
                if (power != null && !"".Equals(power))
                {
                    listpower = power.Split(',').ToList();
                }
                name = this.txtName.Text;
                bean.loginLogBean lb = new bean.loginLogBean();
                lb.name       = name;
                lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                lb.eventInfo  = "登录系统!";
                if (lb.name != "admin" && lb.name != "" && lb.name != null)
                {
                    lls.addCheckLog(lb);
                }

                SplashScreen.CloseSplashScreen();
                this.Hide();
                frmMain main = new frmMain();
                main.hulie = 0;
                main.Show();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!");
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //用户登录 获取用户的账号和密码并判断
            DataTable ret = service.UserService.UserExists(txtName.Text, txtPassword.Text);

            if (ret.Rows.Count == 1)
            {
                string power = ret.Rows[0]["power"].ToString();
                if (power != null && !"".Equals(power))
                {
                    listpower = power.Split(',').ToList();
                }
                name  = this.txtName.Text;
                passw = this.txtPassword.Text;
                saveToXmlsStarttime(DateTime.Now.ToString("yyMMddHHmmss"));
                if (this.checkBox1.Checked)
                {
                    saveToXml(name, MemoryPassword.MyEncrypt.EncryptDES(passw));
                }
                else
                {
                    saveToXml("", "");
                }
                if (SplashScreen.Instance != null)
                {
                    SplashScreen.Instance.BeginInvoke(new MethodInvoker(SplashScreen.Instance.Dispose));
                    SplashScreen.Instance = null;
                }
                bean.loginLogBean lb = new bean.loginLogBean();
                lb.name       = name;
                lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                lb.eventInfo  = "登录系统!";
                if (lb.name != "admin" && lb.name != "" && lb.name != null)
                {
                    lls.addCheckLog(lb);
                }

                this.Hide();
                frmMain main = new frmMain();
                main.hulie = 0;
                main.Show();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!");
            }
        }