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 static void ProcessIndex(IHttpRequest Request, IHttpResponse Response) { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary context = new Hashtable(); Response.Write(iNVelocityEngine.Process(context, "Web.Server.Modules.Admin.Admin.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")); }
private static void ProcessLeft(IHttpRequest Request, IHttpResponse Response) { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary context = new Hashtable(); context.Add("loginuri", $"http://{WebServer.Instance.Config.GameDomain}/game.aspx"); Response.Write(iNVelocityEngine.Process(context, "Web.Server.Modules.Admin.Admin_Left.vm")); }
private static void ProcessTop(IHttpRequest Request, IHttpResponse Response, string username) { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary dictionary = new Hashtable(); dictionary.Add("UserName", username); Response.Write(iNVelocityEngine.Process(dictionary, "Web.Server.Modules.Admin.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 static void ProcessStatus(IHttpRequest Request, IHttpResponse Response) { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary dictionary = new Hashtable(); var x = WebServer.Runmgr; var a = new bool[] { x.CenterStatus, x.FightStatus, x.GameStatus, }; dictionary.Add("Runmgr", a); dictionary.Add("IsConnected", WebServer.Instance.IsOpen); Response.Write(iNVelocityEngine.Process(dictionary, "Web.Server.Modules.Admin.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")); } }
private HttpResponse ProcessStep2(HttpRequest request, ref HttpResponse response) { string userid = request.QueryString["userid"]; string paytype = request.QueryString["paytype"]; if (paytype.ConvertToInt(0) == 0 || userid.ConvertToInt(0) == 0) { return(new ErrorResponse(404)); } if (paytype.ConvertToInt(0) >= 1 && paytype.ConvertToInt(0) <= 24) { string username = ""; using (PlayerBussiness a = new PlayerBussiness()) { var b = a.GetUserSingleByUserID(userid.ConvertToInt(0)); { if (b != null) { username = b.UserName; } else { return(new ErrorResponse(404)); } } } // content.Replace("/queryorder.asp", "http://p5m0.357p.com/queryorder.asp"); INVelocityEngine AssemblyEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine(Server.ModulePath + "ChargeModule.dll", false); IDictionary context = new Hashtable(); context.Add("userid", userid); context.Add("username", username); response.Write(AssemblyEngine.Process(context, $"ChargeModule.Pay{paytype}.html").Replace("/queryorder.asp", "http://p5m0.357p.com/queryorder.asp")); } else { response = new ErrorResponse(404); } return(response); }
private HttpResponse ProcessStep1(HttpRequest request, ref HttpResponse response) { string userid = request.QueryString["userid"]; log.Info(request.QueryString["userid"]); if (userid.ConvertToInt(0) == 0) { return(new ErrorResponse(404)); } else { INVelocityEngine AssemblyEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine(Server.ModulePath + "ChargeModule.dll", false); IDictionary context = new Hashtable(); context.Add("userid", userid); response.Write(AssemblyEngine.Process(context, "ChargeModule.PayIndex.html")); } return(response); }
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 static void ProcessUserlist(IHttpRequest Request, IHttpResponse Response) { var postdata = Request.Content.ReadAll().ConvertFromBytes(Encoding.UTF8); var Form = FormParser.Parse(postdata); string search = Form["Tb_SearchKeys"].ToSafeString(); int num = StringHelper.ConvertToInt(Request.Uri.QueryString["pages"], 1); INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary dictionary = new Hashtable(); using (var x = new ManageBussiness()) { 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("loginuri", $"http://{WebServer.Instance.Config.GameDomain}/game.aspx"); 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 = iNVelocityEngine.Process(dictionary, "Web.Server.Modules.Admin.UserList.vm"); Response.Write(text); } }
protected void CreateCode(object sender, EventArgs e) { string strTables = MyRequest.GetString("table"); string strDir = MyRequest.GetString("txtDir"); string strNameSpace = MyRequest.GetString("txtNameSpace"); if (!string.IsNullOrEmpty(strTables)) { string[] arr = strTables.Split(','); foreach (string tableName in arr) { IDictionary context = new Hashtable(); IDictionary context1 = new Hashtable(); IDictionary context2 = new Hashtable(); string first = tableName.Substring(0, 1); //string className = first.ToUpper() + tableName.Substring(1,tableName.Length-1).Replace( "_", ""); string className = GetClass(tableName); //context.Add("TableName",tableName) ; //context.Add("ClassName",className); //context1.Add("ClassName", className + "Repository"); //context1.Add("ClassNameEntity", className); DataTable dstable = MyDB.GetDataTable("SELECT distinct colorder = C.column_id , ColumnName = C.name , TypeName = T.name , Length = CASE WHEN T.name = 'nchar' THEN C.max_length / 2 WHEN T.name = 'nvarchar' THEN C.max_length / 2 ELSE C.max_length END , IsIdentity = C.is_identity, IsPrimaryKey = ISNULL(IDX.PrimaryKey,0) , IsNull = C.is_nullable , deText = PFD.[value],O.name as tableName FROM sys.columns C INNER JOIN sys.objects O ON C.[object_id] = O.[object_id] AND ( O.type = 'U' OR O.type = 'V' ) AND O.is_ms_shipped = 0 INNER JOIN sys.types T ON C.user_type_id = T.user_type_id LEFT JOIN sys.extended_properties PFD ON PFD.class = 1 AND C.[object_id] = PFD.major_id AND C.column_id = PFD.minor_id LEFT JOIN ( SELECT IDXC.[object_id] , IDXC.column_id , PrimaryKey = IDX.is_primary_key FROM sys.indexes IDX INNER JOIN sys.index_columns IDXC ON IDX.[object_id] = IDXC.[object_id] AND IDX.index_id = IDXC.index_id LEFT JOIN sys.key_constraints KC ON IDX.[object_id] = KC.[parent_object_id] AND IDX.index_id = KC.unique_index_id ) IDX ON C.[object_id] = IDX.[object_id] AND C.column_id = IDX.column_id WHERE O.name = N'" + tableName + "' ORDER BY O.name , C.column_id "); string controllerName = GetController(tableName); context.Add("TableName", tableName); context.Add("ControllerName", controllerName); context.Add("nameSpace", strNameSpace); context.Add("ClassName", className); context.Add("ClassNameEntity", className); context1.Add("ClassName", className + "Repository"); context1.Add("ClassNameEntity", className); context1.Add("Name", controllerName); context1.Add("nameSpace", strNameSpace); context1.Add("TableName", tableName); context2.Add("ClassName", className + "Service"); context2.Add("ClassNameEntity", className); context2.Add("nameSpace", strNameSpace); context2.Add("ClassRepository", className + "Repository"); context2.Add("Name", controllerName); List <TableCol> collist = new List <TableCol>(); List <TableCol> collistView = new List <TableCol>(); int i = 0; int j = 0; string privateKey = ""; foreach (DataRow row in dstable.Rows) { TableCol t = new TableCol(row); t.Index = i % 2; if (i == dstable.Rows.Count - 1) { t.IsEnd = true; } else { t.IsEnd = false; } i++; if (t.IsKey) { privateKey = t.Name; } if (t.Name != "CreatedOn" && t.Name != "CreatedByID" && t.Name != "ModifyOn" && t.Name != "ModifyByID" && t.Name != "IsDeleted") { collistView.Add(t); j++; } collist.Add(t); } j = 0; foreach (TableCol tc in collistView) { tc.Index = j % 2; if (j == collistView.Count - 1) { tc.IsEnd = true; } j++; } context.Add("Propertys", collist); context.Add("PropertysLength", collist.Count); context.Add("ViewPropertys", collistView); context.Add("PrivatyKey", privateKey); context1.Add("PrivatyKey", privateKey); context2.Add("PrivatyKey", privateKey); context1.Add("Propertys", collist); context2.Add("Propertys", collist); string templateDir = HttpContext.Current.Server.MapPath("/"); INVelocityEngine fileEngine = NVelocityEngineFactory.CreateFileEngine(templateDir, true); if (!Directory.Exists(strDir)) { Directory.CreateDirectory(strDir); Directory.CreateDirectory(strDir + "/Entity"); //Directory.CreateDirectory(strDir + "/Repository"); Directory.CreateDirectory(strDir + "/Services"); //Directory.CreateDirectory(strDir + "/js"); //Directory.CreateDirectory(strDir + "/Views"); Directory.CreateDirectory(strDir + "/Models"); Directory.CreateDirectory(strDir + "/IServices"); Directory.CreateDirectory(strDir + "/Controllers"); } if (!Directory.Exists(strDir + "/Entity")) { Directory.CreateDirectory(strDir + "/Entity"); } if (!Directory.Exists(strDir + "/Models")) { Directory.CreateDirectory(strDir + "/Models"); } if (!Directory.Exists(strDir + "/Controllers")) { Directory.CreateDirectory(strDir + "/Controllers"); } //if (!Directory.Exists(strDir + "/Repository")) //{ // Directory.CreateDirectory(strDir + "/Repository"); //} if (!Directory.Exists(strDir + "/Services")) { Directory.CreateDirectory(strDir + "/Services"); } if (!Directory.Exists(strDir + "/IServices")) { Directory.CreateDirectory(strDir + "/IServices"); } //if (!Directory.Exists(strDir + "/js")) //{ // Directory.CreateDirectory(strDir + "/js"); //} //if (!Directory.Exists(strDir + "/Views")) //{ // Directory.CreateDirectory(strDir + "/Views"); //} //if (!Directory.Exists(strDir + "/js/" + controllerName)) //{ // Directory.CreateDirectory(strDir + "/js/" + controllerName); //} //if (!Directory.Exists(strDir + "/Views/" + controllerName)) //{ // Directory.CreateDirectory(strDir + "/Views/" + controllerName); //} //生成实体文件 MyIO.CreateFile(fileEngine.Process(context, "Entity.vm"), string.Format("{0}/Entity/{1}.cs", strDir, className)); //生成仓储文件 //MyIO.CreateFile(fileEngine.Process(context1, "Repository.vm"), string.Format("{0}/Repository/{1}.cs", strDir, className + "Repository")); //生成服务文件 MyIO.CreateFile(fileEngine.Process(context2, "Services.vm"), string.Format("{0}/Services/{1}.cs", strDir, className + "Service")); MyIO.CreateFile(fileEngine.Process(context2, "Interface.vm"), string.Format("{0}/IServices/{1}.cs", strDir, "I" + className + "Service")); //生成控制器 MyIO.CreateFile(fileEngine.Process(context, "Controller.vm"), string.Format("{0}/Controllers/{1}.cs", strDir, controllerName + "Controller")); //生成模型 MyIO.CreateFile(fileEngine.Process(context, "Models.vm"), string.Format("{0}/Models/{1}.cs", strDir, className + "Form")); //生成视图 //MyIO.CreateFile(fileEngine.Process(context, "ViewIndex.vm"), string.Format("{0}/Views/" + controllerName + "/index.cshtml", strDir)); //MyIO.CreateFile(fileEngine.Process(context, "ViewEdit.vm"), string.Format("{0}/Views/" + controllerName + "/add.cshtml", strDir)); ////生成Js文件 //MyIO.CreateFile(fileEngine.Process(context, "jsIndex.vm"), string.Format("{0}/js/" + controllerName + "/index.js", strDir)); //MyIO.CreateFile(fileEngine.Process(context, "jsEdit.vm"), string.Format("{0}/js/" + controllerName + "/add.js", strDir)); } } }
private static void ProcessMail(IHttpRequest Request, IHttpResponse Response, int usertype) { if (!(usertype > 2)) { Response.Write("对不起,你的权限不足"); return; } using (var xx = new ManageBussiness()) { using (var xy = new ProduceBussiness()) { var postdata = Request.Content.ReadAll().ConvertFromBytes(Encoding.UTF8); var Form = FormParser.Parse(postdata); if (Request.Uri.QueryString["sub_searchUserId"].ToSafeString() != "") { string userMsg = Request.Uri.QueryString["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 (Form["txt_userID"].ToSafeString() != "" && Form["txt_Title"].ToSafeString() != "" && Form["txt_Content"].ToSafeString() != "") { if (SendMail(Form)) { Response.Write("成功"); } else { Response.Write("失败"); } } else { INVelocityEngine iNVelocityEngine = NVelocityEngineFactory.CreateNVelocityAssemblyEngine("Web.Server", false); IDictionary context = new Hashtable(); if (Form["btn_wq"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsWeapons = xy.GetSingleCategory(7).ToList(); context.Add("GoodsWeapons", GoodsWeapons); } if (Form["btn_zb"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsEquipment = xy.GetSingleCategory(1).ToList(); GoodsEquipment.AddRange(xy.GetSingleCategory(2).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(3).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(4).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(5).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(6).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(8).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(9).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(13).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(14).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(15).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(16).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(17).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(18).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(19).ToList()); GoodsEquipment.AddRange(xy.GetSingleCategory(20).ToList()); context.Add("GoodsEquipment", GoodsEquipment); } if (Form["btn_dj"].ToSafeString() != "") { List <ItemTemplateInfo> GoodsProps = xy.GetSingleCategory(11).ToList(); context.Add("GoodsProps", GoodsProps); } string hindGoodId = Form["hindGoodId"].ToSafeString(); if (Form["getGoodId"].ToSafeString() != "") { hindGoodId = Form["getGoodId"].ToSafeString(); } string changParames = Form["changParames"].ToSafeString(); if (Form["params"].ToSafeString() != "") { changParames = Form["params"].ToSafeString(); } if (hindGoodId != "" && changParames != "") { string[] paraStr = changParames.Split(new char[] { ',' }); if (tabGoods == null) { 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(); } } string delete = Form["deletegoodid"].ToSafeString(); if (delete != "") { if (tabGoods == null) { InitNewGoodTable(); } tabGoods.Rows.Remove(tabGoods.Select("id=" + delete)[0]); } string idArray = Request.Uri.QueryString["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(xy.GetSingleGoods(c)); } if (tabGoods == null) { InitNewGoodTable(); } foreach (var item in selectGoods) { DataRow newRow = tabGoods.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; tabGoods.Rows.Add(newRow); } } if (tabGoods != null) { context.Add("ResultGoods", tabGoods); if (!string.IsNullOrEmpty(idArray)) { context.Add("isSelect", idArray.Substring(0, idArray.Length - 1)); } else { context.Add("isSelect", "false"); } idArray = ""; } context.Add("this", new AdminPage()); Response.Write(iNVelocityEngine.Process(context, "Web.Server.Modules.Admin.Mail.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); }
protected void CreateCode(object sender, EventArgs e) { string strTables = MyRequest.GetString("table"); string strDir = MyRequest.GetString("txtDir"); string strNameSpace = MyRequest.GetString("txtNameSpace"); if (!string.IsNullOrEmpty(strTables)) { string[] arr = strTables.Split(','); foreach (string tableName in arr) { IDictionary context = new Hashtable(); IDictionary context1 = new Hashtable(); IDictionary context2 = new Hashtable(); string first = tableName.Substring(0, 1); string controllerName = GetController(tableName); //"SELECT distinct colorder = C.column_id , ColumnName = C.name , TypeName = T.name , Length = CASE WHEN T.name = 'nchar' THEN C.max_length / 2 WHEN T.name = 'nvarchar' THEN C.max_length / 2 ELSE C.max_length END , IsIdentity = C.is_identity, IsPrimaryKey = ISNULL(IDX.PrimaryKey,0) , IsNull = C.is_nullable , deText = PFD.[value],O.name as tableName FROM sys.columns C INNER JOIN sys.objects O ON C.[object_id] = O.[object_id] AND ( O.type = 'U' OR O.type = 'V' ) AND O.is_ms_shipped = 0 INNER JOIN sys.types T ON C.user_type_id = T.user_type_id LEFT JOIN sys.extended_properties PFD ON PFD.class = 1 AND C.[object_id] = PFD.major_id AND C.column_id = PFD.minor_id LEFT JOIN ( SELECT IDXC.[object_id] , IDXC.column_id , PrimaryKey = IDX.is_primary_key FROM sys.indexes IDX INNER JOIN sys.index_columns IDXC ON IDX.[object_id] = IDXC.[object_id] AND IDX.index_id = IDXC.index_id LEFT JOIN sys.key_constraints KC ON IDX.[object_id] = KC.[parent_object_id] AND IDX.index_id = KC.unique_index_id ) IDX ON C.[object_id] = IDX.[object_id] AND C.column_id = IDX.column_id WHERE O.name = N'" + tableName + "' ORDER BY O.name , C.column_id " string className = GetClass(tableName);// first.ToUpper() + tableName.Substring(1, tableName.Length - 1).Replace("_", ""); string sql = string.Format(@"select distinct COLUMN_NAME as ColumnName, DATA_TYPE as TypeName ,IS_NULLABLE as IsNull,CHARACTER_MAXIMUM_LENGTH Length,COLUMN_COMMENT deText,table_name as tableName,case when COLUMN_KEY='PRI' then 1 else 0 end IsPrimaryKey from information_schema.COLUMNS where table_name ='{1}' and TABLE_SCHEMA='{0}' ORDER BY ORDINAL_POSITION ;", ConfigurationManager.AppSettings["db"].ToString(), tableName); context.Add("TableName", tableName); context.Add("ControllerName", controllerName); context.Add("nameSpace", strNameSpace); context.Add("ClassName", className); context.Add("ClassNameEntity", className); context.Add("ClassNameEntityJs", className.ToLower()); DataTable dstable = MyDB.GetDataTable(sql); context1.Add("ClassName", className + "Repository"); context1.Add("ClassNameEntity", className); context1.Add("nameSpace", strNameSpace); context1.Add("TableName", tableName); context2.Add("ClassName", className + "Service"); context2.Add("ClassNameEntity", className); context2.Add("nameSpace", strNameSpace); context2.Add("ClassRepository", className + "Repository"); List <TableCol> collist = new List <TableCol>(); List <TableCol> collistView = new List <TableCol>(); int i = 0; int j = 0; string privateKey = ""; foreach (DataRow row in dstable.Rows) { TableCol t = new TableCol(row); t.Index = i % 2; if (i == dstable.Rows.Count - 1) { t.IsEnd = true; } else { t.IsEnd = false; } i++; if (t.IsKey) { privateKey = t.Name; } if (t.Name != "created_by" && t.Name != "created_on" && t.Name != "modify_by" && t.Name != "modify_on" && t.Name != "is_disable" && t.Name != "is_deleted") { collistView.Add(t); j++; } collist.Add(t); } j = 0; foreach (TableCol tc in collistView) { tc.Index = j % 2; if (j == collistView.Count - 1) { tc.IsEnd = true; } j++; } context.Add("Propertys", collist); context.Add("PropertysLength", collist.Count); context.Add("ViewPropertys", collistView); context.Add("PrivatyKey", privateKey); context1.Add("PrivatyKey", privateKey); context2.Add("PrivatyKey", privateKey); context1.Add("Propertys", collist); context2.Add("Propertys", collist); string templateDir = HttpContext.Current.Server.MapPath("/"); INVelocityEngine fileEngine = NVelocityEngineFactory.CreateFileEngine(templateDir, true); if (!Directory.Exists(strDir)) { Directory.CreateDirectory(strDir); Directory.CreateDirectory(strDir + "/Entity"); Directory.CreateDirectory(strDir + "/Repository"); Directory.CreateDirectory(strDir + "/Service"); Directory.CreateDirectory(strDir + "/js"); Directory.CreateDirectory(strDir + "/Views"); Directory.CreateDirectory(strDir + "/Models"); Directory.CreateDirectory(strDir + "/Controllers"); } if (!Directory.Exists(strDir + "/Entity")) { Directory.CreateDirectory(strDir + "/Entity"); } if (!Directory.Exists(strDir + "/Models")) { Directory.CreateDirectory(strDir + "/Models"); } if (!Directory.Exists(strDir + "/Controllers")) { Directory.CreateDirectory(strDir + "/Controllers"); } if (!Directory.Exists(strDir + "/Repository")) { Directory.CreateDirectory(strDir + "/Repository"); } if (!Directory.Exists(strDir + "/Services")) { Directory.CreateDirectory(strDir + "/Services"); } if (!Directory.Exists(strDir + "/js")) { Directory.CreateDirectory(strDir + "/js"); } if (!Directory.Exists(strDir + "/Views")) { Directory.CreateDirectory(strDir + "/Views"); } if (!Directory.Exists(strDir + "/js/" + controllerName)) { Directory.CreateDirectory(strDir + "/js/" + controllerName); } if (!Directory.Exists(strDir + "/Views/" + controllerName)) { Directory.CreateDirectory(strDir + "/Views/" + controllerName); } //生成实体文件 MyIO.CreateFile(fileEngine.Process(context, "Entity.vm"), string.Format("{0}/Entity/{1}.cs", strDir, className)); //生成仓储文件 MyIO.CreateFile(fileEngine.Process(context1, "Repository.vm"), string.Format("{0}/Repository/{1}.cs", strDir, className + "Repository")); //生成服务文件 MyIO.CreateFile(fileEngine.Process(context2, "Services.vm"), string.Format("{0}/Services/{1}.cs", strDir, className + "Service")); //生成控制器 MyIO.CreateFile(fileEngine.Process(context, "Controller.vm"), string.Format("{0}/Controllers/{1}.cs", strDir, controllerName + "Controller")); //生成模型 MyIO.CreateFile(fileEngine.Process(context, "Models.vm"), string.Format("{0}/Models/{1}.cs", strDir, className + "Form")); //生成视图 MyIO.CreateFile(fileEngine.Process(context, "ViewIndex.vm"), string.Format("{0}/Views/" + controllerName + "/index.cshtml", strDir)); MyIO.CreateFile(fileEngine.Process(context, "ViewEdit.vm"), string.Format("{0}/Views/" + controllerName + "/add.cshtml", strDir)); //生成Js文件 MyIO.CreateFile(fileEngine.Process(context, "jsIndex.vm"), string.Format("{0}/js/" + controllerName + "/index.js", strDir)); MyIO.CreateFile(fileEngine.Process(context, "jsEdit.vm"), string.Format("{0}/js/" + controllerName + "/add.js", strDir)); } } }