Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Order of processing for multi-select (Read 8655 times)
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Order of processing for multi-select
Sep 16th, 2011 at 2:34am
Print Post  
I can not figure out the order items are processed when I select multiple items and drag them from one date to another date. I hoped it would maintain the same order as the items had on the original date, but that is not the case. Can you please explain how that is controlled or how I can control it?

TIA
John
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #1 - Sep 16th, 2011 at 6:20am
Print Post  
I'm trying to reproduce this but items always seem to preserve their initial ordering after dragging. In which view are you experiencing this?

Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #2 - Sep 16th, 2011 at 1:56pm
Print Post  
I am using Timetable view. I Ctrl + Click to select multiple items and when I drag from one date to the next, they do not maintain the same order as on the original date. Below are my calendar settings:

'calendar
'
Me.calendar.AllowInplaceCreate = False
Me.calendar.AllowInplaceEdit = False
Me.calendar.Anchor = System.Windows.Forms.AnchorStyles.None
Me.calendar.CurrentTime = New Date(2008, 10, 29, 14, 24, 6, 747)
Me.calendar.CurrentView = MindFusion.Scheduling.WinForms.CalendarView.Timetable
Me.calendar.Date = New Date(2005, 12, 27, 0, 0, 0, 0)
Me.calendar.DateTimeFormat = CType(resources.GetObject("calendar.DateTimeFormat"), System.Globalization.DateTimeFormatInfo)
Me.calendar.EndDate = New Date(2006, 1, 26, 0, 0, 0, 0)
Me.calendar.ItemSettings.HeaderSize = 20
Me.calendar.ItemSettings.MoveBandSize = 1
Me.calendar.ItemSettings.Padding = 1
Me.calendar.ItemSettings.PointedItemStyle = CType(resources.GetObject("calendar.ItemSettings.PointedItemStyle"), MindFusion.Scheduling.Style)
Me.calendar.ItemSettings.ResizeBandSize = 1
Me.calendar.ItemSettings.SelectedItemStyle = CType(resources.GetObject("calendar.ItemSettings.SelectedItemStyle"), MindFusion.Scheduling.Style)
Me.calendar.ItemSettings.Style = CType(resources.GetObject("calendar.ItemSettings.Style"), MindFusion.Scheduling.Style)
Me.calendar.ItemTooltipFormat = "Double Click To See Details" & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(10) & "%d"
Me.calendar.Location = New System.Drawing.Point(276, 96)
Me.calendar.Name = "calendar"
Me.calendar.Selection.AllowMultiple = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.Selection.Enabled = MindFusion.Scheduling.WinForms.State.Disabled
Me.calendar.Selection.SelectedElementsStyle = CType(resources.GetObject("calendar.Selection.SelectedElementsStyle"), MindFusion.Scheduling.Style)
Me.calendar.Selection.Style = MindFusion.Scheduling.WinForms.SelectionStyle.None
Me.calendar.ShowToolTips = True
Me.calendar.Size = New System.Drawing.Size(698, 467)
Me.calendar.TabIndex = 10
Me.calendar.TimetableSettings.CellStyle = CType(resources.GetObject("calendar.TimetableSettings.CellStyle"), MindFusion.Scheduling.Style)
Me.calendar.TimetableSettings.CellTime = System.TimeSpan.Parse("00:30:00")
Me.calendar.TimetableSettings.ColumnBandSize = 2
Me.calendar.TimetableSettings.DayHeaderBrush = New MindFusion.Drawing.SolidBrush("#FFFFFFFF")
Me.calendar.TimetableSettings.DayHeaderMinSize = 5
Me.calendar.TimetableSettings.EnableCollisions = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.EnableDayItems = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.EnableSnapping = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.EndTime = 1620
Me.calendar.TimetableSettings.HeaderDateFormat = "ddd - MM/dd"
Me.calendar.TimetableSettings.HeaderShadowColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer))
Me.calendar.TimetableSettings.HeaderShadowOffset = 3
Me.calendar.TimetableSettings.InfoHeaderSize = 20
Me.calendar.TimetableSettings.MainHeaderSize = 24
Me.calendar.TimetableSettings.MinItemSize = 15
Me.calendar.TimetableSettings.NowColor = System.Drawing.Color.Red
Me.calendar.TimetableSettings.NowFillColor = System.Drawing.Color.Red
Me.calendar.TimetableSettings.Orientation = MindFusion.Scheduling.WinForms.Orientation.Vertical
Me.calendar.TimetableSettings.SelectWholeDayOnHeaderClick = MindFusion.Scheduling.WinForms.State.Disabled
Me.calendar.TimetableSettings.ShowCurrentTime = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.ShowDayHeader = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.ShowInfoHeader = MindFusion.Scheduling.WinForms.State.Disabled
Me.calendar.TimetableSettings.ShowNavigationButtons = MindFusion.Scheduling.WinForms.State.Disabled
Me.calendar.TimetableSettings.ShowPadding = MindFusion.Scheduling.WinForms.State.Disabled
Me.calendar.TimetableSettings.SnapInterval = System.TimeSpan.Parse("00:01:00")
Me.calendar.TimetableSettings.StartTime = 0
Me.calendar.TimetableSettings.Style = CType(resources.GetObject("calendar.TimetableSettings.Style"), MindFusion.Scheduling.Style)
Me.calendar.TimetableSettings.SubHeaderSize = 0
Me.calendar.TimetableSettings.TimelineSize = 60
Me.calendar.TimetableSettings.TimelineStyle = CType(resources.GetObject("calendar.TimetableSettings.TimelineStyle"), MindFusion.Scheduling.Style)
Me.calendar.TimetableSettings.TwelveHourFormat = MindFusion.Scheduling.WinForms.State.Enabled
Me.calendar.TimetableSettings.VisibleColumns = 1
Me.calendar.TimetableSettings.WorkTimeCellStyle = CType(resources.GetObject("calendar.TimetableSettings.WorkTimeCellStyle"), MindFusion.Scheduling.Style)
Me.calendar.TimetableSettings.WorkTimeEndHour = 24
Me.calendar.TimetableSettings.WorkTimeStartHour = 0
Me.calendar.TimetableSettings.ZoomFactor = 100
Me.calendar.WeekRangeSettings.TitleFormat = "dd MMM"
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #3 - Sep 16th, 2011 at 2:01pm
Print Post  
More code (this forum tool will not let me send it all at once...too large)

