/// <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> /// <param name="condition">查找条件</param> /// <returns></returns> public List <PeopleInfo> SearchAllPeople(String condition) { List <PeopleInfo> result = new List <PeopleInfo>(); foreach (string path in getFiles()) { string historyPath = HISTORY_DIR + "/" + path + HISTORY_SUFFIX; if (File.Exists(historyPath)) { StreamReader sr = new StreamReader(historyPath, Encoding.UTF8); String line; while ((line = sr.ReadLine()) != null) { PeopleInfo temPeople = new PeopleInfo(line); if (temPeople.name.Contains(condition) || temPeople.serialId.Equals(condition) || temPeople.cardId.Equals(condition)) { result.Add(new PeopleInfo(line)); } } sr.Close(); sr.Dispose(); result.Sort(); result.Reverse(); } } return(result); }
private void addListItem(PeopleInfo toAdd) { lv_print_history.BeginUpdate(); ListViewItem lvi = new ListViewItem(); lvi.Text = toAdd.name; lvi.SubItems.Add(toAdd.serialId); lvi.SubItems.Add(toAdd.addTime); lvi.Tag = toAdd; lv_print_history.Items.Insert(0, lvi); lv_print_history.EndUpdate(); }
/// <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()); } }
private void printBoxCode(PeopleInfo printPeople) { printBoxCode(printPeople.serialId, printPeople.cardId, printPeople.name, printPeople.cardId, printPeople.age, printPeople.sex, printPeople.serialId); }