protected void Page_Load(object sender, EventArgs e) { //查询用户昵称和照片路径 DataSet dsUser = login.SelectUser(Session["UserName"].ToString()); imgUser.ImageUrl = "../" + dsUser.Tables[0].Rows[0]["PhotoPath"].ToString(); lblUserNick.Text = dsUser.Tables[0].Rows[0]["NickName"].ToString(); //查询会员昵称和照片路径 DataSet dsFriend = login.SelectUser(Session["FriendName"].ToString()); imgFriend.ImageUrl = "../" + dsFriend.Tables[0].Rows[0]["PhotoPath"].ToString(); lblFriendNick.Text = dsFriend.Tables[0].Rows[0]["NickName"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = login.SelectUser(Session["UserName"].ToString()).Tables[0]; txtUserName.Text = dt.Rows[0]["UserName"].ToString(); lblPwd.Text = dt.Rows[0]["PassWord"].ToString(); sltSex.Value = dt.Rows[0]["Sex"].ToString(); txtNickName.Text = dt.Rows[0]["NickName"].ToString(); txtBirth.Text = dt.Rows[0]["BirthDay"].ToString(); string address = dt.Rows[0]["Address"].ToString(); //将省市分开 int position = address.LastIndexOf("省"); if (position == -1) { position = address.LastIndexOf("区"); } sltState.Value = address.Substring(0, position + 1); sltCity.Items.Add(address.Substring(position + 1, address.Length - position - 1)); sltCity.Value = address.Substring(position + 1, address.Length - position - 1); sltStature.Value = dt.Rows[0]["Stature"].ToString(); sltAvoirdupois.Value = dt.Rows[0]["Avoirdupois"].ToString(); sltEducation.Value = dt.Rows[0]["Education"].ToString(); sltEarning.Value = dt.Rows[0]["Earning"].ToString(); sltNation.Value = dt.Rows[0]["Nation"].ToString(); sltBloodType.Value = dt.Rows[0]["BloodType"].ToString(); sltLooks.Value = dt.Rows[0]["Looks"].ToString(); txtMetier.Text = dt.Rows[0]["Metier"].ToString(); sltHousing.Value = dt.Rows[0]["Housing"].ToString(); sltBuyCar.Value = dt.Rows[0]["BuyCar"].ToString(); sltMarriage.Value = dt.Rows[0]["Marriage"].ToString(); sltHaveBaby.Value = dt.Rows[0]["HaveBaby"].ToString(); sltHavingBaby.Value = dt.Rows[0]["HavingBaby"].ToString(); sltSmoke.Value = dt.Rows[0]["Smoke"].ToString(); sltDrink.Value = dt.Rows[0]["Drink"].ToString(); txtLanage.Text = dt.Rows[0]["UseLanguage"].ToString(); txtSexLike.Text = dt.Rows[0]["SexLike"].ToString(); //********修改速配条件***********// string Faddress = dt.Rows[0]["FriendCome"].ToString(); if (Faddress != "00") //主要用于设置地区不限的用户。 { //将省市分开 int Fposition = Faddress.LastIndexOf("省"); if (Fposition == -1) { Fposition = Faddress.LastIndexOf("区"); } sltFState.Value = Faddress.Substring(0, Fposition + 1); sltFCity.Items.Add(Faddress.Substring(Fposition + 1, Faddress.Length - Fposition - 1)); sltFCity.Value = Faddress.Substring(Fposition + 1, Faddress.Length - Fposition - 1); } sltFAgeStar.Value = dt.Rows[0]["FriendAgeStar"].ToString(); sltFAgeEnd.Value = dt.Rows[0]["FriendAgeEnd"].ToString(); sltFStatureStar.Value = dt.Rows[0]["FriendStatureStar"].ToString(); sltFStatureEnd.Value = dt.Rows[0]["FriendStatureEnd"].ToString(); sltFMarriage.Value = dt.Rows[0]["FriendMarriage"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { DataSet dsMsg = msg.MsgSelectID(Session["MsgID"].ToString()); //根据消息ID查询数据 txtMsg.Text = dsMsg.Tables[0].Rows[0]["msg"].ToString(); //显示消息内容 string UserName = dsMsg.Tables[0].Rows[0][2].ToString(); //显示用户名 FriendName = dsMsg.Tables[0].Rows[0][1].ToString(); //显示好友姓名 DataSet dsUser = login.SelectUser(UserName); imgUser.ImageUrl = "../" + "../" + dsUser.Tables[0].Rows[0]["PhotoPath"].ToString(); lblUserNick.Text = dsUser.Tables[0].Rows[0]["NickName"].ToString(); DataSet dsFriend = login.SelectUser(FriendName); imgFriend.ImageUrl = "../" + "../" + dsFriend.Tables[0].Rows[0]["PhotoPath"].ToString(); lblFriendNick.Text = dsFriend.Tables[0].Rows[0]["NickName"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["FriendDetail"] == null) { Session["FriendDetail"] = Request["uname"]; } else { if (Session["FriendDetail"].ToString() != Request["uname"].ToString()) { Session["FriendDetail"] = Request["uname"]; } } this.Title = Session["FriendDetail"].ToString() + "的详细信息"; //基本信息 DataTable dt = login.SelectUser(Session["FriendDetail"].ToString()).Tables[0]; lblBase_NickName.Text = dt.Rows[0]["NickName"].ToString(); lblBase_Sex.Text = dt.Rows[0]["Sex"].ToString(); lblBase_BirthDay.Text = dt.Rows[0]["BirthDay"].ToString(); lblBase_Marray.Text = dt.Rows[0]["Marriage"].ToString(); lblBase_Hight.Text = dt.Rows[0]["Stature"].ToString(); lblBase_Kg.Text = dt.Rows[0]["Avoirdupois"].ToString(); lblBase_Mz.Text = dt.Rows[0]["Nation"].ToString(); lblBase_Study.Text = dt.Rows[0]["Education"].ToString(); lblBase_Menoy.Text = dt.Rows[0]["Earning"].ToString(); lblBase_Look.Text = dt.Rows[0]["Looks"].ToString(); lblBase_Job.Text = dt.Rows[0]["Metier"].ToString(); lblBase_House.Text = dt.Rows[0]["Housing"].ToString(); lblBase_Area.Text = dt.Rows[0]["Address"].ToString(); imgPhoto.ImageUrl = "../../" + dt.Rows[0]["PhotoPath"].ToString(); //真情告白 lblSexLike.Text = dt.Rows[0]["SexLike"].ToString(); //择友要求 lblFAge.Text = dt.Rows[0]["FriendAgeStar"].ToString() + " 至 " + dt.Rows[0]["FriendAgeEnd"].ToString(); lblFHight.Text = dt.Rows[0]["FriendStatureStar"].ToString() + " 至 " + dt.Rows[0]["FriendStatureEnd"].ToString(); lblFArea.Text = dt.Rows[0]["FriendCome"].ToString().Replace("0", ""); lblFMarray.Text = dt.Rows[0]["FriendMarriage"].ToString(); //其他信息 lblHaveChild.Text = dt.Rows[0]["HaveBaby"].ToString(); lblHavingChild.Text = dt.Rows[0]["HavingBaby"].ToString(); lblSmoke.Text = dt.Rows[0]["Smoke"].ToString(); lblDrink.Text = dt.Rows[0]["Drink"].ToString(); lblBlood.Text = dt.Rows[0]["BloodType"].ToString(); lblLanguage.Text = dt.Rows[0]["UseLanguage"].ToString(); }
//注册按钮事件 protected void btnLogin_Click(object sender, EventArgs e) { /************注册交友信息************/ //获取前台页面的txtUserName控件的用户名 login.UserName = txtUserName.Text; //验证前台输入的用户名是否重复 if (login.SelectUser(login.UserName).Tables[0].Rows.Count > 0) { //如果重复,弹出提示 WebMessageBox.Show("该用户ID存在,请重新输入!"); } //获取txtPwd控件返回的密码 login.PassWord = txtPwd.Text; //获取txtNickName控件返回的昵称 login.NickName = txtNickName.Text; //获取页面提交过来的性别 login.Sex = Request.Form["sltSex"].ToString(); //验证页面有没有提交过来性别 if (login.Sex == "0") { //如果没有提交过来性别则弹出提示 WebMessageBox.Show("请选择您的性别!"); } //获取txtBirth控件返回的生日 login.BirthDay = txtBirth.Text; //获取前台提交过来的地址 login.Address = Request.Form["sltState"].ToString() + Request.Form["sltCity"].ToString(); //如果没有获取到前台提交的地址 if (Request.Form["sltState"].ToString() == "0" || Request.Form["sltCity"].ToString() == "0") { //如果没有填写地址弹出提示 WebMessageBox.Show("请选择您的所在省和地区!"); } //获取前台提交过来的身高 login.Stature = Request.Form["sltStature"].ToString(); //验证有没有传递过来身高 if (login.Stature == "0") { //如果没有填写身高弹出提示 WebMessageBox.Show("请选择您的身高!"); } //获取前台提交过来的体重 login.Avoirdupois = Request.Form["sltAvoirdupois"].ToString(); //验证有没有 if (login.Avoirdupois == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您的体重!"); } //获取前台提交过来的学历 login.Education = Request.Form["sltEducation"].ToString(); //验证有没有学历 if (login.Education == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您的最高学历!"); } //获取前台提交过来的年收入 login.Earning = Request.Form["sltEarning"].ToString(); //如果没有年收入 if (login.Earning == "0") { //弹出提示 WebMessageBox.Show("请选择您的年收入!"); } //获取前台传递过来的民族 login.Nation = Request.Form["sltNation"].ToString(); //如果没有传递填写 if (login.Nation == "0") { //弹出提示 WebMessageBox.Show("请选择您所属民族!"); } //获取前台传递过来的血型 login.BloodType = Request.Form["sltBloodType"].ToString(); //验证有没有填写血型 if (login.BloodType == "0") { //如果没有填写血型弹出提示 WebMessageBox.Show("请选择您的血型!"); } //获取前台传递古来的相貌 login.Looks = Request.Form["sltLooks"].ToString(); //如果没有填写相貌 if (login.Looks == "0") { //弹出提示 WebMessageBox.Show("请选择您的相貌!"); } //根据txtMetier获取职业 login.Metier = txtMetier.Text; //获取前台传递过来的住房情况 login.Housing = Request.Form["sltHousing"].ToString(); //如果住房情况没有填写 if (login.Housing == "0") { //弹出提示 WebMessageBox.Show("请选择住房情况!"); } //获取前台传递过来的购车情况 login.BuyCar = Request.Form["sltBuyCar"].ToString(); //如果没有填写 if (login.BuyCar == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您的购车情况!"); } //获取前台传递过来的购车情况 login.Marriage = Request.Form["sltMarriage"].ToString(); //如果没有填写 if (login.Marriage == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您的婚姻状况!"); } //获取前台传递过来的小孩 login.HaveBaby = Request.Form["sltHaveBaby"].ToString(); //如果没有填写 if (login.HaveBaby == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您现在时候有小孩!"); } login.HavingBaby = Request.Form["sltHavingBaby"].ToString(); if (login.HavingBaby == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您将来是否要小孩!"); } //获取前台传递过来的是否抽烟 login.Smoke = Request.Form["sltSmoke"].ToString(); //如果没有填写 if (login.Smoke == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您是否吸烟!"); } //获取前台传递过来是否喝酒 login.Drink = Request.Form["sltDrink"].ToString(); //如果没有填写 if (login.Drink == "0") { //如果没有弹出提示 WebMessageBox.Show("请选择您是否喝酒!"); } //设置交流语言 login.UseLanguage = txtLanage.Text; //设置性格与爱好 login.SexLike = txtSexLike.Text; /***设置速配条件***/ //获取对方的地址 login.FriendCome = Request.Form["sltFState"].ToString() + Request.Form["sltFCity"].ToString(); //获取对方的最小年龄 login.FriendAgeStar = Convert.ToInt32(Request.Form["sltFAgeStar"]); //获取对方的最大年龄 login.FriendAgeEnd = Convert.ToInt32(Request.Form["sltFAgeEnd"]); //获取对方的最小身高 login.FriendStatureStar = Convert.ToInt32(Request.Form["sltFStatureStar"]); //获取对方的最大身高 login.FriendStatureEnd = Convert.ToInt32(Request.Form["sltFStatureEnd"].ToString()); //获取对方的婚姻状态 login.FriendMarriage = Request.Form["sltFMarriage"].ToString(); //添加注册信息 int i = login.Login(login); //设置服务器端客户端标识 Session["UserName"] = login.UserName; //跳转页面 Response.Redirect("index.html"); }
private void BindGridView() { GridView1.DataSource = login.SelectUser(); GridView1.DataKeyNames = new string[] { "id" }; GridView1.DataBind(); }