Private Sub SetupCalendar()
Try
calendar.BeginInit()
SetCalendarDates(Me.viewStartDate.Value.Date)
calendar.Width = Me.Width * 0.9
calendar.Height = (Me.Height - calendar.Top) * 0.9
calendar.Left = (Me.Width - calendar.Width) / 2
calendar.ItemCloneKey = Keys.None
panelSetup.Width = calendar.Width
panelSetup.Left = calendar.Left
calendar.TimetableSettings.ShowDayHeader = State.Disabled
If Me.rbCustom.Checked Then
calendar.TimetableSettings.VisibleColumns = Me.comboCustomDays.SelectedItem
Else
calendar.TimetableSettings.VisibleColumns = 7 * theNumberOfWeeks
End If
calendar.TimetableSettings.CellTime = New TimeSpan(0, theResolution, 0)
If appConfiguration.TimeFormat = "12" Then
calendar.TimetableSettings.TwelveHourFormat = State.Enabled
Else
calendar.TimetableSettings.TwelveHourFormat = State.Disabled
End If
calendar.CurrentTime = Now
Catch ex As Exception
ErrHandler(Me.Name & " - Setup Calendar", ex)
Finally
calendar.EndInit()
End Try
End Sub
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #4 - Sep 16th, 2011 at 2:02pm
Print Post  
And one more...

