本文整理汇总了C#中UserManager.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# UserManager.GetItem方法的具体用法?C# UserManager.GetItem怎么用?C# UserManager.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager.GetItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process_EditGroup
//.........这里部分代码省略.........
lbStatus.Text = string.Format(m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl success avatar uploaded"), strFileName, m_refCommunityGroupApi.SitePath + "uploadedimages/" + strFileName);
Utilities.ProcessThumbnail(Server.MapPath(m_refCommunityGroupApi.SitePath + "uploadedimages/"), strFileName);
}
else
{
//Not a valid jpeg/gif image
lbStatus.Text = m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl err avatar not valid extension");
}
sfileloc = m_refCommunityGroupApi.SitePath + "uploadedimages/thumb_" + Utilities.GetCorrectThumbnailFileWithExtn(strFileName);
cgGroup.GroupImage = sfileloc;
}
else
{
cgGroup.GroupImage = (string)this.GroupAvatar_TB.Text;
}
// file
if (m_iID > 0)
{
m_refCommunityGroupApi.UpdateCommunityGroup(cgGroup);
UpdateGroupTags(false);
InitiateProcessAction();
RemoveCurrentAdminUsers();//Need to remove all admins then re-added
AddMultipleGroupAdmins(strAdminUsers);
}
else
{
UserManager Usermanager = new UserManager();
UserData userBaseData = null;
List<UserData> userlist = new List<UserData>();
long longUserId;
foreach (string userId in strAdminUsers)
{
if (long.TryParse(userId, out longUserId) && longUserId > 0)
userBaseData = Usermanager.GetItem(longUserId);
if (userBaseData != null && userBaseData.Id > 0)
userlist.Add(userBaseData);
}
cgGroup.Admins = userlist;
m_iID = m_refCommunityGroupApi.AddCommunityGroup(cgGroup);
//ADDTAXONOMYITEM to Group eIntranet
if (!(string.IsNullOrEmpty(TaxonomyTreeIdList)))
{
TaxonomyTreeIdList = TaxonomyTreeIdList + ",";
}
else
{
TaxonomyTreeIdList = "";
}
if (profileTaxonomyId > 0)
{
m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
}
else
{
profileTaxonomyId = m_refCommunityGroupApi.EkContentRef.GetTaxonomyIdByPath("\\" + m_refCommunityGroupApi.UserId + "\\Groups", 1);
m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
}
groupMessageBoardModerate = _MessageBoardApi.IsModerated(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
if (groupMessageBoardModerate != false || chkMsgBoardModeration.Checked != false)
{
_MessageBoardApi.Moderate(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, m_userId, System.Convert.ToBoolean(chkMsgBoardModeration.Checked));
}
if (cgGroup.GroupCategory != "")
示例2: btncreateaccount_Click
protected void btncreateaccount_Click(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
//try
//{
string emailAddress = txtEmail.Text;
if (!string.IsNullOrEmpty(emailAddress))
{
try
{
System.Net.Mail.MailAddress addr = new System.Net.Mail.MailAddress(emailAddress);
}
catch
{
litErrorMsg.Text = "Please Enter Valid Email Address.";
return;
}
}
UserData userToCreate = new UserData()
{
Username = txtUsername.Text,
Password = txtPassword.Text,
FirstName = txtFirstName.Text,
LastName = txtLastname.Text,
DisplayName = txtUsername.Text,
Email = txtEmail.Text,
IsMemberShip = true
};
userToCreate.CustomProperties = userManager.GetCustomPropertyList();
userToCreate.CustomProperties["Phone"].Value = txtPhone.Text;
userToCreate.CustomProperties["Country"].Value = ddlCountrylist.SelectedValue;
userToCreate.CustomProperties["Time Zone"].Value = "GMT Standard Time";
string userSubs = "";
if (chkHotDeals.Checked)
userSubs = Resources.ID.SubscriptionHotDealsId;
if (chkNews.Checked)
userSubs += "," + Resources.ID.SubscriptionNewsId;
if (userSubs.StartsWith(","))
userSubs = userSubs.Remove(0, 1);
userToCreate.CustomProperties["Subscriptions"].Value = userSubs;
Ektron.Cms.Framework.User.UserManager umanager = new UserManager();
UserData userToEdit = umanager.GetItem(Ektron.Cms.CommonApi.Current.UserId, true);
userToEdit.FirstName = userToCreate.FirstName;
userToEdit.LastName = userToCreate.LastName;
userToEdit.Email = userToCreate.Email;
userToEdit.CustomProperties["Phone"].Value = userToCreate.CustomProperties["Phone"].Value;
userToEdit.CustomProperties["Country"].Value = userToCreate.CustomProperties["Country"].Value;
userToEdit.CustomProperties["Time Zone"].Value = userToCreate.CustomProperties["Time Zone"].Value;
userToEdit.Username = userToCreate.Username;
userToEdit.Password = userToCreate.Password;
userToEdit.DisplayName = userToCreate.Email;
umanager.Update(userToEdit);
if (userToEdit.Id != 0)
{
divRegistrationwrapper.Visible = false;
litErrorMsg.Text = "<br /><br />" + Resources.Text.UserCreatedSuccess + "<br /><br />";
}
else
{
litErrorMsg.Text = Resources.Text.UserCreatedFail;
}
//}
//catch (Exception ex)
//{
// litErrorMsg.Text = Resources.Text.UserCreatedFail;
//}
}
}
示例3: context_AcquireRequestState
void context_AcquireRequestState(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
if (HttpContext.Current.Session != null)
{
if (HttpContext.Current.Session["ecmComplianceRequired"] != null
&& HttpContext.Current.Session["ecmLastAccessed"] != null)
{
bool complianceRequired = (bool)HttpContext.Current.Session["ecmComplianceRequired"];
DateTime lastAccessed = (DateTime)HttpContext.Current.Session["ecmLastAccessed"];
if (complianceRequired
&& lastAccessed.Add(IDLE_TIMEOUT) < DateTime.Now)
{
DeleteEcmCookie();
DeleteFormsCookie();
}
else
HttpContext.Current.Session["ecmLastAccessed"] = DateTime.Now;
}
else
{
bool complianceMode = GetComplianceModeFromRequestInfo();
if (complianceMode && (ComingFromFolderAction(app) || IsCommerceAdmin()))
{
bool validFolderAction = false;
if (ComingFromFolderAction(app))
{
UserManager userManager = new UserManager();
UserData user = userManager.GetItem(userManager.RequestInformation.UserId);
DateTime lastAccessed = user.DateModified;
validFolderAction = (DateTime.Now.Subtract(lastAccessed).Seconds < 45);
if (validFolderAction)
{
HttpContext.Current.Session["ecmComplianceRequired"] = complianceMode;
HttpContext.Current.Session["ecmLastAccessed"] = lastAccessed;
}
}
if (!validFolderAction)
{
DeleteEcmCookie();
DeleteFormsCookie();
}
}
else
{
HttpContext.Current.Session["ecmLastAccessed"] = DateTime.Now;
HttpContext.Current.Session["ecmComplianceRequired"] = false;
}
}
}
}