Ejemplo n.º 1
0
 /// <summary>
 /// 冻结账户
 /// </summary>
 public void UserFreeZing(string UrId)
 {
     userManage.EditErrorloginLockTimeByPK(UrId, "5", DateTime.Now); // 修改输错次数
     userManage.EditStateByPk(UrId, "2");                            //  将状态改为冻结
     Jswork.Alert("亲, 您的账户已经被冻结请联系管理员或24小时后自动解冻 解冻时间为:" + DateTime.Now.AddDays(1).ToString("yyyy-MM-dd hh:mm:ss") + "", this.Page);
     InsertLog("用户账号冻结", string.Format("id:{0},datetime:{1}", UrId, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")), 0, GetPlatformIdByValue(1));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            #region 验证表单合法性
            if (this.CheckForms() == false)
            {
                CloseDivImplementation();
                return;
            }
            // new UsersMO().GetByUrLoginName()

            if (new UsersMO().GetByUrLoginName(txtToUser.Text.Trim()).Count() > 0)
            {
                Label1.Text = Resources.Resource.verification_successful;
                //"验证成功!";
            }
            else
            {
                Label1.Text = Resources.Resource.usernotexist;
                //"用户不存在!";
                return;
            }
            #endregion

            string _eoid  = "";
            string _eomid = "";

            foreach (UsersEO _eos in new UsersMO().GetByUrLoginName(lblUser.Text.Trim())) // 被复制ID
            {
                _eoid = _eos.UrId;
            }
            foreach (UsersEO _eoss in new UsersMO().GetByUrLoginName(txtToUser.Text.Trim())) // 目标ID
            {
                _eomid = _eoss.UrId;
            }


            string result  = "";
            int    winnum  = 0;                                             // 成功个数
            int    losenum = 0;                                             // 失败个数

            foreach (RoleuserEO _ruEO in new RoleuserMO().GetByUrId(_eoid)) // 循环 目标ID 拥有角色
            {
                RoleuserEO _fzeo = new RoleuserEO();
                _fzeo.UrId      = _eomid;
                _fzeo.RlId      = _ruEO.RlId;
                _fzeo.RuAddUser = GetUserID();
                _fzeo.RuAddTime = DateTime.Now;

                if (new RoleuserMO().GetByPK(_fzeo.UrId, _fzeo.RlId) == null)                                          // 不存在添加 存在不变
                {
                    if (new RoleuserMO().Add(_fzeo) > 0)                                                               // 添加目标Id成功
                    {
                        result += GetDisPlayName(_fzeo) + Resources.Resource.Tip_SuscessCopy;                          //(成功):复制权限:
                        if (rdoType.Text == "1")                                                                       // 转移
                        {
                            new RoleuserMO().RemoveByPK(_eoid, _fzeo.RlId);                                            // 删除原有角色
                            result += "id:" + _eoid + ",roleid:" + _fzeo.RlId + Resources.Resource.tip_delete_success; //删除成功
                        }
                        winnum++;
                    }
                    else //  失败
                    {
                        result += GetDisPlayName(_fzeo) + Resources.Resource.Tip_FaileCopy;//(失败):复制权限:
                        losenum++;
                    }
                }
                else
                {
                    if (rdoType.Text == "1")                            // 转移
                    {
                        new RoleuserMO().RemoveByPK(_eoid, _fzeo.RlId); // 删除原有角色
                        result += "id:" + _eoid + ",roleid:" + _fzeo.RlId + Resources.Resource.tip_delete_success;
                        //"删除成功";
                    }
                }
            }

            if (rdoType.Text == "1")                  // 转移
            {
                userManage.EditStateByPk(_eoid, "1"); // 将用户改为停用
            }

            this.div1.Visible = true;
            //this.Label2.Text = result;
            this.Label2.Text = "复制或转移成功";
            CloseDivImplementation();
            InsertLog(rdoType.Text == "1" ? Resources.Resource.transfer_authority : Resources.Resource.copy_authority, Resources.Resource.tip_content + result, -7, GetPlatformIdByValue(1));
        }