Пример #1
0
        public void UpdateModifiable(IEnumerable <SubCalendarEvent> Modifiables)
        {
            foreach (SubCalendarEvent eachSubCalendarEvent in Modifiables)
            {
                //SubCalendarEvent mySubCalEvent=getSubEvent(eachSubCalendarEvent.SubEvent_ID);
                //mySubCalEvent.UpdateThis(eachSubCalendarEvent);
                //DeviatingSubEvents.Add(eachSubCalendarEvent.ID, eachSubCalendarEvent);
                DB_CalendarEventFly RefCalEvent = (DB_CalendarEventFly)getCalEventByOrginalStart(eachSubCalendarEvent.OrginalStartInfo);


                if (eachSubCalendarEvent.isComplete)
                {
                    if ((RefCalEvent.CompletedSofar < (RefCalEvent.Splits - RefCalEvent.DeletedSofar)))
                    {
                        DB_SubCalendarEventFly myDB_SubCalendarEventFly = (DB_SubCalendarEventFly)RefCalEvent.ActiveSubEvents.Last();
                        myDB_SubCalendarEventFly.InitializeCompleted(eachSubCalendarEvent);
                        try
                        {
                            RefCalEvent.updateDeviationList(1, myDB_SubCalendarEventFly);
                            ++RefCalEvent.CompletedSofar;
                            RefCalEvent.CompletedCount = RefCalEvent.CompletedSofar;
                            continue;
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }

                if (!eachSubCalendarEvent.isEnabled)
                {
                    if ((RefCalEvent.DeletedSofar < (RefCalEvent.Splits - RefCalEvent.CompletedSofar)))
                    {
                        DB_SubCalendarEventFly myDB_SubCalendarEventFly = (DB_SubCalendarEventFly)RefCalEvent.ActiveSubEvents.Last();
                        myDB_SubCalendarEventFly.InitializeDisabled(eachSubCalendarEvent);
                        try
                        {
                            RefCalEvent.updateDeviationList(0, myDB_SubCalendarEventFly);
                            ++RefCalEvent.DeletedSofar;
                            RefCalEvent.DeletedCount = RefCalEvent.DeletedSofar;
                            continue;
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }

                if (eachSubCalendarEvent.NowInfo.isInitialized)
                {
                    SubCalendarEvent[] AllActives = RefCalEvent.ActiveSubEvents;
                    if (AllActives.Length > 0)
                    {
                        try
                        {
                            DB_SubCalendarEventFly myDB_SubCalendarEventFly = (DB_SubCalendarEventFly)AllActives.Last();
                            myDB_SubCalendarEventFly.InitializeNowProfile(eachSubCalendarEvent);
                            RefCalEvent.updateDeviationList(2, myDB_SubCalendarEventFly);
                            continue;
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }
            }
        }