/// <summary>
        /// 登录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //获取用户名跟密码
            string userAccount = cmbUserAccount.Text;
            string pwd         = txtPwd.Text;

            //判断用户名密码不为空
            if (CheckEmpty(userAccount, pwd))
            {
                //检测管理员单选框是否选中
                int flag = 0;
                if (ckbManager.Checked)
                {
                    flag = 1;
                }
                //将密码进行加密处理,让后与数据库中的密文进行比较
                string newPwd = Encryption(pwd);                                     //得到加密的密码
                //从数据库中获取此用户名对象  密码  id
                UserInfo user = userBLL.GetUserInfoByUserAccount(userAccount, flag); //有密码跟ID

                if (userLoginPwd.Length > 0)
                {//从登录历史表中获得到了密码
                    newPwd = userLoginPwd;
                }
                #region 进行判断
                if (user != null)
                {
                    if (user.UserPwd == newPwd)//登录成功
                    {
                        #region 1判断登录历史中是否有这个账号  2判断CKRembPwd是否选中
                        if (uLoginBLL.CheckAccIsExist(userAccount))
                        {     //存在账户
                            if (ckRemebPwd.Checked)
                            { //选中
                                //向登录历史表中插入密码 并修改时间
                                uLoginBLL.UpdatePwdAndTimeByAcc(userAccount, newPwd);
                            }
                            else
                            {//没有选中
                                //在登录历史表中清空密码,并更新时间
                                uLoginBLL.DelPwdUpdateTimeByAccount(userAccount);
                            }
                        }
                        else
                        {     //不存在
                            if (ckRemebPwd.Checked)
                            { //选中
                                uLoginBLL.InsertAccountAndPwd(userAccount, newPwd);
                            }
                            else
                            {//没有选中
                                uLoginBLL.InsertUserAccount(userAccount);
                            }
                        }
                        #endregion
                        //结果一致,则显示主窗体
                        #region 将此用户id 用户名传给主窗体
                        fea.UserId   = user.UserId;
                        fea.UserName = user.UserName;
                        frmMain fm = new frmMain();
                        this.MyEvent += fm.SetText;
                        if (MyEvent != null)
                        {
                            MyEvent(this, fea);
                        }

                        fm.Owner            = this;
                        cmbUserAccount.Text = "";
                        txtPwd.Text         = "";
                        this.Hide();//将登录窗体隐藏
                        fm.ShowDialog();
                        #endregion
                    }
                    else
                    {
                        labMsg.Text = "用户名或密码错误";
                    }
                }
                else
                {
                    labMsg.Text = "用户不存在";
                }
                #endregion

                #region 将此用户id传给主窗体
                //fea.UserId = user.UserId;
                //fea.UserName = user.UserName;
                // frmMain fm=new frmMain();
                // this.MyEvent += fm.SetText;
                // if (MyEvent!=null)
                // {
                //     MyEvent(this, fea);
                // }
                // fm.ShowDialog();
                #endregion
            } //不为空
        }     //方法结束