• 大小: 816KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: C#
  • 标签:

资源简介

C#:汉王人脸通SDK示例代码(五)获取考勤记录 using(FaceId Client = new FaceId(textBoxDeviceIP.Text, Convert.ToInt32(textBoxDevicePort.Text))) { // 获取截止到当前的所有考勤记录 String Answer; FaceId_ErrorCode ErrorCode = Client.Execute("GetRecord(end_time=\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\")", out Answer, DeviceCodePage);

资源截图

代码片段和文件信息

/* ----------------------------------------------------------
 * 文件名称:Form1.cs
 * 作者:秦建辉
 * 
 * QQ:36748897
 * 
 * 博客:http://www.firstsolver.com/wordpress/
 * 
 * 开发环境:
 *      Visual Studio V2013
 *      .NET framework 4.0
 *      
 * 版本历史: 
 *      V1.0 2014年09月12日
 *              人脸通SDK演示:人脸模板导入导出
------------------------------------------------------------ */
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Regularexpressions;
using System.Windows.Forms;

namespace Splash
{
    public partial class Form1 : Form
    {
        /// 
        /// 设备通信字符集编码为简体中文GB2312
        /// 

        public const Int32 DeviceCodePage = 936;

        public Form1()
        {
            InitializeComponent();
        }

        private void buttonExport_Click(object sender EventArgs e)
        {
            // 检测导出文件路径
            String SaveFileName;
            try
            {
                SaveFileName = Path.GetFullPath(textBoxExportFileName.Text);
            }
            catch
            {
                MessageBox.Show(“不正确的导出文件路径!“ “错误“ MessageBoxButtons.OK MessageBoxIcon.Error);
                return;
            }

            // 连接到设备
            try
            {
                using (FaceId Client = new FaceId(textBoxExportIP.Text Convert.ToInt32(textBoxExportPort.Text)))
                {
                    // 获取员工工号集合
                    String Answer;
                    FaceId_ErrorCode ErrorCode = Client.Execute(“GetEmployeeID()“ out Answer DeviceCodePage);
                    if (ErrorCode == FaceId_ErrorCode.Success)
                    {   // 获取所有数据项
                        FaceId_Item[] ItemCollection = FaceId_Item.GetAllItems(Answer);
                        if (ItemCollection != null)
                        {   // 成功导出的人员数
                            Int32 SaveIdCount = 0;

                            // 基于LINQ查询提取员工工号集合
                            String[] EmployeeIdCollection = (from item in ItemCollection where (item.Name.Equals(“id“)) select item.Value).ToArray();
                            using (StreamWriter sw = new StreamWriter(SaveFileName false Encoding.UTF8))
                            {
                                foreach (String EmployeeId in EmployeeIdCollection)
                                {
                                    ErrorCode = Client.Execute(“GetEmployee(id=\““ + EmployeeId + “\“)“ out Answer DeviceCodePage);
                                    if (ErrorCode == FaceId_ErrorCode.Success)
                                    {
                                        sw.WriteLine(Answer);
                                        SaveIdCount++;
                                    }
                                }
                            }

                            String Content = “成功导出人员“ + SaveIdCount + “

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-09-13 13:19  Example Project\
     目录           0  2014-09-13 13:24  Example Project\FaceIdDemo\
     目录           0  2014-09-13 13:24  Example Project\FaceIdDemo\EXIMPORT\
     文件         199  2014-09-12 08:54  Example Project\FaceIdDemo\EXIMPORT\App.config
     文件        3881  2014-09-12 09:09  Example Project\FaceIdDemo\EXIMPORT\EXIMPORT.csproj
     文件      372526  2010-09-14 17:22  Example Project\FaceIdDemo\EXIMPORT\FireEyes.ico
     文件        9287  2014-09-13 12:16  Example Project\FaceIdDemo\EXIMPORT\Form1.cs
     文件       16636  2014-09-13 11:44  Example Project\FaceIdDemo\EXIMPORT\Form1.Designer.cs
     文件      564907  2014-09-13 11:44  Example Project\FaceIdDemo\EXIMPORT\Form1.resx
     文件         518  2014-07-24 12:04  Example Project\FaceIdDemo\EXIMPORT\Program.cs
     目录           0  2014-09-13 13:19  Example Project\FaceIdDemo\EXIMPORT\Properties\
     文件        1340  2014-07-24 10:52  Example Project\FaceIdDemo\EXIMPORT\Properties\AssemblyInfo.cs
     文件        2852  2014-09-12 08:54  Example Project\FaceIdDemo\EXIMPORT\Properties\Resources.Designer.cs
     文件        5612  2014-07-24 10:52  Example Project\FaceIdDemo\EXIMPORT\Properties\Resources.resx
     文件        1106  2014-09-12 08:54  Example Project\FaceIdDemo\EXIMPORT\Properties\Settings.Designer.cs
     文件         249  2014-07-24 10:52  Example Project\FaceIdDemo\EXIMPORT\Properties\Settings.settings
     文件        2953  2014-09-13 10:25  Example Project\FaceIdDemo\FaceIdDemo.sln
     目录           0  2014-09-13 13:24  Example Project\FaceIdDemo\GetRecord\
     文件         199  2014-09-13 10:24  Example Project\FaceIdDemo\GetRecord\App.config
     文件      372526  2014-09-13 10:27  Example Project\FaceIdDemo\GetRecord\FireEyes.ico
     文件        2596  2014-09-13 12:02  Example Project\FaceIdDemo\GetRecord\Form1.cs
     文件        6844  2014-09-13 11:43  Example Project\FaceIdDemo\GetRecord\Form1.Designer.cs
     文件      564907  2014-09-13 11:43  Example Project\FaceIdDemo\GetRecord\Form1.resx
     文件        3882  2014-09-13 11:11  Example Project\FaceIdDemo\GetRecord\GetRecord.csproj
     文件         518  2014-09-13 10:25  Example Project\FaceIdDemo\GetRecord\Program.cs
     目录           0  2014-09-13 13:19  Example Project\FaceIdDemo\GetRecord\Properties\
     文件        1342  2014-09-13 10:24  Example Project\FaceIdDemo\GetRecord\Properties\AssemblyInfo.cs
     文件        2852  2014-09-13 10:25  Example Project\FaceIdDemo\GetRecord\Properties\Resources.Designer.cs
     文件        5612  2014-09-13 10:24  Example Project\FaceIdDemo\GetRecord\Properties\Resources.resx
     文件        1106  2014-09-13 10:25  Example Project\FaceIdDemo\GetRecord\Properties\Settings.Designer.cs
     文件         249  2014-09-13 10:24  Example Project\FaceIdDemo\GetRecord\Properties\Settings.settings
............此处省略49个文件信息

评论

共有 条评论

相关资源