Example #1
0
        public string JsonToDataTable2()
        {
            DataTable dt = new DataTable();

            webservice_helloworld.show_helloworld show_hello = new webservice_helloworld.show_helloworld();
            //return show_hello.getSwlbjk("11");
            return(show_hello.TestData());
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webservice_helloworld.show_helloworld show_hello = new webservice_helloworld.show_helloworld();
            string from_service_str = show_hello.HelloWorld("褚博凡");

            Response.Write(from_service_str);
            Response.Write(JsonToDataTable2());
            JsonToDataTable1();
        }
Example #3
0
        public DataTable get_sw_list()
        {
            webservice_helloworld.show_helloworld show_helloworld = new webservice_helloworld.show_helloworld();
            string jsonStr = show_helloworld.getSwlbjk("1");
            //反序列化
            WaterClass waterClassObject = JLcms.Common.JsonHelper.FromJson <WaterClass>(jsonStr);
            DataTable  dt_waterinfo     = new DataTable();

            dt_waterinfo.Columns.Add("name");
            dt_waterinfo.Columns.Add("water_deep");
            foreach (WaterData w in waterClassObject.data)
            {
                string  name       = w.DEPARTMENT;
                string  water_deep = w.LASTWATERLEVEL;
                DataRow row        = dt_waterinfo.NewRow();
                row["name"]       = name;
                row["water_deep"] = water_deep;
                dt_waterinfo.Rows.Add(row);
            }
            return(dt_waterinfo);
        }