private void fillData() { idCard = CVRSDK.getFarmerCard(); tName.Text = idCard.tName.Trim(); tSex.Text = idCard.tSex.Trim(); tNation.Text = idCard.tNation.Trim(); tCode.Text = idCard.tCode.Trim(); tAddress.Text = idCard.tAddress.Trim(); tBrith.Text = GetTime(idCard.tBirth.ToString()).ToString().Substring(0, 10); tInstitution.Text = idCard.tInstitution.Trim(); tValidity.Text = idCard.tValidity.Trim(); //pictureBox1.Image.Tag = idCard.tPhotoBox1.Trim(); // pictureBox1.Image = idCard.tPhotoBox1; }
public static IDCard getFarmerCard() { IDCard idCard = new IDCard(); try { //pictureBox1.ImageLocation = Application.StartupPath + "\\zp.bmp"; byte[] tName = new byte[30]; int length = 20; CVRSDK.GetPeopleName(ref tName[0], ref length); byte[] idCode = new byte[30]; length = 36; CVRSDK.GetPeopleIDCode(ref idCode[0], ref length); byte[] tNation = new byte[30]; length = 3; CVRSDK.GetPeopleNation(ref tNation[0], ref length); byte[] tValidity = new byte[30]; length = 16; CVRSDK.GetEndDate(ref tValidity[0], ref length); byte[] tBirth = new byte[30]; length = 16; CVRSDK.GetPeopleBirthday(ref tBirth[0], ref length); byte[] tAddress = new byte[50]; length = 70; CVRSDK.GetPeopleAddress(ref tAddress[0], ref length); byte[] tInstitution = new byte[30]; length = 30; CVRSDK.GetDepartment(ref tInstitution[0], ref length); byte[] tSex = new byte[30]; length = 3; CVRSDK.GetPeopleSex(ref tSex[0], ref length); //byte[] tPhoto = new byte[200]; //length = 200; //CVRSDK.GetPhotoBMP(tPhoto[0], length); //对获取到的人的身份证信息字符串进行处理 idCard.tName = Encoding.GetEncoding("GB2312").GetString(tName); idCard.tSex = Encoding.GetEncoding("GB2312").GetString(tSex); idCard.tCode = Encoding.GetEncoding("GB2312").GetString(idCode); idCard.tNation = Encoding.GetEncoding("GB2312").GetString(tNation); idCard.tValidity = Encoding.GetEncoding("GB2312").GetString(tValidity); string str = Encoding.GetEncoding("GB2312").GetString(tBirth); str = str.Substring(0, 10); idCard.tBirth = ConvertDateTimeInt(Convert.ToDateTime(str)); idCard.tAddress = Encoding.GetEncoding("GB2312").GetString(tAddress); //string range = card.ValidTermOfStart + "-" + card.ValidTermOfEnd; //range += "- " + card.ValidTermOfEnd; idCard.tInstitution = Encoding.GetEncoding("GB2312").GetString(tInstitution); //idCard.tPhotoBox1 = Encoding.GetEncoding("GB2312").GetString(tPhoto); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(idCard); }