コード例 #1
0
ファイル: LoginForm.cs プロジェクト: D-Khoa/MyGit
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text.Length > 0)
            {
                EncryptDecrypt encrypt = new EncryptDecrypt();
                string         pass    = txtPassword.Text;
                pass = encrypt.Encrypt(pass);

                string usercd  = cmbUserCD.Text;
                string passcmd = "select password from m_login_password where user_cd ='" + usercd +
                                 "' and password ='******'";
                if (!string.IsNullOrEmpty(SQL.sqlExecuteScalarString(passcmd)))
                {
                    this.Hide();
                    txtPassword.Clear();
                    string cmd = "select user_name from m_mes_user where user_cd = '" + usercd + "'";
                    Userdata.GetData().userName = SQL.sqlExecuteScalarString(cmd);
                    cmd = "select registration_user_cd from m_login_password where user_cd = '" + usercd + "'";
                    Userdata.GetData().reg_user = SQL.sqlExecuteScalarString(cmd);
                    cmd = "select factory_cd from m_login_password where user_cd = '" + usercd + "'";
                    Userdata.GetData().factory = SQL.sqlExecuteScalarString(cmd);
                    MainMenuForm mainform      = new MainMenuForm();
                    mainform.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Wrong password!!!");
                    txtPassword.Clear();
                    txtPassword.Focus();
                }
            }
            else
            {
                MessageBox.Show("Input password!!!");
                txtPassword.Focus();
            }
        }
コード例 #2
0
 public CommonForm()
 {
     InitializeComponent();
     lbusername.Text = Userdata.GetData().userName;
     lbfactory.Text  = Userdata.GetData().factory;
 }