本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.GetRole方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.GetRole方法的具体用法?C# RoleController.GetRole怎么用?C# RoleController.GetRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Security.Roles.RoleController
的用法示例。
在下文中一共展示了RoleController.GetRole方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save_Click
private void Save_Click(object sender, EventArgs e)
{
if (GroupId > 0)
{
RoleController roleController = new RoleController();
Security.PortalSecurity ps = new Security.PortalSecurity();
txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoScripting);
txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoMarkup);
var roleInfo = roleController.GetRole(GroupId, PortalId);
if (roleInfo != null)
{
roleInfo.Description = txtDescription.Text;
roleInfo.IsPublic = rdAccessTypePublic.Checked;
if (roleInfo.Settings.ContainsKey("URL"))
{
roleInfo.Settings["URL"] = Globals.NavigateURL(TabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() });
} else
{
roleInfo.Settings.Add("URL", Globals.NavigateURL(TabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
}
if (roleInfo.Settings.ContainsKey("ReviewMembers"))
{
roleInfo.Settings["ReviewMembers"] = chkMemberApproved.Checked.ToString();
} else
{
roleInfo.Settings.Add("ReviewMembers", chkMemberApproved.Checked.ToString());
}
TestableRoleController.Instance.UpdateRoleSettings(roleInfo, true);
roleController.UpdateRole(roleInfo);
if (inpFile.PostedFile.ContentLength > 0)
{
IFileManager _fileManager = FileManager.Instance;
IFolderManager _folderManager = FolderManager.Instance;
var rootFolderPath = PathUtils.Instance.FormatFolderPath(PortalSettings.HomeDirectory);
IFolderInfo groupFolder = _folderManager.GetFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
if (groupFolder == null)
{
groupFolder = _folderManager.AddFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
}
if (groupFolder != null)
{
var fileName = Path.GetFileName(inpFile.PostedFile.FileName);
var fileInfo = _fileManager.AddFile(groupFolder, fileName, inpFile.PostedFile.InputStream, true);
roleInfo.IconFile = "FileID=" + fileInfo.FileId;
roleController.UpdateRole(roleInfo);
}
}
}
Response.Redirect(Globals.NavigateURL(TabId, "", new String[] { "groupid=" + GroupId.ToString() }));
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.jQuery.RegisterDnnJQueryPlugins(this.Page);
imgGroup.Src = Page.ResolveUrl("~/DesktopModules/SocialGroups/Images/") + "sample-group-profile.jpg";
if (!Page.IsPostBack && GroupId > 0)
{
RoleController roleController = new RoleController();
var roleInfo = roleController.GetRole(GroupId, PortalId);
if (roleInfo != null)
{
if (!UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
{
if (roleInfo.CreatedByUserID != UserInfo.UserID)
{
Response.Redirect(ModuleContext.NavigateUrl(TabId, "", false, new String[] { "groupid=" + GroupId.ToString() }));
}
}
txtGroupName.Visible = !roleInfo.IsSystemRole;
reqGroupName.Enabled = !roleInfo.IsSystemRole;
if(!roleInfo.IsSystemRole)
txtGroupName.Text = roleInfo.RoleName;
else
litGroupName.Text = roleInfo.RoleName;
txtDescription.Text = roleInfo.Description;
rdAccessTypePrivate.Checked = !roleInfo.IsPublic;
rdAccessTypePublic.Checked = roleInfo.IsPublic;
if (roleInfo.Settings.ContainsKey("ReviewMembers"))
{
chkMemberApproved.Checked = Convert.ToBoolean(roleInfo.Settings["ReviewMembers"].ToString());
}
imgGroup.Src = roleInfo.PhotoURL;
}
else
{
Response.Redirect(ModuleContext.NavigateUrl(TabId, "", false));
}
}
}
示例3: CreateGroupFolder
public File CreateGroupFolder(int roleID, int portalID, UserInfo currentUser)
{
FileController ctrl = new FileController();
File rootGroupFolder = new File();
//rootGroupFolder.ChildCount = 0;
rootGroupFolder.CreatedByUserID = currentUser.UserID;
rootGroupFolder.CreatedByUserName = currentUser.DisplayName;
rootGroupFolder.CreatedDate = System.DateTime.Now;
rootGroupFolder.IsInTrash = false;
rootGroupFolder.IsFolder = true;
rootGroupFolder.ItemType = 0;
rootGroupFolder.LastModifiedByUserID = currentUser.UserID;
rootGroupFolder.LastModifiedByUserName = currentUser.DisplayName;
rootGroupFolder.LastModifiedDate = System.DateTime.Now;
RoleController ctrlRole = new RoleController();
RoleInfo role = ctrlRole.GetRole(roleID, portalID);
rootGroupFolder.Name = role.RoleName;
rootGroupFolder.ParentID = GetRootGroupsFolder(portalID, currentUser.UserID).ID;
rootGroupFolder.PortalID = portalID;
rootGroupFolder.RoleID = roleID;
ctrl.Create(rootGroupFolder);
Permission permission = new Permission();
permission.CanAddFiles = true;
permission.CanAddFolders = true;
permission.CanDelete = false;
permission.CanModify = false;
permission.CanModifyPermission = false;
permission.CanSee = true;
permission.FileID = rootGroupFolder.ID;
permission.ModuleID = 0;
permission.PortalID = portalID;
permission.RoleID = role.RoleID;
permission.RoleName = role.RoleName;
PermissionController ctrlPerm = new PermissionController();
ctrlPerm.Create(permission);
return rootGroupFolder;
}
示例4: ShowTrial
protected bool ShowTrial(int roleID)
{
var objRoles = new RoleController();
bool showTrial = Null.NullBoolean;
RoleInfo objRole = objRoles.GetRole(roleID, PortalSettings.PortalId);
if (objRole.TrialFrequency == "N" || (objRole.IsPublic && objRole.ServiceFee == 0.0))
{
showTrial = Null.NullBoolean;
}
else if (objRole.IsPublic && objRole.TrialFee == 0.0)
{
//Use Trial?
UserRoleInfo objUserRole = objRoles.GetUserRole(PortalId, UserInfo.UserID, roleID);
if ((objUserRole == null) || (!objUserRole.IsTrialUsed))
{
showTrial = true;
}
}
return showTrial;
}
示例5: Subscribe
private void Subscribe(int roleID, bool cancel)
{
var objRoles = new RoleController();
RoleInfo objRole = objRoles.GetRole(roleID, PortalSettings.PortalId);
if (objRole.IsPublic && objRole.ServiceFee == 0.0)
{
objRoles.UpdateUserRole(PortalId, UserInfo.UserID, roleID, cancel);
//Raise SubscriptionUpdated Event
OnSubscriptionUpdated(new SubscriptionUpdatedEventArgs(cancel, objRole.RoleName));
}
else
{
if (!cancel)
{
Response.Redirect("~/admin/Sales/PayPalSubscription.aspx?tabid=" + TabId + "&RoleID=" + roleID, true);
}
else
{
Response.Redirect("~/admin/Sales/PayPalSubscription.aspx?tabid=" + TabId + "&RoleID=" + roleID + "&cancel=1", true);
}
}
}
示例6: CheckSecurity
private bool CheckSecurity()
{
bool boolPassedSecurity = false;
HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
select HelpDesk_Tasks).FirstOrDefault();
if (objHelpDesk_Tasks == null)
{
pnlEditTask.Visible = false;
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
}
// User not logged in
if (UserId == -1)
{
// Must have the valid password
if (Request.QueryString["TP"] != null)
{
// Check the password for this Ticket
if (objHelpDesk_Tasks.TicketPassword == Convert.ToString(Request.QueryString["TP"]))
{
boolPassedSecurity = true;
}
else
{
boolPassedSecurity = false;
}
}
}
// User is logged in
if (UserId > -1)
{
// Is user an Admin?
string strAdminRoleID = GetAdminRole();
if (UserInfo.IsInRole(strAdminRoleID) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser)
{
boolPassedSecurity = true;
CommentsControl.ViewOnly = false;
}
// Is user the Requestor?
if (UserId == objHelpDesk_Tasks.RequesterUserID)
{
boolPassedSecurity = true;
}
//Is user in the Assigned Role?
RoleController objRoleController = new RoleController();
RoleInfo objRoleInfo = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);
if (objRoleInfo != null)
{
if (UserInfo.IsInRole(objRoleInfo.RoleName))
{
boolPassedSecurity = true;
CommentsControl.ViewOnly = false;
}
}
// Does user have a valid temporary password?
if (Request.QueryString["TP"] != null)
{
// Check the password for this Ticket
if (objHelpDesk_Tasks.TicketPassword == Convert.ToString(Request.QueryString["TP"]))
{
boolPassedSecurity = true;
}
else
{
boolPassedSecurity = false;
}
}
}
return boolPassedSecurity;
}
示例7: AddModulePermission
private ModulePermissionInfo AddModulePermission(int moduleId, PermissionInfo permission, int roleId)
{
RoleController objRoles = new RoleController();
string roleName = Null.NullString;
ModulePermissionInfo objModulePermission = new ModulePermissionInfo();
objModulePermission.ModuleID = moduleId;
objModulePermission.PermissionID = permission.PermissionID;
objModulePermission.RoleID = roleId;
objModulePermission.PermissionKey = permission.PermissionKey;
objModulePermission.AllowAccess = false;
if (roleId == int.Parse(Globals.glbRoleUnauthUser))
{
roleName = Globals.glbRoleUnauthUserName;
}
else if (roleId == int.Parse(Globals.glbRoleAllUsers))
{
roleName = Globals.glbRoleAllUsersName;
}
else
{
RoleInfo objRole = objRoles.GetRole(objModulePermission.RoleID, PortalSettings.PortalId);
if (objRole != null)
{
roleName = objRole.RoleName;
}
}
if (!(string.IsNullOrEmpty(roleName)))
{
if (PortalSettings.ActiveTab.AdministratorRoles.IndexOf(roleName) != -1)
{
objModulePermission.AllowAccess = true;
}
}
return objModulePermission;
}
示例8: Page_Load
/// <summary>
/// Page_Load runs when the control is loaded
/// </summary>
/// <history>
/// [cnurse] 03/13/2006
/// </history>
protected void Page_Load( Object sender, EventArgs e )
{
try
{
if( ( Request.QueryString["Services"] != null ) )
{
Services = int.Parse( Request.QueryString["Services"] );
}
// free subscriptions
if( ( Request.QueryString["RoleID"] != null ) )
{
RoleID = int.Parse( Request.QueryString["RoleID"] );
RoleController objRoles = new RoleController();
RoleInfo objRole = objRoles.GetRole( RoleID, PortalSettings.PortalId );
if( objRole.IsPublic && objRole.ServiceFee == 0.0 )
{
objRoles.UpdateUserRole( PortalId, UserInfo.UserID, RoleID, Convert.ToBoolean( ( Request.QueryString["cancel"] != null ) ? true : false ) );
if( PortalSettings.UserTabId != - 1 )
{
// user defined tab
Response.Redirect( Globals.NavigateURL( PortalSettings.UserTabId ), true );
}
else
{
// admin tab
Response.Redirect( Globals.NavigateURL( TabId, "profile", "UserID=" + UserInfo.UserID ), true );
}
}
else
{
// EVENTLOGGER
}
}
// If this is the first visit to the page, bind the role data to the datalist
if( Page.IsPostBack == false )
{
//Localize the Headers
Localization.LocalizeDataGrid(ref grdServices, this.LocalResourceFile);
}
}
catch( Exception exc ) //Module failed to load
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}
示例9: SaveMetadata
private void SaveMetadata()
{
var security = new DotNetNuke.Security.PortalSecurity();
var ctlRole = new RoleController();
var role = ctlRole.GetRole(GroupId, PortalId);
var settingKey = security.InputFilter(txtSettingKey.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup);
var settingValue = security.InputFilter(txtSettingValue.Text.Trim(), PortalSecurity.FilterFlag.NoScripting);
if (role.Settings.ContainsKey(settingKey))
{
// update the existing key
role.Settings[settingKey] = settingValue;
}
else
{
// add a new key
role.Settings.Add(settingKey, settingValue);
}
TestableRoleController.Instance.UpdateRoleSettings(role, true);
}
示例10: GetRecipients
private void GetRecipients(out List<string> objRoleNames, out List<UserInfo> objUsers)
{
objRoleNames = new List<string>();
objUsers = new List<UserInfo>();
if (!String.IsNullOrEmpty(txtEmail.Text))
{
Array arrEmail = txtEmail.Text.Split(';');
foreach (string strEmail in arrEmail)
{
var objUser = new UserInfo {UserID = Null.NullInteger, Email = strEmail, DisplayName = strEmail};
objUsers.Add(objUser);
}
}
var roleController = new RoleController();
objRoleNames.AddRange(recipients.Value.Split(',').Where(value => value.StartsWith("role-")).Select(value => roleController.GetRole(int.Parse(value.Substring(5)), PortalId).RoleName).Where(roleName => !string.IsNullOrWhiteSpace(roleName)));
objUsers.AddRange(recipients.Value.Split(',').Where(value => value.StartsWith("user-")).Select(value => UserController.GetUserById(PortalId, int.Parse(value.Substring(5)))).Where(user => user != null));
}
示例11: SaveSettings
private void SaveSettings()
{
var ctlRole = new RoleController();
RoleInfo role = ctlRole.GetRole(GroupId, PortalId);
var sec = new PortalSecurity();
role.RoleName = sec.InputFilter(txtGroupName.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup);
SaveSetting(ref role, FeatureController.KEY_COUNTRY, cboCountry.SelectedValue);
SaveSetting(ref role, FeatureController.KEY_COUNTRYFULL, cboCountry.SelectedItem.Text);
SaveSetting(ref role, FeatureController.KEY_REGION, sec.InputFilter(ParseRegionSaveSetting(), PortalSecurity.FilterFlag.NoMarkup));
if (role.Settings[FeatureController.KEY_REGION] == cboRegion.SelectedValue)
{
SaveSetting(ref role, FeatureController.KEY_REGIONFULL, cboRegion.SelectedItem.Text);
}
else
{
SaveSetting(ref role, FeatureController.KEY_REGIONFULL, sec.InputFilter(txtRegion.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
}
SaveSetting(ref role, FeatureController.KEY_CITY, sec.InputFilter(txtCity.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_DEFAULTLANGUAGE, cboDefaultLanguage.SelectedValue);
SaveSetting(ref role, FeatureController.KEY_WEBSITEURL, sec.InputFilter(txtWebsiteUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_FACEBOOKURL, sec.InputFilter(txtFacebookUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_TWITTERURL, sec.InputFilter(txtTwitterUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_LINKEDINURL, sec.InputFilter(txtLinkedInUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_GOOGLEPLUSURL, sec.InputFilter(txtGooglePlusUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_MEETUPURL, sec.InputFilter(txtMeetUpUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
SaveSetting(ref role, FeatureController.KEY_YOUTUBEURL, sec.InputFilter(txtYouTubeUrl.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup));
// update the role to save the name change
ctlRole.UpdateRole(role);
// save the settings
TestableRoleController.Instance.UpdateRoleSettings(role, true);
}
示例12: Create_Click
private void Create_Click(object sender, EventArgs e)
{
RoleController roleController = new RoleController();
Security.PortalSecurity ps = new Security.PortalSecurity();
txtGroupName.Text = ps.InputFilter(txtGroupName.Text, Security.PortalSecurity.FilterFlag.NoScripting);
txtGroupName.Text = ps.InputFilter(txtGroupName.Text, Security.PortalSecurity.FilterFlag.NoMarkup);
txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoScripting);
txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoMarkup);
if (roleController.GetRoleByName(PortalId, txtGroupName.Text) != null)
{
reqGroupName.Visible = true;
return;
}
List<RoleInfo> modRoles = new List<RoleInfo>();
foreach (ModulePermissionInfo modulePermissionInfo in ModulePermissionController.GetModulePermissions(ModuleId, TabId))
{
if (modulePermissionInfo.PermissionKey == "MODGROUP" && modulePermissionInfo.AllowAccess)
{
modRoles.Add(roleController.GetRole(modulePermissionInfo.RoleID, PortalId));
}
}
RoleInfo roleInfo = new RoleInfo()
{
PortalID = PortalId,
RoleName = txtGroupName.Text,
Description = txtDescription.Text,
SecurityMode = SecurityMode.SocialGroup,
Status = RoleStatus.Approved,
IsPublic = rdAccessTypePublic.Checked
};
var userRoleStatus = RoleStatus.Pending;
if (GroupModerationEnabled)
{
roleInfo.Status = RoleStatus.Pending;
userRoleStatus = RoleStatus.Pending;
}
else
{
userRoleStatus = RoleStatus.Approved;
}
var objModulePermissions = new ModulePermissionCollection(CBO.FillCollection(DataProvider.Instance().GetModulePermissionsByModuleID(ModuleId, -1), typeof(ModulePermissionInfo)));
if (ModulePermissionController.HasModulePermission(objModulePermissions, "MODGROUP"))
{
roleInfo.Status = RoleStatus.Approved;
userRoleStatus = RoleStatus.Approved;
}
roleInfo.RoleGroupID = DefaultRoleGroupId;
roleInfo.RoleID = roleController.AddRole(roleInfo);
roleInfo = roleController.GetRole(roleInfo.RoleID, PortalId);
roleInfo.Settings.Add("URL", Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
roleInfo.Settings.Add("GroupCreatorName", UserInfo.DisplayName);
roleInfo.Settings.Add("ReviewMembers", chkMemberApproved.Checked.ToString());
TestableRoleController.Instance.UpdateRoleSettings(roleInfo, true);
if (inpFile.PostedFile.ContentLength > 0)
{
IFileManager _fileManager = FileManager.Instance;
IFolderManager _folderManager = FolderManager.Instance;
var rootFolderPath = PathUtils.Instance.FormatFolderPath(PortalSettings.HomeDirectory);
IFolderInfo groupFolder = _folderManager.GetFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
if (groupFolder == null)
{
groupFolder = _folderManager.AddFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
}
if (groupFolder != null)
{
var fileName = Path.GetFileName(inpFile.PostedFile.FileName);
var fileInfo = _fileManager.AddFile(groupFolder, fileName, inpFile.PostedFile.InputStream, true);
roleInfo.IconFile = "FileID=" + fileInfo.FileId;
roleController.UpdateRole(roleInfo);
}
}
Components.Notifications notifications = new Components.Notifications();
roleController.AddUserRole(PortalId, UserId, roleInfo.RoleID, userRoleStatus, true, Null.NullDate, Null.NullDate);
if (roleInfo.Status == RoleStatus.Pending)
{
//Send notification to Group Moderators to approve/reject group.
notifications.AddGroupNotification(Constants.GroupPendingNotification, GroupViewTabId, ModuleId, roleInfo, UserInfo, modRoles);
}
else
{
//Send notification to Group Moderators informing of new group.
notifications.AddGroupNotification(Constants.GroupCreatedNotification, GroupViewTabId, ModuleId, roleInfo, UserInfo, modRoles);
//Add entry to journal.
GroupUtilities.CreateJournalEntry(roleInfo, UserInfo);
}
Response.Redirect(Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
}
示例13: SendAdminNotification
private void SendAdminNotification(UserInfo newUser, string notificationType, PortalSettings portalSettings)
{
var notification = new Notification
{
NotificationTypeID = NotificationsController.Instance.GetNotificationType(notificationType).NotificationTypeId,
IncludeDismissAction = true,
SenderUserID = portalSettings.AdministratorId
};
notification.Subject = GetNotificationSubject(notificationType, newUser.Profile.PreferredLocale, newUser, portalSettings);
notification.Body = GetNotificationBody(notificationType, newUser.Profile.PreferredLocale, newUser, portalSettings);
var roleController = new RoleController();
var adminrole = roleController.GetRole(portalSettings.AdministratorRoleId, portalSettings.PortalId);
var roles = new List<RoleInfo>();
roles.Add(adminrole);
NotificationsController.Instance.SendNotification(notification, portalSettings.PortalId, roles, new List<UserInfo>());
}
示例14: NotifyAssignedGroupOfAssignment
// Emails
#region NotifyAssignedGroupOfAssignment
private void NotifyAssignedGroupOfAssignment()
{
RoleController objRoleController = new RoleController();
string strAssignedRole = String.Format("{0}", objRoleController.GetRole(Convert.ToInt32(ddlAssigned.SelectedValue), PortalId).RoleName);
string strLinkUrl = Utils.FixURLLink(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "EditTask", "mid=" + ModuleId.ToString(), String.Format(@"&TaskID={0}", Request.QueryString["TaskID"])), PortalSettings.PortalAlias.HTTPAlias);
string strSubject = "[" + Localization.GetString(String.Format("ddlStatusAdmin{0}.Text", ddlStatus.SelectedValue), LocalResourceFile) + "] " + String.Format(Localization.GetString("HelpDeskTicketAtHasBeenAssigned.Text", LocalResourceFile), Request.QueryString["TaskID"], PortalSettings.PortalAlias.HTTPAlias, strAssignedRole);
string strBody = String.Format(Localization.GetString("ANewHelpDeskTicketHasBeenAssigned.Text", LocalResourceFile), Request.QueryString["TaskID"], txtDescription.Text);
strBody = strBody + Environment.NewLine;
strBody = strBody + String.Format(Localization.GetString("YouMaySeeStatusHere.Text", LocalResourceFile), strLinkUrl);
// Get all users in the AssignedRole Role
ArrayList colAssignedRoleUsers = objRoleController.GetUsersByRoleName(PortalId, strAssignedRole);
foreach (UserInfo objUserInfo in colAssignedRoleUsers)
{
DotNetNuke.Services.Mail.Mail.SendMail(PortalSettings.Email, objUserInfo.Email, "", strSubject, strBody, "", "HTML", "", "", "", "");
}
Log.InsertLog(Convert.ToInt32(Request.QueryString["TaskID"]), UserId, String.Format(Localization.GetString("AssignedTicketTo.Text", LocalResourceFile), UserInfo.DisplayName, strAssignedRole));
}
示例15: DisplayTicketData
// Display Ticket Data
#region DisplayTicketData
private void DisplayTicketData()
{
HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
select HelpDesk_Tasks).FirstOrDefault();
// Name is editable only if user is Anonymous
if (objHelpDesk_Tasks.RequesterUserID == -1)
{
txtEmail.Visible = true;
txtName.Visible = true;
lblEmail.Visible = false;
lblName.Visible = false;
txtEmail.Text = objHelpDesk_Tasks.RequesterEmail;
txtName.Text = objHelpDesk_Tasks.RequesterName;
}
else
{
txtEmail.Visible = false;
txtName.Visible = false;
lblEmail.Visible = true;
lblName.Visible = true;
UserInfo objRequester = //UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false);
UserController.GetUserById (PortalId, objHelpDesk_Tasks.RequesterUserID);
if (objRequester != null)
{
lblEmail.Text = objRequester.Email; // UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false).Email;
lblName.Text = objRequester.DisplayName; // UserController.GetUser(PortalId, objHelpDesk_Tasks.RequesterUserID, false).DisplayName;
}
else
{
lblName.Text = "[User Deleted]";
}
}
lblTask.Text = objHelpDesk_Tasks.TaskID.ToString();
lblCreated.Text = String.Format(Localization.GetString("Created.Text", LocalResourceFile), objHelpDesk_Tasks.CreatedDate.ToShortDateString(), objHelpDesk_Tasks.CreatedDate.ToShortTimeString());
ddlStatus.SelectedValue = objHelpDesk_Tasks.Status;
ddlPriority.SelectedValue = objHelpDesk_Tasks.Priority;
txtDescription.Text = objHelpDesk_Tasks.Description;
txtPhone.Text = objHelpDesk_Tasks.RequesterPhone;
txtDueDate.Text = (objHelpDesk_Tasks.DueDate.HasValue) ? objHelpDesk_Tasks.DueDate.Value.ToShortDateString() : "";
txtStart.Text = (objHelpDesk_Tasks.EstimatedStart.HasValue) ? objHelpDesk_Tasks.EstimatedStart.Value.ToShortDateString() : "";
txtComplete.Text = (objHelpDesk_Tasks.EstimatedCompletion.HasValue) ? objHelpDesk_Tasks.EstimatedCompletion.Value.ToShortDateString() : "";
txtEstimate.Text = (objHelpDesk_Tasks.EstimatedHours.HasValue) ? objHelpDesk_Tasks.EstimatedHours.Value.ToString() : "";
ListItem TmpRoleListItem = ddlAssigned.Items.FindByValue(objHelpDesk_Tasks.AssignedRoleID.ToString());
if (TmpRoleListItem == null)
{
// Value was not found so add it
RoleController objRoleController = new RoleController();
RoleInfo objRoleInfo = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);
if (objRoleInfo != null)
{
ListItem RoleListItem = new ListItem();
RoleListItem.Text = objRoleInfo.RoleName;
RoleListItem.Value = objHelpDesk_Tasks.AssignedRoleID.ToString();
ddlAssigned.Items.Add(RoleListItem);
ddlAssigned.SelectedValue = objHelpDesk_Tasks.AssignedRoleID.ToString();
}
else
{
// Role no longer exists in Portal
ddlAssigned.SelectedValue = "-1";
}
}
else
{
// The Value already exists so set it
ddlAssigned.SelectedValue = objHelpDesk_Tasks.AssignedRoleID.ToString();
}
}