Exemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = this.username.Text.ToString();
            string password = this.password.Text.ToString();

            if (Validate(username, password))
            {
                using (Loading loading = new Loading(SignIn))
                {
                    loading.ShowDialog(this);

                    // check local database connection
                    DBConnect database = new DBConnect();
                    if (!database.CheckMySQLConnection())
                    {
                        notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_CONNECT_LOCAL_DATABASE, ToolTipIcon.Error);
                        return;
                    }
                    database.DisposeDatabaseConnection();

                    // check reader connection
                    Acr123U  acr123U    = new Acr123U();
                    string[] readerList = acr123U.getReaderList();
                    if (readerList.Length <= 0)
                    {
                        notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_DEVICE_READER_NOT_FOUND, ToolTipIcon.Error);
                        return;
                    }

                    // remember me feature
                    if (checkBox1.Checked)
                    {
                        Properties.Settings.Default.Username   = username;
                        Properties.Settings.Default.Password   = password;
                        Properties.Settings.Default.RememberMe = "yes";
                    }
                    else
                    {
                        Properties.Settings.Default.Username   = username;
                        Properties.Settings.Default.Password   = "";
                        Properties.Settings.Default.RememberMe = "no";
                    }
                    Properties.Settings.Default.Save();

                    this.ip_address_server = Properties.Settings.Default.IPAddressServer;

                    if (CheckGate())
                    {
                        // pull some data from server e.g. Vehicle Types
                        if (PullDataFromServer(Properties.Settings.Default.GateType))
                        {
                            ApiSignIn(username, password);
                            loading.Dispose();
                            TKHelper.ClearGarbage();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public MifareCard(Pedestrian pedestrian)
        {
            establishContext();
            ConsoleLogListReader();

            this.pedestrian = pedestrian;
            this.acr123u    = new Acr123U();
        }
Exemplo n.º 3
0
        public MifareCard(FreePass freePass)
        {
            establishContext();
            ConsoleLogListReader();

            this.freePass = freePass;
            this.acr123u  = new Acr123U();
        }
Exemplo n.º 4
0
        public MifareCard(PassKadeOut passKadeOut)
        {
            establishContext();
            ConsoleLogListReader();

            this.passKadeOut = passKadeOut;
            this.acr123u     = new Acr123U();
        }
Exemplo n.º 5
0
        public MifareCard(Cashier cashier)
        {
            establishContext();
            ConsoleLogListReader();

            this.cashier = cashier;
            this.acr123u = new Acr123U();
        }