public List <DoorNameAttriData> GetDatas() { List <DoorNameAttriData> datas = new List <DoorNameAttriData>(); for (int i = this.Controls.Count - 1; i >= 0; i--) { DoorNameAttri doorAttri = (DoorNameAttri)this.Controls[i]; if (doorAttri.Tag != null && (int)doorAttri.Tag == 1) { DoorNameAttriData data = doorAttri.Data; datas.Add(data); } } return(datas); }
private void SetAccessExAttribute(ControllerDoorType doorType) { if (_lastType == null) { _lastType = doorType; } else { if (_lastType == doorType) { return; } } _lastType = doorType; int doorCount = 1; int directionCount = 1; switch (doorType) { case ControllerDoorType.OneDoorTwoDirections: { this.tabItemDoor.Text = "【单门双向控制器】属性"; doorCount = 1; directionCount = 2; } break; case ControllerDoorType.TwoDoorsTwoDirections: { this.tabItemDoor.Text = "【双门双向控制器】属性"; doorCount = 2; directionCount = 2; } break; case ControllerDoorType.FourDoorsOneDirection: { this.tabItemDoor.Text = "【四门单向控制器】属性"; doorCount = 4; directionCount = 1; } break; case ControllerDoorType.Elevator: { return; } break; default: break; } List <DoorNameAttriData> doorNameDatas = new List <DoorNameAttriData>(); List <DoorReaderAttriData> doorReaderDatas = new List <DoorReaderAttriData>(); for (int i = 0; i < doorCount; i++) { DoorNameAttriData data = new DoorNameAttriData(); data.doorNo = i + 1; data.doorCtrlType = 0; data.doorEnable = true; data.doorName = "门_" + tbCtrlrSn.Text.Trim() + "_" + data.doorNo; data.doorSecond = 3; Maticsoft.Model.SMT_DOOR_INFO doorInfo = null; if (_ctrlr != null) { if (_ctrlr.DOOR_INFOS != null) { doorInfo = _ctrlr.DOOR_INFOS.Find(m => m.CTRL_ID == _ctrlr.ID && (m.CTRL_DOOR_INDEX == data.doorNo)); if (doorInfo != null) { if (!string.IsNullOrWhiteSpace(doorInfo.DOOR_NAME)) { data.doorName = doorInfo.DOOR_NAME; } data.doorCtrlType = doorInfo.CTRL_STYLE; data.doorEnable = doorInfo.IS_ENABLE; data.doorSecond = doorInfo.CTRL_DELAY_TIME; data.visitor = doorInfo.IS_ALLOW_VISITOR; } } } doorNameDatas.Add(data); for (int j = 0; j < directionCount; j++) { DoorReaderAttriData rdata = new DoorReaderAttriData(); rdata.doorNo = data.doorNo; rdata.isEnter = rdata.isNoEnter = j == 0; rdata.isAttend = false; rdata.isEnter1 = j == 0; if (doorInfo != null) { rdata.isEnter = j == 0 ? doorInfo.IS_ENTER1 : doorInfo.IS_ENTER2; rdata.isAttend = j == 0 ? doorInfo.IS_ATTENDANCE1 : doorInfo.IS_ATTENDANCE2; } doorReaderDatas.Add(rdata); } } doorNameAttriGroup.SetDatas(doorNameDatas); doorReaderAttriGroup.SetDatas(doorReaderDatas); }