From db68ee28e538f1de22db27216f194d131240f901 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 23 十一月 2020 17:46:30 +0800
Subject: [PATCH] 2020-11-23-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 106 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 7630684..4ba8a9c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using Shared;
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
@@ -72,10 +73,112 @@
             //娣诲姞閿��
             dic.Add(key, value);
         }
-       
-
-        public static void InputCondition() {
+        /// <summary>
+        /// 鑾峰彇鎴块棿鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public static List<HDL_ON.Entity.Room> GetRoomList()
+        {
+            return HDL_ON.Entity.DB_ResidenceData.rooms;
         }
+        /// <summary>
+        /// 鑾峰彇璁惧鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public static List<HDL_ON.Entity.Function> GetDeviceList()
+        {
 
+            return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction();
+        }
+        /// <summary>
+        /// 鑾峰彇鎴块棿鐨勮澶囧垪琛�
+        /// </summary>
+        /// <param name="room">褰撳墠鎴块棿</param>
+        /// <returns></returns>
+        public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
+        {
+            List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>();
+            List<HDL_ON.Entity.Function> lists = GetDeviceList();
+            foreach (var dev in lists)
+            {
+                if (dev.roomIdList.Find((id) => id == room.sid) != null)
+                {
+                    deviceLists.Add(dev);
+                }
+            }
+            return deviceLists;
+        }
+        /// <summary>
+        /// 鑾峰彇璁惧
+        /// </summary>
+        /// <param name="sid">璁惧鍞竴鏍囪瘑</param>
+        /// <returns></returns>
+        public static HDL_ON.Entity.Function GetDevice(string sid)
+        {
+            HDL_ON.Entity.Function device = new Entity.Function();
+            List<HDL_ON.Entity.Function> deviceLists = GetDeviceList();
+            foreach (var dev in deviceLists)
+            {
+                if (dev.sid == sid)
+                {
+                    device = dev;
+                    break;
+                }
+            }
+            return device;
+        }
+        /// <summary>
+        /// 鑾峰彇鎴块棿鍚�(鍗虫槸=鍖哄煙鍚嶇О)
+        /// </summary>
+        /// <param name="device">璁惧</param>
+        /// <returns></returns>
+        public static string GetGetRoomName(HDL_ON.Entity.Function device)
+        {
+            string roomName = "";
+            List<HDL_ON.Entity.Room> roomLists = GetRoomList();
+
+            foreach (var dev in device.roomIdList)
+            {
+                var room = roomLists.Find((c) => c.sid == dev);
+                if (room != null)
+                {
+                    roomName += room.floorName + "." + room.name + ",";
+                }
+            }
+
+            return roomName.TrimEnd(',');
+        }
+        /// <summary>
+        /// 鑾峰彇鎴块棿鍚嶅垪琛�(鍗虫槸=鍖哄煙鍚嶇О)
+        /// </summary>
+        /// <returns></returns>
+        public static List<string> GetGetRoomNameList()
+        {
+            List<string> roomNameList = new List<string>();
+            roomNameList.Add(Language.StringByID(StringId.allAreas));
+            List<HDL_ON.Entity.Room> roomLists = GetRoomList();
+            foreach (var room in roomLists)
+            {
+                roomNameList.Add(room.name);
+            }
+
+            return roomNameList;
+        }
+        /// <summary>
+        /// 鑾峰彇鍥炬爣
+        /// </summary>
+        /// <param name="functionType">璁惧绫诲瀷</param>
+        /// <returns></returns>
+        public static string GetIconPath(FunctionType functionType) {
+            string strPath = "";
+            switch (functionType) {
+                case FunctionType.Relay: {
+                        strPath = "LogicIcon/lightloguc.png";
+                    }
+                    break;
+
+            }
+            return strPath;
+        }
     }
 }

--
Gitblit v1.8.0