Processing of employee names in the use of the SDK for the central control attendance machine (C #)

Source: Internet
Author: User

The attendance machine used by the company is the fingerprint attendance machine of the control, but the model of the control is messy, the model which is read out by the program is inconsistent with the actual Standard model.

In addition, the C # version of the supplied development package is called in the demo

Axczkem1.readalluserid (Imachinenumber);

Called after

Axczkem1.ssr_getalluserinfo (Imachinenumber, out-sdwenrollnumber, out-sName, out-Spassword, out-Iprivilege, out bEnabled)

To get all the user information, the returned sname (employee name) is always at the back of a few more bytes at a time, although Windows automatically blocks garbled characters when displayed in the ListView in the demo, but the program is still garbled when it is processed.

Use the following method to resolve the problem and resolve the correct employee name from the sname.

 //handling extra characters in a name//UTF8 the length of the encoded byte array, the number of Chinese characters in the name = (byte[] length -10)/6+2//extracting Chinese characters = 0 of the byte array begins, the number of Chinese characters in the name                if(NULL!=sName) {                                        byte[] Namebytes =System.Text.Encoding.UTF8.GetBytes (sName); if(Namebytes.length >=Ten)                    {                        intNamelength = (Namebytes.length-Ten) /6+2; SName= System.Text.Encoding.UTF8.GetString (Namebytes,0,3*namelength); }                    /*switch (namebytes.length) {case 22:                            SName = System.Text.Encoding.UTF8.GetString (namebytes, 0, 12);                        Break                            Case 16:sname = System.Text.Encoding.UTF8.GetString (namebytes, 0, 9);                        Break                            Case 10:sname = System.Text.Encoding.UTF8.GetString (namebytes, 0, 6);                        Break                            Default:sname = Getchinese (sName);                    Break }                   */                }                Else{sName="NULL"; }

By the way the slot under the central control of the attendance Machine SDK:

Unable to get the attendance data for the specified time, it must be downloaded in full volume each time.

By the way, the quality of the demo:

The programming style is very rigorous, the code comment is very detailed. Praise!

Processing of employee names in the use of the SDK for the central control attendance machine (C #)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.