public ActionResult GetDeviceTreeForJson() { string prjGUID = this.PrjGUID; if (string.IsNullOrEmpty(prjGUID)) { return(null); } BLL.tHostInfo hiBLL = new BLL.tHostInfo(); BLL.tLightInfoes liBLL = new BLL.tLightInfoes(); List <Model.tHostInfo> hiList = hiBLL.GetModelListByPrjGUID(prjGUID); List <Model.tLightInfoes> liList; if (hiList.Count == 0) { return(null); } StringBuilder result = new StringBuilder(); result.Append("["); for (int i = 0; i < hiList.Count; i++) { Model.tHostInfo hi = hiList[i]; result.Append("{\"id\":\"" + hi.sGUID + "\","); result.Append("\"text\":\"" + hi.sName + "\","); result.Append("\"icon\":\"" + "fa fa-warning icon-state-danger" + "\","); result.Append("\"state\":{\"opened\": false},"); result.Append("\"children\":["); // 下面是子节点,注意]关闭 liList = liBLL.GetModelListByHostGUID(hi.sGUID); for (int j = 0; j < liList.Count; j++) { Model.tLightInfoes li = liList[j]; result.Append("{\"id\":\"" + li.sGUID + "\","); result.Append("\"text\":\"" + li.sName + "\","); result.Append("\"icon\":\"" + "fa fa-warning icon-state-danger" + "\"}"); if (j < liList.Count - 1) { result.Append(","); } } result.Append("]}"); if (i < hiList.Count - 1) { result.Append(","); } } result.Append("]"); return(Content(result.ToString())); }
public LightInfo(string roadID) { tLightInfo = new Model.tLightInfoes(); RoadID = roadID; }
public LightInfo(Model.tLightInfoes hi, string roadID) { tLightInfo = hi; RoadID = roadID; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LumluxSSYDB.Model.tLightInfoes model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(LumluxSSYDB.Model.tLightInfoes model) { return(dal.Add(model)); }