コード例 #1
0
ファイル: Frm_Login.cs プロジェクト: lqingh/LightControl
        private void button1_Click(object sender, EventArgs e)
        {
            if (ValidateInput())
            {
                string    strMsg   = string.Empty;
                DataTable dt       = new DataTable();
                string    passWord = txtPwd.Text.Trim();
                string    userName = txtID.Text.Trim();
                if (TEST_DB.DBConnect(ref strMsg))
                {
                    string strSql = "select * from user where name = @userName and password = @passWord";
                    TEST_DB.Add_Param("@userName", userName);
                    TEST_DB.Add_Param("@passWord", passWord);
                    TEST_DB.ExecuteSQL(strSql, dt);
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                    else
                    {
                        com.TEST_DB = TEST_DB;
                        Frm_Main frmMain = new Frm_Main();                  //创建主窗体对象
                        frmMain.user          = userName;
                        frmMain.StartPosition = FormStartPosition.CenterScreen;
                        frmMain.Show();                                     //显示主窗体
                        this.Visible = false;
                    }
                }
                else
                {
                    MessageBox.Show(this, strMsg);
                }
                //    if (rdata.code == 10200)
                //  {

                //  Frm_Main frmMain = new Frm_Main();                  //创建主窗体对象
                //  frmMain.StartPosition = FormStartPosition.CenterScreen;
                //  frmMain.Show();                                     //显示主窗体
                //     this.Visible = false;
                // }
                //   com.user = JsonConvert.DeserializeObject<user>(rdata.result);


                //  MessageBox.Show(rdata.message);
            }
        }
コード例 #2
0
        //User login

        void UserLogin()
        {
            CLS_Users users = cmd_Users.GetUserByUsernameAndPassword(txtUsername.Text, HelperClass.EncryptPassword(txtPassword.Text));

            if (users != null)
            {
                UserInfo.currentUser = users;
                this.Hide();
                Frm_Main frm = new Frm_Main();
                frm.Show();
            }
            else
            {
                count++;
                XtraMessageBox.Show("تاكد من صحة اسم المستخدم وكلمة المرور", "دخول", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                HelperClass.ClearValue(tableLayoutPanel2);
            }

            if (count == 3)
            {
                Application.Exit();
            }
        }
コード例 #3
0
        private void Item_Confi_Click(object sender, EventArgs e)
        {
            Frm_Main frm_Main = new Frm_Main(usuario);

            frm_Main.Show();
        }