本文整理汇总了C#中AuthorProfile类的典型用法代码示例。如果您正苦于以下问题:C# AuthorProfile类的具体用法?C# AuthorProfile怎么用?C# AuthorProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthorProfile类属于命名空间,在下文中一共展示了AuthorProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProfile
public static JsonProfile GetProfile(string id)
{
if (!Utils.StringIsNullOrWhitespace(id))
{
bool canEditRoles;
if (!CanUserEditProfile(id, out canEditRoles))
return null;
var pf = AuthorProfile.GetProfile(id);
if (pf == null)
{
pf = new AuthorProfile(id);
pf.Birthday = DateTime.Parse("01/01/1900");
pf.DisplayName = id;
pf.EmailAddress = Utils.GetUserEmail(id);
pf.FirstName = id;
pf.Private = true;
pf.Save();
}
return AuthorProfile.ToJson(id);
}
return null;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Params["id"] != null)
{
lbID.Text = Request.Params["id"];
}
ap = AuthorProfile.GetProfile(lbID.Text);
//机构名称
lbTitle.Text = ap.Company;
strTitle = ap.Company;
strCity = ap.Address;
strGSJS = ap.AboutMe;
strFWGKH = ap.Description1;
this.Title = ap.Company;
if (Request.Cookies["OrgansViewCount_" + lbID.Text] == null)
{
HttpCookie MyCookie = new HttpCookie("OrgansViewCount_" + lbID.Text);
DateTime now = DateTime.Now;
MyCookie["IP"] = Request.UserHostAddress;
MyCookie["tid"] = lbID.Text;
MyCookie.Expires = now.AddHours(1);
Response.Cookies.Add(MyCookie);
ap.ViewCount++;
ap.Save();
}
}
}
示例3: DeleteProfile
/// <summary>
/// The delete profile.
/// </summary>
/// <param name="profile">
/// The profile.
/// </param>
public override void DeleteProfile(AuthorProfile profile)
{
var fileName = string.Format("{0}profiles{1}{2}.xml", GetFolder(profile.Blog), Path.DirectorySeparatorChar, profile.Id);
if (File.Exists(fileName))
{
File.Delete(fileName);
}
if (AuthorProfile.Profiles.Contains(profile))
{
AuthorProfile.Profiles.Remove(profile);
}
// remove profile picture
var dir = BlogService.GetDirectory("/avatars");
foreach (var f in dir.Files)
{
var dot = f.Name.IndexOf(".");
var img = dot > 0 ? f.Name.Substring(0, dot) : f.Name;
if (profile.UserName == img)
{
f.Delete();
}
}
}
示例4: btnok_Click
protected void btnok_Click(object sender, EventArgs e)
{
string reg_uid = Request["reg_uid"];
Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]);
AuthorProfile pc = new AuthorProfile(reg_uid);
pc.DisplayName = Request["reg_xingming"];
//pc.Company = Request["reg_company"];
if (Request["reg_phone2"] != string.Empty)
{
pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : "");
}
pc.PhoneMobile = Request["reg_mobile"];
if (Request["reg_fax2"] != string.Empty)
{
pc.PhoneFax = (Request["reg_fax1"].Trim() != string.Empty ? Request["reg_fax1"] + "-" : "") + Request["reg_fax2"];
}
pc.CityTown = Request["reg_shi"];
pc.MSN_QQ = Request["reg_qqmsn"];
pc.Company = Request["reg_company"];
pc.Address = Request["reg_address"];
pc.AboutMe = Request["reg_jianjie"];
pc.Description1 = Request["reg_kehu"];
Uppic(pc);
pc.Save();
Roles.AddUserToRole(reg_uid, "organs");
Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=org", true);
}
示例5: lbSaveProfile_Click
protected void lbSaveProfile_Click(object sender, EventArgs e)
{
string userProfileToSave = ViewState["selectedProfile"] as string;
AuthorProfile pc = AuthorProfile.GetProfile(userProfileToSave);
if (pc == null)
pc = new AuthorProfile(userProfileToSave);
pc.IsPrivate = cbIsPublic.Checked;
pc.DisplayName = tbDisplayName.Text;
pc.FirstName = tbFirstName.Text;
pc.MiddleName = tbMiddleName.Text;
pc.LastName = tbLastName.Text;
DateTime date;
if (DateTime.TryParse(tbBirthdate.Text, out date))
pc.Birthday = date;
pc.PhotoURL = tbPhotoUrl.Text;
pc.PhoneMain = tbPhoneMain.Text;
pc.PhoneMobile = tbPhoneMobile.Text;
pc.PhoneFax = tbPhoneFax.Text;
pc.EmailAddress = tbEmailAddress.Text;
pc.CityTown = tbCityTown.Text;
pc.RegionState = tbRegionState.Text;
pc.Country = ddlCountry.SelectedValue;
pc.Company = tbCompany.Text;
pc.AboutMe = tbAboutMe.Text;
pc.Save();
}
示例6: Uppic
protected void Uppic(AuthorProfile ap)
{
if (fudPhoto.FileName == string.Empty)
{
return;
}
HttpPostedFile pf = fudPhoto.PostedFile;
int intDocLen = pf.ContentLength;
string contentType = pf.ContentType;
byte[] Docbuffer = new byte[intDocLen];
Stream objStream;
objStream = pf.InputStream;
objStream.Read(Docbuffer, 0, intDocLen);
Res res = new Res();
res.FileName = Path.GetFileName(pf.FileName);
res.ResType = pf.ContentType;
res.Description = "Profile";
res.Author = ap.UserName;
res.Points = 0;
res.Save();
res.CurrentPostFileBuffer = Docbuffer;
res.BlobUpdate();
res.CurrentPostFileBuffer = null;
ap.PhotoURL = res.Id.ToString();
}
示例7: DeleteProfile
public override void DeleteProfile(AuthorProfile profile)
{
string fileName = _Folder + "profiles" + Path.DirectorySeparatorChar + profile.Id + ".xml";
if (File.Exists(fileName))
File.Delete(fileName);
if (AuthorProfile.Profiles.Contains(profile))
AuthorProfile.Profiles.Remove(profile);
}
示例8: btnNo_Click
protected void btnNo_Click(object sender, EventArgs e)
{
string userProfileToSave = ViewState["selectedProfile"] as string;
AuthorProfile pc = AuthorProfile.GetProfile(userProfileToSave);
if (pc == null)
pc = new AuthorProfile(userProfileToSave);
pc.IsPrivate = false;
pc.NoMess = txtNoMess.Text;
pc.Save();
}
示例9: DeleteProfile
/// <summary>
/// The delete profile.
/// </summary>
/// <param name="profile">
/// The profile.
/// </param>
public override void DeleteProfile(AuthorProfile profile)
{
var fileName = string.Format("{0}profiles{1}{2}.xml", this.Folder, Path.DirectorySeparatorChar, profile.Id);
if (File.Exists(fileName))
{
File.Delete(fileName);
}
if (AuthorProfile.Profiles.Contains(profile))
{
AuthorProfile.Profiles.Remove(profile);
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
lbID.Text = Request.Params["uid"];
tch = AuthorProfile.GetProfile(lbID.Text);
this.Title = tch.DisplayName;
if (Request.Cookies["tchViewCount_" + lbID.Text] == null)
{
HttpCookie MyCookie = new HttpCookie("tchViewCount_" + lbID.Text);
DateTime now = DateTime.Now;
MyCookie["IP"] = Request.UserHostAddress;
MyCookie["tid"] = lbID.Text;
MyCookie.Expires = now.AddHours(1);
Response.Cookies.Add(MyCookie);
tch.ViewCount++;
tch.Save();
}
}
示例11: InsertProfile
/// <summary>
/// The insert profile.
/// </summary>
/// <param name="profile">
/// The profile.
/// </param>
public override void InsertProfile(AuthorProfile profile)
{
if (!Directory.Exists(string.Format("{0}profiles", this.Folder)))
{
Directory.CreateDirectory(string.Format("{0}profiles", this.Folder));
}
var fileName = string.Format("{0}profiles{1}{2}.xml", this.Folder, Path.DirectorySeparatorChar, profile.Id);
var settings = new XmlWriterSettings { Indent = true };
using (var writer = XmlWriter.Create(fileName, settings))
{
writer.WriteStartDocument(true);
writer.WriteStartElement("profileData");
writer.WriteElementString("DisplayName", profile.DisplayName);
writer.WriteElementString("FirstName", profile.FirstName);
writer.WriteElementString("MiddleName", profile.MiddleName);
writer.WriteElementString("LastName", profile.LastName);
writer.WriteElementString("CityTown", profile.CityTown);
writer.WriteElementString("RegionState", profile.RegionState);
writer.WriteElementString("Country", profile.Country);
writer.WriteElementString("Birthday", profile.Birthday.ToString("yyyy-MM-dd"));
writer.WriteElementString("AboutMe", profile.AboutMe);
writer.WriteElementString("PhotoURL", profile.PhotoUrl);
writer.WriteElementString("Company", profile.Company);
writer.WriteElementString("EmailAddress", profile.EmailAddress);
writer.WriteElementString("PhoneMain", profile.PhoneMain);
writer.WriteElementString("PhoneMobile", profile.PhoneMobile);
writer.WriteElementString("PhoneFax", profile.PhoneFax);
writer.WriteElementString("IsPrivate", profile.Private.ToString());
writer.WriteEndElement();
}
}
示例12: InsertProfile
public override void InsertProfile(AuthorProfile profile)
{
if (!Directory.Exists(_Folder + "profiles"))
Directory.CreateDirectory(_Folder + "profiles");
string fileName = _Folder + "profiles" + Path.DirectorySeparatorChar + profile.Id + ".xml";
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
using (XmlWriter writer = XmlWriter.Create(fileName, settings))
{
writer.WriteStartDocument(true);
writer.WriteStartElement("profileData");
writer.WriteElementString("DisplayName", profile.DisplayName);
writer.WriteElementString("FirstName", profile.FirstName);
writer.WriteElementString("MiddleName", profile.MiddleName);
writer.WriteElementString("LastName", profile.LastName);
writer.WriteElementString("CityTown", profile.CityTown);
writer.WriteElementString("RegionState", profile.RegionState);
writer.WriteElementString("Country", profile.Country);
writer.WriteElementString("Birthday", profile.Birthday.ToString("yyyy-MM-dd"));
writer.WriteElementString("AboutMe", profile.AboutMe);
writer.WriteElementString("PhotoURL", profile.PhotoURL);
writer.WriteElementString("Company", profile.Company);
writer.WriteElementString("EmailAddress", profile.EmailAddress);
writer.WriteElementString("PhoneMain", profile.PhoneMain);
writer.WriteElementString("PhoneMobile", profile.PhoneMobile);
writer.WriteElementString("PhoneFax", profile.PhoneFax);
writer.WriteElementString("IsPrivate", profile.IsPrivate.ToString());
writer.WriteEndElement();
}
}
示例13: btnok_Click
protected void btnok_Click(object sender, EventArgs e)
{
string reg_uid = Request["reg_uid"];
Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]);
//reg_nicheng reg_company
//reg_phone1 reg_phone2 reg_phone3 reg_mobile reg_qqmsn
AuthorProfile pc = new AuthorProfile(reg_uid);
pc.DisplayName = Request["reg_nicheng"];
pc.CityTown = Request["reg_shi"];
pc.Company = Request["reg_company"];
if (Request["reg_phone2"]!=string.Empty)
{
pc.PhoneMain = Request["reg_phone1"].Trim() != string.Empty ?Request["reg_phone1"] + "-":"" + Request["reg_phone2"] + Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : "";
}
pc.PhoneMobile = Request["reg_mobile"];
pc.MSN_QQ = Request["reg_qqmsn"];
pc.IsPrivate = true;//学员注册直接审核通过
pc.Save();
Roles.AddUserToRole(reg_uid, "students");
Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=std", true);
}
示例14: btnok_Click
protected void btnok_Click(object sender, EventArgs e)
{
string reg_uid = Request["reg_uid"];
Membership.CreateUser(Request["reg_uid"], Request["reg_pwd1"], Request["reg_email"]);
AuthorProfile pc = new AuthorProfile(reg_uid);
pc.DisplayName = Request["reg_xingming"];
pc.CityTown = Request["reg_shi"];
//pc.Company = Request["reg_company"];
if (Request["reg_phone2"] != string.Empty)
{
pc.PhoneMain = (Request["reg_phone1"].Trim() != string.Empty ? Request["reg_phone1"] + "-" : "") + Request["reg_phone2"] + (Request["reg_phone3"].Trim() != string.Empty ? "-" + Request["reg_phone3"] : "");
}
pc.PhoneMobile = Request["reg_mobile"];
pc.MSN_QQ = Request["reg_qqmsn"];
pc.Pay = Request["reg_pay"];
pc.AboutMe = Request["reg_jianjie"];
pc.Description1 = Request["reg_kehu"];
pc.Description2 = Request["reg_zhujiang"];
string fields = string.Empty;
for (int i = 0; i < Field.Fields.Count; i++)
{
if (Request["reg_lingyu:" + i]!=null)
{
Field fld = Field.Fields[i];
fields += fld.Id + "|";
}
}
pc.Fields = fields.TrimEnd('|');
Uppic(pc);
pc.Save();
Roles.AddUserToRole(reg_uid, "teachers");
Response.Redirect(Utils.AbsoluteWebRoot + "reg/regok.aspx?uType=tch", true);
}
示例15: SelectProfile
/// <summary>
/// Loads AuthorProfile from database
/// </summary>
/// <param name="id">username</param>
/// <returns></returns>
public override AuthorProfile SelectProfile(string id)
{
StringDictionary dic = new StringDictionary();
AuthorProfile profile = new AuthorProfile(id);
// Retrieve Profile data from Db
string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName;
DbProviderFactory provider = DbProviderFactories.GetFactory(providerName);
using (DbConnection conn = provider.CreateConnection())
{
conn.ConnectionString = connString;
conn.Open();
using (DbCommand cmd = conn.CreateCommand())
{
string sqlQuery = "SELECT SettingName, SettingValue FROM " + tablePrefix + "Profiles " +
"WHERE UserName = " + parmPrefix + "name";
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
DbParameter dpName = provider.CreateParameter();
dpName.ParameterName = parmPrefix + "name";
dpName.Value = id;
cmd.Parameters.Add(dpName);
using (DbDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
dic.Add(rdr.GetString(0), rdr.GetString(1));
}
}
}
}
// Load profile with data from dictionary
if (dic.ContainsKey("DisplayName"))
profile.DisplayName = dic["DisplayName"];
if (dic.ContainsKey("FirstName"))
profile.FirstName = dic["FirstName"];
if (dic.ContainsKey("MiddleName"))
profile.MiddleName = dic["MiddleName"];
if (dic.ContainsKey("LastName"))
profile.LastName = dic["LastName"];
if (dic.ContainsKey("CityTown"))
profile.CityTown = dic["CityTown"];
if (dic.ContainsKey("RegionState"))
profile.RegionState = dic["RegionState"];
if (dic.ContainsKey("Country"))
profile.Country = dic["Country"];
if (dic.ContainsKey("Birthday"))
{
DateTime date;
if (DateTime.TryParse(dic["Birthday"], out date))
profile.Birthday = date;
}
if (dic.ContainsKey("AboutMe"))
profile.AboutMe = dic["AboutMe"];
if (dic.ContainsKey("PhotoURL"))
profile.PhotoURL = dic["PhotoURL"];
if (dic.ContainsKey("Company"))
profile.Company = dic["Company"];
if (dic.ContainsKey("EmailAddress"))
profile.EmailAddress = dic["EmailAddress"];
if (dic.ContainsKey("PhoneMain"))
profile.PhoneMain = dic["PhoneMain"];
if (dic.ContainsKey("PhoneMobile"))
profile.PhoneMobile = dic["PhoneMobile"];
if (dic.ContainsKey("PhoneFax"))
profile.PhoneFax = dic["PhoneFax"];
if (dic.ContainsKey("IsPrivate"))
profile.IsPrivate = dic["IsPrivate"] == "true";
return profile;
}