Ejemplo n.º 1
0
        public async void GetPrintUser()
        {
            UserFunctions uf = new UserFunctions();
            User          u  = new User();

            try
            {
                int UserID = await uf.GetDriver(new Imc().ToBase64String(new Imc().ToByteArr(ScannedFingerPrint)));

                u = await uf.GetUser(UserID);


                firstnamelabel.Text = u.NationalRegInfo.FirstName;
                lastnamelabel.Text  = u.NationalRegInfo.LastName;
                ninlabel.Text       = u.NationalRegInfo.NIN;
                phonelabel.Text     = u.PhoneNumber;
                emaillabel.Text     = u.Email;
                UserId = u.ID;
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        private async void GetDriver()
        {
            try
            {
                pictureBox2.Image = ScannedFingerPrint;

                UserFunctions uf = new UserFunctions();

                label2.Text = "Scanning...";

                int y = await uf.GetDriver(new Imc().ToBase64String(new Imc().ToByteArr(ScannedFingerPrint)));

                if (y == 0)
                {
                    pictureBox1.Image = Properties.Resources.fingerdumbwrong;
                    label2.Text       = "Failed to find Driver";
                }
                else
                {
                    UserID = y;

                    // System.Diagnostics.Debug.WriteLine("Current Gate: "+h.CurrentGate.ToString());
                    try
                    {
                        if (h.CurrentGate == GateSide.Entrance)
                        {
                            pictureBox1.Image = Properties.Resources.fingerdumbcorrect;
                            label2.Text       = "Success";

                            this.Close();

                            MessageBox.Show(h, String.Format("{0} Car has Entered Parking", h.DetectedLicenseNumber));
                        }
                        else
                        {
                            bool result = await uf.ExitParking(23, h.CarID, UserID);

                            if (result)
                            {
                                pictureBox1.Image = Properties.Resources.fingerdumbcorrect;
                                label2.Text       = "Success";

                                this.Close();

                                MessageBox.Show(h, String.Format("{0} Car has Exited Parking", h.DetectedLicenseNumber));
                            }
                            else
                            {
                                pictureBox1.Image = Properties.Resources.fingerdumbwrong;
                                label2.Text       = "Failed to find Driver";
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
        }