本文整理汇总了C#中umbraco.cms.businesslogic.member.Member.getProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Member.getProperty方法的具体用法?C# Member.getProperty怎么用?C# Member.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.member.Member
的用法示例。
在下文中一共展示了Member.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
}
示例2: SetAvatar
public static string SetAvatar(int mId, string service)
{
string retval = "";
Member m = new Member(mId);
if (m != null) {
switch (service) {
case "twitter":
if (m.getProperty("twitter") != null && m.getProperty("twitter").Value.ToString() != "") {
XPathNodeIterator twitData = Twitter.Profile(m.getProperty("twitter").Value.ToString());
if (twitData.MoveNext()) {
string imgUrl = twitData.Current.SelectSingleNode("//profile_image_url").Value;
return saveUrlAsBuddyIcon(imgUrl, m);
}
}
break;
case "gravatar":
string gUrl = "http://www.gravatar.com/avatar/" + umbraco.library.md5(m.Email) + "?s=48&d=monsterid";
return saveUrlAsBuddyIcon(gUrl, m);
default:
break;
}
}
return retval;
}
示例3: 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));
}
}
}
示例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: SendNotification
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
try
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
string domain = details.SelectSingleNode("//domain").InnerText;
int topicId = int.Parse(args[0].ToString());
int memberId = int.Parse(args[1].ToString());
uForum.Businesslogic.Topic t = uForum.Businesslogic.Topic.GetTopic(topicId);
Member m = new Member(memberId);
body = string.Format(body,
t.Title,
"https://" + domain + args[2].ToString());
if (m.getProperty("bugMeNot").Value.ToString() != "1")
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"]);
conn.Open();
string insert =
"Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())";
SqlCommand icomm = new SqlCommand(insert, conn);
icomm.Parameters.AddWithValue("@topicId", topicId);
icomm.Parameters.AddWithValue("@memberID", m.Id);
icomm.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message);
}
return true;
}
示例6: NotSpamTopic
protected void NotSpamTopic(Object sender, CommandEventArgs e)
{
var id = int.Parse(e.CommandArgument.ToString());
var topic = Topic.GetTopic(id);
topic.Save(false, true);
// Set reputation to at least 50 so their next posts won't be automatically marked as spam
var member = new Member(topic.MemberId);
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;
FillSpamTopicGrid();
}
示例7: Member_AfterSave
void Member_AfterSave(Member sender, umbraco.cms.businesslogic.SaveEventArgs e)
{
string groups = "";
foreach (MemberGroup mg in sender.Groups.Values)
{
groups += mg.Text + ",";
}
sender.getProperty("groups").Value = groups.Trim().Trim(','); ;
sender.XmlGenerate(new System.Xml.XmlDocument());
}
示例8: NotSpamComment
protected void NotSpamComment(Object sender, CommandEventArgs e)
{
var id = int.Parse(e.CommandArgument.ToString());
var comment = Services.CommentService.Instance().GetById(id);
comment.IsSpam = false;
comment.Save(true);
// Set reputation to at least 50 so their next posts won't be automatically marked as spam
var member = new Member(comment.MemberId);
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;
FillSpamCommentGrid();
}
示例9: NotSpamComment
protected void NotSpamComment(Object sender, CommandEventArgs e)
{
var id = int.Parse(e.CommandArgument.ToString());
var comment = Comment.GetComment(id, true);
comment.IsSpam = false;
comment.Save(true);
// Restore karma
var member = new Member(comment.MemberId);
int reputationTotal;
int.TryParse(member.getProperty("reputationTotal").Value.ToString(), out reputationTotal);
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;
Forum.MarkAsHam(comment.MemberId, comment.Body, "comment");
FillSpamCommentGrid();
}
示例10: 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");
}
示例11: 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;
}
示例12: SetAvatar
public static string SetAvatar(int mId, string service)
{
var member = new Member(mId);
switch (service)
{
case "twitter":
if (member.getProperty("twitter") != null && member.getProperty("twitter").Value.ToString() != "")
{
var twitData = Twitter.Profile(member.getProperty("twitter").Value.ToString());
if (twitData.MoveNext())
{
var imgUrl = twitData.Current.SelectSingleNode("//profile_image_url").Value;
return SaveUrlAsBuddyIcon(imgUrl, member);
}
}
break;
case "gravatar":
var gravatarUrl = "http://www.gravatar.com/avatar/" + umbraco.library.md5(member.Email) + "?s=48&d=monsterid";
return SaveUrlAsBuddyIcon(gravatarUrl, member);
}
return string.Empty;
}
示例13: Member_New
void Member_New(Member sender, NewEventArgs e)
{
//This is a bit of a hack to ensure that the member is approved when created since many people will be using
// this old api to create members on the front-end and they need to be approved - which is based on whether or not
// the Umbraco membership provider is configured.
var provider = Membership.Provider as UmbracoMembershipProvider;
if (provider != null)
{
var approvedField = provider.ApprovedPropertyTypeAlias;
var property = sender.getProperty(approvedField);
if (property != null)
{
property.Value = 1;
}
}
}
示例14: GetMessageCreds
private void GetMessageCreds()
{
// Make sure we have a member id available to us
MemberId = null;
if (Request.QueryString["mem"] != null)
MemberId = Request.QueryString["mem"].ToInt32();
if (MemberId != null)
{
try
{
MessageToMember = new Member((Int32)MemberId);
if (MembershipHelper.IsAuthenticated() &&
Settings.EnablePrivateMessaging &&
MessageToMember.getProperty("forumUserAllowPrivateMessages").Value.ToString() == "1" &&
!IsBanned)
{
//quick check to make sure the member is not PM'ing themselves
if (MessageToMember.Id == CurrentMember.MemberId) Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("CantMessageYourself")));
if (!Page.IsPostBack)
{
// See if there is a subject querystring, if so we know this is a reply
ReplySubject = null;
if (Request.QueryString["r"] != null)
ReplySubject = "RE: " + Request.QueryString["r"];
lvPrivateMessage.Visible = true;
//Now if this is a reply, prepopulate the subject textbox
var tbMessageSubject = (TextBox)lvPrivateMessage.FindControl("tbMessageSubject");
tbMessageSubject.Text = ReplySubject;
}
var litMemberTo = (Literal)lvPrivateMessage.FindControl("litMemberTo");
if (litMemberTo != null)
litMemberTo.Text = MessageToMember.LoginName;
}
}
catch(Exception)
{
// Show friendly message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", "Unable to find that member"));
}
}
}
示例15: 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)));
}
}