public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { try { uid = res["UID"].ToString().Trim(); } catch { return(SiteHelper.GetJsonFromHashTable(null, "faild", "数据格式不正确")); } PlatformManager platformManager = new PlatformManager(); DataTable dt = platformManager.GetAllPlatformInfo(); if (dt == null || dt.Rows.Count <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "亲,没有数据了")); } else { return(JsonHelper.DataTableToJson("success", "获取数据成功", dt, "GetVehiclePlatformList")); } } }
/// <summary> /// 绑定车辆平台 /// </summary> private void BindPlatforms() { PlatformManager platformManager = new PlatformManager(); DataTable dt = new DataTable(); dt.Columns.Add("ID", Type.GetType("System.String")); dt.Columns.Add("Platform", Type.GetType("System.String")); DataRow newRow = dt.NewRow(); newRow["ID"] = "-1"; newRow["Platform"] = ""; dt.Rows.Add(newRow); DataTable platformTable = platformManager.GetAllPlatformInfo(); foreach (DataRow row in platformTable.Rows) { newRow = dt.NewRow(); newRow["ID"] = row["ID"].ToString(); newRow["Platform"] = row["Platform"]; dt.Rows.Add(newRow); } selPlatform.DataSource = dt; selPlatform.DataTextField = "Platform"; selPlatform.DataValueField = "ID"; selPlatform.DataBind(); }
private void BindPlatforms() { PlatformManager platformManager = new PlatformManager(); PlatformId.DataSource = platformManager.GetAllPlatformInfo(); PlatformId.DataTextField = "Platform"; PlatformId.DataValueField = "ID"; PlatformId.DataBind(); }