Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Imports license
Imports System.Collections
Public Class log
Dim T As Boolean
Dim CnString As String = "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\salse.mdb;user id=admin;jet oledb:database password=remkhaled"
Dim Con As New OleDbConnection(CnString)
Dim dt As DataTable
Dim DataSet1 As New DataSet
Dim dataset2 As New DataSet
Dim dataset3 As New DataSet
Dim dataset4 As New DataSet
Dim DataAdapter1 As OleDbDataAdapter
Dim DataAdapter2 As OleDbDataAdapter
Dim DataAdapter3 As OleDbDataAdapter
Dim DataAdapter4 As OleDbDataAdapter
Dim CMD As New OleDbCommand
Dim CMD1 As New OleDbCommand
Dim da As OleDbDataAdapter
Public day As String
Public month As String
Public year As String
Private Sub cd()
'هذا الكود لحفظ اول تاريخ تم فتح به البرنامج
Dim filename As String = "D:\aka\aka.png"
If Not IO.File.Exists(filename) Then
'وهذا كود لحفظ التاريخ الحالى
IO.File.WriteAllText(filename, Now.Date)
End If
If My.Computer.FileSystem.ReadAllText(filename).ToString.Trim = "" Then
'وهذا كود لحفظ التاريخ الحالى
My.Computer.FileSystem.WriteAllText(filename, Now.Date, False)
Else
'وهذا الكود لقراءة التاريخ واذا كان التاريخ قديم يضع الجديد
Dim lines As String() = IO.File.ReadAllLines(filename)
For i = 0 To lines.Length - 1
If IsDate(lines(i)) AndAlso CDate(lines(i)) = DateString Then
lines(i) = CDate(lines(i)).AddDays(1)
End If
Next
IO.File.WriteAllLines(filename, lines)
End If
End Sub
Private Sub TextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseClick
TextBox1.Text = ""
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox2.MouseClick
TextBox2.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not (seri = My.Settings.NUMr) Then
Ser.ShowDialog()
End If
If TextBox1.Text = "" And TextBox2.Text = "" Then
Else
Using cmd As New OleDb.OleDbCommand("SELECT * FROM login WHERE (user = @username) AND (pass = @password)", Con)
If Con.State = ConnectionState.Closed Then Con.Open()
cmd.Parameters.AddWithValue("@username", TextBox1.Text)
cmd.Parameters.AddWithValue("@password", TextBox2.Text)
Using rd As OleDb.OleDbDataReader = cmd.ExecuteReader
Dim t As New DataTable
t.Load(rd)
If t.Rows.Count > 0 Then
start.Show()
Me.Hide()
Home1.add.Enabled = t(0)(3) ' Flase or true
Home1.cars.Enabled = t(0)(4)
Home1.day.Enabled = t(0)(5)
Home1.stor.Enabled = t(0)(6)
Home1.entag.Enabled = t(0)(7)
Home1.data.Enabled = t(0)(8)
Home1.admin1.Enabled = t(0)(9)
Else
MsgBox("هناك خطأ ما")
End If
End Using
End Using
End If
End Sub
Private Sub log_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cd()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class