From cd1029a11d96f55337430cec97b7d4cd510f5d5f Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 17 十二月 2020 15:09:38 +0800 Subject: [PATCH] 2020-12-17 1.成员管理UI还原度修改。2.增加右键删除。3.增加无区域功能管理。 --- HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs | 2 HDL-ON_iOS/Resources/Language.ini | 4 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs | 235 +++++++----------- HDL-ON_Android/Assets/Language.ini | 4 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs | 77 +++--- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 1 HDL_ON/Common/R.cs | 10 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs | 150 +++++++----- HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs | 165 +++++++++++++ .vs/HDL_APP_Project/xs/UserPrefs.xml | 27 + 10 files changed, 418 insertions(+), 257 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 6cdeb77..bbbe054 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,26 +1,45 @@ -锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> +锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs" Line="66" Column="1" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs" Line="313" Column="39" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs" Line="144" Column="46" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberManagementPage.cs" Line="228" Column="39" /> + <File FileName="HDL_ON/Common/R.cs" Line="148" Column="26" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> + <Node name="Common" expanded="True" /> + <Node name="DAL" expanded="True"> + <Node name="DriverLayer" expanded="True" /> + <Node name="Server" expanded="True" /> + </Node> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> + <Node name="ResponseEntity" expanded="True" /> + </Node> <Node name="UI" expanded="True"> <Node name="UI0-Public" expanded="True" /> <Node name="UI2" expanded="True"> <Node name="4-PersonalCenter" expanded="True"> <Node name="MemberManagement" expanded="True"> - <Node name="MemberPermissionPage.cs" selected="True" /> + <Node name="MemberFunctionPermissionPage.cs" selected="True" /> </Node> + </Node> + <Node name="FuntionControlView" expanded="True"> + <Node name="Light" expanded="True" /> </Node> </Node> </Node> </Node> + <Node name="HDL-ON_Android" expanded="True"> + <Node name="Assets" expanded="True" /> + </Node> <Node name="HDL-ON_iOS" expanded="True"> + <Node name="References" expanded="True" /> <Node name="Resources" expanded="True" /> </Node> </Node> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index ba91db0..29cc253 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -273,7 +273,7 @@ 251=娣诲姞澶辫触锛屾潈闄愪笉瓒炽�� 252=淇濆瓨鎴愬姛 253=淇濆瓨涓紝璇风◢鍚� -254=淇敼鎴愬憳鏄电О +254=鏄电О缂栬緫 255=绉婚櫎璇ユ垚鍛� 256=鏆傛棤宸叉敹钘忕殑鍔熻兘 257=璇疯緭鍏ュ唴瀹� @@ -576,6 +576,8 @@ 9056=骞� 9057=鏃犲尯鍩熷姛鑳� 9058=鏄惁闇�瑕佷繚瀛� +9059=鏆傛棤鍒嗕韩 +9060=浣跨敤鏉冮檺 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index ba91db0..29cc253 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -273,7 +273,7 @@ 251=娣诲姞澶辫触锛屾潈闄愪笉瓒炽�� 252=淇濆瓨鎴愬姛 253=淇濆瓨涓紝璇风◢鍚� -254=淇敼鎴愬憳鏄电О +254=鏄电О缂栬緫 255=绉婚櫎璇ユ垚鍛� 256=鏆傛棤宸叉敹钘忕殑鍔熻兘 257=璇疯緭鍏ュ唴瀹� @@ -576,6 +576,8 @@ 9056=骞� 9057=鏃犲尯鍩熷姛鑳� 9058=鏄惁闇�瑕佷繚瀛� +9059=鏆傛棤鍒嗕韩 +9060=浣跨敤鏉冮檺 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index a885d78..0794dc3 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -145,7 +145,7 @@ public const int EditNickname = 237; public const int NicknameCannotBeEmpty = 236; public const int CreateScene = 235; - public const int PermissionToUse = 234; + public const int MemberPermissionManagement = 234; public const int Nickname = 233; public const int MemberManagement = 232; public const int OtherArea = 231; @@ -750,6 +750,14 @@ /// 鏄惁闇�瑕佷繚瀛� /// </summary> public const int IfNeedToSave = 9058; + /// <summary> + /// 鏆傛棤鍒嗕韩 + /// </summary> + public const int NoShare = 9059; + /// <summary> + /// 浣跨敤鏉冮檺 + /// </summary> + public const int PermissionToUse = 9060; #region 缃戠粶璇锋眰鍝嶅簲閿欒鎻愮ず淇℃伅 diff --git a/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs b/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs index 3759f66..2c1680d 100644 --- a/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs +++ b/HDL_ON/Entity/ResponseEntity/ResidenceMemberInfo.cs @@ -38,7 +38,7 @@ /// <summary> /// 瀛愯处鍙疯幏寰楃殑褰撳墠浣忓畢鐨勫姛鑳芥暟鎹� /// </summary> - public List<ShareData> CurResidenceShareDate = new List<ShareData>(); + public List<ShareData> CurResidenceShareData = new List<ShareData>(); /// <summary> /// diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs index 172eb57..b47c385 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs @@ -31,44 +31,53 @@ ResidenceMemberInfo memberInfo; - Room room; - - Action<string> refreshFunctionCount; + /// <summary> + /// 褰撳墠鐨勬埧闂磖oomId + /// 濡傛灉涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘鍒嗕韩 + /// </summary> + string roomId; + /// <summary> + /// 鎴块棿鎵�鏈夊姛鑳藉垪琛� + /// </summary> + List<Function> roomFunctionList = new List<Function>(); /// <summary> - /// 涔嬪墠鐨勫垎浜垪琛� + /// 鍒锋柊鍥炶皟Action /// </summary> - List<ShareData> funs; + Action refreshAction; + /// <summary> + /// 褰撳墠璐﹀彿鐨勬墍鏈夊垎浜垪琛� + /// </summary> + List<ShareData> curResidenceShareData; /// <summary> /// 灞炰簬褰撳墠鎴块棿鏈�缁堢殑璁惧鍒嗕韩鍒楄〃 /// </summary> - List<ShareData> funs_New; + List<ShareData> funs_RoomAll; + //shareDataList = new List<ShareData>(); /// <summary> /// 鍒犻櫎鐨勫垎浜垪琛� /// </summary> List<ShareData> funs_Del; - public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r, Action<string> action) + /// <summary> + /// + /// </summary> + /// <param name="mInfo"></param> + /// <param name="roomFunctionList"></param> + /// <param name="roomId"></param> + /// <param name="refreshAction"></param> + public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<Function> roomFunctionList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction) { bodyView = this; - memberInfo = mInfo; - room = r; - funs = new List<ShareData>(); - funs = memberInfo.CurResidenceShareDate; - funs_New = new List<ShareData>(); - funs_Del = new List<ShareData>(); - - refreshFunctionCount = action; - } - - public MemberFunctionPermissionPage(Room r,List<ShareData> sd) - { - bodyView = this; - room = r; - funs = new List<ShareData>(); - funs_New = sd; - funs_Del = new List<ShareData>(); - memberInfo = new ResidenceMemberInfo(); + this.memberInfo = mInfo; + this.roomFunctionList = roomFunctionList; + this.roomId = roomId; + //this.curResidenceShareData = new List<ShareData>(); + this.curResidenceShareData = memberInfo.CurResidenceShareData; + this.funs_RoomAll = new List<ShareData>(); + this.funs_RoomAll.AddRange(funs_RoomAll); + this.funs_Del = new List<ShareData>(); + this.refreshAction = refreshAction; } public void LoadPage(int tId) @@ -132,7 +141,7 @@ BackgroundColor = CSS_Color.MainColor, TextAlignment = TextAlignment.Center, TextColor = CSS_Color.MainBackgroundColor, - TextID = titleId == StringId.PermissionToUse ? StringId.Confirm : StringId.Shared, + TextID = titleId == StringId.MemberPermissionManagement ? StringId.Confirm : StringId.Shared, TextSize = CSS_FontSize.SubheadingFontSize, IsBold = true, Radius = (uint)Application.GetRealWidth(22), @@ -141,23 +150,17 @@ }; bodyView.AddChidren(btnOption); - if(titleId == StringId.PermissionToUse) - { - LoadFunctionRow(funs); - } - else - { - LoadFunctionRow(funs_New); - } + LoadFunctionRow(funs_RoomAll); + LoadEventList(); } /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃 /// </summary> - void LoadFunctionRow(List<ShareData> shareDatas) + void LoadFunctionRow(List<ShareData> shareDatas) { contentView.RemoveAll(); - foreach (var function in room.GetRoomFunctions(false)) + foreach (var function in roomFunctionList) { var roomView = new FrameLayout() { @@ -195,7 +198,7 @@ { btnChoose.IsSelected = true; //鍒锋柊灞炰簬褰撳墠鎴块棿鐨勫垎浜粺璁� - funs_New.Add(shareData); + //funs_New.Add(shareData); } else { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs index 5c98269..ee44a30 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPageBLL.cs @@ -22,24 +22,31 @@ { btnOption.MouseUpEventHandler = (sender, e) => { - if (titleId == StringId.PermissionToUse)//浠庝釜浜轰腑蹇冭繘鍏ュ崟鐙垎浜� + Action action = () => { - Action action = () => - { - UploadShareDeviceList(); - }; - //鏄惁闇�瑕佷繚瀛� - new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); - } - else - { - //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New)); - //2020-12-01 灞忚斀椤甸潰 - //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo); - //MainPage.BasePageView.AddChidren(page); - //page.LoadPage(); - //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } + UploadShareDeviceList(); + }; + //鏄惁闇�瑕佷繚瀛� + new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); + + //if (titleId == StringId.PermissionToUse)//浠庝釜浜轰腑蹇冭繘鍏ュ崟鐙垎浜� + //{ + // Action action = () => + // { + // UploadShareDeviceList(); + // }; + // //鏄惁闇�瑕佷繚瀛� + // new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); + //} + //else + //{ + // //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New)); + // //2020-12-01 灞忚斀椤甸潰 + // //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo); + // //MainPage.BasePageView.AddChidren(page); + // //page.LoadPage(); + // //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //} }; } @@ -60,32 +67,12 @@ act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); }); - //1.绠$悊鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩 - if (funs_New != null && funs_New.Count > 0) + if (!string.IsNullOrEmpty(roomId)) { - //鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩澶т簬0 - var success = ShareRoom(); - if (success) - { - Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩鎴愬姛"); - } - else - { - Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩澶辫触"); - } + //濡傛灉鎴块棿ID涓嶄负绌猴紝绠$悊鎴块棿 + ManageRoomSharing(); } - else - { - var success = DeleteShareRoom(); - if (success) - { - Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩鎴愬姛"); - } - else - { - Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩澶辫触"); - } - } + //2.鎵归噺鍒犻櫎鍒嗕韩 var deleteShareObj = new DeleteShareObj() @@ -97,9 +84,9 @@ //3.鎵归噺涓婁紶 var funs_NeedAdd = new List<ShareData>(); - foreach (var f in funs_New) + foreach (var f in funs_RoomAll) { - var sd = funs.Find((obj) => obj.shareTypeId == f.shareTypeId); + var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.shareTypeId); //濡傛灉璇ュ姛鑳藉凡缁忓垎浜紝涓嶇敤鍒嗕韩 if (null == sd) { @@ -133,7 +120,7 @@ { //4.1绠$悊鏈�缁堢殑鍒嗕韩鍒楄〃 var funs_final = new List<ShareData>(); - funs_final.AddRange(funs); + funs_final.AddRange(curResidenceShareData); //4.2绉婚櫎鍒犻櫎鐨� foreach (var share_d in funs_Del) { @@ -150,14 +137,13 @@ Application.RunOnMainThread(() => { new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.FunctionSharingSucceeded), true); - memberInfo.CurResidenceShareDate = funs_final; + memberInfo.CurResidenceShareData = funs_final; }); Thread.Sleep(1600); Application.RunOnMainThread(() => { - //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); - refreshFunctionCount?.Invoke(funs_New.Count.ToString()); + refreshAction?.Invoke(); }); } } @@ -208,6 +194,42 @@ } /// <summary> + /// 绠$悊鎴块棿鍒嗕韩鎿嶄綔 + /// funs_New 澶т簬1鍒嗕韩鎴块棿 + /// </summary> + bool ManageRoomSharing() + { + bool success = false; + //1.绠$悊鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩 + if (funs_RoomAll != null && funs_RoomAll.Count > 0) + { + //鏈�缁堝睘浜庢埧闂寸殑鍒嗕韩澶т簬0 + success = ShareRoom(); + if (success) + { + Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩鎴愬姛"); + } + else + { + Utlis.WriteLine("娣诲姞鎴块棿鍒嗕韩澶辫触"); + } + } + else + { + success = DeleteShareRoom(); + if (success) + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩鎴愬姛"); + } + else + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩澶辫触"); + } + } + return success; + } + + /// <summary> /// 鍒嗕韩鎴块棿 /// </summary> /// <returns></returns> @@ -217,7 +239,7 @@ roomList.Add(new ShareData() { shareType = ShareType.ROOM.ToString(), - shareTypeId = room.roomId + shareTypeId = roomId }); List<string> childAccountIds = new List<string>(); childAccountIds.Add(memberInfo.childAccountId); @@ -248,7 +270,7 @@ roomList.Add(new ShareData() { shareType = ShareType.ROOM.ToString(), - shareTypeId = room.roomId + shareTypeId = roomId }); var deleteShareObj = new DeleteShareObj() @@ -279,16 +301,16 @@ EventHandler<MouseEventArgs> eventHandler = (sender, e) => { btnChoose.IsSelected = !btnChoose.IsSelected; - var sd = funs.Find((obj) => obj.shareTypeId == function.deviceId); + var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == function.deviceId); if (btnChoose.IsSelected) { try { if (null != sd) { - if (!funs_New.Contains(sd)) + if (!funs_RoomAll.Contains(sd)) { - funs_New.Add(sd); + funs_RoomAll.Add(sd); } if (funs_Del.Contains(sd)) { @@ -300,12 +322,12 @@ var newSd = new ShareData(); newSd.shareTypeId = function.deviceId; - funs_New.Add(newSd); + funs_RoomAll.Add(newSd); } btnChooseAll.IsSelected = true; - foreach (var f in room.GetRoomFunctions(false)) + foreach (var f in roomFunctionList) { - if (funs_New.Find((obj) => obj.shareTypeId == f.deviceId) == null) + if (funs_RoomAll.Find((obj) => obj.shareTypeId == f.deviceId) == null) { btnChooseAll.IsSelected = false; break; @@ -319,10 +341,10 @@ } else { - var onFuns = funs_New.Find((obj) => obj.shareTypeId == function.deviceId); - if (funs_New.Contains(onFuns)) + var onFuns = funs_RoomAll.Find((obj) => obj.shareTypeId == function.deviceId); + if (funs_RoomAll.Contains(onFuns)) { - funs_New.Remove(onFuns); + funs_RoomAll.Remove(onFuns); } if (null != sd) @@ -349,28 +371,28 @@ { btnChooseAll.IsSelected = !btnChooseAll.IsSelected; funs_Del = new List<ShareData>(); - funs_New = new List<ShareData>(); + funs_RoomAll = new List<ShareData>(); if (btnChooseAll.IsSelected) { - foreach (var f in room.GetRoomFunctions(false)) + foreach (var f in roomFunctionList) { var ssdd = new ShareData(); ssdd.shareTypeId = f.deviceId; - funs_New.Add(ssdd); + funs_RoomAll.Add(ssdd); } } else { - foreach (var f in room.GetRoomFunctions(false)) + foreach (var f in roomFunctionList) { - var sd = funs.Find((obj) => obj.shareTypeId == f.deviceId); + var sd = curResidenceShareData.Find((obj) => obj.shareTypeId == f.deviceId); if (sd != null) { funs_Del.Add(sd); } } } - LoadFunctionRow(funs_New); + LoadFunctionRow(funs_RoomAll); }; btnChooseAll.MouseUpEventHandler = eventHandler; allRoomView.MouseUpEventHandler = eventHandler; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs index dea9002..9798f7e 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPage.cs @@ -4,11 +4,12 @@ using HDL_ON.Entity; using System.Collections.Generic; using HDL_ON.DAL; +using HDL_ON.DAL.Server; namespace HDL_ON.UI { /// <summary> - /// 浣跨敤鏉冮檺椤甸潰 + /// 鎴愬憳鏉冮檺绠$悊椤甸潰 /// </summary> public partial class MemberPermissionPage : FrameLayout { @@ -30,7 +31,7 @@ public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView(); + new TopViewDiv(bodyView, Language.StringByID(StringId.MemberPermissionManagement)).LoadTopView(); FrameLayout headPortraitView = new FrameLayout() { @@ -131,6 +132,7 @@ List<Function> allFunctionList = FunctionList.List.GetDeviceFunctionList(); //鏈垎閰嶅尯鍩熺殑鍔熻兘 List<Function> unallocatedList = new List<Function>(); + // foreach (var function in allFunctionList) { function.roomIds.Remove(null); @@ -145,14 +147,14 @@ } //绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘 - for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) + for (int i = 0; i < memberInfo.CurResidenceShareData.Count;) { - var sd = memberInfo.CurResidenceShareDate[i]; + var sd = memberInfo.CurResidenceShareData[i]; if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) { //new DAL.Server.HttpServerRequest().DeleteShareData(sd); //寰呯‘璁ゆ槸鍚﹀悓姝ヤ簯绔垹闄ゅ垎浜� - memberInfo.CurResidenceShareDate.Remove(sd); + memberInfo.CurResidenceShareData.Remove(sd); } else { @@ -160,118 +162,57 @@ } } - foreach (var room in SpatialInfo.CurrentSpatial.RoomList) + try { - var roomView = new RowLayout() + //閬嶅巻鍔犺浇鎴块棿鍒嗕韩涓暟缁熻鐘舵�丷owLayout + foreach (var room in SpatialInfo.CurrentSpatial.RoomList) { - Height = Application.GetRealWidth(50), - BackgroundColor = CSS_Color.MainBackgroundColor, - LineColor = CSS_Color.MainBackgroundColor, - }; - roomListView.AddChidren(roomView); - - var btnRoomName = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(4), - Width = Application.GetRealWidth(330), - Height = Application.GetRealWidth(24), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - Text = room.roomName, - }; - roomView.AddChidren(btnRoomName); - - //璁$畻宸茬粡鍔犲叆鎴块棿鐨勮澶囨暟閲� - int addCount = 0; - foreach (var sd in memberInfo.CurResidenceShareDate) - { - if (room.GetRoomFunctions(false).Find((obj) => obj.deviceId == sd.shareTypeId) != null) - { - addCount++; - } + AddRoomFunctionRowLayout(room); } - ////绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘 - //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) - //{ - // var sd = memberInfo.CurResidenceShareDate[i]; - // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) - // { - // //new DAL.Server.HttpServerRequest().DeleteShareData(sd); - // memberInfo.CurResidenceShareDate.Remove(sd); - // } - // else - // { - // i++; - // } - //} - - var btnFunctionCount = new Button() - { - X = Application.GetRealWidth(16), - Y = btnRoomName.Bottom, - Width = Application.GetRealWidth(330), - Height = Application.GetRealWidth(18), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(), - }; - roomView.AddChidren(btnFunctionCount); - - var btnRight = new Button() - { - X = Application.GetRealWidth(351), - Gravity = Gravity.CenterVertical, - Width = Application.GetMinRealAverage(16), - Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/Right.png", - }; - roomView.AddChidren(btnRight); - //鍒嗗壊绾� - var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); - roomView.AddChidren(lineView); - //鍒犻櫎鎸夐挳 - var deleteBtn = new Button() - { - TextID = StringId.Del, - BackgroundColor = CSS_Color.AuxiliaryColor2, - TextColor = CSS_Color.MainBackgroundColor, - TextSize = CSS_FontSize.TextFontSize, - }; - roomView.AddRightView(deleteBtn); - deleteBtn.MouseUpEventHandler = (sender, e) => - { - //鍒犻櫎浜嬩欢 - }; - - EventHandler<MouseEventArgs> eHandler = (sender, e) => - { - Action<string> refreshFunctionCount = (newCount) => { - btnFunctionCount.Text = newCount + "/" + room.GetRoomFunctions(false).Count.ToString(); - }; - var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount); - MainPage.BasePageView.AddChidren(mmp); - mmp.LoadPage(StringId.PermissionToUse); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - roomView.MouseUpEventHandler = eHandler; - btnRoomName.MouseUpEventHandler = eHandler; - btnRight.MouseUpEventHandler = eHandler; - btnFunctionCount.MouseUpEventHandler = eHandler; + //2020-12-16 鍔犺浇鏈垎閰嶅尯鍩熷姛鑳絉owLayout + AddNoAreaFunctionRowLayout(unallocatedList); } - - //2020-12-16 鍔犺浇鏈垎閰嶅尯鍩熷姛鑳� - AddNoAreaFunction(unallocatedList); + catch + { + Utlis.WriteLine("AddRoomFunctionRowLayout error"); + } } /// <summary> - /// 娣诲姞鏈垎閰嶅尯鍩熷姛鑳� + /// 娣诲姞鎴块棿鍒嗕韩涓暟缁熻鐘舵�佺殑RowLayout /// </summary> - /// <param name="unallocatedList"></param> - void AddNoAreaFunction(List<Function> unallocatedList) + /// <param name="mRoom"></param> + void AddRoomFunctionRowLayout(Room mRoom) { + ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null); + } + + /// <summary> + /// 娣诲姞鏈垎閰嶅尯鍩熷姛鑳� 鐨勪釜鏁扮粺璁$姸鎬佺殑RowLayout + /// </summary> + /// <param name="unallocatedList">鏈垎閰嶇殑鎵�鏈夊姛鑳藉垪琛�</param> + void AddNoAreaFunctionRowLayout(List<Function> unallocatedList) + { + ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList); + } + + /// <summary> + /// 2020-12-17 閲嶆柊璋冩暣 + /// 娣诲姞鎴块棿鍒嗕韩鎴栬�呮棤鍖哄煙鍒嗛厤 涓暟缁熻鐘舵�佺殑RowLayout + /// </summary> + /// <param name="room">濡傛灉鎴块棿涓虹┖锛屼唬琛ㄧ鐞嗘棤鍒嗛厤鍖哄煙</param> + /// <param name="unallocatedList">绠$悊鏃犲垎閰嶅尯鍩熸墠鏈夋晥</param> + void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList) + { + /// 褰撳墠鎴块棿鎴栬�呮棤鍒嗛厤鍖哄煙鍒嗕韩鍒楄〃 + List<ShareData> funs_RoomAll = new List<ShareData>(); + /// <summary> + /// 鎴块棿鎴栬�呮棤鍒嗛厤鍖哄煙鎵�鏈夊姛鑳藉垪琛� + /// </summary> + List<Function> roomFunctionList = new List<Function>(); + /// 鎴块棿ID + string roomId = ""; + var roomView = new RowLayout() { Height = Application.GetRealWidth(50), @@ -289,33 +230,25 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - TextID = StringId.NoAreaFunction + //Text = room.roomName, }; roomView.AddChidren(btnRoomName); - //璁$畻宸茬粡鍔犲叆鎴块棿鐨勮澶囨暟閲� - int addCount = 0; - foreach (var sd in memberInfo.CurResidenceShareDate) + //濡傛灉鎴块棿涓虹┖锛屼唬琛ㄧ鐞嗘棤鍒嗛厤鍖哄煙 + if (mRoom != null) { - if (unallocatedList.Find((obj) => obj.deviceId == sd.shareTypeId) != null) - { - addCount++; - } + //鏄剧ず鎴块棿鍚� + btnRoomName.Text = mRoom.roomName; + roomFunctionList = mRoom.GetRoomFunctions(false); + roomId = mRoom.roomId; } - ////绉婚櫎褰撳墠浣忓畢宸茬粡涓嶅瓨鍦ㄧ殑鍔熻兘 - //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) - //{ - // var sd = memberInfo.CurResidenceShareDate[i]; - // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) - // { - // //new DAL.Server.HttpServerRequest().DeleteShareData(sd); - // memberInfo.CurResidenceShareDate.Remove(sd); - // } - // else - // { - // i++; - // } - //} + else + { + //鏄剧ず鏃犲尯鍩熷姛鑳� + btnRoomName.TextID = StringId.NoAreaFunction; + roomFunctionList = unallocatedList; + roomId = null; + } var btnFunctionCount = new Button() { @@ -326,7 +259,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - Text = addCount + "/" + unallocatedList.Count.ToString(), + //Text = addCount + "/" + room.GetRoomFunctions(false).Count.ToString(), }; roomView.AddChidren(btnFunctionCount); @@ -339,9 +272,9 @@ UnSelectedImagePath = "Public/Right.png", }; roomView.AddChidren(btnRight); - ////鍒嗗壊绾� - //var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); - //roomView.AddChidren(lineView); + //鍒嗗壊绾� + var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); + roomView.AddChidren(lineView); //鍒犻櫎鎸夐挳 var deleteBtn = new Button() { @@ -353,25 +286,41 @@ roomView.AddRightView(deleteBtn); deleteBtn.MouseUpEventHandler = (sender, e) => { - //鍒犻櫎浜嬩欢 + //涓�閿垹闄ゆ墍鏈夊垎浜� + DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView); }; + //璁$畻宸茬粡鍔犲叆鎴块棿鐨勮澶囨暟閲忕殑Action浜嬩欢 + Action RefreshAction = () => { + funs_RoomAll = new List<ShareData>(); + int addCount = 0; + foreach (var sd in memberInfo.CurResidenceShareData) + { + if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null) + { + addCount++; + funs_RoomAll.Add(sd); + } + } + btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString(); + //Utlis.WriteLine("鍒锋柊鎴愬姛"); + }; + //鐐瑰嚮璋冩暣浜嬩欢 EventHandler<MouseEventArgs> eHandler = (sender, e) => { - Action<string> refreshFunctionCount = (newCount) => { - btnFunctionCount.Text = newCount + "/" + unallocatedList.Count.ToString(); - }; - //var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount); - //MainPage.BasePageView.AddChidren(mmp); - //mmp.LoadPage(StringId.PermissionToUse); - //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction); + MainPage.BasePageView.AddChidren(mmp); + mmp.LoadPage(StringId.MemberPermissionManagement); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; roomView.MouseUpEventHandler = eHandler; btnRoomName.MouseUpEventHandler = eHandler; btnRight.MouseUpEventHandler = eHandler; btnFunctionCount.MouseUpEventHandler = eHandler; - + RefreshAction?.Invoke(); } + + } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs index 20943bd..5018a0f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberPermissionPageBLL.cs @@ -1,6 +1,8 @@ 锘縰sing System; using System.Collections.Generic; +using System.Threading; using HDL_ON.DAL.Server; +using HDL_ON.Entity; using Shared; namespace HDL_ON.UI @@ -40,16 +42,16 @@ var responePack = new HttpServerRequest().GetShareDataByMemberAccount(memberInfo.childAccountId); if (responePack.Code == StateCode.SUCCESS) { - if(responePack.Data != null) + if (responePack.Data != null) { var responeObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ShareData>>(responePack.Data.ToString()); - memberInfo.CurResidenceShareDate = responeObj; + memberInfo.CurResidenceShareData = responeObj; } else { - memberInfo.CurResidenceShareDate = new List<ShareData>(); + memberInfo.CurResidenceShareData = new List<ShareData>(); } - + Application.RunOnMainThread(() => { ShowRoomListView(); @@ -57,7 +59,7 @@ } else { - memberInfo.CurResidenceShareDate = new List<ShareData>(); + memberInfo.CurResidenceShareData = new List<ShareData>(); IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); } } @@ -125,5 +127,158 @@ { IsBackground = true }.Start(); } + + /// <summary> + /// 涓�閿垹闄ゅ綋鍓嶆埧闂存墍鏈夊垎浜� + /// </summary> + /// <param name="funs_Del">闇�瑕佷竴閿垹闄ょ殑鍒嗕韩鏁版嵁</param> + /// <param name="roomFunctionList">褰撳墠鎴块棿鎵�鏈夊姛鑳藉垪琛�</param> + /// <param name="roomId">濡傛灉鎴块棿ID涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘锛屼笉闇�瑕佸垹闄ゆ埧闂村垎浜�</param> + /// <param name="btnFunctionCount">涓暟缁熻鏁伴噺</param> + /// <param name="roomView">鑳屾櫙View</param> + void DeleteRoomAllShare(List<ShareData> funs_Del, List<Function> roomFunctionList, string roomId, Button btnFunctionCount, RowLayout roomView) + { + //闇�瑕佸垹闄ょ殑鍒嗕韩涓�0 + if (funs_Del == null || funs_Del.Count == 0) + { + //鍏抽棴鍙虫粦鑿滃崟 + roomView.HideMenu(); + Utlis.ShowTip(Language.StringByID(StringId.NoShare)); + return; + } + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + new Thread(() => + { + try + { + bool result = false; + //濡傛灉鎴块棿ID涓虹┖锛屽垯浠h〃绠$悊鏃犲垎閰嶅尯鍩熺殑鍔熻兘锛屼笉闇�瑕佸垹闄ゆ埧闂村垎浜� + if (!string.IsNullOrEmpty(roomId)) + { + //鍒犻櫎鎴块棿鍒嗕韩 + var success = DeleteShareRoom(roomId); + if (success) + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩鎴愬姛"); + } + else + { + Utlis.WriteLine("鍒犻櫎鎴块棿鍒嗕韩澶辫触"); + } + } + + //2.鎵归噺鍒犻櫎鍒嗕韩 + var deleteShareObj = new DeleteShareObj() + { + shareDatas = funs_Del, + homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, + }; + result = LoadMethod_DelSharedData(deleteShareObj); + + if (!result) + { + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.delFail), true); + }); + } + else + { + //鍒犻櫎鍒嗕韩鎴愬姛 + //4.1绠$悊鏈�缁堢殑鍒嗕韩鍒楄〃 + var funs_final = new List<ShareData>(); + funs_final.AddRange(memberInfo.CurResidenceShareData); + //4.2绉婚櫎鍒犻櫎鐨� + foreach (var share_d in funs_Del) + { + var sd = funs_final.Find((obj) => obj.shareTypeId == share_d.shareTypeId); + //濡傛灉璇ュ姛鑳藉凡缁忓垎浜紝涓嶇敤鍒嗕韩 + if (null != sd) + { + funs_final.Remove(share_d); + } + } + + Application.RunOnMainThread(() => + { + new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.SavedSuccessfully), true); + //娓呯┖ + funs_Del.Clear(); + memberInfo.CurResidenceShareData = funs_final; + btnFunctionCount.Text = 0 + "/" + roomFunctionList.Count.ToString(); + //鍏抽棴鍙虫粦鑿滃崟 + roomView.HideMenu(); + }); + + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + + } + + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鍒犻櫎鎴块棿鍒嗕韩 + /// </summary> + /// <returns></returns> + bool DeleteShareRoom(string roomId) + { + var roomList = new List<ShareData>(); + roomList.Add(new ShareData() + { + shareType = ShareType.ROOM.ToString(), + shareTypeId = roomId + }); + + var deleteShareObj = new DeleteShareObj() + { + shareDatas = roomList, + homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, + }; + var responePack = new HttpServerRequest().DeleteShareData(deleteShareObj); + if (responePack.Code != StateCode.SUCCESS) + { + return false; + } + else + { + return true; + } + } + + /// <summary> + /// 鍒犻櫎鍏变韩鏁版嵁鐐瑰嚮浜嬩欢 + /// </summary> + /// <param name="function"></param> + bool LoadMethod_DelSharedData(DeleteShareObj sd) + { + var responePack = new HttpServerRequest().DeleteShareData(sd); + if (responePack.Code != StateCode.SUCCESS) + { + return false; + } + else + { + return true; + } + } } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 33dcfe9..4d22aef 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -297,6 +297,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, Text = DB_ResidenceData.Instance.CurrentRegion.Name, + IsBold = true }; residenceInfoView.AddChidren(btnCurResidenceName); -- Gitblit v1.8.0