public ActionResult EditRecurringEvent(int id = 0)
        {
            List <EventLocation> locations = this._db.Query <EventLocation>("SELECT * FROM ec_locations").ToList();

            locations.Insert(0, new EventLocation()
            {
                LocationName = "No Location", Id = 0
            });

            var e = _db.Single <RecurringEvent>(id);

            //Create SelectList with selected location
            SelectList list = new SelectList(locations, "Id", "LocationName", e.locationId);

            EditRecurringEventModel ere = new EditRecurringEventModel()
            {
                title            = e.title,
                description      = e.description,
                allDay           = e.allDay,
                id               = e.Id,
                day              = (DayOfWeekEnum)e.day,
                frequency        = (FrequencyTypeEnum)e.frequency,
                monthly          = (MonthlyIntervalEnum)e.monthly_interval,
                calendar         = e.calendarId,
                locations        = list,
                selectedLocation = e.locationId
            };

            return(PartialView(ere));
        }
Esempio n. 2
0
        public void FlagMigrationAsFinished(IUmbracoMigration migration)
        {
            var migrationName = migration.GetType().Name;

            var migrationHistory = UmbracoDatabase.Single <MigrationHistory>("WHERE Name = @Name", new { Name = migrationName });

            migrationHistory.Completed = true;
            UmbracoDatabase.Update(migrationHistory);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the audit log detail for one entry
        /// </summary>
        /// <param name="id">The Id of the row</param>
        /// <returns>A detail record</returns>
        public LogEntryDetail GetLogDetail(int id)
        {
            const string sql = @"SELECT L.Id, L.NodeId as NodeId, CT.icon as Icon, N.[text] as Name, U.id as UserId, U.userName as UserName, U.userEmail as UserEmail, 
			L.Datestamp as DateStamp, L.logHeader as LogType, L.logComment as Comment, 
			CT.Alias as Alias, CT.[description] as Description, L.nodeId  
			FROM umbracoLog L 
			LEFT JOIN umbracoUser U ON L.userId = U.id
			LEFT JOIN cmsDocument D ON L.NodeId = D.nodeId
			LEFT JOIN umbracoNode N ON N.id = L.nodeId
			LEFT JOIN cmsContent C ON C.nodeId = L.nodeId
			LEFT JOIN cmsContentType CT ON C.contentType = CT.nodeId
			WHERE L.Id = @0
			AND (D.newest = 1 OR D.newest IS NULL)"            ;

            return(db.Single <LogEntryDetail>(sql, id));
        }
        public ActionResult EditRecurringEvent(int id = 0)
        {
            List <EventLocation> locations = this._db.Query <EventLocation>("SELECT * FROM ec_locations").ToList();

            locations.Insert(0, new EventLocation()
            {
                LocationName = "No Location", Id = 0
            });

            var e = _db.Single <RecurringEvent>(id);

            //Create SelectList with selected location
            SelectList list = new SelectList(locations, "Id", "LocationName", e.locationId);

            EditRecurringEventModel ere = new EditRecurringEventModel()
            {
                title            = e.title,
                allDay           = e.allDay,
                id               = e.Id,
                day              = (DayOfWeekEnum)e.day,
                frequency        = (FrequencyTypeEnum)e.frequency,
                monthly          = (MonthlyIntervalEnum)e.monthly_interval,
                calendar         = e.calendarId,
                locations        = list,
                selectedLocation = e.locationId
            };

            //Get Descriptions for Event
            Dictionary <string, EventDesciption> descriptions = this._db.Query <EventDesciption>("SELECT * FROM ec_eventdescriptions WHERE eventid = @0 AND type = 1 AND calendarid = @1", id, e.calendarId).ToDictionary(x => x.CultureCode);
            List <ILanguage> languages = Services.LocalizationService.GetAllLanguages().ToList();

            foreach (var lang in languages)
            {
                if (!descriptions.ContainsKey(lang.CultureInfo.ToString()))
                {
                    descriptions.Add(lang.CultureInfo.ToString(), new EventDesciption()
                    {
                        CultureCode = lang.CultureInfo.ToString(), EventId = ere.id, Id = 0, Type = (int)EventType.Recurring, CalendarId = ere.calendar
                    });
                }
            }
            ere.Descriptions = descriptions;

            return(PartialView(ere));
        }
Esempio n. 5
0
        public CustomMember GetMemberById(Guid id)
        {
            var member = _db.Single <CustomMember>("SELECT TOP 1 * FROM CustomMembers WHERE Id = @0", id);

            return(member);
        }