示例#1
0
        private void txtmm_KeyDown(object sender, KeyEventArgs e)
        {
            if (Keys.Enter == e.KeyCode)
            {
                string zh                   = "";
                string mm                   = "";
                string lab_name             = txtzh.Text;
                string lab_pass_word        = txtmm.Text;
                Maticsoft.BLL.username user = new Maticsoft.BLL.username();

                DataSet   ds        = user.GetList(string.Format(" user = '******' ", lab_name));
                DataTable dt        = ds.Tables[0];
                string    user_name = dt.Rows[0]["user"].ToString();
                string    password  = dt.Rows[0]["password"].ToString();
                global.power = dt.Rows[0]["power"].ToString();
                //MessageBox.Show("  " + password + " aa  ");

                //MessageBox.Show(dt.Rows.Count + " :count   " + user_name + " : username " + password + " :password  " + lab_name + " :lab_name  " + lab_pass_word + " :mm  ");
                if (user_name == lab_name && password == lab_pass_word)
                {
                    MainFrom mf = new MainFrom();
                    mf.Show();
                }
                else
                {
                    //MessageBox.Show("  " + password + " ===  " + mm);
                    MessageBox.Show("密码或账号不正确");
                    return;
                }
            }
        }
示例#2
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            string zh            = "";
            string mm            = "";
            string lab_name      = txtzh.Text;
            string lab_pass_word = txtmm.Text;

            Maticsoft.BLL.username user = new Maticsoft.BLL.username();

            DataSet   ds        = user.GetList(string.Format(" user = '******' ", lab_name));
            DataTable dt        = ds.Tables[0];
            string    user_name = dt.Rows[0]["user"].ToString();
            string    password  = dt.Rows[0]["password"].ToString();

            global.power = dt.Rows[0]["power"].ToString();
            //MessageBox.Show("  " + password + " aa  ");

            //MessageBox.Show(dt.Rows.Count + " :count   " + user_name + " : username " + password + " :password  " + lab_name + " :lab_name  " + lab_pass_word + " :mm  ");
            if (user_name == lab_name && password == lab_pass_word)
            {
                MainFrom mf = new MainFrom();
                mf.Show();
            }
            else
            {
                //MessageBox.Show("  " + password + " ===  " + mm);
                MessageBox.Show("密码或账号不正确");
                return;
            }

            /*
             * Maticsoft.BLL.username use = new Maticsoft.BLL.username();
             * DataSet ds = use.GetAllList();
             * for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             * {
             *  zh = ds.Tables[0].Rows[i]["user"].ToString();
             *  mm = ds.Tables[0].Rows[i]["password"].ToString();
             *
             *
             * if (txtzh.Text == zh && txtmm.Text == mm)
             * {
             *  MainFrom mf = new MainFrom();
             *  mf.Show();
             *      break;
             * }
             * }
             * if(txtzh.Text != zh || txtmm.Text != mm)
             * {
             *  MessageBox.Show("密码或账号不正确");
             *  return;
             * }
             */
            //MainFrom mf = new MainFrom();
            //mf.Show();
        }