/// <summary> /// 对单条记录进行添加(或者修改) /// </summary> /// <param name="keyGuid"></param> /// <returns></returns> public ActionResult Item(string keyGuid) { Guid targetGuid = Converter.TryToGuid(keyGuid); BusinessRole targetObject = BusinessRoleBLL.Get(targetGuid); return(View(targetObject)); }
/// <summary> /// 角色对应的权限 /// </summary> /// <param name="targetKey"></param> /// <param name="targetName"></param> /// <returns></returns> public ActionResult Permission(string targetKey, string targetName = "") { Guid targetGuid = Converter.TryToGuid(targetKey); if (string.IsNullOrWhiteSpace(targetName)) { targetName = BusinessRoleBLL.Get(targetGuid).RoleName; } string returnUrl = RequestHelper.CurrentRequest.AppRelativeCurrentExecutionFilePath; return(RedirectToAction("Index", "Permission", new { ownerGuid = targetKey, ownerName = targetName, ownerType = ExecutorTypes.Role, permissionMode = PermissionModes.Allow, returenUrl = returnUrl })); }
public ActionResult Item(string keyGuid, BusinessRole entity, bool isOnlyPlaceHolder = true) { Guid targetGuid = Converter.TryToGuid(keyGuid); bool isSuccessful = false; string displayMessage = string.Empty; BusinessRole targetRole = null; if (targetGuid == Guid.Empty) { targetRole = new BusinessRole(); targetRole.RoleGuid = GuidHelper.NewGuid(); SetTargetEntityValue(entity, ref targetRole); CreateUserRoleStatuses status; BusinessRoleBLL.CreateRole(targetRole, out status); if (status == CreateUserRoleStatuses.Successful) { isSuccessful = true; } else { isSuccessful = false; } } else { targetRole = BusinessRoleBLL.Get(targetGuid); SetTargetEntityValue(entity, ref targetRole); isSuccessful = BusinessRoleBLL.UpdateRole(targetRole); } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败"; } return(Json(new LogicStatusInfo(isSuccessful, displayMessage))); }
/// <summary> /// 内部员工生日提醒是发送到配置文件中设置的生日提醒接收人角色 /// </summary> /// <param name="birthdayUserList"></param> protected override void DispatchRemindMessage(List <BusinessUser> birthdayUserList) { string[] roles = StringHelper.SplitToArray(SystemTaskInConfig.GetAddonItemValue("receiveRoleNames")); RemindEntity remindEntity = CreateRemindEntity(); foreach (BusinessUser currentUser in birthdayUserList) { remindEntity.RemindTitle = string.Format("同事【{0}】将在{1}过生日", currentUser.UserNameDisplay, currentUser.UserBirthDay.ToShortDateString()); remindEntity.RemindCategory = RemindCategories.BirthdayRemindOfEmployee; remindEntity.RemindUrl = string.Empty; //向指定的角色发送提醒数据 foreach (string currentRole in roles) { BusinessRole role = BusinessRoleBLL.Get(currentRole); RemindBLL.Instance.Create(role.ExecutorGuid, ExecutorTypes.Role, remindEntity); } } }