黄学彪
2019-11-13 8b9ce384b26c414db32f98e94e088f5334869c2d
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -69,18 +69,43 @@
                            {
                                foreach (var curDoorLockUser in getDoorLockInfoList.PageData)
                                {
                                    if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "")
                                    {
                                        continue;
                                    }
                                    if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId)))
                                    {
                                        doorLock.localDoorLockUserList.Remove(int.Parse(curDoorLockUser.DoorLockLocalUserId));
                                        var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                                        doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId);
                                        doorLockObj.UnlockType = curDoorLockUser.OpenLockMode;
                                        doorLockObj.PrimaryId = curDoorLockUser.Id;
                                        doorLockObj.EntryTime = curDoorLockUser.EntryTime;
                                        doorLockObj.UserName = curDoorLockUser.UserIdRemarks;
                                        doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId;
                                        doorLock.localDoorLockUserList[int.Parse(curDoorLockUser.DoorLockLocalUserId)] = doorLockObj;
                                    }
                                    var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                                    doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId);
                                    doorLockObj.UnlockType = curDoorLockUser.OpenLockMode;
                                    doorLockObj.PrimaryId = curDoorLockUser.Id;
                                    doorLockObj.EntryTime = curDoorLockUser.EntryTime;
                                    doorLockObj.UserName = curDoorLockUser.UserIdRemarks;
                                    doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId;
                                    doorLock.localDoorLockUserList.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId), doorLockObj);
                                    else
                                    {
                                        if (curDoorLockUser.DoorLockLocalUserId != null)
                                        {
                                            //门锁中没有,云端有用户ID,后台删除云端这些ID
                                            var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
                                            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                                            {
                                                deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                                                deleteDoorLockData.IsOtherAccountCtrl = true;
                                            }
                                            if (doorLock.DeviceAddr != null)
                                            {
                                                deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
                                            }
                                            deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId;
                                            deleteDoorLockData.PrimaryId = curDoorLockUser.Id;
                                            deleteDoorLockData.DelDoorLockDelType = 2;
                                            var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                                            int i = 0;
                                        }
                                    }
                                }
                            }
                            else
@@ -88,6 +113,7 @@
                                Application.RunOnMainThread(() =>
                                {
                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
                                    return;
                                });
                            }
                        }
@@ -168,9 +194,18 @@
                SideslipFramelayout();
            };
            var btnLine = new Button
            {
                Y = midTopFrameLayout.Bottom,
                Height = 1,
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine,
            };
            this.midFrameLayout.AddChidren(btnLine);
            bodyView = new VerticalScrolViewLayout()
            {
                Y = midTopFrameLayout.Bottom,
                Height = Application.GetRealHeight(1921 - 184 - 115 - 1),
            };
            this.midFrameLayout.AddChidren(bodyView);
@@ -537,35 +572,42 @@
                    addLockInfo.EntryTime = curDoorLockUser.EntryTime;
                    var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
                    if (result != null && result.StateCode == "Success")
                    if (result != null)
                    {
                        //存账户信息
                        //var resultList1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalAccountlist(doorLock, curAccountId);
                        //存门锁信息
                        var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
                        var uList = new List<int> { };
                        if (resultList != null)
                        if (result.StateCode == "Success")
                        {
                            foreach (var a in resultList.Keys)
                            //存门锁信息
                            var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
                            var uList = new List<int> { };
                            if (resultList != null)
                            {
                                uList.Add(a);
                                foreach (var a in resultList.Keys)
                                {
                                    uList.Add(a);
                                }
                            }
                        }
                        var d = uList.Find((value) => { return value == doorLock.doorLockProgrammingEventNotificationCommand.UserID; });
                        if (d != null)
                        {
                            RefreshList();
                            flMain.RemoveFromParent();
                            bottomFrameLayout.RemoveAll();
                            var d = uList.Find((value) => { return value == curDoorLockUser.UserID; });
                            if (d != null)
                            {
                                RefreshList();
                                flMain.RemoveFromParent();
                                bottomFrameLayout.RemoveAll();
                            }
                            else
                            {
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
                            }
                        }
                        else
                        {
                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
                            flMain.RemoveFromParent();
                            bottomFrameLayout.RemoveAll();
                        }
                    }
                    else
                    {
                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
                        flMain.RemoveFromParent();
                        bottomFrameLayout.RemoveAll();
                    }