Profiles更新
来源:互联网 发布:邓肯常规赛数据统计 编辑:程序博客网 时间:2024/06/08 06:29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
public partial class ProfileTestSource : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!User.Identity.IsAuthenticated)
{
FormsAuthentication.RedirectToLoginPage();
}
else
{
//还原Profile用户设置文件到相关控制项
if (!IsPostBack)
{
restoreProfile();
Page.DataBind();
}
}
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
try
{
Profile.Sex = dwnSex.SelectedItem.Value == "1" ? true : false;
Profile.Address.City = dwnCity.SelectedItem.Text;
if (!string.IsNullOrEmpty(txtPostalCode.Text))
{
Profile.Address.PostalCode = Convert.ToInt32(txtPostalCode.Text);
}
else
{
throw new Exception("邮编不得为空白!");
}
if (Calendar1.SelectedDates.Count >= 1)
{
Profile.生日 = Calendar1.SelectedDate;
}
else
{
throw new Exception("您必须选择生日!");
}
Profile.学历 = dwnEduDegree.SelectedItem.Text;
Profile.星座 = dwnConstellation.SelectedItem.Text;
Profile.血型 = dwnBloodType.SelectedItem.Text;
if (!String.IsNullOrEmpty(txtCareer.Text))
{
Profile.职业 = txtCareer.Text;
}
else
{
throw new Exception("职业不得为空白!");
}
Profile.Save(); //储存Profile
new AlertMessage().showMsg(this.Page, "Profile修改成功!");
}
catch (Exception ex)
{
new AlertMessage().showMsg(this.Page, ex.Message.ToString());
}
}
//还原Profile用户设置文件到相关控制项
private void restoreProfile()
{
try
{
//性别
string txtSex = Profile.Sex ? "男" : "女";
for (int i = 0; i < dwnSex.Items.Count; i++)
{
if (dwnSex.Items[i].Text == txtSex)
{
dwnSex.Items[i].Selected = true;
break;
}
}
//国家
txtCountry.Text = Profile.Address.Country;
//县市
for (int i = 0; i < dwnCity.Items.Count; i++)
{
if (dwnCity.Items[i].Text == Profile.Address.City)
{
dwnCity.Items[i].Selected = true;
break;
}
}
//邮编
txtPostalCode.Text = Profile.Address.PostalCode.ToString();
//生日
if (Profile.生日.Year == 1)
{
Calendar1.TodaysDate = DateTime.Now.Date;
}
else
{
Calendar1.SelectedDate = Profile.生日;
Calendar1.TodaysDate = Profile.生日;
}
//学历
for (int i = 0; i < dwnEduDegree.Items.Count; i++)
{
if (dwnEduDegree.Items[i].Text == Profile.学历)
{
dwnEduDegree.Items[i].Selected = true;
break;
}
}
//星座
for (int i = 0; i < dwnConstellation.Items.Count; i++)
{
if (dwnConstellation.Items[i].Text == Profile.星座)
{
dwnConstellation.Items[i].Selected = true;
break;
}
}
//血型
for (int i = 0; i < dwnBloodType.Items.Count; i++)
{
if (dwnBloodType.Items[i].Text == Profile.血型)
{
dwnBloodType.Items[i].Selected = true;
break;
}
}
//职业
txtCareer.Text = Profile.职业;
}
catch (Exception ex)
{
new AlertMessage().showMsg(this.Page, ex.Message.ToString());
}
}
protected void btnSignOut_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
}
- Profiles更新
- xcode6更新证书错误:No matching provisioning profiles found 解决方案
- xcode6.0更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found
- xcode6更新证书错误:No matching provisioning profiles found 解决方案
- IOSXcode更新证书时出现No matching provisioning profiles found
- iOS真机调试时更新证书错误:No matching provisioning profiles found
- 更新证书错误:No matching provisioning profiles found或者友盟错误
- iOS真机调试时更新证书错误:No matching provisioning profiles found
- maven profiles
- bluez & profiles
- 重学java之java数组冒泡排序
- 稀疏矩阵与广义表的操作(用C写的)
- 为人处事
- 成功法则
- 总结:加载javascript
- Profiles更新
- 20110505
- 强制类型转换(转)
- may 5,2011
- js 打开窗体的操作类
- 写给兄弟连学员的一封信
- 小命令告诉你电脑是否存在木马
- 贝尔实验室与AT&T实验室的关系
- 打开QTP之后,IE运行打不开