Beispiel #1
0
        /// <summary>
        /// 修改授权
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_certain_Click(object sender, EventArgs e)
        {
            //this.DialogResult = DialogResult.OK;
            if (txt_pwd.Text != "")
            {
                string pwd = Encrypt.Encode(txt_pwd.Text);


                if (new PersonService().LoginValidate(cmb_user.SelectedValue.ToString(), pwd))
                {
                    //引发事件并传递事件包含的数据,该事件检验用户名密码是否正确
                    AuthorizationEventArgs authorizationEventArgs = new AuthorizationEventArgs();
                    authorizationEventArgs.userAndPwdRight = true;
                    onAuthorizPass(authorizationEventArgs);

                    this.Close();
                }


                else
                {
                    lbl_information.Text = "";
                    lbl_information.Text = lbl_information.Text + "您输入授权密码不正确,请重新输入";
                }
            }
            else
            {
                lbl_information.Text = "";
                lbl_information.Text = "请输入授权密码";
            }
        }
Beispiel #2
0
 /// <summary>
 /// 事件处理方法,调用端实例化事件委托后就执行该方法
 /// authorizPass?本质上相当于执行方法时的第二次判断
 /// 引发事件是执行事件处理方法的第一次判断
 /// </summary>
 /// <param name="authorizationEventArgs"></param>
 protected virtual void onAuthorizPass(AuthorizationEventArgs authorizationEventArgs)
 {
     authorizPass?.Invoke(this, authorizationEventArgs);
 }