From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs | 97 ++++++++++++++++++++----------------------------
1 files changed, 41 insertions(+), 56 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
index d37511f..9e23323 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
@@ -18,7 +18,7 @@
/// <summary>
/// 浣忓畢鏁版嵁(鏈夌綉鏃朵娇鐢�)
/// </summary>
- private Dictionary<string, Common.ResponseEntity.ResidenceObj> dicResidenceData = null;
+ private Dictionary<string, ResidenceInformation> dicResidenceData = null;
/// <summary>
/// 浣忓畢鏁版嵁(鏃犵綉鏃朵娇鐢�)
/// </summary>
@@ -123,16 +123,11 @@
private bool SetResidenceInfoByOnline()
{
//鑾峰彇浣忓畢淇℃伅
- var Pra = new GetResidenceInfoPra();
- string resultData = UserCenterLogic.GetResponseDataByRequestHttps("App/GetHomePager", false, Pra, new List<string> { "NotCheck" }, false);
- if (string.IsNullOrEmpty(resultData) == true)
+ var listHouse = HdlResidenceLogic.Current.GetHomeListsFromDb(ShowNetCodeMode.No);
+ if (listHouse == null)
{
return false;
}
- var pageData = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResidenceRes>(resultData);
- //鎺掑簭浣忓畢
- var listHouse = HdlResidenceLogic.Current.SortHouse(pageData.PageData);
-
HdlThreadLogic.Current.RunMain(() =>
{
if (this.Parent == null)
@@ -141,7 +136,7 @@
}
listView.Height = bodyFrameLayout.Height;
- this.dicResidenceData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>();
+ this.dicResidenceData = new Dictionary<string, ResidenceInformation>();
for (int i = 0; i < listHouse.Count; i++)
{
var info = listHouse[i];
@@ -161,7 +156,7 @@
/// 娣诲姞浣忓畢鐨勮(鏈夌綉鎯呭喌)
/// </summary>
/// <param name="info"></param>
- private void AddRowLayoutByOnline(Common.ResponseEntity.ResidenceObj info, bool addLine)
+ private void AddRowLayoutByOnline(ResidenceInformation info, bool addLine)
{
var rowLayout = new RowLayoutControl(listView.rowSpace / 2);
this.listView.AddChidren(rowLayout);
@@ -174,7 +169,7 @@
if (info.Id == Config.Instance.Home.Id)
{
//浣忓畢鍚嶇О
- btnHome = rowLayout.frameTable.AddLeftCaption(info.Name, 800, 60, true);
+ btnHome = rowLayout.frameTable.AddLeftCaption(info.HomeName, 800, 60, true);
btnHome.TextSize = 15;
btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent);
@@ -189,7 +184,7 @@
else
{
//浣忓畢鍚嶇О
- btnHome = rowLayout.frameTable.AddLeftCaption(info.Name, 800, true);
+ btnHome = rowLayout.frameTable.AddLeftCaption(info.HomeName, 800, true);
btnHome.TextSize = 15;
}
//鍙崇澶�
@@ -208,7 +203,7 @@
string msg = Language.StringByID(R.MyInternationalizationString.uSwitchResidenceMsg);
if (msg.Contains("{0}") == true)
{
- msg = string.Format(msg, info.Name);
+ msg = string.Format(msg, info.HomeName);
}
this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
@@ -245,7 +240,7 @@
}
};
- if (info.IsOthreShare == true)
+ if (info.IsOtherShare == true)
{
//鍒嗕韩鐨�,涓嶈兘鏇存敼
return;
@@ -416,9 +411,9 @@
/// </summary>
/// <param name="info">鏈夌綉鏃朵娇鐢�</param>
/// <param name="i_house">鏃犵綉鏃堕�傜敤</param>
- private void ShowEditorNameForm(Common.ResponseEntity.ResidenceObj info, House i_house, NormalViewControl btnHome)
+ private void ShowEditorNameForm(ResidenceInformation info, House i_house, NormalViewControl btnHome)
{
- string oldName = info != null ? info.Name : i_house.Name;
+ string oldName = info != null ? info.HomeName : i_house.Name;
//鐢熸垚涓�涓脊绐楃敾闈�
var dialogForm = new DialogInputControl();
//缂栬緫浣忓畢
@@ -457,7 +452,7 @@
return;
}
//鍒锋柊鍐呭瓨鐨勪綇瀹呭悕
- HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue);
+ HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue, null, null);
//鏇存敼鏄剧ず鐨勫悕瀛�
btnHome.Text = textValue;
}
@@ -471,7 +466,7 @@
/// <param name="ResidenceName"></param>
/// <param name="info"></param>
/// <returns></returns>
- private void EditorResidenceName(string ResidenceName, Common.ResponseEntity.ResidenceObj info, NormalViewControl btnHome)
+ private void EditorResidenceName(string ResidenceName, ResidenceInformation info, NormalViewControl btnHome)
{
//妫�娴嬭兘鍚︿繚瀛樹綇瀹�
if (this.CheckIsCanSaveResidence(info.Id, ResidenceName, true) == false)
@@ -481,7 +476,7 @@
//寮�鍚繘搴︽潯
this.ShowProgressBar();
- var result = HdlResidenceLogic.Current.EditorResidenceName(info.Id, ResidenceName);
+ var result = HdlResidenceLogic.Current.EditorResidenceName(info.Id, ResidenceName, null, null);
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
@@ -491,10 +486,10 @@
HdlThreadLogic.Current.RunMain(() =>
{
//鍒锋柊鍐呭瓨鐨勪綇瀹呭悕
- HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName);
+ HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName, null, null);
//鏇存敼鏄剧ず鐨勫悕瀛�
btnHome.Text = ResidenceName;
- info.Name = ResidenceName;
+ info.HomeName = ResidenceName;
});
}
}
@@ -550,28 +545,19 @@
//寮�鍚繘搴︽潯
this.ShowProgressBar();
- var Pra = new AddResidencePra();
- Pra.Name = ResidenceName;
- //娣诲姞浣忓畢
- string resultData = UserCenterLogic.GetResponseDataByRequestHttps("App/AddHome", false, Pra);
- if (string.IsNullOrEmpty(resultData) == true)
+ //鍒涘缓浣忓畢
+ var newId = HdlResidenceLogic.Current.CreatNewResidence(ResidenceName, null, null);
+ this.CloseProgressBar();
+
+ if (newId != null)
{
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar();
- return;
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //閲嶆柊鍒锋柊鍒楄〃
+ this.listView.RemoveAll();
+ this.SetResidenceInfo(2);
+ });
}
-
- var newInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewResidenceInfo>>(resultData);
-
- HdlResidenceLogic.Current.AddHouseToMemmory(newInfo[0].Id, ResidenceName);
-
- HdlThreadLogic.Current.RunMain(() =>
- {
- //閲嶆柊鍒锋柊鍒楄〃
- this.listView.RemoveAll();
- this.SetResidenceInfo(2);
- });
-
}
#endregion
@@ -590,13 +576,13 @@
var result2 = HdlGatewayLogic.Current.ResetComandToBindBackupGateway();
if (result2 == false)
{
- //涓存椂杩欎箞鍐�,鏂颁簯绔氨浼氬啓鍒癛鏂囦欢浜�
- this.ShowMassage(ShowMsgType.Tip, "缁戝畾缃戝叧澶辫触,璇烽噸鏂版搷浣�");
+ //缁戝畾缃戝叧澶辫触,璇烽噸鏂版搷浣�
+ this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindGatewayFailPleaseDoAgain));
this.CloseProgressBar();
return;
}
//妫�娴嬪畠鏈夋病鏈夊浠�
- var listBack = HdlBackupLogic.Current.GetBackupListNameFromDB();
+ var listBack = HdlBackupLogic.Current.GetBackupListNameFromDB(BackUpMode.A鎵嬪姩澶囦唤);
this.CloseProgressBar();
if (listBack == null)
@@ -626,7 +612,7 @@
HdlThreadLogic.Current.RunThread(() =>
{
//鍒涘缓涓�涓浠藉悕瀛�
- string backupClassId = HdlBackupLogic.Current.CreatNewBackupNameToDB(textValue);
+ string backupClassId = HdlBackupLogic.Current.CreatNewBackupNameToDB(textValue, BackUpMode.A鎵嬪姩澶囦唤);
if (backupClassId == null)
{
//鍒涘缓澶囦唤鍚嶅瓧澶辫触
@@ -670,7 +656,7 @@
/// 妫�娴嬫湰鍦版湁娌℃湁杩欎釜浣忓畢
/// </summary>
/// <param name="info"></param>
- private void CheckIsExsitResidence(Common.ResponseEntity.ResidenceObj info)
+ private void CheckIsExsitResidence(ResidenceInformation info)
{
var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, info.Id);
bool isExsit = System.IO.Directory.Exists(path);
@@ -680,10 +666,9 @@
//鍒涘缓鏂扮殑浣忓畢
var house = new House();
house.Id = info.Id;
- house.Name = info.Name;
- house.IsOthreShare = info.IsOthreShare;
- house.AccountType = info.AccountType;
- house.MainUserDistributedMark = info.MainUserDistributedMark;
+ house.Name = info.HomeName;
+ house.IsOtherShare = info.IsOtherShare;
+ house.AccountType = info.AccountType == "ADMIN" ? 1 : 0;
house.Longitude = info.Longitude;
house.Latitude = info.Latitude;
house.Save(false);
@@ -701,14 +686,14 @@
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
- private bool CheckIsCanDeleteResidence(Common.ResponseEntity.ResidenceObj info)
+ private bool CheckIsCanDeleteResidence(ResidenceInformation info)
{
- if (info.IsOthreShare == false)
+ if (info.IsOtherShare == false)
{
int myCount = 0;
foreach (var data in this.dicResidenceData.Values)
{
- if (data.IsOthreShare == false)
+ if (data.IsOtherShare == false)
{
myCount++;
}
@@ -766,12 +751,12 @@
//浣忓畢鍚嶅瓧閲嶅妫�娴�
foreach (string strId in this.dicResidenceData.Keys)
{
- if (this.dicResidenceData[strId].IsOthreShare == true)
+ if (this.dicResidenceData[strId].IsOtherShare == true)
{
//鍒嗕韩鐨勪綇瀹呬笉鑰冭檻
continue;
}
- if (residenceId != strId && residenceName == this.dicResidenceData[strId].Name)
+ if (residenceId != strId && residenceName == this.dicResidenceData[strId].HomeName)
{
//浣忓畢鍚嶅瓧宸茬粡瀛樺湪
int msgId = isEditor == true ? R.MyInternationalizationString.EditZigbeeHome_Exist : R.MyInternationalizationString.AddZigbeeHome_Exist;
@@ -785,7 +770,7 @@
{
foreach (var myHouse in this.listLocalHouse)
{
- if (myHouse.IsOthreShare == true)
+ if (myHouse.IsOtherShare == true)
{
//鍒嗕韩鐨勪綇瀹呬笉鑰冭檻
continue;
--
Gitblit v1.8.0