Beispiel #1
0
 public void SendOcrResult(string data)
 {
     ////var cli = new System.Net.WebClient();
     ////cli.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json";
     ////byte[] buf = Encoding.UTF8.GetBytes(data);
     ////string response = Encoding.UTF8.GetString(cli.UploadData(URL_OCR_API, buf));
     //////string response = cli.UploadString(URL_OCR_API, data);
     _RESULT = JsonConvert.DeserializeObject <OCR_BUF>(data);
     _EVENT.Set();
     _EVENT.Reset();
 }
        public OCR_RESULT(bool ok_, OCR_BUF data_)
        {
            var o = this;

            o.ok         = ok_;
            o.ocr_result = data_;

            string s = data_.DataFront.Trim(), err = string.Empty;

            string[] a;

            // id
            a    = ___extract_startWith(s, "số");
            o.id = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // fullname
            a          = ___extract_startWith(s, "tên");
            o.fullname = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // birthday
            a          = ___extract_startWith(s, "ngày", 1, -1, OCR_DATA_TYPE.DATE_TIME_BIRTHDAY);
            o.birthday = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // address
            a         = ___extract_startWith(s, "trú", 2);
            o.address = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // expiry
            a        = ___extract_startWith(s, "giá trị đến", 1, -1, OCR_DATA_TYPE.DATE_TIME_BIRTHDAY);
            o.expiry = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // expiry
            a        = ___extract_startWith(s, "giới tính", 1, 1);
            o.gender = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            //---------------------

            s = data_.DataBack.Trim();

            // signal_description
            a = ___extract_startWith(s, "nhận dạng", 2, -1);
            o.signal_description = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }

            // signal_description
            a             = ___extract_startWith(s, "ngày", 1, -1, OCR_DATA_TYPE.DATE_TIME_BIRTHDAY);
            o.date_active = a[0];
            if (err.Length == 0)
            {
                err = a[2];
            }


            ocr_error = err;
        }