From 611786df5108dca0bdcff03834cc285cba4b8e61 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 13 十月 2020 16:48:43 +0800
Subject: [PATCH] 2020-10-13-1

---
 HDL_ON/Entity/Room.cs |   53 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs
index 68ca3dd..c128f9e 100644
--- a/HDL_ON/Entity/Room.cs
+++ b/HDL_ON/Entity/Room.cs
@@ -4,11 +4,28 @@
 namespace HDL_ON.Entity
 {
 
+
     /// <summary>
     /// 鎴块棿瀵硅薄
-    /// 鎴块棿鍛藉悕瑙勫垯 typeof (Room).Name + "_" + etNameBox.Text.Trim ();
     /// </summary>
-    [System.Serializable]
+    [Serializable]
+    public class Floor
+    {
+        /// <summary>
+        /// 妤煎眰鍚嶇О
+        /// </summary>
+        public string name = "1 F";
+        /// <summary>
+        /// 妤煎眰ID
+        /// </summary>
+        public string sid;
+    }
+
+
+    /// <summary>
+    /// 鎴块棿瀵硅薄
+    /// </summary>
+    [Serializable]
     public class Room
     {
         /// <summary>
@@ -19,6 +36,10 @@
         /// 鎴块棿ID
         /// </summary>
         public string sid;
+        /// <summary>
+        /// 妤煎眰绱㈠紩
+        /// </summary>
+        public string floorId = "";
 
         /// <summary>
         /// 鎴块棿鑳屾櫙
@@ -27,40 +48,40 @@
         /// <summary>
         /// 妤煎眰
         /// </summary>
-        public string floor {
+        public string floor
+        {
             get
             {
-                string str = "";
-                if (floorIndex != -1)
+                if (DB_ResidenceData.residenceData.floors.Count > 0)
                 {
-                    if (floorIndex < DB_ResidenceData.residenceData.floors.Count)
-                        str = DB_ResidenceData.residenceData.floors[floorIndex];
+                    var f = DB_ResidenceData.residenceData.floors.Find((obj) => obj.sid == floorId);
+                    if (f != null)
+                    {
+                        return f.name;
+                    }
                 }
-                return str;
+                return "";
             }
         }
-        /// <summary>
-        /// 妤煎眰绱㈠紩
-        /// </summary>
-        public int floorIndex = -1;
+
 
         /// <summary>
         /// 鎴块棿鍔熻兘鍒楄〃
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
-        public List<Function> functionData = new List<Function>();
+        public List<Function> functions = new List<Function>();
 
         public void RefreshFunctions()
         {
             List<Function> funcList = new List<Function>();
             foreach (var f in DB_ResidenceData.residenceData.functionList.functions)
             {
-                if (f.roomIdList.Contains(sid))
+                if (f.roomIdList.Contains(sid) && sid != null)
                 {
                     funcList.Add(f);
                 }
             }
-            functionData = funcList;
+            functions = funcList;
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0