Exemple #1
0
        public ActionResult AdminDeleteProvide(Guid id)
        {
            if (!base.HasPermission("admin", PermissionOperate.delete))
            {
                return(JsonMessage(false, "你没有删除管理员的权限"));
            }

            Ocean.Entity.Admin admin = _adminService.GetById(id);
            _adminService.Delete(id.ToString());
            base.AddLog(string.Format("删除管理员[{0}]成功", admin.Name), AdminLoggerModuleEnum.Admin);
            return(JsonMessage(true, "删除成功"));
        }
Exemple #2
0
        public ActionResult AdminEdit()
        {
            if (!base.HasPermission("admin", PermissionOperate.add) && !base.HasPermission("admin", PermissionOperate.edit))
            {
                return(base.ShowNotPermissionTip(""));
            }

            string id = RQuery["Id"];

            Ocean.Entity.Admin admin = string.IsNullOrWhiteSpace(id) ? null : _adminService.GetById(new Guid(id));
            return(AdminView(admin));
        }
Exemple #3
0
        public ActionResult AdminUnFreezeProvide(Guid id)
        {
            if (!base.HasPermission("admin", PermissionOperate.unfreeze))
            {
                return(JsonMessage(false, "你没有解冻管理员的权限"));
            }

            Ocean.Entity.Admin admin = _adminService.GetById(id);

            if (_adminService.UnFreezeAdmin(id))
            {
                base.AddLog(string.Format("解冻管理员[{0}]成功", admin.Name), AdminLoggerModuleEnum.Admin);
            }

            return(JsonMessage(true, "解冻成功"));
        }
Exemple #4
0
        public ActionResult KfNumberEditProvide()
        {
            KfNumber kfNumber   = new KfNumber();
            Guid     oldAdminId = Guid.Empty;

            if (!string.IsNullOrWhiteSpace(RQuery["KfNumberId"]))
            {
                kfNumber   = _kfNumberService.GetById(new Guid(RQuery["KfNumberId"]));
                oldAdminId = kfNumber.AdminId;
            }

            UpdateModel <KfNumber>(kfNumber);

            if (kfNumber.AdminId == Guid.Empty || kfNumber.AdminId == null)
            {
                return(JsonMessage(false, "请选择分配管理员"));
            }

            if (string.IsNullOrWhiteSpace(RQuery["KfNumberId"]))
            {
                Ocean.Entity.Admin admin = _adminService.GetById(kfNumber.AdminId);

                if (admin.KfNumbers.Count != 0)
                {
                    return(JsonMessage(false, "当前所选管理员已被分配过工号"));
                }

                _kfNumberService.Insert(kfNumber);
                return(JsonMessage(true, "添加客服工号成功"));
            }
            else
            {
                if (oldAdminId != kfNumber.AdminId)
                {
                    Ocean.Entity.Admin admin = _adminService.GetById(kfNumber.AdminId);

                    if (admin.KfNumbers.Count != 0)
                    {
                        return(JsonMessage(false, "当前所选管理员已被分配过工号"));
                    }
                }

                _kfNumberService.Update(kfNumber);
                return(JsonMessage(true, "修改客服工号成功"));
            }
        }
Exemple #5
0
        public ActionResult UpdatePwd()
        {
            Guid id = new Guid(RQuery["Id"]);

            Ocean.Entity.Admin admin = _adminService.GetById(id);

            if (RQuery["NewPassword"] != RQuery["ConfirmPwd"])
            {
                return(JsonMessage(false, "两次输入密码不正确"));
            }

            if (Hash.MD5Encrypt(Hash.MD5Encrypt(RQuery["Password"])) != admin.Password)
            {
                return(JsonMessage(false, "原密码错误"));
            }

            admin.Password = Hash.MD5Encrypt(Hash.MD5Encrypt(RQuery["NewPassword"]));
            _adminService.Update(admin);
            base.AddLog(string.Format("管理员[{0}]修改密码成功", admin.Name), AdminLoggerModuleEnum.Admin);
            return(JsonMessage(true, "修改成功"));
        }