Private Sub B1UpdateCalendar()
Try
calendar.BeginInit()
' set calendar start end times based on
' work center schedule
calendar.Schedule.Items.Clear()
Dim startTimeWholeHours As Integer = Math.Floor(theWorkScheduleInfo.StartOfDayFactor / 60) * 60
calendar.TimetableSettings.StartTime = startTimeWholeHours
calendar.TimetableSettings.EndTime = startTimeWholeHours - 1
panelNumberOfWeeks.Visible = True
'
calendar.TimetableSettings.EnableCollisions = State.Disabled
'
Dim startDate As Date = Me.viewStartDate.Value.Date
Dim endDate As Date = startDate.AddDays(7 * theNumberOfWeeks - 1)

Dim slRuns As New SortedList(Of String, List(Of B1RunInfo))
slRuns = GetB1RunsListByProductionDate(startDate, endDate, theWorkCenter)
If errorInfo.Length > 0 Then
Throw New System.Exception("Updating Calendar for B1 runs - failed to read " & _
"list of B1 runs." & vbCrLf & errorInfo)
End If

If slRuns.Count = 0 Then
Exit Sub
End If
'
Dim theRunList As New List(Of B1RunInfo)
Dim theRunInfo As New B1RunInfo
Dim appID As Integer = 0
Dim processTime As Long
Dim strProcessTime As String

theRunList = slRuns(theWorkCenter)
For i As Integer = 0 To theRunList.Count - 1
theRunInfo = theRunList(i)

Dim app As New Appointment()
app.HeaderText = theRunInfo.ItemNumber
app.Tag = theRunInfo
app.Id = appID.ToString
appID += 1
If theRunInfo.StartTime >= 1440 Then
app.StartTime = theRunInfo.ProductionDate.AddDays(1) & " " & _
MinutesTo24HourTime(theRunInfo.StartTime)
Else
app.StartTime = theRunInfo.ProductionDate & " " & _
MinutesTo24HourTime(theRunInfo.StartTime)
End If
If theRunInfo.EndTime >= 1440 Then
app.EndTime = theRunInfo.ProductionDate.AddDays(1) & " " & _
MinutesTo24HourTime(theRunInfo.EndTime)
Else
app.EndTime = theRunInfo.ProductionDate & " " & MinutesTo24HourTime(theRunInfo.EndTime)
End If
processTime = DateDiff(DateInterval.Minute, app.StartTime, app.EndTime)
strProcessTime = MinutesToHoursMinutes(processTime)
app.DescriptionText = _
theRunInfo.ItemNumber & vbCrLf & _
theRunInfo.ItemDescription & vbCrLf & vbCrLf & _
"Quantity: " & Format(theRunInfo.ItemQuantity, "###,###,###.##") & vbCrLf & _
"Start: " & FormatedTime(theRunInfo.StartTime) & vbCrLf & _
"End: " & FormatedTime(theRunInfo.EndTime) & vbCrLf & _
"Processing Time: " & strProcessTime & vbCrLf & _
"Overhead Time: " & theRunInfo.OverHeadTime.ToString & "m" & vbCrLf & _
"Breaks: " & theRunInfo.BreakTime.ToString & "m" & vbCrLf & vbCrLf & _
"MO: " & theRunInfo.MONumber & " - " & theRunInfo.MOLineNumber
If theRunInfo.MOStatus = "P" Then
app.DescriptionText += vbCrLf & "Key: " & theRunInfo.OriginalPlannerInfoKey.ToString
End If

app.AllowMove = True
app.AllowChangeStart = False
app.AllowChangeEnd = False
' todo handle coloring
If theRunInfo.MOStatus = "P" Then
app.Style.Brush = New MindFusion.Drawing.HatchBrush(Drawing2D.HatchStyle.Percent50, _
Color.LightGreen, Color.WhiteSmoke)
Else
app.Style.Brush = New MindFusion.Drawing.HatchBrush(Drawing2D.HatchStyle.Percent50, _
Color.Yellow, Color.WhiteSmoke)
'app.Style.Brush = New MindFusion.Drawing.HatchBrush(Drawing2D.DashStyle.Dot, _
' Color.GreenYellow, Color.White)
'app.Style.TextColor = Color.DarkOliveGreen
'app.Style.HeaderTextColor = Color.DarkGoldenrod
app.SelectedStyle.Brush = New MindFusion.Drawing.HatchBrush(Drawing2D.HatchStyle.Percent90, _
Color.Yellow, Color.White)
End If
calendar.Schedule.Items.Add(app)
Next

