本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.DeleteUserRole方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.DeleteUserRole方法的具体用法?C# RoleController.DeleteUserRole怎么用?C# RoleController.DeleteUserRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Security.Roles.RoleController
的用法示例。
在下文中一共展示了RoleController.DeleteUserRole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: grdUserRoles_Delete
/// <summary>
/// grdUserRoles_Delete runs when one of the Delete Buttons in the UserRoles Grid
/// is clicked
/// </summary>
/// <history>
/// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
public void grdUserRoles_Delete( object sender, DataGridCommandEventArgs e )
{
try
{
RoleController objUser = new RoleController();
string strMessage = "";
if( _roleId != - 1 )
{
if( objUser.DeleteUserRole( PortalId, int.Parse( Convert.ToString( grdUserRoles.DataKeys[e.Item.ItemIndex] ) ), _roleId ) == false )
{
strMessage = Localization.GetString( "RoleRemoveError", this.LocalResourceFile );
}
else
{
if( chkNotify.Checked )
{
SendNotification( int.Parse( Convert.ToString( grdUserRoles.DataKeys[e.Item.ItemIndex] ) ), _roleId, "remove" );
}
}
}
if( _userId != - 1 )
{
if( objUser.DeleteUserRole( PortalId, _userId, int.Parse( Convert.ToString( grdUserRoles.DataKeys[e.Item.ItemIndex] ) ) ) == false )
{
strMessage = Localization.GetString( "RoleRemoveError", this.LocalResourceFile );
}
else
{
if( chkNotify.Checked )
{
SendNotification( _userId, int.Parse( Convert.ToString( grdUserRoles.DataKeys[e.Item.ItemIndex] ) ), "remove" );
}
}
}
grdUserRoles.EditItemIndex = - 1;
BindGrid();
if( !String.IsNullOrEmpty(strMessage) )
{
UI.Skins.Skin.AddModuleMessage( this, strMessage, ModuleMessageType.RedError );
}
}
catch( Exception exc ) //Module failed to load
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}
示例2: RejectMember
public ActionResult RejectMember(int notificationId)
{
try
{
var recipient = InternalMessagingController.Instance.GetMessageRecipient(notificationId, UserInfo.UserID);
if (recipient == null) return Json(new { Result = "error" });
var notification = NotificationsController.Instance.GetNotification(notificationId);
ParseKey(notification.Context);
if (MemberId <= 0) return Json(new { Result = "error" });
if (roleInfo == null) return Json(new { Result = "error" });
var member = UserController.GetUserById(PortalSettings.PortalId, MemberId);
if (member != null)
{
var roleController = new RoleController();
roleController.DeleteUserRole(PortalSettings.PortalId, MemberId, roleInfo.RoleID);
var notifications = new Notifications();
var groupOwner = UserController.GetUserById(PortalSettings.PortalId, roleInfo.CreatedByUserID);
notifications.AddMemberNotification(Constants.MemberRejectedNotification, TabId, ModuleId, roleInfo, groupOwner, member);
NotificationsController.Instance.DeleteAllNotificationRecipients(notificationId);
return Json(new { Result = "success" });
}
} catch (Exception exc)
{
DnnLog.Error(exc);
}
return Json(new { Result = "error" });
}