public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; Core.Business.AccountExtend ae = new CY.UME.Core.Business.AccountExtend(); String tempId = context.Request.Params["Id"].ToString(); long Id = CY.Utility.Common.ConvertUtility.ConvertToLong(tempId, -1); String Type = context.Request.Params["Type"].ToString(); String Title = "Ume校园社区想您了"; StringBuilder Body = new StringBuilder(); if (Id != -1) { Core.Business.Account account = Core.Business.Account.Load(Id); if (account == null) { context.Response.Write("{ success:false,msg:'用户不存在' }"); return; } ae = account.ExtendInfo; DateTime DateCreated = CY.UME.Core.Business.AccountOperation.GetOperationDateCreatedByAccountIdAndType(Id, Type); TimeSpan IntervalDay = new TimeSpan(DateTime.Now.Ticks - DateCreated.Ticks); Body.Append("亲爱的" + account.Name + ",您已经有" + IntervalDay.Days + "天没有登录Ume了,我们的网址是:http://www.iume.mobi <br/>"); Body.Append("您的用户名就是您的邮箱:" + ae.Email); try { Core.Business.SystemSetting siteUrlSetting = Core.Business.SystemSetting.Load("SiteUrl"); if (siteUrlSetting == null || string.IsNullOrEmpty(siteUrlSetting.Value)) { throw new SystemException("服务器忙,请稍后再试"); } if (Send(ae.Email, Title, Body.ToString())) { context.Response.Write("{ success:true,msg:'发送成功' }"); } else { context.Response.Write("{ success:false,msg:'发送失败' }"); } } catch (Exception ex) { context.Response.Write("{ success:false,msg:'发送没能完全成功:" + ex.Message + "' }"); } } else { context.Response.Write("{ success:false,msg:'用户不存在' }"); } }
protected void Page_Load(object sender, EventArgs e) { SetTitle("学校信息"); accountExtend = base.CurrentAccount.ExtendInfo; grade = CY.UME.Core.Business.Grade.Load(accountExtend.GradeId); university = CY.UME.Core.Business.University.Load(accountExtend.UniversityId); if (Request.QueryString["back"] != null) { back = Request.QueryString["back"]; } if (!Page.IsPostBack) { //if (university == null || grade == null) //{ // ShowAlert("错误", "您的学校信息有误,请重新填写!"); // //return; //} Bind(); //if (selUniversity.Items.Count > 0 && university != null) //{ // selUniversity.Value = university.Id.ToString(); // HFCollege.Value = university.Id.ToString(); //} if (ddlGrade.Items.Count > 0 && grade != null) { ddlGrade.SelectedValue = grade.Id.ToString(); HFCollege.Value = grade.Id.ToString(); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; Core.Business.AccountExtend ae = new CY.UME.Core.Business.AccountExtend(); String tempId = context.Request.Params["Id"].ToString(); long Id = CY.Utility.Common.ConvertUtility.ConvertToLong(tempId, -1); String Title = context.Request.Params["Title"].ToString(); String Body = context.Request.Params["Body"].ToString(); if (Id != -1) { Core.Business.Account account = Core.Business.Account.Load(Id); if (account == null) { context.Response.Write("{ success:false,msg:'用户不存在' }"); return; } try { Core.Business.SystemSetting siteUrlSetting = Core.Business.SystemSetting.Load("SiteUrl"); if (siteUrlSetting == null || string.IsNullOrEmpty(siteUrlSetting.Value)) { throw new SystemException("服务器忙,请稍后再试"); } ae = account.ExtendInfo; #region BackCode #region 读取发送邮件的信息 /*Core.Business.SystemSetting mailServerAddressSetting = Core.Business.SystemSetting.Load("MailServerAddress");// 邮件服务器地址 Core.Business.SystemSetting mailServerPortSetting = Core.Business.SystemSetting.Load("MailserverPort");// 邮件服务器端口 Core.Business.SystemSetting mailFromSetting = Core.Business.SystemSetting.Load("MailFrom");// 发送邮件 Core.Business.SystemSetting mailLoginNameSetting = Core.Business.SystemSetting.Load("MailAccountLoginName");// 发送邮件名称 Core.Business.SystemSetting mailLoginPwdSetting = Core.Business.SystemSetting.Load("MailAccountLoginPwd");// Core.Business.SystemSetting mailEnableSSL = Core.Business.SystemSetting.Load("MailEnableSSL");//开启? if (mailServerAddressSetting == null || mailServerPortSetting == null || mailFromSetting == null || mailLoginNameSetting == null || mailLoginPwdSetting == null || mailEnableSSL == null || string.IsNullOrEmpty(mailServerAddressSetting.Value) || string.IsNullOrEmpty(mailServerPortSetting.Value) || string.IsNullOrEmpty(mailFromSetting.Value) || string.IsNullOrEmpty(mailLoginNameSetting.Value) || string.IsNullOrEmpty(mailLoginPwdSetting.Value)) { ; } SMTPServer = mailServerAddressSetting.Value; SMTPAuthUsername = mailLoginNameSetting.Value; SMTPAuthPassword = mailLoginPwdSetting.Value;*/ #endregion /* String SiteUrl = siteUrlSetting.Value; StringBuilder sbBody = new StringBuilder(); //sbBody.Append("邀请您加入UME,点击如下链接接受邀请!<a target='_blank' href='"); sbBody.Append("<body style=\"font-size: 12px; margin: 0; padding: 0; text-align: center; background: #ffffff; color: #ffffff; font: '微软雅黑'\"><div style='width: 588px; margin: auto'><div style='width: 588px;'><div align='left'>"); sbBody.Append("<a href='" + SiteUrl + "/Login.aspx' style='color: #67a4d4; text-decoration: none'>"); sbBody.Append("<img src='" + SiteUrl + "/E-Mail/image/mail_logo.jpg' style='border: 0' /></a><span><a style='color: #67a4d4;"); sbBody.Append("text-decoration: none' href='" + SiteUrl + "/Home.aspx?uid=" + account.Id + "'><img style='margin-left: 320px;"); sbBody.Append("border: 0' src='" + SiteUrl + "/E-Mail/image/mail_top0.jpg' /></a></span></div><div style='padding: 20px; color: #999999'><div align='left'>"); sbBody.Append("Hi! <a href='" + SiteUrl + "/Home.aspx?uid=" + account.Id + "'>" + account.Name + "</a><br />朋友们给你留了新消息!"); sbBody.Append("<a href='" + SiteUrl + "/Index' style='color: #67a4d4; text-decoration: none'>查看好友消息</a><br/>Ume秒杀将于1月9日下午3点闪亮登场了!你只需要花费一定数目的积分就能够赢取PSP大奖!<br/>赶快来看看吧: http://www.iume.mobi/InstantlyKilling/SpikeIndex.aspx"); sbBody.Append("</div></div><div style='width: 583px; height: 20px; line-height: 20px; background: url(" + SiteUrl + "/E-Mail/image/mail_top1.jpg);"); sbBody.Append("text-align: left; padding-left: 5px;'>最新推荐</div><div style='width: 588px; height: 102px; margin-top: 5px;'><ul style='list-style-type: none; margin: 0; padding: 0'><li style='list-style-type: none; margin: 0; padding: 0;color:#999999;float:left;margin-left:5px;margin-top:5px;text-align:left;'>"); sbBody.Append("<img style='border: 0' src='" + SiteUrl + "/E-Mail/image/mail_pci0.jpg' /></li><li style='width: 460px; list-style-type: none; margin: 0; padding: 0;list-style-type: none; margin: 0; padding: 0;color:#999999;float:left;margin-left:5px;margin-top:5px;text-align:left;'>Ume倾情奉献秒杀大奖!大奖免费等你拿!你只需花费5个积分就可参与大奖秒杀活动,当倒计时为0,“当前出价人”即为最终获胜者!只要你的积分足够,时间充裕,大奖敬请免费拿吧!</li><li style='padding-left: 400px; padding-top: 20px; list-style-type: none; float:left;margin-left:5px;margin-top:5px;'>"); sbBody.Append("<a style='color: #67a4d4; text-decoration: none' href='" + SiteUrl + "/InstantlyKilling/SpikeIndex.aspx'><img style='border: 0' src='" + SiteUrl + "/E-Mail/image/mail_pci3.jpg' /></a></li></ul></div><div style='clear: both'></div><div style='width: 588px; height: 102px; margin-top: 5px;'><ul style='list-style-type: none; margin: 0; padding: 0'>"); sbBody.Append("<li style='list-style-type: none; margin: 0; padding: 0;list-style-type: none; margin: 0; padding: 0;color:#999999;float:left;margin-left:5px;margin-top:5px;text-align:left;'>"); sbBody.Append("<img style='border: 0' src='" + SiteUrl + "/E-Mail/image/mail_pci2.jpg' /></li>"); sbBody.Append("<li style='width: 460px; list-style-type: none; margin: 0; padding: 0;list-style-type: none; margin: 0; padding: 0;color:#999999;float:left;margin-left:5px;margin-top:5px;text-align:left;'>想组织人去K歌么?想招兵买马在篮球场上一决高下么?还会为外出郊游却没有人驴友而在校园里四处贴小广告么?还会为举办老乡会而一个个打电话么?Ume为你搞定这一切,“Ume活动”火热上线,想参加什么,想发起什么,Ume都为你做主!来吧!"); sbBody.Append("<a style='color: #67a4d4; text-decoration: none' href='" + SiteUrl + "/Activities/ActiveDefault.aspx'></li><li style='padding-left: 400px; padding-top: 20px; list-style-type: none; float:left;margin-left:5px;margin-top:5px;'>"); sbBody.Append("<img style='border: 0' src='" + SiteUrl + "/E-Mail/image/mail_pci3.jpg' /></a></li></ul></div><div style='clear: both'></div>"); #region 可能认识的人 IList<Core.Business.AccountExtend> MayBeList = Core.Business.AccountExtend.GetInterFrendsByAccountExtend(ae); // Core.Business.Account.MayBe(ae, 6); if (MayBeList.Count >= 1) { sbBody.Append("<div style='width: 580px; height: 136px; border: #CCCCCC 1px solid; color: #26b4e7; margin-top: 5px; #margin-top: 10px'><div style='padding-left: 5px; text-align: left; line-height: 24px;'>你可能认识的人</div><div>"); for (int j = 0; j < MayBeList.Count; j++) { Core.Business.AccountExtend MayBeAccount = MayBeList[j]; if (MayBeAccount.Id != account.Id) { sbBody.Append("<ul style='float: left; margin-top: 10px; margin-left: 14px; list-style-type: none; padding: 0'><li style='margin-left: 5px; margin-top: 5px; color: #999999; list-style-type: none; padding: 0'>"); sbBody.Append("<img width='60' height='60' src='" + SiteUrl + "/Ajax/Account/GetAvatar.ashx?uid=" + MayBeAccount.Id + "' style='border: 0' /></li>"); sbBody.Append("<li style='margin-left: 5px; margin-top: 5px; color: #999999; list-style-type: none;padding: 0'><a style='color: #67a4d4; text-decoration: none' href='" + SiteUrl + "/Home.aspx?uid=" + MayBeAccount.Id + "'>" + Core.Business.Account.GetAccountNameById(MayBeAccount.Id.ToString()) + "</a></li></ul>"); } } sbBody.Append("</div>"); } #endregion sbBody.Append("</div></div></div></body>"); String Email = "*****@*****.**";//SMTPAuthUsername;// "*****@*****.**";//ae.Email; string subject = account.Name + " Ume邀请你来秒杀!"; String body = sbBody.ToString(); SendMail(SMTPAuthUsername, "Ume校园大使", Email, Email, subject, body, SMTPServer, SMTPAuthUsername, SMTPAuthPassword); */ #endregion if (Send(ae.Email, Title, Body)) { context.Response.Write("{ success:true,msg:'发送成功' }"); } else { context.Response.Write("{ success:false,msg:'发送失败' }"); } } catch (Exception ex) { context.Response.Write("{ success:false,msg:'发送没能完全成功:" + ex.Message + "' }"); } } else { context.Response.Write("{ success:false,msg:'用户不存在' }"); } }
protected void Page_Load(object sender, EventArgs e) { try { long Id = 0; CurrentAccount = CY.UME.Core.Global.GetCurrentAccount(); if (CurrentAccount == null) { Response.Redirect("../Login.aspx"); return; } //this.hiduserid.Value = currentacc.Id.ToString(); uaccountex = CY.UME.Core.Business.AccountExtend.Load(Id); CY.UME.Core.Business.Account currentacc = CY.UME.Core.Business.Account.Load(Id); if (uaccountex != null && !uaccountex.IsNew) { IList<CY.UME.Core.Business.Friendship> fslist = CY.UME.Core.Business.Friendship.GetAccountRequestList(currentacc); IList<CY.UME.Core.Business.AccountExtend> sameinterlist = CY.UME.Core.Business.AccountExtend.GetInterFrendsByAccountExtend(uaccountex); IList<CY.UME.Core.Business.AccountExtend> classmatelist = CY.UME.Core.Business.AccountExtend.GetClassMateByAccountExtend(uaccountex); groups = CY.UME.Core.Business.Group.GetCommendGroup(uaccountex); if (sameinterlist != null && sameinterlist.Count != 0) { if (fslist != null && fslist.Count != 0) { for (int i = 0; i < sameinterlist.Count; i++) { for (int j = 0; j < fslist.Count; j++) { if (sameinterlist[i].Id == fslist[j].FriendId) { sameinterlist.Remove(sameinterlist[i]); i = i - 1; break; } } } } sameinterlist = sameinterlist.Take(6).ToList(); for (int i = 0; i < sameinterlist.Count; i++) { CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(sameinterlist[i].Id); if (acc != null && !acc.IsNew) { sameinter.Add(acc); } } } if (classmatelist != null && classmatelist.Count != 0) { if (fslist != null && fslist.Count != 0) { for (int i = 0; i < classmatelist.Count; i++) { for (int j = 0; j < fslist.Count; j++) { if (classmatelist[i].Id == fslist[j].FriendId) { classmatelist.Remove(classmatelist[i]); i = i - 1; break; } } } } classmatelist = classmatelist.Take(6).ToList(); for (int j = 0; j < classmatelist.Count; j++) { CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(classmatelist[j].Id); if (acc != null && !acc.IsNew) { classmate.Add(acc); } } } if (groups != null && groups.Count != 0) { CY.UME.Core.Business.AccountGroup accgroup = new CY.UME.Core.Business.AccountGroup(); IList<CY.UME.Core.Business.AccountGroup> accgrouplist = accgroup.GetAccountGroupByAccountIdOrGroupId(Id, 0); if (accgrouplist != null && accgrouplist.Count != 0) { for (int i = 0; i < groups.Count; i++) { for (int j = 0; j < accgrouplist.Count; j++) { if (groups[i].Id == accgrouplist[j].GroupId) { groups.Remove(groups[i]); i = i - 1; break; } } } } groups = groups.Take(6).ToList(); } } } catch { return; } }