国产老熟女高潮毛片A片仙踪林,欧美喂奶吃大乳,狠狠爱无码一区二区三区,女神的私人医生动漫免费阅读

新聞建站cms系統(tǒng)、政府cms系統(tǒng)定制開(kāi)發(fā)

廣州網(wǎng)站建設(shè)公司-閱速公司

asp.net新聞發(fā)布系統(tǒng)、報(bào)紙數(shù)字報(bào)系統(tǒng)方案
/
http://www.tjsimaide.com/
廣州網(wǎng)站建設(shè)公司
您當(dāng)前位置:首頁(yè)>ASP.NET MVC

ASP.NET MVC

asp.net mvc 服務(wù)器端返回JSON

發(fā)布時(shí)間:2013/6/10 10:13:34  作者:Admin  閱讀:476  

廣告:

using System;

using System.Text;

using System.Web;

using System.Web.Mvc;

using System.Data.SqlClient;

using System.Drawing;

#region 生成文件json(也可直接輸出JSON,生成文件便于減少服務(wù)器壓力)

public void Provincefile()

{

int classid = 1; //報(bào)紙 6為雜志

if (Request.QueryString["bi"] != null && Request.QueryString["bi"].ToString() != "")

classid = int.Parse(Request.QueryString["bi"].ToString());

string wherestr = " parentid=0 ";

string sql = "select areaid,cnname,parentid,childclass from area where " + wherestr;

SqlDataReader dr = DB.DataReader(sql, null);

string areaid = "";

string cnname = "";

int total = 0;

int i = 0;

int j = 0;

string childclass = "";

StringBuilder hb = new StringBuilder();

hb.Append("{\"bk_province\": [ ");//返回bk_province表

while (dr.Read())

{

i++;

areaid = dr[0].ToString();

cnname = dr[1].ToString();

total = Mvc_areabll.Totalbk(Fun.Toint(areaid),classid);

childclass=dr[3].ToString();

if (i >1)

hb.Append(",");

hb.Append("{ \"areaid\": \"");

hb.Append(areaid);

hb.Append("\", \"cnname\": \"");

hb.Append(cnname);

hb.Append("\", \"total\": \"");

hb.Append(total);

hb.Append("\", \"childclass\": \"");

hb.Append(childclass);

hb.Append("\"");

//下面二級(jí)城市 bk_city:{....}

wherestr = " parentid=" +areaid;

sql = "select areaid,cnname,parentid,childclass from area where " + wherestr;

SqlDataReader dr2 = DB.DataReader(sql, null);

j = 0;

if (dr2.Read())

{

hb.Append(",\"bk_city\": [ ");//二級(jí)bk_city表記錄

do

{

areaid = dr2[0].ToString();

cnname = dr2[1].ToString();

total = Mvc_areabll.Totalbk(Fun.Toint(areaid), classid);

childclass = dr2[3].ToString();

if (total > 0)

{

j++;

if (j>1)

hb.Append(",");

hb.Append("{ \"cityid\": \"");

hb.Append(areaid);

hb.Append("\", \"cityname\": \"");

hb.Append(cnname);

hb.Append("\", \"citytotal\": \"");

hb.Append(total);

hb.Append("\", \"citychildclass\": \"");

hb.Append(childclass);

hb.Append("\" }");

}

 

}

while (dr2.Read());

hb.Append(" ]"); //二級(jí)bk_city表記錄

}

dr2.Close();

dr2.Dispose();

//二級(jí)城市 bk_city finish

hb.Append(" }");

 

}

dr.Close();

dr.Dispose();

hb.Append(" ] }"); //返回表名

string filestr = hb.ToString();

//生成json文件

string filename = "";

if (classid == 1)

filename = "bk_province.json";

else

filename = "mag_province.json";

string filename1 = Server.MapPath(Fun.Webdirectory + Fun.Savedata() + "/json/" + filename);

// Response.Write(filestr);

Mvccom.Funs.SaveFile(filestr, filename1);

Response.Write("ok");

hb = null;

return;

}

#endregion

 

using System;

using System.Globalization;

using System.Text;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.IO;

#region 保存為文件方法

public static void SaveFile(string filecon, string fileName)

{

FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);

byte[] byteData = Encoding.UTF8.GetBytes(filecon);

fs.Write(byteData, 0, byteData.Length);

fs.Close();

fs.Dispose();

}

#endregion

廣告:

相關(guān)文章
asp.net mvc
JSON
cms新聞系統(tǒng)購(gòu)買(mǎi)咨詢
掃描關(guān)注 廣州閱速軟件科技有限公司
掃描關(guān)注 廣州閱速科技
主站蜘蛛池模板: 洪泽县| 登封市| 安吉县| 合川市| 临猗县| 杭州市| 开阳县| 福海县| 桦甸市| 社旗县| 上林县| 岳阳县| 景宁| 平乡县| 紫金县| 长沙县| 衡东县| 曲沃县| 肃宁县| 前郭尔| 沐川县| 平邑县| 建阳市| 翁牛特旗| 轮台县| 江孜县| 三亚市| 日照市| 博客| 宾川县| 鹤庆县| 鸡泽县| 拜城县| 丰都县| 靖安县| 兴安盟| 张家界市| 开封市| 洛浦县| 洛川县| 西峡县|