CYQ.Data example JSON data communication application framework papers

Preface:

Long time no write articles like tutorials, version upgrade is very fast, since all versions are backward compatible, so the original tutorial also applies,

Have time to update the look of a modest man.

There are some new features temporary usage, are scattered in all the published version of the article, so do not let everyone free versions of articles published.

Today, specially carefully wrote an example to demonstrate CYQ.Data data in a frame is not everyone attention: JSON application papers.

 

Here's a look at an example:

 

A: Function list introduction

 

1: Publish a WebService, provides two methods:

a: Data Query table: public string GetUsersInfo ()

b: Data Update [strap-insertion]: public bool UpdateUserInfo (string json)

 

2: Local Aspx page:

a: Direct Calling WebService GetUsersInfo, bound to the list control.

b: reading WebService with Jquery, cycling the output data.

c: UpdateUserInfo call with Jquery, submit data.

 

3: Solution:

 

For this example, the Autumn Park QBlog  database also were using.

 

II: Project implementation steps

 

1: to Download Center Download V4.3 version, and configure the database link - skip

2: Reference CYQ.Data data framework - skip

 

3: Adding WebService, and add the following two methods:

 

4: Add a reference to WebService

 

5: Interface call:

a:html

<asp:GridView ID="gvUsers" runat="server"></asp:GridView>

b:Default.aspx

    protected void Page_Load(object sender, EventArgs e)
    {
        localhost.Service s = new localhost.Service();
        MDataTable.LoadFromJson(s.GetUsersInfo()).Bind(gvUsers); ;
    }

 

6:F5结果1:

 

7:与Jquery调用交互一:查询数据:

a:html

<div id="jsonBody" title="显示用的Div一个"> </div>

同时body增加onload="loadData()",引发事件的脚本如下:

b:调用结果:

 

8:与Jquery调用交互二:提交数据:

a:html:1个输入框,一个提交按钮

   <input id="txtJson" type="text" value=""  style="width: 300px" />
   <input type="button" value="提交更新" onclick="updateData()" />

b:jquery调用提交数据:

c:界面输入数据,并准备提交数据:

d:提交后的数据结果已更新如下:

 

三:总结与示例打包下载:

 

本能过篇的介绍,能掌握 CYQ.Data 数据框架在网络通讯JSON的应用。

 

从本节的示例代码中看,应用起来是相当的简洁方便的:

Can be very easily converted to JSON from the table, at the same time can be easily reduced to a table, the table can also be converted to List <T> in the form of an entity from JSON.

 

Even based on WCF, Silverlight communications applications, is also very convenient, and everyone got off to experience the passion.

 

Finally: Sample package Download: http://www.cyqdata.com/download/article-detail-28683

Reproduced in: https: //my.oschina.net/secyaher/blog/274345

Guess you like

Origin blog.csdn.net/weixin_34409357/article/details/91967095