UpdateCalendarDone:
Catch ex As Exception
ErrHandler(Me.Name & " - B1 Update Calendar", ex)
Finally
calendar.EndInit()
End Try
End Sub
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #5 - Sep 16th, 2011 at 2:25pm
Print Post  
Looking at your code now I see that you are recreating the appointments representing the data (B1RunInfo) every time B1UpdateCalendar is called. And indeed, the ordering of the new appointments might be different than the ordering of the previous ones. To ensure the same ordering you need to use the Appointment.Priority property. Items with higher priority appear before items with lower priority. The simplest solution in your case would be to assign '-i' to Appointment.Priority.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #6 - Sep 17th, 2011 at 3:37am
Print Post  
Hi Meppy,
I had looked at the priority before but that did not make a difference. The problem is that the ItemModified event does not fire in the priority order, which is what I need so I can process the items in that same order. Can you tell me what determines the order of the ItemModified event? That would help me get the correct order.

Thanks,
John
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #7 - Sep 19th, 2011 at 6:41am
Print Post  
It appears that the order of the ItemModified event is related to the order in which the modified items were added to the selection. If you have selected the items 'a', 'b', and 'c' in this order and then move them, the ItemModified event will be raised for item 'c', then 'b', then 'a'.

Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #8 - Sep 19th, 2011 at 2:40pm
Print Post  
Hi Meppy,
Thank you again for your excellent help.

I think my problem is in the way I am clearing the schedule each time an item is modified. And I have to do that because I use my own database to manage the schedule. I only use the schedule for presentation and drag/drop. The underlying data requires complicated business logic to complete the modification beyond just changing the start date/time.

So I will have to look into the way I am processing all of this and find another way.

Thanks,
John
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #9 - Sep 20th, 2011 at 5:57am
Print Post  
If you want to control the order in which the ItemModified event is raised, you can handle the Calendar.ItemSelectionChanged event and arrange the items in the selection appropriately so that subsequent ItemModified events arrive in the expected order.

Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #10 - Sep 20th, 2011 at 3:18pm
Print Post  
Hi Meppy
That sounds like a good idea. Can you give me sample code on changing the selection order?

Thanks,
John
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #11 - Sep 21st, 2011 at 6:44am
Print Post  
Unfortunately my observation about the ItemModified order is incorrect - the event is fired pseudo randomly depending on some internal structures. However, I have figured a better way to control the modification order - the ItemsModified event. This event is raised only once regardless of the number of the modified items and contains information about all of the modifications. This way you can process the modified items in any order you want.

Let me know if this will work.

Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #12 - Sep 21st, 2011 at 3:30pm
Print Post  
Hi Meppy,
That sounds hopeful. I do not know how to access the modified items list from the event arguments. Can you skecth some code?

Thanks,
John
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Order of processing for multi-select
Reply #13 - Sep 22nd, 2011 at 6:26am
Print Post  
The event argument contains a single property - a collection of MindFusion.Scheduling.WinForms.ModifiedItemInfo objects. Each ModifiedItemInfo object contains the information about the modification of a single item. For example, if you have modified three items, the collection will contain three ModifiedItemInfo objects. Each ModifiedItemInfo object exposes various properties related to the modificaiton, such as a reference to the item that was modified, the old start and end time, and so on. For example, the following code prints the headers of all modified items:

Code
Select All
For Each info As ModifiedItemInfo In e.ItemInfo
      Debug.WriteLine(info.Item.HeaderText)
Next 


Regards,
Meppy
  
Back to top
 
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Order of processing for multi-select
Reply #14 - Sep 22nd, 2011 at 1:40pm
Print Post  
Excellent. Thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint