private void ProcessInvite(ref HttpResponse response, ref HttpRequest request) { string username = request.QueryString["user"]; int c = 0; using (PlayerBussiness a = new PlayerBussiness()) { PlayerInfo b = a.GetUserSingleByUserName(username); if (b != null) { c = b.ID; } } if (c == 0) { response.ReturnAndRedict("用户不存在,请确保已经注册角色!", "login.htm"); } else { INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(Server.ModulePath + @"vm", false); IDictionary context = new Hashtable(); context.Add("content", "http://www.hqgddt.com/?i=" + c); response.Write(FileEngine.Process(context, "invite.vm")); } }
private void ProcessNotice() { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary context = new Hashtable(); Response.Write(iNVelocityEngine.Process(context, "SysNotice.vm")); }
private void ProcessUserlist() { string search = Request.Form["Tb_SearchKeys"].ToSafeString(); int num = StringHelper.ConvertToInt(Request.QueryString["pages"], 1); INVelocityEngine arg_13D_0 = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary dictionary = new Hashtable(); using (var x = new WebHelperClient()) { List <UserInfo> list = x.GetAllUserInfo().ToList(); var onlinecount = list.Where((a) => (a.State != 0)).Count(); list.Sort(new Comparison <UserInfo>(CompareByID)); if (search != "") { list = list.FindAll((UserInfo a) => a.UserName.IndexOf(search, 0) != -1 || a.NickName.IndexOf(search, 0) != -1); } int count = list.Count; int num2 = 1; if (search == "") { num2 = Convert.ToInt32(Math.Ceiling(count / 20m)); list = list.Skip((num - 1) * 20).Take(20).ToList <UserInfo>(); } dictionary.Add("Result", list); dictionary.Add("OnlineCount", onlinecount); dictionary.Add("Search", search); dictionary.Add("Count", count); dictionary.Add("Page", num); dictionary.Add("TocalPage", num2); string text = arg_13D_0.Process(dictionary, "UserList.vm"); Response.Write(text); } }
private void ProcessTop() { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary dictionary = new Hashtable(); dictionary.Add("UserName", this.username); Response.Write(iNVelocityEngine.Process(dictionary, "Admin_Top.vm")); }
public static String readTemlate(String templateName, IDictionary context) { string templateDir = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "/templete/"; INVelocityEngine fileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(templateDir, true); return(fileEngine.Process(context, templateName)); }
protected void Page_Load(object sender, EventArgs e) { using (var a = new WebHelperClient()) { if (!a.IsOpen()) { Response.Write("服务器尚未开放!"); } else { string name = Request.Cookies["username"].GetSafeValue(); string pass = Request.Cookies["password"].GetSafeValue(); int inviteid = Request.Cookies["inviteid"].GetSafeValue().ConvertToInt(0); int b = 0; if (a.CheckUser(name, pass, inviteid)) { b = a.GetUserType(name); if (b >= 2) { var x = Request.QueryString["ForceLoginUsername"].ToSafeString(); if (x != "" && a.ExistsUsername(x)) { name = x; } var type = a.GetUserType(x); if (b <= type) { Response.Write("对不起,你的权限不足"); return; } } pass = Guid.NewGuid().ToString(); a.AddPlayer(name, pass); string content = "user="******"&key=" + pass; INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary context = new Hashtable(); context.Add("Username", name); context.Add("Content", content); context.Add("Edition", "0"); context.Add("Rand", DateTime.Now.Ticks.ToString()); context.Add("UserType", b.ToString()); Response.Write(FileEngine.Process(context, "Game.vm")); } else { Response.Cookies.Add(WebHelper.CreateCookie("username", "", DateTime.Now.AddYears(-1), "hqgddt.com")); Response.Cookies.Add(WebHelper.CreateCookie("password", "", DateTime.Now.AddYears(-1), "hqgddt.com")); Response.ReturnAndRedirect("用户名或密码错误!", "login"); } } } }
private void ProcessStatus() { using (var a = new WebHelperClient()) { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary dictionary = new Hashtable(); dictionary.Add("Runmgr", a.GetRunMgr()); dictionary.Add("IsConnected", a.IsOpen()); Response.Write(iNVelocityEngine.Process(dictionary, "Status.vm")); } }
private void ProcessStep1() { string userid = Request.QueryString["userid"]; if (userid.ConvertToInt(0) == 0) { Write404(); } else { INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary context = new Hashtable(); context.Add("userid", userid); Response.Write(FileEngine.Process(context, @"charge\PayIndex.vm")); } }
//public Boolean ProcesarAlertaRecuperacionContrasenia() //{ // try // { // var listado = ObtenerPendientesProceso(); // if(listado != null) // { // if (listado.Any()) // { // foreach (var item in listado) // { // ProcesarAlertaRecuperacionIndividual(item); // } // } // } // return true; // } // catch (Exception ex) // { // Log(Level.Error, ex.InnerException == null ? ex.Message : ex.InnerException.Message); // } // return false; //} //private void ProcesarAlertaRecuperacionIndividual(RecuperacionContraseniaObtenerDto entidad) //{ // try // { // string cuerpoHtml = ProcesarPlantillaVm(entidad, "RecuperacionContrasenia.vm"); // if (string.IsNullOrEmpty(cuerpoHtml)) return; // if (cuerpoHtml.ToLower().Contains("encountered") || // cuerpoHtml.ToLower().Contains("lexical error")) // { // //Log(Level.Error, String.Format("IdTransaccion: {0} ; error al procesar la plantilla: {1}", // // alerta.IdTransaccion, // // cuerpoHtml)); // } // else // { // List<string> destinatarios = new List<string>(); // destinatarios.Add(entidad.CorreoElectronico); // if (EnviarMensaje(destinatarios, // "Solicitud de recuperacion de contraseña", // cuerpoHtml)) // { // Log(Level.Info, string.Format("Se envió alerta informando datos erroneos en la trama recibida")); // int resultadoMarcarCorreoEnviado = ModificarEstadoEnviado(entidad.IdRecuperacionContrasenia); // if (resultadoMarcarCorreoEnviado > 0) // { // Log(Level.Info, String.Format("Se actualizó el indicador de correo informando que se ha enviado satisfactoriamente")); // } // } // else // { // Log(Level.Warn, String.Format("No pudo enviarse alerta informando datos erroneos en la trama recibida")); // } // } // } // catch (Exception ex) // { // Log(Level.Error, ex.InnerException == null ? ex.Message : ex.InnerException.Message); // } //} private string ProcesarPlantillaVm(RecuperacionContraseniaObtenerDto cuerpoMensaje, string nombrePlantilla) { try { var directorioPlantilla = Path.Combine(ConfiguracionJson.Conf.RutaArchivos, "Plantillas"); var fileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(directorioPlantilla, true); IDictionary context = new Hashtable(); context.Add("datos", cuerpoMensaje); string html = fileEngine.Process(context, nombrePlantilla); return(html); } catch (Exception ex) { Log(Level.Error, ex.InnerException == null ? ex.Message : ex.InnerException.Message); return(string.Empty); } }
private void ProcessStep2() { string userid = Request.QueryString["userid"]; string paytype = Request.QueryString["paytype"]; if (paytype.ConvertToInt(0) == 0 || userid.ConvertToInt(0) == 0) { Write404(); } if (paytype.ConvertToInt(0) >= 1 && paytype.ConvertToInt(0) <= 24) { string username = ""; using (var a = new WebHelperClient()) { var x = a.GetUserNameByID(userid.ConvertToInt(0)); if (x != "") { username = x; } else { Write404(); } } INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary context = new Hashtable(); context.Add("userid", userid); context.Add("username", username); Response.Write(FileEngine.Process(context, "charge/Pay" + paytype + ".vm")); } else { Write404(); } }
private void ProcessInvite() { string username = Request.QueryString["user"].ToSafeString(); int c = 0; using (var a = new WebHelperClient()) { c = a.GetIDByUserName(username); } if (c == 0) { Response.ReturnAndRedirect("用户不存在,请确保已经注册角色!", "Default.aspx"); } else { INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["VMPath"], false); IDictionary context = new Hashtable(); context.Add("content", $"{AppConfig.AppSettings["IndexPage"]}?i=" + c); Response.Write(FileEngine.Process(context, "invite.vm")); } }
private void ProcessMail() { if (!(this.usertype > 2)) { Response.Write("对不起,你的权限不足"); return; } using (var xx = new WebHelperClient()) { if (Request["sub_searchUserId"].ToSafeString() != "") { string userMsg = Request["userMsg"].ToSafeString(); string getAllUserId = ""; if (userMsg != "") { string[] strUsersg = userMsg.Split(new char[] { ',' }); List <UserInfo> result = xx.GetAllUserInfo().ToList(); for (int i = 0; i < strUsersg.Count <string>(); i++) { foreach (var a in result.FindAll((t) => { if (t.UserName.IndexOf(strUsersg[i]) != -1 || t.NickName.IndexOf(strUsersg[i]) != -1) { return(true); } else { return(false); } })) { getAllUserId += string.Concat(new string[] { "ID:[", a.UserID.ToString(), "],用户名:[", a.UserName.ToString(), "],昵称:[", a.NickName.ToString(), "]\n" }); } } Response.Write(getAllUserId); return; } } else if (Request.Form["txt_userID"].ToSafeString() != "" && Request.Form["txt_Title"].ToSafeString() != "" && Request.Form["txt_Content"].ToSafeString() != "") { if (SendMail()) { Response.Write("成功"); } else { Response.Write("失败"); } } else { INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false); IDictionary context = new Hashtable(); if (Request["btn_wq"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsWeapons = xx.GetSingleCategoryItemTemplates(7).ToList(); context.Add("GoodsWeapons", GoodsWeapons); } if (Request["btn_zb"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsEquipment = xx.GetSingleCategoryItemTemplates(1).ToList(); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(2).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(3).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(4).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(5).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(6).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(8).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(9).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(13).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(14).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(15).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(16).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(17).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(18).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(19).ToList()); GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(20).ToList()); context.Add("GoodsEquipment", GoodsEquipment); } if (Request["btn_dj"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsProps = xx.GetSingleCategoryItemTemplates(11).ToList(); context.Add("GoodsProps", GoodsProps); } string hindGoodId = Request["hindGoodId"].ToSafeString(); if (Request["getGoodId"].ToSafeString() != "") { hindGoodId = Request["getGoodId"].ToSafeString(); ; } string changParames = Request["changParames"].ToSafeString(); if (Request["params"].ToSafeString() != "") { changParames = Request["params"].ToSafeString(); } if (hindGoodId != "" && changParames != "") { string[] paraStr = changParames.Split(new char[] { ',' }); DataTable tabGoods = Context.Session["goodsTable"] as DataTable ?? InitNewGoodTable(); int rowNum = Convert.ToInt32(hindGoodId); DataRow[] rowArray = tabGoods.Select("id=" + hindGoodId); DataRow[] array = rowArray; for (int j = 0; j < array.Length; j++) { DataRow rows = array[j]; rows.BeginEdit(); rows["GoodId"] = hindGoodId.ToString(); rows["GoodNumber"] = paraStr[0].ToString(); rows["GoodName"] = paraStr[16].ToString(); rows["TemplateID"] = paraStr[12].ToString(); rows["ValidDate"] = paraStr[1].ToString(); rows["Gold"] = paraStr[10].ToString(); rows["Money"] = paraStr[9].ToString(); rows["LiJuan"] = paraStr[11].ToString(); rows["StrengthenLevel"] = paraStr[4].ToString(); rows["AttackCompose"] = paraStr[5].ToString(); rows["DefendCompose"] = paraStr[6].ToString(); rows["AgilityCompose"] = paraStr[7].ToString(); rows["LuckCompose"] = paraStr[8].ToString(); rows["IsBind"] = paraStr[2].ToString(); rows["Sex"] = paraStr[3].ToString(); rows["CategoryID"] = paraStr[13].ToString(); rows["CanStrengthen"] = paraStr[14].ToString(); rows["CanCompose"] = paraStr[15].ToString(); rows.EndEdit(); } Context.Session["goodsTable"] = tabGoods; } string delete = Request["deletegoodid"].ToSafeString(); if (delete != "") { DataTable dt = Context.Session["goodsTable"] as DataTable ?? InitNewGoodTable(); dt.Rows.Remove(dt.Select("id=" + delete)[0]); } string idArray = Request["ids"].ToSafeString(); if (idArray != "") { var a = idArray.Substring(0, idArray.Length - 1); int[] b = a.Split(',').ConvertToIntArray(); List <ItemTemplateInfo> selectGoods = new List <ItemTemplateInfo>(); foreach (var c in b) { selectGoods.Add(xx.GetSingleItemTemplate(c)); } if (Context.Session["goodsTable"] == null) { goodsTable = InitNewGoodTable(); } else { goodsTable = Context.Session["goodsTable"] as DataTable; } foreach (var item in selectGoods) { DataRow newRow = goodsTable.NewRow(); newRow["GoodId"] = item.TemplateID; newRow["GoodNumber"] = 1; newRow["GoodName"] = item.Name; newRow["TemplateID"] = item.TemplateID; newRow["ValidDate"] = 1; newRow["StrengthenLevel"] = 0; newRow["AttackCompose"] = 0; newRow["DefendCompose"] = 0; newRow["AgilityCompose"] = 0; newRow["LuckCompose"] = 0; newRow["IsBind"] = "True"; newRow["Sex"] = 0; newRow["CategoryID"] = item.CategoryID; newRow["CanStrengthen"] = item.CanStrengthen; newRow["CanCompose"] = item.CanCompose; goodsTable.Rows.Add(newRow); } Context.Session["goodsTable"] = goodsTable; } if (Context.Session["goodsTable"] != null) { context.Add("ResultGoods", Context.Session["goodsTable"] as DataTable); if (!string.IsNullOrEmpty(idArray)) { context.Add("isSelect", idArray.Substring(0, idArray.Length - 1)); } else { context.Add("isSelect", "false"); } idArray = ""; } context.Add("this", this); Response.Write(FileEngine.Process(context, "Mail.vm")); } } }
public HttpResponse Process(HttpRequest request) { var response = new HttpResponse(); response.ContentType = "text/html; charset=utf-8"; if (!WebServer.Instance.IsOpen) { response.ReturnAndRedict("服务器尚未开放!", "login.htm"); } else { string name = request.Cookies["username"].content; string pass = request.Cookies["password"].content; using (MemberShipbussiness a = new MemberShipbussiness()) { int b = 0; if (a.CheckUser(name, pass)) { b = a.GetUserType(name); if (b >= 2) { var x = request.QueryString["ForceLoginUsername"]; if (x != "" && a.ExistsUsername(x)) { name = x; } } pass = Guid.NewGuid().ToString(); PlayerManager.Add(name, pass); string content = $"user={name}&key={pass}"; INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(Server.ModulePath + @"vm", false); IDictionary context = new Hashtable(); context.Add("Username", name); context.Add("Content", content); context.Add("Edition", "0"); context.Add("Rand", DateTime.Now.Ticks.ToString()); context.Add("UserType", b.ToString()); response.Write(FileEngine.Process(context, "Game.vm")); } else { response.cookies.Add(new HttpCookie { name = "username", Expires = DateTime.Now.AddYears(-1) }); response.cookies.Add(new HttpCookie { name = "password", Expires = DateTime.Now.AddYears(-1) }); response.ReturnAndRedict("用户名或密码错误!", "login.htm"); } } } return(response); }