using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.Stan;
using System;
using System.Collections.Generic;
using System.Text;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
///
/// 门锁历史记录的界面(多门锁时,才能进来)
///
public class DoorLockHistoryInfoPage : EditorCommonForm
{
#region ■ 变量声明___________________________
///
/// 门锁设备列表
///
private List listDevice = new List();
///
/// 成员列表
///
private List listMember = null;
///
/// 默认选择的用户
///
private List listSelectUser = new List { "all" };
///
/// 默认选择的开锁方式
///
private List listUnlock = new List { "all" };
///
/// 默认选择的信息类型
///
private List listMsgType = new List { "all" };
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
/// 门锁设备列表
public void ShowForm(List i_listDevice)
{
this.listDevice.AddRange(i_listDevice);
//历史记录
base.SetTitleText(Language.StringByID(StringId.HistoryLog));
//初始化头部筛选控件
this.InitTopScreenControl();
//初始化中部信息
this.InitMiddleFrame();
}
///
/// 初始化中部信息
///
private void InitMiddleFrame()
{
//清空bodyFrame
this.ClearBodyFrame();
}
#endregion
#region ■ 初始化筛选控件_____________________
///
/// 初始化头部筛选控件
///
private void InitTopScreenControl()
{
//右上角的筛选控件
var btnScreenContr = new PicViewControl(28, 28);
btnScreenContr.X = Application.GetRealWidth(337);
btnScreenContr.Y = Application.GetRealHeight(9);
btnScreenContr.UnSelectedImagePath = "FunctionIcon/DoorLock/Screen.png";
topFrameLayout.AddChidren(btnScreenContr);;
btnScreenContr.ButtonClickEvent += (sender, e) =>
{
//初始化成员列表信息
if (this.InitMemberListInfo() == false)
{
return;
}
var form = new DoorLockHistoryTypeScreenPage(null, this.listMember);
form.InitControl(null, this.listSelectUser, this.listUnlock, this.listMsgType);
form.FinishEvent += (list1, list2, list3, list4) =>
{
//更改缓存
this.listSelectUser.Clear();
this.listSelectUser.AddRange(list2);
this.listUnlock.Clear();
this.listUnlock.AddRange(list3);
this.listMsgType.Clear();
this.listMsgType.AddRange(list4);
};
};
}
#endregion
#region ■ 初始化成员列表信息_________________
///
/// 初始化成员列表信息
///
///
private bool InitMemberListInfo()
{
//已经初始化
if (this.listMember != null) { return true; }
//主账号需要去获取成员列表,而子账号只能他自己
if (DB_ResidenceData.Instance.CurrentRegion.isOtherShare == false)
{
//获取成员列表
var responePack = new DAL.Server.HttpServerRequest().GetResidenceMemberAccount();
if (responePack.Code == DAL.Server.StateCode.SUCCESS)
{
this.listMember = Newtonsoft.Json.JsonConvert.DeserializeObject>(responePack.Data.ToString());
}
//失败
else
{
//提示
DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
return false;
}
}
else
{
//先初始化
this.listMember = new List();
}
//自身加进去,自己位于首位
var info = new ResidenceMemberInfo();
info.childAccountId = OnAppConfig.Instance.LastLoginUserId;
info.childAccountType = DB_ResidenceData.Instance.CurrentRegion.isOtherShare == false ? "ADMIN" : "ORDINARY";
info.nickName = UserInfo.Current.userName;
this.listMember.Insert(0, info);
if (string.IsNullOrEmpty(info.nickName))
{
info.nickName = UserInfo.Current.AccountString;
}
foreach (var info2 in this.listMember)
{
//设置用户昵称
if (string.IsNullOrEmpty(info2.nickName))
{
info2.nickName = info2.memberName;
}
}
return true;
}
#endregion
#region ■ 一般方法___________________________
#endregion
}
}