本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.DeleteRole方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.DeleteRole方法的具体用法?C# RoleController.DeleteRole怎么用?C# RoleController.DeleteRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Security.Roles.RoleController
的用法示例。
在下文中一共展示了RoleController.DeleteRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDeleteClick
/// -----------------------------------------------------------------------------
/// <summary>
/// cmdDelete_Click runs when the delete Button is clicked
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
/// -----------------------------------------------------------------------------
protected void OnDeleteClick(object sender, EventArgs e)
{
try
{
var objUser = new RoleController();
objUser.DeleteRole(_roleID, PortalSettings.PortalId);
//Clear Roles Cache
DataCache.RemoveCache("GetRoles");
Response.Redirect(Globals.NavigateURL());
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例2: RejectGroup
public HttpResponseMessage RejectGroup(NotificationDTO postData)
{
try
{
var recipient = InternalMessagingController.Instance.GetMessageRecipient(postData.NotificationId, UserInfo.UserID);
if (recipient == null) return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to locate recipient");
var notification = NotificationsController.Instance.GetNotification(postData.NotificationId);
ParseKey(notification.Context);
if (_roleInfo == null)
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to locate role");
}
if (!IsMod())
{
return Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Not Authorized!");
}
var notifications = new Notifications();
var roleCreator = UserController.GetUserById(PortalSettings.PortalId, _roleInfo.CreatedByUserID);
var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
notifications.AddGroupNotification(Constants.GroupRejectedNotification, _tabId, _moduleId, _roleInfo, siteAdmin, new List<RoleInfo> { _roleInfo }, roleCreator);
var roleController = new RoleController();
roleController.DeleteRole(_roleId, PortalSettings.PortalId);
NotificationsController.Instance.DeleteAllNotificationRecipients(postData.NotificationId);
return Request.CreateResponse(HttpStatusCode.OK, new {Result = "success"});
}
catch (Exception exc)
{
Logger.Error(exc);
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
}
}
示例3: RejectGroup
public ActionResult RejectGroup(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 (roleInfo == null)
{
return Json(new { Result = "error" });
}
if (!IsMod())
{
return Json(new { Result = "access denied" });
}
var notifications = new Notifications();
var roleCreator = UserController.GetUserById(PortalSettings.PortalId, roleInfo.CreatedByUserID);
var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
notifications.AddGroupNotification(Constants.GroupRejectedNotification, TabId, ModuleId, roleInfo, siteAdmin, new List<RoleInfo> { roleInfo }, roleCreator);
var roleController = new RoleController();
roleController.DeleteRole(RoleId, PortalSettings.PortalId);
NotificationsController.Instance.DeleteAllNotificationRecipients(notificationId);
return Json(new { Result = "success" });
}
catch (Exception exc)
{
DnnLog.Error(exc);
return Json(new { Result = "error" });
}
}
示例4: cmdDelete_Click
/// <summary>
/// cmdDelete_Click runs when the delete Button is clicked
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
protected void cmdDelete_Click( object sender, EventArgs e )
{
try
{
RoleController objUser = new RoleController();
objUser.DeleteRole( RoleID, PortalSettings.PortalId );
EventLogController objEventLog = new EventLogController();
objEventLog.AddLog( "RoleID", RoleID.ToString(), PortalSettings, UserId, EventLogController.EventLogType.ROLE_DELETED );
//Clear Roles Cache
DataCache.RemoveCache( "GetRoles" );
Response.Redirect( Globals.NavigateURL() );
}
catch( Exception exc ) //Module failed to load
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}