public override void KhoiTao(SqlConnection con) { bool login = SecurityCangTin.IsAuthenticated(); Page _Page = new Page(); ClientScriptManager cs = _Page.ClientScript; StringBuilder sb = new StringBuilder(); HttpContext c = HttpContext.Current; string _alias = c.Request["pages"]; sb.AppendFormat(@" <div class=""top""> <div class=""top-box""> <div class=""top-r"">"); if (login) { sb.AppendFormat(@" <a href=""{0}"" class=""top-r-avatar avatar-50-box""><img src=""5f45c3ea-3a9d-4089-ba18-6bac8c70aec450x50.jpeg"" class=""avatar-50"" /></a> <a href=""javascript:;"" class=""top-r-item top-r-msg"">Tin nhắn</a><span class=""top-r-space"">|</span> <a href=""javascript:;"" class=""top-r-item top-r-thongBao"">Thông báo</a><a href=""{0}"" class=""top-r-item top-r-profile"">Tiểu ni</a> ", domain); } else { sb.AppendFormat(@" <a href=""javascript:;"" class=""top-r-item top-r-login"">Đăng nhập</a><a href=""javascript:;"" class=""top-r-item top-r-register"">Đăng ký</a> "); } sb.AppendFormat(@" </div> <div class=""top-l""> <a href=""{0}"" class=""logo""></a> <a href=""{0}tim-ban/"" class=""top-l-item{2}"">Tìm bạn</a> <a href=""{0}su-kien/"" class=""top-l-item{3}"">Sự kiện</a> <a href=""{0}qua/"" class=""top-l-item{4}"">Quà</a> </div> <div class=""search-pnl""> <a href=""javascript:;"" class=""search-btn""> </a> <input class=""search-txt"" /> </div> </div> </div>", domain , _alias == "home" ? " top-l-item-active" : "" , _alias == "tim-ban" ? " top-l-item-active" : "" , _alias == "su-kien" ? " top-l-item-active" : "" , _alias == "qua" ? " top-l-item-active" : ""); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Banner), "appStore.authorityStore.content.html.Banner.js") , "{bannerFn.setup();}"); Html = sb.ToString(); base.KhoiTao(con); }
public override void KhoiTao(SqlConnection con) { bool login = SecurityCangTin.IsAuthenticated(); Page _Page = new Page(); ClientScriptManager cs = _Page.ClientScript; StringBuilder sb = new StringBuilder(); HttpContext c = HttpContext.Current; string _Usr = c.Request["Usr"]; string _Pwd = c.Request["Pwd"]; string _Rem = c.Request["Rem"]; string _Ten = c.Request["Ten"]; string _Email = c.Request["Email"]; string _ActiveCode = c.Request["ActiveCode"]; string _GioiTinh = c.Request["GioiTinh"]; switch (subAct) { case "Login": #region Login sb.Append(SecurityCangTin.Login(_Usr, _Pwd, _Rem).ToString()); break; #endregion case "LogOut": #region LogOut Security.LogOut(); break; #endregion case "Reg": #region Reg: Đăng ký if (!string.IsNullOrEmpty(_Email) && !string.IsNullOrEmpty(_Usr)) { string activeCode = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 6); User Item = new User(); Item.Active = false; Item.ActiveCode = activeCode; Item.Email = _Email; Item.NgayTao = DateTime.Now; Item.Ten = _Ten; Item.RowId = Guid.NewGuid(); Item.Username = _Usr; Item.GioiTinh = Convert.ToBoolean(_GioiTinh); Item.Pwd = linh.common.maHoa.EncryptString(_Usr, _Usr); Item = UserDal.Insert(Item); sendEmailDele dele = new sendEmailDele(omail.SendthongBao); IAsyncResult ar = dele.BeginInvoke(_Email, "Căng tin (cangtin.com) - Email kích hoạt", string.Format(emailActiveBody, _Ten, Item.ActiveCode , domain, _Email), null, null); sb.Append(Item.ID.ToString()); } break; #endregion case "ValidateEmail": #region ValidateEmail : Kiểm tra email if (!string.IsNullOrEmpty(_Email)) { sb.Append(MemberDal.ValidEmail(_Email).ToString()); } break; #endregion case "ActiveByCode": #region AciveByCode : Kiểm tra ActiveCode if (!string.IsNullOrEmpty(_ActiveCode)) { bool ok = UserDal.ValidActiveCode(_ActiveCode, Security.Username); if (!ok) { SecurityCangTin.Login(Security.Username, "True"); c.Session["c-user"] = null; } if (!string.IsNullOrEmpty(Request["type"])) { c.Response.Redirect(domain); } else { sb.Append(ok.ToString()); } } break; #endregion case "ReSendActiveEmail": #region ReSendActiveEmail : Gửi lại mail if (!string.IsNullOrEmpty(_Email)) { User Item = UserDal.SelectByUsername(Security.Username); if (_Email != Item.Email) { if (UserDal.ValidEmail(_Email)) { sb.Append("0"); } else { UserDal.UpdateEmail(Security.Username, _Email); } } sendEmailDele dele = new sendEmailDele(omail.SendthongBao); IAsyncResult ar = dele.BeginInvoke(_Email, "Căng tin (cangtin.com) - Email kích hoạt", string.Format(emailActiveBody, _Ten, Item.ActiveCode , domain, _Email), null, null); rendertext("1"); } break; #endregion case "ValidateUsername": #region ValidateUsername : Kiểm tra username if (!string.IsNullOrEmpty(_Usr)) { sb.Append(UserDal.ValidUsername(_Usr).ToString()); } break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(authentication), "appStore.authorityStore.userMgr.js.js")); break; #endregion default: break; } Html = sb.ToString(); base.KhoiTao(con); }