Please Help: I am making an internet Cafe system that will login his/her account
If user still have time left on his account(database) then login success and countsdown hours and minutes to zero
if user logsout it will update the database "timeleft" of the current user
If 5 minutes remaining a window will alert the user if he wants to extend his time.
if zero hours and zero minutes on the database "timeleft" then the user will automatically logout..

THIS WOULD BE THE CONCEPT: http://aacable.files.wordpress.com/2011/12/ccsp-client-finished-reboot.png?w=830&h=382

PS: My database look like this
Account = user
Password = user1234
Timeleft = 05:43

Public Class frmMain


    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        lbltime.Text = Date.Now.ToString("hh:mm tt") 'live clock
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
        frmLogin.Show()
    End Sub
    Private Sub btnEnd_Click(sender As Object, e As EventArgs) Handles btnEnd.Click
        btnEnd.FlatStyle = FlatStyle.Flat
        btnGames.FlatStyle = FlatStyle.Flat
        btnInternet.FlatStyle = FlatStyle.Flat
        btnLock.FlatStyle = FlatStyle.Flat
        btnOffice.FlatStyle = FlatStyle.Flat
        btnLogin.FlatStyle = FlatStyle.Standard
        btnEnd.ForeColor = Color.Gray
        btnGames.ForeColor = Color.Gray
        btnInternet.ForeColor = Color.Gray
        btnLock.ForeColor = Color.Gray
        btnOffice.ForeColor = Color.Gray
        btnLogin.ForeColor = Color.Black
        btnEnd.Enabled = False
        btnGames.Enabled = False
        btnInternet.Enabled = False
        btnLock.Enabled = False
        btnOffice.Enabled = False
        btnLogin.Enabled = True
        frmLogin.ds = New DataSet 'reset dataset
        lblend.Text = Format(Now, "hh:mm tt") 'get stop time'

    End Sub
End Class




Imports System.Data.OleDb

Public Class frmLogin
    Friend ds As New DataSet
    Friend adptr As OleDbDataAdapter


    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles btncheck.Click
        Dim sql As String
        sql = "Select * from Users WHERE Account = '" & txtUsername.Text & "'"
        Dim cnn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Renz\Documents\Visual Studio 2012\Internet Cafe Billing System\Database\Database1.accdb")
        Try
            cnn.Open()
            adptr = New OleDbDataAdapter(sql, cnn)
            adptr.Fill(ds)
            'check if username and password is matched'
            If ds.Tables(0).Rows(0)("Account") = txtUsername.Text And ds.Tables(0).Rows(0)("Password") = txtPassword.Text Then
                'check if user still have remaining time to use'
                If ds.Tables(0).Rows(0)("Timeleft") = ("00:00") Then
                    MessageBox.Show("Sorry You don't have time left")
                    Me.Close()
                Else
                    MessageBox.Show("Logged In")
                    frmMain.btnEnd.FlatStyle = FlatStyle.Standard
                    frmMain.btnGames.FlatStyle = FlatStyle.Standard
                    frmMain.btnInternet.FlatStyle = FlatStyle.Standard
                    frmMain.btnLock.FlatStyle = FlatStyle.Standard
                    frmMain.btnOffice.FlatStyle = FlatStyle.Standard
                    frmMain.btnLogin.FlatStyle = FlatStyle.Flat
                    frmMain.btnEnd.ForeColor = Color.Black
                    frmMain.btnGames.ForeColor = Color.Black
                    frmMain.btnInternet.ForeColor = Color.Black
                    frmMain.btnLock.ForeColor = Color.Black
                    frmMain.btnOffice.ForeColor = Color.Black
                    frmMain.btnLogin.ForeColor = Color.Gray
                    frmMain.btnEnd.Enabled = True
                    frmMain.btnGames.Enabled = True
                    frmMain.btnInternet.Enabled = True
                    frmMain.btnLock.Enabled = True
                    frmMain.btnOffice.Enabled = True
                    frmMain.btnLogin.Enabled = False
                    frmMain.lblstart.Text = Format(Now, "hh:mm tt")
                    Me.Hide()
                End If
            Else
                MessageBox.Show("Invalid Username or Password.")
                txtUsername.Text = String.Empty
                txtPassword.Text = String.Empty
            End If

        Catch ex As Exception
        End Try
    End Sub

End Class

To get the most accurate time used, you will have to read/write to the database every n seconds. This could be a performance hog but it can be done.

What is you time stored as in database? A string? (Text, NVarchar, Varchar, ect..)

whats the problem now? you didnt say your problem, please let me know...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.