Skip to content

Commit 4a941d6

Browse files
committed
init
1 parent c0673ee commit 4a941d6

File tree

1,197 files changed

+334053
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,197 files changed

+334053
-0
lines changed

JavaScript.Utilities.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.24720.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YanZhiwei.JavaScript.Utilities", "YanZhiwei.JavaScript.Utilities\YanZhiwei.JavaScript.Utilities.csproj", "{249C60C1-2E93-49FC-84D0-DAF3828807EB}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{249C60C1-2E93-49FC-84D0-DAF3828807EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{249C60C1-2E93-49FC-84D0-DAF3828807EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{249C60C1-2E93-49FC-84D0-DAF3828807EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{249C60C1-2E93-49FC-84D0-DAF3828807EB}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ WebHandler Language="C#" CodeBehind="BaseHandler.ashx.cs" Class="YanZhiwei.JavaScript.Utilities.BackHandler.BaseHandler" %>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Net;
5+
using System.Web;
6+
using YanZhiwei.DotNet3._5.Utilities.Model;
7+
using YanZhiwei.DotNet3._5.Utilities.WebForm.Jquery;
8+
9+
namespace YanZhiwei.JavaScript.Utilities.BackHandler
10+
{
11+
/// <summary>
12+
/// Summary description for BaseHandler
13+
/// </summary>
14+
public class BaseHandler : IHttpHandler
15+
{
16+
public static IEnumerable<Person> GetPersons()
17+
{
18+
for (int i = 0; i < 57; i++)
19+
{
20+
yield return new Person
21+
{
22+
Id = i,
23+
Name = "name " + i
24+
};
25+
}
26+
}
27+
28+
public void ProcessRequest(HttpContext context)
29+
{
30+
context.ExecutePageQuery<Person>((pageLength, pageIndex, orderIndex, orderBy) =>
31+
{
32+
var persons = GetPersons();
33+
Func<Person, object> order = p =>
34+
{
35+
if (orderIndex == 0)
36+
{
37+
return p.Id;
38+
}
39+
return p.Name;
40+
};
41+
if ("desc" == orderBy)
42+
{
43+
persons = persons.OrderByDescending(order);
44+
}
45+
else
46+
{
47+
persons = persons.OrderBy(order);
48+
}
49+
//错误测试
50+
//DataTablePageResult result = new DataTablePageResult();
51+
//result.ExecuteMessage = "测试错误";
52+
//result.ExecuteState = HttpStatusCode.BadGateway;
53+
//正确测试
54+
DataTablePageResult result = new DataTablePageResult();
55+
result.iTotalDisplayRecords = persons.Count();
56+
List<Person> _personList = new List<Person>();
57+
result.iTotalRecords = persons.Count();
58+
result.aaData = persons.Skip(pageIndex).Take(pageLength);
59+
result.ExecuteState = HttpStatusCode.OK;
60+
return result;
61+
});
62+
// // Those parameters are sent by the plugin
63+
// var iDisplayLength = int.Parse(context.Request["iDisplayLength"]);
64+
// var iDisplayStart = int.Parse(context.Request["iDisplayStart"]);
65+
// var iSortCol = int.Parse(context.Request["iSortCol_0"]);
66+
// var iSortDir = context.Request["sSortDir_0"];
67+
68+
// // Fetch the data from a repository (in my case in-memory)
69+
// var persons = GetPersons();
70+
71+
// // Define an order function based on the iSortCol parameter
72+
// Func<Person, object> order = p =>
73+
// {
74+
// if (iSortCol == 0)
75+
// {
76+
// return p.Id;
77+
// }
78+
// return p.Name;
79+
// };
80+
81+
// // Define the order direction based on the iSortDir parameter
82+
// if ("desc" == iSortDir)
83+
// {
84+
// persons = persons.OrderByDescending(order);
85+
// }
86+
// else
87+
// {
88+
// persons = persons.OrderBy(order);
89+
// }
90+
91+
// // prepare an anonymous object for JSON serialization
92+
// var result = new
93+
// {
94+
// iTotalRecords = persons.Count(),
95+
// iTotalDisplayRecords = persons.Count(),
96+
// aaData = persons
97+
// .Skip(iDisplayStart)
98+
// .Take(iDisplayLength)
99+
// };
100+
101+
// //var serializer = new JavaScriptSerializer();
102+
//// var json = SerializationHelper.JsonSerialize(result);// serializer.Serialize(result);
103+
// context.CreateResponse(result, System.Net.HttpStatusCode.OK);
104+
// //context.Response.ContentType = "application/json";
105+
// //context.Response.Write(json);
106+
}
107+
108+
public bool IsReusable
109+
{
110+
get
111+
{
112+
return false;
113+
}
114+
}
115+
}
116+
117+
public class Person
118+
{
119+
public int Id { get; set; }
120+
public string Name { get; set; }
121+
}
122+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="YanZhiwei.JavaScript.Utilities.Global" Language="C#" %>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
3+
namespace YanZhiwei.JavaScript.Utilities
4+
{
5+
public class Global : System.Web.HttpApplication
6+
{
7+
protected void Application_Start(object sender, EventArgs e)
8+
{
9+
}
10+
11+
protected void Session_Start(object sender, EventArgs e)
12+
{
13+
}
14+
15+
protected void Application_BeginRequest(object sender, EventArgs e)
16+
{
17+
}
18+
19+
protected void Application_AuthenticateRequest(object sender, EventArgs e)
20+
{
21+
}
22+
23+
protected void Application_Error(object sender, EventArgs e)
24+
{
25+
}
26+
27+
protected void Session_End(object sender, EventArgs e)
28+
{
29+
}
30+
31+
protected void Application_End(object sender, EventArgs e)
32+
{
33+
}
34+
}
35+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JsDemo.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.JsDemo" %>
2+
3+
<!DOCTYPE html>
4+
5+
<html xmlns="http://www.w3.org/1999/xhtml">
6+
<head runat="server">
7+
<title>Js Demo</title>
8+
<script src="jsUtils.js"></script>
9+
<script type="text/javascript">
10+
function getFriendlyStringDemo() {
11+
var _time = '2011-10-12 09:14:12';
12+
_time = jsUtils.datetime.parseDateTime(_time);
13+
console.log("getFriendlyString:" + jsUtils.datetime.getFriendlyString(_time));
14+
}
15+
function getUrlParamterDemo() {
16+
var _url = window.location.href;
17+
var _value = jsUtils.url.get(_url, 'keyid');
18+
alert(_value);
19+
20+
}
21+
</script>
22+
</head>
23+
<body>
24+
<form id="form1" runat="server">
25+
<div>
26+
<input id="Button1" type="button" value="getFriendlyString" onclick="getFriendlyStringDemo()" /><br />
27+
<input id="Button2" type="button" value="getUrl" onclick="getUrlParamterDemo()" />
28+
</div>
29+
</form>
30+
</body>
31+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.UI;
6+
using System.Web.UI.WebControls;
7+
8+
namespace YanZhiwei.JavaScript.Utilities
9+
{
10+
public partial class JsDemo : System.Web.UI.Page
11+
{
12+
protected void Page_Load(object sender, EventArgs e)
13+
{
14+
15+
}
16+
}
17+
}

YanZhiwei.JavaScript.Utilities/JsDemo.aspx.designer.cs

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JsDemo2.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.JsDemo2" %>
2+
3+
<!DOCTYPE html>
4+
5+
<html xmlns="http://www.w3.org/1999/xhtml">
6+
<head runat="server">
7+
<title>Js参数获取测试</title>
8+
</head>
9+
<body>
10+
<form id="form1" runat="server">
11+
<div>
12+
<a href="JsDemo.aspx?keyid=EC8C2ECB-C95C-475B-B4CE-A0B9EC4DC553">Js跳转测试</a>
13+
</div>
14+
</form>
15+
</body>
16+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.UI;
6+
using System.Web.UI.WebControls;
7+
8+
namespace YanZhiwei.JavaScript.Utilities
9+
{
10+
public partial class JsDemo2 : System.Web.UI.Page
11+
{
12+
protected void Page_Load(object sender, EventArgs e)
13+
{
14+
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)