• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Internals.Primitive类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BoxSocial.Internals.Primitive的典型用法代码示例。如果您正苦于以下问题:C# Primitive类的具体用法?C# Primitive怎么用?C# Primitive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Primitive类属于BoxSocial.Internals命名空间,在下文中一共展示了Primitive类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PrimitiveApplicationInfo

        public PrimitiveApplicationInfo(Core core, Primitive owner, long applicationId)
            : base(core)
        {
            this.owner = owner;
            ItemLoad += new ItemLoadHandler(PrimitiveApplicationInfo_ItemLoad);

            SelectQuery query = new SelectQuery(PrimitiveApplicationInfo.GetTable(typeof(PrimitiveApplicationInfo)));
            query.AddFields(PrimitiveApplicationInfo.GetFieldsPrefixed(core, typeof(PrimitiveApplicationInfo)));
            query.AddCondition("application_id", applicationId);
            query.AddCondition("item_id", owner.Id);
            query.AddCondition("item_type_id", owner.TypeId);

            DataTable appDataTable = db.Query(query);

            if (appDataTable.Rows.Count == 1)
            {
                DataRow appRow = appDataTable.Rows[0];
                try
                {
                    loadItemInfo(appRow);
                }
                catch (InvalidItemException)
                {
                    throw new InvalidPrimitiveAppInfoException();
                }
            }
            else
            {
                throw new InvalidPrimitiveAppInfoException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:31,代码来源:PrimitiveApplicationInfo.cs


示例2: EventInvite

        public EventInvite(Core core, long eventId, Primitive invitee)
            : base(core)
        {
            this.ItemLoad += new ItemLoadHandler(EventInvite_ItemLoad);

            SelectQuery query = EventInvite.GetSelectQueryStub(core, typeof(EventInvite));
            query.AddCondition("event_id", eventId);
            query.AddCondition("item_id", invitee.Id);
            query.AddCondition("item_type_id", invitee.TypeId);

            System.Data.Common.DbDataReader inviteReader = db.ReaderQuery(query);

            try
            {
                if (inviteReader.HasRows)
                {
                    inviteReader.Read();

                    loadItemInfo(inviteReader);
                }

                inviteReader.Close();
                inviteReader.Dispose();
            }
            catch (InvalidItemException)
            {
                inviteReader.Close();
                inviteReader.Dispose();

                throw new InvalidEventInviteException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:32,代码来源:EventInvite.cs


示例3: Calendar

        public Calendar(Core core, Primitive owner)
            : base(core)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            if (owner == null)
            {
                throw new InvalidUserException();
            }

            this.owner = owner;
            ItemLoad += new ItemLoadHandler(Calendar_ItemLoad);

            try
            {
                LoadItem("calendar_item_id", "calendar_item_type_id", owner);
            }
            catch (InvalidItemException)
            {
                throw new InvalidCalendarException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:25,代码来源:Calendar.cs


示例4: ControlPanelSubModule

        /// <summary>
        /// Initializes a new instance of the ControlPanelSubModule class. 
        /// </summary>
        /// <param name="core">The Core token.</param>
        public ControlPanelSubModule(Core core, Primitive owner)
        {
            this.core = core;
            this.db = core.Db;
            this.session = core.Session;
            this.tz = core.Tz;
            this.LoggedInMember = session.LoggedInMember;
            this.Owner = owner;

            core.Prose.AddApplication(Assembly.GetAssembly(this.GetType()).GetName().Name);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:15,代码来源:ControlPanelSubModule.cs


示例5: Access

        internal Access(Core core, ItemKey key, Primitive leafOwner)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            this.core = core;
            this.item = null;
            this.owner = leafOwner;
            this.itemKey = key;
            this.viewer = core.Session.LoggedInMember;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:13,代码来源:Access.cs


示例6: Project

        public Project(Core core, Primitive owner, string key)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(Project_ItemLoad);

            try
            {
                LoadItem("project_item_id", "project_item_type_id", owner, new FieldValuePair("project_key", key));
            }
            catch (InvalidItemException)
            {
                throw new InvalidProjectException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:14,代码来源:Project.cs


示例7: DnsRecord

        public DnsRecord(Core core, Primitive owner)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(DnsRecord_ItemLoad);

            try
            {
                LoadItem("dns_owner_id", "dns_owner_type", owner);
            }
            catch (InvalidItemException)
            {
                throw new InvalidDnsRecordException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:14,代码来源:DnsRecord.cs


示例8: ForumMember

        public ForumMember(Core core, Primitive owner, User user)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ForumMember_ItemLoad);

            // load the info into a the new object being created
            this.userInfo = user.UserInfo;
            this.userProfile = user.Profile;
            this.userStyle = user.Style;
            this.userId = user.UserId;
            this.userName = user.UserName;
            this.domain = user.UserDomain;
            this.emailAddresses = user.EmailAddresses;

            SelectQuery sQuery = ForumMember.GetSelectQueryStub(core, typeof(ForumMember));
            sQuery.AddCondition("user_id", user.Id);
            sQuery.AddCondition("item_id", owner.Id);
            sQuery.AddCondition("item_type_id", owner.TypeId);

            try
            {
                System.Data.Common.DbDataReader memberReader = core.Db.ReaderQuery(sQuery);

                if (memberReader.HasRows)
                {
                    memberReader.Read();

                    loadItemInfo(memberReader);

                    memberReader.Close();
                    memberReader.Dispose();
                }
                else
                {
                    memberReader.Close();
                    memberReader.Dispose();

                    throw new InvalidForumMemberException();
                }
            }
            catch (InvalidItemException)
            {
                throw new InvalidForumMemberException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:45,代码来源:ForumMember.cs


示例9: BlogEntry

        public BlogEntry(Core core, Blog blog, Primitive owner, System.Data.Common.DbDataReader postEntryReader)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(BlogEntry_ItemLoad);

            this.blog = blog;
            this.owner = owner;

            loadItemInfo(postEntryReader);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:10,代码来源:BlogEntry.cs


示例10: GetEvents

        public List<Event> GetEvents(Core core, Primitive owner, long startTimeRaw, long endTimeRaw)
        {
            List<Event> events = new List<Event>();

            SelectQuery sQuery = Item.GetSelectQueryStub(core, typeof(Event));
            sQuery.AddCondition("event_item_id", owner.Id);
            sQuery.AddCondition("event_item_type_id", owner.TypeId);
            QueryCondition sqc2 = sQuery.AddCondition("event_time_start_ut", ConditionEquality.GreaterThanEqual, startTimeRaw);
            sqc2.AddCondition("event_time_start_ut", ConditionEquality.LessThanEqual, endTimeRaw);
            QueryCondition sqc3 = sqc2.AddCondition(ConditionRelations.Or, "event_time_end_ut", ConditionEquality.GreaterThanEqual, startTimeRaw);
            sqc3.AddCondition("event_time_end_ut", ConditionEquality.LessThanEqual, endTimeRaw);
            QueryCondition sqc4 = sqc3.AddCondition(ConditionRelations.Or, "event_time_start_ut", ConditionEquality.LessThan, startTimeRaw);
            sqc4.AddCondition("event_time_end_ut", ConditionEquality.GreaterThan, endTimeRaw);
            sQuery.AddSort(SortOrder.Ascending, "event_time_start_ut");

            {
                System.Data.Common.DbDataReader eventsReader = db.ReaderQuery(sQuery);

                while (eventsReader.Read())
                {
                    events.Add(new Event(core, eventsReader));
                }

                eventsReader.Close();
                eventsReader.Dispose();
            }

            if (owner.TypeId == ItemKey.GetTypeId(core, typeof(User)))
            {
                // now select events invited to
                SelectQuery query = Event.GetSelectQueryStub(core, typeof(Event));
                query.AddFields("event_invites.item_id", "event_invites.item_type_id", "event_invites.inviter_id", "event_invites.event_id");
                query.AddJoin(JoinTypes.Left, new DataField(typeof(Event), "event_id"), new DataField("event_invites", "event_id"));
                query.AddCondition("item_id", core.LoggedInMemberId);
                query.AddCondition("item_type_id", ItemKey.GetTypeId(core, typeof(User)));
                QueryCondition qc2 = query.AddCondition("event_time_start_ut", ConditionEquality.GreaterThanEqual, startTimeRaw);
                qc2.AddCondition("event_time_start_ut", ConditionEquality.LessThanEqual, endTimeRaw);
                QueryCondition qc3 = qc2.AddCondition(ConditionRelations.Or, "event_time_end_ut", ConditionEquality.GreaterThanEqual, startTimeRaw);
                qc3.AddCondition("event_time_end_ut", ConditionEquality.LessThanEqual, endTimeRaw);
                QueryCondition qc4 = qc3.AddCondition(ConditionRelations.Or, "event_time_start_ut", ConditionEquality.LessThan, startTimeRaw);
                qc4.AddCondition("event_time_end_ut", ConditionEquality.GreaterThan, endTimeRaw);

                System.Data.Common.DbDataReader eventsReader = db.ReaderQuery(sQuery);

                while (eventsReader.Read())
                {
                    events.Add(new Event(core, eventsReader));
                }

                eventsReader.Close();
                eventsReader.Dispose();

                User user = (User)owner;
                List<UserRelation> friends = user.GetFriendsBirthdays(startTimeRaw, endTimeRaw);

                foreach (UserRelation friend in friends)
                {
                    try
                    {
                        events.Add(new BirthdayEvent(core, user, friend, core.Tz.DateTimeFromMysql(startTimeRaw).Year));
                    }
                    catch (InvalidEventException)
                    {
                        // Not a reciprocol friend, ignore
                    }
                }
            }

            events.Sort();

            return events;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:72,代码来源:Calendar.cs


示例11: Show

        public static void Show(Core core, TPage page, Primitive owner, int year, int month, int day)
        {
            core.Template.SetTemplate("Calendar", "viewcalendarday");

            // 15 year window
            if (year < DateTime.Now.Year - 10 || year > DateTime.Now.Year + 5)
            {
                core.Functions.Generate404();
            }

            if (month < 1 || month > 12)
            {
                core.Functions.Generate404();
            }

            if (day < 1 || day > DateTime.DaysInMonth(year, month))
            {
                core.Functions.Generate404();
            }

            /* pages */
            core.Display.ParsePageList(owner, true);

            core.Template.Parse("PAGE_TITLE", day.ToString() + " " + core.Functions.IntToMonth(month) + " " + year.ToString());

            core.Template.Parse("CURRENT_DAY", day.ToString());
            core.Template.Parse("CURRENT_MONTH", core.Functions.IntToMonth(month));
            core.Template.Parse("CURRENT_YEAR", year.ToString());

            long startTime = core.Tz.GetUnixTimeStamp(new DateTime(year, month, day, 0, 0, 0));
            long endTime = startTime + 60 * 60 * 24;

            Calendar cal = null;
            try
            {
                cal = new Calendar(core, owner);
            }
            catch (InvalidCalendarException)
            {
                cal = Calendar.Create(core, owner);
            }

            if (cal.Access.Can("CREATE_EVENTS"))
            {
                core.Template.Parse("U_NEW_EVENT", core.Hyperlink.BuildAccountSubModuleUri(owner, "calendar", "new-event", true,
                    string.Format("year={0}", year),
                    string.Format("month={0}", month),
                    string.Format("day={0}", day)));
            }

            List<Event> events = cal.GetEvents(core, owner, startTime, endTime);

            bool hasAllDaysEvents = false;

            foreach (Event calendarEvent in events)
            {
                if (calendarEvent.AllDay)
                {
                    hasAllDaysEvents = true;
                    VariableCollection eventVariableCollection = core.Template.CreateChild("event");

                    eventVariableCollection.Parse("TITLE", calendarEvent.Subject);
                    eventVariableCollection.Parse("URI", calendarEvent.Uri);
                }
            }

            if (hasAllDaysEvents)
            {
                core.Template.Parse("ALL_DAY_EVENTS", "TRUE");
            }

            VariableCollection[] hours = new VariableCollection[24];

            for (int hour = 0; hour < 24; hour++)
            {
                VariableCollection timeslotVariableCollection = core.Template.CreateChild("timeslot");

                DateTime hourTime = new DateTime(year, month, day, hour, 0, 0);

                timeslotVariableCollection.Parse("TIME", hourTime.ToString("h tt").ToLower());
                hours[hour] = timeslotVariableCollection;
            }

            showHourEvents(core, owner, year, month, day, hours, events);

            List<string[]> calendarPath = new List<string[]>();
            calendarPath.Add(new string[] { "calendar", core.Prose.GetString("CALENDAR") });
            calendarPath.Add(new string[] { year.ToString(), year.ToString() });
            calendarPath.Add(new string[] { month.ToString(), core.Functions.IntToMonth(month) });
            calendarPath.Add(new string[] { day.ToString(), day.ToString() });
            owner.ParseBreadCrumbs(calendarPath);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:92,代码来源:Calendar.cs


示例12: showHourEvents

        private static void showHourEvents(Core core, Primitive owner, int year, int month, int day, VariableCollection[] timeslotVariableCollections, List<Event> events)
        {
            bool hasEvents = false;

            long startOfDay = core.Tz.GetUnixTimeStamp(new DateTime(year, month, day, 0, 0, 0));
            long endOfDay = startOfDay + 60 * 60 * 24;

            long[] heights = new long[events.Count];
            long[] tops = new long[events.Count];
            double[] widths = new double[events.Count];
            double[] lefts = new double[events.Count];
            int[] eventCount = new int[96];
            int[] eventNumber = new int[96];

            int hourHeight = 32;

            List<Event> expired = new List<Event>();
            int i = 0;
            foreach (Event calendarEvent in events)
            {
                if (calendarEvent.AllDay)
                {
                    continue;
                }

                long startTime = calendarEvent.StartTimeRaw;
                long endTime = calendarEvent.EndTimeRaw;

                if (endTime > endOfDay)
                {
                    endTime = endOfDay;
                }

                if (startTime < startOfDay)
                {
                    startTime = startOfDay;
                }

                DateTime startDateTime = core.Tz.DateTimeFromMysql(startTime);
                DateTime endDateTime = core.Tz.DateTimeFromMysql(endTime - 1);
                long startMinute = startDateTime.Minute;
                long startHour = startDateTime.Hour;
                long endMinute = endDateTime.Minute;
                long endHour = endDateTime.Hour;
                int startFifteen = (int)Math.Floor(startHour * 4.0 + startMinute / 15.0);
                int endFifteen = (int)Math.Floor(endHour * 4.0 + endMinute / 15.0);

                for (int j = startFifteen; j <= endFifteen; j++)
                {
                    eventCount[j]++;
                }

                heights[i] = (endTime - startTime) * hourHeight / 60 / 60;
                tops[i] = startMinute * 36 / 60;
                widths[i] = 100.0;
                lefts[i] = 100 - 100.0 / Math.Max(1, eventCount[startFifteen]);

                i++;
            }

            i = 0;
            foreach (Event calendarEvent in events)
            {
                if (calendarEvent.AllDay)
                {
                    continue;
                }

                long startTime = calendarEvent.StartTimeRaw;
                long endTime = calendarEvent.EndTimeRaw;

                if (endTime > endOfDay)
                {
                    endTime = endOfDay;
                }

                if (startTime < startOfDay)
                {
                    startTime = startOfDay;
                }

                DateTime startDateTime = core.Tz.DateTimeFromMysql(startTime);
                DateTime endDateTime = core.Tz.DateTimeFromMysql(endTime - 1);
                long startMinute = startDateTime.Minute;
                long startHour = startDateTime.Hour;
                long endMinute = endDateTime.Minute;
                long endHour = endDateTime.Hour;
                int startFifteen = (int)Math.Floor(startHour * 4.0 + startMinute / 15.0);
                int endFifteen = (int)Math.Floor(endHour * 4.0 + endMinute / 15.0);

                int maxEventsOnFifteen = 0;
                for (int j = startFifteen; j <= endFifteen; j++)
                {
                    eventNumber[j]++;
                    if (eventCount[j] > maxEventsOnFifteen)
                    {
                        maxEventsOnFifteen = eventCount[j];
                    }
                }

//.........这里部分代码省略.........
开发者ID:smithydll,项目名称:boxsocial,代码行数:101,代码来源:Calendar.cs


示例13: DisplayMiniCalendar

        private static void DisplayMiniCalendar(Core core, Template template, VariableCollection vc1, Primitive owner, int year, int month)
        {
            int days = DateTime.DaysInMonth(year, month);
            DayOfWeek firstDay = new DateTime(year, month, 1).DayOfWeek;
            int offset = Calendar.GetFirstDayOfMonthOffset(firstDay);
            int weeks = (int)Math.Ceiling((days + offset) / 7.0);

            if (template != null)
            {
                template.Parse("CURRENT_MONTH", core.Functions.IntToMonth(month));
                template.Parse("CURRENT_YEAR", year.ToString());
            }
            else
            {
                vc1.Parse("MONTH", core.Functions.IntToMonth(month));
                vc1.Parse("U_MONTH", BuildMonthUri(core, owner, year, month));
            }

            for (int week = 0; week < weeks; week++)
            {
                VariableCollection weekVariableCollection;
                if (template != null)
                {
                    weekVariableCollection = template.CreateChild("week");
                }
                else
                {
                    weekVariableCollection = vc1.CreateChild("week");
                }

                weekVariableCollection.Parse("WEEK", (week + 1).ToString());

                if (week + 1 == 1)
                {
                    int daysPrev = DateTime.DaysInMonth(year - (month - 1) / 12, (month - 1) % 12 + 1);
                    for (int i = offset - 1; i >= 0; i--)
                    {
                        int day = daysPrev - i;

                        VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
                        dayVariableCollection.Parse("DATE", day.ToString());
                        dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year - (month - 2) / 12, (month - 2) % 12 + 1, day));
                    }
                    for (int i = offset; i < 7; i++)
                    {
                        int day = i - offset + 1;

                        VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
                        dayVariableCollection.Parse("DATE", day.ToString());
                        dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year, month, day));
                    }
                }
                else if (week + 1 == weeks)
                {
                    for (int i = week * 7 - offset; i < days; i++)
                    {
                        int day = i + 1;

                        VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
                        dayVariableCollection.Parse("DATE", day.ToString());
                        dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year, month, day));
                    }
                    for (int i = 0; i < weeks * 7 - days - offset; i++)
                    {
                        int day = i + 1;

                        VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
                        dayVariableCollection.Parse("DATE", day.ToString());
                        dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year + (month) / 12, (month) % 12 + 1, day));
                    }
                }
                else
                {
                    for (int i = 0; i < 7; i++)
                    {
                        int day = week * 7 + i + 1 - offset;

                        VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
                        dayVariableCollection.Parse("DATE", day.ToString());
                        dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year, month, day));
                    }
                }
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:84,代码来源:Calendar.cs


示例14: BuildDateUri

 internal static string BuildDateUri(Core core, Primitive owner, int year, int month, int day)
 {
     return core.Hyperlink.AppendSid(string.Format("{0}calendar/{1}/{2}/{3}",
         owner.UriStub, year, month, day));
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:5,代码来源:Calendar.cs


示例15: GetTasks

 public List<Task> GetTasks(Core core, Primitive owner, long startTimeRaw, long endTimeRaw)
 {
     return GetTasks(core, owner, startTimeRaw, endTimeRaw, false);
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:4,代码来源:Calendar.cs


示例16: AccountBlogDrafts

 /// <summary>
 /// Initializes a new instance of the AccountBlogDrafts class. 
 /// </summary>
 /// <param name="core">The Core token.</param>
 public AccountBlogDrafts(Core core, Primitive owner)
     : base(core, owner)
 {
     this.Load += new EventHandler(AccountBlogDrafts_Load);
     this.Show += new EventHandler(AccountBlogDrafts_Show);
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:10,代码来源:AccountBlogDrafts.cs


示例17: Network_GetPrimitiveGroups

        public static List<PrimitivePermissionGroup> Network_GetPrimitiveGroups(Core core, Primitive owner)
        {
            List<PrimitivePermissionGroup> ppgs = new List<PrimitivePermissionGroup>();

            if (owner is User)
            {
                List<Network> networks = Network.GetUserNetworks(core, (User)owner);

                foreach (Network network in networks)
                {
                    ppgs.Add(new PrimitivePermissionGroup(network.TypeId, network.Id, network.DisplayName, string.Empty));
                }
            }

            return ppgs;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:16,代码来源:Network.cs


示例18: BuildYearUri

 internal static string BuildYearUri(Core core, Primitive owner, int year)
 {
     return core.Hyperlink.AppendSid(string.Format("{0}calendar/{1}",
         owner.UriStub, year));
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:5,代码来源:Calendar.cs


示例19: Create

        /// <summary>
        /// Creates a new blog for the logged in user.
        /// </summary>
        /// <param name="core"></param>
        /// <returns></returns>
        public static Calendar Create(Core core, Primitive owner)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            InsertQuery iQuery = new InsertQuery(GetTable(typeof(Calendar)));
            iQuery.AddField("calendar_item_id", owner.Id);
            iQuery.AddField("calendar_item_type_id", owner.TypeId);
            iQuery.AddField("calendar_simple_permissions", true);

            long calendarId = core.Db.Query(iQuery);

            Calendar newCalendar = new Calendar(core, owner);

            if (owner is User)
            {
                Access.CreateAllGrantsForOwner(core, newCalendar);
                newCalendar.Access.CreateGrantForPrimitive(Friend.GetFriendsGroupKey(core), "VIEW");
            }
            if (owner is UserGroup)
            {
                newCalendar.Access.CreateGrantForPrimitive(UserGroup.GetGroupOperatorsGroupKey(core), "VIEW", "CREATE_EVENTS", "CREATE_TASKS", "ASSIGN_TASKS", "EDIT_EVENTS", "EDIT_TASKS");
                newCalendar.Access.CreateGrantForPrimitive(UserGroup.GetGroupOfficersGroupKey(core), "VIEW", "CREATE_EVENTS", "CREATE_TASKS", "ASSIGN_TASKS", "EDIT_EVENTS", "EDIT_TASKS");
                newCalendar.Access.CreateGrantForPrimitive(User.GetEveryoneGroupKey(core), "VIEW");
                newCalendar.Access.CreateGrantForPrimitive(User.GetCreatorKey(core), "EDIT_EVENTS", "EDIT_TASKS");
            }

            return newCalendar;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:36,代码来源:Calendar.cs


示例20: showDayEvents

        private static void showDayEvents(Core core, Primitive owner, int year, int month, int day, VariableCollection weekVariableCollection, List<Event> events)
        {
            VariableCollection dayVariableCollection = weekVariableCollection.CreateChild("day");
            dayVariableCollection.Parse("DATE", day.ToString());
            dayVariableCollection.Parse("URI", Calendar.BuildDateUri(core, owner, year, month, day));

            DateTime now = core.Tz.Now;
            if (year == now.Year && month == now.Month && day == now.Day)
            {
                dayVariableCollection.Parse("CLASS", "today");
            }

            bool hasEvents = false;

            List<Event> expired = new List<Event>();
            foreach (Event calendarEvent in events)
            {
                // if the event starts after the end of the day, skip this day
                if (calendarEvent.GetStartTime(core.Tz).CompareTo(new DateTime(year, month, day, 23, 59, 59)) > 0)
                {
                    break;
                }

                VariableCollection eventVariableCollection = dayVariableCollection.CreateChild("event");

                eventVariableCollection.Parse("TITLE", calendarEvent.Subject);
                if (calendarEvent.GetStartTime(core.Tz).Day != day)
                {
                    eventVariableCollection.Parse("START_TIME", calendarEvent.GetStartTime(core.Tz).ToString("d MMMM h:mmt").ToLower());
                }
                else
                {
                    eventVariableCollection.Parse("START_TIME", calendarEvent.GetStartTime(core.Tz).ToString("h:mmt").ToLower());
                }
                eventVariableCollection.Parse("URI", calendarEvent.Uri);

                if (calendarEvent is BirthdayEvent)
                {
                    BirthdayEvent birthdayEvent = (BirthdayEvent)calendarEvent;

                    eventVariableCollection.Parse("BIRTH_DATE", birthdayEvent.User.Profile.DateOfBirth.Day + " " + core.Tz.MonthToString(birthdayEvent.User.Profile.DateOfBirth.Month));
                }

                hasEvents = true;

                // if the event ends before the end of the day, finish up the event
                if (calendarEvent.GetEndTime(core.Tz).CompareTo(new DateTime(year, month, day, 23, 59, 59)) <= 0)
                {
                    expired.Add(calendarEvent);
                }
            }

            if (hasEvents)
            {
                dayVariableCollection.Parse("EVENTS", "TRUE");
            }

            foreach (Event calendarEvent in expired)
            {
                events.Remove(calendarEvent);
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:62,代码来源:Calendar.cs



注:本文中的BoxSocial.Internals.Primitive类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Internals.User类代码示例发布时间:2022-05-24
下一篇:
C# Internals.ItemKey类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap