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/UI/UI0-Public/TopViewDivBLL.cs |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs b/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs
index 9ded327..51787f4 100644
--- a/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs
+++ b/HDL_ON/UI/UI0-Public/TopViewDivBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using HDL_ON.Entity;
 
 namespace HDL_ON.UI
@@ -13,10 +14,7 @@
         void LoadEvent_BackEvent()
         {
             btnBack.MouseUpEventHandler = (sender, e) => {
-                if (backAction != null)
-                {
-                    backAction();
-                }
+                backAction?.Invoke();
                 if (baseView != null)
                 {
                     baseView.RemoveFromParent();
@@ -51,22 +49,32 @@
                 case "floors":
                     Action<string> callBackAction = (floorName) =>
                     {
-                        if (DB_ResidenceData.residenceData.floors.Contains(floorName))
-                        {
-                            return;
-                        }
-                        else
-                        {
-                            DB_ResidenceData.residenceData.floors.Add(floorName);
-                            DB_ResidenceData.residenceData.SaveResidenceData();
-                            callBack("add", floorName);
-                        }
+                        callBack("add", floorName);
                     };
-                    new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors, DB_ResidenceData.residenceData.floors.Count + 1 + " F", callBackAction);
+                    string newFloorName = "1 F";
+                    for (int i = 0; i < DB_ResidenceData.residenceData.floors.Count + 1; )
+                    {
+                        newFloorName = ++i + " F";
+                        if (null == DB_ResidenceData.residenceData.floors.Find((obj)=>obj.name ==  newFloorName))
+                        {
+                            break;
+                        }
+                    }
+                    var fs = new List<string>();
+                    foreach(var f in DB_ResidenceData.residenceData.floors)
+                    {
+                        fs.Add(f.name);
+                    }
+                    new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors,newFloorName , callBackAction,StringId.FloorNameCannotBeEmpty,
+                        StringId.AddFloorFailed_FloorAlreadyExist,fs);
                     break;
                 case "rooms":
                     callBack("", "");
                     break;
+                case "Member":
+                    callBack("","");
+                    break;
+                
             }
         }
 

--
Gitblit v1.8.0