/// <summary> /// 打印记录 /// </summary> /// <param name="toSavePeople">记录(个人信息)</param> /// <param name="dt">打印时间</param> public void WriteHistory(PeopleInfo toSavePeople, DateTime dt) { string historyPath = HISTORY_DIR + "/" + DateTime.Now.ToString("yy-MM-dd") + HISTORY_SUFFIX; WriteFile(historyPath, toSavePeople.ToString(), true); toSavePeople.clearInfo(); }
/// <summary> /// 填充数据 /// </summary> public void FillData(PeopleInfo toSavePeople) { toSavePeople.clearInfo(); try { byte[] name = new byte[30]; int length = 30; CVRSDK.GetPeopleName(ref name[0], ref length); //MessageBox.Show(); byte[] number = new byte[30]; length = 36; CVRSDK.GetPeopleIDCode(ref number[0], ref length); byte[] people = new byte[30]; length = 3; CVRSDK.GetPeopleNation(ref people[0], ref length); byte[] validtermOfStart = new byte[30]; length = 16; CVRSDK.GetStartDate(ref validtermOfStart[0], ref length); byte[] birthday = new byte[30]; length = 16; CVRSDK.GetPeopleBirthday(ref birthday[0], ref length); byte[] address = new byte[30]; length = 70; CVRSDK.GetPeopleAddress(ref address[0], ref length); byte[] validtermOfEnd = new byte[30]; length = 16; CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length); byte[] signdate = new byte[30]; length = 30; CVRSDK.GetDepartment(ref signdate[0], ref length); byte[] sex = new byte[30]; length = 3; CVRSDK.GetPeopleSex(ref sex[0], ref length); byte[] samid = new byte[32]; CVRSDK.CVR_GetSAMID(ref samid[0]); toSavePeople.sex = Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim(); toSavePeople.age = Convert.ToString(GetAgeByBirthdate(Convert.ToDateTime(Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim()))); toSavePeople.cardId = Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim(); toSavePeople.name = Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim(); toSavePeople.serialId = Convert.ToString(serialId);// DateTime.Now.ToString("yyyyMMddHHmm"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }