From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs | 126 ++++++++++++++++++++++++++++++++++--------
1 files changed, 102 insertions(+), 24 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs
index 2914390..e7454e3 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs
@@ -146,21 +146,41 @@
}
}
- //绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘
- for (int i = 0; i < memberInfo.CurResidenceShareData.Count;)
+ //鎵�鏈夊満鏅�
+ List<Scene> allSceneList = FunctionList.List.scenes;
+ //鍏ㄥ眬鍦烘櫙鍦烘櫙
+ List<Scene> globalSceneList = new List<Scene>();
+ //鎵惧嚭鎵�鏈夌殑鍏ㄥ眬鍦烘櫙
+ foreach (var mScene in allSceneList)
{
- var sd = memberInfo.CurResidenceShareData[i];
- if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
+
+ //roomIds澶т簬0 浠h〃鍒嗛厤鍒版埧闂�
+ mScene.roomIds.Remove(null);
+ if (mScene.roomIds.Count > 0)
{
- //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
- //寰呯‘璁ゆ槸鍚﹀悓姝ヤ簯绔垹闄ゅ垎浜�
- memberInfo.CurResidenceShareData.Remove(sd);
+ //allocatedList.Add(function);
}
else
{
- i++;
+ globalSceneList.Add(mScene);
}
}
+
+ ////绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘
+ //for (int i = 0; i < memberInfo.CurResidenceShareData.Count;)
+ //{
+ // var sd = memberInfo.CurResidenceShareData[i];
+ // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null)
+ // {
+ // //new DAL.Server.HttpServerRequest().DeleteShareData(sd);
+ // //寰呯‘璁ゆ槸鍚﹀悓姝ヤ簯绔垹闄ゅ垎浜�
+ // memberInfo.CurResidenceShareData.Remove(sd);
+ // }
+ // else
+ // {
+ // i++;
+ // }
+ //}
try
{
@@ -170,7 +190,7 @@
AddRoomFunctionRowLayout(room);
}
//2020-12-16 鍔犺浇鏈垎閰嶅尯鍩熷姛鑳絉owLayout
- AddNoAreaFunctionRowLayout(unallocatedList);
+ AddNoAreaFunctionRowLayout(unallocatedList, globalSceneList);
}
catch
{
@@ -184,16 +204,17 @@
/// <param name="mRoom"></param>
void AddRoomFunctionRowLayout(Room mRoom)
{
- ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null);
+ ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null, null);
}
/// <summary>
- /// 娣诲姞鏈垎閰嶅尯鍩熷姛鑳� 鐨勪釜鏁扮粺璁$姸鎬佺殑RowLayout
+ ///
/// </summary>
/// <param name="unallocatedList">鏈垎閰嶇殑鎵�鏈夊姛鑳藉垪琛�</param>
- void AddNoAreaFunctionRowLayout(List<Function> unallocatedList)
+ /// <param name="globalSceneList">鍏ㄥ尯鍩熺殑鍦烘櫙</param>
+ void AddNoAreaFunctionRowLayout(List<Function> unallocatedList, List<Scene> globalSceneList)
{
- ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList);
+ ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList, globalSceneList);
}
/// <summary>
@@ -202,14 +223,15 @@
/// </summary>
/// <param name="room">濡傛灉鎴块棿涓虹┖锛屼唬琛ㄧ鐞嗘棤鍒嗛厤鍖哄煙</param>
/// <param name="unallocatedList">绠$悊鏃犲垎閰嶅尯鍩熸墠鏈夋晥</param>
- void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList)
+ /// <param name="globalSceneList">鍏ㄥ眬鍦烘櫙</param>
+ void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList, List<Scene> globalSceneList)
{
/// 褰撳墠鎴块棿鎴栬�呮棤鍒嗛厤鍖哄煙鍒嗕韩鍒楄〃
List<ShareData> funs_RoomAll = new List<ShareData>();
- /// <summary>
- /// 鎴块棿鎴栬�呮棤鍒嗛厤鍖哄煙鎵�鏈夊姛鑳藉垪琛�
- /// </summary>
- List<Function> roomFunctionList = new List<Function>();
+
+ /// 鎴块棿鎵�鏈夊姛鑳藉拰鑰呭満鏅垪琛�
+ List<RoomData> roomFunctionOrSceneList = new List<RoomData>();
+
/// 鎴块棿ID
string roomId = "";
@@ -264,7 +286,36 @@
{
//鏄剧ず鎴块棿鍚�
btnRoomName.Text = mRoom.roomName;
- roomFunctionList = mRoom.GetRoomFunctions(false);
+ var mRoomFunctionList = mRoom.GetRoomFunctions(false);
+ var mRoomSceneList = mRoom.GetRoomScenes(true);
+ //閬嶅巻鎵�鏈夊姛鑳藉垪琛�
+ if (mRoomFunctionList != null)
+ {
+ foreach (var fun in mRoomFunctionList)
+ {
+ roomFunctionOrSceneList.Add(new RoomData()
+ {
+ shareTypeId = fun.deviceId,
+ shareType = ShareType.DEVICE.ToString(),
+ name = fun.name,
+ });
+ }
+ }
+
+ //閬嶅巻鎵�鏈夊満鏅垪琛�
+ if (mRoomSceneList != null)
+ {
+ foreach (var roomScene in mRoomSceneList)
+ {
+ roomFunctionOrSceneList.Add(new RoomData()
+ {
+ shareTypeId = roomScene.userSceneId,
+ shareType = ShareType.SCENE.ToString(),
+ name = roomScene.name,
+ });
+ }
+ }
+
roomId = mRoom.roomId;
//娣诲姞鍒嗗壊绾�
var lineView = new LineView(roomView.Height - Application.GetRealHeight(1));
@@ -274,8 +325,35 @@
{
//鏄剧ず鏃犲尯鍩熷姛鑳�
btnRoomName.TextID = StringId.NoAreaFunction;
- roomFunctionList = unallocatedList;
roomId = null;
+
+ //閬嶅巻鎵�鏈夊姛鑳藉垪琛�
+ if (unallocatedList != null)
+ {
+ foreach (var fun in unallocatedList)
+ {
+ roomFunctionOrSceneList.Add(new RoomData()
+ {
+ shareTypeId = fun.deviceId,
+ shareType = ShareType.DEVICE.ToString(),
+ name = fun.name,
+ });
+ }
+ }
+
+ //閬嶅巻鎵�鏈夊満鏅垪琛�
+ if (globalSceneList != null)
+ {
+ foreach (var roomScene in globalSceneList)
+ {
+ roomFunctionOrSceneList.Add(new RoomData()
+ {
+ shareTypeId = roomScene.userSceneId,
+ shareType = ShareType.SCENE.ToString(),
+ name = roomScene.name,
+ });
+ }
+ }
}
//鍒犻櫎鎸夐挳
@@ -290,7 +368,7 @@
deleteBtn.MouseUpEventHandler = (sender, e) =>
{
//涓�閿垹闄ゆ墍鏈夊垎浜�
- DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView);
+ DeleteRoomAllShare(funs_RoomAll, roomFunctionOrSceneList, roomId, btnFunctionCount, roomView);
};
//璁$畻宸茬粡鍔犲叆鎴块棿鐨勮澶囨暟閲忕殑Action浜嬩欢
@@ -299,19 +377,19 @@
int addCount = 0;
foreach (var sd in memberInfo.CurResidenceShareData)
{
- if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null)
+ if (roomFunctionOrSceneList.Find((obj) => obj.shareTypeId == sd.shareTypeId) != null)
{
addCount++;
funs_RoomAll.Add(sd);
}
}
- btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString();
+ btnFunctionCount.Text = addCount + "/" + roomFunctionOrSceneList.Count.ToString();
//Utlis.WriteLine("鍒锋柊鎴愬姛");
};
//鐐瑰嚮璋冩暣浜嬩欢
EventHandler<MouseEventArgs> eHandler = (sender, e) =>
{
- var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction);
+ var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionOrSceneList, funs_RoomAll, roomId, RefreshAction);
MainPage.BasePageView.AddChidren(mmp);
mmp.LoadPage(StringId.MemberPermissionManagement);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
--
Gitblit v1.8.0