Example #1
0
        protected void BaseCalendar1_RenderBodyDay(BaseCalendar sender, BaseTagContentDay tag)
        {
            // for every day and if the date is within the current visible month...
            if (!tag.Info.IsOtherMonth)
            {
                // we change the ID of the generated TD (inside TBODY > TR), maybe useful when using javascript
                tag.Id = "x_" + tag.Info.Date.Day;
                // just a demo that you can add/use style values (more than one) for each row
                //tag.Style.Add("cursor:pointer");

                // you can also add custom attributes, in this case "onclick"
                // The actual content of the cell can be anything, like other HTML tags. In this case
                // we render the day number like the calendar would render is we didn't have a DayTag
                // handler by we add an asterisk to show that it's different.
                tag.Content.Write("<div class=dayheader><a class='day' href='#' onclick=\"EditTask(0," + tag.Info.Date.ToString("yyyyMMdd")
                     + ",'" + txtCustOwnerID.SelectedItem.Text + "');\">" + tag.DefaultText + ChineseCalendar.GetChineseShortDay(tag.Info.Date) + "</a></div>");

                //-----------根据人名,日期取得日程---------
                tag.Content.Write(svr.GetDayTagHtml(tag.Info.Date.ToString("yyyyMMdd"), txtCustOwnerID.SelectedItem.Text));
                //tag.Content.Write(tag.Info.Date.ToString("%d*", sender.CurrentDateTimeFormatInfo));
            }
            else
            {
                // Since we have a DayTag handler (this method) the calendar control doesn't output anything
                // by default (it lets us to our custom rendering). To help us out it puts the content it
                // would've normally rendered inside DefaultText, but it's still up to us to actually render it;
                // we just don't have to figure out what it would've rendered by default -- note that this is
                // exactly what we did in the other "if" branch...

                tag.Content.Write("");
            }
            // just to show that you can, a dummy "url" attribute with "sweet" inside
            tag.Attributes.Add("url", "sweet");
        }
        public SubscriptionWrapper Get(BaseCalendar calendar, UserViewSettings userViewSettings)
        {
            var subscriptionWrapper = (SubscriptionWrapper)CalendarWrapperHelper.Get(calendar, userViewSettings);
            var _userViewSettings   = subscriptionWrapper._userViewSettings;

            //isSubscribed
            if (subscriptionWrapper.UserCalendar is Calendar.BusinessObjects.Calendar)
            {
                subscriptionWrapper.IsAccepted = _userViewSettings != null && _userViewSettings.IsAccepted;
            }
            else
            {
                subscriptionWrapper.IsAccepted = subscriptionWrapper.IsAcceptedSubscription;
            }

            //isNew
            subscriptionWrapper.IsNew = _userViewSettings == null;

            //group
            if (subscriptionWrapper.UserCalendar.IsiCalStream())
            {
                subscriptionWrapper.Group = Resources.CalendarApiResource.iCalCalendarsGroup;
            }
            else
            {
                subscriptionWrapper.Group = String.IsNullOrEmpty(subscriptionWrapper.UserCalendar.Context.Group) ? Resources.CalendarApiResource.SharedCalendarsGroup : subscriptionWrapper.UserCalendar.Context.Group;
            }
            return(subscriptionWrapper);
        }
Example #3
0
        public void TestClone()
        {
            BaseCalendar baseCalendar = new BaseCalendar();

            baseCalendar.Description = "My description";
            baseCalendar.TimeZone    = TimeZoneInfo.GetSystemTimeZones()[3];
            BaseCalendar clone = (BaseCalendar)baseCalendar.Clone();

            Assert.AreEqual(baseCalendar.Description, clone.Description);
            Assert.AreEqual(baseCalendar.CalendarBase, clone.CalendarBase);
            Assert.AreEqual(baseCalendar.TimeZone, clone.TimeZone);
        }
Example #4
0
        public static List <EventWrapper> GetEventWrappers(this BaseCalendar calendar, Guid userId, ApiDateTime startDate, ApiDateTime endDate)
        {
            var result = new List <EventWrapper>();

            if (calendar != null)
            {
                var events = calendar.LoadEvents(userId, startDate.UtcTime, endDate.UtcTime);
                events.ForEach(e => result.AddRange(new EventWrapper(e, userId, calendar.TimeZone).GetList(startDate.UtcTime, endDate.UtcTime)));
            }

            return(result);
        }
Example #5
0
        protected void CalendarBodyDay(BaseCalendar sender, BaseTagContentDay tag)
        {
            if (!tag.Info.IsOtherMonth)
            {
                tag.Content.WriteLine("<b><span class=\"emph1\">" + tag.DefaultText + "</span></b><br/>");

                var dayItems = items.Where(i => i.Start.GetValueOrDefault().Date == tag.Info.Date.Date).ToList();

                if (dayItems.Count > 0)
                {
                    tag.Content.WriteLine("<div class=\"calendarItems\">");

                    foreach (var item in dayItems)
                    {
                        if (item.AllDay)
                        {
                            tag.Content.WriteLine(string.Format("{0}<br />", item.Title));
                        }
                        else
                        {
                            tag.Content.WriteLine(
                                string.Format("<span class=\"emph1\">{0}:</span> {1}<br />",
                                item.Start.Value.ToString("t"), item.Title)
                            );
                        }
                    }

                    tag.Content.WriteLine("<br />");
                    tag.Content.WriteLine("</div>");
                }
            }
            else
            {
                tag.Content.WriteLine("<span class=\"calendarOtherMonth\">" + tag.DefaultText + "</span>");
            }
        }