当前位置: 首页>>代码示例>>C#>>正文


C# ColumnCollection.RegistryColumn方法代码示例

本文整理汇总了C#中ColumnCollection.RegistryColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnCollection.RegistryColumn方法的具体用法?C# ColumnCollection.RegistryColumn怎么用?C# ColumnCollection.RegistryColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColumnCollection的用法示例。


在下文中一共展示了ColumnCollection.RegistryColumn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUserViewSettings

        public List<UserViewSettings> GetUserViewSettings(Guid userId, List<string> calendarIds)
        {
            var cc = new ColumnCollection();

            var extCalId = cc.RegistryColumn("ext_calendar_id");
            var usrId = cc.RegistryColumn("user_id");
            var hideEvents = cc.RegistryColumn("hide_events");
            var isAccepted = cc.RegistryColumn("is_accepted");
            var textColor = cc.RegistryColumn("text_color");
            var background = cc.RegistryColumn("background_color");
            var alertType = cc.RegistryColumn("alert_type");
            var calId = cc.RegistryColumn("calendar_id");
            var calName = cc.RegistryColumn("name");
            var timeZone = cc.RegistryColumn("time_zone");

            var data = DbManager
               .ExecuteList(
               new SqlQuery("calendar_calendar_user").Select(cc.SelectQuery)
                   .Where((Exp.In(extCalId.Name, calendarIds) | Exp.In(calId.Name, calendarIds)) & Exp.Eq(usrId.Name, userId))
                   );

            var options = new List<UserViewSettings>();
            foreach (var r in data)
            {
                options.Add(new UserViewSettings()
                {
                    CalendarId = Convert.ToInt32(r[calId.Ind]) == 0 ? Convert.ToString(r[extCalId.Ind]) : Convert.ToString(r[calId.Ind]),
                    UserId = usrId.Parse<Guid>(r),
                    IsHideEvents = hideEvents.Parse<bool>(r),
                    IsAccepted = isAccepted.Parse<bool>(r),
                    TextColor = textColor.Parse<string>(r),
                    BackgroundColor = background.Parse<string>(r),
                    EventAlertType = (EventAlertType)alertType.Parse<int>(r),
                    Name = calName.Parse<string>(r),
                    TimeZone = timeZone.Parse<TimeZoneInfo>(r)
                });
            }

            return options;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:40,代码来源:DataProvider.cs

示例2: UpdateEventNotifications

        private void UpdateEventNotifications(int eventId, int calendarId, DateTime eventUtcStartDate, EventAlertType baseEventAlertType, RecurrenceRule rrule,
            IEnumerable<ASC.Web.Core.Calendars.SharingOptions.PublicItem> eventPublicItems,
            IEnumerable<ASC.Web.Core.Calendars.SharingOptions.PublicItem> calendarPublicItems)
        {
            var cc = new ColumnCollection();
            var userIdCol = cc.RegistryColumn("user_id");
            var alertTypeCol = cc.RegistryColumn("alert_type");
            var isUnsubscribeCol = cc.RegistryColumn("is_unsubscribe");

            var eventUsersData = DbManager.ExecuteList(new SqlQuery("calendar_event_user").Select(cc.SelectQuery).Where(Exp.Eq("event_id", eventId)));

            var calendarData = DbManager.ExecuteList(new SqlQuery("calendar_calendars").Select("alert_type", "owner_id", "time_zone").Where(Exp.Eq("id", calendarId)));
            var calendarAlertType = calendarData.Select(r => (EventAlertType)Convert.ToInt32(r[0])).First();
            Guid calendarOwner = calendarData.Select(r => new Guid(Convert.ToString(r[1]))).First();
            TimeZoneInfo calendarTimeZone = calendarData.Select(r => TimeZoneConverter.GetTimeZone(Convert.ToString(r[2]))).First();

            List<UserAlertType> eventUsers = new List<UserAlertType>();

            #region shared event's data

            if (eventPublicItems == null)
            {
                eventPublicItems = new List<SharingOptions.PublicItem>(DbManager.ExecuteList(new SqlQuery("calendar_event_item").Select("item_id", "is_group").Where(Exp.Eq("event_id", eventId)))
                                                                       .Select(r => new ASC.Web.Core.Calendars.SharingOptions.PublicItem() { Id = new Guid(Convert.ToString(r[0])), IsGroup = Convert.ToBoolean(r[1]) }));
            }

            foreach (var item in eventPublicItems)
            {
                if (item.IsGroup)
                    eventUsers.AddRange(CoreContext.UserManager.GetUsersByGroup(item.Id).Select(u => new UserAlertType(u.ID, baseEventAlertType, calendarTimeZone)));
                else
                    eventUsers.Add(new UserAlertType(item.Id, baseEventAlertType, calendarTimeZone));
            }

            //remove calendar owner
            eventUsers.RemoveAll(u => u.UserId.Equals(calendarOwner));

            //remove unsubscribed and exec personal alert_type
            if (eventUsers.Count > 0)
            {
                foreach (var r in eventUsersData)
                {
                    if (isUnsubscribeCol.Parse<bool>(r))
                        eventUsers.RemoveAll(u => u.UserId.Equals(userIdCol.Parse<Guid>(r)));
                    else
                        eventUsers.ForEach(u =>
                        {
                            if (u.UserId.Equals(userIdCol.Parse<Guid>(r)))
                                u.AlertType = (EventAlertType)alertTypeCol.Parse<int>(r);
                        });

                }
            }

            //remove and exec sharing calendar options
            if (eventUsers.Count > 0)
            {
                var extCalendarAlertTypes = DbManager.ExecuteList(new SqlQuery("calendar_calendar_user cu")
                                                        .Select("cu.user_id", "cu.alert_type", "cu.is_accepted", "cu.time_zone")
                                                        .Where(Exp.Eq("cu.ext_calendar_id", SharedEventsCalendar.CalendarId) & Exp.In("cu.user_id", eventUsers.Select(u => u.UserId).ToArray())));

                foreach (var r in extCalendarAlertTypes)
                {
                    if (!Convert.ToBoolean(r[2]))
                    {
                        //remove unsubscribed from shared events calendar
                        eventUsers.RemoveAll(u => u.UserId.Equals(new Guid(Convert.ToString(r[0]))));
                        continue;
                    }
                    eventUsers.ForEach(u =>
                    {
                        if (u.UserId.Equals(new Guid(Convert.ToString(r[0]))))
                            u.TimeZone = ((r[3] == null || r[3] == DBNull.Value) ? calendarTimeZone : TimeZoneConverter.GetTimeZone(Convert.ToString(r[3])));

                        if (u.AlertType == EventAlertType.Default && u.UserId.Equals(new Guid(Convert.ToString(r[0]))))
                            u.AlertType = (EventAlertType)Convert.ToInt32(r[1]);
                    });
                };

                eventUsers.ForEach(u =>
                {
                    if (u.AlertType == EventAlertType.Default)
                        u.AlertType = EventAlertType.Hour;
                });

            }
            #endregion

            #region calendar's data

            if (calendarPublicItems == null)
            {
                calendarPublicItems = new List<SharingOptions.PublicItem>(DbManager.ExecuteList(new SqlQuery("calendar_calendar_item").Select("item_id", "is_group").Where(Exp.Eq("calendar_id", calendarId)))
                                                                       .Select(r => new ASC.Web.Core.Calendars.SharingOptions.PublicItem() { Id = new Guid(Convert.ToString(r[0])), IsGroup = Convert.ToBoolean(r[1]) }));
            }

            //calendar users
            List<UserAlertType> calendarUsers = new List<UserAlertType>();
            foreach (var item in eventPublicItems)
            {
//.........这里部分代码省略.........
开发者ID:vipwan,项目名称:CommunityServer,代码行数:101,代码来源:DataProvider.cs

示例3: GetEventsByIds

        public List<Event> GetEventsByIds(object[] evtIds, Guid userId)
        {
            var cc = new ColumnCollection();
            var eId = cc.RegistryColumn("evt.id");
            var eName = cc.RegistryColumn("evt.name");
            var eDescription = cc.RegistryColumn("evt.description");
            var eTenant = cc.RegistryColumn("evt.tenant");
            var eCalId = cc.RegistryColumn("evt.calendar_id");
            var eStartDate = cc.RegistryColumn("evt.start_date");
            var eEndDate = cc.RegistryColumn("evt.end_date");
            var eIsAllDay = cc.RegistryColumn("evt.all_day_long");
            var eRRule = cc.RegistryColumn("evt.rrule");
            var eOwner = cc.RegistryColumn("evt.owner_id");
            var usrAlertType = cc.RegistryColumn("evt_usr.alert_type");
            var eAlertType = cc.RegistryColumn("evt.alert_type");

            var data = DbManager.ExecuteList(new SqlQuery(_eventTable)
                .LeftOuterJoin("calendar_event_user evt_usr", Exp.EqColumns(eId.Name, "evt_usr.event_id") & Exp.Eq("evt_usr.user_id", userId))
                                .Select(cc.SelectQuery).Where(Exp.In(eId.Name, evtIds)));

            var cc1 = new ColumnCollection();
            var evId = cc1.RegistryColumn("evt_itm.event_id");
            var itemId = cc1.RegistryColumn("evt_itm.item_id");
            var itemIsGroup = cc1.RegistryColumn("evt_itm.is_group");

            var sharingData = DbManager.ExecuteList(new SqlQuery(_eventItemTable).Select(cc1.SelectQuery)
                                                        .Where(Exp.In(evId.Name, evtIds)));

            //parsing           
            var events = new List<Event>();

            foreach (var r in data)
            {
                var ev = events.Find(e => String.Equals(e.Id, eId.Parse<string>(r), StringComparison.InvariantCultureIgnoreCase));
                if (ev == null)
                {
                    ev = new Event()
                    {
                        Id = eId.Parse<string>(r),
                        Name = eName.Parse<string>(r),
                        Description = eDescription.Parse<string>(r),
                        TenantId = eTenant.Parse<int>(r),
                        CalendarId = eCalId.Parse<string>(r),
                        UtcStartDate = eStartDate.Parse<DateTime>(r),
                        UtcEndDate = eEndDate.Parse<DateTime>(r),
                        AllDayLong = eIsAllDay.Parse<bool>(r),
                        OwnerId = eOwner.Parse<Guid>(r),
                        AlertType = (usrAlertType.IsNull(r)) ? (EventAlertType)eAlertType.Parse<int>(r) : (EventAlertType)usrAlertType.Parse<int>(r),
                        RecurrenceRule = eRRule.Parse<RecurrenceRule>(r)

                    };
                    events.Add(ev);
                }

                foreach (var row in sharingData)
                {
                    if (String.Equals(evId.Parse<string>(row), ev.Id, StringComparison.InvariantCultureIgnoreCase))
                    {
                        ev.SharingOptions.PublicItems.Add(new ASC.Web.Core.Calendars.SharingOptions.PublicItem()
                        {
                            Id = itemId.Parse<Guid>(row),
                            IsGroup = itemIsGroup.Parse<bool>(row)
                        });
                    }
                }
            }
            return events;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:68,代码来源:DataProvider.cs

示例4: UpdateCalendarUserView

        public void UpdateCalendarUserView(UserViewSettings viewSettings)
        {
            int calendarId;
            var cc = new ColumnCollection();
            var eId = cc.RegistryColumn("e.id");
            var eStartDate = cc.RegistryColumn("e.start_date");
            var eAlertType = cc.RegistryColumn("e.alert_type");
            var eRRule = cc.RegistryColumn("e.rrule");
            var eCalId = cc.RegistryColumn("e.calendar_id");

            if (int.TryParse(viewSettings.CalendarId, out calendarId))
            {
                DbManager.ExecuteNonQuery(new SqlInsert("calendar_calendar_user", true)
                                                        .InColumnValue("calendar_id", calendarId)
                                                        .InColumnValue("user_id", viewSettings.UserId)
                                                        .InColumnValue("hide_events", viewSettings.IsHideEvents)
                                                        .InColumnValue("text_color", viewSettings.TextColor)
                                                        .InColumnValue("background_color", viewSettings.BackgroundColor)
                                                        .InColumnValue("is_accepted", viewSettings.IsAccepted)
                                                        .InColumnValue("alert_type", (int)viewSettings.EventAlertType)
                                                        .InColumnValue("name", viewSettings.Name ?? "")
                                                        .InColumnValue("time_zone", viewSettings.TimeZone != null ? viewSettings.TimeZone.Id : null)
                                                        );



                //update notifications
                var eventsData = DbManager.ExecuteList(
                    new SqlQuery("calendar_events e")
                    .Select(cc.SelectQuery)
                    .Where("e.calendar_id", calendarId)
                    .Where("e.tenant", CoreContext.TenantManager.GetCurrentTenant().TenantId));

                foreach (var r in eventsData)
                {
                    UpdateEventNotifications(eId.Parse<int>(r), calendarId,
                                            eStartDate.Parse<DateTime>(r),
                                           (EventAlertType)eAlertType.Parse<int>(r),
                                           eRRule.Parse<RecurrenceRule>(r), null, null);
                }

            }
            else
            {
                DbManager.ExecuteNonQuery(new SqlInsert("calendar_calendar_user", true)
                                                        .InColumnValue("ext_calendar_id", viewSettings.CalendarId)
                                                        .InColumnValue("user_id", viewSettings.UserId)
                                                        .InColumnValue("hide_events", viewSettings.IsHideEvents)
                                                        .InColumnValue("text_color", viewSettings.TextColor)
                                                        .InColumnValue("background_color", viewSettings.BackgroundColor)
                                                        .InColumnValue("alert_type", (int)viewSettings.EventAlertType)
                                                        .InColumnValue("is_accepted", viewSettings.IsAccepted)
                                                        .InColumnValue("name", viewSettings.Name ?? "")
                                                        .InColumnValue("time_zone", viewSettings.TimeZone != null ? viewSettings.TimeZone.Id : null)
                                                        );

                if (String.Equals(viewSettings.CalendarId, SharedEventsCalendar.CalendarId, StringComparison.InvariantCultureIgnoreCase))
                {
                    //update notifications
                    var groups = CoreContext.UserManager.GetUserGroups(viewSettings.UserId).Select(g => g.ID).ToList();
                    groups.AddRange(CoreContext.UserManager.GetUserGroups(viewSettings.UserId, ASC.Core.Users.Constants.SysGroupCategoryId).Select(g => g.ID));

                    var q = new SqlQuery("calendar_events e")
                        .Select(cc.SelectQuery)
                        .InnerJoin("calendar_event_item ei", Exp.EqColumns("ei.event_id", eId.Name))
                        .Where("e.tenant", CoreContext.TenantManager.GetCurrentTenant().TenantId)
                        .Where((Exp.Eq("ei.is_group", false) & Exp.Eq("ei.item_id", viewSettings.UserId)) | (Exp.Eq("ei.is_group", true) & Exp.In("ei.item_id", groups.ToArray())));
                    var eventsData = DbManager.ExecuteList(q);

                    foreach (var r in eventsData)
                    {
                        UpdateEventNotifications(eId.Parse<int>(r), eCalId.Parse<int>(r),
                                                 eStartDate.Parse<DateTime>(r),
                                                 (EventAlertType)eAlertType.Parse<int>(r),
                                                 eRRule.Parse<RecurrenceRule>(r), null, null);
                    }
                }
            }
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:79,代码来源:DataProvider.cs

示例5: UpdateCalendar

        public Calendar UpdateCalendar(int calendarId, string name, string description, List<SharingOptions.PublicItem> publicItems, List<UserViewSettings> viewSettings)
        {
            using (var tr = DbManager.BeginTransaction())
            {

                DbManager.ExecuteNonQuery(new SqlUpdate("calendar_calendars")
                                                    .Set("name", name)
                                                    .Set("description", description)
                                                    .Where("id", calendarId));

                //sharing
                DbManager.ExecuteNonQuery(new SqlDelete("calendar_calendar_item").Where("calendar_id", calendarId));
                foreach (var item in publicItems)
                {
                    DbManager.ExecuteNonQuery(new SqlInsert("calendar_calendar_item")
                                                .InColumnValue("calendar_id", calendarId)
                                                .InColumnValue("item_id", item.Id)
                                                .InColumnValue("is_group", item.IsGroup));
                }

                //view
                DbManager.ExecuteNonQuery(new SqlDelete("calendar_calendar_user").Where("calendar_id", calendarId));
                foreach (var view in viewSettings)
                {
                    DbManager.ExecuteNonQuery(new SqlInsert("calendar_calendar_user")
                                                .InColumnValue("calendar_id", calendarId)
                                                .InColumnValue("user_id", view.UserId)
                                                .InColumnValue("hide_events", view.IsHideEvents)
                                                .InColumnValue("is_accepted", view.IsAccepted)
                                                .InColumnValue("text_color", view.TextColor)
                                                .InColumnValue("background_color", view.BackgroundColor)
                                                .InColumnValue("alert_type", (int)view.EventAlertType)
                                                .InColumnValue("name", view.Name ?? "")
                                                .InColumnValue("time_zone", view.TimeZone != null ? view.TimeZone.Id : null)
                                                );

                }

                //update notifications
                var cc = new ColumnCollection();
                var eId = cc.RegistryColumn("e.id");
                var eStartDate = cc.RegistryColumn("e.start_date");
                var eAlertType = cc.RegistryColumn("e.alert_type");
                var eRRule = cc.RegistryColumn("e.rrule");

                var eventsData = DbManager.ExecuteList(
                    new SqlQuery("calendar_events e")
                    .Select(cc.SelectQuery)
                    .Where("e.calendar_id", calendarId)
                    .Where("e.tenant", CoreContext.TenantManager.GetCurrentTenant().TenantId));

                foreach (var r in eventsData)
                {
                    UpdateEventNotifications(eId.Parse<int>(r), calendarId,
                                             eStartDate.Parse<DateTime>(r),
                                            (EventAlertType)eAlertType.Parse<int>(r),
                                             eRRule.Parse<RecurrenceRule>(r), null, publicItems);
                }

                tr.Commit();
            }

            return GetCalendarById(calendarId);
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:64,代码来源:DataProvider.cs

示例6: GetCalendarsByIds

        public List<Calendar> GetCalendarsByIds(object[] calIds)
        {
            var cc = new ColumnCollection();

            var calId = cc.RegistryColumn("cal.id");
            var calName = cc.RegistryColumn("cal.name");
            var calDescription = cc.RegistryColumn("cal.description");
            var calTenant = cc.RegistryColumn("cal.tenant");
            var calTextColor = cc.RegistryColumn("cal.text_color");
            var calBackground = cc.RegistryColumn("cal.background_color");
            var calOwner = cc.RegistryColumn("cal.owner_id");
            var calAlertType = cc.RegistryColumn("cal.alert_type");
            var calTimeZone = cc.RegistryColumn("cal.time_zone");
            var iCalUrl = cc.RegistryColumn("cal.ical_url");

            var usrId = cc.RegistryColumn("cal_usr.user_id");
            var usrHideEvents = cc.RegistryColumn("cal_usr.hide_events");
            var usrIsAccepted = cc.RegistryColumn("cal_usr.is_accepted");
            var usrTextColor = cc.RegistryColumn("cal_usr.text_color");
            var usrBackground = cc.RegistryColumn("cal_usr.background_color");
            var usrAlertType = cc.RegistryColumn("cal_usr.alert_type");
            var usrCalName = cc.RegistryColumn("cal_usr.name");
            var usrTimeZone = cc.RegistryColumn("cal_usr.time_zone");

            var data = DbManager.ExecuteList(new SqlQuery(_calendarTable).Select(cc.SelectQuery)
                                            .LeftOuterJoin(_calendarUserTable, Exp.EqColumns(calId.Name, "cal_usr.calendar_id"))
                                            .Where(Exp.In(calId.Name, calIds)));

            var cc1 = new ColumnCollection();

            var itemCalId = cc1.RegistryColumn("cal_itm.calendar_id");
            var itemId = cc1.RegistryColumn("cal_itm.item_id");
            var itemIsGroup = cc1.RegistryColumn("cal_itm.is_group");

            var sharingData = DbManager.ExecuteList(new SqlQuery(_calendarItemTable).Select(cc1.SelectQuery)
                                                    .Where(Exp.In(itemCalId.Name, calIds)));


            //parsing
            var calendars = new List<Calendar>();
            foreach (var r in data)
            {
                var calendar = calendars.Find(c => string.Equals(c.Id, calId.Parse<int>(r).ToString(), StringComparison.InvariantCultureIgnoreCase));
                if (calendar == null)
                {
                    calendar = new Calendar()
                    {
                        Id = calId.Parse<int>(r).ToString(),
                        Name = calName.Parse<string>(r),
                        Description = calDescription.Parse<string>(r),
                        TenantId = calTenant.Parse<int>(r),
                        OwnerId = calOwner.Parse<Guid>(r),
                        EventAlertType = (EventAlertType)calAlertType.Parse<int>(r),
                        TimeZone = calTimeZone.Parse<TimeZoneInfo>(r),
                        iCalUrl = iCalUrl.Parse<string>(r),
                    };
                    calendar.Context.HtmlTextColor = calTextColor.Parse<string>(r);
                    calendar.Context.HtmlBackgroundColor = calBackground.Parse<string>(r);
                    if (!String.IsNullOrEmpty(calendar.iCalUrl))
                    {
                        calendar.Context.CanChangeTimeZone = false;
                        calendar.Context.CanChangeAlertType = false;
                    }

                    calendars.Add(calendar);

                    foreach (var row in sharingData)
                    {
                        var _calId = itemCalId.Parse<int>(row).ToString();
                        if (String.Equals(_calId, calendar.Id, StringComparison.InvariantCultureIgnoreCase))
                        {
                            calendar.SharingOptions.PublicItems.Add(new ASC.Web.Core.Calendars.SharingOptions.PublicItem()
                            {
                                Id = itemId.Parse<Guid>(row),
                                IsGroup = itemIsGroup.Parse<bool>(row)
                            });
                        }
                    }
                }

                if (!usrId.IsNull(r))
                {
                    var uvs = new UserViewSettings()
                    {
                        CalendarId = calendar.Id.ToString(),
                        UserId = usrId.Parse<Guid>(r),
                        IsHideEvents = usrHideEvents.Parse<bool>(r),
                        IsAccepted = usrIsAccepted.Parse<bool>(r),
                        TextColor = usrTextColor.Parse<string>(r),
                        BackgroundColor = usrBackground.Parse<string>(r),
                        EventAlertType = (EventAlertType)usrAlertType.Parse<int>(r),
                        Name = usrCalName.Parse<string>(r),
                        TimeZone = usrTimeZone.Parse<TimeZoneInfo>(r)
                    };

                    calendar.ViewSettings.Add(uvs);
                }
            }

            return calendars;
//.........这里部分代码省略.........
开发者ID:vipwan,项目名称:CommunityServer,代码行数:101,代码来源:DataProvider.cs

示例7: ExtractAndRecountNotifications

        public List<EventNotificationData> ExtractAndRecountNotifications(DateTime utcDate)
        {
            var data = new List<EventNotificationData>();

            using (var tr = DbManager.BeginTransaction())
            {
                var cc = new ColumnCollection();
                var userIdCol = cc.RegistryColumn("user_id");
                var tenantCol = cc.RegistryColumn("tenant");
                var eventIdCol = cc.RegistryColumn("event_id");
                var notifyDateCol = cc.RegistryColumn("notify_date");
                var rruleCol = cc.RegistryColumn("rrule");
                var alertTypeCol = cc.RegistryColumn("alert_type");
                var timeZoneCol = cc.RegistryColumn("time_zone");

                data = new List<EventNotificationData>(DbManager.ExecuteList(new SqlQuery("calendar_notifications").Select(cc.SelectQuery)
                                      .Where(Exp.Between(notifyDateCol.Name, utcDate.AddDays(-1), utcDate.AddDays(1))))
                                      .Select(r => new EventNotificationData()
                                      {
                                          UserId = userIdCol.Parse<Guid>(r),
                                          TenantId = tenantCol.Parse<int>(r),
                                          EventId = eventIdCol.Parse<int>(r),
                                          NotifyUtcDate = notifyDateCol.Parse<DateTime>(r),
                                          RRule = rruleCol.Parse<RecurrenceRule>(r),
                                          AlertType = (EventAlertType)alertTypeCol.Parse<int>(r),
                                          TimeZone = timeZoneCol.Parse<TimeZoneInfo>(r)
                                      }));


                var events = GetEventsByIds(data.Select(d => (object)d.EventId).Distinct().ToArray(), Guid.Empty);
                data.ForEach(d => d.Event = events.Find(e => String.Equals(e.Id, d.EventId.ToString(), StringComparison.InvariantCultureIgnoreCase)));
                data = data.Where(r => (r.Event.AllDayLong ? r.GetUtcStartDate() : r.NotifyUtcDate) <= utcDate).ToList();

                foreach (var d in data)
                {
                    if (d.RRule.Freq == Frequency.Never)
                        DbManager.ExecuteNonQuery(new SqlDelete("calendar_notifications").Where(Exp.Eq("user_id", d.UserId) & Exp.Eq("event_id", d.EventId)));
                    else
                    {
                        var alertDate = GetNextAlertDate(d.Event.UtcStartDate, d.RRule, d.AlertType, d.TimeZone);
                        if (!alertDate.Equals(DateTime.MinValue))
                        {
                            DbManager.ExecuteNonQuery(new SqlInsert("calendar_notifications", true).InColumnValue("user_id", d.UserId)
                                                                                             .InColumnValue("event_id", d.EventId)
                                                                                             .InColumnValue("rrule", d.RRule.ToString())
                                                                                             .InColumnValue("alert_type", (int)d.AlertType)
                                                                                             .InColumnValue("tenant", d.TenantId)
                                                                                             .InColumnValue("notify_date", alertDate)
                                                                                             .InColumnValue("time_zone", d.TimeZone.Id));
                        }
                        else
                            DbManager.ExecuteNonQuery(new SqlDelete("calendar_notifications").Where(Exp.Eq("user_id", d.UserId) & Exp.Eq("event_id", d.EventId)));
                    }
                }

                tr.Commit();
            }


            return data;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:61,代码来源:DataProvider.cs


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