protected void Page_Load(object sender, EventArgs e) { DataSet ds = bll.GetList(100, "msn='" + System.DateTime.Now.ToString("yyyyMMdd") + "'", "id"); foreach (DataRow dr in ds.Tables[0].Rows) { model = bll.GetModel(int.Parse(dr["id"].ToString())); try { string title = "積分清零提醒"; string str = "您還有" + dr["point"] + "積分年底到期請注意使用。"; TWMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailport, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, dr["email"].ToString(), title + " - " + siteConfig.webname + "", str); } catch (Exception eee) { } model.msn = System.DateTime.Now.ToString("yyyyMMdd"); bll.Update(model); } if (ds.Tables[0].Rows.Count > 0) { Response.Write("正在發送請勿關閉本頁"); Response.Redirect("mail.aspx"); } else { Response.Write("發送完畢可以關閉本頁"); Response.End(); } }
//第三方登入後處理 protected void multi_login(string id, string name, string email, string source) { Tea.Model.users model = new Tea.Model.users(); Tea.BLL.users bll = new Tea.BLL.users(); //自動加入會員 DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id"); //Response.Write(ds.Tables[0].Rows.Count); if (ds.Tables[0].Rows.Count == 0) { if (!string.IsNullOrEmpty(email) && email.Length > 5) { if (new Tea.BLL.users().ExistsEmail(email)) { Response.Write(ljd.function.LocalHint("此帳號信箱已存在於此網站,請以新mail註冊", "/users/login.aspx")); Response.End(); } } model.group_id = 1; model.status = 0; model.user_name = id; model.password = DESEncrypt.Encrypt(ljd.function.getUUIDString(12)); model.email = email; // txtEmail.Text; //model.birthday = DateTime.Parse("1980-1-1"); model.nick_name = name; //txtNickName.Text; model.mobile = ""; //txtTelphone.Text.Trim(); model.address = ""; //Request["txtcity"] + "|" + Request["txtcity1"] + "|" + txtZip.Text + "|" + txtAddress.Text.Trim(); model.reg_time = DateTime.Now; model.reg_ip = TWRequest.GetIP(); model.user_hei = 2; int uid = bll.Add(model); model = bll.GetModel(uid); //model.id = uid; } else { model = bll.GetModel(id); if (model == null) { Response.Write(ljd.function.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/users/login.aspx")); Response.End(); } } //防止Session提前過期 try { Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1); if (cartModel.total_quantity == 0) { Response.Redirect("/Default.aspx"); } else { Response.Redirect("/shop/cart.aspx"); } //寫入登入日誌 // new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP()); } catch { Response.Write("no"); } //寫入登入日誌 //new Tea.BLL.user_login_log().Add(model.id, model.user_name, id + "會員登入", TWRequest.GetIP()); //Response.Write(model.id+"--"+model.user_name+"--"+model.email); }
protected void Page_Load(object sender, EventArgs e) { id = Request["id"]; name = Request["name"]; if (!string.IsNullOrEmpty(id)) { Tea.Model.users model = new Tea.Model.users(); Tea.BLL.users bll = new Tea.BLL.users(); //自動加入會員 DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id"); if (ds.Tables[0].Rows.Count == 0) { model.group_id = 1; model.status = 0; model.user_name = id; model.password = DESEncrypt.Encrypt(ljd.function.getUUIDString(12)); //model.birthday = DateTime.Parse("1980-1-1"); if (!string.IsNullOrEmpty(name)) { model.nick_name = name; } else { model.nick_name = "暱名"; } model.mobile = ""; model.address = ""; model.reg_time = DateTime.Now; model.reg_ip = TWRequest.GetIP(); model.user_hei = 1; model.point = 0; model.avatar = "https://graph.facebook.com/" + id + "/picture"; try { string tcode = Utils.GetCookie("tcode"); model.company = Utils.StrToInt(tcode, 0); } catch (Exception eee) { } int uid = bll.Add(model); model.id = uid; Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); //寫入登入日誌 //new Tea.BLL.user_login_log().Add(); if (model.email.Length < 2) { Response.Write("2"); Response.End(); } Response.Write("1"); Response.End(); } else { model = bll.GetModel(id); model.avatar = "https://graph.facebook.com/" + id + "/picture"; bll.Update(model); if (model == null) { //Response.Write(Tea.Common.Utils.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/login.aspx")); //Response.End(); } } //防止Session提前過期 try { Session[TWKeys.SESSION_USER_INFO] = model; Session.Timeout = 4500; //防止Session提前過期 Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name); Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password); //寫入登入日誌 //new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP()); if (model.email.Length < 2) { Response.Write("2"); Response.End(); } Response.Write("1"); Response.End(); Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1); if (cartModel.total_quantity == 0) { Response.Write("3"); Response.End(); } else { Response.Write("4"); Response.End(); } } catch {// Response.Write("no"); Response.End(); } } }