/// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //解决确定后窗体关闭问题
            DialogResult = DialogResult.None;
            //用户组名称
            string name = _txtGroupName.Text.ToString().Trim();

            //检查用户组名称不能为空,不能重复
            if (LibCommon.Validator.checkSpecialCharacters(name) || LibCommon.Validator.IsEmpty(name) || UserGroupInformationManagementBLL.FindTheSameGroupName(name))
            {
                Alert.alert(LibCommon.Const.USER_GROUP_NAME_IS_WRONG, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //设置焦点
                _txtGroupName.Focus();
                return;
            }
            //选择用户的数量
            int userCount = _lstSelUserName.Items.Count;

            //定义用户组信息实体
            LibEntity.UserGroup ent = new LibEntity.UserGroup();
            //组名
            ent.GroupName = _txtGroupName.Text.ToString().Trim();
            //人数
            ent.UserCount = userCount.ToString();
            //备注
            ent.Remark = _rtxtRemarks.Text.ToString().Trim();
            //插入数据库
            UserGroupInformationManagementBLL.InsertRecordIntoTableUserGroupInformation(ent);

            //修改用户登录信息表中记录的组名
            for (int i = 0; i < userCount; i++)
            {
                UserGroupInformationManagementBLL.ChangeUserGroup(ent.GroupName, _lstSelUserName.Items[i].ToString());
            }

            DataTable dt = UserGroupInformationManagementBLL.GetUserGroupInformation();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                UserGroupInformationManagementBLL.UpdateUserCountFromUserGroup(dt.Rows[i][UserGroupInformationMangementDbConstNames.USER_GROUP_NAME].ToString());
            }
            this.Close();
        }
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //登录名
            string loginname = _txtLoginName.Text;
            //密码
            string password = _txtPassWord.Text;
            //所属用户组
            string groupname = _cboGroup.Text;
            //权限
            string permission = _cboPermission.Text;
            //备注
            string remarks = _rtxtRemark.Text;

            //用户登录名不能包含特殊字符且不能为空
            //查空、特殊字符
            if (LibCommon.Validator.checkSpecialCharacters(_txtLoginName.Text.ToString()) || LibCommon.Validator.IsEmpty(_txtLoginName.Text.ToString()))
            {
                Alert.alert(LibCommon.Const.LOGIN_NAME_IS_WRONG, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                _txtLoginName.Focus();
                return;
            }

            //添加时查重
            if (_strIsAddOrModify == "add")
            {
                UserLogin entAdd = UserLogin.FindOneByLoginName(_txtLoginName.Text.ToString().Trim());
                if (entAdd != null)
                {
                    if (entAdd.LoginName == _txtLoginName.Text.ToString())
                    {
                        Alert.alert(LibCommon.Const.LOGIN_NAME_EXIST, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        _txtLoginName.Focus();
                        return;
                    }
                }
            }
            //修改
            else if (_strIsAddOrModify == "modify")
            {
                UserLogin entModify = UserLogin.Find(_needModifyEnt.Id);
                if (entModify != null)
                {
                    Alert.alert(LibCommon.Const.LOGIN_NAME_EXIST, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    _txtLoginName.Focus();
                    return;
                }
            }

            //密码不能包含特殊字符且不能为空
            if (LibCommon.Validator.checkSpecialCharacters(password) || LibCommon.Validator.IsEmptyOrBlank(password))
            {
                Alert.alert(LibCommon.Const.PASS_WORD_IS_WRONG, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                _txtPassWord.Focus();
                return;
            }

            //确认密码不能为空且必须与密码值相同
            if (_txtConfirmPassword.Text != _txtPassWord.Text)
            {
                Alert.alert(LibCommon.Const.CONFIRM_PASSWORD_IS_WRONG, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                _txtConfirmPassword.Focus();
                return;
            }

            //权限选择不能为空
            if (_cboPermission.SelectedItem == null)
            {
                Alert.alert(LibCommon.Const.PERMISSION_IS_WRONG, LibCommon.Const.NOTES, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                _cboPermission.Focus();
                return;
            }

            //定义用户实体
            UserLogin ent = new UserLogin();

            //登录名
            ent.LoginName = loginname;
            //密码
            ent.PassWord = password;
            //权限
            ent.Permission = permission;
            //所属用户组
            ent.GroupName = groupname;
            //备注
            ent.Remarks = remarks;
            //尚未登录系统,在插入新值时,默认为True
            ent.IsLogined = 0;
            //记住密码,在插入新值时,默认为False
            ent.IsSavePassWord = 0;

            //添加
            if (_strIsAddOrModify == "add")
            {
                //数据库插值
                ent.Save();
                UserGroupInformationManagementBLL.UpdateUserCountFromUserGroup(ent.GroupName);
            }
            //修改
            if (_strIsAddOrModify == "modify")
            {
                //数据库更新,ent代表修改的实体,参数2代表LoginName
                UserLogin.FindOneByLoginName(UserLoginInformationManagement._userSel[0]);
                ent.LoginName      = loginname;
                ent.PassWord       = password;
                ent.Permission     = permission;
                ent.GroupName      = groupname;
                ent.Remarks        = remarks;
                ent.IsLogined      = 0;
                ent.IsSavePassWord = 0;
                ent.Save();
            }

            //初次登录系统时,需要添加新用户。记录初次登录的用户名与密码,并直接输入到LoginForm中
            if (LibCommon.Const.FIRST_TIME_LOGIN)
            {
                LibCommon.Const.FIRST_LOGIN_NAME       = ent.LoginName;
                LibCommon.Const.FIRST_LOGIN_PASSWORD   = ent.PassWord;
                LibCommon.Const.FIRST_LOGIN_PERMISSION = ent.Permission;
                this.Close();
                return;
            }
            this.Close();
        }