コード例 #1
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "1nt3gr1ty@ENLI");

            string value = "";
            bool passed  = false;
            if (js.InputBox("Check Out", "Please Scan Barcode", ref value) == System.Windows.Forms.DialogResult.OK)
            {
                string q = "SELECT * FROM tblKids WHERE fldStudentID = '" + value + "'";
                js.ExecuteQuery(q);
                js.RiD.Read();

                if(!js.RiD.HasRows)
                {
                    return;
                }

                string kidsid = js.RiD["fldID"].ToString();
                for (int i=0;i<kID.Length;i++)
                {
                    if(kidsid==kID[i])
                    {
                        passed = true;
                        break;
                    }
                }

                if(passed==true)
                {
                    string p = js.GetPath() + "/Kids/" + js.RiD["fldPicture"];

                    string aID = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + value  + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND (fldLogoutDateTime IS NULL)");

                    if (System.IO.File.Exists(p))
                    {
                        pbK1.Image = Image.FromFile(p);
                    }
                    lblKName.Text = "" + js.RiD["fldNickName"] + " " + js.RiD["fldLastName"];
                    lblBarcode.Text = value;
                    lblBirthday.Text = Convert.ToDateTime(js.RiD["fldBirthday"].ToString()).ToString("MM/dd/yyyy");
                    btnConfirm.Tag = aID;
                    btnConfirm.Enabled = true;
                    fromNFC = false;
                }
                else
                {
                    lblNotification.ForeColor = Color.Red;
                    lblNotification.Text = "Fetcher and Kid Do Not Match";
                }
            }
        }