本文整理汇总了C#中umbraco.cms.businesslogic.member.Member.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Member.Save方法的具体用法?C# Member.Save怎么用?C# Member.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.member.Member
的用法示例。
在下文中一共展示了Member.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createMember
protected void createMember(object sender, EventArgs e)
{
if (tb_email.Text != "")
{
m = Member.GetMemberFromEmail(tb_email.Text);
if (m == null)
{
MemberType mt = MemberType.GetByAlias(memberType);
m = Member.MakeNew(tb_name.Text, mt, new umbraco.BusinessLogic.User(0));
m.Email = tb_email.Text;
m.Password = tb_password.Text;
m.LoginName = tb_email.Text;
//Standard values
m.getProperty("reputationTotal").Value = 20;
m.getProperty("reputationCurrent").Value = 20;
m.getProperty("forumPosts").Value = 0;
if (!string.IsNullOrEmpty(Group))
{
MemberGroup mg = MemberGroup.GetByName(Group);
if (mg != null)
m.AddGroup(mg.Id);
}
//set a default avatar
Api.CommunityController.SetAvatar(m.Id, "gravatar");
m.Save();
m.XmlGenerate(new System.Xml.XmlDocument());
Member.AddMemberToCache(m);
Response.Redirect(umbraco.library.NiceUrl(NextPage));
}
}
}
示例2: LinkBanMemberClick
protected void LinkBanMemberClick(object sender, EventArgs e)
{
if (CurrentMember.MemberIsAdmin && ProfileMember.MemberId != null)
{
string usermessage;
var cMem = new Member((int)ProfileMember.MemberId);
if(ProfileMember.MemberIsBanned)
{
//Un ban member
cMem.getProperty("forumUserIsBanned").Value = "0";
usermessage = library.GetDictionaryItem("MemberIsNowNotBanned");
}
else
{
// Ban the member
cMem.getProperty("forumUserIsBanned").Value = "1";
usermessage = library.GetDictionaryItem("MemberIsNowBanned");
}
//Save member
cMem.Save();
//Generate member Xml Cache
cMem.XmlGenerate(new System.Xml.XmlDocument());
// Redirect to show message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", usermessage));
}
}
示例3: UpdateSecretCode
public static bool UpdateSecretCode(Member member)
{
string secretCode = Upac.Core.Security.RandomPassword.Generate(CommonUtil.GetSetting("Membership/SecretCodeLength", 7));
if (member != null)
{
Property property = member.getProperty("SecretCode");
if (property != null)
{
property.Value = secretCode;
member.Save();
}
}
return false;
}
示例4: Topic_AfterCreate
void Topic_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e)
{
uForum.Businesslogic.Topic t = (uForum.Businesslogic.Topic)sender;
Member mem = new Member(t.MemberId);
int posts = 0;
int.TryParse(mem.getProperty("forumPosts").Value.ToString(), out posts);
mem.getProperty("forumPosts").Value = posts++;
mem.Save();
mem.XmlGenerate(new System.Xml.XmlDocument());
Member.RemoveMemberFromCache(mem.Id);
Member.AddMemberToCache(mem);
}
示例5: BtnSubmitMessageClick
protected void BtnSubmitMessageClick(object sender, EventArgs e)
{
// Check user isn't spammer by checking flood control settings
if (Helpers.TimeDifferenceInMinutes(DateTime.Now, CurrentMember.MemberLastPrivateMessageTime) > Settings.PrivateMessagingFloodControlTimeSpan)
{
var sb = new StringBuilder();
var tbMessageSubject = (TextBox)lvPrivateMessage.FindControl("tbMessageSubject");
var tbMessage = (TextBox)lvPrivateMessage.FindControl("txtPost");
var replylink = string.Concat(Url(),
"/privatemessage.aspx?mem=" + CurrentMember.MemberId,
"&r=" + Helpers.GetSafeHtml(tbMessageSubject.Text).UrlEncode());
replylink = string.Format("<a href='{0}'>{0}</a>", replylink);
sb.AppendFormat(library.GetDictionaryItem("PrivateMessageEmailText"),
CurrentMember.MemberLoginName,
DateTime.Now.ToShortDateString(),
Helpers.GetSafeHtml(tbMessageSubject.Text));
sb.Append(Helpers.GetSafeHtml(tbMessage.Text).ConvertBbCode());
sb.AppendFormat("<p><b>{0}</b></p><p>{1}</p>", library.GetDictionaryItem("ClickLinkToReply"), replylink);
Helpers.SendMail(Settings.EmailNotification, MessageToMember.Email, string.Concat(library.GetDictionaryItem("PrivateMessageOn"), Settings.Name), sb.ToString());
// Lastly update last private message sent on this user
var cMem = new Member(Convert.ToInt32(CurrentMember.MemberId));
cMem.getProperty("forumUserLastPrivateMessage").Value = DateTime.Now;
cMem.Save();
cMem.XmlGenerate(new System.Xml.XmlDocument());
// Show friendly message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("MessageSent")));
}
else
{
// Show friendly message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=",
string.Format(library.GetDictionaryItem("SorryMustWaitBetween"),
Settings.PrivateMessagingFloodControlTimeSpan)));
}
}
示例6: SaveUrlAsBuddyIcon
private static string SaveUrlAsBuddyIcon(string url, Member m)
{
var file = m.Id.ToString(CultureInfo.InvariantCulture);
var path = HttpContext.Current.Server.MapPath("/media/avatar/" + file + ".jpg");
if (File.Exists(path))
File.Delete(path);
var webClient = new System.Net.WebClient();
webClient.DownloadFile(url, path);
m.getProperty("avatar").Value = "/media/avatar/" + file + ".jpg";
m.XmlGenerate(new XmlDocument());
m.Save();
Member.RemoveMemberFromCache(m);
Member.AddMemberToCache(m);
return "/media/avatar/" + file + ".jpg";
}
示例7: Topic_AfterCreate
void Topic_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e)
{
uForum.Businesslogic.Topic t = (uForum.Businesslogic.Topic)sender;
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in ForumPostsCounter() class is starting");
Member mem = new Member(t.MemberId);
int posts = 0;
int.TryParse(mem.getProperty("forumPosts").Value.ToString(), out posts);
mem.getProperty("forumPosts").Value = (posts + 1);
mem.Save();
mem.XmlGenerate(new System.Xml.XmlDocument());
//Performs the action NewTopic in case we want to reward people for creating new posts.
uPowers.BusinessLogic.Action a = new uPowers.BusinessLogic.Action("NewTopic");
a.Perform(mem.Id, t.Id, "New topic created");
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in ForumPostsCounter() class is finishing");
}
示例8: MarkAsHam
public void MarkAsHam()
{
var markAsHamEventArgs = new MarkAsHamEventArgs();
FireBeforeMarkAsHam(markAsHamEventArgs);
if (markAsHamEventArgs.Cancel)
return;
var forum = new Forum(ParentId);
var topic = GetTopic(Id);
var member = new Member(topic.MemberId);
var akismetApi = Forum.GetAkismetApi();
var akismetComment = Forum.ConstructAkismetComment(member, "topic", string.Format("{0} - {1}", Title, Body));
akismetApi.SubmitHam(akismetComment);
Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 0 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));
Id = 0;
forum.Save();
// Set reputation to at least 50 so their next posts won't be automatically marked as spam
int reputation;
int.TryParse(member.getProperty("reputationTotal").Value.ToString(), out reputation);
if (reputation < 50)
member.getProperty("reputationTotal").Value = 50;
int.TryParse(member.getProperty("reputationCurrent").Value.ToString(), out reputation);
if (reputation < 50)
member.getProperty("reputationCurrent").Value = 50;
member.Save();
FireAfterMarkAsHam(markAsHamEventArgs);
}
示例9: Member_AfterSave
void Member_AfterSave(Member sender, umbraco.cms.businesslogic.SaveEventArgs e)
{
Document[] documents = Document.GetChildrenForTree(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.GymnastNode)));
Document documentMember = documents.SingleOrDefault(d => d.Text == sender.Text);
Property gymnast = sender.getProperty("gymnast");
if (documentMember == null && Roles.GetRolesForUser(sender.LoginName).Any())
{
DocumentType documentType = DocumentType.GetByAlias("Gymnast");
Document document = Document.MakeNew(sender.Text, documentType, new User("admin"), int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.GymnastNode)));
document.getProperty("member").Value = sender.Id;
document.Save();
gymnast.Value = document.Id;
sender.Save();
//Log.Add(LogTypes.New, int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.GymnastNode)), string.Format("Create new user {0} in Member_AfterSave event", sender.Text));
}
else if (gymnast.Value == null && Roles.GetRolesForUser(sender.LoginName).Any())
{
gymnast.Value = documentMember.Id;
sender.Save();
}
//sender.Save();
//if (sender.LoginName != sender.Text && documentMember == null)
}
示例10: HandleEditProfile
public ActionResult HandleEditProfile(ProfileViewModel model)
{
if (!ModelState.IsValid)
{
return CurrentUmbracoPage();
}
//Update the member with our data & save it down
//Using member ID and not email address in case member has changed their email
Member updateMember = new Member(model.MemberID);
updateMember.Text = model.Name;
updateMember.Email = model.EmailAddress;
updateMember.getProperty("description").Value = model.Description;
updateMember.getProperty("profileURL").Value = model.ProfileURL;
updateMember.getProperty("twitter").Value = model.Twitter;
updateMember.getProperty("linkedIn").Value = model.LinkedIn;
updateMember.getProperty("skype").Value = model.Skype;
//Save the member
updateMember.Save();
//Update success flag (in a TempData key)
TempData["IsSuccessful"] = true;
//Return the view
return RedirectToCurrentUmbracoPage();
}
示例11: CheckForSpam
public static SpamResult CheckForSpam(Member member)
{
// Already blocked, nothing left to do here
if (member.getProperty("blocked").Value.ToString() == "1")
{
return new SpamResult
{
MemberId = member.Id,
Name = member.Text,
Blocked = true
};
}
// If reputation is > ReputationThreshold they've got enough karma, spammers never get that far
var reputation = member.getProperty("reputationTotal").Value.ToString();
int reputationTotal;
if (int.TryParse(reputation, out reputationTotal) && reputationTotal > ReputationThreshold)
return null;
// If they're already marked as suspicious then no need to process again
if (Roles.IsUserInRole(member.LoginName, SpamMemberGroupName))
{
return new SpamResult
{
MemberId = member.Id,
Name = member.Text,
AlreadyInSpamRole = true
};
}
var spammer = CheckForSpam(member.Email, member.Text, false);
if (spammer != null && spammer.TotalScore > PotentialSpammerThreshold)
{
AddMemberToPotentialSpamGroup(member);
spammer.MemberId = member.Id;
SendPotentialSpamMemberMail(spammer);
if (spammer.Blocked)
{
member.getProperty("blocked").Value = true;
member.Save();
// If blocked, just redirect them to the home page where they'll get a message saying they're blocked
HttpContext.Current.Response.Redirect("/");
}
}
return null;
}
示例12: MarkAsSpam
public void MarkAsSpam()
{
var markAsSpamEventArgs = new MarkAsSpamEventArgs();
FireBeforeMarkAsSpam(markAsSpamEventArgs);
if (markAsSpamEventArgs.Cancel)
return;
var forum = new Forum(ParentId);
var topic = GetTopic(Id);
var member = new Member(topic.MemberId);
member.getProperty("blocked").Value = true;
member.Save();
Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 1 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));
Id = 0;
forum.Save();
Forum.SendSpamMail(Body, Id, "topic", member.Id, true);
FireAfterMarkAsSpam(markAsSpamEventArgs);
}
示例13: MakeNew
public static Member MakeNew(string Name, string LoginName, string Email, MemberType mbt, User u)
{
var loginName = (!String.IsNullOrEmpty(LoginName)) ? LoginName : Name;
if (String.IsNullOrEmpty(loginName))
throw new ArgumentException("The loginname must be different from an empty string", "loginName");
// Test for e-mail
if (Email != "" && Member.GetMemberFromEmail(Email) != null)
throw new Exception(String.Format("Duplicate Email! A member with the e-mail {0} already exists", Email));
else if (Member.GetMemberFromLoginName(loginName) != null)
throw new Exception(String.Format("Duplicate User name! A member with the user name {0} already exists", loginName));
Guid newId = Guid.NewGuid();
//create the cms node first
CMSNode newNode = MakeNew(-1, _objectType, u.Id, 1, Name, newId);
//we need to create an empty member and set the underlying text property
Member tmp = new Member(newId, true);
tmp.SetText(Name);
//create the content data for the new member
tmp.CreateContent(mbt);
// Create member specific data ..
SqlHelper.ExecuteNonQuery(
"insert into cmsMember (nodeId,Email,LoginName,Password) values (@id,@email,@loginName,'')",
SqlHelper.CreateParameter("@id", tmp.Id),
SqlHelper.CreateParameter("@loginName", loginName),
SqlHelper.CreateParameter("@email", Email));
//read the whole object from the db
Member m = new Member(newId);
NewEventArgs e = new NewEventArgs();
m.OnNew(e);
m.Save();
return m;
}
示例14: saveUrlAsBuddyIcon
private static string saveUrlAsBuddyIcon(string url, Member m)
{
string _file = m.Id.ToString();
string _path = HttpContext.Current.Server.MapPath("/media/avatar/" + _file + ".jpg");
string _currentFile = m.getProperty("avatar").Value.ToString();
if (System.IO.File.Exists(_path))
System.IO.File.Delete(_path);
System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile(url, _path);
m.getProperty("avatar").Value = "/media/avatar/" + _file + ".jpg";
m.XmlGenerate(new XmlDocument());
m.Save();
Member.RemoveMemberFromCache(m);
Member.AddMemberToCache(m);
return "/media/avatar/" + _file + ".jpg";
}
示例15: IsSpam
public static bool IsSpam(int memberId, string body, string commentType, int topicId)
{
var member = new Member(memberId);
int reputationTotal;
int.TryParse(member.getProperty("reputationTotal").Value.ToString(), out reputationTotal);
// Members with over 50 karma are trusted automatically
if (reputationTotal >= 50)
return false;
var isSpam = TextContainsSpam(body) || IsSuspiciousBehavior(body);
if (isSpam)
{
// Deduct karma
member.getProperty("reputationTotal").Value = reputationTotal >= 0 ? reputationTotal - 1 : 0;
int reputationCurrent;
int.TryParse(member.getProperty("reputationCurrent").Value.ToString(), out reputationCurrent);
member.getProperty("reputationCurrent").Value = reputationCurrent >= 0 ? reputationCurrent - 1 : 0;
member.Save();
SendSpamMail(body, topicId, commentType, memberId, false);
}
return isSpam;
}