不同机具的通用的第二代居民身份证读写

    公安部已经大规模在全国范围内推广第二代居民身份证的换发工作,目前,许多地区二代证换发工作已经进行了很久。但是,相对应于二代证的推广,社会上许许多多的应用系统都还没有对二代证读卡开发相应的接口,为此,我写了一个通用的二代证机具读卡类,希望能对各位在各自的系统中开发这样的接口提供帮助。
    本类仅仅提供读卡的用法,写卡的方式我并没有写在里面,但是,相应的写调用我已经声明在里面,希望各位大侠能独自研究应用。26.gif
    该类接口具有如下特点:
    1、通用于目前市场上各个机具厂商的二代证读(写)机具。(想想,为不同厂商开发不同的接口确实令人头疼的,且由于接口不兼容,容易被客户骂死!knife.gif
    2、自动适应串口、USB口的各种机具
    3、能读文字信息,但是,要想正确读照片,必须需要机具厂商的授权文件Termb.Lic,且授权文件必须放在C盘根目录下。(我总不能不照顾机具厂商的利益吧01.gif
    4、除了上面第三条之外,您甚至不用安装机具的驱动程序,接上二代证机具即可使用。
    
    废话少说,下面看实现方法:

None.gif using  System;
None.gif
using  System.Drawing;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Windows.Forms;
None.gif
using  System.Runtime.InteropServices;
None.gif
using  System.Reflection ;
None.gif
using  System.IO;
None.gif
None.gif
None.gif
namespace  ICCard
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
public class clsICCard
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
//首先,声明通用接口
InBlock.gif
        [DllImport("sdtapi.dll")]
InBlock.gif        
public static extern int SDT_OpenPort(int iPortID);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ClosePort(int iPortID);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_PowerManagerBegin(int iPortID, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_AddSAMUser(int iPortID, string pcUserName, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_SAMLogin(int iPortID, string pcUserName, string pcPasswd, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_SAMLogout(int iPortID, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_UserManagerOK(int iPortID, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ChangeOwnPwd(int iPortID, string pcOldPasswd, string pcNewPasswd, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ChangeOtherPwd(int iPortID, string pcUserName, string pcNewPasswd, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_DeleteSAMUser(int iPortID, string pcUserName, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_StartFindIDCard(int iPortID, ref int pucIIN, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_SelectIDCard(int iPortID, ref int pucSN, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ReadBaseMsg(int iPortID, string pucCHMsg, ref int puiCHMsgLen, string pucPHMsg, ref int puiPHMsgLen, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ReadBaseMsgToFile(int iPortID, string fileName1, ref int puiCHMsgLen, string fileName2, ref int puiPHMsgLen, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_WriteAppMsg(int iPortID, ref byte pucSendData, int uiSendLen, ref byte pucRecvData, ref int puiRecvLen, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_WriteAppMsgOK(int iPortID, ref byte pucData, int uiLen, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_CancelWriteAppMsg(int iPortID, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ReadNewAppMsg(int iPortID, ref byte pucAppMsg, ref int puiAppMsgLen, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ReadAllAppMsg(int iPortID, ref byte pucAppMsg, ref int puiAppMsgLen, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_UsableAppMsg(int iPortID, ref byte ucByte, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_GetUnlockMsg(int iPortID, ref byte strMsg, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_GetSAMID(int iPortID, ref byte StrSAMID, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_SetMaxRFByte(int iPortID, byte ucByte, int iIfOpen);
InBlock.gif        [DllImport(
"sdtapi.dll")]
InBlock.gif        
public static extern int SDT_ResetSAM(int iPortID, int iIfOpen);
InBlock.gif
InBlock.gif        [DllImport(
"WltRS.dll")]
InBlock.gif        
public static extern int GetBmp(string file_name, int intf);
InBlock.gif
InBlock.gif        
public delegate void De_ReadICCardComplete(clsEDZ objEDZ);
InBlock.gif        
public event De_ReadICCardComplete ReadICCardComplete;
InBlock.gif        
private clsEDZ objEDZ = new clsEDZ();
InBlock.gif        
private int EdziIfOpen = 1;               //自动开关串口
InBlock.gif
        int EdziPortID;        
InBlock.gif        
public clsICCard()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public bool ReadICCard()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{           
InBlock.gif            
bool bUsbPort = false;
InBlock.gif            
int intOpenPortRtn = 0;
InBlock.gif            
int rtnTemp = 0;
InBlock.gif            
int pucIIN = 0;
InBlock.gif            
int pucSN = 0;
InBlock.gif            
int puiCHMsgLen = 0;
InBlock.gif            
int puiPHMsgLen = 0;
InBlock.gif
InBlock.gif            objEDZ 
= new clsEDZ();
InBlock.gif            
//检测usb口的机具连接,必须先检测usb
InBlock.gif
            for (int iPort = 1001; iPort <= 1016; iPort++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                intOpenPortRtn 
= SDT_OpenPort(iPort);
InBlock.gif                
if (intOpenPortRtn == 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    EdziPortID 
= iPort;
InBlock.gif                    bUsbPort 
= true;
InBlock.gif                    
break;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
//检测串口的机具连接
InBlock.gif
            if (!bUsbPort)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
for (int iPort = 1; iPort <= 2; iPort++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    intOpenPortRtn 
= SDT_OpenPort(iPort);
InBlock.gif                    
if (intOpenPortRtn == 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        EdziPortID 
= iPort;
InBlock.gif                        bUsbPort 
= false;
InBlock.gif                        
break;
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
if (intOpenPortRtn != 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{                             
InBlock.gif                MessageBox.Show(
"端口打开失败,请检测相应的端口或者重新连接读卡器!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                
return false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
//在这里,如果您想下一次不用再耗费检查端口的检查的过程,您可以把 EdziPortID 保存下来,可以保存在注册表中,也可以保存在配置文件中,我就不多写了,但是,
InBlock.gif            
//您要考虑机具连接端口被用户改变的情况哦
InBlock.gif
InBlock.gif            
//下面找卡
InBlock.gif
            rtnTemp = SDT_StartFindIDCard(EdziPortID, ref pucIIN, EdziIfOpen);
InBlock.gif            
if (rtnTemp != 159)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rtnTemp 
= SDT_StartFindIDCard(EdziPortID, ref pucIIN, EdziIfOpen);  //再找卡
InBlock.gif
                if (rtnTemp != 159)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{                                   
InBlock.gif                    rtnTemp 
= SDT_ClosePort(EdziPortID);
InBlock.gif                    MessageBox.Show(
"未放卡或者卡未放好,请重新放卡!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
return false;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
//选卡
InBlock.gif
            rtnTemp = SDT_SelectIDCard(EdziPortID, ref pucSN, EdziIfOpen);
InBlock.gif            
if (rtnTemp != 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                rtnTemp 
= SDT_SelectIDCard(EdziPortID, ref pucSN, EdziIfOpen);  //再选卡
InBlock.gif
                if (rtnTemp != 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{                                      
InBlock.gif                    rtnTemp 
= SDT_ClosePort(EdziPortID);
InBlock.gif                    MessageBox.Show(
"读卡失败!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
return false;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
//注意,在这里,用户必须有应用程序当前目录的读写权限
InBlock.gif
            FileInfo objFile = new FileInfo("wz.txt");
InBlock.gif            
if (objFile.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                objFile.Attributes 
= FileAttributes.Normal;
InBlock.gif                objFile.Delete();
ExpandedSubBlockEnd.gif            }

InBlock.gif            objFile 
= new FileInfo("zp.bmp");
InBlock.gif            
if (objFile.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                objFile.Attributes 
= FileAttributes.Normal;
InBlock.gif                objFile.Delete();
ExpandedSubBlockEnd.gif            }

InBlock.gif            objFile 
= new FileInfo("zp.wlt");
InBlock.gif            
if (objFile.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                objFile.Attributes 
= FileAttributes.Normal;
InBlock.gif                objFile.Delete();
ExpandedSubBlockEnd.gif            }

InBlock.gif            rtnTemp 
= SDT_ReadBaseMsgToFile(EdziPortID, "wz.txt"ref puiCHMsgLen, "zp.wlt"ref puiPHMsgLen, EdziIfOpen);
InBlock.gif            
if (rtnTemp != 144)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{                        
InBlock.gif                rtnTemp 
= SDT_ClosePort(EdziPortID);
InBlock.gif                MessageBox.Show(
"读卡失败!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                
return false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
//下面解析照片,注意,如果在C盘根目录下没有机具厂商的授权文件Termb.Lic,照片解析将会失败
InBlock.gif
            if (bUsbPort)
InBlock.gif                rtnTemp 
= GetBmp("zp.wlt"2);
InBlock.gif            
else
InBlock.gif                rtnTemp 
= GetBmp("zp.wlt"1);
InBlock.gif            
switch (rtnTemp)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
case 0:
InBlock.gif                    MessageBox.Show(
"调用sdtapi.dll错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case 1:   //正常
InBlock.gif
                    break;
InBlock.gif                
case -1:
InBlock.gif                    MessageBox.Show(
"相片解码错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case -2:
InBlock.gif                    MessageBox.Show(
"wlt文件后缀错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case -3:
InBlock.gif                    MessageBox.Show(
"wlt文件打开错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case -4:
InBlock.gif                    MessageBox.Show(
"wlt文件格式错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case -5:
InBlock.gif                    MessageBox.Show(
"软件未授权!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
InBlock.gif                
case -6:
InBlock.gif                    MessageBox.Show(
"设备连接错误!""提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
InBlock.gif                    
break;
ExpandedSubBlockEnd.gif            }

InBlock.gif            rtnTemp 
= SDT_ClosePort(EdziPortID);
InBlock.gif            FileInfo f 
= new FileInfo("wz.txt");
InBlock.gif            FileStream fs 
= f.OpenRead();
InBlock.gif            
byte[] bt = new byte[fs.Length];
InBlock.gif            fs.Read(bt, 
0, (int)fs.Length);
InBlock.gif            fs.Close();
InBlock.gif
InBlock.gif            
string str = System.Text.UnicodeEncoding.Unicode.GetString(bt);
InBlock.gif
InBlock.gif            objEDZ.Name 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 030).Trim();
InBlock.gif            objEDZ.Sex_Code 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 302).Trim();
InBlock.gif            objEDZ.NATION_Code 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 324).Trim();
InBlock.gif            
string strBird = System.Text.UnicodeEncoding.Unicode.GetString(bt, 3616).Trim();
InBlock.gif            objEDZ.BIRTH 
= Convert.ToDateTime(strBird.Substring(04+ "" + strBird.Substring(42+ "" + strBird.Substring(6+ "");
InBlock.gif            objEDZ.ADDRESS 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 5270).Trim();
InBlock.gif            objEDZ.IDC 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 12236).Trim();
InBlock.gif            objEDZ.REGORG 
= System.Text.UnicodeEncoding.Unicode.GetString(bt, 15830).Trim();
InBlock.gif            
string strTem = System.Text.UnicodeEncoding.Unicode.GetString(bt, 188, bt.GetLength(0- 188).Trim();
InBlock.gif            objEDZ.STARTDATE 
= Convert.ToDateTime(strTem.Substring(04+ "" + strTem.Substring(42+ "" + strTem.Substring(62+ "");
InBlock.gif            strTem 
= strTem.Substring(8);
InBlock.gif            
if (strTem.Trim() != "长期")
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                objEDZ.ENDDATE 
= Convert.ToDateTime(strTem.Substring(04+ "" + strTem.Substring(42+ "" + strTem.Substring(62+ "");
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                objEDZ.ENDDATE 
= DateTime.MaxValue;
ExpandedSubBlockEnd.gif            }

InBlock.gif            objFile 
= new FileInfo("zp.bmp");
InBlock.gif            
if (objFile.Exists)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Image img 
= Image.FromFile("zp.bmp");
InBlock.gif                objEDZ.PIC_Image
=(Image)img.Clone();
InBlock.gif                System.IO.MemoryStream m 
= new MemoryStream();
InBlock.gif                img.Save(m, System.Drawing.Imaging.ImageFormat.Jpeg);
InBlock.gif                objEDZ.PIC_Byte 
= m.ToArray();
InBlock.gif                img.Dispose();
InBlock.gif                img 
= null;
ExpandedSubBlockEnd.gif            }

InBlock.gif            ReadICCardComplete(objEDZ);           
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif    
public class clsEDZ
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private System.Collections.SortedList lstMZ = new SortedList();
InBlock.gif        
private string _Name;   //姓名
InBlock.gif
        private string _Sex_Code;   //性别代码
InBlock.gif
        private string _Sex_CName;   //性别
InBlock.gif
        private string _IDC;      //身份证号码
InBlock.gif
        private string _NATION_Code;   //民族代码
InBlock.gif
        private string _NATION_CName;   //民族
InBlock.gif
        private DateTime _BIRTH;     //出生日期
InBlock.gif
        private string _ADDRESS;    //住址
InBlock.gif
        private string _REGORG;     //签发机关
InBlock.gif
        private DateTime _STARTDATE;    //身份证有效起始日期
InBlock.gif
        private DateTime _ENDDATE;    //身份证有效截至日期
InBlock.gif
        private string _Period_Of_Validity_Code;   //有效期限代码,许多原来系统上面为了一代证考虑,常常存在这样的字段,二代证中已经没有了
InBlock.gif
        private string _Period_Of_Validity_CName;   //有效期限
InBlock.gif
        private byte[] _PIC_Byte;    //照片二进制
InBlock.gif
        private Image _PIC_Image;   //照片
InBlock.gif

InBlock.gif        
public clsEDZ()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            lstMZ.Add(
"01""汉族");
InBlock.gif            lstMZ.Add(
"02""蒙古族");
InBlock.gif            lstMZ.Add(
"03""回族");
InBlock.gif            lstMZ.Add(
"04""藏族");
InBlock.gif            lstMZ.Add(
"05""维吾尔族");
InBlock.gif            lstMZ.Add(
"06""苗族");
InBlock.gif            lstMZ.Add(
"07""彝族");
InBlock.gif            lstMZ.Add(
"08""壮族");
InBlock.gif            lstMZ.Add(
"09""布依族");
InBlock.gif            lstMZ.Add(
"10""朝鲜族");
InBlock.gif            lstMZ.Add(
"11""满族");
InBlock.gif            lstMZ.Add(
"12""侗族");
InBlock.gif            lstMZ.Add(
"13""瑶族");
InBlock.gif            lstMZ.Add(
"14""白族");
InBlock.gif            lstMZ.Add(
"15""土家族");
InBlock.gif            lstMZ.Add(
"16""哈尼族");
InBlock.gif            lstMZ.Add(
"17""哈萨克族");
InBlock.gif            lstMZ.Add(
"18""傣族");
InBlock.gif            lstMZ.Add(
"19""黎族");
InBlock.gif            lstMZ.Add(
"20""傈僳族");
InBlock.gif            lstMZ.Add(
"21""佤族");
InBlock.gif            lstMZ.Add(
"22""畲族");
InBlock.gif            lstMZ.Add(
"23""高山族");
InBlock.gif            lstMZ.Add(
"24""拉祜族");
InBlock.gif            lstMZ.Add(
"25""水族");
InBlock.gif            lstMZ.Add(
"26""东乡族");
InBlock.gif            lstMZ.Add(
"27""纳西族");
InBlock.gif            lstMZ.Add(
"28""景颇族");
InBlock.gif            lstMZ.Add(
"29""柯尔克孜族");
InBlock.gif            lstMZ.Add(
"30""土族");
InBlock.gif            lstMZ.Add(
"31""达翰尔族");
InBlock.gif            lstMZ.Add(
"32""仫佬族");
InBlock.gif            lstMZ.Add(
"33""羌族");
InBlock.gif            lstMZ.Add(
"34""布朗族");
InBlock.gif            lstMZ.Add(
"35""撒拉族");
InBlock.gif            lstMZ.Add(
"36""毛南族");
InBlock.gif            lstMZ.Add(
"37""仡佬族");
InBlock.gif            lstMZ.Add(
"38""锡伯族");
InBlock.gif            lstMZ.Add(
"39""阿昌族");
InBlock.gif            lstMZ.Add(
"40""普米族");
InBlock.gif            lstMZ.Add(
"41""塔吉克族");
InBlock.gif            lstMZ.Add(
"42""怒族");
InBlock.gif            lstMZ.Add(
"43""乌孜别克族");
InBlock.gif            lstMZ.Add(
"44""俄罗斯族");
InBlock.gif            lstMZ.Add(
"45""鄂温克族");
InBlock.gif            lstMZ.Add(
"46""德昂族");
InBlock.gif            lstMZ.Add(
"47""保安族");
InBlock.gif            lstMZ.Add(
"48""裕固族");
InBlock.gif            lstMZ.Add(
"49""京族");
InBlock.gif            lstMZ.Add(
"50""塔塔尔族");
InBlock.gif            lstMZ.Add(
"51""独龙族");
InBlock.gif            lstMZ.Add(
"52""鄂伦春族");
InBlock.gif            lstMZ.Add(
"53""赫哲族");
InBlock.gif            lstMZ.Add(
"54""门巴族");
InBlock.gif            lstMZ.Add(
"55""珞巴族");
InBlock.gif            lstMZ.Add(
"56""基诺族");
InBlock.gif            lstMZ.Add(
"57""其它");
InBlock.gif            lstMZ.Add(
"98""外国人入籍");
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public string Name
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _Name; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _Name = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Sex_Code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _Sex_Code; }
InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                _Sex_Code 
= value;
InBlock.gif                
switch (value)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
case "1":
InBlock.gif                        Sex_CName 
= "";
InBlock.gif                        
break;
InBlock.gif                    
case "2":
InBlock.gif                        Sex_CName 
= "";
InBlock.gif                        
break;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Sex_CName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _Sex_CName; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _Sex_CName = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string IDC
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _IDC; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _IDC = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string NATION_Code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _NATION_Code; }
InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                _NATION_Code 
= value;
InBlock.gif                
if (lstMZ.Contains(value))
InBlock.gif                    NATION_CName 
= lstMZ[value].ToString();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string NATION_CName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _NATION_CName; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _NATION_CName = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public DateTime BIRTH
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _BIRTH; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _BIRTH = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string ADDRESS
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _ADDRESS; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _ADDRESS = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string REGORG
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _REGORG; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _REGORG = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public DateTime STARTDATE
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _STARTDATE; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _STARTDATE = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public DateTime ENDDATE
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _ENDDATE; }
InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                _ENDDATE 
= value;
InBlock.gif                
if (_ENDDATE == DateTime.MaxValue)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    _Period_Of_Validity_Code 
= "3";
InBlock.gif                    _Period_Of_Validity_CName 
= "长期";
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (_STARTDATE != DateTime.MinValue)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
switch (value.AddDays(1).Year - _STARTDATE.Year)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
case 5:
InBlock.gif                                _Period_Of_Validity_Code 
= "4";
InBlock.gif                                _Period_Of_Validity_CName 
= "5年";
InBlock.gif                                
break;
InBlock.gif                            
case 10:
InBlock.gif                                _Period_Of_Validity_Code 
= "1";
InBlock.gif                                _Period_Of_Validity_CName 
= "10年";
InBlock.gif                                
break;
InBlock.gif                            
case 20:
InBlock.gif                                _Period_Of_Validity_Code 
= "2";
InBlock.gif                                _Period_Of_Validity_CName 
= "20年";
InBlock.gif                                
break;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Period_Of_Validity_Code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _Period_Of_Validity_Code; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _Period_Of_Validity_Code = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Period_Of_Validity_CName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _Period_Of_Validity_CName; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _Period_Of_Validity_CName = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public byte[] PIC_Byte
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _PIC_Byte; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _PIC_Byte = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public Image PIC_Image
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn _PIC_Image; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{ _PIC_Image = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

   类中使用到了两个dll文件(sdtapi.dll和WltRS.dll),点击这里下载!

 

转载于:https://www.cnblogs.com/name-lh/archive/2006/01/28/324003.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值