本文整理汇总了C#中MembershipUser类的典型用法代码示例。如果您正苦于以下问题:C# MembershipUser类的具体用法?C# MembershipUser怎么用?C# MembershipUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MembershipUser类属于命名空间,在下文中一共展示了MembershipUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetByUser
/// <summary>
/// Return notifications for a specified user
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public IList<CategoryNotification> GetByUser(MembershipUser user)
{
var cacheKey = string.Concat(CacheKeys.CategoryNotification.StartsWith, "GetByUser-", user.Id);
return _cacheService.CachePerRequest(cacheKey, () => _context.CategoryNotification
.Where(x => x.User.Id == user.Id)
.ToList());
}
开发者ID:lenwen,项目名称:mvcforum,代码行数:12,代码来源:CategoryNotificationService.cs
示例2: SnitzMembershipUser
public SnitzMembershipUser(MembershipUser mu, int posts,string country)
{
this.mu = mu;
Posts = posts;
Title = mu.Comment;
Country = country;
}
开发者ID:huwred,项目名称:SnitzDotNet,代码行数:7,代码来源:SnitzMembershipUser.cs
示例3: btnUpdate_Click
private void btnUpdate_Click(object sender, RoutedEventArgs e)
{
try
{
UserPresenter userPresenter = (UserPresenter)this.DataContext;
MembershipUser membershipUser = new MembershipUser();
DeepClone.CopyTo((MembershipUser)(userPresenter.View.dataGridUsers.SelectedItem), membershipUser);
UserEditPresenter userEditPresenter = new UserEditPresenter(new UserEditView(), membershipUser);
userEditPresenter.View.Label_AddOrEditUser.Content = "Edytowanie użytkownika";
if (membershipUser.is_active) { userEditPresenter.View.ComboBox_active.SelectedValue = "TAK"; }
else { userEditPresenter.View.ComboBox_active.SelectedValue = "NIE"; }
if (userEditPresenter.View.ShowDialog() == true)
{
membershipUser.creation_date = DateTime.Now;
userPresenter.SaveUser(membershipUser, true);
MembershipUser temp = (MembershipUser)userPresenter.View.dataGridUsers.SelectedItem;
ChangeCurrentRow(userPresenter, userEditPresenter, temp);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
开发者ID:pawelsorsa,项目名称:Fixed-Assets-System,代码行数:25,代码来源:UserView.xaml.cs
示例4: Delete
public void Delete(MembershipUser user, PointsFor type, Guid referenceId)
{
var mp = _context.MembershipUserPoints.Include(x => x.User).Where(x => x.User.Id == user.Id && x.PointsFor == type && x.PointsForId == referenceId);
var mpoints = new List<MembershipUserPoints>();
mpoints.AddRange(mp);
Delete(mpoints);
}
开发者ID:lenwen,项目名称:mvcforum,代码行数:7,代码来源:MembershipUserPointsService.cs
示例5: sendMail
private void sendMail(MembershipUser user)
{
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("[email protected]");
mailMessage.Subject = "Welcome To Tom's List";
mailMessage.To.Add(new MailAddress(user.Email));
Guid userId = (Guid)user.ProviderUserKey;
string body = "";
using (StreamReader reader = new StreamReader(Server.MapPath("~/Templates/NewAccountTemplate.html")))
{
body = reader.ReadToEnd();
}
body = body.Replace("<%UserName%>", user.UserName);
string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + (Request.ApplicationPath.Equals("/") ? "" : Request.ApplicationPath);
string verifyUrl = "/Views/AccountVerify.aspx?ID=" + userId.ToString();
body = body.Replace("<%VerifyUrl%>", baseUrl + verifyUrl);
mailMessage.Body = body;
mailMessage.IsBodyHtml = true;
new SmtpClient().Send(mailMessage);
}
开发者ID:bduong,项目名称:toms-list,代码行数:25,代码来源:Login.aspx.cs
示例6: MembershipUserIdentity
public MembershipUserIdentity(MembershipUser user)
{
_user = user;
if (Roles.Enabled)
{
_roles = Roles.GetRolesForUser(user.UserName);
}
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:8,代码来源:MembershipUserIdentity.cs
示例7: AddNewPost
/// <summary>
/// Add a new post
/// </summary>
/// <param name="postContent"> </param>
/// <param name="topic"> </param>
/// <param name="user"></param>
/// <param name="permissions"> </param>
/// <returns>True if post added</returns>
public Post AddNewPost(string postContent, Topic topic, MembershipUser user, out PermissionSet permissions)
{
// Get the permissions for the category that this topic is in
permissions = _roleService.GetPermissions(topic.Category, UsersRole(user));
// Check this users role has permission to create a post
if (permissions[SiteConstants.Instance.PermissionDenyAccess].IsTicked || permissions[SiteConstants.Instance.PermissionReadOnly].IsTicked)
{
// Throw exception so Ajax caller picks it up
throw new ApplicationException(_localizationService.GetResourceString("Errors.NoPermission"));
}
// Has permission so create the post
var newPost = new Post
{
PostContent = postContent,
User = user,
Topic = topic,
IpAddress = StringUtils.GetUsersIpAddress(),
DateCreated = DateTime.UtcNow,
DateEdited = DateTime.UtcNow
};
// Sort the search field out
var category = topic.Category;
if (category.ModeratePosts == true)
{
newPost.Pending = true;
}
var e = new PostMadeEventArgs { Post = newPost };
EventManager.Instance.FireBeforePostMade(this, e);
if (!e.Cancel)
{
// create the post
Add(newPost);
// Update the users points score and post count for posting
_membershipUserPointsService.Add(new MembershipUserPoints
{
Points = _settingsService.GetSettings().PointsAddedPerPost,
User = user,
PointsFor = PointsFor.Post,
PointsForId = newPost.Id
});
// add the last post to the topic
topic.LastPost = newPost;
EventManager.Instance.FireAfterPostMade(this, new PostMadeEventArgs { Post = newPost });
return newPost;
}
return newPost;
}
开发者ID:lenwen,项目名称:mvcforum,代码行数:66,代码来源:PostService.cs
示例8: GenerateMappedRecord
public static Activity GenerateMappedRecord(MembershipUser user)
{
return new Activity
{
Data = KeyUserId + Equality + user.Id,
Timestamp = user.CreateDate,
Type = ActivityType.MemberJoined.ToString()
};
}
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:9,代码来源:MemberJoinedActivity.cs
示例9: GenerateMappedRecord
public static Activity GenerateMappedRecord(MembershipUser user, DateTime modified)
{
return new Activity
{
Data = KeyUserId + Equality + user.Id,
Timestamp = modified,
Type = ActivityType.ProfileUpdated.ToString()
};
}
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:9,代码来源:ProfileUpdatedActivity.cs
示例10: GetUserStatus
protected string GetUserStatus(MembershipUser user)
{
if (user.IsApproved == false)
return "NOT APPROVED";
else if (user.IsLockedOut)
return "LOCKED";
else
return "Active";
}
开发者ID:Learion,项目名称:BruceToolSet,代码行数:9,代码来源:UserList.aspx.cs
示例11: GenerateMappedRecord
public static Activity GenerateMappedRecord(Badge badge, MembershipUser user, DateTime timestamp)
{
return new Activity
{
// badge=badgeId,user=userId
Data = KeyBadgeId + Equality + badge.Id + Separator + KeyUserId + Equality + user.Id,
Timestamp = timestamp,
Type = ActivityType.BadgeAwarded.ToString()
};
}
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:10,代码来源:BadgeActivity.cs
示例12: GetByUserAndTag
public IList<TagNotification> GetByUserAndTag(MembershipUser user, TopicTag tag, bool addTracking = false)
{
var notifications = _context.TagNotification
.Where(x => x.User.Id == user.Id && x.Tag.Id == tag.Id);
if (addTracking)
{
return notifications.ToList();
}
return notifications.AsNoTracking().ToList();
}
开发者ID:lenwen,项目名称:mvcforum,代码行数:10,代码来源:TagNotificationService.cs
示例13: GetByUserAndCategory
/// <summary>
/// Return notifications for a specified user and category
/// </summary>
/// <param name="user"></param>
/// <param name="category"></param>
/// <param name="addTracking"></param>
/// <returns></returns>
public IList<CategoryNotification> GetByUserAndCategory(MembershipUser user, Category category, bool addTracking = false)
{
var cacheKey = string.Concat(CacheKeys.CategoryNotification.StartsWith, "GetByUserAndCategory-", user.Id, "-", category.Id, "-", addTracking);
return _cacheService.CachePerRequest(cacheKey, () =>
{
var notifications = _context.CategoryNotification.Where(x => x.Category.Id == category.Id && x.User.Id == user.Id);
if (addTracking)
{
return notifications.ToList();
}
return notifications.AsNoTracking().ToList();
});
}
开发者ID:lenwen,项目名称:mvcforum,代码行数:20,代码来源:CategoryNotificationService.cs
示例14: SanitizeUser
public MembershipUser SanitizeUser(MembershipUser membershipUser)
{
membershipUser.Avatar = StringUtils.SafePlainText(membershipUser.Avatar);
membershipUser.Comment = StringUtils.SafePlainText(membershipUser.Comment);
membershipUser.Email = StringUtils.SafePlainText(membershipUser.Email);
membershipUser.Password = StringUtils.SafePlainText(membershipUser.Password);
membershipUser.PasswordAnswer = StringUtils.SafePlainText(membershipUser.PasswordAnswer);
membershipUser.PasswordQuestion = StringUtils.SafePlainText(membershipUser.PasswordQuestion);
membershipUser.Signature = StringUtils.GetSafeHtml(membershipUser.Signature);
membershipUser.Twitter = StringUtils.SafePlainText(membershipUser.Twitter);
membershipUser.UserName = StringUtils.SafePlainText(membershipUser.UserName);
membershipUser.Website = StringUtils.SafePlainText(membershipUser.Website);
return membershipUser;
}
开发者ID:StefanoPireddu,项目名称:mvcforum,代码行数:14,代码来源:MembershipService.cs
示例15: UpdateSelf
void UpdateSelf (MembershipUser fromUser)
{
try { Comment = fromUser.Comment; } catch (NotSupportedException) {}
try { creationDate = fromUser.CreationDate; } catch (NotSupportedException) {}
try { Email = fromUser.Email; } catch (NotSupportedException) {}
try { IsApproved = fromUser.IsApproved; } catch (NotSupportedException) {}
try { isLockedOut = fromUser.IsLockedOut; } catch (NotSupportedException) {}
try { LastActivityDate = fromUser.LastActivityDate; } catch (NotSupportedException) {}
try { lastLockoutDate = fromUser.LastLockoutDate; } catch (NotSupportedException) {}
try { LastLoginDate = fromUser.LastLoginDate; } catch (NotSupportedException) {}
try { lastPasswordChangedDate = fromUser.LastPasswordChangedDate; } catch (NotSupportedException) {}
try { passwordQuestion = fromUser.PasswordQuestion; } catch (NotSupportedException) {}
try { providerUserKey = fromUser.ProviderUserKey; } catch (NotSupportedException) {}
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:14,代码来源:MembershipUser.cs
示例16: Init
public void Init()
{
AutoMappingRegistrar.Configure();
_membershipServiceSub = Substitute.For<IMembershipService>();
//.Do(x => { return MembershipCreateStatus.ProviderError; });
var role = new MembershipRole
{
Id = Guid.NewGuid(),
RoleName = "authors",
};
var user = new MembershipUser
{
UserId = Guid.NewGuid(),
UserName = "fred",
Comment = "test user",
CreateDate = DateTime.Now,
Email = "[email protected]",
FailedPasswordAnswerAttempt = 0,
FailedPasswordAttemptCount = 0,
IsApproved = true,
IsLockedOut = false,
LastLockoutDate = DateTime.Now,
LastLoginDate = DateTime.Now,
LastPasswordChangedDate = DateTime.Now,
Password = "test",
PasswordQuestion = "question",
PasswordAnswer = "answer",
Roles = new List<MembershipRole> {role},
Stories = new List<NewsItem>()
};
var newsItem = new NewsItem
{
Id = Guid.NewGuid(),
Title = "test title",
Body = "body",
Authors = new List<MembershipUser> { user }
};
role.Users = new List<MembershipUser> {user};
user.Stories = new List<NewsItem> {newsItem};
_membershipServiceSub.GetAll().Returns(new List<MembershipUser>{user});
}
开发者ID:StefanoPireddu,项目名称:mvcforum,代码行数:50,代码来源:AuthorControllerTests.cs
示例17: getAllNotificationsForCurrentEmployee
public static TransactionResponse getAllNotificationsForCurrentEmployee(MembershipUser currentUser)
{
//get detail of the logged on user.
Employee employee = EmployeeManager.getLoggedOnUser((Guid)currentUser.ProviderUserKey);
if (employee == null)
{
return EmployeeManager.handleLoggedInUserCanNotBeIdentfied();
}
TransactionResponse response = new TransactionResponse();
try
{
IDictionary<string, object> employeeIdMap = new Dictionary<string, object>();
employeeIdMap.Add("@EMP_ID", employee.EmpID);
employeeIdMap.Add("@destrictID", PageAccessManager.getDistrictID());
//Pass Stored Procedure Name and parameter list.
DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spGetAllNotificationForTheCurrentEmployee, employeeIdMap);
DataTable dataTable = dbOperation.getRecord();
//put the data on Transaction response
response.Data = dataTable;
response.setSuccess(true);
response.setMessageType(TransactionResponse.SeverityLevel.INFO);
response.setMessage(DBOperationErrorConstants.M_NOTIFICATION_INFO);
//get Notifications inside the TransactionResponse.
return response;
}
catch (SqlException ex)
{
response.setErrorCode(DBOperationErrorConstants.E_ERROR_WHILE_READING_NOTIFICATION);
response.setMessage(DBOperationErrorConstants.M_ERROR_WHILE_READING_NOTIF);
response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
response.setSuccess(false);
return response;
}
//CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
catch (Exception ex)
{
//Write this exception to file for investigation of the issue later.
LoggerManager.LogError(ex.ToString(), logger);
response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR);
response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
response.setSuccess(false);
return response;
}
}
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:49,代码来源:NotificationManager.cs
示例18: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["UserName"] == null)
{
Response.Redirect("GetAllusersDemo.aspx");
}
//调用GetUser方法获取当前的用户信息
mbu = Membership.GetUser(Request.QueryString["UserName"]);
if (!Page.IsPostBack)
{
//获取MembershipUser中的属性信息
lblUser.Text = mbu.UserName;
txtEmail.Text = mbu.Email;
txtComment.Text = mbu.Comment;
CheckBox1.Checked = mbu.IsApproved;
}
}
开发者ID:AJLoveChina,项目名称:workAtQmm,代码行数:17,代码来源:EditUsers.aspx.cs
示例19: ResetPassword_OnClick
public void ResetPassword_OnClick(object sender, EventArgs args)
{
string newPassword;
u = Membership.GetUser(UsernameTextBox.Text, false);
if (u == null)
{
Msg.Text = "Username " + Server.HtmlEncode(UsernameTextBox.Text) + " not found. Please check the value and re-enter.";
return;
}
try
{
newPassword = u.ResetPassword(AnswerTextBox.Text);
}
catch (MembershipPasswordException e)
{
Msg.Text = "Invalid password answer. Please re-enter and try again.";
return;
}
catch (Exception e)
{
Msg.Text = e.Message;
return;
}
if (newPassword != null)
{
Msg.Text = "Password reset. Your new password is: " + Server.HtmlEncode(newPassword);
}
else
{
Msg.Text = "Password reset failed. Please re-enter your values and try again.";
}
}
开发者ID:haithemaraissia,项目名称:Done,代码行数:35,代码来源:ResetPassword.aspx.cs
示例20: FuddleUser
public FuddleUser(string username)
{
SqlConnection conn = new SqlConnection(connString);
this.user = Membership.GetUser(username);
this.id = (Guid)user.ProviderUserKey;
this.username = username;
}
开发者ID:btevfik,项目名称:Fuddle,代码行数:7,代码来源:FuddleUser.cs
注:本文中的MembershipUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论