protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); ret = DeviceObject.objMJ.SetDoorUrgent(Convert.ToByte(doorInfo.DoorID), flag); return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); ret = DeviceObject.objMJNew.DoorOpen(doorInfo.DoorID, flag); return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); switch (flag) { case 0: AccessV2API.TYPE_DoorBasic basic = new AccessV2API.TYPE_DoorBasic(); AccessV2API.TYPE_DoorExpert expert = new AccessV2API.TYPE_DoorExpert(); ret = DeviceObject.objMJNew.ReadDoorInfo(doorInfo.DoorID, ref basic, ref expert); if (ret) { if (doorInfo.DoorPass.Length >= 16) { basic.PasswordA = doorInfo.DoorPass.Substring(0, 8); basic.PasswordB = doorInfo.DoorPass.Substring(8, 8); } else { basic.PasswordA = "00000000"; basic.PasswordB = "00000000"; } ret = DeviceObject.objMJNew.SetDoorBasicInfo(doorInfo.DoorID, basic); } break; } return(ret); }
protected bool InitMacDoorList() { for (int i = 0; i < dataGrid.RowCount; i++) { SetMacDoorResult(dataGrid[2, i].Value.ToString(), true, ""); } TMJDoorInfo doorInfo; doorList.Clear(); if (dataGrid.RowCount == 1) { doorInfo = new TMJDoorInfo(); int row = 0; doorInfo.ConnInfo = Pub.ValueToNewMJConnInfo(dataGrid[3, row].Value.ToString(), dataGrid[ResultIndex + 1, row].Value.ToString(), dataGrid[ResultIndex + 2, row].Value.ToString(), dataGrid[ResultIndex + 3, row].Value.ToString(), dataGrid[ResultIndex + 4, row].Value.ToString()); doorInfo.DoorSysID = dataGrid[2, row].Value.ToString(); byte doorID = 0; byte.TryParse(dataGrid[4, row].Value.ToString(), out doorID); doorInfo.DoorID = doorID; doorInfo.DoorName = dataGrid[5, row].Value.ToString(); for (int i = 0; i < ExtField.Count; i++) { doorInfo.ExtField.Add(dataGrid[6 + i, row].Value.ToString()); } doorList.Add(doorInfo); } else { for (int i = 0; i < dataGrid.RowCount; i++) { if (Pub.ValueToBool(dataGrid[0, i].EditedFormattedValue)) { doorInfo = new TMJDoorInfo(); doorInfo.ConnInfo = Pub.ValueToNewMJConnInfo(dataGrid[3, i].Value.ToString(), dataGrid[ResultIndex + 1, i].Value.ToString(), dataGrid[ResultIndex + 2, i].Value.ToString(), dataGrid[ResultIndex + 3, i].Value.ToString(), dataGrid[ResultIndex + 4, i].Value.ToString()); doorInfo.DoorSysID = dataGrid[2, i].Value.ToString(); byte doorID = 0; byte.TryParse(dataGrid[4, i].Value.ToString(), out doorID); doorInfo.DoorID = doorID; doorInfo.DoorName = dataGrid[5, i].Value.ToString(); for (int j = 0; j < ExtField.Count; j++) { doorInfo.ExtField.Add(dataGrid[6 + j, i].Value.ToString()); } doorList.Add(doorInfo); } } } if (doorList.Count == 0) { Pub.ShowErrorMsg(Pub.GetResText(formCode, "ErrorSelectMacDoorOprt", "")); } return(doorList.Count > 0); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); switch (flag) { case 0: ret = DeviceObject.objMJNew.RemoteOpen(doorInfo.DoorID); break; case 1: ret = DeviceObject.objMJNew.AwhileOpen(doorInfo.DoorID, DoorDelay); break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); switch (flag) { case 0: ret = DeviceObject.objMJ.SetDoorOpenRemote(Convert.ToByte(doorInfo.DoorID)); break; case 1: ret = DeviceObject.objMJ.SetDoorOpenTemp(Convert.ToByte(doorInfo.DoorID), DoorDelay); break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); switch (flag) { case 0: QHKS.TMJMacPasswordInfo passInfo = new QHKS.TMJMacPasswordInfo(); passInfo.Pass = new string[8]; for (int i = 0; i < doorPasswordList.Count; i++) { passInfo.Pass[i] = doorPasswordList[i]; } ret = DeviceObject.objMJ.SetMacPasswordInfo(ref passInfo); break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); byte doorID = Convert.ToByte(doorInfo.DoorID); switch (flag) { case 0: if (DownFlag == 0) { ret = DeviceObject.objMJ.SetMacTimeOpenDoorInfo(doorID, ref timeOpenInfo); } break; case 1: if (DownFlag == 0) { ret = DeviceObject.objMJ.ClearMacTimeOpenDoorInfo(doorID); } break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); byte doorID = Convert.ToByte(doorInfo.DoorID); switch (flag) { case 0: if (DownFlag == 0) { AccessV2API.TYPE_DoorBasic basic = new AccessV2API.TYPE_DoorBasic(); AccessV2API.TYPE_DoorExpert expert = new AccessV2API.TYPE_DoorExpert(); ret = DeviceObject.objMJNew.ReadDoorInfo(doorID, ref basic, ref expert); if (ret) { expert.EnableTiming = 1; expert.ExpertTiming = ExpertTiming; ret = DeviceObject.objMJNew.SetDoorExpertInfo(doorID, expert); } } break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); bool IsError = false; int Index = 0; string cardNo = ""; switch (flag) { case 0: QHKS.TMJMoreCardInfo cardInfo = new QHKS.TMJMoreCardInfo(); cardInfo.DoorID = Convert.ToByte(doorInfo.DoorID); cardInfo.CardList = new string[20]; if (doorInfo.ExtField[0] == "Y") { TMacMoreCard card = new TMacMoreCard(doorInfo.ExtField[1]); if (card.EmpList != "") { DataTableReader dr = null; try { string sql = ""; if (SystemInfo.HasFaCard) { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "108", card.EmpList }); } else { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "301", card.EmpList }); } dr = db.GetDataReader(sql); while (dr.Read()) { cardNo = dr["OtherCardNo"].ToString(); if (SystemInfo.AdvUseOtherCard && cardNo != "") { cardInfo.CardList[Index] = "1-" + cardNo; } else { cardInfo.CardList[Index] = dr["CardPhysicsNo10"].ToString(); } Index += 1; } } catch (Exception E) { IsError = true; Pub.ShowErrorMsg(E); } finally { if (dr != null) { dr.Close(); } dr = null; } } for (int i = Index; i < 20; i++) { cardInfo.CardList[i] = ""; } cardInfo.CardCount = card.EmpCount; cardInfo.CardIn = card.EnabledIn; cardInfo.CardOut = card.EnabledOut; } if (!IsError) { ret = DeviceObject.objMJ.SetMacMoreCardInfo(ref cardInfo); } break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); bool IsError = false; int Index = 0; UInt32 cardNo = 0; switch (flag) { case 0: UInt32 EnableGuardCard = 0; UInt32[] ExpertGuardCard = new UInt32[5]; if (doorInfo.ExtField[0] == "Y") { EnableGuardCard = 1; TInOutCard card = new TInOutCard(doorInfo.ExtField[1]); if (card.EmpList != "") { DataTableReader dr = null; try { string sql = ""; if (SystemInfo.HasFaCard) { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "108", card.EmpList }); } else { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "301", card.EmpList }); } dr = db.GetDataReader(sql); while (dr.Read()) { UInt32.TryParse(dr["OtherCardNo"].ToString(), out cardNo); if (SystemInfo.AdvUseOtherCard && cardNo > 0) { ExpertGuardCard[Index] = cardNo; } else { UInt32.TryParse(dr["CardPhysicsNo10"].ToString(), out ExpertGuardCard[Index]); } Index++; } } catch (Exception E) { IsError = true; Pub.ShowErrorMsg(E); } finally { if (dr != null) { dr.Close(); } dr = null; } } } if (!IsError) { AccessV2API.TYPE_DoorBasic basic = new AccessV2API.TYPE_DoorBasic(); AccessV2API.TYPE_DoorExpert expert = new AccessV2API.TYPE_DoorExpert(); ret = DeviceObject.objMJNew.ReadDoorInfo(doorInfo.DoorID, ref basic, ref expert); if (ret) { expert.EnableGuardCard = EnableGuardCard; expert.ExpertGuardCard = ExpertGuardCard; ret = DeviceObject.objMJNew.SetDoorExpertInfo(doorInfo.DoorID, expert); } } break; } return(ret); }
protected string GetMacDoorMsg(TMJDoorInfo doorInfo) { string ret = doorInfo.ConnInfo.MacSN + " " + doorInfo.DoorID + ":" + doorInfo.DoorName + "]"; return(ret); }
protected virtual bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { MacMsg = ""; return(false); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); bool IsError = false; int Index = 0; UInt32 cardNo1 = 0; UInt32 cardNo2 = 0; switch (flag) { case 0: AccessV2API.TYPE_MulitCardDat cardInfo = new AccessV2API.TYPE_MulitCardDat(); cardInfo.GroupA = new UInt32[50]; cardInfo.GroupB = new UInt32[50]; cardInfo.GroupC = new UInt32[50]; cardInfo.GroupD = new UInt32[50]; cardInfo.GroupE = new UInt32[50]; cardInfo.GroupF = new UInt32[50]; cardInfo.GroupG = new UInt32[50]; cardInfo.GroupH = new UInt32[50]; cardInfo.GroupI = new UInt32[50]; cardInfo.GroupJ = new UInt32[50]; AccessV2API.TYPE_MulitCardMap CardMap = new AccessV2API.TYPE_MulitCardMap(); CardMap.ProgramA = new UInt32[10]; CardMap.ProgramB = new UInt32[10]; CardMap.ProgramC = new UInt32[10]; CardMap.ProgramD = new UInt32[10]; if (doorInfo.ExtField[0] == "Y") { TMacMoreCardNew card = new TMacMoreCardNew(doorInfo.ExtField[1]); for (int i = 0; i < 10; i++) { if (card.EmpList[i] != "") { DataTableReader dr = null; try { string sql = ""; if (SystemInfo.HasFaCard) { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "108", card.EmpList[i] }); } else { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "301", card.EmpList[i] }); } dr = db.GetDataReader(sql); Index = 0; while (dr.Read()) { UInt32.TryParse(dr["CardPhysicsNo10"].ToString(), out cardNo1); UInt32.TryParse(dr["OtherCardNo"].ToString(), out cardNo2); switch (i) { case 0: cardInfo.GroupA[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 1: cardInfo.GroupB[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 2: cardInfo.GroupC[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 3: cardInfo.GroupD[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 4: cardInfo.GroupE[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 5: cardInfo.GroupF[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 6: cardInfo.GroupG[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 7: cardInfo.GroupH[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 8: cardInfo.GroupI[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; case 9: cardInfo.GroupJ[Index] = SystemInfo.AdvUseOtherCard && cardNo2 > 0 ? cardNo2 : cardNo1; break; } Index += 1; } } catch (Exception E) { IsError = true; Pub.ShowErrorMsg(E); } finally { if (dr != null) { dr.Close(); } dr = null; } } } switch (doorInfo.DoorID) { case 1: for (int i = 0; i < 10; i++) { CardMap.ProgramA[i] = (UInt32)card.CountList[i]; } break; case 2: for (int i = 0; i < 10; i++) { CardMap.ProgramB[i] = (UInt32)card.CountList[i]; } break; case 3: for (int i = 0; i < 10; i++) { CardMap.ProgramC[i] = (UInt32)card.CountList[i]; } break; case 4: for (int i = 0; i < 10; i++) { CardMap.ProgramD[i] = (UInt32)card.CountList[i]; } break; } } if (!IsError) { ret = DeviceObject.objMJNew.SetMultiCardDat(doorInfo.DoorID, cardInfo); if (ret) { ret = DeviceObject.objMJNew.SetMultiCardMap(CardMap); } if (ret) { AccessV2API.TYPE_DoorBasic basic = new AccessV2API.TYPE_DoorBasic(); AccessV2API.TYPE_DoorExpert expert = new AccessV2API.TYPE_DoorExpert(); ret = DeviceObject.objMJNew.ReadDoorInfo(doorInfo.DoorID, ref basic, ref expert); if (ret) { if (doorInfo.ExtField[0] == "Y") { expert.EnableMulitCard = 1; } else { expert.EnableMulitCard = 0; } ret = DeviceObject.objMJNew.SetDoorExpertInfo(doorInfo.DoorID, expert); } } } break; } return(ret); }
protected override bool ExecMacDoorCommand(byte flag, TMJDoorInfo doorInfo, ref string MacMsg) { bool ret = base.ExecMacDoorCommand(flag, doorInfo, ref MacMsg); bool IsError = false; int Index = 0; UInt32 cardNo = 0; switch (flag) { case 0: AccessV2API.TYPE_DoorExpert_First cardInfo = new AccessV2API.TYPE_DoorExpert_First(); cardInfo.CardNo = new UInt32[10]; cardInfo.WeekConfig = new byte[8]; if (doorInfo.ExtField[0] == "Y") { TMacFirstCard card = new TMacFirstCard(doorInfo.ExtField[1]); cardInfo.InsideMode = card.Way[0]; cardInfo.OutsideMode = card.Way[1]; for (int i = 0; i < 7; i++) { if (card.Week[i] == 0) { cardInfo.WeekConfig[i] = 1; } else { cardInfo.WeekConfig[i] = 0; } } if (card.StartTime.Length == 5) { cardInfo.TimeBegin.wHour = Convert.ToUInt16(card.StartTime.Substring(0, 2)); cardInfo.TimeBegin.wMinute = Convert.ToUInt16(card.StartTime.Substring(3, 2)); } if (card.EndTime.Length == 5) { cardInfo.TimeEnd.wHour = Convert.ToUInt16(card.EndTime.Substring(0, 2)); cardInfo.TimeEnd.wMinute = Convert.ToUInt16(card.EndTime.Substring(3, 2)); } if (card.EmpList != "") { DataTableReader dr = null; try { string sql = ""; if (SystemInfo.HasFaCard) { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "108", card.EmpList }); } else { sql = Pub.GetSQL(DBCode.DB_003001, new string[] { "301", card.EmpList }); } dr = db.GetDataReader(sql); while (dr.Read()) { UInt32.TryParse(dr["OtherCardNo"].ToString(), out cardNo); if (SystemInfo.AdvUseOtherCard && cardNo > 0) { cardInfo.CardNo[Index] = cardNo; } else { UInt32.TryParse(dr["CardPhysicsNo10"].ToString(), out cardInfo.CardNo[Index]); } Index++; } } catch (Exception E) { IsError = true; Pub.ShowErrorMsg(E); } finally { if (dr != null) { dr.Close(); } dr = null; } } } if (!IsError) { AccessV2API.TYPE_DoorBasic basic = new AccessV2API.TYPE_DoorBasic(); AccessV2API.TYPE_DoorExpert expert = new AccessV2API.TYPE_DoorExpert(); ret = DeviceObject.objMJNew.ReadDoorInfo(doorInfo.DoorID, ref basic, ref expert); if (ret) { expert.ExpertFirstCard = cardInfo; if (doorInfo.ExtField[0] == "Y") { expert.EnableFirstCard = 1; } else { expert.EnableFirstCard = 0; } ret = DeviceObject.objMJNew.SetDoorExpertInfo(doorInfo.DoorID, expert); } } break; } return(ret); }