Ejemplo n.º 1
0
        public ActionResult Read()
        {
            Person person = new Person()
            {
                id = "11",Birthday = "10/10/2000",Sex="M",
                Th_Prefix = "Mr.", Th_Firstname = "Test", Th_Lastname = "test"
            };
            ThaiIDCard idcard = new ThaiIDCard();
            Personal personal = idcard.readAll();
            return RedirectToAction("Test", "Home");
            if (personal != null)
            {
                person.id = personal.Citizenid;
                person.Birthday = personal.Birthday.ToString("dd/MM/yyyy");
                person.Sex = personal.Sex;
                person.Th_Prefix = personal.Th_Prefix;
                person.Th_Firstname = personal.Th_Firstname;
                person.Th_Lastname = personal.Th_Lastname;
            }
            else
            {

            }
            return View("Test", person);
        }
Ejemplo n.º 2
0
 private void InitializeProperties()
 {
     _thaiIdCard = new ThaiIDCard();
     _thaiIdCard.eventCardInserted       += new handleCardInserted(OnCompleteReadCard);
     _thaiIdCard.eventPhotoProgress      += new handlePhotoProgress(OnPhotoProgress);
     _thaiIdCard.eventBeforeCardInserted += new handleBeforeCardInserted(OnBeginReadCard);
     _thaiIdCard.eventCardReadError      += new handleCardReadError(OnErrorReadCard);
     _thaiIdCard.eventCardRemoved        += new handleCardRemoved(OnRemoveCard);
     _thaiIdCard.eventReaderDisconnected += new handleReaderDisconnected(OnReaderDisconnected);
     btnClear.Enabled = false;
 }
Ejemplo n.º 3
0
        private void btnSmartCard_Click(object sender, EventArgs e)
        {
            btnSmartCard.Enabled = false;
            ThaiIDCard idcard = new ThaiIDCard();
            Personal personal = idcard.readAll();
            Personal personal_photo = idcard.readAllPhoto();

            if (personal != null)
            {
                btnSelectImage.Visible = false;
                txtCitizenId.Text = personal.Citizenid;
                txtName.Text = personal.Th_Firstname;
                txtLastname.Text = personal.Th_Lastname;

                rdbMan.Checked = personal.Sex == "1";
                rdbWoman.Checked = personal.Sex != "1";
                cbbProvince.SelectedItem = personal.addrProvince.Replace("จังหวัด", "");
                //lblProvince.Text = personal.addrAmphur + " " + personal.addrProvince  personal.addrTambol;

                string[] address = personal.Address.Replace(personal.addrTambol, "").Replace(personal.addrAmphur, "").Replace(personal.addrProvince, "").Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                StringBuilder sb = new StringBuilder(address[0]);
                for (int i = 1; i < address.Length; i++)
                {
                    sb.Append(" " + address[i]);
                }
                txtAddress1.Text = sb.ToString();

                txtSubDistrict.Text = personal.addrTambol.Replace("แขวง", "").Replace("ตำบล", "");
                cbbDistrict.SelectedItem = personal.addrAmphur.Replace("เขต", "").Replace("อำเภอ", "");

                //txtAddress.Text = personal.Address.Replace(personal.addrTambol, "").Replace(personal.addrAmphur, "").Replace(personal.addrProvince, "").Trim();
                //txtSubDistrict.Text = personal.addrTambol;
                //dtBirthday.Value = personal.Birthday;
                //dtIssue.Value = personal.Issue;
                //dtExpire.Value = personal.Expire;
                _PHOTO = personal_photo.PhotoBitmap;
                ptbPhoto.Image = personal_photo.PhotoBitmap;

                Thread.CurrentThread.CurrentCulture = new CultureInfo("th-TH");
                dtpBarthday.Text = personal.Birthday.ToString("d MMMM yyyy");

                LoadCustomerData(sender, e, "CitizenID", txtCitizenId.Text.Trim());
            }
            else
            {
                MessageBox.Show("ไม่สามารถอ่านข้อมูลได้\nกรุณาติดตั้งเครื่องอ่าน Smart Card ให้เรียบร้อย\nแล้วลองใหม่อีกครั้ง", "มีข้อผิดพลาดเกิดขึ้น", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            btnSmartCard.Enabled = true;
        }