protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "系统报错,页面:" + CommonMethod.FinalString(Request["aspxerrorpath"]), "系统报错,页面:" + CommonMethod.FinalString(Request["aspxerrorpath"])); } }
private void CheckeNotes() { Transaction t = new Transaction(); DataTable dt = Query.ProcessSql(@"SELECT Id,Content,ReplyContent FROM XiHuan_GuestBook WITH(nolock) WHERE IsChecked=0 ", GlobalVar.DataBase_Name); string content = string.Empty; string replycontent = string.Empty; int nid = 0; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { nid = CommonMethod.ConvertToInt(dr["Id"], 0); content = CommonMethod.FinalString(dr["Content"]); replycontent = CommonMethod.FinalString(dr["ReplyContent"]); if (CommonMethodFacade.ValidFFZF(content).Length == 0 && CommonMethodFacade.ValidFFZF(replycontent).Length == 0) { XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity(); notesinfo.Id = nid; notesinfo.Retrieve(); if (notesinfo.IsPersistent) { notesinfo.IsChecked = 1; t.AddSaveObject(notesinfo); XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity(); notechecknoticemessage.FromId = 1; notechecknoticemessage.FromName = "喜换网"; notechecknoticemessage.ToId = notesinfo.FromId; notechecknoticemessage.ToName = notesinfo.FromName; notechecknoticemessage.Content = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!", notesinfo.FromName, notesinfo.ToName, notesinfo.Content); notechecknoticemessage.Flag = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d")); notechecknoticemessage.CreateDate = DateTime.Now; t.AddSaveObject(notechecknoticemessage); if (t.Process()) { #region 如果是对换品页面的留言,重新生成换品页 if (CommonMethod.ConvertToInt(nid, 0) > 0) { RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity)); rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL); Condition cgoods = rcgoods.GetNewCondition(); cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, notesinfo.GoodsId); cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1); XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity; if (goods != null) { CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + notesinfo.GoodsId, "../" + goods.DetailUrl); } } #endregion } } } } } }
private void CheckUserName(string username) { username = Microsoft.JScript.GlobalObject.unescape(username); string ffzf = CommonMethodFacade.ValidFFZF(username); if (ffzf.Length > 0) { CommonMethod.ResponseAjaxContent(this, "您输入的用户名含有非法字符:" + ffzf); } if (XiHuan_UserFacade.IsUserNameAlreayUse(username)) { CommonMethod.ResponseAjaxContent(this, "0"); } else { CommonMethod.ResponseAjaxContent(this, "1"); } }
public void Execute(JobExecutionContext context) { SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), " 进行了自动触发程序执行操作!", "进行了自动触发程序执行操作"); HttpWebRequest wr = WebRequest.Create(CommonMethodFacade.GetConfigValue("GenerateUrl")) as HttpWebRequest; wr.Timeout = 30 * 1000 * 60; //超时时间30分钟 wr.ReadWriteTimeout = 30 * 1000 * 60; //超时时间30分钟 WebResponse ws = wr.GetResponse(); string response = string.Empty; using (System.IO.StreamReader reader = new System.IO.StreamReader( ws.GetResponseStream() , System.Text.Encoding.GetEncoding("GBK"))) { response = reader.ReadToEnd(); if (response.Equals("1") && CommonMethodFacade.GetConfigValue("SendSysTriggerEmail").Equals("true")) { SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "网站半小时自动执行程序触发", " 执行成功,进行了更新明星换客和换品浏览次数,更新幻灯操作,留言自动审核,更新首页操作!"); } } }
protected void btn_submitinfo_ServerClick(object sender, EventArgs e) { #region 务器端验证 #endregion #region 信息保存 Transaction t = new Transaction(); int uid = CurrentUserId; if (uid > 0) { XiHuan_UserInfoEntity updateRegInfo = XiHuan_UserInfoEntityAction.RetrieveAXiHuan_UserInfoEntity(uid); if (updateRegInfo != null) { string savepath = string.Empty; string filepath = string.Empty; string filename = string.Empty; if (headImage.HasFile) { if (headImage.PostedFile.ContentLength < 50 * 1024) { string hz = System.IO.Path.GetExtension(headImage.PostedFile.FileName); if (CommonMethod.IsUploadImageValid("", hz)) { filepath = "images/userupload/headimage/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/"; filename = DateTime.Now.ToString("yyyymmddhhmmssfff") + "_" + uid + hz; if (!Directory.Exists(Server.MapPath(filepath))) { Directory.CreateDirectory(Server.MapPath(filepath)); } savepath = Server.MapPath(filepath + filename); headImage.PostedFile.SaveAs(savepath); } else { Alert("头像格式不符合要求,请重新选择头像!"); return; } } else { Alert("头像大小超出50k,请换个小点的图片吧!"); return; } } if (savepath.Length > 0) { if (updateRegInfo.HeadImage.Length > 0 && System.IO.File.Exists(Server.MapPath(updateRegInfo.HeadImage))) { if (!updateRegInfo.HeadImage.Equals("images/nophoto.gif")) { System.IO.File.Delete(Server.MapPath(updateRegInfo.HeadImage)); } } updateRegInfo.HeadImage = filepath + filename; } updateRegInfo.Email = txtEmail.Text.Trim(); updateRegInfo.Gender = byte.Parse(rbtSex.SelectedValue.Trim()); updateRegInfo.ProvinceId = CommonMethod.ConvertToInt(ddlProvince.SelectedValue, 0); updateRegInfo.ProvinceName = ddlProvince.SelectedItem.Text.Trim(); updateRegInfo.CityId = CommonMethod.ConvertToInt(Request["ddlCity"], 0); updateRegInfo.CityName = CommonMethodFacade.GetCityNameById(updateRegInfo.CityId.ToString()); updateRegInfo.AreaId = CommonMethod.ConvertToInt(Request["ddlArea"], 0); if (updateRegInfo.AreaId > 0) { updateRegInfo.AreaName = CommonMethodFacade.GetAreaNameById(updateRegInfo.AreaId.ToString()); } int schoolid = CommonMethod.ConvertToInt(Request["ddlSchool"], 0); updateRegInfo.SchoolId = schoolid; if (schoolid > 0) { updateRegInfo.SchoolName = CommonMethodFacade.GetSchoolNameById(ddlProvince.SelectedValue, Request["ddlCity"], schoolid.ToString()); } else { updateRegInfo.SchoolName = ""; } updateRegInfo.Question = txtQuestion.Text.Trim(); updateRegInfo.Answer = txtAnswer.Text.Trim(); updateRegInfo.TelePhone = txtTel.Value.Trim(); updateRegInfo.WangWang = txtWangWang.Value.Trim(); updateRegInfo.QQ = txt_qq.Value.Trim(); updateRegInfo.Msn = txt_msn.Value.Trim(); updateRegInfo.OtherLink = txtOtherLink.Text.Trim(); updateRegInfo.SignNote = CommonMethod.ClearInputText(txtSingnNote.Text, 200); t.DoSaveObject(updateRegInfo); //更新换品浏览人信息里的头像地址 t.DoSqlNonQueryString("update XiHuan_GoodsViewUser set VisitorHeadImage='" + updateRegInfo.HeadImage + "' where VisitorId=" + CurrentUserId, GlobalVar.DataBase_Name); try { t.Commit(); headPic.ImageUrl = filepath + filename; LoadUserInfo(); Alert("恭喜:您的注册信息已成功更改!"); DataTable dt = Query.ProcessSql("select Id,DetailUrl from XiHuan_UserGoods with(nolock) where OwnerId= " + CurrentUserId + " and IsChecked=1 ", GlobalVar.DataBase_Name); foreach (DataRow dr in dt.Rows) { CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + dr["Id"], dr["DetailUrl"].ToString()); } } catch (Exception ex) { Alert("抱歉:修改信息时出错," + ex.Message + "请稍后重试!"); return; } } } else { Alert("登陆超时,请重新登陆再继续当前的操作!"); return; } #endregion }
protected void lnkSubmit_Click(object sender, EventArgs e) { #region 务器端验证 int provinceid = CommonMethod.ConvertToInt(ddlProvince.SelectedValue, 0); int cityid = CommonMethod.ConvertToInt(ddlCity.SelectedValue, 0); int areaid = CommonMethod.ConvertToInt(ddlArea.SelectedValue, 0); int schoolid = CommonMethod.ConvertToInt(ddlSchool.SelectedValue, 0); if (txtUserName.Text.Trim().Length == 0) { Alert(" 请您填写换客名!"); Select(txtUserName); return; } else if (XiHuan_UserFacade.IsUserNameAlreayUse(txtUserName.Text)) { Alert("您填写的换客名已经被占用,请您换个换客名重试!"); Select(txtUserName); return; } if (txtPassWord.Text.Trim().Length == 0) { Alert("请您填写密码!"); Select(txtPassWord); return; } if (txtPassWord2.Text.Trim().Length == 0) { Alert("请您再次输入密码!"); Select(txtPassWord2); return; } if (!txtPassWord.Text.Trim().Equals(txtPassWord2.Text.Trim())) { Alert("两次密码输入不一致,请重新输入!"); Select(txtPassWord2); return; } if (txtEmail.Text.Trim().Length > 0) { Regex reg = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"); if (!reg.IsMatch(txtEmail.Text.Trim())) { Alert("您的邮箱格式填写不正确!"); Select(txtEmail); return; } } if (provinceid == 0) { Alert("请您选择省份!"); return; } if (cityid == 0) { Alert("请您选择城市!"); return; } if (txtQuestion.Text.Trim().Length == 0) { Alert("请您填写安全提问问题!"); Select(txtQuestion); return; } if (txtAnswer.Text.Trim().Length == 0) { Alert("请您填写安全提问答案!"); Select(txtAnswer); return; } #endregion #region 用户基本信息 Transaction t = new Transaction(); XiHuan_UserInfoEntity NewUser = new XiHuan_UserInfoEntity(); NewUser.UserType = (int)XiHuan_UserFacade.UserType.个人注册; NewUser.UserName = txtUserName.Text.Trim(); NewUser.OrignalPwd = txtPassWord.Text.Trim(); NewUser.Md5Pwd = CommonMethod.MD5Encrypt(txtPassWord.Text.Trim()); NewUser.Email = txtEmail.Text.Trim(); NewUser.Gender = Rad_sex_0.Checked ? (byte)1 : (byte)0; NewUser.ProvinceId = provinceid; NewUser.ProvinceName = ddlProvince.SelectedItem.Text; NewUser.CityId = cityid; if (cityid > 0) { NewUser.CityName = CommonMethodFacade.GetCityNameById(cityid.ToString()); } NewUser.AreaId = areaid; if (areaid > 0) { NewUser.AreaName = CommonMethodFacade.GetAreaNameById(areaid.ToString()); } if (schoolid > 0) { NewUser.SchoolId = schoolid; NewUser.SchoolName = CommonMethodFacade.GetSchoolNameById(provinceid.ToString(), cityid.ToString(), schoolid.ToString()); } NewUser.HuanBi = SystemConfigFacade.Instance().RegisterAddHuanBi(); NewUser.Score = SystemConfigFacade.Instance().RegisterAddScore(); NewUser.RegisterDate = NewUser.LastLoginTime = DateTime.Now; NewUser.Question = txtQuestion.Text.Trim(); NewUser.Answer = txtAnswer.Text.Trim(); NewUser.HeadImage = "images/nophoto.gif"; t.DoSaveObject(NewUser); #endregion #region 推荐人积分换币更新 if (txtTuiJianMember.Text.Trim().Length > 0) { string updateTJ = string.Format("update XiHuan_UserInfo set Score=Score+{0},HuanBi=HuanBi+{1} where UserName='******' ", SystemConfigFacade.Instance().TuiJianAddScore(), SystemConfigFacade.Instance().TuiJianAddHuanBi(), txtTuiJianMember.Text.Trim()); t.DoSqlNonQueryString(updateTJ, GlobalVar.DataBase_Name); } #endregion #region 给新注册用户发送短消息 XiHuan_MessageFacade.SendNewMessage(1, NewUser.ID, "喜换网", NewUser.UserName, "尊敬的会员" + NewUser.UserName + "," + SystemConfigFacade.Instance().RegMesContent(), t, true); #endregion try { t.Commit(); #region 注册完成后自动登陆调转到个人管理中心 Alert("恭喜:您的注册信息已成功提交!"); CommonMethod.AddLoginCookie(NewUser.ID, NewUser.UserName, DateTime.MinValue); SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "有人在喜换网注册了", "有人在喜换网注册了:" + txtUserName.Text); Response.Redirect("membercenter.aspx?action=" + Server.UrlEncode("membermanageindex.aspx")); #endregion } catch (Exception ex) { t.RollBack(); Alert("抱歉:注册信息提交失败," + ex.Message + "请重试!"); return; } }
private void InitPage() { if (GoodDetail == null) { return; } #region 界面显示 RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity)); Condition c = rc.GetNewCondition(); c.AddEqualTo(XiHuan_UserInfoEntity.__ID, GoodDetail.OwnerId); rc.AddSelect(XiHuan_UserInfoEntity.__GENDER); rc.AddSelect(XiHuan_UserInfoEntity.__SCORE); rc.AddSelect(XiHuan_UserInfoEntity.__HUANBI); rc.AddSelect(XiHuan_UserInfoEntity.__GOODFEED); rc.AddSelect(XiHuan_UserInfoEntity.__XINYU); rc.AddSelect(XiHuan_UserInfoEntity.__REGISTERDATE); rc.AddSelect(XiHuan_UserInfoEntity.__LASTLOGINTIME); rc.AddSelect(XiHuan_UserInfoEntity._TelePhone); rc.AddSelect(XiHuan_UserInfoEntity._WangWang); rc.AddSelect(XiHuan_UserInfoEntity.__EMAIL); rc.AddSelect(XiHuan_UserInfoEntity.__QQ); rc.AddSelect(XiHuan_UserInfoEntity.__MSN); rc.AddSelect(XiHuan_UserInfoEntity.__OTHERLINK); XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity; lblScore.Text = user.Score.ToString(); lblHB.Text = user.HuanBi.ToString(); lblGoodFeed.Text = user.GoodFeed.ToString(); lblXY.Text = user.XinYu.ToString(); lblRegisterDate.Text = user.RegisterDate.ToString("yyyy-MM-dd"); lblLastLoginTime.Text = user.LastLoginTime.ToString("yyyy-MM-dd"); lblWW.Text = CommonMethod.FinalString(user.WangWang).Length > 0 ? " " + string.Format(GlobalVar.BIGSTRWW, Server.UrlEncode(user.WangWang)) : string.Empty; lblQQ.Text = CommonMethod.FinalString(user.QQ).Length > 0 ? string.Format(GlobalVar.QQSTR, user.QQ) : string.Empty; linkMethod.Text = string.Format(" 电话:{0} 邮箱:{1} 旺旺:{5} QQ:{2} MSN:{3}<br/> 其他联系方式:{4}", user.TelePhone, user.Email, user.QQ + lblQQ.Text, user.Msn, user.OtherLink, lblWW.Text); lblGender.Text = CommonMethodFacade.FormatGender(user.Gender, SrcRootPath); #endregion #region 换主热门换品 RetrieveCriteria rchotgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity)); Condition hotgoodscondition = rchotgoods.GetNewCondition(); hotgoodscondition.AddEqualTo(XiHuan_UserGoodsEntity.__OWNERID, GoodDetail.OwnerId); hotgoodscondition.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1); rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO); rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__NAME); rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL); rchotgoods.Top = 10; rchotgoods.OrderBy(XiHuan_UserGoodsEntity.__VIEWCOUNT, false); rptHotGoods.DataSource = rchotgoods.AsDataTable(); rptHotGoods.DataBind(); #endregion #region 其它相关换品 DataTable dtrelateGoods = Query.ProcessSql( @"select top 10 DefaultPhoto,Name,DetailUrl from XiHuan_UserGoods with(nolock) where TypeId=" + GoodDetail.TypeId + " and OwnerId<>" + GoodDetail.OwnerId + " and IsChecked=1 order by newid() ", GlobalVar.DataBase_Name); rtpRelateGoods.DataSource = dtrelateGoods; rtpRelateGoods.DataBind(); #endregion #region 留言 BindNotes(); #endregion #region 交换请求 BindRequire(); #endregion #region 一换品下一换品链接 string sqlpre = "select top 1 Name,DetailUrl from XiHuan_UserGoods with(nolock) where Id<" + Request["id"] + " and IsChecked=1 order by Id desc;"; string sqlnext = "select top 1 Name,DetailUrl from XiHuan_UserGoods with(nolock) where Id>" + Request["id"] + " and IsChecked=1 order by Id asc;"; DataSet dt = Query.ProcessMultiSql(sqlpre + sqlnext, GlobalVar.DataBase_Name); lblPre.Text = dt.Tables[0].Rows.Count > 0 ? string.Format("<a href=\"{0}\" title=\"{1}\">{2}</a>", SrcRootPath + (dt.Tables[0].Rows[0][1]), dt.Tables[0].Rows[0][0], CommonMethod.GetSubString(CommonMethod.FinalString(dt.Tables[0].Rows[0][0]), 20, "")) : "没有了"; lblNext.Text = dt.Tables[1].Rows.Count > 0 ? string.Format("<a href=\"{0}\" title=\"{1}\">{2}</a>", SrcRootPath + (dt.Tables[1].Rows[0][1]), dt.Tables[1].Rows[0][0], CommonMethod.GetSubString(CommonMethod.FinalString(dt.Tables[1].Rows[0][0]), 20, "")) : "没有了"; #endregion #region 换品图片加载 if (GoodDetail.DefaultPhoto != null && GoodDetail.DefaultPhoto.Trim().Length > 0 && !GoodDetail.DefaultPhoto.Trim().Equals("images/none.jpg")) { RetrieveCriteria rcgoodimage = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity)); Condition cg = rcgoodimage.GetNewCondition(); cg.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, GoodDetail.Id); cg.AddEqualTo(XiHuan_GoodsImageEntity.__ISDEFAULTPHOTO, 0); rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGSRC); rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGDESC); rcgoodimage.OrderBy(XiHuan_GoodsImageEntity.__CREATEDATE, false); rptGoodsImage.DataSource = rcgoodimage.AsDataTable(); rptGoodsImage.DataBind(); } #endregion }
private void AddNotes() { #region 验证 string username = CommonMethod.FinalString(Request["username"]); string userpass = CommonMethod.FinalString(Request["pwd"]); if (!IsUserAlreadyLogin) { if (username.Length == 0) { CommonMethod.ResponseAjaxContent(this.Page, "needusername"); return; } if (userpass.Length == 0) { CommonMethod.ResponseAjaxContent(this.Page, "needpwd"); return; } } #endregion #region 留言提交 XiHuan_GuestBookEntity newguest = new XiHuan_GuestBookEntity(); newguest.ToId = CommonMethod.ConvertToInt(Request["oid"], 0); newguest.ToName = GlobalObject.unescape(CommonMethod.FinalString(Request["oname"])); newguest.GoodsId = CommonMethod.ConvertToInt(Request["gid"], 0);; newguest.GoodsName = GlobalObject.unescape(CommonMethod.FinalString(Request["gname"])); if (IsUserAlreadyLogin) { newguest.FromId = CurrentUserId; newguest.FromName = CurrentUserName; } else { if (XiHuan_UserFacade.IsUserValid(username, userpass)) { CommonMethod.AddLoginCookie(XiHuan_UserFacade.GetIdByName(username), username, DateTime.MinValue); newguest.FromName = username; newguest.FromId = XiHuan_UserFacade.GetIdByName(username); } else { CommonMethod.ResponseAjaxContent(this.Page, "notvaliduser"); return; } } newguest.Content = GlobalObject.unescape(CommonMethod.FinalString(Request["content"])); newguest.IsScerect = CommonMethod.FinalString(Request["issceret"]) == "true" ? (byte)1 : (byte)0; newguest.CreateDate = DateTime.Now; newguest.IsChecked = 0; newguest.Save(); SendMailFacade.sendEmail(CommonMethodFacade.GetConfigValue("NoticeEmail"), "有人在喜换网留言了", "有人在喜换网留言了,快去审核吧!"); if (CommonMethod.FinalString(Request["type"]).Equals("1")) { CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + newguest.GoodsId, CommonMethod.FinalString(Request["url"])); } CommonMethod.ResponseAjaxContent(this.Page, "ok"); #endregion }