private void SaveRealData(UInt32 EnrollNumber, DateTime logTime, int MacSN, byte[] PhotoImage) { TFingerLog attLog = new TFingerLog(); attLog.CardID = EnrollNumber.ToString("0000000000"); attLog.Time = logTime; string GUID = ""; if (readData != null) { readData.SaveDB(db, attLog, MacSN, ref GUID); if (GUID != "" && PhotoImage != null && PhotoImage.Length > 0) { readData.SaveDBPhoto(db, GUID, PhotoImage); } } ShowRealDataProcess(attLog, MacSN); for (int i = 0; i < dataGrid.RowCount; i++) { if (dataGrid[2, i].Value.ToString() == MacSN.ToString()) { int DataCount = 0; if (dataGrid[11, i].Value != null) { int.TryParse(dataGrid[11, i].Value.ToString(), out DataCount); } DataCount += 1; dataGrid[11, i].Value = DataCount; break; } } }
public void ShowRealDataProcess(TFingerLog attLog, int MacSN) { string EmpSysID = ""; string EmpNo = ""; string EmpName = ""; string DepartID = ""; string DepartName = ""; DataTableReader dr = null; try { dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "240", attLog.CardID })); if (dr.Read()) { EmpSysID = dr["EmpSysID"].ToString(); EmpNo = dr["EmpNo"].ToString(); EmpName = dr["EmpName"].ToString(); DepartID = dr["DepartID"].ToString(); DepartName = dr["DepartName"].ToString(); } } catch { } finally { if (dr != null) { dr.Close(); } dr = null; } realGrid.Rows.Add(); realGrid[0, realGrid.RowCount - 1].Value = Convert.ToInt32(attLog.CardID); realGrid[1, realGrid.RowCount - 1].Value = attLog.Time; realGrid[2, realGrid.RowCount - 1].Value = MacSN; realGrid[3, realGrid.RowCount - 1].Value = EmpNo; realGrid[4, realGrid.RowCount - 1].Value = EmpName; realGrid[5, realGrid.RowCount - 1].Value = DepartID; realGrid[6, realGrid.RowCount - 1].Value = DepartName; realGrid[7, realGrid.RowCount - 1].Value = EmpSysID; realGrid.Rows[realGrid.RowCount - 1].Selected = true; realGrid.CurrentCell = realGrid.Rows[realGrid.RowCount - 1].Cells[0]; if (realGrid.RowCount == 1) { realGrid_SelectionChanged(null, null); } if (!SystemInfo.UseRealSendKQ || !objRealSend.IsInit) { return; } string PhotoData = RealSendPhoto ? ShowEmpPhoto(false) : ""; objRealSend.SendDataKQ(MacSN.ToString(), EmpNo, EmpName, DepartID, DepartName, attLog.CardID, attLog.Time, PhotoData); }
public void SaveFaceLog(string LogStr) { byte[] PhotoImage = null; DataTableReader dr = null; int InOutMode = 0; int VerifyStatus = 0; int VerifyType = 0; int DevMode = 0; VerifyPush <VerifyPushInfo> verifyPush = null; VerifyPush <RemoteOpenDoorPushInfo> remoteOpenDoorPush = null; if (LogStr.Contains("RemoteOpenDoorPush")) { remoteOpenDoorPush = JsonConvert.DeserializeObject <VerifyPush <RemoteOpenDoorPushInfo> >(LogStr); MacSN = remoteOpenDoorPush.info.DeviceID.ToString(); attLog.Remark = ""; UInt32 FingerNo = 0; attLog = new TFingerLog(); attLog.CardID = FingerNo.ToString("0000000000"); attLog.CardTime = DateTime.Parse(remoteOpenDoorPush.info.CreateTime); attLog.FingerNo = FingerNo; VerifyStatus = 27; VerifyType = remoteOpenDoorPush.info.VerfyType; } else { verifyPush = JsonConvert.DeserializeObject <VerifyPush <VerifyPushInfo> >(LogStr); MacSN = verifyPush.info.DeviceID.ToString(); attLog.Remark = verifyPush.info.Notes; if (verifyPush.info.CustomizeID < 0) { verifyPush.info.CustomizeID = 0; } UInt32 FingerNo = (UInt32)verifyPush.info.CustomizeID; attLog = new TFingerLog(); attLog.CardID = FingerNo.ToString("0000000000"); attLog.CardTime = DateTime.Parse(verifyPush.info.CreateTime); attLog.FingerNo = FingerNo; attLog.Temperature = verifyPush.info.Temperature; attLog.TemperatureAlarm = verifyPush.info.TemperatureAlarm; VerifyType = verifyPush.info.VerfyType; VerifyStatus = verifyPush.info.VerifyStatus; if (verifyPush.SanpPic != null) { PhotoImage = Convert.FromBase64String(verifyPush.SanpPic.Replace("data:image/jpeg;base64,", "")); } else { PhotoImage = new byte[0]; } } dr = SystemInfo.db.GetDataReader("SELECT * FROM VDI_MacInfo WHERE MacSN='" + MacSN + "'"); if (dr.Read()) { int.TryParse(dr["InOutMode"].ToString(), out InOutMode); int.TryParse(dr["DevModeID"].ToString(), out DevMode); } dr.Close(); readData.Sea_SetLogName(attLog, InOutMode, VerifyStatus, VerifyType); if (attLog.VerifyMode == 2 || attLog.VerifyMode == 3) { pidLog.Name = verifyPush.info.Name; pidLog.Time = attLog.CardTime; pidLog.MacSN = MacSN; if (verifyPush.info.Gender == 0) { pidLog.Gender = Pub.GetResText("Public", "EmpSex0", ""); } else if (verifyPush.info.Gender == 1) { pidLog.Gender = Pub.GetResText("Public", "EmpSex1", ""); } else { pidLog.Gender = ""; } pidLog.Birthday = DateTime.Parse(verifyPush.info.Birthday); pidLog.CardType = Pub.GetResText("Public", "LOG_IDCARD", ""); pidLog.EmpCertNo = verifyPush.info.IdCard; pidLog.EmpAddress = verifyPush.info.Address; pidLog.InOutMode = attLog.InOutMode; pidLog.InOutModeName = attLog.InOutModeName; pidLog.Temperature = verifyPush.info.Temperature; pidLog.TemperatureAlarm = verifyPush.info.TemperatureAlarm; pidLog.Nation = readData.Sea_GetNation(verifyPush.info.Nation); readData.SavePID(pidLog, ref GUID);//人证记录表 if (GUID != "" && PhotoImage != null) { readData.SavePIDPhoto(GUID, PhotoImage); } } readData.WriteTextFile(attLog, MacSN); if (textFormat.Allow) { readData.WriteTextFormat(textFormat, attLog, MacSN); } if (DevMode == 0 || DevMode == 1) { readData.SaveDB(attLog, MacSN, true, ref GUID); if (GUID != "") { if (PhotoImage != null) { readData.SaveDBPhoto(GUID, PhotoImage); } } } if (attLog.VerifyMode == 0 || (attLog.VerifyMode != 2 && attLog.VerifyMode != 3)) { attLog.VerifyMode = attLog.DoorMode; attLog.VerifyModeName = attLog.DoorModeName; } readData.WriteTextFileMJ(attLog, MacSN); if (DevMode == 0 || DevMode == 2) { readData.SaveDBMJ(attLog, MacSN, true, ref GUID); if (GUID != "") { if (PhotoImage != null) { readData.SaveDBPhotoMJ(GUID, PhotoImage); } } } if (prog != null) { prog(1, 1, MacSN, attLog, GUID, true); } }
public void SaveCardLog(string LogStr) { jsonBody <CardVerify> verifyPush = JsonConvert.DeserializeObject <jsonBody <CardVerify> >(LogStr); byte[] PhotoImage = null; int InOutMode = 0; int DevMode = 0; MacSN = verifyPush.info.DeviceID.ToString(); attLog.Remark = verifyPush.info.CardNo; UInt32 FingerNo = 0; attLog = new TFingerLog(); attLog.CardID = FingerNo.ToString("0000000000"); attLog.CardTime = DateTime.Parse(verifyPush.info.CreateTime); attLog.FingerNo = FingerNo; DataTableReader dr = SystemInfo.db.GetDataReader("SELECT * FROM VDI_MacInfo WHERE MacSN='" + MacSN + "'"); if (dr.Read()) { int.TryParse(dr["InOutMode"].ToString(), out InOutMode); int.TryParse(dr["DevModeID"].ToString(), out DevMode); } dr.Close(); attLog.InOutMode = InOutMode; readData.Sea_SetLogName(attLog, InOutMode, 1, 21); readData.WriteTextFile(attLog, MacSN); if (textFormat.Allow) { readData.WriteTextFormat(textFormat, attLog, MacSN); } if (DevMode == 0 || DevMode == 1) { readData.SaveDB(attLog, MacSN, true, ref GUID); if (GUID != "") { if (PhotoImage != null) { readData.SaveDBPhoto(GUID, PhotoImage); } } } if (attLog.VerifyMode == 0 || (attLog.VerifyMode != 2 && attLog.VerifyMode != 3)) { attLog.VerifyMode = attLog.DoorMode; attLog.VerifyModeName = attLog.DoorModeName; } readData.WriteTextFileMJ(attLog, MacSN); if (DevMode == 0 || DevMode == 2) { readData.SaveDBMJ(attLog, MacSN, true, ref GUID); if (GUID != "") { if (PhotoImage != null) { readData.SaveDBPhotoMJ(GUID, PhotoImage); } } } if (prog != null) { prog(1, 1, MacSN, attLog, GUID, true); } }
public void SaveFaceLog(string LogStr) { byte[] PhotoImage = null; string InOutMode = ""; string VerifyStatus = ""; int DevMode = 0; MonitoringLogs logs = JsonConvert.DeserializeObject <MonitoringLogs>(LogStr); MacSN = request.Headers.Get("dev_id"); //获取设备模式 DataTableReader dr = SystemInfo.db.GetDataReader("SELECT * FROM VDI_MacInfo WHERE MacSN='" + MacSN + "'"); if (dr.Read()) { Int32.TryParse(dr["DevModeID"].ToString(), out DevMode); } dr.Close(); attLog = new TFingerLog(); attLog.Remark = request.Headers.Get("Host"); UInt32 FingerNo = Convert.ToUInt32(logs.userId); attLog.CardID = FingerNo.ToString("0000000000"); attLog.CardTime = DateTime.Parse(readData.stringToTimeStr(logs.time)); attLog.FingerNo = FingerNo; InOutMode = logs.inOut; if (logs.doorMode == null) { attLog.DoorMode = 9; } else { attLog.DoorMode = readData.GetDoorMode(logs.doorMode); } VerifyStatus = logs.verifyMode; if (VerifyStatus != null) { attLog.VerifyMode = readData.GetVerifyModeID(VerifyStatus); } attLog.InOut = readData.GetInOut(InOutMode); attLog.IoMode = logs.ioMode; readData.Star_SetLogName(attLog); bool IsKQ = readData.IsKQData(attLog); if (IsKQ) { readData.WriteTextFile(attLog, MacSN); if (textFormat.Allow) { readData.WriteTextFormat(textFormat, attLog, MacSN); } if (DevMode == 0 || DevMode == 1) { readData.SaveDB(attLog, MacSN, true, ref GUID); if (GUID != "" && PhotoImage != null) { readData.SaveDBPhoto(GUID, PhotoImage); } } } else { if (attLog.VerifyMode == 0) { attLog.VerifyMode = attLog.DoorMode; attLog.VerifyModeName = attLog.DoorModeName; } readData.WriteTextFileMJ(attLog, MacSN); if (DevMode == 0 || DevMode == 2) { readData.SaveDBMJ(attLog, MacSN, true, ref GUID); if (GUID != "" && PhotoImage != null) { readData.SaveDBPhotoMJ(GUID, PhotoImage); } } } if (IsKQ && attLog.DoorMode > 0) { attLog.VerifyMode = attLog.DoorMode; attLog.VerifyModeName = attLog.DoorModeName; if (DevMode == 0 || DevMode == 2) { readData.SaveDBMJ(attLog, MacSN, true, ref GUID); if (GUID != "" && PhotoImage != null) { readData.SaveDBPhotoMJ(GUID, PhotoImage); } } } if (prog != null) { prog(1, 1, MacSN, attLog, GUID, true); } }