コード例 #1
0
        private void CalendarCtrl_ItemCreated(object sender, Mediachase.Web.UI.WebControls.CalendarItemEventArgs e)
        {
            CalendarItem _ci = e.Item;
            int          ID  = (int)DataBinder.Eval(e.Item.DataItem, "ID");
            HtmlAnchor   lnk = (HtmlAnchor)e.Item.FindControl("lnk");

            switch ((Mediachase.IBN.Business.CalendarView.CalendarFilter)DataBinder.Eval(e.Item.DataItem, "Type"))
            {
            case Mediachase.IBN.Business.CalendarView.CalendarFilter.Appointment:
                //					_ci.LabelColor = Color.LightGoldenrodYellow;
                break;

            case Mediachase.IBN.Business.CalendarView.CalendarFilter.Event:
                //					_ci.LabelColor = Color.LightCoral;
                break;

            case Mediachase.IBN.Business.CalendarView.CalendarFilter.Meeting:
                //					_ci.LabelColor = Color.LightSalmon;
                break;

            case Mediachase.IBN.Business.CalendarView.CalendarFilter.Task:
            case Mediachase.IBN.Business.CalendarView.CalendarFilter.MileStone:
                //					_ci.LabelColor = Color.LightSeaGreen;
                break;

            case Mediachase.IBN.Business.CalendarView.CalendarFilter.ToDo:
                //					_ci.LabelColor = Color.LightSteelBlue;
                break;
            }
        }
コード例 #2
0
ファイル: Calendar.cs プロジェクト: 0anion0/IBN
        private CalendarItem CreateItem(int itemIndex, bool dataBind, object dataItem)
        {
            String label = null;
            String link = null;
            String description = null;
            String color = null;
            String owner = null;
            DateTime startDate = DateTime.Now.Date;
            DateTime endDate = DateTime.MinValue;

            if (DataTextField != String.Empty)
                label = DataBinder.GetPropertyValue(dataItem, DataTextField, null);
            if (DataLinkField != String.Empty)
            {
                if (DataLinkFormat != String.Empty) // apply formatting
                    link = String.Format(DataLinkFormat, DataBinder.GetPropertyValue(dataItem, DataLinkField, null));
                else
                    link = DataBinder.GetPropertyValue(dataItem, DataLinkField, null);
            }

            if (DataStartDateField != String.Empty)
                startDate = DateTime.Parse(DataBinder.GetPropertyValue(dataItem, DataStartDateField, null));
            if (DataEndDateField != String.Empty)
                endDate = DateTime.Parse(DataBinder.GetPropertyValue(dataItem, DataEndDateField, null));
            if (DataDescriptionField != String.Empty)
                description = DataBinder.GetPropertyValue(dataItem, DataDescriptionField, null);
            if (DataColorField != String.Empty)
                color = DataBinder.GetPropertyValue(dataItem, DataColorField, null);
            if (DataOwnerField != String.Empty)
                owner = DataBinder.GetPropertyValue(dataItem, DataOwnerField, null);

            CalendarItem item = null;

            //CalendarItem item = new CalendarItem(itemIndex);

            if(endDate==DateTime.MinValue)
                item = new CalendarItem(itemIndex, label, startDate, startDate, link, description);
            else
                item = new CalendarItem(itemIndex, label, startDate, endDate, link, description);

            if(color!=null)
                item.LabelColor = Color.FromName(color);

            if(owner!=null)
                item.Owner = owner;

            CalendarItemEventArgs e = new CalendarItemEventArgs(item);

            if (dataBind)
            {
                item.DataItem = dataItem;
            }
            OnItemCreated(e);

            Items.Add(item);

            item.Initialize();
            item.ValidateItem();

            // REMOVED v1.4:
            Controls.Add(item);

            if (dataBind)
            {
                item.DataBind();
                OnItemDataBound(e);

                //item.DataItem = null;
            }

            return item;
        }
コード例 #3
0
ファイル: Calendar.cs プロジェクト: 0anion0/IBN
 /// <summary>
 /// Raises the <see cref="OnItemDataBound"/> event. This allows you to provide a custom handler for the event.
 /// </summary>
 /// <param name="e">A <see cref="CalendarItemEventArgs"/> that contains event data.</param>
 /// Use the OnItemCreated method to provide a custom handler for the ItemCreated event.
 /// 
 /// <remarks>
 /// Use the OnItemDataBound method to provide a custom handler for the ItemDataBound event.
 /// The ItemDataBound event is raised after an item is data bound to the Calendar control. This event provides you with the last opportunity to access the data item before it is displayed on the client. After this event is raised, the data item is nulled out and no longer available.
 /// Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
 /// The OnItemDataBound method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
 /// </remarks>
 protected virtual void OnItemDataBound(CalendarItemEventArgs e)
 {
     CalendarItemEventHandler onItemDataBoundHandler = (CalendarItemEventHandler)Events[EventItemDataBound];
     if (onItemDataBoundHandler != null) onItemDataBoundHandler(this, e);
 }