Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class About
- End Class
- Public Class accounts
- End Class
- Public Class Account
- Private Sub b_UpdateProfile_Click(sender As Object, e As RoutedEventArgs) Handles b_UpdateProfile.Click
- End Sub
- End Class
- Class Application
- ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
- ' can be handled in this file.
- End Class
- Imports System.Data
- Imports System.Data.SQLite
- Imports System.Windows.Forms
- Imports MySql.Data.MySqlClient
- Public Class Breifcase
- Private Sub onLoad() Handles Me.Loaded
- daemon()
- End Sub
- Private Async Sub daemon()
- onloadDataGrid()
- Await Delay(2)
- daemon()
- End Sub
- 'dataGrid
- Private Sub onloadDataGrid()
- dgv.Children.Clear()
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Dim sqli As MySqlConnection = Connector.ConnectDB(True)
- Try
- Dim cmd1 As New MySqlCommand("Select (Select type from student_user Union all select type from employee_user ),reservation.reservation_name, reservation.id_number, reservation.room_id, reservation.start_time, reservation.end_time, users.first_name, users.mid_name, users.last_name, room.room_type_id, room_type.description From (((reservation inner join users on reservation.id_number = users.id_number) inner join room on room.room_id = reservation.room_id) inner join room_type on room_type.room_type_id = room.room_type_id) ", sqli)
- Dim id As MySqlDataReader = cmd1.ExecuteReader()
- While id.Read()
- Dim dg As New gridData
- dg.eventname.Content = id("reservation_name").ToString
- dg.room.Content = id("description").ToString
- dg.username.Content = id("first_name").ToString & " " & id("mid_name") & " " & id("last_name")
- dg.usertype.Content = id("(Select type from student_user Union all select type from employee_user )").ToString
- dg.date.Content = CDate(id("start_time")).ToShortDateString
- dg.startime.Content = id("start_time")
- dg.endtime.Content = id("end_time")
- dgv.Children.Add(dg)
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Try
- Dim cmd1 As New SQLiteCommand("Select (Select type from student_user Union all select type from employee_user ),reservation.reservation_name, reservation.id_number, reservation.room_id, reservation.start_time, reservation.end_time, users.first_name, users.mid_name, users.last_name, room.room_type_id, room_type.description From (((reservation inner join users on reservation.id_number = users.id_number) inner join room on room.room_id = reservation.room_id) inner join room_type on room_type.room_type_id = room.room_type_id) ", sqli)
- Dim id As SQLiteDataReader = cmd1.ExecuteReader()
- Dim dgy As New gridData
- dgy.eventname.Content = "Event Name"
- dgy.room.Content = "Room Name"
- dgy.username.Content = "Name of User"
- dgy.usertype.Content = "Type of User"
- dgy.date.Content = "Reservation Date"
- dgy.startime.Content = "Start Time"
- dgy.endtime.Content = "End Time"
- dgv.Children.Add(dgy)
- While id.Read()
- Dim dg As New gridData
- dg.eventname.Content = id("reservation_name").ToString
- dg.room.Content = id("description").ToString
- dg.username.Content = id("first_name").ToString & " " & id("mid_name") & " " & id("last_name")
- dg.usertype.Content = id("(Select type from student_user Union all select type from employee_user )").ToString
- dg.date.Content = CDate(id("start_time")).ToShortDateString
- dg.startime.Content = id("start_time")
- dg.endtime.Content = id("end_time")
- dgv.Children.Add(dg)
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- End Sub
- End Class
- Imports System.Data.SQLite
- Imports MySql.Data.MySqlClient
- Namespace cldr
- Partial Public Class Calendar
- Private _myReservationsList As New List(Of Reservation)
- Public n As New NewAppointmentEventArgs()
- #Region "Data Validation"
- Partial Public Class Calendar
- Inherits UserControl
- End Class
- Private _errors As Integer = 0
- Private _reservationData As New ReservationData()
- Private _userData As New UserInfo()
- Private _userTypeData As New UserType()
- Public Sub New()
- InitializeComponent()
- reservation_context.DataContext = _reservationData
- userinfo_context.DataContext = _userData
- 'User Type
- usertype_context.DataContext = _userTypeData
- position.DataContext = _userTypeData
- rank.DataContext = _userTypeData
- college.DataContext = _userTypeData
- track.DataContext = _userTypeData
- grade.DataContext = _userTypeData
- End Sub
- Private Sub Confirm_CanExecute(sender As Object, e As CanExecuteRoutedEventArgs)
- e.CanExecute = _errors = 0
- e.Handled = True
- End Sub
- Private Sub Confirm_Executed(sender As Object, e As ExecutedRoutedEventArgs)
- _reservationData = New ReservationData()
- _userData = New UserInfo()
- _userTypeData = New UserType()
- reservation_context.DataContext = _reservationData
- userinfo_context.DataContext = _userData
- 'User Type
- usertype_context.DataContext = _userTypeData
- position.DataContext = _userTypeData
- rank.DataContext = _userTypeData
- college.DataContext = _userTypeData
- track.DataContext = _userTypeData
- grade.DataContext = _userTypeData
- e.Handled = True
- End Sub
- Private Sub Validation_Error(sender As Object, e As ValidationErrorEventArgs)
- If e.Action = ValidationErrorEventAction.Added Then
- _errors += 1
- Else
- _errors -= 1
- End If
- End Sub
- #End Region
- Public Sub onLoad() Handles Me.Loaded
- onLoadReservation()
- End Sub
- Private Sub b_save_Click(sender As Object, e As RoutedEventArgs)
- 'Todo validation
- saveUserInfo()
- saveReservation()
- End Sub
- Private Sub DayBoxClicked_event(ByVal e As NewAppointmentEventArgs) Handles Reservation_Calendar.DayBoxClicked
- Add_Reservation.IsOpen = True
- Add_Reservation.Tag = e.TagID
- retrieveData()
- roomListRefresh()
- dp_date.IsEnabled = False
- dp_date.Text = CDate(e.StartDate)
- l_date.Content = Microsoft.VisualBasic.MonthName(CDate(e.StartDate).Month) & " " & CDate(e.StartDate).Day & ", " & CDate(e.StartDate).Year
- n = e
- End Sub
- Private Sub roomListRefresh()
- cb_room_name.Items.Clear()
- Dim Connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Try
- Dim sqli As MySqlConnection = Connector.ConnectDB(True)
- Dim rmd As New MySqlCommand("SELECT * From room", sqli)
- Dim dr As MySqlDataReader = rmd.ExecuteReader()
- While dr.Read()
- Dim rmd1 As New MySqlCommand("SELECT * From room_type Where room_type_id =" & dr("room_type_id").ToString, sqli)
- Dim dr1 As MySqlDataReader = rmd1.ExecuteReader()
- While dr1.Read
- cb_room_name.Items.Add(dr1("description").ToString)
- End While
- End While
- Catch ex As MySQLException
- MainWindow.Instance.MainSnackBar("Refresh Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("SELECT * From room", sqli)
- Dim dr As SQLiteDataReader = rmd.ExecuteReader()
- While dr.Read()
- Dim rmd1 As New SQLiteCommand("SELECT * From room_type Where room_type_id =" & dr("room_type_id").ToString, sqli)
- Dim dr1 As SQLiteDataReader = rmd1.ExecuteReader()
- While dr1.Read
- cb_room_name.Items.Add(dr1("description").ToString)
- End While
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Refresh Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub AppointmentDblClicked(ByVal Appointment_Id As Integer) Handles Reservation_Calendar.ReservationClickedEvent
- MessageBox.Show("You Clicked a reservation ID = " & Appointment_Id, "Calendar Event", MessageBoxButton.OK)
- End Sub
- Private Sub AddReservation(ByVal e As NewAppointmentEventArgs)
- Dim apt As New Reservation()
- apt.ReservationID = e.TagID
- apt.StartTime = CDate(e.StartDate)
- apt.EndTime = apt.StartTime
- apt.Subject = tb_ev_name.Text & " on " & tp_start_time.Text & "-" & tp_end_time.Text
- _myReservationsList.Add(apt)
- Call SetReservations()
- End Sub
- Private Sub onLoadReservation()
- _myReservationsList.Clear()
- Dim Connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Try
- Dim sqli As MySqlConnection = Connector.ConnectDB(True)
- Dim rmd As New MySqlCommand("Select reservation.reservation_name, reservation.start_time, reservation.end_time, reservation.reservation_id from reservation", sqli)
- Dim d As MySqlDataReader = rmd.ExecuteReader()
- While d.Read()
- Dim apt As New Reservation()
- apt.ReservationID = d("reservation_id").ToString
- apt.StartTime = CDate(d("start_time"))
- apt.EndTime = apt.StartTime
- apt.Subject = d("reservation_name") & " on " & CDate(d("start_time")).ToString("hh:MM tt") & "-" & CDate(d("end_time")).ToString("hh:MM tt")
- _myReservationsList.Add(apt)
- Call SetReservations()
- End While
- Catch ex As MySQLException
- MainWindow.Instance.MainSnackBar("Reservation Info Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("Select reservation.reservation_name, reservation.start_time, reservation.end_time, reservation.reservation_id from reservation", sqli)
- Dim d As SQLiteDataReader = rmd.ExecuteReader()
- While d.Read()
- Dim apt As New Reservation()
- apt.ReservationID = d("reservation_id").ToString
- apt.StartTime = CDate(d("start_time"))
- apt.EndTime = apt.StartTime
- apt.Subject = d("reservation_name") & " on " & CDate(d("start_time")).ToString("hh:MM tt") & "-" & CDate(d("end_time")).ToString("hh:MM tt")
- _myReservationsList.Add(apt)
- Call SetReservations()
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Reservation Info Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub DisplayMonthChanged(ByVal e As MonthChangedEventArgs) Handles Reservation_Calendar.DisplayMonthChanged
- onLoadReservation()
- Call SetReservations()
- End Sub
- Public Sub SetReservations()
- '-- Use whatever function you want to load the MonthReservations list, I happen to have a list filled by linq that has
- ' many (possibly the past several years) of them loaded, so i filter to only pass the ones showing up in the displayed
- ' month. Note that the "setter" for MonthReservations also triggers a redraw of the display.
- Me.Reservation_Calendar.MonthAppointments = _myReservationsList.FindAll(
- New System.Predicate(Of Reservation)(
- Function(apt As Reservation) _
- apt.StartTime IsNot Nothing AndAlso
- CDate(apt.StartTime).Month = Me.Reservation_Calendar.DisplayStartDate.Month AndAlso
- CDate(apt.StartTime).Year = Me.Reservation_Calendar.DisplayStartDate.Year))
- End Sub
- Private Sub b_cancel_Click(sender As Object, e As RoutedEventArgs)
- Add_Reservation.IsOpen = False
- clearInputs()
- MainWindow.Instance.MainSnackBar("Action Canceled", 3)
- End Sub
- Private Sub saveReservation()
- Dim Connector As New SQLConnector()
- Dim id As String
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("SELECT max(reservation_id) FROM reservation", sqli)
- Dim d As SQLiteDataReader = rmd.ExecuteReader()
- While d.Read()
- id = CInt(If(IsDBNull(d(0)), n.TagID & 1, n.TagID & CInt(d(0).ToString.Last.ToString) + 1))
- End While
- Dim rdr As New SQLiteCommand("SELECT room_type_id From room_type Where description = '" & cb_room_name.SelectedValue & "'", sqli)
- Dim dr As SQLiteDataReader = rdr.ExecuteReader()
- While dr.Read()
- Dim cmd As New SQLiteCommand("INSERT INTO reservation(reservation_id, reservation_name, staff_id, room_id, id_number, start_time, end_time) values ('" & id & "','" & tb_ev_name.Text & "','" & config.io.getSession("id") & "','" & dr("room_type_id") & "','" & cb_id_number.Text & "','" & CDate(n.StartDate).ToString("MM/dd/yyyy") & " " & tp_start_time.Text & "','" & CDate(n.EndDate).ToString("MM/dd/yyyy") & " " & tp_end_time.Text & "')", sqli)
- cmd.ExecuteNonQuery()
- Add_Reservation.IsOpen = False
- MainWindow.Instance.MainSnackBar("Reservation Reserved", 3)
- AddReservation(n)
- clearInputs()
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Reservation Info Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub saveUserInfo()
- Dim Connector As New SQLConnector()
- Dim type As String = cb_user_type.SelectedValue
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim depid As Integer
- Try
- Dim dep1 As New SQLiteCommand("Select * From Department Where description like '" & tb_department.Text & "'", sqli)
- Dim r3 As SQLiteDataReader = dep1.ExecuteReader()
- If r3.Read() Then
- While r3.Read()
- depid = r3("dep_id")
- End While
- Else
- Dim dep As New SQLiteCommand("Select max(dep_id) From Department", sqli)
- Dim r2 As SQLiteDataReader = dep.ExecuteReader()
- While r2.Read
- depid = CInt(If(IsDBNull(r2(0)), 0, r2(0)))
- End While
- depid += 1
- Dim cmd As New SQLiteCommand("INSERT INTO Department(Dep_ID , Description) Values('" & depid & "','" & tb_department.Text & "')", sqli)
- cmd.ExecuteNonQuery()
- r2.Close()
- dep.Dispose()
- End If
- Dim cmd1 As New SQLiteCommand("INSERT INTO Users(id_number, First_name, Mid_name, Last_name, Dep_ID) Values('" & cb_id_number.Text & "','" & tb_fname.Text & "','" & tb_mname.Text & "','" & tb_lname.Text & "','" & depid & "')", sqli)
- cmd1.ExecuteNonQuery()
- If rb_student.IsChecked Then
- Dim cmd2 As New SQLiteCommand("INSERT INTO Student_User(S_ID_Number, type) Values ('" & cb_id_number.Text & "', '" & type & "')", sqli)
- cmd2.ExecuteNonQuery()
- Else
- Dim cmd2 As New SQLiteCommand("INSERT INTO Employee_User(E_ID_Number, type) Values ('" & cb_id_number.Text & "', '" & type & "')", sqli)
- cmd2.ExecuteNonQuery()
- End If
- Dim cmdType As New SQLiteCommand()
- If type Like "NTEA" Then
- cmdType.CommandText = "INSERT INTO NTEA_Employee_User(N_E_ID_Number, Position) Values (" & cb_id_number.Text & ", '" & tb_pname.Text & "')"
- cmdType.Connection = sqli
- cmdType.ExecuteNonQuery()
- cmdType.Dispose()
- ElseIf type Like "Faculty"
- cmdType.CommandText = "INSERT INTO Faculty_Employee_User(F_E_ID_Number, Rank) Values (" & cb_id_number.Text & ",'" & tb_rank.Text & "')"
- cmdType.Connection = sqli
- cmdType.ExecuteNonQuery()
- cmdType.Dispose()
- ElseIf type Like "College"
- cmdType.CommandText = "INSERT INTO college_student(c_id_number, Course, Year) Values (" & cb_id_number.Text & ", '" & tb_cname.Text & "','" & cb_college_level.Text & "')"
- cmdType.Connection = sqli
- cmdType.ExecuteNonQuery()
- cmdType.Dispose()
- ElseIf type Like "Senior High School"
- cmdType.CommandText = "INSERT INTO High_School_Student(HS_ID_Number, Grade) Values (" & cb_id_number.Text & ",'" & cb_high_level.Text & "')"
- cmdType.Connection = sqli
- cmdType.ExecuteNonQuery()
- cmdType.Dispose()
- ElseIf type Like "High School"
- cmdType.CommandText = "INSERT INTO Senior_High_School_Student(S_HS_ID_Number, Track) Values (" & cb_id_number.Text & ", '" & tb_track.Text & "')"
- cmdType.Connection = sqli
- cmdType.ExecuteNonQuery()
- cmdType.Dispose()
- End If
- cmdType = Nothing
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- End Sub
- Private Sub retrieveData()
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Try
- Dim cmd1 As New SQLiteCommand("SELECT s_id_number FROM Student_User Union all SELECT e_id_number FROM Employee_User", sqli)
- Dim id As SQLiteDataReader = cmd1.ExecuteReader()
- While id.Read
- cb_id_number.Items.Add(id("s_id_number").ToString)
- End While
- id.Close()
- cmd1 = Nothing
- Dim cmd2 As New SQLiteCommand("Select * From Department", sqli)
- Dim r2 As SQLiteDataReader = cmd2.ExecuteReader
- While r2.Read
- tb_department.Items.Add(r2("description"))
- End While
- r2.Close()
- cmd2 = Nothing
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- End Sub
- Private Sub onSelected(sender As Object, e As RoutedEventArgs) Handles cb_id_number.SelectionChanged
- Dim u As New UserInfo
- Dim t As New UserType
- If cb_id_number.Items.Contains(cb_id_number.SelectedValue) Then
- Dim id As Integer = cb_id_number.SelectedValue
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim dep_id As Integer
- Try
- Dim cmd1 As New SQLiteCommand("Select * From users where id_number = " & id, sqli)
- Dim r1 As SQLiteDataReader = cmd1.ExecuteReader()
- While r1.Read
- u.FName = r1("first_name").ToString
- u.MName = r1("mid_name").ToString
- u.LName = r1("last_name").ToString
- dep_id = CInt(r1("dep_id").ToString)
- End While
- r1.Close()
- cmd1 = Nothing
- Dim cmd2 As New SQLiteCommand("Select description From Department where dep_id = " & dep_id, sqli)
- Dim r2 As SQLiteDataReader = cmd2.ExecuteReader()
- While r2.Read
- u.DepName = r2(0).ToString
- End While
- r2.Close()
- cmd2 = Nothing
- Dim cmd3 As New SQLiteCommand("select type from student_user where s_id_number = " & id & " union all select type from employee_user where e_id_number = " & id, sqli)
- Dim r3 As SQLiteDataReader = cmd3.ExecuteReader()
- While r3.Read
- t.UserType = r3(0).ToString
- End While
- r3.Close()
- cmd3 = Nothing
- Dim cmdType As New SQLiteCommand()
- If t.UserType Like "NTEA" Then
- cmdType.CommandText = "select position from ntea_employee_user where n_e_id_number =" & id
- cmdType.Connection = sqli
- Dim r As SQLiteDataReader = cmdType.ExecuteReader()
- While r.Read
- t.PName = r("position").ToString
- End While
- r.Close()
- cmdType.Dispose()
- ElseIf t.UserType Like "Faculty"
- cmdType.CommandText = "select rank from faculty_employee_user where f_e_id_number =" & id
- cmdType.Connection = sqli
- Dim r As SQLiteDataReader = cmdType.ExecuteReader()
- While r.Read
- t.Rank = r("rank").ToString
- End While
- r.Close()
- cmdType.Dispose()
- ElseIf t.UserType Like "College"
- cmdType.CommandText = "select course, year from college_student where c_id_number =" & id
- cmdType.Connection = sqli
- Dim r As SQLiteDataReader = cmdType.ExecuteReader()
- While r.Read
- t.CName = r("course").ToString
- t.CollegeLevel = r("year").ToString
- End While
- r.Close()
- cmdType.Dispose()
- ElseIf t.UserType Like "Senior High School"
- cmdType.CommandText = "select track from senior_high_school_student where s_hs_id_number =" & id
- cmdType.Connection = sqli
- Dim r As SQLiteDataReader = cmdType.ExecuteReader()
- While r.Read
- t.Track = r("track").ToString
- End While
- r.Close()
- cmdType.Dispose()
- ElseIf t.UserType Like "High School"
- cmdType.CommandText = "select grade from high_school_student where hs_id_number =" & id
- cmdType.Connection = sqli
- Dim r As SQLiteDataReader = cmdType.ExecuteReader()
- While r.Read
- t.HighLevel = r("grade").ToString
- End While
- r.Close()
- cmdType.Dispose()
- End If
- Catch ex As Exception
- 'Logs
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- deployUserInfo(u, t)
- Else
- clearUserInfo()
- End If
- End Sub
- Public Sub clearUserInfo()
- 'Clear User Information
- tb_fname.Clear()
- tb_mname.Clear()
- tb_lname.Clear()
- tb_department.Text = Nothing
- 'Clear User Type
- rb_student.IsChecked = True
- tb_pname.Clear()
- tb_rank.Clear()
- tb_cname.Clear()
- tb_track.Clear()
- cb_user_type.Text = Nothing
- cb_college_level.Text = Nothing
- cb_high_level.Text = Nothing
- End Sub
- 'Auto Fill User Information
- Public Sub deployUserInfo(u As UserInfo, t As UserType)
- 'User Information
- tb_fname.Text = u.FName
- tb_mname.Text = u.MName
- tb_lname.Text = u.LName
- tb_department.SelectedValue = u.DepName
- 'User Type Information
- If t.UserType Like "NTEA" Then
- rb_employee.IsChecked = True
- cb_user_type.SelectedValue = t.UserType
- tb_pname.Text = t.PName
- ElseIf t.UserType Like "Faculty"
- rb_employee.IsChecked = True
- cb_user_type.SelectedValue = t.UserType
- tb_rank.Text = t.Rank
- ElseIf t.UserType Like "College"
- rb_student.IsChecked = True
- cb_user_type.SelectedValue = t.UserType
- tb_cname.Text = t.CName
- cb_college_level.Text = t.CollegeLevel
- ElseIf t.UserType Like "Senior High School"
- rb_student.IsChecked = True
- cb_user_type.SelectedValue = t.UserType
- tb_track.Text = t.Track
- ElseIf t.UserType Like "High School"
- rb_student.IsChecked = True
- cb_user_type.SelectedValue = t.UserType
- cb_high_level.Text = t.HighLevel
- End If
- user_typeChange()
- End Sub
- Private Async Sub rb_student_Click(sender As Object, e As RoutedEventArgs)
- Await Tasker.Delay(1)
- cb_user_type.Items.Clear()
- cb_user_type.Items.Add("College")
- cb_user_type.Items.Add("Senior High School")
- cb_user_type.Items.Add("High School")
- End Sub
- Private Sub rb_employee_Click(sender As Object, e As RoutedEventArgs)
- cb_user_type.Items.Clear()
- cb_user_type.Items.Add("NTEA")
- cb_user_type.Items.Add("Faculty")
- End Sub
- Public Sub clearInputs()
- tb_ev_name.Clear()
- cb_room_name.Text = Nothing
- chb_whole_day.IsChecked = False
- tp_start_time.Text = Nothing
- tp_end_time.Text = Nothing
- cb_id_number.Text = Nothing
- tb_fname.Clear()
- tb_mname.Clear()
- tb_lname.Clear()
- rb_employee.IsChecked = False
- rb_student.IsChecked = True
- cb_user_type.Text = Nothing
- tb_pname.Text = Nothing
- tb_rank.Text = Nothing
- tb_cname.Text = Nothing
- cb_college_level.Text = Nothing
- tb_track.Text = Nothing
- cb_high_level.Text = Nothing
- tb_department.Text = Nothing
- 'Removing Error Validation
- Validation.ClearInvalid(DirectCast(tb_ev_name, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_fname, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_mname, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_lname, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_pname, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_rank, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_cname, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_track, TextBox).GetBindingExpression(TextBox.TextProperty))
- Validation.ClearInvalid(DirectCast(cb_id_number, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(cb_user_type, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(cb_college_level, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(cb_high_level, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tb_department, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(cb_room_name, ComboBox).GetBindingExpression(ComboBox.TextProperty))
- Validation.ClearInvalid(DirectCast(tp_start_time, MaterialDesignThemes.Wpf.TimePicker).GetBindingExpression(MaterialDesignThemes.Wpf.TimePicker.TextProperty))
- Validation.ClearInvalid(DirectCast(tp_end_time, MaterialDesignThemes.Wpf.TimePicker).GetBindingExpression(MaterialDesignThemes.Wpf.TimePicker.TextProperty))
- End Sub
- Private Sub chb_whole_day_Checked(sender As Object, e As RoutedEventArgs)
- If chb_whole_day.IsChecked Then
- tp_start_time.IsEnabled = False
- tp_start_time.ToolTip = "Whole Day Event"
- tp_start_time.Text = "12:00 AM"
- tp_end_time.Text = ""
- tp_end_time.IsEnabled = False
- tp_end_time.ToolTip = "Whole Day Event"
- tp_end_time.Text = "12:00 PM"
- Else
- tp_start_time.IsEnabled = True
- tp_start_time.ToolTip = "Select start time"
- tp_end_time.IsEnabled = True
- tp_end_time.ToolTip = "Select end time"
- End If
- End Sub
- Private Sub b_reset_Click(sender As Object, e As RoutedEventArgs)
- clearInputs()
- MainWindow.Instance.MainSnackBar("Values Cleared", 3)
- End Sub
- Private Sub cb_user_type_Selected(sender As Object, e As RoutedEventArgs) Handles cb_user_type.SelectionChanged
- user_typeChange()
- End Sub
- Private Sub user_typeChange()
- Select Case cb_user_type.SelectedValue
- Case "NTEA"
- user_type.SelectedIndex = 0
- Case "Faculty"
- user_type.SelectedIndex = 1
- Case "College"
- user_type.SelectedIndex = 2
- Case "Senior High School"
- user_type.SelectedIndex = 3
- Case "High School"
- user_type.SelectedIndex = 4
- Case Else
- user_type.SelectedIndex = 5
- End Select
- End Sub
- End Class
- End NamespacePublic Class card
- End Class
- Imports System.IO
- Imports System.Reflection
- Imports System.Text.RegularExpressions
- Imports AMS.Profile
- Imports MySql.Data.MySqlClient
- Public Class config
- Public Shared m_instance As config
- Public conf As Registry = New Registry()
- Public hash As New Cypher("R$4@zD*<uT)+?!0,\%1dT")
- Private theme As New App.Settings.Theme
- #Region "Instantion of Class"
- Public Shared ReadOnly Property [io]() As config
- Get
- Return m_instance
- End Get
- End Property
- Public Sub Config_onLoad() Handles Me.Loaded
- m_instance = Me
- End Sub
- #End Region
- #Region "Installation Configuration"
- Public Sub setAdmin(id As Integer, username As String, password As String, email As String)
- conf.SetValue("Account", "type", "0")
- conf.SetValue("Account", "user_id", hash.EncryptData(id))
- conf.SetValue("Account", "email", hash.EncryptData(email))
- conf.SetValue("Account", "username", hash.EncryptData(username))
- conf.SetValue("Account", "password", hash.EncryptData(password))
- id = Nothing
- username = Nothing
- password = Nothing
- email = Nothing
- End Sub
- Public Function getAdmin()
- Return conf.GetValue("Account", "type") & "," & hash.DecryptData(conf.GetValue("Account", "user_id")) & "," & hash.DecryptData(conf.GetValue("Account", "email")) & "," & hash.DecryptData(conf.GetValue("Account", "username")) & "," & hash.DecryptData(conf.GetValue("Account", "password"))
- End Function
- Public Function getRegistryStatus() As Boolean
- If conf.GetSectionNames.Length = 5 Then
- Return True
- Else
- Return False
- End If
- End Function
- Public Sub setDefaults()
- conf.RemoveSection("Establishment")
- conf.RemoveSection("Theme")
- conf.RemoveSection("Database")
- conf.RemoveSection("Account")
- conf.RemoveSection("Misc Configuration")
- setStablishment("Reserfy", "Malaybalay City", "reserfy@survs-systems.ml")
- theme.Mode(False)
- theme.Color("Blue")
- setDBLocation(String.Empty)
- setMiscEnable()
- setmysqlStatus(False)
- Session(False)
- Settings.Instance.ts_advance_modes(True)
- End Sub
- #End Region
- #Region "General Establishment Settings"
- Public Sub setStablishment(name As String, address As String, contact As String)
- conf.SetValue("Establisment", "name", name)
- conf.SetValue("Establisment", "address", address)
- conf.SetValue("Establisment", "contact", contact)
- MainWindow.Instance.l_sys_name.Content = name
- name = Nothing
- address = Nothing
- contact = Nothing
- End Sub
- Public Function getStablishment()
- Return If(conf.GetValue("Establisment", "name") Is Nothing, "Establishment Name", conf.GetValue("Establisment", "name")) & "," & If(conf.GetValue("Establisment", "address") Is Nothing, "Address", conf.GetValue("Establisment", "address")) & "," & If(conf.GetValue("Establisment", "contact") Is Nothing, "Contact", conf.GetValue("Establisment", "contact"))
- End Function
- #End Region
- #Region "Database Related Configuration"
- Public Sub setDBLocation(location As String)
- If Not System.IO.Directory.Exists(System.Windows.Forms.Application.UserAppDataPath & "\Reserfy Local Database\") Then
- System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.UserAppDataPath & "\Reserfy Local Database\")
- End If
- conf.SetValue("Database", "Type", "personal")
- conf.SetValue("Database", "location", If(location = "", System.Windows.Forms.Application.UserAppDataPath & "\Reserfy Local Database\", location))
- location = Nothing
- End Sub
- Public Function getDBLocation() As String
- Return If(conf.GetValue("Database", "location") = "", System.Windows.Forms.Application.UserAppDataPath & "\Reserfy Local Database\", conf.GetValue("Database", "location"))
- End Function
- Public Sub setDBShared(servername As String, port As String, username As String, password As String, dbname As String)
- conf.SetValue("Database", "Type", "shared")
- conf.SetValue("Database", "servername", servername)
- conf.SetValue("Database", "port", If(port = String.Empty, 3306, port))
- conf.SetValue("Database", "dbname", getDBName())
- conf.SetValue("Database", "username", hash.EncryptData(username))
- conf.SetValue("Database", "password", hash.EncryptData(password))
- servername = Nothing
- port = Nothing
- username = Nothing
- password = Nothing
- dbname = Nothing
- End Sub
- Public Function getDBShared()
- Return conf.GetValue("Database", "servername") & "," & conf.GetValue("Database", "port") & "," & hash.DecryptData(conf.GetValue("Database", "username")) & "," & hash.DecryptData(conf.GetValue("Database", "password")) & "," & conf.GetValue("Database", "dbname")
- End Function
- Public Function getDBType() As String
- Return If(conf.GetValue("Database", "Type") = "", "personal", conf.GetValue("Database", "Type"))
- End Function
- Public Function getDBName() As String
- If daemon.setter.SettingsSQL.Ping Then
- Return daemon.setter.SettingsSQL.Database
- Else
- Return conf.GetValue("Database", "dbname")
- End If
- End Function
- Public Function getInitDB() As String
- Return "reserfy_data_v"
- End Function
- Public Function setDBCreate(ext As Integer) As String
- Return "CREATE DATABASE IF NOT EXISTS `reserfy_data_v" & ext & "` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
- USE `reserfy_data_v" & ext & "`"
- End Function
- Public Function getDBTablesCommand() As String
- Return "
- --
- -- --------------------------------------------------------
- --
- -- Table structure for table `college_student`
- --
- CREATE TABLE `college_student` (
- `c_id_number` int(11) NOT NULL,
- `course` varchar(60) NOT NULL,
- `year` int(5) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact`
- --
- CREATE TABLE `contact` (
- `contact_id` int(11) NOT NULL,
- `email_add` varchar(30) NOT NULL,
- `mobile` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `credentials`
- --
- CREATE TABLE `credentials` (
- `cred_id` int(11) NOT NULL,
- `username` varchar(30) NOT NULL,
- `password` varchar(100) NOT NULL,
- `privilege` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `department`
- --
- CREATE TABLE `department` (
- `dep_id` int(11) NOT NULL,
- `description` varchar(60) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `employee_user`
- --
- CREATE TABLE `employee_user` (
- `e_id_number` int(11) NOT NULL,
- `type` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `faculty_employee_user`
- --
- CREATE TABLE `faculty_employee_user` (
- `f_e_id_number` int(11) NOT NULL,
- `rank` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `high_school_student`
- --
- CREATE TABLE `high_school_student` (
- `hs_id_number` int(11) NOT NULL,
- `grade` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `ntea_employee_user`
- --
- CREATE TABLE `ntea_employee_user` (
- `n_e_id_number` int(11) NOT NULL,
- `position` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `reservation`
- --
- CREATE TABLE `reservation` (
- `reservation_id` int(11) NOT NULL,
- `reservation_name` varchar(100) NOT NULL,
- `staff_id` int(11) NOT NULL,
- `room_id` int(11) NOT NULL,
- `id_number` int(11) NOT NULL,
- `start_time` varchar(30) NOT NULL,
- `end_time` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `room`
- --
- CREATE TABLE `room` (
- `room_id` int(11) NOT NULL,
- `floor_level` int(11) NOT NULL,
- `room_type_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `room_type`
- --
- CREATE TABLE `room_type` (
- `room_type_id` int(11) NOT NULL,
- `description` varchar(60) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `senior_high_school_student`
- --
- CREATE TABLE `senior_high_school_student` (
- `s_hs_id_number` int(11) NOT NULL,
- `track` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `staff`
- --
- CREATE TABLE `staff` (
- `staff_id` int(11) NOT NULL,
- `name_id` int(11) NOT NULL,
- `birth_date` date NOT NULL,
- `photo` BLOB NOT NULL,
- `contact_id` int(11) NOT NULL,
- `cred_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `staff_name`
- --
- CREATE TABLE `staff_name` (
- `name_staff_id` int(11) NOT NULL,
- `first_name` varchar(60) NOT NULL,
- `mid_name` varchar(60) NOT NULL,
- `last_name` varchar(60) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `student_user`
- --
- CREATE TABLE `student_user` (
- `s_id_number` int(11) NOT NULL,
- `type` varchar(30) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `users`
- --
- CREATE TABLE `users` (
- `id_number` int(11) NOT NULL,
- `first_name` varchar(30) NOT NULL,
- `mid_name` varchar(30) NOT NULL,
- `last_name` varchar(30) NOT NULL,
- `dep_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Indexes for dumped tables
- --
- --
- -- Indexes for table `college_student`
- --
- ALTER TABLE `college_student`
- ADD PRIMARY KEY (`c_id_number`);
- --
- -- Indexes for table `contact`
- --
- ALTER TABLE `contact`
- ADD PRIMARY KEY (`contact_id`);
- --
- -- Indexes for table `credentials`
- --
- ALTER TABLE `credentials`
- ADD PRIMARY KEY (`cred_id`);
- --
- -- Indexes for table `department`
- --
- ALTER TABLE `department`
- ADD PRIMARY KEY (`dep_id`);
- --
- -- Indexes for table `employee_user`
- --
- ALTER TABLE `employee_user`
- ADD PRIMARY KEY (`e_id_number`);
- --
- -- Indexes for table `faculty_employee_user`
- --
- ALTER TABLE `faculty_employee_user`
- ADD PRIMARY KEY (`f_e_id_number`);
- --
- -- Indexes for table `high_school_student`
- --
- ALTER TABLE `high_school_student`
- ADD PRIMARY KEY (`hs_id_number`);
- --
- -- Indexes for table `ntea_employee_user`
- --
- ALTER TABLE `ntea_employee_user`
- ADD PRIMARY KEY (`n_e_id_number`);
- --
- -- Indexes for table `reservation`
- --
- ALTER TABLE `reservation`
- ADD PRIMARY KEY (`reservation_id`),
- ADD KEY `id_number` (`id_number`),
- ADD KEY `room_id` (`room_id`),
- ADD KEY `staff_id` (`staff_id`);
- --
- -- Indexes for table `room`
- --
- ALTER TABLE `room`
- ADD PRIMARY KEY (`room_id`),
- ADD KEY `room_type_id` (`room_type_id`);
- --
- -- Indexes for table `room_type`
- --
- ALTER TABLE `room_type`
- ADD PRIMARY KEY (`room_type_id`);
- --
- -- Indexes for table `senior_high_school_student`
- --
- ALTER TABLE `senior_high_school_student`
- ADD PRIMARY KEY (`s_hs_id_number`);
- --
- -- Indexes for table `staff`
- --
- ALTER TABLE `staff`
- ADD PRIMARY KEY (`staff_id`),
- ADD KEY `name_id` (`name_id`),
- ADD KEY `contact_id` (`contact_id`),
- ADD KEY `cred_id` (`cred_id`);
- --
- -- Indexes for table `staff_name`
- --
- ALTER TABLE `staff_name`
- ADD PRIMARY KEY (`name_staff_id`);
- --
- -- Indexes for table `student_user`
- --
- ALTER TABLE `student_user`
- ADD PRIMARY KEY (`s_id_number`);
- --
- -- Indexes for table `users`
- --
- ALTER TABLE `users`
- ADD PRIMARY KEY (`id_number`),
- ADD KEY `dep_id` (`dep_id`);
- --
- -- AUTO_INCREMENT for dumped tables
- --
- --
- -- AUTO_INCREMENT for table `reservation`
- --
- ALTER TABLE `reservation`
- MODIFY `reservation_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- Constraints for dumped tables
- --
- --
- -- Constraints for table `college_student`
- --
- ALTER TABLE `college_student`
- ADD CONSTRAINT `college_student_ibfk_1` FOREIGN KEY (`c_id_number`) REFERENCES `student_user` (`s_id_number`);
- --
- -- Constraints for table `employee_user`
- --
- ALTER TABLE `employee_user`
- ADD CONSTRAINT `employee_user_ibfk_1` FOREIGN KEY (`e_id_number`) REFERENCES `users` (`id_number`);
- --
- -- Constraints for table `faculty_employee_user`
- --
- ALTER TABLE `faculty_employee_user`
- ADD CONSTRAINT `faculty_employee_user_ibfk_1` FOREIGN KEY (`f_e_id_number`) REFERENCES `employee_user` (`e_id_number`);
- --
- -- Constraints for table `high_school_student`
- --
- ALTER TABLE `high_school_student`
- ADD CONSTRAINT `high_school_student_ibfk_1` FOREIGN KEY (`hs_id_number`) REFERENCES `student_user` (`s_id_number`);
- --
- -- Constraints for table `ntea_employee_user`
- --
- ALTER TABLE `ntea_employee_user`
- ADD CONSTRAINT `ntea_employee_user_ibfk_1` FOREIGN KEY (`n_e_id_number`) REFERENCES `employee_user` (`e_id_number`);
- --
- -- Constraints for table `reservation`
- --
- ALTER TABLE `reservation`
- ADD CONSTRAINT `reservation_ibfk_1` FOREIGN KEY (`id_number`) REFERENCES `users` (`id_number`),
- ADD CONSTRAINT `reservation_ibfk_2` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`),
- ADD CONSTRAINT `reservation_ibfk_3` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`);
- --
- -- Constraints for table `room`
- --
- ALTER TABLE `room`
- ADD CONSTRAINT `room_ibfk_1` FOREIGN KEY (`room_type_id`) REFERENCES `room_type` (`room_type_id`);
- --
- -- Constraints for table `senior_high_school_student`
- --
- ALTER TABLE `senior_high_school_student`
- ADD CONSTRAINT `senior_high_school_student_ibfk_1` FOREIGN KEY (`s_hs_id_number`) REFERENCES `student_user` (`s_id_number`);
- --
- -- Constraints for table `staff`
- --
- ALTER TABLE `staff`
- ADD CONSTRAINT `staff_ibfk_1` FOREIGN KEY (`name_id`) REFERENCES `staff_name` (`name_staff_id`),
- ADD CONSTRAINT `staff_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`contact_id`),
- ADD CONSTRAINT `staff_ibfk_3` FOREIGN KEY (`cred_id`) REFERENCES `credentials` (`cred_id`);
- --
- -- Constraints for table `student_user`
- --
- ALTER TABLE `student_user`
- ADD CONSTRAINT `student_user_ibfk_1` FOREIGN KEY (`s_id_number`) REFERENCES `users` (`id_number`);
- --
- -- Constraints for table `users`
- --
- ALTER TABLE `users`
- ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`dep_id`) REFERENCES `department` (`dep_id`);
- COMMIT;
- "
- End Function
- Public Function getDBSQLITablesCommand()
- Return "--
- -- File generated with SQLiteStudio v3.1.1 on Tue Oct 10 17:49:33 2017
- --
- -- Text encoding used: System
- --
- PRAGMA foreign_keys = off;
- BEGIN TRANSACTION;
- -- Table: college_student
- DROP TABLE IF EXISTS college_student;
- CREATE TABLE college_student (c_id_number int (11) NOT NULL PRIMARY KEY, course varchar (60) NOT NULL, year int (5) NOT NULL);
- -- Table: contact
- DROP TABLE IF EXISTS contact;
- CREATE TABLE contact (contact_id int (11) NOT NULL PRIMARY KEY, email_add varchar (30) NOT NULL, mobile varchar (30));
- -- Table: credentials
- DROP TABLE IF EXISTS credentials;
- CREATE TABLE credentials (cred_id int (11) NOT NULL PRIMARY KEY, username varchar (30) NOT NULL, password varchar (100) NOT NULL, privilege int (11) NOT NULL);
- -- Table: department
- DROP TABLE IF EXISTS department;
- CREATE TABLE department (dep_id int (11) NOT NULL PRIMARY KEY, description varchar (60));
- -- Table: employee_user
- DROP TABLE IF EXISTS employee_user;
- CREATE TABLE employee_user (e_id_number int (11) NOT NULL PRIMARY KEY, type varchar (60));
- -- Table: faculty_employee_user
- DROP TABLE IF EXISTS faculty_employee_user;
- CREATE TABLE faculty_employee_user (f_e_id_number int (11) NOT NULL PRIMARY KEY, rank int (11));
- -- Table: high_school_student
- DROP TABLE IF EXISTS high_school_student;
- CREATE TABLE high_school_student (hs_id_number int (11) NOT NULL PRIMARY KEY, grade varchar (30));
- -- Table: ntea_employee_user
- DROP TABLE IF EXISTS ntea_employee_user;
- CREATE TABLE ntea_employee_user (n_e_id_number int (11) NOT NULL PRIMARY KEY, position int (11));
- -- Table: reservation
- DROP TABLE IF EXISTS reservation;
- CREATE TABLE reservation (reservation_id int (11) NOT NULL PRIMARY KEY,`reservation_name` varchar(100) NOT NULL, staff_id int (11) NOT NULL REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE, room_id int (11) NOT NULL REFERENCES room (room_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE, id_number int (11) NOT NULL REFERENCES users (id_number) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE,start_time varchar(30) NOT NULL,
- end_time varchar(30) NOT NULL);
- -- Table: room
- DROP TABLE IF EXISTS room;
- CREATE TABLE room (room_id int (11) NOT NULL PRIMARY KEY, floor_level int (11), room_type_id int (11) NOT NULL REFERENCES room_type (room_type_id) ON DELETE NO ACTION ON UPDATE NO ACTION MATCH SIMPLE);
- -- Table: room_type
- DROP TABLE IF EXISTS room_type;
- CREATE TABLE room_type (room_type_id int (11) NOT NULL PRIMARY KEY, description varchar (60));
- -- Table: senior_high_school_student
- DROP TABLE IF EXISTS senior_high_school_student;
- CREATE TABLE senior_high_school_student (s_hs_id_number int (11) NOT NULL PRIMARY KEY, track varchar (30));
- -- Table: staff
- DROP TABLE IF EXISTS staff;
- CREATE TABLE staff (staff_id int (11) NOT NULL PRIMARY KEY, name_id int (11) NOT NULL REFERENCES staff_name (name_staff_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE, birth_date date, contact_id int (11) NOT NULL REFERENCES contact (contact_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE, cred_id int (11) NOT NULL REFERENCES credentials (cred_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE, photo BLOB);
- -- Table: staff_name
- DROP TABLE IF EXISTS staff_name;
- CREATE TABLE staff_name (name_staff_id int (11) NOT NULL PRIMARY KEY, first_name varchar (60), mid_name varchar (60), last_name varchar (60));
- -- Table: student_user
- DROP TABLE IF EXISTS student_user;
- CREATE TABLE student_user (s_id_number int (11) NOT NULL PRIMARY KEY,type varchar (60));
- -- Table: users
- DROP TABLE IF EXISTS users;
- CREATE TABLE users (id_number int (11) NOT NULL PRIMARY KEY, first_name varchar (30), mid_name varchar (30), last_name varchar (30), dep_id int (11) NOT NULL REFERENCES department (dep_id) ON DELETE RESTRICT ON UPDATE RESTRICT MATCH SIMPLE);
- COMMIT TRANSACTION;
- PRAGMA foreign_keys = on;
- "
- End Function
- #End Region
- #Region "Authentication Related Functions"
- Public Sub Session(b As Boolean)
- conf.SetValue("Misc Configuration", "Session", hash.EncryptData(b))
- End Sub
- Public Sub setSession(id As Integer, username As String, name As String, email As String, phone As String, privilege As Integer, photo As Object)
- If (CBool(hash.DecryptData(conf.GetValue("Misc Configuration", "Session")))) Then
- conf.SetValue("Misc Configuration", "SessionString", hash.EncryptData(id & ";" & username & ";" & email & ";" & privilege & ";" & name & ";" & phone & photo))
- End If
- End Sub
- Public Function getSession(session As String)
- Try
- If (CBool(hash.DecryptData(conf.GetValue("Misc Configuration", "Session")))) Then
- Dim s() As String = Split(hash.DecryptData(conf.GetValue("Misc Configuration", "SessionString")), ";")
- Select Case session
- Case "id"
- Return s(0)
- Case "username"
- Return s(1)
- Case "email"
- Return s(2)
- Case "privilege"
- Return s(3)
- Case "name"
- Return s(4)
- Case "phone"
- Return s(5)
- Case "photo"
- Return s(6)
- Case Else
- Return String.Empty
- End Select
- Else
- Return String.Empty
- End If
- Catch ex As Exception
- Return String.Empty
- 'Logs
- End Try
- End Function
- Public Sub deployAccount()
- Try
- Dim name As String = If(getSession("name") = " ", "Not Available", getSession("name"))
- Dim type As String = If(getSession("privilege") = String.Empty, getAccountType(1), getAccountType(CInt(getSession("privilege"))))
- Dim email As String = If(getSession("email") = String.Empty, "Not Available", getSession("email"))
- Dim phone As String = If(getSession("phone") = String.Empty, "Not Available", getSession("phone"))
- Dim username As String = If(getSession("username") = String.Empty, "Not Available", getSession("username"))
- Dim id As String = If(getSession("id") = String.Empty, "Not Available", getSession("id"))
- 'MainWindow UI Text
- MainWindow.Instance.l_account_name.Content = name
- MainWindow.Instance.l_account_type.Content = type
- MainWindow.Instance.l_account_email.Content = email
- MainWindow.Instance.acc_name.Content = username
- MainWindow.Instance.acc_name.ToolTip = If(getSession("name") = " ", "Try to add Preference", getSession("name"))
- 'Settings UI Text
- Settings.Instance.l_account_name_if.Content = name
- Settings.Instance.l_account_name_b_if.Content = name
- Settings.Instance.l_account_name.Content = name
- Settings.Instance.l_account_phone_if.Content = phone
- Settings.Instance.l_account_privilage_if.Content = type
- Settings.Instance.l_account_type.Content = type
- Settings.Instance.l_account_type_if.Content = type
- Settings.Instance.l_account_username_if.Content = username
- Settings.Instance.l_account_id_if.Content = id
- Settings.Instance.l_account_email_if.Content = email
- Catch ex As Exception
- MsgBox("Opps, Something went wrong", "Account Deployment")
- End Try
- End Sub
- Public Sub deployClean()
- MainWindow.Instance.l_account_name.Content = String.Empty
- MainWindow.Instance.l_account_type.Content = String.Empty
- MainWindow.Instance.l_account_email.Content = String.Empty
- MainWindow.Instance.acc_name.Content = String.Empty
- MainWindow.Instance.acc_name.ToolTip = String.Empty
- MainWindow.Instance.tb_login_username.Text = String.Empty
- MainWindow.Instance.pb_password.Password = String.Empty
- Settings.Instance.l_account_name_b_if.Content = String.Empty
- Settings.Instance.l_account_name.Content = String.Empty
- Settings.Instance.l_account_phone_if.Content = String.Empty
- Settings.Instance.l_account_privilage_if.Content = String.Empty
- Settings.Instance.l_account_type.Content = String.Empty
- Settings.Instance.l_account_type_if.Content = String.Empty
- Settings.Instance.l_account_username_if.Content = String.Empty
- Settings.Instance.l_account_id_if.Content = String.Empty
- Settings.Instance.l_account_email_if.Content = String.Empty
- conf.RemoveEntry("Misc Configuration", "SessionString")
- Settings.Instance.b_Add_Accounts.Visibility = Visibility.Collapsed
- Settings.Instance.gb_accounts.Visibility = Visibility.Collapsed
- End Sub
- Public Function getAccountType(p As Integer) As String
- Select Case p
- Case 0
- Settings.Instance.b_Add_Accounts.Visibility = Visibility.Visible
- Settings.Instance.gb_accounts.Visibility = Visibility.Visible
- Return "Administrator"
- Case 1
- Settings.Instance.gb_accounts.Visibility = Visibility.Collapsed
- Return "Staff"
- Case 3
- Return "Developer"
- Case Else
- Return "Visitor"
- End Select
- p = Nothing
- End Function
- #End Region
- #Region "Misc Related"
- Public Sub setMiscEnable()
- conf.SetValue("Misc Configuration", "status", True)
- conf.SetValue("Misc Configuration", "defualt_background", MainWindow.Instance.lockscreen.Background)
- End Sub
- Public Sub setmysqlStatus(status As Boolean)
- conf.SetValue("Misc Configuration", "mysql_status", status)
- End Sub
- Public Function getmysqlStatus() As Boolean
- Return conf.GetValue("Misc Configuration", "mysql_status")
- End Function
- Public Function filter(str As String) As String
- Return Regex.Replace(str, "[^a-zA-Z ]", "")
- End Function
- Public Function filterNum(str As String) As String
- Return Regex.Replace(str, "[^0-9 ]", "")
- End Function
- Public Function Byte2Image(ByVal byteArr() As Byte) As System.Drawing.Image
- Using ImageStream As New MemoryStream(byteArr)
- Dim newImage As System.Drawing.Image
- Try
- If byteArr.GetUpperBound(0) > 0 Then
- newImage = System.Drawing.Image.FromStream(ImageStream)
- Else
- newImage = Nothing
- End If
- Catch ex As Exception
- newImage = Nothing
- End Try
- Return newImage
- End Using
- End Function
- Public Function getVersion() As String
- Return "v"
- End Function
- #End Region
- End Class
- Imports System.ComponentModel
- Imports System.Data.SQLite
- Imports MySql.Data.MySqlClient
- Public Class daemon
- Public Shared m_instance As daemon
- Public connectivity As BackgroundWorker = New BackgroundWorker
- Public tablesInstaller As BackgroundWorker = New BackgroundWorker
- Public SettingsSQL As New MySqlConnection
- Dim incPub As Integer
- Dim connector As New SQLConnector()
- Dim create As String
- Dim command As String
- Dim com() As String
- Dim sql As MySqlConnection
- Public Shared ReadOnly Property setter() As daemon
- Get
- Return m_instance
- End Get
- End Property
- Public Sub daemon_onLoad() Handles Me.Loaded
- m_instance = Me
- End Sub
- Public Sub New()
- InitializeComponent()
- connectivity.WorkerReportsProgress = True
- connectivity.WorkerSupportsCancellation = True
- tablesInstaller.WorkerReportsProgress = True
- tablesInstaller.WorkerSupportsCancellation = True
- AddHandler connectivity.DoWork, AddressOf dsc_DoQuery
- AddHandler connectivity.RunWorkerCompleted, AddressOf dsc_RunQueryCompleted
- AddHandler tablesInstaller.DoWork, AddressOf tables_DoQuery
- AddHandler tablesInstaller.RunWorkerCompleted, AddressOf tables_RunQueryCompleted
- End Sub
- Public Sub connecting()
- MainWindow.Instance.sql_status.Content = "Connecting..."
- MainWindow.Instance.db_type_status.ToolTip = "Connecting to Network"
- MainWindow.Instance.MainSnackBar("Connecting..", 3)
- MainWindow.Instance.FlyoutSnackBar("Connecting..", 3)
- End Sub
- Public Sub connected()
- MainWindow.Instance.sql_status.Content = "Network Connected"
- MainWindow.Instance.db_type_status.ToolTip = "Currently Connected to Network"
- MainWindow.Instance.MainSnackBar("Connected", 3)
- MainWindow.Instance.FlyoutSnackBar("Connected", 3)
- If config.io.getmysqlStatus() Then
- SettingsSQL.ChangeDatabase(config.io.conf.GetValue("Database", "dbname"))
- Settings.Instance.l_database.Content = SettingsSQL.Database
- Settings.Instance.gb_dm_mysql.Visibility = Visibility.Visible
- Else
- database_installation()
- End If
- End Sub
- Public Sub disconnected()
- MainWindow.Instance.sql_status.Content = "Disconnected"
- MainWindow.Instance.db_type_status.ToolTip = "Unable to connect to specified network"
- MainWindow.Instance.MainSnackBar("Disconnected", 3)
- MainWindow.Instance.FlyoutSnackBar("Disconnected", 3)
- End Sub
- Public Sub retry_disconnected()
- MainWindow.Instance.sql_status.Content = "Disconnected"
- MainWindow.Instance.db_type_status.ToolTip = "Click to Reconnect"
- MainWindow.Instance.MainSnackBar("Disconnected", 3)
- MainWindow.Instance.FlyoutSnackBar("Disconnected", 3)
- End Sub
- Public Sub retry_connecting()
- MainWindow.Instance.sql_status.Content = "Connecting..."
- MainWindow.Instance.db_type_status.ToolTip = "Retrying to connect"
- MainWindow.Instance.MainSnackBar("
- Connecting", 3)
- MainWindow.Instance.FlyoutSnackBar("Connecting..", 3)
- End Sub
- 'Background Worker for SQL Connection State
- Public Sub dsc_DoQuery(ByVal sender As Object, ByVal e As DoWorkEventArgs)
- Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
- While SettingsSQL.Ping
- If connectivity.CancellationPending = True Then
- e.Cancel = True
- Exit While
- Else
- System.Threading.Thread.Sleep(3000)
- database_c_update()
- End If
- End While
- End Sub
- Public Sub dsc_RunQueryCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs)
- If (SettingsSQL.State = Data.ConnectionState.Closed) Then
- If connectivity.IsBusy = True Then
- connectivity.CancelAsync()
- database_c_update()
- End If
- End If
- database_c_update()
- MainWindow.Instance.MainSnackBar("Connection Interupted", 4)
- End Sub
- 'Background Installation DB Tables
- Public Sub tables_DoQuery(ByVal sender As Object, ByVal e As DoWorkEventArgs)
- Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
- Try
- Dim cmdDB As New MySqlCommand(create, sql)
- cmdDB.ExecuteNonQuery()
- Dim cmdTables As New MySqlCommand()
- For index = 0 To com.Length
- If connectivity.CancellationPending = True Then
- e.Cancel = True
- Exit For
- Else
- Try
- cmdTables.Connection = sql
- cmdTables.CommandText = com(index)
- cmdTables.ExecuteNonQuery()
- Settings.Instance.l_deamon_status.Content = "Creating Tables " & index & " of " & com.Length & "tables"
- Catch ex As Exception
- 'TODO Logs
- Finalize()
- End Try
- System.Threading.Thread.Sleep(500)
- End If
- Next
- sql.Close()
- Catch ex As MySqlException
- 'Todo Installation Logs
- Catch exc As Exception
- 'Todo Installation Logs
- End Try
- End Sub
- Public Sub tables_RunQueryCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs)
- MainWindow.Instance.MainSnackBar("Tables Created", 2)
- config.io.conf.SetValue("Misc Configuration", "mysql_status", True)
- config.io.setDBShared(Settings.Instance.tb_p_db_server.Text, Settings.Instance.tb_p_db_server_port.Text, Settings.Instance.tb_p_db_server_username.Text, Settings.Instance.tb_p_db_server_password.Password, config.io.conf.GetValue("Database", "dbname"))
- Settings.Instance.database_tc_status(4)
- daemon.setter.SettingsSQL = connector.ConnectDB(config.io.getmysqlStatus())
- daemon.setter.connectivity.RunWorkerAsync()
- daemon.setter.database_c_update()
- MainWindow.Instance.FlyoutSnackBar("Saved", 3)
- Settings.Instance.l_deamon_status.Content = "Exporting Credentials"
- Settings.Instance.l_deamon_status.Content = "Connecting..."
- exportAdmin()
- MainWindow.Instance.FlyoutSnackBar("Credential Syncronized", 3)
- End Sub
- Public Sub database_c_update()
- Try
- If (SettingsSQL.State) Then
- Settings.Instance.l_version.Content = SettingsSQL.ServerVersion
- Settings.Instance.l_host.Content = Settings.Instance.tb_p_db_server.Text
- Settings.Instance.l_port.Content = Settings.Instance.tb_p_db_server_port.Text
- connected()
- Else
- Settings.Instance.l_database.Content = ""
- Settings.Instance.gb_dm_mysql.Visibility = Visibility.Collapsed
- Settings.Instance.database_tc_status(2)
- retry_disconnected()
- End If
- Catch ex As System.InvalidOperationException
- Finalize()
- Catch etcEx As Exception
- Finalize()
- End Try
- End Sub
- Public Sub database_installation()
- Try
- config.io.conf.SetValue("Database", "dbname", config.io.getInitDB() & 0)
- Dim setconf() As String = Split(config.io.getDBShared(), ",")
- Dim reg_dbname As String = If(Not setconf(4) = "", setconf(4), config.io.getInitDB() & 0)
- Dim db_version() As String = Split(reg_dbname, "v")
- If (isDBExist(reg_dbname)) Then
- If MessageBox.Show("Another database exist " & Environment.NewLine & "Create new database? Yes or No to use the existing. ", "Old Database Exists", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
- Dim temp As Integer = 0
- While Not config.io.getmysqlStatus
- If isDBExist(config.io.getInitDB() & temp) Then
- temp = temp + 1
- Else
- database_creation(temp)
- config.io.conf.SetValue("Database", "dbname", config.io.getInitDB() & temp)
- Settings.Instance.l_deamon_status.Content = "Database Created"
- Exit While
- End If
- End While
- Else
- config.io.conf.SetValue("Database", "dbname", config.io.getInitDB() & CInt(db_version(1)))
- exportAdmin()
- End If
- Else
- config.io.conf.SetValue("Database", "dbname", config.io.getInitDB() & CInt(db_version(1)))
- database_creation(CInt(db_version(1)))
- exportAdmin()
- End If
- Catch ex As Exception
- 'todo installation logs
- End Try
- End Sub
- Public Function isDBExist(dbname As String) As Boolean
- Try
- Dim sql As MySqlConnection = connector.ConnectDB(False)
- Dim isCreated As New MySqlCommand("SHOW DATABASES LIKE '" & dbname & "';", sql)
- Dim sqlReader As MySqlDataReader = isCreated.ExecuteReader()
- Return sqlReader.Read()
- sql.Close()
- Catch ex As MySqlException
- Return False
- End Try
- End Function
- Public Sub database_creation(inc As Integer)
- If Not (tablesInstaller.IsBusy) Then
- create = config.io.setDBCreate(inc)
- command = config.io.getDBTablesCommand()
- com = Split(command, ";")
- sql = connector.ConnectDB(config.io.getmysqlStatus())
- tablesInstaller.RunWorkerAsync()
- End If
- End Sub
- Private Sub exportAdmin()
- Dim sql As New MySqlConnection()
- sql = connector.ConnectDB(True)
- Dim export As New MySqlCommand("INSERT INTO staff_name (name_staff_id) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ");
- INSERT INTO contact(contact_id, email_add) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", '" & config.io.hash.DecryptData((config.io.conf.GetValue("Account", "email"))) & "');
- INSERT INTO credentials(cred_id, username, password, privilege) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", '" & config.io.hash.DecryptData((config.io.conf.GetValue("Account", "username"))) & "', '" & config.io.conf.GetValue("Account", "password") & "', " & config.io.conf.GetValue("Account", "type") & ");
- INSERT INTO staff(staff_id, name_id, cred_id,contact_id) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & "," & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & "," & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & "," & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ")", sql)
- sql.Close()
- End Sub
- Public Sub connectSQLite()
- Try
- Dim dbConnection As SQLiteConnection = connector.ConnectDBSQLI()
- Dim cmd As New SQLiteCommand(config.io.getDBSQLITablesCommand, dbConnection)
- cmd.ExecuteNonQuery()
- dbConnection.Close()
- config.io.conf.SetValue("Misc Configuration", "sqli_status", True)
- Catch ex As Exception
- MsgBox(ex.ToString)
- End Try
- End Sub
- Public Sub exportAdminSQLi()
- Dim sqli As New SQLiteConnection()
- sqli = connector.ConnectDBSQLI()
- Dim export As New SQLiteCommand("INSERT INTO contact (contact_id, email_add) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", '" & config.io.hash.DecryptData((config.io.conf.GetValue("Account", "email"))) & "');
- INSERT INTO credentials (cred_id, username, password, privilege) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", '" & config.io.hash.DecryptData((config.io.conf.GetValue("Account", "username"))) & "', '" & config.io.conf.GetValue("Account", "password") & "', " & config.io.conf.GetValue("Account", "type") & ");
- INSERT INTO staff_name (name_staff_id) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ");
- INSERT INTO staff (staff_id, name_id, contact_id, cred_id) VALUES (" & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", " & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & "," & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ", " & config.io.hash.DecryptData(config.io.conf.GetValue("Account", "user_id")) & ");", sqli)
- export.ExecuteNonQuery()
- sqli.Close()
- End Sub
- Private Sub logger(err As Object)
- If Not System.IO.Directory.Exists(System.Windows.Forms.Application.UserAppDataPath & "\Reserfy Local Database\") Then
- System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.UserAppDataPath & "\Logs\")
- End If
- End Sub
- End Class
- Imports System.Data.SQLite
- Public Class DashBoard
- Private Sub DashBoard_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
- availableRoomRefresh()
- End Sub
- Private Sub Add_Room(sender As Object, e As RoutedEventArgs)
- Add_Rooms.IsOpen = True
- End Sub
- Private Sub Refresh_Rooms(sender As Object, e As RoutedEventArgs)
- availableRoomRefresh()
- End Sub
- Private Sub Delete_Room(sender As Object, e As RoutedEventArgs)
- Delete_Rooms.IsOpen = True
- updateDelList()
- End Sub
- Private Sub b_reset_Click(sender As Object, e As RoutedEventArgs)
- clear()
- MainWindow.Instance.MainSnackBar("Fields Reseted", 3)
- End Sub
- Private Sub b_save_Click(sender As Object, e As RoutedEventArgs)
- Try
- If String.IsNullOrEmpty(tb_room_name.Text) Then
- MainWindow.Instance.MainSnackBar("Floor Field Rquired", 3)
- End If
- If String.IsNullOrEmpty(nud_floor.Value) Then
- MainWindow.Instance.MainSnackBar("Room Field Rquired", 3)
- End If
- If Not (String.IsNullOrEmpty(tb_room_name.Text) Or String.IsNullOrEmpty(nud_floor.Value)) Then
- Add_Rooms.IsOpen = False
- AddRoom()
- availableRoomRefresh()
- End If
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Failed to Add", 3)
- End Try
- End Sub
- Private Sub b_cancel_Click(sender As Object, e As RoutedEventArgs)
- Add_Rooms.IsOpen = False
- clear()
- MainWindow.Instance.MainSnackBar("Action Canceled", 3)
- End Sub
- Private Sub clear()
- nud_floor.Value = Nothing
- tb_room_name.Clear()
- End Sub
- Private Sub AddRoom()
- Dim Connector As New SQLConnector()
- Dim id As Integer
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("SELECT max(room_type_id) FROM room_type", sqli)
- Dim dr As SQLiteDataReader = rmd.ExecuteReader()
- While dr.Read
- id = CInt(If(IsDBNull(dr(0)), 0, dr(0)))
- End While
- Dim cmd As New SQLiteCommand("INSERT INTO room_type(room_type_id, description) values ('" & id + 1 & "','" & tb_room_name.Text & "')", sqli)
- Dim cmd2 As New SQLiteCommand("INSERT INTO room(room_id, floor_level, room_type_id) values ('" & id + 1 & "', '" & nud_floor.Value & "', '" & id + 1 & "')", sqli)
- cmd.ExecuteNonQuery()
- cmd2.ExecuteNonQuery()
- clear()
- MainWindow.Instance.MainSnackBar("Room Added", 3)
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Adding Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub availableRoomRefresh()
- available_rooms.Children.Clear()
- Dim Connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("SELECT * From room", sqli)
- Dim dr As SQLiteDataReader = rmd.ExecuteReader()
- While dr.Read()
- Dim room As New card()
- Dim rmd1 As New SQLiteCommand("SELECT * From room_type Where room_type_id =" & dr("room_type_id").ToString, sqli)
- Dim dr1 As SQLiteDataReader = rmd1.ExecuteReader()
- While dr1.Read
- room.l_room_name.Content = dr1("description").ToString
- End While
- room.status.Tag = dr("room_id").ToString & ":" & dr("floor_level").ToString & ":" & dr("room_type_id").ToString
- AddHandler room.status.Click, AddressOf Room_Status_Clicked
- available_rooms.Children.Add(room)
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Refresh Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub updateDelList()
- cb_del.Items.Clear()
- Dim Connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rmd As New SQLiteCommand("SELECT * From room", sqli)
- Dim dr As SQLiteDataReader = rmd.ExecuteReader()
- While dr.Read()
- Dim rmd1 As New SQLiteCommand("SELECT * From room_type Where room_type_id =" & dr("room_type_id").ToString, sqli)
- Dim dr1 As SQLiteDataReader = rmd1.ExecuteReader()
- While dr1.Read
- cb_del.Items.Add(dr1("description").ToString)
- End While
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Refresh Failed", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- Private Sub Room_Status_Clicked(ByVal sender As Object, ByVal e As RoutedEventArgs)
- If e.Source.GetType Is GetType(Button) Then
- MsgBox(sender.Tag)
- End If
- End Sub
- Private Sub b_d_cancel_Click(sender As Object, e As RoutedEventArgs)
- Delete_Rooms.IsOpen = False
- cb_del.Text = Nothing
- End Sub
- Private Sub b_d_Delete_Click(sender As Object, e As RoutedEventArgs)
- Dim Connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Else
- Try
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Dim rdr As New SQLiteCommand("SELECT room_type_id From room_type Where description = '" & cb_del.SelectedValue & "'", sqli)
- Dim dr As SQLiteDataReader = rdr.ExecuteReader()
- While dr.Read()
- Dim cmd As New SQLiteCommand("DELETE FROM `room` WHERE `room_type_id` = " & dr("room_type_id"), sqli)
- cmd.ExecuteNonQuery()
- Dim cmd2 As New SQLiteCommand("DELETE FROM `room_type` WHERE `room_type_id` = " & dr("room_type_id"), sqli)
- cmd2.ExecuteNonQuery()
- availableRoomRefresh()
- Delete_Rooms.IsOpen = False
- MainWindow.Instance.MainSnackBar("Room Removed", 3)
- End While
- Catch ex As SQLiteException
- MainWindow.Instance.MainSnackBar("Failed Remove", 3)
- Catch ex As Exception
- MainWindow.Instance.MainSnackBar("Something Went Wrong", 3)
- End Try
- End If
- End Sub
- End Class
- Imports MySql.Data.MySqlClient
- Imports AMS.Profile
- Imports Reserfy_App.SettingsHelper
- Public Class Database
- Private XMLConfig As New ConfigurationHelper()
- Private settingsXML As Xml = XMLConfig.SettingsConfigXML()
- Private settingsRegistry As Registry = XMLConfig.SettingsConfigRegistry()
- Private settingsHash As Cypher = XMLConfig.SettingsHashWrapper()
- Private mainConnection As MySqlConnection
- Private Sub rb_personal_Checked(sender As Object, e As RoutedEventArgs) Handles rb_personal.Checked
- tc_db_status(1)
- End Sub
- Private Sub b_p_browse_Click(sender As Object, e As RoutedEventArgs) Handles b_p_browse.Click
- Dim location As New System.Windows.Forms.FolderBrowserDialog()
- Dim result As System.Windows.Forms.DialogResult = location.ShowDialog()
- If result Then
- tb_p_db_location.Text = location.SelectedPath
- End If
- End Sub
- Private Function rb_personal_verififcation()
- If Not (tb_p_db_location.Text Like "") Then
- Return True
- Else
- Return False
- End If
- End Function
- Private Sub rb_shared_Checked(sender As Object, e As RoutedEventArgs) Handles rb_shared.Checked
- tc_db_status(2)
- End Sub
- Private Sub tc_db_status(index As Integer)
- tc_db_connections.SelectedIndex = index
- End Sub
- Public Function db_c_update()
- If (mainConnection.State) Then
- l_version.Content = mainConnection.ServerVersion
- l_database.Content = mainConnection.Database
- l_host.Content = tb_p_db_server.Text
- l_port.Content = tb_p_db_server_port.Text
- Else
- l_version.Content = "Can't get Server Version"
- l_database.Content = "Database Unknown"
- l_host.Content = tb_p_db_server.Text
- l_port.Content = tb_p_db_server_port.Text
- End If
- Return mainConnection.State
- End Function
- Private Async Sub b_db_connection_save_Click(sender As Object, e As RoutedEventArgs) Handles b_db_connection_save.Click
- Dim connector As New SQLConnector()
- If (rb_personal.IsChecked = True) Then
- If rb_personal_verififcation() Then
- personal_save_config()
- Else
- 'TODO Prompt Empty DB Location Error
- End If
- ElseIf (rb_shared.IsChecked = True)
- tc_db_status(3)
- Dim status = Await connector.shared_try_config(tb_p_db_server.Text, tb_p_db_server_port.Text, tb_p_db_server_username.Text, tb_p_db_server_password.Password)
- If (status) Then
- rb_personal.IsEnabled = False
- b_db_connection_save.IsEnabled = False
- tc_db_status(4)
- shared_save_config()
- connector.ConnectDB()
- Else
- tc_db_status(2)
- End If
- settingsRegistry.SetValue("db_shared", "status", status)
- db_c_update()
- End If
- End Sub
- Private Sub b_db_management_import_Click(sender As Object, e As RoutedEventArgs) Handles b_db_management_import.Click
- End Sub
- Private Sub b_db_management_export_Click(sender As Object, e As RoutedEventArgs) Handles b_db_management_export.Click
- End Sub
- Private Sub b_db_management_delete_Click(sender As Object, e As RoutedEventArgs) Handles b_db_management_delete.Click
- End Sub
- Private Sub personal_save_config()
- settingsXML.Buffer()
- settingsXML.SetValue("db", "status", "personal")
- settingsXML.RemoveSection("db_shared")
- settingsRegistry.RemoveSection("db_shared")
- settingsXML.SetValue("db_personal", "location", tb_p_db_location.Text)
- End Sub
- Private Sub shared_save_config()
- settingsXML.Buffer()
- settingsXML.SetValue("db", "status", "shared")
- settingsXML.RemoveSection("db_personal")
- settingsXML.SetValue("db_shared", "servername", tb_p_db_server.Text)
- settingsXML.SetValue("db_shared", "port", If(tb_p_db_server_port.Text Like "", 3306, tb_p_db_server_port.Text))
- 'For Security Reasons Database Username And Password Are Not Save same as other configurations
- settingsRegistry.SetValue("db_shared", "username", settingsHash.EncryptData(tb_p_db_server_username.Text))
- settingsRegistry.SetValue("db_shared", "password", settingsHash.EncryptData(tb_p_db_server_password.Password))
- End Sub
- End Class
- Public Class DayBox
- Private _myReservationsList As New List(Of Reservation)
- Public Sub SetReservations()
- '-- Use whatever function you want to load the MonthReservations list, I happen to have a list filled by linq that has
- ' many (possibly the past several years) of them loaded, so i filter to only pass the ones showing up in the displayed
- ' month. Note that the "setter" for MonthReservations also triggers a redraw of the display.
- Dim SetReservation As New cldr.Calendar
- SetReservation.Reservation_Calendar.MonthAppointments = _myReservationsList.FindAll(
- New System.Predicate(Of Reservation)(
- Function(apt As Reservation) _
- apt.StartTime IsNot Nothing AndAlso
- CDate(apt.StartTime).Month = SetReservation.Reservation_Calendar.DisplayStartDate.Month AndAlso
- CDate(apt.StartTime).Year = SetReservation.Reservation_Calendar.DisplayStartDate.Year))
- End Sub
- End Class
- Public Class EventBadge
- End Class
-
- Public Class gridData
- End Class
- Public Class Home
- Public Shared m_instance As Home
- Public Shared ReadOnly Property Instance() As Home
- Get
- Return m_instance
- End Get
- End Property
- Public Sub Config_onLoad() Handles Me.Loaded
- m_instance = Me
- End Sub
- Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click
- MainActivity.Instance.HamburgerTab(2)
- End Sub
- Private Sub button_Copy_Click(sender As Object, e As RoutedEventArgs) Handles button_Copy.Click
- MainActivity.Instance.HamburgerTab(1)
- End Sub
- Private Sub button_Copy1_Click(sender As Object, e As RoutedEventArgs) Handles button_Copy1.Click
- MainActivity.Instance.HamburgerTab(3)
- End Sub
- Private Sub button_Copy2_Click(sender As Object, e As RoutedEventArgs) Handles button_Copy2.Click
- MainWindow.Instance.FlyoutSettings.IsOpen = True
- End Sub
- End Class
- Imports System.Threading
- Imports MahApps.Metro.Controls
- Imports MahApps.Metro.Controls.Dialogs
- Public Class MainActivity
- Public Shared m_instance As MainActivity
- Private Sub uc_onload() Handles Me.Loaded
- m_instance = Me
- l_en_title.Content = config.io.conf.GetValue("Establisment", "name")
- time_date()
- End Sub
- Public Shared ReadOnly Property Instance() As MainActivity
- Get
- Return m_instance
- End Get
- End Property
- Private Sub AppMenu(sender As Object, e As ItemClickEventArgs)
- HamburgerTab(HamburgerMenuControl.SelectedIndex)
- If Me.HamburgerMenuControl.IsPaneOpen Then
- Me.HamburgerMenuControl.IsPaneOpen = False
- End If
- End Sub
- Public Sub HamburgerTab(index As Integer)
- HamburgerTabControl.SelectedIndex = index
- End Sub
- Private Async Sub time_date()
- Await Task.Delay(250)
- l_date_time.Content = DateTime.Now.ToString("MMMM dd, yyyy h:mm:ss tt")
- time_date()
- End Sub
- Private Sub AppOptions(sender As Object, e As ItemClickEventArgs)
- Dim index As Integer = HamburgerMenuControl.SelectedOptionsIndex
- If (index = 0) Then
- If (MessageBox.Show("Logout?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes) Then
- config.io.Session(False)
- config.io.deployClean()
- MainWindow.Instance.Auth_Window()
- MainWindow.Instance.RemoveMainActivity()
- Settings.Instance.loginBackground(config.io.conf.GetValue("Misc Configuration", "loginBackground"), False)
- Else
- End If
- ElseIf (index = 1) Then
- MainWindow.Instance.FlyoutSettings.IsOpen = True
- End If
- End Sub
- End Class
- Imports System.ComponentModel
- Imports MySql.Data.MySqlClient
- Imports System.Data.SQLite
- Imports System.Threading
- Public Class MainWindow
- Private Shared m_instance As MainWindow
- 'Authentication retry counts
- Dim authCount As Integer = Nothing
- Public Shared ReadOnly Property Instance() As MainWindow
- Get
- Return m_instance
- End Get
- End Property
- 'Flyout Hyperlink Code
- Private Sub Hyperlink_Account(sender As Object, e As RoutedEventArgs)
- FlyoutSettings.IsOpen = True
- FlyoutAccount.IsOpen = False
- Settings.Instance.settingsMainTab.SelectedIndex = 1
- End Sub
- Private Sub auth_forgot_account(sender As Object, e As RoutedEventArgs)
- tb_login_username.Clear()
- pb_password.Clear()
- tc_authentication.SelectedIndex = 1
- End Sub
- 'Tab Control Main App
- Private Sub mw_tab_control(sender As Object, e As RoutedEventArgs) Handles AppMode.SelectionChanged
- If AppMode.SelectedIndex = 3 Then
- If Settings.Instance.rb_shared.IsChecked = True Then
- db_type_status.Visibility = Visibility.Visible
- Else
- db_type_status.Visibility = Visibility.Collapsed
- End If
- RigthStatusBar.Visibility = Visibility.Visible
- Else
- RigthStatusBar.Visibility = Visibility.Collapsed
- End If
- End Sub
- 'Windows Controls Code
- Private Sub settingsFlyout(sender As Object, e As RoutedEventArgs) Handles FlyoutSettings.ClosingFinished
- Settings.Instance.loginBackground(config.io.conf.GetValue("Misc Configuration", "loginBackground"), True)
- Settings.Instance.i_image.Source = Nothing
- Settings.Instance.image_profile_account.Source = Nothing
- Dim t As New Thread(New ThreadStart(Sub()
- Thread.Sleep(500)
- GC.Collect()
- End Sub))
- t.Start()
- End Sub
- Private Sub settingsFlyoutOpen(sender As Object, e As RoutedEventArgs) Handles FlyoutSettings.IsOpenChanged
- If FlyoutSettings.IsOpen Then
- Settings.Instance.loginBackground(config.io.conf.GetValue("Misc Configuration", "loginBackground"), True)
- MainWindow.Instance.lockscreen.Background = Nothing
- Dim t As New Thread(New ThreadStart(Sub()
- Thread.Sleep(500)
- GC.Collect()
- End Sub))
- t.Start()
- End If
- End Sub
- 'App Configuration Code
- Private Function app_configure_verify()
- 'Return Boolean Validation
- Dim isValid As Boolean = True
- 'User input initializations
- Dim id1 As String = tb_new_id.Text
- Dim p1 As String = pb_new_password.Password
- Dim p2 As String = pb_set_password_retype.Password
- Dim u1 As String = tb_new_username.Text
- Dim e1 As String = tb_recovery_email.Text
- 'User error handling initialization
- If (id1 Like "") Then
- id_error.Content = "ID Number must not be empty"
- isValid = False
- Else
- Try
- id1 = CInt(id1)
- id_error.Content = ""
- Catch ex As Exception
- id_error.Content = "ID Number must be a number"
- isValid = False
- End Try
- End If
- If (u1 Like "") Then
- username_error.Content = "Username must not be empty"
- isValid = False
- ElseIf (u1.Length > 20)
- username_error.Content = "Username must 20 characters or less"
- isValid = False
- Else
- username_error.Content = ""
- End If
- If (p1 Like "") Then
- password_error.Content = "Password must not be empty"
- isValid = False
- ElseIf (p1.Length < 8)
- password_error.Content = "Password must 8 characters or greater"
- isValid = False
- Else
- password_error.Content = ""
- End If
- If Not (p1 Like p2) Then
- retype_password_error.Content = "Password did not match"
- isValid = False
- Else
- retype_password_error.Content = ""
- End If
- If (e1 Like "") Then
- email_error.Content = "Recovery Email must not be empty"
- isValid = False
- Else
- Try
- Dim eAT() As String = Split(e1, "@")
- Dim eDot() As String = Split(eAT(1), ".")
- If (eAT(0) Like "" Or eDot(0) Like "" Or eDot(1) Like "") Then
- email_error.Content = "Recovery Email is Invalid"
- isValid = False
- Else
- email_error.Content = ""
- End If
- Catch ex As IndexOutOfRangeException
- email_error.Content = "Recovery Email is Invalid"
- isValid = False
- End Try
- End If
- id1 = Nothing
- p1 = Nothing
- p2 = Nothing
- u1 = Nothing
- e1 = Nothing
- Return isValid
- End Function
- Private Async Sub app_configure_data_save()
- If (app_configure_verify()) Then
- config.io.setDefaults()
- config.io.setAdmin(tb_new_id.Text, tb_new_username.Text, pb_new_password.Password, tb_recovery_email.Text)
- MainSnackBar("Preparing Login...", 2)
- daemon.setter.connectSQLite()
- daemon.setter.exportAdminSQLi()
- Await Tasker.Delay(2)
- Auth_Window()
- End If
- End Sub
- Private Sub b_get_started_Click(sender As Object, e As RoutedEventArgs)
- AppMode.SelectedIndex = 2
- End Sub
- 'Authentication Window
- Private Sub b_login_Click(sender As Object, e As RoutedEventArgs)
- If Not (tb_login_username.Text = String.Empty Or pb_password.Password = String.Empty) Then
- Dim isLogin As Boolean = False
- Dim staff_id As Integer = 0
- Dim connector As New SQLConnector()
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Dim sql As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("SELECT * FROM `credentials` WHERE `username` LIKE '" & config.io.filter(tb_login_username.Text) & "' AND `password` LIKE '" & config.io.hash.EncryptData(pb_password.Password) & "';", sql)
- Dim sqlReader As MySqlDataReader = cmd.ExecuteReader()
- isLogin = sqlReader.Read()
- staff_id = sqlReader("staff_id").ToString
- sqlReader.Close()
- cmd.Dispose()
- sqlReader = Nothing
- cmd = Nothing
- Catch ex As Exception
- MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- connector = Nothing
- sql.Close()
- sql.Dispose()
- sql = Nothing
- End Try
- Else
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("select * from credentials where username like '" & config.io.filter(tb_login_username.Text) & "' and password like '" & config.io.hash.EncryptData(pb_password.Password) & "';", sqli)
- Dim sqliReader As SQLiteDataReader = cmd.ExecuteReader()
- isLogin = sqliReader.Read()
- staff_id = sqliReader("cred_id").ToString
- cmd.Dispose()
- cmd = Nothing
- sqliReader.Close()
- sqliReader = Nothing
- Catch ex As Exception
- MainSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- If isLogin Then
- If (config.io.getDBType() = "personal") Then
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("SELECT staff.staff_id,staff.photo, staff_name.first_name, staff_name.last_name, contact.email_add, contact.mobile, credentials.username, credentials.privilege FROM (((staff INNER JOIN contact ON staff.staff_id = contact.contact_id) INNER JOIN credentials ON staff.staff_id = credentials.cred_id) INNER JOIN staff_name ON staff_id = staff_name.name_staff_id) WHERE staff.staff_id = " & staff_id & " ", sqli)
- Dim sqliREader As SQLiteDataReader = cmd.ExecuteReader()
- If (sqliREader.Read()) Then
- AddMainActivity()
- onSession()
- config.io.Session(True)
- config.io.setSession(CInt(sqliREader("staff_id")), sqliREader("username").ToString, sqliREader("first_name").ToString & " " & sqliREader("last_name").ToString, sqliREader("email_add").ToString, sqliREader("mobile").ToString, CInt(sqliREader("privilege")), sqliREader("photo"))
- config.io.deployAccount()
- End If
- cmd.Dispose()
- cmd = Nothing
- sqliREader.Close()
- sqliREader = Nothing
- Catch ex As SQLiteException
- MainSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- isLogin = Nothing
- Else
- Dim sql As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("SELECT staff.staff_id,staff.photo, staff_name.first_name, staff_name.last_name, contact.email_add, contact.mobile, credentials.username, credentials.privilege FROM (((staff INNER JOIN contact ON staff.staff_id = contact.contact_id) INNER JOIN credentials ON staff.staff_id = credentials.cred_id) INNER JOIN staff_name ON staff_id = staff_name.name_staff_id) WHERE staff.staff_id = " & staff_id & " ", sql)
- Dim sqlReader As MySqlDataReader = cmd.ExecuteReader()
- If (sqlReader.Read()) Then
- AddMainActivity()
- onSession()
- config.io.Session(True)
- config.io.setSession(CInt(sqlReader("staff_id")), sqlReader("username").ToString, sqlReader("first_name").ToString & " " & sqlReader("last_name").ToString, sqlReader("email_add").ToString, sqlReader("mobile").ToString, CInt(sqlReader("privilege")), sqlReader("photo"))
- config.io.deployAccount()
- End If
- cmd.Dispose()
- cmd = Nothing
- sqlReader.Close()
- sqlReader = Nothing
- Catch ex As MySqlException
- MainSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sql.Close()
- sql.Dispose()
- sql = Nothing
- End Try
- End If
- cw_auth.IsOpen = False
- AppMode.SelectedIndex = 3
- authCount = 0
- Else
- authCount = authCount + 1
- If (authCount >= 3) Then
- tc_authentication.SelectedIndex = 1
- authCount = 0
- Else
- tb_login_username.Clear()
- pb_password.Clear()
- MainSnackBar("Wrong Credentials, Try again", 3)
- End If
- End If
- Else
- MainSnackBar("Login Failed", 3)
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_exit_Click(sender As Object, e As RoutedEventArgs)
- Me.Close()
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_rec_yes_Click(sender As Object, e As RoutedEventArgs)
- tc_authentication.SelectedIndex = 2
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_search_confirm_Click(sender As Object, e As RoutedEventArgs)
- 'todo sent reset link
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub auth_recovery_cancel(sender As Object, e As RoutedEventArgs) Handles b_search_cancel.Click, b_sent_cancel.Click, b_retry_cancel.Click, b_rec_no.Click
- tc_authentication.SelectedIndex = 0
- 'todo clean all recovery data's
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_retry_send_Click(sender As Object, e As RoutedEventArgs)
- 'todo retry sending
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_new_save_Click(sender As Object, e As RoutedEventArgs)
- 'todo save new password
- sender = Nothing
- e = Nothing
- End Sub
- 'Authentication Dialog
- Public Sub Auth_Window()
- cw_auth.IsOpen = True
- tc_authentication.SelectedIndex = 0
- AppMode.SelectedIndex = 4
- End Sub
- 'SnackBar MessageBox
- Public Async Sub MainSnackBar(message As String, timeout As Integer)
- MainWindow.Instance.s_main.Visibility = Visibility.Visible
- MainWindow.Instance.s_main.IsActive = True
- MainWindow.Instance.s_name_msg.Content = message
- Await Tasker.Delay(timeout)
- MainWindow.Instance.s_main.IsActive = False
- MainWindow.Instance.s_name_msg.Content = Nothing
- MainWindow.Instance.s_main.Visibility = Visibility.Collapsed
- message = Nothing
- timeout = Nothing
- End Sub
- Public Async Sub FlyoutSnackBar(message As String, timeout As Integer)
- MainWindow.Instance.fs_main.Visibility = Visibility.Visible
- MainWindow.Instance.fs_main.IsActive = True
- MainWindow.Instance.fs_name_msg.Content = message
- Await Tasker.Delay(timeout)
- MainWindow.Instance.fs_main.IsActive = False
- MainWindow.Instance.fs_name_msg.Content = Nothing
- MainWindow.Instance.fs_main.Visibility = Visibility.Collapsed
- message = Nothing
- timeout = Nothing
- End Sub
- 'Blast Off Main Objects
- Public Async Sub onLoad() Handles Me.Loaded
- Dim opt As New Optimizer.App
- m_instance = Me
- opt.cleanProcess()
- Await Delay(5)
- If config.io.getRegistryStatus() Then
- Auth_Window()
- Else
- AppMode.SelectedIndex = 1
- config.io.conf.SetValue("Misc Configuration", "sqli_status", False)
- End If
- opt = Nothing
- End Sub
- Private Sub onSession()
- MainWindow.Instance.lockscreen.Background = Nothing
- Dim t As New Thread(New ThreadStart(Sub()
- Thread.Sleep(500)
- GC.Collect()
- End Sub))
- t.Start()
- UpdateLayout()
- End Sub
- 'On App Close Handler
- Private Sub MainWindow_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
- If MessageBox.Show("Are you sure do you want to quit the App?", "Quit Reserfy", MessageBoxButton.YesNo) = MessageBoxResult.Yes Then
- config.io.deployClean()
- End
- Else
- e.Cancel = True
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub db_type_status_Click(sender As Object, e As RoutedEventArgs)
- If Not daemon.setter.SettingsSQL.Ping And Settings.Instance.rb_shared.IsChecked = True Then
- Settings.Instance.reconnect()
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub acc_name_Click(sender As Object, e As RoutedEventArgs)
- FlyoutAccount.IsOpen = True
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_start_save_Click(sender As Object, e As RoutedEventArgs)
- app_configure_data_save()
- sender = Nothing
- e = Nothing
- End Sub
- Public Sub AddMainActivity()
- Dim ma As New MainActivity()
- MainActivityHolder.Children.Clear()
- MainActivityHolder.Children.Add(ma)
- End Sub
- Public Sub RemoveMainActivity()
- Dim ma As New MainActivity()
- MainActivityHolder.Children.Clear()
- Finalize()
- End Sub
- End Class
- Imports System.Globalization
- Class MonthView
- Friend _DisplayStartDate As Date = Date.Now.AddDays(-1 * (Date.Now.Day - 1))
- Private _DisplayMonth As Integer = _DisplayStartDate.Month
- Private _DisplayYear As Integer = _DisplayStartDate.Year
- Private _cultureInfo As New CultureInfo(CultureInfo.CurrentUICulture.LCID)
- Private sysCal As Globalization.Calendar = _cultureInfo.Calendar()
- Private _monthAppointments As List(Of Reservation)
- Public Event DisplayMonthChanged(ByVal e As MonthChangedEventArgs)
- Public Event DayBoxClicked(ByVal e As NewAppointmentEventArgs)
- Public Event ReservationClickedEvent(ByVal Appointment_Id As Integer)
- Public Property DisplayStartDate() As Date
- Get
- Return _DisplayStartDate
- End Get
- Set(ByVal value As Date)
- _DisplayStartDate = value
- _DisplayMonth = _DisplayStartDate.Month
- _DisplayYear = _DisplayStartDate.Year
- End Set
- End Property
- Friend Property MonthAppointments() As List(Of Reservation)
- Get
- Return _monthAppointments
- End Get
- Set(ByVal value As List(Of Reservation))
- _monthAppointments = value
- Call BuildCalendarUI()
- End Set
- End Property
- Private Sub MonthView_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles MyBase.Loaded
- If _monthAppointments Is Nothing Then Call BuildCalendarUI()
- End Sub
- Private Sub BuildCalendarUI()
- Dim iDaysInMonth As Integer = sysCal.GetDaysInMonth(_DisplayStartDate.Year, _DisplayStartDate.Month)
- Dim iOffsetDays As Integer = CInt(System.Enum.ToObject(GetType(System.DayOfWeek), _DisplayStartDate.DayOfWeek))
- Dim iWeekCount As Integer = 0
- Dim weekRowCtrl As New WeekBox()
- MonthViewGrid.Children.Clear()
- Call AddRowsToMonthGrid(iDaysInMonth, iOffsetDays)
- MonthLabel.Content = Microsoft.VisualBasic.MonthName(_DisplayMonth)
- YearLabel.Content = _DisplayYear
- For i As Integer = 1 To iDaysInMonth
- If (i <> 1) AndAlso System.Math.IEEERemainder((i + iOffsetDays - 1), 7) = 0 Then
- '-- add existing weekrowcontrol to the monthgrid
- Grid.SetRow(weekRowCtrl, iWeekCount)
- MonthViewGrid.Children.Add(weekRowCtrl)
- '-- make a new weekrowcontrol
- weekRowCtrl = New WeekBox()
- iWeekCount += 1
- End If
- Dim dayBox As New DayBox()
- dayBox.DayNumberLabel.Content = i.ToString
- dayBox.Tag = i.ToString
- dayBox.Uid = i.ToString & _DisplayMonth.ToString & _DisplayYear.ToString
- dayBox.Add_Reservation.Tag = i.ToString
- dayBox.Add_Reservation.Uid = i.ToString & _DisplayMonth.ToString & _DisplayYear.ToString
- AddHandler dayBox.Add_Reservation.Click, AddressOf DayBox_Clicked
- If (New Date(_DisplayYear, _DisplayMonth, i)) = Date.Today Then
- dayBox.DayAppointmentsStack.Background = CType(dayBox.TryFindResource("AccentColorBrush3"), Brush)
- End If
- If _monthAppointments IsNot Nothing Then
- If (New Date(_DisplayYear, _DisplayMonth, i)) = Date.Today Then
- dayBox.DayAppointmentsStack.Background = CType(dayBox.TryFindResource("AccentColorBrush3"), Brush)
- End If
- Dim iday As Integer = i
- Dim aptInDay As List(Of Reservation) =
- _monthAppointments.FindAll(New System.Predicate(Of Reservation)(
- Function(apt As Reservation) CDate(apt.StartTime).Day = iday))
- For Each a As Reservation In aptInDay
- Dim apt As New EventBadge()
- apt.EventName.Text = a.Subject
- apt.Tag = a.ReservationID
- AddHandler apt.MouseDown, AddressOf ReservationClicked
- dayBox.DayAppointmentsStack.Children.Add(apt)
- Next
- End If
- Grid.SetColumn(dayBox, (i - (iWeekCount * 7)) + iOffsetDays)
- weekRowCtrl.WeekRowGrid.Children.Add(dayBox)
- Next
- Grid.SetRow(weekRowCtrl, iWeekCount)
- MonthViewGrid.Children.Add(weekRowCtrl)
- End Sub
- Private Sub AddRowsToMonthGrid(ByVal DaysInMonth As Integer, ByVal OffSetDays As Integer)
- MonthViewGrid.RowDefinitions.Clear()
- Dim rowHeight As New System.Windows.GridLength(60, System.Windows.GridUnitType.Star)
- Dim EndOffSetDays As Integer = 7 -
- (CInt(System.Enum.ToObject(GetType(System.DayOfWeek), _DisplayStartDate.AddDays(DaysInMonth - 1).DayOfWeek)) + 1)
- For i As Integer = 1 To CInt((DaysInMonth + OffSetDays + EndOffSetDays) / 7)
- Dim rowDef = New RowDefinition()
- rowDef.Height = rowHeight
- MonthViewGrid.RowDefinitions.Add(rowDef)
- Next
- End Sub
- Private Sub UpdateMonth(ByVal MonthsToAdd As Integer)
- Dim ev As New MonthChangedEventArgs()
- ev.OldDisplayStartDate = _DisplayStartDate
- Me.DisplayStartDate = _DisplayStartDate.AddMonths(MonthsToAdd)
- ev.NewDisplayStartDate = _DisplayStartDate
- RaiseEvent DisplayMonthChanged(ev)
- End Sub
- #Region " UI Event Handlers "
- Private Sub ReservationClicked(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
- If e.Source.GetType Is GetType(EventBadge) Then
- If CType(e.Source, EventBadge).Tag IsNot Nothing Then
- RaiseEvent ReservationClickedEvent(CInt(CType(e.Source, EventBadge).Tag))
- End If
- e.Handled = True
- End If
- End Sub
- Private Sub DayBox_Clicked(ByVal sender As Object, ByVal e As RoutedEventArgs)
- If e.Source.GetType Is GetType(Button) AndAlso
- Utilities.FindVisualAncestor(GetType(EventBadge), e.OriginalSource) Is Nothing Then
- Dim ev As New NewAppointmentEventArgs()
- If CType(e.Source, Button).Tag IsNot Nothing Then
- ev.StartDate = New Date(_DisplayYear, _DisplayMonth, CInt(CType(e.Source, Button).Tag), 10, 0, 0)
- ev.EndDate = CDate(ev.StartDate).AddHours(2)
- ev.TagID = CInt(CType(e.Source, Button).Uid)
- End If
- RaiseEvent DayBoxClicked(ev)
- e.Handled = True
- End If
- End Sub
- Private Sub MonthGoPrev_Click(sender As Object, e As RoutedEventArgs)
- UpdateMonth(-1)
- End Sub
- Private Sub MonthGoNext_Click(sender As Object, e As RoutedEventArgs)
- UpdateMonth(1)
- End Sub
- #End Region
- End Class
- Public Structure MonthChangedEventArgs
- Public OldDisplayStartDate As Date
- Public NewDisplayStartDate As Date
- End Structure
- Public Structure NewAppointmentEventArgs
- Public StartDate As Date?
- Public EndDate As Date?
- Public CandidateId As Integer?
- Public RequirementId As Integer?
- Public TagID As String
- Public EventName As String
- End Structure
- Class Utilities
- Public Shared Function FindVisualAncestor(
- ByVal ancestorType As System.Type,
- ByVal visual As Media.Visual) As FrameworkElement
- While (visual IsNot Nothing AndAlso Not ancestorType.IsInstanceOfType(visual))
- visual = DirectCast(Media.VisualTreeHelper.GetParent(visual), Media.Visual)
- End While
- Return CType(visual, FrameworkElement)
- End Function
- End ClassImports System.Data.SQLite
- Imports System.IO
- Imports System.Threading
- Imports MySql.Data.MySqlClient
- Public Class Settings
- Public Shared m_instance As Settings
- Private theme As New App.Settings.Theme
- Private est As New App.Settings.Establishment
- Private db As New App.Settings.Database
- Dim connector As New SQLConnector()
- Private Sub uc_onload() Handles Me.Loaded
- 'Extract Data Registry
- Dim en() As String = Split(est.Name, ",")
- Dim setconf() As String = Split(config.io.getDBShared(), ",")
- general_theme_color_cb(theme.Color, False)
- ts_theme.IsChecked = theme.Mode
- tb_en.Text = en(0)
- tb_ad.Text = en(1)
- tb_ec.Text = en(2)
- 'Login UI
- loginTitle(config.io.conf.GetValue("Misc Configuration", "loginTitle"))
- loginNotification(config.io.conf.GetValue("Misc Configuration", "loginNotify"))
- loginBackground(config.io.conf.GetValue("Misc Configuration", "loginBackground"), False)
- ts_advance_modes(If(config.io.conf.GetValue("Misc Configuration", "LocalAdvanceMode") = String.Empty, True, config.io.conf.GetValue("Misc Configuration", "LocalAdvanceMode")))
- 'Stablishment UI
- config.io.setStablishment(tb_en.Text, tb_ad.Text, tb_ec.Text)
- 'Database UI Connection
- If (config.io.getDBType() Like "personal") Then
- rb_personal.IsChecked = True
- rb_shared.IsChecked = False
- tb_p_db_location.Text = config.io.getDBLocation()
- Else
- rb_shared.IsChecked = True
- rb_personal.IsChecked = False
- tb_p_db_server.Text = setconf(0)
- tb_p_db_server_port.Text = setconf(1)
- tb_p_db_server_username.Text = setconf(2)
- tb_p_db_server_password.Password = setconf(3)
- End If
- 'Version UI
- v_app_version.Content = config.io.getVersion()
- MainWindow.Instance.v_app.Content = config.io.getVersion()
- MainWindow.Instance.tcc_settings.Content = settings_TabNames(settingsMainTab.SelectedIndex)
- setconf = Nothing
- en = Nothing
- updateAccounts()
- End Sub
- Public Shared ReadOnly Property Instance() As Settings
- Get
- Return m_instance
- End Get
- End Property
- Public Sub Config_onLoad() Handles Me.Loaded
- m_instance = Me
- End Sub
- 'General Theme
- Private Sub general_theme_mode_onchange(sender As Object, e As RoutedEventArgs)
- If (ts_theme.IsChecked) Then
- theme.Mode(True)
- MainWindow.Instance.FlyoutSnackBar("Dark Theme Applied", 3)
- Else
- theme.Mode(False)
- MainWindow.Instance.FlyoutSnackBar("Light Theme Applied", 3)
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub general_theme_color_cb(cb_color As String, bool As Boolean)
- If Not cb_blue.Tag.ToString = cb_color Then
- cb_blue.IsChecked = bool
- Else
- cb_blue.IsChecked = Not bool
- End If
- If Not cb_cyan.Tag.ToString = cb_color Then
- cb_cyan.IsChecked = bool
- Else
- cb_cyan.IsChecked = Not bool
- End If
- If Not cb_green.Tag.ToString = cb_color Then
- cb_green.IsChecked = bool
- Else
- cb_green.IsChecked = Not bool
- End If
- If Not cb_indigo.Tag.ToString = cb_color Then
- cb_indigo.IsChecked = bool
- Else
- cb_indigo.IsChecked = Not bool
- End If
- If Not cb_lightblue.Tag.ToString = cb_color Then
- cb_lightblue.IsChecked = bool
- Else
- cb_lightblue.IsChecked = Not bool
- End If
- If Not cb_pink.Tag.ToString = cb_color Then
- cb_pink.IsChecked = bool
- Else
- cb_pink.IsChecked = Not bool
- End If
- If Not cb_red.Tag.ToString = cb_color Then
- cb_red.IsChecked = bool
- Else
- cb_red.IsChecked = Not bool
- End If
- If Not cb_teal.Tag.ToString = cb_color Then
- cb_teal.IsChecked = bool
- Else
- cb_teal.IsChecked = Not bool
- End If
- MainWindow.Instance.FlyoutSnackBar("Color Theme Applied", 3)
- cb_color = Nothing
- bool = Nothing
- End Sub
- Private Sub general_theme_color_cb_handler(sender As Object, e As RoutedEventArgs)
- Dim cb As CheckBox = DirectCast(sender, CheckBox)
- Dim color As String = cb.Tag.ToString
- If cb.IsChecked Then
- general_theme_color_cb(color, False)
- Else
- color = "blue"
- End If
- theme.Color(color)
- cb = Nothing
- color = Nothing
- sender = Nothing
- e = Nothing
- End Sub
- 'General Theme End
- 'General Reservation Name
- Private Sub b_en_Click(sender As Object, e As RoutedEventArgs)
- config.io.setStablishment(tb_en.Text, tb_ad.Text, tb_ec.Text)
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- sender = Nothing
- e = Nothing
- End Sub
- 'General Reservation Name End
- 'Database
- Private Sub database_rb_personal_Checked(sender As Object, e As RoutedEventArgs)
- database_tc_status(1)
- tb_p_db_location.Text = config.io.getDBLocation()
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub database_rb_shared_Checked(sender As Object, e As RoutedEventArgs) Handles rb_shared.Checked
- database_tc_status(2)
- sender = Nothing
- e = Nothing
- End Sub
- Public Sub database_tc_status(index As Integer)
- If index = 1 Then
- rb_personal.IsChecked = True
- rb_shared.IsChecked = False
- MainWindow.Instance.db_type_status.Visibility = Visibility.Collapsed
- ElseIf index = 2
- rb_personal.IsChecked = False
- rb_shared.IsChecked = True
- rb_personal.IsEnabled = True
- b_db_connection_save.IsEnabled = True
- MainWindow.Instance.db_type_status.Visibility = Visibility.Visible
- ElseIf index = 3
- rb_personal.IsEnabled = False
- rb_personal.IsChecked = False
- rb_shared.IsChecked = True
- b_db_connection_save.IsEnabled = False
- ElseIf (index = 4) Then
- rb_personal.IsEnabled = False
- rb_shared.IsChecked = True
- b_db_connection_save.IsEnabled = False
- End If
- tc_db_connections.SelectedIndex = index
- index = Nothing
- End Sub
- Private Async Sub b_db_connection_save_Click(sender As Object, e As RoutedEventArgs)
- If rb_personal.IsChecked Then
- Try
- If database_rb_personal_verififcation() Then
- If (config.io.conf.GetValue("Misc Configuration", "sqli_status") = True) Then
- If Not (tb_p_db_location.Text = config.io.conf.GetValue("Database", "location")) Then
- config.io.setDBLocation(tb_p_db_location.Text)
- daemon.setter.connectSQLite()
- daemon.setter.exportAdminSQLi()
- End If
- Else
- daemon.setter.connectSQLite()
- daemon.setter.exportAdminSQLi()
- End If
- MainWindow.Instance.FlyoutSnackBar("Saved", 3)
- Else
- MainWindow.Instance.FlyoutSnackBar("Opps, Location is empty", 3)
- End If
- Catch ex As System.UnauthorizedAccessException
- MainWindow.Instance.FlyoutSnackBar("Try saving on other location", 3)
- MsgBox(ex.ToString)
- End Try
- ElseIf rb_shared.IsChecked
- Try
- If (Await SharedConnect()) Then
- config.io.setDBShared(tb_p_db_server.Text, tb_p_db_server_port.Text, tb_p_db_server_username.Text, tb_p_db_server_password.Password, config.io.conf.GetValue("Database", "dbname"))
- If config.io.conf.GetValue("Misc Configuration", "mysql_status") = True Then
- database_tc_status(4)
- daemon.setter.SettingsSQL = connector.ConnectDB(True)
- daemon.setter.connectivity.RunWorkerAsync()
- daemon.setter.database_c_update()
- MainWindow.Instance.FlyoutSnackBar("Saved", 3)
- Else
- daemon.setter.database_installation()
- End If
- Else
- database_tc_status(2)
- MainWindow.Instance.FlyoutSnackBar("Failed to Save ", 3)
- End If
- Catch ex As Exception
- database_tc_status(2)
- MainWindow.Instance.FlyoutSnackBar("Failed to Save ", 3)
- End Try
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Public Async Sub reconnect()
- Try
- If (Await SharedConnect()) Then
- database_tc_status(4)
- daemon.setter.SettingsSQL = connector.ConnectDB(True)
- daemon.setter.connectivity.RunWorkerAsync()
- daemon.setter.database_c_update()
- MainWindow.Instance.FlyoutSnackBar("Connected", 3)
- Else
- database_tc_status(2)
- MainWindow.Instance.FlyoutSnackBar("Try Again", 3)
- End If
- Catch ex As Exception
- database_tc_status(2)
- MainWindow.Instance.FlyoutSnackBar("Try Again", 3)
- ex = Nothing
- End Try
- End Sub
- 'Database Personal
- Private Sub database_b_browse_Click(sender As Object, e As RoutedEventArgs)
- Dim location As New System.Windows.Forms.FolderBrowserDialog()
- Dim result As System.Windows.Forms.DialogResult = location.ShowDialog()
- If result Then
- tb_p_db_location.Text = location.SelectedPath
- End If
- location = Nothing
- result = Nothing
- sender = Nothing
- e = Nothing
- End Sub
- Private Function database_rb_personal_verififcation()
- If Not (tb_p_db_location.Text Like "") Then
- Return My.Computer.FileSystem.DirectoryExists(tb_p_db_location.Text)
- Else
- Return False
- End If
- End Function
- 'Database Personal End
- 'Database Shared
- Public Async Function SharedConnect() As Task(Of Boolean)
- database_tc_status(3)
- Return Await connector.ConnectTry(tb_p_db_server.Text, tb_p_db_server_port.Text, tb_p_db_server_username.Text, tb_p_db_server_password.Password)
- End Function
- Private Sub settingsMainTab_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
- If Me.IsLoaded Then
- MainWindow.Instance.tcc_settings.Content = settings_TabNames(settingsMainTab.SelectedIndex)
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Public Function settings_TabNames(index As Integer) As String
- If (index = 0) Then
- Return ti_general.Header
- ElseIf (index = 1)
- Return ti_account.Header
- ElseIf (index = 2)
- Return ti_database.Header
- ElseIf (index = 3)
- Return ti_about.Header
- Else
- Return ti_general.Header
- End If
- index = Nothing
- End Function
- 'Database Shared End
- Private Sub b_account_edit_Click(sender As Object, e As RoutedEventArgs)
- If (config.io.getDBType() = "personal") Then
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("SELECT staff_name.first_name, staff_name.last_name, staff_name.mid_name, contact.email_add, contact.mobile, credentials.password FROM ((staff_name INNER JOIN contact ON staff_name.name_staff_id = contact.contact_id) INNER JOIN credentials ON staff_name.name_staff_id = credentials.cred_id) WHERE staff_name.name_staff_id =" & config.io.getSession("id") & " ", sqli)
- Dim sqliREader As SQLiteDataReader = cmd.ExecuteReader()
- If (sqliREader.Read()) Then
- AccountEdit(sqliREader("first_name").ToString, sqliREader("mid_name").ToString, sqliREader("last_name").ToString, sqliREader("mobile").ToString)
- End If
- cmd.Dispose()
- cmd = Nothing
- sqliREader.Close()
- sqliREader = Nothing
- Catch ex As SQLiteException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sql As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("SELECT staff_name.first_name, staff_name.last_name, staff_name.mid_name, contact.email_add, contact.mobile, credentials.password FROM ((staff_name INNER JOIN contact ON staff_name.name_staff_id = contact.contact_id) INNER JOIN credentials ON staff_name.name_staff_id = credentials.cred_id) WHERE staff_name.name_staff_id = " & config.io.getSession("id") & " ", sql)
- Dim sqlReader As MySqlDataReader = cmd.ExecuteReader()
- If (sqlReader.Read()) Then
- AccountEdit(sqlReader("first_name").ToString, sqlReader("mid_name").ToString, sqlReader("last_name").ToString, sqlReader("mobile").ToString)
- End If
- cmd.Dispose()
- cmd = Nothing
- sqlReader.Close()
- sqlReader.Dispose()
- sqlReader = Nothing
- Catch ex As MySqlException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sql.Close()
- sql.Dispose()
- sql = Nothing
- End Try
- End If
- tc_account_manage.SelectedIndex = 1
- Finalize()
- End Sub
- Private Sub b_am_p_apply_Click(sender As Object, e As RoutedEventArgs)
- If Not (tb_am_old_pass.Password = String.Empty Or tb_am_new_pass.Password = String.Empty) Then
- If (config.io.getDBType = "personal") Then
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("Select password From credentials where cred_id =" & config.io.getSession("id"), sqli)
- Dim sqliReader As SQLiteDataReader = cmd.ExecuteReader()
- If (sqliReader.Read) Then
- If (config.io.hash.EncryptData(tb_am_old_pass.Password) = sqliReader("password").ToString) Then
- If (tb_am_old_pass.Password = String.Empty) Then
- MainWindow.Instance.FlyoutSnackBar("New Password must be empty", 3)
- ElseIf tb_am_old_pass.Password.Length < 8
- MainWindow.Instance.FlyoutSnackBar("New Password must atleast 8 characters", 3)
- Else
- sqliReader.Close()
- cmd.CommandText = "Update credentials set password='" & config.io.hash.EncryptData(tb_am_new_pass.Password) & "' where cred_id=" & config.io.getSession("id")
- cmd.Connection = sqli
- cmd.ExecuteNonQuery()
- accountUIUpdate()
- tc_account_manage.SelectedIndex = 0
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- End If
- Else
- MainWindow.Instance.FlyoutSnackBar("Wrong Password, Try Again", 3)
- End If
- End If
- cmd.Dispose()
- cmd = Nothing
- sqliReader.Close()
- sqliReader = Nothing
- Catch ex As SQLiteException
- MsgBox(ex.ToString)
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again ", 3)
- ex = Nothing
- Catch ex As Exception
- MsgBox(ex.ToString)
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sql As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("select password from credentials where cred_id =" & config.io.getSession("id"), sql)
- Dim sqlReader As MySqlDataReader = cmd.ExecuteReader()
- If (sqlReader.Read) Then
- If (config.io.hash.EncryptData(tb_am_old_pass.Password) = sqlReader("password").ToString) Then
- If (tb_am_old_pass.Password = String.Empty) Then
- MainWindow.Instance.FlyoutSnackBar("New Password must be empty", 3)
- ElseIf tb_am_old_pass.Password.Length < 8
- MainWindow.Instance.FlyoutSnackBar("New Password must atleast 8 characters", 3)
- Else
- sqlReader.Close()
- cmd.CommandText = "Update credentials set password='" & config.io.hash.EncryptData(tb_am_new_pass.Password) & "' where cred_id=" & config.io.getSession("id")
- cmd.Connection = sql
- cmd.ExecuteNonQuery()
- accountUIUpdate()
- tc_account_manage.SelectedIndex = 0
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- End If
- Else
- MainWindow.Instance.FlyoutSnackBar("Wrong Password, Try Again", 3)
- End If
- End If
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- cmd.Dispose()
- cmd = Nothing
- sqlReader.Close()
- sqlReader.Dispose()
- sqlReader = Nothing
- Catch ex As MySqlException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again ", 3)
- ex = Nothing
- Catch ex As Exception
- MsgBox(ex.ToString)
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again", 3)
- ex = Nothing
- Finally
- sql.Close()
- sql.Dispose()
- sql = Nothing
- End Try
- End If
- Else
- MainWindow.Instance.FlyoutSnackBar("Password Fields Required", 3)
- End If
- Finalize()
- End Sub
- Private Sub loadAccounts()
- End Sub
- Private Sub b_cw_apply_Click(sender As Object, e As RoutedEventArgs)
- If (config.io.getDBType = "personal") Then
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("UPDATE staff_name
- SET first_name = '" & config.io.filter(tb_cw_fname.Text) & "',
- last_name = '" & config.io.filter(tb_cw_lname.Text) & "',
- mid_name = '" & config.io.filter(tb_cw_sname.Text) & "'
- WHERE name_staff_id = " & config.io.getSession("id") & ";
- UPDATE contact
- SET mobile = '" & If(tb_cw_pnumber.Text = String.Empty, String.Empty, config.io.filterNum(tb_cw_pnumber.Text)) & "'
- WHERE contact_id = " & config.io.getSession("id") & ";
- ", sqli)
- cmd.ExecuteNonQuery()
- tc_account_manage.SelectedIndex = 0
- accountUIUpdate()
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- cmd.Dispose()
- cmd = Nothing
- Catch ex As SQLiteException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sqli As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("UPDATE staff_name
- SET first_name = '" & config.io.filter(tb_cw_fname.Text) & "',
- last_name = '" & config.io.filter(tb_cw_lname.Text) & "',
- mid_name = '" & config.io.filter(tb_cw_sname.Text) & "'
- WHERE name_staff_id = " & config.io.getSession("id") & ";
- UPDATE contact
- SET mobile = '" & If(tb_cw_pnumber.Text = String.Empty, String.Empty, config.io.filterNum(tb_cw_pnumber.Text)) & "'
- WHERE contact_id = " & config.io.getSession("id") & ";
- ", sqli)
- cmd.ExecuteNonQuery()
- tc_account_manage.SelectedIndex = 0
- accountUIUpdate()
- MainWindow.Instance.FlyoutSnackBar("Applied", 3)
- cmd.Dispose()
- cmd = Nothing
- Catch ex As MySqlException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try Again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- Finalize()
- End Sub
- Private Sub b_cw_cancel_Click(sender As Object, e As RoutedEventArgs)
- tc_account_manage.SelectedIndex = 0
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub AccountEdit(fname As String, mname As String, lname As String, pnumber As String)
- tb_cw_fname.Text = fname
- tb_cw_sname.Text = mname
- tb_cw_lname.Text = lname
- tb_cw_pnumber.Text = pnumber
- fname = Nothing
- mname = Nothing
- lname = Nothing
- pnumber = Nothing
- End Sub
- Public Sub accountUIUpdate()
- If (config.io.getDBType() = "personal") Then
- Dim sqli As SQLiteConnection = connector.ConnectDBSQLI()
- Try
- Dim cmd As New SQLiteCommand("SELECT staff.staff_id, staff.photo, staff_name.first_name, staff_name.mid_name, staff_name.last_name, contact.email_add, contact.mobile, credentials.username, credentials.privilege FROM (((staff INNER JOIN contact ON staff.staff_id = contact.contact_id) INNER JOIN credentials ON staff.staff_id = credentials.cred_id) INNER JOIN staff_name ON staff.staff_id = staff_name.name_staff_id) WHERE staff.staff_id = " & config.io.getSession("id") & " ", sqli)
- Dim sqliREader As SQLiteDataReader = cmd.ExecuteReader()
- If (sqliREader.Read()) Then
- config.io.Session(True)
- config.io.setSession(CInt(sqliREader("staff_id")), sqliREader("username").ToString, sqliREader("first_name").ToString & " " & sqliREader("mid_name").ToString & " " & sqliREader("last_name").ToString, sqliREader("email_add").ToString, sqliREader("mobile").ToString, CInt(sqliREader("privilege")), sqliREader("photo").ToString)
- config.io.deployAccount()
- End If
- cmd.Dispose()
- cmd = Nothing
- sqliREader.Close()
- sqliREader = Nothing
- Catch ex As SQLiteException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sql As MySqlConnection = connector.ConnectDB(True)
- Try
- Dim cmd As New MySqlCommand("SELECT staff.staff_id,staff.photo, staff_name.first_name, staff_name.mid_name, staff_name.last_name, contact.email_add, contact.mobile, credentials.username, credentials.privilege FROM (((staff INNER JOIN contact ON staff.staff_id = contact.contact_id) INNER JOIN credentials ON staff.staff_id = credentials.cred_id) INNER JOIN staff_name ON staff.staff_id = staff_name.name_staff_id) WHERE staff.staff_id = " & config.io.getSession("id") & " ", sql)
- Dim sqlReader As MySqlDataReader = cmd.ExecuteReader()
- If (sqlReader.Read()) Then
- config.io.Session(True)
- config.io.setSession(CInt(sqlReader("staff_id")), sqlReader("username").ToString, sqlReader("first_name").ToString & " " & sqlReader("mid_name").ToString & " " & sqlReader("last_name").ToString, sqlReader("email_add").ToString, sqlReader("mobile").ToString, CInt(sqlReader("privilege")), sqlReader("photo"))
- config.io.deployAccount()
- End If
- cmd.Dispose()
- cmd = Nothing
- sqlReader.Close()
- sqlReader.Dispose()
- sqlReader = Nothing
- Catch ex As MySqlException
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. ", 3)
- ex = Nothing
- Finally
- sql.Close()
- sql.Dispose()
- sql = Nothing
- End Try
- End If
- Finalize()
- End Sub
- Private Sub ts_login_background(sender As Object, e As RoutedEventArgs)
- If (ts_l_background.IsChecked) Then
- g_i_panel.Visibility = Visibility.Collapsed
- Else
- g_i_panel.Visibility = Visibility.Visible
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub ts_l_notify(sender As Object, e As RoutedEventArgs)
- If (ts_l_notification.IsChecked) Then
- 'Todo for notification
- Else
- 'Todo for notification
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub ts_l_login(sender As Object, e As RoutedEventArgs)
- If (ts_l_name.IsChecked) Then
- loginTitle(True)
- Else
- loginTitle(False)
- End If
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub ts_advance_(sender As Object, e As RoutedEventArgs)
- ts_advance_modes(ts_advance_mode.IsChecked)
- sender = Nothing
- e = Nothing
- End Sub
- Public Sub ts_advance_modes(b As Boolean)
- If (b) Then
- gb_dconn.ToolTip = "Go to General > Advance > Turn OFF Advance Mode"
- Else
- gb_dconn.ToolTip = Nothing
- End If
- ts_advance_mode.IsChecked = b
- db_conn.IsEnabled = Not (b)
- config.io.conf.SetValue("Misc Configuration", "LocalAdvanceMode", b)
- b = Nothing
- End Sub
- Private Sub loginTitle(b As Boolean)
- If (b) Then
- ts_l_name.IsChecked = True
- MainWindow.Instance.l_sys_name.Visibility = Visibility.Visible
- Else
- ts_l_name.IsChecked = False
- MainWindow.Instance.l_sys_name.Visibility = Visibility.Collapsed
- End If
- config.io.conf.SetValue("Misc Configuration", "loginTitle", b)
- b = Nothing
- End Sub
- Private Sub loginNotification(b As Boolean)
- If (b) Then
- 'Toggle Notification
- Else
- 'Toggle Notification
- End If
- config.io.conf.SetValue("Misc Configuration", "loginNotify", b)
- b = Nothing
- End Sub
- Public Sub loginBackground(src As String, bool As Boolean)
- If Not (src = String.Empty) Then
- Dim b As BitmapImage = New BitmapImage()
- b.BeginInit()
- b.UriSource = New Uri(src, UriKind.RelativeOrAbsolute)
- b.EndInit()
- b.Freeze()
- Dim i As Image = New Image()
- Dim ib As ImageBrush = New ImageBrush()
- i.Stretch = Stretch.Fill
- i.Source = b
- i_image.Source = b
- ib.ImageSource = b
- Home.Instance.g_home.Background = ib
- setLoginB(ib)
- config.io.conf.SetValue("Misc Configuration", "loginBackground", src)
- i.Source = Nothing
- If bool Then
- ib.ImageSource = Nothing
- End If
- Dim t As New Thread(New ThreadStart(Sub()
- Thread.Sleep(500)
- GC.Collect()
- End Sub))
- t.Start()
- b = Nothing
- i = Nothing
- ib = Nothing
- src = Nothing
- UpdateLayout()
- End If
- src = Nothing
- UpdateLayout()
- End Sub
- Private Sub setLoginB(ib As ImageBrush)
- MainWindow.Instance.lockscreen.Background = ib
- End Sub
- Private Sub b_image_browse_Click(sender As Object, e As RoutedEventArgs)
- Dim sf As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
- sf.Filter = "Image files (*.jpg)|*.jpg"
- Dim result As System.Windows.Forms.DialogResult = sf.ShowDialog()
- If result Then
- loginBackground(sf.FileName, True)
- End If
- sender = Nothing
- e = Nothing
- sf.Dispose()
- sf = Nothing
- result = Nothing
- Finalize()
- End Sub
- Private Sub b_cw_add_photo_Click(sender As Object, e As RoutedEventArgs)
- Dim sf As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
- sf.Filter = "Image files (*.jpg)|*.jpg"
- Dim result As System.Windows.Forms.DialogResult = sf.ShowDialog()
- If result Then
- If Not (sf.FileName = String.Empty) Then
- Dim b As BitmapImage = New BitmapImage()
- Dim i As Image = New Image()
- Dim ib As ImageBrush = New ImageBrush()
- b.BeginInit()
- b.UriSource = New Uri(sf.FileName, UriKind.RelativeOrAbsolute)
- b.EndInit()
- b.Freeze()
- i.Stretch = Stretch.Fill
- i.Source = b
- i_image.Source = b
- ib.ImageSource = b
- image_profile_account.Source = b
- i.Source = Nothing
- i_image.Source = Nothing
- Dim t As New Thread(New ThreadStart(Sub()
- Thread.Sleep(500)
- GC.Collect()
- End Sub))
- t.Start()
- t = Nothing
- End If
- End If
- End Sub
- Private Sub b_account_ChangePassword_Click(sender As Object, e As RoutedEventArgs)
- tc_account_manage.SelectedIndex = 2
- sender = Nothing
- e = Nothing
- End Sub
- Private Sub b_Add_Accounts_Click(sender As Object, e As RoutedEventArgs)
- Add_Account.IsOpen = True
- End Sub
- Private Sub b_new_add_Click(sender As Object, e As RoutedEventArgs)
- If Not (String.IsNullOrEmpty(tb_idNum.Text) Or String.IsNullOrEmpty(tb_new_username.Text) Or String.IsNullOrEmpty(tb_password.Password) Or String.IsNullOrEmpty(tb_email.Text)) Then
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Try
- Dim sql As New MySqlConnection()
- sql = Connector.ConnectDB(True)
- Dim export As New MySqlCommand("INSERT INTO staff_name (name_staff_id) VALUES (" & tb_idNum.Text & ");
- INSERT INTO contact(contact_id, email_add) VALUES (" & tb_idNum.Text & ", '" & tb_email.Text & "');
- INSERT INTO credentials(cred_id, username, password, privilege) VALUES (" & tb_idNum.Text & ", '" & tb_new_username.Text & "', '" & config.io.hash.EncryptData(tb_password.Password) & "');
- INSERT INTO staff(staff_id, name_id, cred_id,contact_id) VALUES (" & tb_idNum.Text & "," & tb_idNum.Text & "," & tb_idNum.Text & "," & tb_idNum.Text & ")", sql)
- export.ExecuteNonQuery()
- sql.Close()
- updateAccounts()
- NewClear()
- Add_Account.IsOpen = False
- MainWindow.Instance.FlyoutSnackBar("Account Added", 3)
- Catch ex As MySqlException
- MainWindow.Instance.FlyoutSnackBar("Connection Error", 3)
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Something went wrong", 3)
- End Try
- Else
- Try
- Dim sql As New SQLiteConnection()
- sql = Connector.ConnectDBSQLI()
- Dim export As New SQLiteCommand("INSERT INTO staff_name (name_staff_id) VALUES (" & tb_idNum.Text & ");
- INSERT INTO contact(contact_id, email_add) VALUES (" & tb_idNum.Text & ", '" & tb_email.Text & "');
- INSERT INTO credentials(cred_id, username, password, privilege) VALUES (" & tb_idNum.Text & ", '" & tb_new_username.Text & "', '" & config.io.hash.EncryptData(tb_password.Password) & "', " & 1 & ");
- INSERT INTO staff(staff_id, name_id, cred_id,contact_id) VALUES (" & tb_idNum.Text & "," & tb_idNum.Text & "," & tb_idNum.Text & "," & tb_idNum.Text & ")", sql)
- export.ExecuteNonQuery()
- sql.Close()
- updateAccounts()
- NewClear()
- Add_Account.IsOpen = False
- MainWindow.Instance.FlyoutSnackBar("Account Added", 3)
- Catch ex As SQLiteException
- MainWindow.Instance.FlyoutSnackBar("Connection Error", 3)
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Something went wrong", 3)
- End Try
- End If
- Else
- MainWindow.Instance.FlyoutSnackBar("Fill all fields", 3)
- End If
- End Sub
- Private Sub b_new_cancel_Click(sender As Object, e As RoutedEventArgs)
- Add_Account.IsOpen = False
- NewClear()
- End Sub
- Private Sub b_new_reset_Click(sender As Object, e As RoutedEventArgs)
- NewClear()
- End Sub
- Private Sub NewClear()
- tb_new_username.Clear()
- tb_password.Clear()
- tb_idNum.Clear()
- tb_email.Clear()
- End Sub
- Private Sub updateAccounts()
- gb_other_accounts.Children.Clear()
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Dim sqli As MySqlConnection = Connector.ConnectDB(True)
- Try
- Dim cmd1 As New MySqlCommand("select cred_id, username, privilege from credentials", sqli)
- Dim id As MySqlDataReader = cmd1.ExecuteReader()
- While id.Read()
- Dim acc As New accounts()
- acc.l_LocalAccount.Content = id("username").ToString
- acc.Tag = id("cred_id").ToString
- If id("privilege").ToString Like "0" Then
- acc.b_remove.IsEnabled = False
- End If
- acc.b_remove.Tag = acc.Tag
- gb_other_accounts.Children.Add(acc)
- AddHandler acc.b_remove.Click, AddressOf b_remove_acc
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Try
- Dim cmd1 As New SQLiteCommand("select cred_id, username, privilege from credentials", sqli)
- Dim id As SQLiteDataReader = cmd1.ExecuteReader()
- While id.Read()
- Dim acc As New accounts()
- acc.l_LocalAccount.Content = id("username").ToString
- acc.Tag = id("cred_id").ToString
- If id("privilege").ToString Like "0" Then
- acc.b_remove.IsEnabled = False
- End If
- acc.b_remove.Tag = acc.Tag
- gb_other_accounts.Children.Add(acc)
- AddHandler acc.b_remove.Click, AddressOf b_remove_acc
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- End Sub
- Private Sub b_remove_acc(sender As Object, e As RoutedEventArgs)
- Dim b As String = DirectCast(sender, Button).Tag
- gb_other_accounts.Children.Clear()
- Dim Connector As New SQLConnector
- If (config.io.conf.GetValue("Database", "Type") Like "shared") Then
- Dim sqli As MySqlConnection = Connector.ConnectDB(True)
- Try
- Dim cmd1 As New MySqlCommand("select cred_id, username, privilege from credentials", sqli)
- Dim id As MySqlDataReader = cmd1.ExecuteReader()
- While id.Read()
- Dim acc As New accounts()
- acc.l_LocalAccount.Content = id("username").ToString
- acc.Tag = id("cred_id").ToString
- If id("privilege").ToString Like "0" Then
- acc.b_remove.IsEnabled = False
- End If
- acc.b_remove.Tag = acc.Tag
- gb_other_accounts.Children.Add(acc)
- AddHandler acc.b_remove.Click, AddressOf b_remove_acc
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- Else
- Dim sqli As SQLiteConnection = Connector.ConnectDBSQLI()
- Try
- Dim cmd1 As New SQLiteCommand("select cred_id, username, privilege from credentials", sqli)
- Dim id As SQLiteDataReader = cmd1.ExecuteReader()
- While id.Read()
- Dim acc As New accounts()
- acc.l_LocalAccount.Content = id("username").ToString
- acc.Tag = id("cred_id").ToString
- If id("privilege").ToString Like "0" Then
- acc.b_remove.IsEnabled = False
- End If
- acc.b_remove.Tag = acc.Tag
- gb_other_accounts.Children.Add(acc)
- AddHandler acc.b_remove.Click, AddressOf b_remove_acc
- End While
- id.Close()
- cmd1 = Nothing
- Catch ex As Exception
- MainWindow.Instance.FlyoutSnackBar("Opps, Something went wrong. Try again", 3)
- ex = Nothing
- Finally
- sqli.Close()
- sqli.Dispose()
- sqli = Nothing
- End Try
- End If
- End Sub
- End Class
- Public Class WeekBox
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement