Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string dlname = this.textBox1.Text;
            string dlmima = this.textBox2.Text;

            //非空验证
            if (dlname == "" || dlmima == "")
            {
                MessageBox.Show("用户名或密码不能为空!", "验证错误:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string sql = string.Format(@"
SELECT [dengluname]
      ,[glmima]
      
  FROM [dbo].[guanliyuzhucexinxi]
where [dengluname]='{0}'

", dlname);

            SqlParameter[] parm = new SqlParameter[] {
                new  SqlParameter("@name", dlname),
                new  SqlParameter("@pwd", dlmima)
            };

            DataTable chaxun = DBHelper.Se("proc_adminLogin", parm);

            if (chaxun.Rows.Count == 0)
            {
                MessageBox.Show("用户名不存在!", "登录失败:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;

                //this.Hide();
            }
            if (chaxun.Rows[0]["glmima"].ToString() != dlmima)
            {
                MessageBox.Show("密码错误!", "登录失败:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (this.textBox3.Text != this.label5.Text)
            {
                this.label7.Text = "错误";
                MessageBox.Show("验证码错误!");
            }
            else if (this.textBox3.Text == this.label5.Text)
            {
                //登录成功!
                MessageBox.Show("登录成功!");
                Conmen.SuoQuGuanLiYuanDLName = this.textBox1.Text;

                shiping shiping = new shiping();
                shiping.ShowDialog();
                Frmguanliyuanmain dl = new Frmguanliyuanmain();
                dl.Show();
                //this.Show();
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string dlname = this.textBox1.Text;

            string dlmima = this.textBox2.Text;

            //非空验证
            if (dlname == "" || dlmima == "")
            {
                MessageBox.Show("用户名或密码不能为空!", "验证错误:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string sql = string.Format(@"
SELECT [yhdlname]
      ,[yhmima]
      ,[yhname]
      ,[gender]
      ,[sfz]
      ,[yhmenhao]
      ,[phone]
      ,[age]
      ,[area]
  FROM [dbo].[yonghuzhuce]
where [yhdlname]='{0}'

", dlname);

            SqlParameter[] parm = new SqlParameter[] {
                new  SqlParameter("@name", dlname),
                new SqlParameter("@pwd", dlmima)
            };
            DataTable chaxun = DBHelper.Se("proc_yongLogin", parm);

            if (chaxun.Rows.Count == 0)
            {
                MessageBox.Show("用户名不存在!", "登录失败:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;

                //this.Hide();
            }
            if (chaxun.Rows[0]["yhmima"].ToString() != dlmima)
            {
                MessageBox.Show("密码错误!", "登录失败:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (this.textBox3.Text != this.label5.Text)
            {
                this.label7.Text = "错误";
                MessageBox.Show("验证码错误!");
            }
            else if (this.textBox3.Text == this.label5.Text)
            {
                //登录成功!
                MessageBox.Show("登录成功!");
                //锁定登录名
                //获取当前用户的名字
                // Conmen.SuoQuName = dlname; //Conmen suoding = new Conmen();
                Conmen.SuoQuName = this.textBox1.Text;
                shiping shiping = new shiping();
                shiping.ShowDialog();
                Frmyonghumain dl = new Frmyonghumain();
                dl.Show();

                //this.Show();
            }
        }