Esempio n. 1
0
        int DeleteFingerPrint(string strOldRecord,
                              out string strError)
        {
            strError = "";
            XmlDocument old_dom = new XmlDocument();

            old_dom.LoadXml(strOldRecord);

            string strReaderBarcode = GetReaderBarcode(old_dom);

            if (string.IsNullOrEmpty(strReaderBarcode) == false)
            {
                FingerprintItem item = new FingerprintItem
                {
                    FingerprintString = "",
                    ReaderBarcode     = strReaderBarcode
                };
                // return:
                //      0   成功
                //      其他  失败。错误码
                int nRet = AddItems(
                    new List <FingerprintItem> {
                    item
                },
                    out strError);
                if (nRet != 0)
                {
                    return(-1);
                }
            }

            return(0);
        }
Esempio n. 2
0
        // 验证读者指纹. 1:1比对
        // parameters:
        //      item    读者信息。ReaderBarcode成员提供了读者证条码号,FingerprintString提供了指纹特征码
        //              如果 FingerprintString 不为空,则用它和当前采集的指纹进行比对;
        //              否则用 ReaderBarcode,对高速缓存中的指纹进行比对
        // return:
        //      -1  出错
        //      0   不匹配
        //      1   匹配
        public int VerifyFingerprint(FingerprintItem item,
                                     out string strError)
        {
            strError = "";

            return(0);

#if NO
            // 等到扫描一次指纹
            // 这次的扫描不要进行自动比对,也不要键盘仿真

            string strTemplate = item.FingerprintString;

            bool bRet = this.m_host.VerFingerFromStr(ref strTemplate,
                                                     strThisString,
                                                     false,
                                                     ref bChanged);
#endif
        }
Esempio n. 3
0
        // 写入新记录的指纹缓存
        int AddFingerPrint(string strRecord,
                           out string strError)
        {
            strError = "";

            XmlDocument new_dom = new XmlDocument();

            new_dom.LoadXml(strRecord);

            string strReaderBarcode = GetReaderBarcode(new_dom);

            if (string.IsNullOrEmpty(strReaderBarcode))
            {
                return(0);
            }
            string strFingerPrintString = DomUtil.GetElementText(new_dom.DocumentElement,
                                                                 this.ElementName);

            // TODO: 看新旧记录之间 fingerprint 之间的差异。有差异才需要覆盖进入高速缓存
            FingerprintItem item = new FingerprintItem
            {
                FingerprintString = strFingerPrintString,
                ReaderBarcode     = strReaderBarcode
            };
            // return:
            //      0   成功
            //      其他  失败。错误码
            int nRet = AddItems(
                new List <FingerprintItem> {
                item
            },
                out strError);

            if (nRet != 0)
            {
                return(-1);
            }

            return(1);
        }
Esempio n. 4
0
        // 根据结果集文件初始化指纹高速缓存
        // parameters:
        //      resultset   用于初始化的结果集对象。如果为 null,表示希望清空指纹高速缓存
        //                  一般可用 null 调用一次,然后用多个 resultset 对象逐个调用一次
        // return:
        //      -1  出错
        //      >=0 实际发送给接口程序的事项数目
        int CreateFingerprintCache(DpResultSet resultset,
                                   out string strError)
        {
            strError = "";
            int nRet = 0;

            this.ShowMessage("加入高速缓存");

            try
            {
                if (resultset == null)
                {
                    // 清空以前的全部缓存内容,以便重新建立
                    // return:
                    //      0   成功
                    //      其他  失败。错误码
                    nRet = this.AddItems(
                        null,
                        out strError);
                    if (nRet != 0)
                    {
                        return(-1);
                    }

                    return(0);
                }

                int  nSendCount = 0;
                long nCount     = resultset.Count;
                List <FingerprintItem> items = new List <FingerprintItem>();
                for (long i = 0; i < nCount; i++)
                {
                    DpRecord record = resultset[i];

                    //string strTimestamp = "";
                    //string strBarcode = "";
                    //string strFingerprint = "";
                    ParseResultItemString(record.BrowseText,
                                          out string strTimestamp,
                                          out string strBarcode,
                                          out string strFingerprint);
                    // TODO: 注意读者证条码号为空的,不要发送出去


                    FingerprintItem item = new FingerprintItem
                    {
                        ReaderBarcode     = strBarcode,
                        FingerprintString = strFingerprint
                    };

                    items.Add(item);
                    if (items.Count >= 100)
                    {
                        // return:
                        //      0   成功
                        //      其他  失败。错误码
                        nRet = this.AddItems(
                            items,
                            out strError);
                        if (nRet != 0)
                        {
                            return(-1);
                        }

                        nSendCount += items.Count;
                        items.Clear();
                    }
                }

                if (items.Count > 0)
                {
                    // return:
                    //      0   成功
                    //      其他  失败。错误码
                    nRet = this.AddItems(
                        items,
                        out strError);
                    if (nRet != 0)
                    {
                        return(-1);
                    }

                    nSendCount += items.Count;
                }

                // Console.Beep(); // 表示读取成功
                return(nSendCount);
            }
            finally
            {
            }
        }