Ejemplo n.º 1
0
        public void LoadEvents(CalendarEventFilter filter)
        {
            try
            {
                loadDurations = true;
                monthView.EventsDurationByDate = new Dictionary <DateTime, int>();
                eventsFlowLayoutPanel.Controls.Clear();
                foreach (var item in ezkoController.GetEvents(filter))
                {
                    CalendarEventCard card = new CalendarEventCard(item, visitUserControl,
                                                                   item.StateID == (int)DatabaseCommunicator.Enums.EventStateEnum.Payed);
                    card.Width = eventsFlowLayoutPanel.Width - 25;

                    //for AutoSize only in vertical direction
                    card.MaximumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0);
                    card.MinimumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0);

                    eventsFlowLayoutPanel.Controls.Add(card);

                    UpdateDurations(item.StartDate, item.EndDate, false);
                }

                monthView.Invalidate();
            }
            catch (Exception e)
            {
                BasicMessagesHandler.ShowErrorMessage("Udalosti sa nepodarilo načítať", e);
            }
        }
Ejemplo n.º 2
0
        private void LoadEvents(DateTime selectionStart, DateTime selectionEnd)
        {
            try
            {
                if (loadDurations)
                {
                    LoadDurations(DateTime.Now.AddMonths(-6), DateTime.Now.AddYears(1));
                }

                eventsFlowLayoutPanel.Controls.Clear();
                foreach (var item in ezkoController.GetEvents(selectionStart, selectionEnd))
                {
                    CalendarEventCard card = new CalendarEventCard(item, visitUserControl,
                                                                   item.StateID == (int)DatabaseCommunicator.Enums.EventStateEnum.Payed);
                    card.Width = eventsFlowLayoutPanel.Width - 25;

                    //for AutoSize only in vertical direction
                    card.MaximumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0);
                    card.MinimumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0);

                    eventsFlowLayoutPanel.Controls.Add(card);
                }

                monthView.Invalidate();
            }
            catch (Exception e)
            {
                BasicMessagesHandler.ShowErrorMessage("Udalosti sa nepodarilo načítať", e);
            }
        }