本文整理汇总了C#中umbraco.cms.businesslogic.member.Member类的典型用法代码示例。如果您正苦于以下问题:C# Member类的具体用法?C# Member怎么用?C# Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Member类属于umbraco.cms.businesslogic.member命名空间,在下文中一共展示了Member类的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: MemberGroup_Add_Member_To_Group_And_Delete_Group
public void MemberGroup_Add_Member_To_Group_And_Delete_Group()
{
var mt = MemberType.MakeNew(m_User, "TEST" + Guid.NewGuid().ToString("N"));
var m = Member.MakeNew("TEST" + Guid.NewGuid().ToString("N"),
"TEST" + Guid.NewGuid().ToString("N") + "@test.com", mt, m_User);
var mg = MemberGroup.MakeNew("TEST" + Guid.NewGuid().ToString("N"), m_User);
Assert.IsInstanceOfType(mg, typeof(MemberGroup));
Assert.IsTrue(mg.Id > 0);
//add the member to the group
m.AddGroup(mg.Id);
//ensure they are added
Assert.AreEqual(1, m.Groups.Count);
Assert.AreEqual<int>(mg.Id, ((MemberGroup)m.Groups.Cast<DictionaryEntry>().First().Value).Id);
//delete the group
mg.delete();
//make sure the member is no longer associated
m = new Member(m.Id); //need to re-get the member
Assert.AreEqual<int>(0, m.Groups.Count);
//now cleanup...
m.delete();
Assert.IsFalse(Member.IsNode(m.Id));
mt.delete();
Assert.IsFalse(MemberType.IsNode(mt.Id));
}
示例3: SaveProject
private void SaveProject(Document project, Member user)
{
if (!string.IsNullOrWhiteSpace(Request["title"]))
{
project.getProperty("title").Value = Request["title"];
}
if (!string.IsNullOrWhiteSpace(Request["description"]))
project.getProperty("description").Value = Request["description"];
if (!string.IsNullOrWhiteSpace(Request["projectType"]))
project.getProperty("projectType").Value = Convert.ToInt32(Request["projectType"]);
if (!string.IsNullOrWhiteSpace(Request["area"]))
project.getProperty("area").Value = Convert.ToInt32(Request["area"]);
project.getProperty("allowComments").Value = !string.IsNullOrWhiteSpace(Request["allowComments"]) && Request["allowComments"].ToLower().Equals("on");
project.getProperty("author").Value = user.Id;
if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0)
{
var uploadedFile = Request.Files[0];
var fileName = Path.GetFileName(uploadedFile.FileName);
var fileSavePath = Server.MapPath("~/media/projects/" + fileName);
uploadedFile.SaveAs(fileSavePath);
project.getProperty("image").Value = "/media/projects/" + fileName;
}
project.SaveAndPublish(user.User);
umbraco.library.UpdateDocumentCache(project.Id);
}
示例4: 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;
}
示例5: GetOriginalUrl
/// <summary>
/// Gets the image property.
/// </summary>
/// <returns></returns>
internal static string GetOriginalUrl(int nodeId, ImageResizerPrevalueEditor imagePrevalueEditor)
{
Property imageProperty;
var node = new CMSNode(nodeId);
if (node.nodeObjectType == Document._objectType)
{
imageProperty = new Document(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
}
else if (node.nodeObjectType == Media._objectType)
{
imageProperty = new Media(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
}
else
{
if (node.nodeObjectType != Member._objectType)
{
throw new Exception("Unsupported Umbraco Node type for Image Resizer (only Document, Media and Members are supported.");
}
imageProperty = new Member(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
}
try
{
return imageProperty.Value.ToString();
}
catch
{
return string.Empty;
}
}
示例6: bt_submit_Click
protected void bt_submit_Click(object sender, EventArgs e)
{
umbraco.presentation.nodeFactory.Node p = new umbraco.presentation.nodeFactory.Node(int.Parse(Request.QueryString["id"]));
Member owner = new Member(int.Parse(p.GetProperty("owner").Value));
Member m = Member.GetCurrentMember();
MailMessage mm = new MailMessage();
mm.Subject = "Umbraco community: Request to contribute to project";
mm.Body =
string.Format("The Umbraco Community member '{0}' would like to contribute to your project '{1}'. You can add the member to the project from your profile on our.umbraco.org.",
m.Text, p.Name);
mm.Body = mm.Body + string.Format("\n\r\n\rMessage from {0}: \n\r\n\r", m.Text) + tb_message.Text;
mm.To.Add(owner.Email);
mm.From = new MailAddress(m.Email);
SmtpClient c = new SmtpClient();
c.Send(mm);
umbraco.presentation.nodeFactory.Node current = umbraco.presentation.nodeFactory.Node.GetCurrent();
Response.Redirect(umbraco.library.NiceUrl(current.Children[0].Id));
}
示例7: 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));
}
}
示例8: OnNewMember
new protected virtual void OnNewMember(NewMemberUIEventArgs e, string unencryptedPassword, Member m)
{
if (NewMember != null)
{
NewMember(m, unencryptedPassword, e);
}
}
示例9: 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;
}
示例10: Member_AfterSave
private void Member_AfterSave(Member sender, SaveEventArgs e)
{
//ensure that only the providers are flagged to listen execute
var xml = sender.ToXml(new System.Xml.XmlDocument(), false).ToXElement();
var providers = ExamineManager.Instance.IndexProviderCollection.OfType<BaseUmbracoIndexer>()
.Where(x => x.EnableDefaultEventHandler);
ExamineManager.Instance.ReIndexNode(xml, IndexTypes.Member, providers);
}
示例11: GetMember
public static Member GetMember(int id)
{
Member m = Member.GetMemberFromCache(id);
if (m == null)
m = new Member(id);
return m;
}
示例12: Member_AfterDelete
private void Member_AfterDelete(Member sender, DeleteEventArgs e)
{
var nodeId = sender.Id.ToString();
//ensure that only the providers are flagged to listen execute
ExamineManager.Instance.DeleteFromIndex(nodeId,
ExamineManager.Instance.IndexProviderCollection.OfType<BaseUmbracoIndexer>()
.Where(x => x.EnableDefaultEventHandler));
}
示例13: SendMailFromPageToMember
public static void SendMailFromPageToMember(string FromMail, Member member, string Subject, int PageId, string body, Dictionary<string, LinkedResource> imagedictionary)
{
MailMessage mail = Helper.BuildMail(member,Subject, body, imagedictionary);
mail.From = new MailAddress(FromMail.Trim());
mail.To.Add(new MailAddress(member.Email));
SendMail(mail);
}
示例14: readById
public memberCarrier readById(int memberId, string username, string password)
{
Authenticate(username, password);
umbraco.cms.businesslogic.member.Member foundMember = new umbraco.cms.businesslogic.member.Member(memberId);
if (foundMember == null)
return null;
return CreateMemberCarrier(foundMember);
}
示例15: SendAdminNotification
private void SendAdminNotification(Member newmember)
{
var sb = new StringBuilder();
sb.AppendFormat(library.GetDictionaryItem("MemberSignUpEmailText"),
Settings.Name,
newmember.LoginName,
newmember.Text,
newmember.Email);
Helpers.SendMail(Settings.EmailNotification, Settings.EmailAdmin, library.GetDictionaryItem("NewMemberSignUp"), sb.ToString());
}