• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

csharp:LearnhowtopostJSONstringtogenericHandlerusingjQueryinASP.NetC#.

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
 /// <summary>
    ///參考: http://james.newtonking.com/json/help/index.html#
    /// 塗聚文(Geovin Du) 20141228
    /// 捷為工作室
    /// </summary>
    public partial class _Default : System.Web.UI.Page
    {
        Geovindu_TimeLineProjectInfo geovindu_TimeLineProjectInfo = new Geovindu_TimeLineProjectInfo();
        Geovindu_TimeLineProjectBLL geovindu_TimeLineProjectBLL = new Geovindu_TimeLineProjectBLL();
        Geovindu_TimeLineAssetInfo geovindu_TimeLineAssetProjectInfo = new Geovindu_TimeLineAssetInfo();

        List<Geovindu_TimeLineDataInfo> selectGeovindu_TimeLineDataProject = new List<Geovindu_TimeLineDataInfo>();

        Geovindu_TimeLineDataInfo geovindu_TimeLineDataInfo = new Geovindu_TimeLineDataInfo();
        Geovindu_TimeLineAssetInfo geovindu_TimeLineAssetDataInfo = new Geovindu_TimeLineAssetInfo();

        Geovindu_TimeLineAssetBLL geovindu_TimeLineAssetBLL = new Geovindu_TimeLineAssetBLL();
        Geovindu_TimeLineDataBLL geovindu_TimeLineDataBLL = new Geovindu_TimeLineDataBLL();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                geovindu_TimeLineProjectInfo = geovindu_TimeLineProjectBLL.SelectGeovindu_TimeLineProject(1);
                geovindu_TimeLineAssetProjectInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetProject(1);
                selectGeovindu_TimeLineDataProject = geovindu_TimeLineDataBLL.SelectGeovindu_TimeLineDataProject(1);
                for (int i = 0; i < selectGeovindu_TimeLineDataProject.Count; i++)
                {
                    selectGeovindu_TimeLineDataProject[i].TimeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(selectGeovindu_TimeLineDataProject[i].TimeDataID);
                }

                //context.Response.ContentType = "text/plain";
                //context.Response.Write("Hello World");
                geovindu_TimeLineProjectInfo = geovindu_TimeLineProjectBLL.SelectGeovindu_TimeLineProject(1);
                geovindu_TimeLineAssetProjectInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetProject(1);
                selectGeovindu_TimeLineDataProject = geovindu_TimeLineDataBLL.SelectGeovindu_TimeLineDataProject(1);
                for (int i = 0; i < selectGeovindu_TimeLineDataProject.Count; i++)
                {
                    selectGeovindu_TimeLineDataProject[i].TimeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(selectGeovindu_TimeLineDataProject[i].TimeDataID);
                }

                JObject rss =
                new JObject(
                    new JProperty("timeline",
                        new JObject(
                            new JProperty("headline", geovindu_TimeLineProjectInfo.TimeHeadline),
                            new JProperty("type", geovindu_TimeLineProjectInfo.TimeType),
                            new JProperty("text", geovindu_TimeLineProjectInfo.TimeText),
                            new JProperty("startDate", geovindu_TimeLineProjectInfo.TimeStartDate.ToString("yyyy,MM,dd")),
                            new JProperty("asset",
                                new JObject(
                                     new JProperty("media", geovindu_TimeLineAssetProjectInfo.TimeAssetMedia),
                                     new JProperty("credit", geovindu_TimeLineAssetProjectInfo.TimeAssetCredit),
                                     new JProperty("caption", geovindu_TimeLineAssetProjectInfo.TimeAssetCaption))),
                                     new JProperty("date",
                                    from p in selectGeovindu_TimeLineDataProject
                                    orderby p.TimeDataHeadline
                                    select new JObject(
                                        new JProperty("startDate", p.TimeDataStartDate.ToString("yyyy,MM,dd")),
                                        new JProperty("headline", p.TimeDataHeadline),
                                        new JProperty("text", p.TimeDataText),
                                        new JProperty("asset",
                                            new JObject(
                                        //geovindu_TimeLineAssetDataInfo=geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(p.TimeDataID)
                                                 new JProperty("media", p.TimeLineDataAssetInfo.TimeAssetMedia),
                                                 new JProperty("credit", p.TimeLineDataAssetInfo.TimeAssetCredit),
                                                 new JProperty("caption", p.TimeLineDataAssetInfo.TimeAssetCaption)

                                                )))))));
                Response.Write(rss.ToString());
                File.WriteAllText(Server.MapPath("geovindu.json"), rss.ToString());

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message.ToString());
            }



        }
    }
}

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
怎么运行ASP.NETCore控制台程序发布时间:2022-07-10
下一篇:
asp.net防止页面滚动的两个方法发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap