예제 #1
0
 public string GetDeviceListByArea(QueryDevice query)
 {
     StringBuilder sbTree = new StringBuilder();
      //  var result = new ResultDevice();
      //  result.DeviceUnitList = new List<DeviceUnit>();
        List<Device> deviceList;
        if(query.ItemCode=="00000")
        {
        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
        }
        else
        {
        string itemCodeAll = query.ItemCode;
        var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
        var itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ParentID, " order by itemcodeid");
        itemCodeAll = itemcodeListChild.Aggregate(itemCodeAll, (current, itemcode) => current + ("," + itemcode.ItemcodeID));
        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
        }
        sbTree.Append("[");
        for (var device=0; device< deviceList.Count;device++)
        {
        sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
        sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
        }
        sbTree.Append("]");
     return sbTree.ToString();
 }
예제 #2
0
 public string GetDeviceListByArea(QueryDevice query)
 {
     StringBuilder sbTree = new StringBuilder();
     //  var result = new ResultDevice();
     //  result.DeviceUnitList = new List<DeviceUnit>();
     List<Device> deviceList;
     if (query.ItemCode == "00000" || string.IsNullOrEmpty(query.ItemCode))
     {
         deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
     }
     else
     {
         string itemCodeAll = query.ItemCode;
         string tempCode = string.Empty;
         var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
         var itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ItemcodeID, " order by itemcodeid");
         foreach (Model.Itemcode itemcode in itemcodeListChild)
             tempCode += ",'" + itemcode.ItemCodeNumber + "'";
         itemCodeAll = tempCode.Length > 0 ? tempCode.Substring(1) : "'" + itemCodeAll + "'";
         deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
     }
     sbTree.Append("[");
     for (var device = 0; device < deviceList.Count; device++)
     {
         sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
         sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
     }
     sbTree.Append("]");
     return sbTree.ToString();
 }
예제 #3
0
 public string GetDeviceListByArea(QueryDevice query)
 {
     return new NTS.WEB.BLL.BaseTree().GetDeviceListByArea(query);
 }