From 99253403b560f761d5f9af8b4f5140496996433a Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 20 十一月 2020 16:49:50 +0800
Subject: [PATCH] 新云端的代码Ver1.0

---
 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs |  113 ++++++++++----------------------------------------------
 1 files changed, 21 insertions(+), 92 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
index 02092c1..f1dc712 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -42,7 +42,7 @@
             base.SetTitleText(Common.Config.Instance.Home.Name);
 
             //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
+            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
             {
                 //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
                 if (Common.Config.Instance.Home.IsShowTemplate == false)
@@ -91,7 +91,7 @@
             btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
             rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
             //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
+            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
             {
                 //鍙崇澶�
                 rowHome.frameTable.AddRightArrow();
@@ -103,7 +103,7 @@
             btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
 
             //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
+            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
             {
                 rowHome.frameTable.UseClickStatu = true;
                 //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
@@ -320,7 +320,7 @@
                 form.AddForm(keys);
             };
 
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
+            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
             {
                 //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
                 if (Common.Config.Instance.Home.IsShowTemplate == true)
@@ -659,36 +659,12 @@
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
 
-            if (Common.Config.Instance.Home.IsOthreShare == false)
+            var result = HdlResidenceLogic.Current.DeleteCloundHouse(Common.Config.Instance.Home.Id);
+            if (result == false)
             {
-                //鍒犻櫎涓讳汉鑷繁鐨勪綇瀹�
-                var Pra = new DeleteResidencePra();
-                Pra.HomeId = Common.Config.Instance.Home.Id;
-                Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-
-                bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
-                if (result == false)
-                {
-                    //鍏抽棴杩涘害鏉�
-                    this.CloseProgressBar();
-                    return;
-                }
-            }
-            else
-            {
-                //鍒犻櫎鍒嗕韩鐨勪綇瀹�
-                var Pra2 = new
-                {
-                    HomeId = Common.Config.Instance.Home.Id,
-                    PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
-                };
-                bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
-                if (result == false)
-                {
-                    //鍏抽棴杩涘害鏉�
-                    this.CloseProgressBar();
-                    return;
-                }
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar();
+                return;
             }
 
             //鍥犱负鍒犻櫎鐨勬槸褰撳墠鐨勪綇瀹�,鎵�浠ラ渶瑕佸厛鍒囨崲鍒板埆鐨勪綇瀹�
@@ -697,19 +673,9 @@
             int index = 0;
             for (; index < Common.Config.Instance.HomeFilePathList.Count; index++)
             {
-                if (Common.Config.Instance.HomeFilePathList[index] == deleteFile)
+                //褰撳墠浣忓畢鎵�澶勭殑浣嶇疆(浣忓畢鏁拌偗瀹氬ぇ浜�1,涓嶇劧涓嶄細鍑虹幇鍒犻櫎鎸夐挳)
+                if (Common.Config.Instance.HomeFilePathList[index] != deleteFile)
                 {
-                    //褰撳墠浣忓畢鎵�澶勭殑浣嶇疆(浣忓畢鏁拌偗瀹氬ぇ浜�1,涓嶇劧涓嶄細鍑虹幇鍒犻櫎鎸夐挳)
-                    if (index == 0)
-                    {
-                        //鍙栦笅涓�浣�
-                        index++;
-                    }
-                    else
-                    {
-                        //鍙栧墠涓�浣�
-                        index--;
-                    }
                     break;
                 }
             }
@@ -722,7 +688,7 @@
             Common.Config.Instance.Save();
 
             //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-            bool result2 = UserCenterLogic.InitUserCenterMenmoryAndThread(false);
+            bool result2 = HdlUserCenterLogic.Current.InitUserCenterMenmoryAndThread(false);
             if (result2 == false)
             {
                 //寮�鍚簡璋冭瘯鍔熻兘
@@ -812,54 +778,17 @@
         /// <param name="addresName">浣嶇疆鍚嶇О</param>
         private void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
         {
-            //濡傛灉涓嶆槸铏氭嫙浣忓畢,鎵嶆洿鏂颁簯绔�
-            if (Common.Config.Instance.Home.IsVirtually == false)
+            //寮�鍚繘搴︽潯
+            this.ShowProgressBar();
+
+            //淇濆瓨缁忕含搴�
+            var result = HdlResidenceLogic.Current.EditorResidenceLongitudeAndLatitude(latitude, longitude, addresName);
+            this.CloseProgressBar();
+
+            if (result == false)
             {
-                //寮�鍚繘搴︽潯
-                this.ShowProgressBar();
-
-                var Pra = new EditorResidencePra();
-                Pra.HomeId = Common.Config.Instance.Home.Id;
-                Pra.Name = Common.Config.Instance.Home.Name;
-                Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-                Pra.Latitude = latitude;
-                Pra.Longitude = longitude;
-
-                //缂栬緫浣忓畢
-                bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
-                if (flage == false)
-                {
-                    //鍏抽棴杩涘害鏉�
-                    this.CloseProgressBar();
-                    return;
-                }
-                //璁剧疆鍏ㄩ儴缃戝叧鐨勪綇瀹呭湴鍧�
-                var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
-                foreach (var gateway in listGateway)
-                {
-                    ZigBee.Device.ZbGateway realWay = null;
-                    if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gateway) == false)
-                    {
-                        //閿欒:缃戝叧瀵硅薄涓㈠け
-                        continue;
-                    }
-                    var result = HdlGatewayLogic.Current.SetGatewaySite(gateway, longitude, latitude, ShowErrorMode.YES);
-                    if (result == false)
-                    {
-                        //鍏抽棴杩涘害鏉�
-                        this.CloseProgressBar();
-                        return;
-                    }
-                }
-                //鍏抽棴杩涘害鏉�
-                this.CloseProgressBar();
+                return;
             }
-
-            //淇濆瓨缂撳瓨
-            Common.Config.Instance.Home.Longitude = longitude;
-            Common.Config.Instance.Home.Latitude = latitude;
-            Common.Config.Instance.Home.ResidenceAddressName = addresName;
-            Common.Config.Instance.Home.Save();
             HdlThreadLogic.Current.RunMain(() =>
             {
                 btnLocation.Text = addresName;

--
Gitblit v1.8.0