/// <summary> /// Update selected role /// </summary> /// <param name="pRole"></param> /// <returns>A struct contains, if necessary, errors occurs</returns> public RoleErrors UpdateRole(Role pRole) { RoleErrors roleErrors = new RoleErrors(); _roleManager.UpdateRole(pRole); roleErrors.ErrorCode = "RoleUpdated"; return(roleErrors); }
/// <summary> /// Save selected role /// </summary> /// <param name="pRole"></param> /// <returns>A struct contains, if necessary, errors occurs</returns> public RoleErrors SaveRole(Role pRole) { RoleErrors roleErrors = new RoleErrors(); if (string.IsNullOrEmpty(pRole.RoleName)) { roleErrors.FindError = true; roleErrors.RoleNameError = true; //roleErrors.ResultMessage += "\n - " + MultiLanguageStrings.GetString(Ressource.StringRes, "Role_RoleName_Empty.Text"); roleErrors.ErrorCode = "RoleNameEmpty"; } if (roleErrors.FindError) { return(roleErrors); } if (pRole.Id == 0) { if (_roleManager.SelectRole(pRole.RoleName, true) != null) { roleErrors.FindError = true; //roleErrors.ResultMessage += "\n - " + MultiLanguageStrings.GetString(Ressource.StringRes, "Role_Save_AlreadyExist.Text"); roleErrors.ErrorCode = "RoleExists"; } else { _roleManager.AddRole(pRole); //roleErrors.ResultMessage = MultiLanguageStrings.GetString(Ressource.StringRes, "Role_Save_OK.Text"); roleErrors.ErrorCode = "RoleCreated"; } } else { //user UpdateRoles for this block } return(roleErrors); }
/// <summary> /// Update selected role /// </summary> /// <param name="pRole"></param> /// <returns>A struct contains, if necessary, errors occurs</returns> public RoleErrors UpdateRole(Role pRole) { RoleErrors roleErrors = new RoleErrors(); _roleManager.UpdateRole(pRole); roleErrors.ErrorCode = "RoleUpdated"; return roleErrors; }
/// <summary> /// Save selected role /// </summary> /// <param name="pRole"></param> /// <returns>A struct contains, if necessary, errors occurs</returns> public RoleErrors SaveRole(Role pRole) { RoleErrors roleErrors = new RoleErrors(); if (string.IsNullOrEmpty(pRole.RoleName)) { roleErrors.FindError = true; roleErrors.RoleNameError = true; //roleErrors.ResultMessage += "\n - " + MultiLanguageStrings.GetString(Ressource.StringRes, "Role_RoleName_Empty.Text"); roleErrors.ErrorCode = "RoleNameEmpty"; } if (roleErrors.FindError) return roleErrors; if (pRole.Id == 0) { if (_roleManager.SelectRole(pRole.RoleName,true) != null) { roleErrors.FindError = true; //roleErrors.ResultMessage += "\n - " + MultiLanguageStrings.GetString(Ressource.StringRes, "Role_Save_AlreadyExist.Text"); roleErrors.ErrorCode = "RoleExists"; } else { _roleManager.AddRole(pRole); //roleErrors.ResultMessage = MultiLanguageStrings.GetString(Ressource.StringRes, "Role_Save_OK.Text"); roleErrors.ErrorCode = "RoleCreated"; } } else { //user UpdateRoles for this block } return roleErrors; }
/// <summary> /// Update selected role /// </summary> /// <param name="pRole"></param> /// <returns>A struct contains, if necessary, errors occurs</returns> public RoleErrors UpdateRole(Role pRole) { RoleErrors roleErrors = new RoleErrors(); _roleManager.UpdateRole(pRole); //roleErrors.ResultMessage = MultiLanguageStrings.GetString(Ressource.StringRes, "Role_Update_OK.Text"); roleErrors.ErrorCode = "RoleUpdated"; return roleErrors; }