Documentation Question


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I have (more or less) followed your example for doing a login thus:

Private Shared Sub ShowLoginAndInitMainForm(ByVal e As ShowLoginAndInitFormEventArgs)

'-- ToDo: add any code to show a login form and authenticate the user

' e.LoginSuccessful = ?

'-- Establish locals

Dim llAuthenticated As Boolean = False

Dim loLoginForm As New LoginForm()

Dim loUsers As New UsersBO()



'-- Show the login form

If loLoginForm.ShowDialog = Windows.Forms.DialogResult.OK Then

'-- Check to see if the user entered the correct username and password

'-- Get the user from the database

loUsers.FillByUserName(loLoginForm.UserName)



'-- Check the password

If (loUsers.Count > 0) AndAlso _

(loUsers.user_password.Equals(loLoginForm.Password)) Then



'-- The user authenticated

llAuthenticated = True

End If



Having done that I want to set some properties of my main form (or pass the bo to the main form). I have no idea what the mainform is called or how to reference it.



Going the other way, your example below (presumably in a form or a bo) makes reference to a Users object but it does not make it clear where that object comes from or how it becomes a property of Me (this). At this rate I may get something useful built in a year. Guess I'm just dense.



Private Sub Customers_CheckSecurity( _

      ByVal e As MicroFour.StrataFrame.Business.CheckSecurityEventArgs) _

      Handles Customers.CheckSecurity

      

'-- Check the requested action

Select Case e.ActionRequested

Case SecurityAction.AddRecord

'-- See if the user can perform the requested action

If Me.Users.user_authlevel >= 3 Then

e.Allowed = True

Else

e.Allowed = False

End If



Case SecurityAction.DeleteRecord

'-- See if the user can perform the requested action

If Me.Users.user_authlevel >= 4 Then

e.Allowed = True

Else

e.Allowed = False

End If



Case SecurityAction.EditRecord

'-- See if the user can perform the requested action

If Me.Users.user_authlevel >= 3 Then

e.Allowed = True

Else

e.Allowed = False

End If



End Select

End Sub

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The Users business object is just some pseudo business object that was used in the sample.  It doesn't exist in the framework. 

The main form that will be displayed is the form that is set within the InitApplication() method where the call to "e.Forms.Add(GetType(MainFormType))" is made.  The "MainFormType" is the System.Type of the main form that will be shown. 

Within the ShowLoginAndInitMainForm() method, you won't have a reference to the main for, yet, but you can pass parameters to the main form's constructor through the event args of the method like this:

e.FormInitArgs.Add(Parameter1)
e.FormInitArgs.Add(Parameter2)

Where Parameter1 and Parameter2 are passed to the main form's constructor like this:

public MyMainForm(string Parameter1, int Parameter2)
{
     // save off the parameters into private fields
}

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
oh



Thanks
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search