/// <summary> /// 编辑信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button3_Click(object sender, EventArgs e) { #region 检查输入 if (RadioButtonList1.SelectedIndex == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "nogender", "alert('请选择性别');", true); return; } #endregion try { m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.FateType = int.Parse(drpFateType.SelectedValue); m_user.Gender = int.Parse(RadioButtonList1.SelectedValue); m_user.Birth = DatePicker2.SelectedTime; m_user.IsShowBirth = int.Parse(drpBirthType.SelectedValue); m_user.HomeTown = District2.Area3SysNo; m_user.Intro = txtIntro.Text; USR_CustomerBll.GetInstance().Update(m_user); SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; Page.ClientScript.RegisterStartupScript(this.GetType(), "infook", "alert('用户信息更新成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.UserInfo.Edit", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "noinfo", "alert('系统故障,请联系管理员');", true); } }
public void SetSession(USR_CustomerMod m_user) { SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo); Session[AppConfig.CustomerSession] = m_session; }
/// <summary> /// 修改密码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button5_Click(object sender, EventArgs e) { if (txtOldPass.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('请输入旧密码');", true); return; } if (txtNewPass.Text.Trim() == "" || txtPassAgain.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('新的密码不能为空');", true); return; } if (txtNewPass.Text.Trim().Length < 6 || txtNewPass.Text.Trim().Length > 16) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码长度必须在6-16字符内!');", true); return; } if (txtPassAgain.Text.Trim() != txtPassAgain.Text.Trim()) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码输入不一致!');", true); return; } if (txtOldPass.Text.Trim() != GetSession().CustomerEntity.Password) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您输入的旧密码与原密码不一致,请重新输入!');", true); return; } if (CommonTools.CheckPasswordLevel(txtNewPass.Text.Trim()) == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您的密码实在太过简单,请重新输入!');", true); return; } else { try { //更新数据库中的用户密码 m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.Password = txtNewPass.Text.Trim(); USR_CustomerBll.GetInstance().Update(m_user); //更新session中的密码 SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; Page.ClientScript.RegisterStartupScript(this.GetType(), "passok", "alert('修改成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.UserPass.Edit", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "nopass", "alert('系统故障,请联系管理员');", true); } } }
public void RefreshSession() { SessionInfo oSession = (SessionInfo)Session[AppConfig.CustomerSession]; if (oSession != null) { oSession.CustomerEntity = USR_CustomerBll.GetInstance().GetModel(oSession.CustomerEntity.SysNo); oSession.GradeEntity = USR_GradeBll.GetInstance().GetModel(oSession.CustomerEntity.GradeSysNo); } }
protected void Page_Load(object sender, EventArgs e) { PageBase m_base = new PageBase(); if (m_user.SysNo != m_base.GetSession().CustomerEntity.SysNo) { ltr_me = "TA"; } m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo); }
protected void Unnamed2_Click(object sender, EventArgs e) { string username = txtEmail.Text.Trim(); string password = txtPass.Text.Trim(); #region 验证邮箱有效性 #endregion USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password); if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功 { SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; //记住我 if (chkRemember.Checked) { HttpCookie Cookie = CookiesHelper.GetCookie("upup1000"); if (Cookie == null || Cookie.Value == null || Cookie.Value == "") { Cookie = new HttpCookie("upup1000"); Cookie.Values.Add("uname", CommonTools.Encode(username)); Cookie.Values.Add("psd", CommonTools.Encode(password)); //设置Cookie过期时间 Cookie.Expires = DateTime.Now.AddYears(50); CookiesHelper.AddCookie(Cookie); } else { CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50)); CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50)); } } LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.CustomerEntity.Email); //跳转 Response.Redirect("Qin/View/" + m_user.SysNo); } else { Response.Redirect("Passport/Login.aspx?email=" + txtEmail.Text.Trim() + "&error=" + (int)AppEnum.ErrorType.WrongAccount); } }
protected void BindData() { try { if (m_qustion.DR != (int)AppEnum.State.normal) { ShowError(""); } m_qustion.ReadCount++; QA_QuestionBll.GetInstance().Update(m_qustion); ltrTitle.Text = m_qustion.Title; ltrContext.Text = m_qustion.Context; ltrAward.Text = m_qustion.Award.ToString(); ltrReply.Text = m_qustion.ReplyCount.ToString(); ltrViewNum.Text = m_qustion.ReadCount.ToString(); USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(m_qustion.CustomerSysNo); USR_GradeMod m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo); ltrNickName.Text = m_user.NickName; ltrQALevel.Text = m_grade.Name; ltrTotalReply.Text = m_user.TotalReply.ToString(); ltrTotalAsk.Text = m_user.TotalQuest.ToString(); Image1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + m_user.Photo; #region 显示命盘 FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(SysNo); if (m_chart != null && m_chart.SysNo != AppConst.IntNull) { if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull) { Astro1.input = m_chart; Astro1.Visible = true; } else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.ziwei) { Ziwei1.input = m_chart; Ziwei1.Visible = true; } else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.bazi) { Bazi1.input = m_chart; Bazi1.Visible = true; } else { Astro1.input = m_chart; Astro1.Visible = true; } } #endregion #region 绑定原报价单信息 if (order != 0) { TextBox2.Text = old_order.Words.ToString(); TextBox2.ReadOnly = true; TextBox3.Text = old_order.Price.ToString(); TextBox3.ReadOnly = true; txtDescription.Text = old_order.Description; txtDescription.ReadOnly = true; txtTrial.Text = old_order.Trial; txtTrial.ReadOnly = true; } else { //发布报价单时隐藏结果输入框 resulttitle.Visible = false; resultcontent.Visible = false; } #endregion } catch { ShowError(""); } }
protected void BindData() { try { if (m_qustion.DR != (int)AppEnum.State.normal) { ShowError(""); } m_qustion.ReadCount++; QA_QuestionBll.GetInstance().Update(m_qustion); ltrTitle.Text = m_qustion.Title; ltrContext.Text = m_qustion.Context; ltrAward.Text = m_qustion.Award.ToString(); ltrReply.Text = m_qustion.ReplyCount.ToString(); ltrTime.Text = m_qustion.TS.ToString("yyyy-MM-dd HH:mm:ss"); ltrViewNum.Text = m_qustion.ReadCount.ToString(); if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { LinkButton5.Style["display"] = ""; ltrTime.Text += " | "; } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(m_qustion.CustomerSysNo); USR_GradeMod m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo); ltrNickName.Text = m_user.NickName; ltrQALevel.Text = m_grade.Name; ltrTotalReply.Text = m_user.TotalReply.ToString(); ltrTotalAsk.Text = m_user.TotalQuest.ToString(); Image1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + m_user.Photo; #region 显示命盘 FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(SysNo); if (m_chart != null && m_chart.SysNo != AppConst.IntNull) { if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull) { Astro1.input = m_chart; Astro1.Visible = true; } else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.ziwei) { Ziwei1.input = m_chart; Ziwei1.Visible = true; } else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.bazi) { Bazi1.input = m_chart; Bazi1.Visible = true; } else { Astro1.input = m_chart; Astro1.Visible = true; } } #endregion BindList(); } catch { ShowError(""); } }
protected void Unnamed3_Click(object sender, EventArgs e) { #region 验证输入 if (!ValidateCode()) { code.Text = ""; return; } if (!ValidateEmail()) { code.Text = ""; return; } if (!ValidatePass()) { code.Text = ""; return; } if (!ValidateNickName()) { code.Text = ""; return; } #endregion #region 保存数据 USR_CustomerMod m_user = new USR_CustomerMod(); try { m_user.Email = email.Text.Trim(); m_user.FateType = int.Parse(drpType.SelectedValue); m_user.GradeSysNo = AppConst.OriginalGrade;; m_user.NickName = name.Text.Trim(); m_user.Password = password1.Text.Trim(); m_user.RegTime = DateTime.Now; m_user.Point = AppConst.OriginalPoint; m_user.Photo = AppConst.OriginalPhoto; m_user.LastLoginTime = DateTime.Now; if (AppConfig.RegisterEmailCheck.ToLower() == "true") { m_user.Status = (int)AppEnum.State.prepare; } else { m_user.Status = (int)AppEnum.State.normal; } m_user.Credit = 0; m_user.Birth = AppConst.DateTimeNull; m_user.IsShowBirth = 1; m_user.IsStar = 0; m_user.BestAnswer = 0; m_user.TotalAnswer = 0; m_user.TotalQuest = 0; m_user.HomeTown = AppConst.IntNull; m_user.Intro = AppConst.OriginalIntro; m_user.Signature = AppConst.OriginalSign; m_user.Exp = 0; m_user.TotalReply = 0; m_user.HasNewInfo = 0; m_user.TotalTalk = 0; m_user.TotalTalkReply = 0; m_user.SetOrderCount = 0; m_user.BuyOrderCount = 0; m_user.SellOrderCount = 0; m_user.TotalSellRMB = 0; m_user.TotalBuyRMB = 0; m_user.TotalBuyPoint = 0; m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Register", Request.UserHostAddress); return; } #endregion #region 发送验证邮件 if (AppConfig.RegisterEmailCheck.ToLower() == "true") { } #endregion #region 登陆状态设置 if (!(AppConfig.RegisterEmailCheck.ToLower() == "true")) { SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; } #endregion if (Request.QueryString["url"] != null && Request.QueryString["url"] != "") { Response.Redirect("RegisterSucc.aspx?url=" + Request.QueryString["url"]); } else { Response.Redirect("RegisterSucc.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { try { m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); if (m_user.SysNo == AppConst.IntNull) { ShowError(""); } } catch { ShowError(""); } } else if (Page.RouteData.Values["id"] != null) { try { m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Page.RouteData.Values["id"].ToString())); if (m_user.SysNo == AppConst.IntNull) { ShowError(""); } } catch { ShowError(""); } } else { Login(Request.Url.ToString()); m_user = USR_CustomerBll.GetInstance().GetModel(GetSession().CustomerEntity.SysNo); m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo); } try { if (!IsPostBack) { if (m_user.HomeTown != AppConst.IntNull) { SYS_DistrictMod m_dictrict = SYS_DistrictBll.GetInstance().GetModel(SYS_DistrictBll.GetInstance().GetModel(m_user.HomeTown).UpSysNo); ltrFrom.Text = m_dictrict.Name; } else { ltrFrom.Text = "未知"; } if (m_user.Birth != AppConst.DateTimeNull) { ltrBirth.Text = "生日:" + m_user.Birth.ToString("yyyy年MM月dd日"); } else { ltrBirth.Text = "生日:未知"; } BindArticles(); BindBestAnswer(); BindIcons(); LinkButton1_Click(LinkButton1, e); } if (GetSession().CustomerEntity != null && GetSession().CustomerEntity.SysNo != AppConst.IntNull && m_user.SysNo == GetSession().CustomerEntity.SysNo) { ltrMe = "我"; sendmsg.Visible = false; intro.HRef = AppConfig.HomeUrl() + "Qin/UserInfo.aspx?id=" + m_user.SysNo + "&tab=1"; ImageButton1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo; } else { ltrMe = "Ta"; intro.Visible = false; sendmsg.HRef = AppConfig.HomeUrl() + "Qin/MsgDetail.aspx?UserSysNo=" + m_user.SysNo; ImageButton1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo; ImageButton1.Enabled = false; } RightPannel1.m_user = m_user; RightPannel1.m_grade = m_grade; } catch { ShowError(""); } if (Request.QueryString["pn"] != null) { try { pageindex = int.Parse(Request.QueryString["pn"]); } catch { } } if (Request.QueryString["tab"] != null) { try { tab = int.Parse(Request.QueryString["tab"]); } catch { } } }
protected void LinkButton1_Click(object sender, EventArgs e) { //if (!ValidateEmail()) //{ // return; //} if (!ValidateNickName()) { return; } #region 获取用户第三方数据 USR_ThirdLoginMod m_third = new USR_ThirdLoginMod(); switch (ViewState["type"].ToString()) { case "qq": m_third.OpenID = ViewState["openid"].ToString(); m_third.AccessKey = ViewState["code"].ToString(); m_third.ExpireTime = DateTime.Now.AddSeconds(int.Parse(ViewState["expire"].ToString())); m_third.ThirdType = (int)AppEnum.ThirdLoginType.qq; break; case "weibo": m_third.OpenID = ViewState["openid"].ToString(); m_third.AccessKey = ViewState["code"].ToString(); m_third.ThirdType = (int)AppEnum.ThirdLoginType.weibo; break; default: ShowError("系统故障,请联系管理员"); break; } #endregion #region 保存数据 USR_CustomerMod m_user = new USR_CustomerMod(); try { m_user.Email = ""; m_user.FateType = int.Parse(drpType.SelectedValue); m_user.GradeSysNo = AppConst.OriginalGrade;; m_user.NickName = ViewState["nickname"].ToString(); m_user.Password = ""; m_user.RegTime = DateTime.Now; m_user.Point = AppConst.OriginalPoint; m_user.Photo = ViewState["photo"].ToString(); m_user.LastLoginTime = DateTime.Now; if (AppConfig.RegisterEmailCheck.ToLower() == "true") { m_user.Status = (int)AppEnum.State.prepare; } else { m_user.Status = (int)AppEnum.State.normal; } m_user.Credit = 0; m_user.Birth = AppConst.DateTimeNull; m_user.IsShowBirth = 1; m_user.IsStar = 0; m_user.BestAnswer = 0; m_user.TotalAnswer = 0; m_user.TotalQuest = 0; m_user.HomeTown = AppConst.IntNull; m_user.Intro = AppConst.OriginalIntro; m_user.Signature = AppConst.OriginalSign; m_user.Exp = 0; m_user.TotalReply = 0; m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user); m_third.CustomerSysNo = m_user.SysNo; USR_ThirdLoginBll.GetInstance().Add(m_third); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Register", Request.UserHostAddress); return; } #endregion #region 登陆状态设置 if (!(AppConfig.RegisterEmailCheck.ToLower() == "true")) { SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; } #endregion if (Request.QueryString["url"] != null && Request.QueryString["url"] != "") { Response.Redirect("RegisterSucc.aspx?url=" + Request.QueryString["url"]); } else { Response.Redirect("RegisterSucc.aspx"); } }