public QA_CommentShow MapQA_CommentShow(DataRow input) { QA_CommentShow ret = new QA_CommentShow(); USR_CustomerMaintain tmpuu = new USR_CustomerMaintain(); USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString())).MemberwiseCopy(tmpuu); ret.Customer = tmpuu; if (input["AnswerSysNo"].ToString() != "") { ret.AnswerSysNo = int.Parse(input["AnswerSysNo"].ToString()); } ret.Context = input["Context"].ToString(); if (input["CustomerSysNo"].ToString() != "") { ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString()); } if (input["DR"].ToString() != "") { ret.DR = int.Parse(input["DR"].ToString()); } if (input["QuestionSysNo"].ToString() != "") { ret.QuestionSysNo = int.Parse(input["QuestionSysNo"].ToString()); } if (input["SysNo"].ToString() != "") { ret.SysNo = int.Parse(input["SysNo"].ToString()); } if (input["TS"].ToString() != "") { ret.TS = DateTime.Parse(input["TS"].ToString()); } return(ret); }
public ReturnValue <bool> UpdateUserInfo(int uid, int gender, int fatetype, string intro) { if (gender > 1 || gender < 0) { throw new BusinessException("性别错误"); } if (fatetype > 3 || fatetype < 1) { throw new BusinessException("排盘类型错误"); } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(uid); if (m_user == null || m_user.SysNo == -999999) { throw new BusinessException("该用户不存在"); } else { m_user.Gender = gender; m_user.FateType = fatetype; m_user.Intro = AppCmn.CommonTools.NoHTML(AppCmn.CommonTools.StringFilter(intro)); USR_CustomerBll.GetInstance().Update(m_user); return(ReturnValue <bool> .Get200OK(true)); } }
public void SetOrder(QA_OrderMod order, QA_AnswerMod answer) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { int sysno = QA_AnswerBll.GetInstance().AddAnswer(answer); USR_CustomerBll.GetInstance().AddCount(answer.CustomerSysNo, 0, 0, 0, 0, 0, 0, 1, 0, 0); order.AnswerSysNo = sysno; Add(order); QA_QuestionMod m_qa = QA_QuestionBll.GetInstance().GetModel(order.QuestionSysNo); m_qa.OrderCount++; QA_QuestionBll.GetInstance().Update(m_qa); AppMod.User.USR_RecordMod m_record = new AppMod.User.USR_RecordMod(); m_record.CustomerSysNo = order.CustomerSysNo; m_record.TargetSysNo = sysno; m_record.TS = DateTime.Now; m_record.Type = (int)AppEnum.ActionType.SetOrder; User.USR_RecordBll.GetInstance().Add(m_record); scope.Complete(); } }
protected void Button7_Click(object sender, EventArgs e) { string OPath = @"~\WebResources\UpUserFiles\Photos\O"; try { int imageWidth = Int32.Parse(txt_width.Text); int imageHeight = Int32.Parse(txt_height.Text); int cutTop = Int32.Parse(txt_top.Text); int cutLeft = Int32.Parse(txt_left.Text); int dropWidth = Int32.Parse(txt_DropWidth.Text); int dropHeight = Int32.Parse(txt_DropHeight.Text); string filename = ImageHelper.SaveCutPic(Server.MapPath(@"~\WebResources\UpUserFiles\Photos\Tmp\o" + hdfPicID.Value), Server.MapPath(OPath), 0, 0, dropWidth, dropHeight, cutLeft, cutTop, imageWidth, imageHeight); ImageHelper.SaveThumbnail(Server.MapPath(OPath + @"\" + filename), Server.MapPath(@"~\WebResources\UpUserFiles\Photos\T"), filename, 70, 70, true); m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.Photo = filename.Replace(".jpg", ""); USR_CustomerBll.GetInstance().Update(m_user); MultiView1.ActiveViewIndex = 0; //DataBind(); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('头像更新成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }
/// <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 SetAward(QA_AnswerMod m_answer, QA_QuestionMod m_quest, int score) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { if (m_answer.Award == AppConst.IntNull) { m_answer.Award = score; } else { m_answer.Award += score; } QA_AnswerBll.GetInstance().Update(m_answer); USR_CustomerBll.GetInstance().AddPoint(score, m_answer.CustomerSysNo); USR_CustomerBll.GetInstance().AddCount(m_answer.CustomerSysNo, 0, 0, 1, 0, 0, 0, 0, 0, 0); int usedAward = QA_AnswerBll.GetInstance().GetUsedAward(m_quest.SysNo); if (score == m_quest.Award - usedAward) { m_quest.EndTime = DateTime.Now; QA_QuestionBll.GetInstance().Update(m_quest); } scope.Complete(); } }
public ReturnValue <bool> CheckUser(string username) { if (string.IsNullOrEmpty(username)) { throw new BusinessException("用户名或手机号不能为空"); } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username); if (m_user.SysNo != -999999) { return(ReturnValue <bool> .Get200OK(true)); } else { m_user = USR_CustomerBll.GetInstance().CheckPhone(username); if (m_user.SysNo != -999999) { return(ReturnValue <bool> .Get200OK(true)); } else { return(ReturnValue <bool> .Get200OK(false)); } } }
public ReturnValue <PageInfo <QA_AnswerShow> > GetAnswerByQuest(int pagesize, int pageindex, int sysno) { int total = 0; DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, sysno, ref total); List <QA_AnswerShow> ret = new List <QA_AnswerShow>(); PageInfo <QA_AnswerShow> rett = new PageInfo <QA_AnswerShow>(); if (m_dt == null || m_dt.Rows.Count == 0) { rett.List = ret; rett.Total = total; rett.HasNextPage = false; return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett)); } for (int i = 0; i < m_dt.Rows.Count; i++) { QA_AnswerShow tmp_answer = MapQA_AnswerShow(m_dt.Rows[i]); USR_CustomerShow tmpu = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(tmp_answer.CustomerSysNo).MemberwiseCopy(tmpu); tmp_answer.Customer = tmpu; DataTable tmp_dt = QA_CommentBll.GetInstance().GetListByAnswer(tmp_answer.SysNo); if (tmp_dt != null && tmp_dt.Rows.Count > 0) { List <QA_CommentShow> commentlist = new List <QA_CommentShow>(); for (int j = 0; j < tmp_dt.Rows.Count && j <= 3; j++) { QA_CommentShow tmp_comment = MapQA_CommentShow(tmp_dt.Rows[j]); USR_CustomerMaintain tmpuu = new USR_CustomerMaintain(); USR_CustomerBll.GetInstance().GetModel(tmp_comment.CustomerSysNo).MemberwiseCopy(tmpuu); tmp_comment.Customer = tmpuu; commentlist.Add(tmp_comment); } tmp_answer.TopComments = commentlist; tmp_answer.ToalComment = tmp_dt.Rows.Count; if (tmp_dt.Rows.Count > 3) { tmp_answer.HasMoreComment = true; } else { tmp_answer.HasMoreComment = false; } } ret.Add(tmp_answer); } rett.List = ret; rett.Total = total; if (pagesize * pageindex >= total) { rett.HasNextPage = false; } else { rett.HasNextPage = true; } return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett)); }
/// <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); } }
private bool ValidateEmail() { m_user = USR_CustomerBll.GetInstance().CheckUser(email.Text.Trim()); if (m_user.SysNo != AppConst.IntNull) { Page.ClientScript.RegisterStartupScript(this.GetType(), "emailwrong", "document.getElementById('ctl00_ContentPlaceHolder1_emailTip').innerHTML = '该邮箱已注册,请重新输入!';", true); return(false); } return(true); }
// Methods protected void BindContent() { DateTime beginTime = AppConst.DateTimeNull; DateTime endTime = AppConst.DateTimeNull; try { if (this.txtTimeBegin.Text != "") { beginTime = DateTime.Parse(this.txtTimeBegin.Text.Trim()); } if (this.txtTimeEnd.Text != "") { endTime = DateTime.Parse(this.txtTimeEnd.Text.Trim()); } } catch { } DataTable m_dt = USR_CustomerBll.GetInstance().GetList(20, this.pageindex, this.txtName.Text.Trim(), beginTime, endTime, this.drpStatus.SelectedValue, ref this.total); m_dt.Columns.Add("deleteurl"); m_dt.Columns.Add("topurl"); m_dt.Columns.Add("topname"); for (int i = 0; i < m_dt.Rows.Count; i++) { m_dt.Rows[i]["deleteurl"] = this.urlnow + "&delete="; int star = 1; if (m_dt.Rows[i]["IsStar"].ToString() == star.ToString()) { m_dt.Rows[i]["topurl"] = this.urlnow + "¬op="; m_dt.Rows[i]["topname"] = "取消明星"; } else { m_dt.Rows[i]["topurl"] = this.urlnow + "&top="; m_dt.Rows[i]["topname"] = "设置明星"; } } this.rptFamous.DataSource = m_dt; this.rptFamous.DataBind(); this.Pager1.url = "List.aspx?name=" + this.txtName.Text.Trim() + "&begin=" + this.txtTimeBegin.Text.Trim() + "&end=" + this.txtTimeEnd.Text.Trim() + "&status=" + this.drpStatus.SelectedValue + "&pn="; if ((this.total % 20) == 0) { this.Pager1.total = this.total / 20; } else { this.Pager1.total = (this.total / 20) + 1; } this.Pager1.index = this.pageindex; this.Pager1.numlenth = 3; }
protected void Unnamed1_Click(object sender, EventArgs e) { if (ValidateCode() && ValidateEmail()) { try { //生成6位随机新密码,并MD5加密; string[] arr = ("A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,2,3,4,5,6,7,8,9").Split(','); string Password = ""; int randValue = -1; Random rand = new Random(unchecked ((int)DateTime.Now.Ticks)); for (int i = 0; i < 6; i++) { randValue = rand.Next(0, arr.Length - 1); Password += arr[randValue]; } m_user.Password = Password; USR_CustomerBll.GetInstance().Update(m_user); //TCPMail oMail = new TCPMail(); //string url = "http://www.diafans.com/Login/LoginSuccess.aspx?opt=ValidateEmail&ID=" + this.txt_NickName.Text.Trim() + "&Email=" + this.txt_Email.Text.Trim(); string mailadd = m_user.Email; string mailSubject = "上上签密码找回"; #region SetEmailContent string mailBody = CommonTools.ReadHtmFile(AppConfig.AdvFolderPath + @"EmailTemplate/FindPassword.htm"); mailBody.Replace("@nickname", m_user.NickName); mailBody.Replace("@password", m_user.Password); //mailBody.Replace("@userid", m_user.SysNo.ToString()); //mailBody.Replace("@md5",CommonTools.md5(m_user.NickName+m_user.Password+DateTime.Now.ToString("yyyyMMddHHmmss"),32); #endregion SetEmailContent //邮件发送 TCPMail oMail = new TCPMail(); oMail.Html = true; if (oMail.Send(mailadd, mailSubject, mailBody)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('邮件已发送,请注意查收!');", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true); } } catch (Exception exp) { LogManagement.getInstance().WriteException(exp, "FindPass", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true); } } }
protected void Button5_Click(object sender, EventArgs e) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(txtName.Text.Trim()); if (m_user.SysNo == AppConst.IntNull) { Page.ClientScript.RegisterStartupScript(this.GetType(), "SendMsg", "alert('找不到该用户,请重新输入!');", true); ModalPopupExtender1.Show(); } else { Response.Redirect("MsgDetail.aspx?UserSysNo=" + m_user.SysNo); } }
private void IsLogin() { PageBase m_base = new PageBase(); if (m_base.GetSession().CustomerEntity != null && m_base.GetSession().CustomerEntity.SysNo != AppConst.IntNull) { ltrLinks.Text = "<a href='/Passport/Login.aspx?type=logout' title='注销'>退出</a> | <a href='/Qin/View/" + m_base.GetSession().CustomerEntity.SysNo + "' title='我的首页'>我的首页</a>"; ltrTips.Text = m_base.GetSession().CustomerEntity.NickName + ",欢迎回到上上签"; int sms = USR_CustomerBll.GetInstance().GetUnReadInfoNum(m_base.GetSession().CustomerEntity.SysNo); if (sms > 0) { ltrLinks.Text += @"<div class=""msg_tip_box""><a href=""/Qin/MyNotice.aspx"">您有" + sms + "条新消息</a></div>"; } } }
protected void Delete() { try { USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(base.Request.QueryString["delete"])); m_customer.Status = 3; USR_CustomerBll.GetInstance().Update(m_customer); this.ltrNotice.Text = "该记录已冻结!"; base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { this.ltrError.Text = "系统错误,冻结失败!"; base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true); } }
public ReturnValue <QA_QuestionShow <ZiWeiMod> > GetQuestionForZiWei(int sysno) { QA_QuestionMod tmp = QA_QuestionBll.GetInstance().GetModel(sysno); QA_QuestionShow <ZiWeiMod> ret = new QA_QuestionShow <ZiWeiMod>(); tmp.MemberwiseCopy(ret); USR_CustomerShow tmpu = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu); ret.Customer = tmpu; #region 设置命盘 int[] _paras = { 1, 1, 0, 1 }; FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo); if (m_chart != null) { ZiWeiMod m_ziwei = new ZiWeiMod(); #region 设置实体各种参数 //默认做太阳时修正 string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); m_ziwei.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName))); m_ziwei.Gender = (AppEnum.Gender) int.Parse(m_chart.FirstGender.ToString()); m_ziwei.RunYue = PublicValue.ZiWeiRunYue.dangxia; m_ziwei.TransitTime = new DateEntity(DateTime.Now); #endregion m_ziwei = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras); ret.Chart.Add(m_ziwei); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { ZiWeiMod m_ziwei1 = new ZiWeiMod(); #region 设置实体各种参数 tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); m_ziwei1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName))); m_ziwei1.Gender = (AppEnum.Gender) int.Parse(m_chart.SecondGender.ToString()); m_ziwei1.RunYue = PublicValue.ZiWeiRunYue.dangxia; m_ziwei1.TransitTime = new DateEntity(DateTime.Now); #endregion m_ziwei1 = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras); ret.Chart.Add(m_ziwei1); } } #endregion return(ReturnValue <QA_QuestionShow <ZiWeiMod> > .Get200OK(ret)); }
private bool ValidateNickName() { if (CommonTools.HasForbiddenWords(name.Text.Trim())) { Page.ClientScript.RegisterStartupScript(this.GetType(), "namewrong", "document.getElementById('ctl00_ContentPlaceHolder1_nameTip').innerHTML = '您的昵称中有违禁字符,请重新输入!';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').style['display']='block';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').className='onError';", true); return(false); } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(name.Text.Trim()); if (m_user.SysNo != AppConst.IntNull) { Page.ClientScript.RegisterStartupScript(this.GetType(), "namewrong", "document.getElementById('ctl00_ContentPlaceHolder1_nameTip').innerHTML = '该昵称已被占用,请尝试使用其他昵称!';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').style['display']='block';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').className='onError';", true); return(false); } return(true); }
protected void Button7_Click(object sender, EventArgs e) { #region 判定登录信息 USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(TextBox1.Text.Trim(), TextBox2.Text.Trim()); if (m_user.SysNo != AppConst.IntNull) { PageBase m_base = new PageBase(); m_base.SetSession(m_user); Response.Redirect(Request.Url.ToString()); } else { Literal1.Text = "账号或密码错误,请重新输入!"; ModalPopupExtender2.Show(); } #endregion }
public ReturnValue <USR_CustomerShow> AddComment(int AnswerSysNo, int CustomerSysNo, int QuestionSysNo, string Context) { QA_CommentMod m_comment = new QA_CommentMod(); m_comment.AnswerSysNo = AnswerSysNo; m_comment.Context = AppCmn.CommonTools.SystemInputFilter(Context.DoTrim()); m_comment.DR = (int)AppEnum.State.normal; m_comment.QuestionSysNo = QuestionSysNo; m_comment.TS = DateTime.Now; m_comment.CustomerSysNo = CustomerSysNo; QA_CommentBll.GetInstance().AddComment(m_comment); USR_CustomerShow ret = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(CustomerSysNo).MemberwiseCopy(ret); return(ReturnValue <USR_CustomerShow> .Get200OK(ret)); }
public ReturnValue <bool> CheckNickName(string nickname) { if (string.IsNullOrEmpty(nickname)) { throw new BusinessException("昵称不能为空"); } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(nickname); if (m_user.SysNo != -999999) { return(ReturnValue <bool> .Get200OK(true)); } else { return(ReturnValue <bool> .Get200OK(false)); } }
protected void Page_Load(object sender, EventArgs e) { Login(Request.Url.ToString()); WebForMain.Master.Qin m_master = (WebForMain.Master.Qin)Master; m_master.SetTab(4); if (Request.QueryString["id"] != null) { try { SysNo = int.Parse(Request.QueryString["id"]); } catch { ShowError(""); } } else if (Request.QueryString["UserSysNo"] != null) { try { TargetID = int.Parse(Request.QueryString["UserSysNo"]); TargetName = USR_CustomerBll.GetInstance().GetModel(TargetID).NickName; } catch { ShowError(""); } } else { ShowError(""); } if (!IsPostBack) { if (SysNo != 0) { BindList(); } imgPhoto.ImageUrl = "~/ControlLibrary/ShowPhoto.aspx?type=t&id=" + GetSession().CustomerEntity.Photo; RightPannel1.m_user = GetSession().CustomerEntity; } }
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); } }
public ReturnValue <bool> CheckPhone(string phone) { if (string.IsNullOrEmpty(phone)) { throw new BusinessException("手机号不能为空"); } USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckPhone(phone); if (m_user.SysNo != -999999) { throw new BusinessException("该手机号已注册"); } else { //生成6位随机验证码 string[] arr = ("1,2,3,4,5,6,7,8,9,0").Split(','); string Password = ""; int randValue = -1; Random rand = new Random(unchecked ((int)DateTime.Now.Ticks)); for (int i = 0; i < 6; i++) { randValue = rand.Next(0, arr.Length - 1); Password += arr[randValue]; } #region 发送短信 //Password = "******"; //测试验证码为111111 SYS_SMSMod m_sms = new SYS_SMSMod(); m_sms.Content = AppConst.RegisterPhoneCode.Replace("@code", Password); m_sms.PhoneNum = phone; m_sms.Status = (int)AppEnum.SMSStatus.sending; m_sms.TS = DateTime.Now; m_sms.Type = (int)AppEnum.SMSType.Register; m_sms.SysNo = SYS_SMSBll.GetInstance().Add(m_sms); SYS_SMSBll.GetInstance().SendSMS(m_sms); XMS.Core.Container.CacheService.LocalCache.SetItem(AppConst.APIRegionName, "SMSVerifyCode" + phone, Password, 1000); return(ReturnValue <bool> .Get200OK(true)); #endregion } }
public void LoginCheck(string username, string password) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password); if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功 { SetSession(m_user); //记住我 if (CheckBox1.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 + "|UserID:" + GetSession().CustomerEntity.Email); //跳转 if (Request.QueryString["url"] != null && Request.QueryString["url"] != "") { Response.Redirect(Request.QueryString["url"]); } else { Response.Redirect("../Qin/View/" + m_user.SysNo); } } else { password1Tip.InnerHtml = AppEnum.GetErrorType(2); } }
public ReturnValue <USR_CustomerShow> GetUserInfo(int uid) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(uid); if (m_user.SysNo != -999999) { USR_CustomerShow ret = new USR_CustomerShow(); m_user.MemberwiseCopy(ret); DataTable m_dt = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(uid, 0); ret.TotalMedal = m_dt.Rows.Count; int total = 0; DataTable m_dt1 = USR_MessageBll.GetInstance().GetMessageByCustomer(uid, 1, 1, 0, 1, ref total); ret.NewMessage = total; return(ReturnValue <USR_CustomerShow> .Get200OK(ret)); } else { throw new BusinessException("用户ID错误,请重新输入!"); } }
protected void Button2_Click(object sender, EventArgs e) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(this.TextBox3.Text.Trim(), this.TextBox4.Text.Trim()); if (m_user.SysNo != -999999) { base.SetSession(m_user); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "addcomment", "alert('账号或密码错误,请重新输入!');", true); return; } this.TextBox1.Text = this.TextBox2.Text; this.Button1_Click(sender, e); this.BindFamous(); this.BindChart(); this.TextBox2.Text = ""; ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "refresh", "location.reload();", true); }
protected void Page_Load(object sender, EventArgs e) { Login(Request.Url.ToString()); if (Request.QueryString["tab"] != null) { try { tab = int.Parse(Request.QueryString["tab"]); } catch { } } if (Request.QueryString["id"] != null) { try { m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); if (m_user.SysNo == AppConst.IntNull) { ShowError(""); } if (m_user.SysNo != GetSession().CustomerEntity.SysNo) { ShowError(""); } if (!IsPostBack) { FormPrepare(); } } catch { ShowError(""); } } else { ShowError(""); } MultiView1.ActiveViewIndex = tab; }
public ReturnValue <USR_CustomerShow> AddAnswer(int CustomerSysNo, int QuestionSysNo, string Title, string Context) { QA_AnswerMod m_answer = new QA_AnswerMod(); m_answer.Award = 0; m_answer.Title = Title; m_answer.Context = AppCmn.CommonTools.SystemInputFilter(Context.DoTrim()); m_answer.CustomerSysNo = CustomerSysNo; m_answer.DR = (int)AppEnum.State.normal; m_answer.Hate = 0; m_answer.Love = 0; m_answer.QuestionSysNo = QuestionSysNo; m_answer.Title = ""; m_answer.TS = DateTime.Now; QA_AnswerBll.GetInstance().AddAnswer(m_answer); USR_CustomerShow ret = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(CustomerSysNo).MemberwiseCopy(ret); return(ReturnValue <USR_CustomerShow> .Get200OK(ret)); }
public ReturnValue <QA_QuestionShow <BaZiMod> > GetQuestionForBaZi(int sysno) { QA_QuestionMod tmp = QA_QuestionBll.GetInstance().GetModel(sysno); QA_QuestionShow <BaZiMod> ret = new QA_QuestionShow <BaZiMod>(); tmp.MemberwiseCopy(ret); USR_CustomerShow tmpu = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu); ret.Customer = tmpu; #region 设置命盘 FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo); if (m_chart != null) { BaZiMod m_bazi = new BaZiMod(); string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName))); m_bazi.AreaName = m_chart.FirstPoiName.ToString(); m_bazi.Longitude = tmplatlng[0]; m_bazi.Gender = (AppEnum.Gender)m_chart.FirstGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi); ret.Chart.Add(m_bazi); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { BaZiMod m_bazi1 = new BaZiMod(); tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName))); m_bazi1.AreaName = m_chart.SecondPoiName.ToString(); m_bazi1.Longitude = tmplatlng[0]; m_bazi1.Gender = (AppEnum.Gender)m_chart.SecondGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1); ret.Chart.Add(m_bazi1); } } #endregion return(ReturnValue <QA_QuestionShow <BaZiMod> > .Get200OK(ret)); }