void ControlTreeDataLoader.LoadData()
        {
            if (dateModificationMethod == null)
            {
                throw new ApplicationException("In order to place this calendar on a page, you must call SetParameters before the end of LoadData.");
            }
            buildNavigationBox();

            // Begin drawing calendar
            var table = TableOps.CreateUnderlyingTable();

            table.Attributes["class"] = "ewfMonthView ewfMonthViewCalendar";
            base.Controls.Add(table);

            var headerRow = new TableRow();

            foreach (var day in Enum.GetValues(typeof(DayOfWeek)))
            {
                headerRow.Cells.Add(new TableCell {
                    Text = day.ToString(), CssClass = "commonHeader ewfDaysOfWeekHeader"
                });
            }
            table.Rows.Add(headerRow);

            var localDate      = IsTwoWeekCalendar ? date.WeekBeginDate() : new DateTime(date.Year, date.Month, 1).WeekBeginDate();
            var endDrawingDate = IsTwoWeekCalendar
                                                     ? localDate.AddDays(13)
                                                     : new DateTime(date.Year, date.Month, 1).AddDays(DateTime.DaysInMonth(date.Year, date.Month) - 1);

            do
            {
                var row = new TableRow();
                foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
                {
                    var cell = new TableCell {
                        Text = " "
                    };
                    if (IsTwoWeekCalendar || localDate.Date.Month.CompareTo(date.Date.Month) == 0)
                    {
                        if (daysOfMonthToCells.ContainsKey(localDate))
                        {
                            cell = daysOfMonthToCells[localDate];
                        }

                        if (daysOfMonthToolTips.ContainsKey(localDate))
                        {
                            new ToolTip(daysOfMonthToolTips[localDate].Content, cell);
                        }
                    }
                    cell.Attributes.Add("class", localDate.CompareTo(DateTime.Now.Date) == 0 ? "ewfToday" : localDate.Month == date.Month ? "ewfDay" : "ewfDaySpacer");
                    cell.Controls.AddAt(0, new Paragraph(localDate.Day.ToString().GetLiteralControl())
                    {
                        CssClass = "dayLabel"
                    });
                    row.Cells.Add(cell);
                    localDate = localDate.AddDays(1);
                }
                table.Rows.Add(row);
            }while(localDate.CompareTo(endDrawingDate) <= 0);
        }
Ejemplo n.º 2
0
        private void createChildControlsAndWireUpEvents()
        {
            captionTable          = TableOps.CreateUnderlyingTable();
            captionTable.CssClass = "ewfStandardDynamicTableCaption";
            captionTable.Visible  = false;
            var row = new TableRow();

            var captionCell = new TableCell();

            captionCell.Controls.Add(captionStack = ControlStack.Create(false));
            row.Cells.Add(captionCell);

            var actionLinksCell = new TableCell {
                CssClass = "ewfAddItemLink"
            };

            actionLinksCell.Controls.Add(actionLinkStack = ControlStack.Create(false));
            row.Cells.Add(actionLinksCell);

            captionTable.Rows.Add(row);
            Controls.Add(captionTable);

            table = TableOps.CreateUnderlyingTable();
            Controls.Add(table);

            PreRender += ewfTable_PreRender;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of a Control Line with the given controls.
        /// </summary>
        public ControlLine(params Control[] controls)
        {
            var table = TableOps.CreateUnderlyingTable();

            table.Rows.Add(row = new TableRow());
            base.Controls.Add(table);
            AddControls(controls);
            VerticalAlignment = TableCellVerticalAlignment.NotSpecified;
        }