Best place (event) to put BO data access code to fill 3rd party control?


Author
Message
William Fields
William Fields
StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Hello,

Working on my first SF Maintenance Form and have a couple BO's that are retrieving data just fine.

Now, I need to take the data contained within the BO's and load it into a 3rd party calendar control. Basically, I have to cycle through the data tables and create an object the calendar control can use for each data row. I'd love to be able to bind the calendar control directly to the BO's, but I'm not sure that's possible. All the sample code from the calendar vendor shows methods that take data and push it into collections of "appointment" objects, which the control then uses for it's data.

Also, since this is my first sample SF app, I'm trying to take the path of least resistance. So I'm just going with the vendor's examples for now.

BTW - the calendar control is the dbiMonth control from DBI Technologies. http://www.dbi-tech.com/

So, my question is, "What event should I use to load the data into the calendar control?"

I'm still a .NET WinForms newbie, but in VFP I would do this in the INIT event of the form since all the form controls would be available, but the form would not be visible yet. I have a working example of loading the data into the calendar control in the click of a button on the form, but I woud like to load the data before the form becomes visible.

Suggestions?

Thanks.

Bill
Replies
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi William,

I had a similar job to do for one of our customers. It was not a third party calendar, but the .net native System.Windows.MonthCalendar, on which we needed to show working days and the days worked, for each plant, on a set of 4 months at a time.

Of course, working days and days worked are retrieved in a BO, and there is no databinding enabled for this control...

The ParentFormLoading Event is the right place to code, the controls are already created (this event is more similar to the init VFP event, than to the load VFP event).

here is some code:

   Private Sub BO_JoursTravailSites_ParentFormLoading() Handles BO_JoursTravailSites.ParentFormLoading

Dim andeb As Integer = Today.Year - 5
Dim anfin As Integer = Today.Year + 10
Me.BO_JoursTravailSites.FillJoursTravail(andeb, anfin, "")
' définir la plage du calendrier sur les dates maxi et mini du BO
' let's define the calendar's range from the min and max dates in the BO
Me.MonthCalendar.MinDate = DateValue("01/01/" & andeb.ToString)
Me.MonthCalendar.MaxDate = DateValue("31/12/" & anfin.ToString)
' sur cette plage, mettre en gras les week-ends et jours fériés
' on this range, display in BOLD weekends and holidays


With Me.BO_JoursTravailSites

If .MoveFirst() Then

Do

If .WeekEnd = True _
Or .JourFerie = True Then

Me.MonthCalendar.AddBoldedDate(.DateJour)

End If

Loop While .MoveNext()

End If

End With

End Sub



When a date is selected on the calendar, I run some code to add a check in a list.



Private Sub MonthCalendar_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) _
       
Handles MonthCalendar.DateSelected

Me.ActualiseListeSites(e.Start)

End Sub



the ActualiseListeSites is pretty identic as the code above. I put a filter on the BO based on the value received in the parameter, and then I process a scan/endscan in a loop.
William Fields
William Fields
StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Hi Michel,

I'm sure there's a number of ways to go about this, but in general, would a call to MyBase.OnLoad(e) in the form load cause the StrataFram ParentFormLoading event to fire?

I guess I'm curious how the "custom" SF events fit into the normal .NET event sequence.

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