From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 16 十二月 2020 13:09:08 +0800 Subject: [PATCH] 新云端代码Ver1.2 --- ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs | 168 ++++++++++++++----------------------------------------- 1 files changed, 43 insertions(+), 125 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs index 9ffe23b..9b73486 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs @@ -36,8 +36,7 @@ this.memberInfo = info; //璁剧疆鏍囬淇℃伅 - string title = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName; - base.SetTitleText(title); + base.SetTitleText(info.ShowName); //鍒濆鍖栧彸涓婅鐨勫浘鏍� this.InitTopRightIcon(); @@ -51,7 +50,7 @@ /// </summary> private void InitTopRightIcon() { - if (UserCenterResourse.UserInfo.AuthorityNo != 1) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) { return; } @@ -76,7 +75,7 @@ //纭畾鎺堟潈銆寋0}銆嶆垚涓虹鐞嗗憳? msg = Language.StringByID(R.MyInternationalizationString.uUpSubAccountLevel); } - msg = msg.Replace("{0}", string.IsNullOrEmpty(memberInfo.UserName) == true ? memberInfo.Account : memberInfo.UserName); + msg = msg.Replace("{0}", memberInfo.ShowName); this.ShowMassage(ShowMsgType.Confirm, msg, () => { @@ -114,7 +113,7 @@ bodyFrameLayout.AddChidren(frame); //鐢ㄦ埛鍥炬爣 - string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png"); + string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfo.ChildAccountId + ".png"); var btnUserIcon = new ImageView(); btnUserIcon.Height = this.GetPictrueRealSize(207); btnUserIcon.Width = this.GetPictrueRealSize(207); @@ -160,7 +159,7 @@ { //鏍囬:鎴愬憳鏉冮檺 var btnMenberTile = new NormalViewControl(800, 60, true); - btnMenberTile.X = ControlCommonResourse.XXLeft; + btnMenberTile.X = HdlControlResourse.XXLeft; btnMenberTile.Y = Application.GetRealHeight(418); btnMenberTile.TextColor = UserCenterColor.Current.TextColor2; btnMenberTile.TextID = R.MyInternationalizationString.MenberAuthority; @@ -218,11 +217,7 @@ string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveMember); this.ShowMassage(ShowMsgType.Confirm, msg, () => { - //鍒犻櫎瀛愯处鍙� - HdlThreadLogic.Current.RunThread(() => - { - this.DeleteSubAccount(); - }); + this.DeleteSubAccount(); }); }; } @@ -248,24 +243,19 @@ //寮�鍏� var btnSwitch = row.AddMostRightSwitchIcon(); - if (this.memberInfo.IsAllowRemoteCtrl == true) + if (this.memberInfo.IsRemoteControl == true) { btnSwitch.IsSelected = true; } btnSwitch.ButtonClickEvent += (sender, e) => { btnSwitch.CanClick = false; + bool statu = !btnSwitch.IsSelected; HdlThreadLogic.Current.RunThread(() => { - var pra = new - { - HouseDistributedMark = Common.Config.Instance.Home.Id, - DistributedMark = this.memberInfo.DistributedMark, - IsAllowRemoteCtrl = !btnSwitch.IsSelected - }; //鎵撳紑杩涘害鏉� this.ShowProgressBar(); - var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra); + var result = HdlMemberLogic.Current.SetRemoteOperationPermissions(this.memberInfo.ChildAccountId, statu); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); @@ -273,12 +263,12 @@ { return; } - this.memberInfo.IsAllowRemoteCtrl = !btnSwitch.IsSelected; + this.memberInfo.IsRemoteControl = statu; HdlThreadLogic.Current.RunMain(() => { + btnSwitch.IsSelected = statu; btnSwitch.CanClick = true; - btnSwitch.IsSelected = !btnSwitch.IsSelected; }); }); @@ -309,11 +299,10 @@ //鍙冲浘鏍� row.AddRightArrow(); - var memberShardInfo = new MemberShardInfoData(); row.ButtonClickEvent += (sender, e) => { var form = new SharedContent.LookSharedListRoomForm(); - form.AddForm(memberInfo, memberShardInfo); + form.AddForm(memberInfo.ChildAccountId); }; } @@ -324,50 +313,33 @@ /// <summary> /// 鍗囩骇鎴栬�呴檷绾у瓙璐﹀彿 /// </summary> - public void UpOrDownSubAccountLevel() + private void UpOrDownSubAccountLevel() { - HdlThreadLogic.Current.RunThread(() => + //鍙樻洿鏉冮檺 + var result = HdlMemberLogic.Current.EditorMemberAuthority(this.memberInfo.ChildAccountId, memberInfo.AccountType == 1 ? 1 : 3); + if (result == false) { - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); + return; + } - var pra = new UpOrDownLevelPra(); - pra.DistributedMark = memberInfo.DistributedMark; + //鍙樻洿鏉冮檺 + memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1; - bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra); - if (result == false) - { - this.CloseProgressBar(); - return; - } - this.CloseProgressBar(); + //鍙樻洿鏉冮檺鍥炬爣 + if (memberInfo.AccountType == 1) + { + btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png"; + } + else + { + btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png"; + } + //鍙樻洿鏉冮檺鏂囧瓧 + btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember; - //鍙樻洿鏉冮檺 - memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1; - - HdlThreadLogic.Current.RunMain(() => - { - if (this.Parent == null) - { - return; - } - //鍙樻洿鏉冮檺鍥炬爣 - if (memberInfo.AccountType == 1) - { - btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png"; - } - else - { - btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png"; - } - //鍙樻洿鏉冮檺鏂囧瓧 - btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember; - - //鎵撳紑鏄剧ず鎴愬姛鐨勭敾闈� - var form = new SubAccountLevelUpSuccessForm(); - form.AddForm(memberInfo); - }); - }); + //鎵撳紑鏄剧ず鎴愬姛鐨勭敾闈� + var form = new SubAccountLevelUpSuccessForm(); + form.AddForm(memberInfo); } #endregion @@ -379,28 +351,15 @@ /// </summary> private void DeleteSubAccount() { - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); - - var pra = new DeleteSubAccountPra(); - pra.SubAccount = memberInfo.SubAccountDistributedMark; - - bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - + bool result = HdlMemberLogic.Current.DeleteMember(this.memberInfo.ChildAccountId); if (result == false) { return; } - - HdlThreadLogic.Current.RunMain(() => - { - //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄� - this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account); - //鑷韩鍏抽棴 - this.CloseForm(); - }); + //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄� + this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account); + //鑷韩鍏抽棴 + this.CloseForm(); } #endregion @@ -414,24 +373,12 @@ { HdlThreadLogic.Current.RunThread(() => { - var pra = new AccountInfoPra(); - pra.Account = memberInfo.Account; - var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false); - if (result == null) - { - return; - } - var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(result)); - if (revertObj == null || revertObj.ResponseData == null) - { - return; - } - var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString()); - if (infoResult.HeadImage != null) + var imageData = HdlAccountLogic.Current.DownLoadAccountPictrue(memberInfo.Account); + if (imageData != null && imageData.Length > 0) { //鍐欏叆澶村儚鍐呭 - string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png"); - Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage); + string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfo.ChildAccountId + ".png"); + Shared.IO.FileUtils.WriteFileByBytes(iconPath, imageData); HdlThreadLogic.Current.RunMain(() => { btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath); @@ -440,35 +387,6 @@ }); } - #endregion - - #region 鈻� 缁撴瀯浣揰____________________________ - - /// <summary> - /// 鍗囩骇鎴栬�呴檷绾у瓙璐﹀彿鐨勫惎鍔ㄥ弬鏁� - /// </summary> - private class UpOrDownLevelPra : IfacePraCommon - { - /// <summary> - /// 閫氳繃銆婁綇瀹呯殑Guid鏌ヨ浣忓畢涓嬮潰鐨勫瓙璐﹀彿銆嬫帴鍙f椂锛岃繑鍥炵殑DistributedMark瀛楁 - /// </summary> - public string DistributedMark = string.Empty; - } - - /// <summary> - /// 鍒犻櫎瀛愯处鍙风殑鍚姩鍙傛暟 - /// </summary> - private class DeleteSubAccountPra : IfacePraCommon - { - /// <summary> - /// 閫氳繃銆婁綇瀹呯殑Guid鏌ヨ浣忓畢涓嬮潰鐨勫瓙璐﹀彿銆嬫帴鍙f椂锛岃繑鍥炵殑DistributedMark瀛楁 - /// </summary> - public string SubAccount = string.Empty; - /// <summary> - /// HouseDistributedMark - /// </summary> - public string HouseDistributedMark = Common.Config.Instance.HomeId; - } #endregion } } -- Gitblit v1.8.0