protected void btn_SaveBasicInfo_Click(object sender, EventArgs e) { EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User; EShop.Model.Account_UserDetails objUserDetails = bllUserDetails.GetModelList(string.Format(" UserCode = '{0}'", objUser.UserCode)).FirstOrDefault(); objUserDetails = objUserDetails == null ? new EShop.Model.Account_UserDetails() : objUserDetails; objUser.Email = this.email.Text; objUserDetails.UserCode = objUser.UserCode; try { objUserDetails.Birthday = DateTime.Parse(this.birthday.Value); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新失败!请填写生日!');</script>"); return; } objUserDetails.Gender = int.Parse(this.gender.SelectedValue); objUserDetails.OfficeTEL = this.offictel.Value; objUserDetails.FamilyTEL = this.familytel.Value; objUserDetails.Phone = this.cellphone.Text; objUserDetails.PwdTipCode = this.passQuestion.SelectedValue; objUserDetails.PwdTipAns = this.pwdanswer.Value; if (bllUserDetails.UpdateBasicInfo(objUser, objUserDetails) == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "success", "<script>alert('更新成功!');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "<script>alert('更新失败!');</script>"); } }
void FormInitialize() { EShop.Model.Account_User objUser = Session["User"] as EShop.Model.Account_User; this.email.Text = objUser.Email; EShop.Model.Account_UserDetails objUserDetails = bllUserDetails.GetModelList(string.Format(" UserCode = '{0}'", objUser.UserCode)).FirstOrDefault(); if (objUserDetails != null) { this.birthday.Value = objUserDetails.Birthday.Value.ToString("yyyy/MM/dd"); this.gender.SelectedValue = objUserDetails.Gender.ToString(); this.offictel.Value = objUserDetails.OfficeTEL; this.familytel.Value = objUserDetails.FamilyTEL; this.cellphone.Text = objUserDetails.Phone; this.passQuestion.SelectedValue = objUserDetails.PwdTipCode; this.pwdanswer.Value = objUserDetails.PwdTipAns; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EShop.Model.Account_UserDetails model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(EShop.Model.Account_UserDetails model) { return(dal.Add(model)); }
public int UpdateBasicInfo(EShop.Model.Account_User objUser, EShop.Model.Account_UserDetails objUserDetails) { return(dal.UpdateBasicInfo(objUser, objUserDetails)); }