Inheritance: Lava.ILiquidizable
コード例 #1
0
ファイル: CheckInPerson.cs プロジェクト: waldo2590/Rock
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckInPersonSummary"/> class.
 /// </summary>
 /// <param name="schedule">The schedule.</param>
 /// <param name="groupType">Type of the group.</param>
 /// <param name="group">The group.</param>
 /// <param name="location">The location.</param>
 public CheckInPersonSummary(CheckInSchedule schedule, CheckInGroupType groupType, CheckInGroup group, CheckInLocation location)
 {
     Schedule  = schedule;
     GroupType = groupType;
     Group     = group;
     Location  = location;
 }
コード例 #2
0
ファイル: CheckInPerson.cs プロジェクト: waldo2590/Rock
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckInPersonSummary" /> class.
        /// </summary>
        /// <param name="label">The label.</param>
        /// <param name="schedule">The schedule.</param>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="group">The group.</param>
        /// <param name="location">The location.</param>
        public CheckInPersonSummary(KioskLabel label, CheckInSchedule schedule, CheckInGroupType groupType, CheckInGroup group, CheckInLocation location)
            : this(schedule, groupType, group, location)
        {
            if (groupType != null && groupType.GroupType != null && label != null)
            {
                if (groupType.GroupType.Attributes == null)
                {
                    // shouldn't happen since GroupType is a ModelCache<,> type
                    return;
                }

                foreach (var attribute in groupType.GroupType.Attributes.OrderBy(a => a.Value.Order))
                {
                    if (attribute.Value.FieldType.Guid == SystemGuid.FieldType.LABEL.AsGuid())
                    {
                        Guid?binaryFileGuid = groupType.GroupType.GetAttributeValue(attribute.Key).AsGuidOrNull();
                        if (binaryFileGuid.HasValue && binaryFileGuid.Value == label.Guid)
                        {
                            GroupTypeConfiguredForLabel = true;
                            break;
                        }
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckInPersonSummary" /> class.
        /// </summary>
        /// <param name="label">The label.</param>
        /// <param name="schedule">The schedule.</param>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="group">The group.</param>
        /// <param name="location">The location.</param>
        public CheckInPersonSummary(KioskLabel label, CheckInSchedule schedule, CheckInGroupType groupType, CheckInGroup group, CheckInLocation location)
            : this(schedule, groupType, group, location)
        {
            if (groupType != null && groupType.GroupType != null && label != null)
            {
                if (groupType.GroupType.Attributes == null)
                {
                    groupType.GroupType.LoadAttributes();
                }

                foreach (var attribute in groupType.GroupType.Attributes.OrderBy(a => a.Value.Order))
                {
                    if (attribute.Value.FieldType.Guid == SystemGuid.FieldType.BINARY_FILE.AsGuid() &&
                        attribute.Value.QualifierValues.ContainsKey("binaryFileType") &&
                        attribute.Value.QualifierValues["binaryFileType"].Value.Equals(SystemGuid.BinaryFiletype.CHECKIN_LABEL, StringComparison.OrdinalIgnoreCase))
                    {
                        Guid?binaryFileGuid = groupType.GroupType.GetAttributeValue(attribute.Key).AsGuidOrNull();
                        if (binaryFileGuid.HasValue && binaryFileGuid.Value == label.Guid)
                        {
                            GroupTypeConfiguredForLabel = true;
                            break;
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: CheckInPerson.cs プロジェクト: waldo2590/Rock
        /// <summary>
        /// Gets the available group types.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        /// <returns></returns>
        public List <CheckInGroupType> GetAvailableGroupTypes(CheckInSchedule schedule)
        {
            var groupTypes = GroupTypes.Where(t => !t.ExcludedByFilter);

            if (schedule != null)
            {
                groupTypes = groupTypes.Where(t => t.AvailableForSchedule.Contains(schedule.Schedule.Id));
            }
            return(groupTypes.ToList());
        }
コード例 #5
0
ファイル: CheckInGroup.cs プロジェクト: SparkDevNetwork/Rock
        /// <summary>
        /// Gets the available locations.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        /// <returns></returns>
        public List <CheckInLocation> GetAvailableLocations(CheckInSchedule schedule)
        {
            var locations = Locations.Where(t => !t.ExcludedByFilter);

            if (schedule != null)
            {
                locations = locations.Where(t => t.AvailableForSchedule.Contains(schedule.Schedule.Id));
            }
            return(locations.ToList());
        }
コード例 #6
0
ファイル: LoadSchedules.cs プロジェクト: pkdevbox/Rock
        /// <summary>
        /// Executes the specified workflow.
        /// </summary>
        /// <param name="action">The workflow action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public override bool Execute( Model.WorkflowAction action, Object entity, out List<string> errorMessages )
        {
            var checkInState = GetCheckInState( entity, out errorMessages );
            if ( checkInState != null )
            {

                bool loadAll = false;
                if ( bool.TryParse( GetAttributeValue( action, "LoadAll" ), out loadAll ) && loadAll )
                {
                    loadAll = true;
                }

                 foreach ( var family in checkInState.CheckIn.Families.Where( f => f.Selected ).ToList() )
                 {
                     foreach ( var person in family.People.Where( p => p.Selected ).ToList() )
                     {
                         foreach ( var groupType in person.GroupTypes.Where( g => g.Selected || loadAll ).ToList() )
                         {
                             var kioskGroupType = checkInState.Kiosk.FilteredGroupTypes( checkInState.ConfiguredGroupTypes ) .Where( g => g.GroupType.Id == groupType.GroupType.Id ).FirstOrDefault();
                             if ( kioskGroupType != null )
                             {
                                 foreach ( var group in groupType.Groups.Where( g => g.Selected || loadAll ).ToList() )
                                 {
                                     foreach ( var location in group.Locations.Where( l => l.Selected || loadAll ).ToList() )
                                     {
                                         var kioskGroup = kioskGroupType.KioskGroups.Where( g => g.Group.Id == group.Group.Id ).FirstOrDefault();
                                         if ( kioskGroup != null )
                                         {
                                             var kioskLocation = kioskGroup.KioskLocations.Where( l => l.Location.Id == location.Location.Id ).FirstOrDefault();
                                             if ( kioskLocation != null )
                                             {
                                                 foreach ( var kioskSchedule in kioskLocation.KioskSchedules )
                                                 {
                                                     if ( !location.Schedules.Any( s => s.Schedule.Id == kioskSchedule.Schedule.Id ) )
                                                     {
                                                         var checkInSchedule = new CheckInSchedule();
                                                         checkInSchedule.Schedule = kioskSchedule.Schedule.Clone( false );
                                                         checkInSchedule.StartTime = kioskSchedule.StartTime;
                                                         location.Schedules.Add( checkInSchedule );
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }

                 return true;
             }

            return false;
        }
コード例 #7
0
 /// <summary>
 /// Returns the locations valid schedules
 /// </summary>
 /// <param name="schedule">The schedule.</param>
 /// <returns></returns>
 public List <CheckInSchedule> ValidSchedules(CheckInSchedule schedule)
 {
     if (schedule != null)
     {
         return(Schedules
                .Where(s =>
                       s.Schedule.Id == schedule.Schedule.Id &&
                       !s.ExcludedByFilter)
                .ToList());
     }
     else
     {
         return(Schedules
                .Where(s => !s.ExcludedByFilter)
                .ToList());
     }
 }
コード例 #8
0
ファイル: CheckInGroup.cs プロジェクト: SparkDevNetwork/Rock
 /// <summary>
 /// Returns the selected locations
 /// </summary>
 /// <param name="currentSchedule">The current schedule.</param>
 /// <returns></returns>
 public List <CheckInLocation> SelectedLocations(CheckInSchedule currentSchedule)
 {
     return((currentSchedule != null && currentSchedule.Schedule != null) ?
            Locations.Where(l => l.SelectedForSchedule.Contains(currentSchedule.Schedule.Id)).ToList() :
            Locations.Where(l => l.Selected).ToList());
 }
コード例 #9
0
ファイル: CheckInPerson.cs プロジェクト: waldo2590/Rock
 /// <summary>
 /// Returns the selected group types.
 /// </summary>
 /// <param name="currentSchedule">The current schedule.</param>
 /// <returns></returns>
 public List <CheckInGroupType> SelectedGroupTypes(CheckInSchedule currentSchedule)
 {
     return((currentSchedule != null && currentSchedule.Schedule != null) ?
            GroupTypes.Where(t => t.SelectedForSchedule.Contains(currentSchedule.Schedule.Id)).ToList() :
            GroupTypes.Where(t => t.Selected).ToList());
 }
コード例 #10
0
ファイル: CheckInPerson.cs プロジェクト: SparkDevNetwork/Rock
 /// <summary>
 /// Returns the selected group types.
 /// </summary>
 /// <param name="currentSchedule">The current schedule.</param>
 /// <returns></returns>
 public List<CheckInGroupType> SelectedGroupTypes( CheckInSchedule currentSchedule )
 {
     return ( currentSchedule != null && currentSchedule.Schedule != null ) ?
         GroupTypes.Where( t => t.SelectedForSchedule.Contains( currentSchedule.Schedule.Id ) ).ToList() :
         GroupTypes.Where( t => t.Selected ).ToList();
 }
コード例 #11
0
ファイル: GroupSelect.ascx.cs プロジェクト: NewPointe/Rockit
        /// <summary>
        /// Processes the selection.
        /// </summary>
        /// <param name="person">The person.</param>
        /// <param name="schedule">The schedule.</param>
        /// <returns></returns>
        protected bool ProcessSelection( CheckInPerson person, CheckInSchedule schedule )
        {
            if ( person != null )
            {
                if ( !ProcessSelection(
                    maWarning,
                    () => person.SelectedGroupTypes( schedule )
                        .SelectMany( t => t.SelectedGroups( schedule )
                            .SelectMany( g => g.Locations.Where( l => !l.ExcludedByFilter ) ) )
                        .Count() <= 0,
                    "<p>Sorry, based on your selection, there are currently not any available locations that can be checked into.</p>",
                    true ) )
                {
                    ClearSelection();
                }
                else
                {
                    return true;
                }
            }

            return false;
        }
コード例 #12
0
ファイル: CheckInGroup.cs プロジェクト: NewSpring/Rock
 /// <summary>
 /// Returns the selected locations
 /// </summary>
 /// <param name="currentSchedule">The current schedule.</param>
 /// <returns></returns>
 public List<CheckInLocation> SelectedLocations( CheckInSchedule currentSchedule )
 {
     return ( currentSchedule != null && currentSchedule.Schedule != null ) ?
         Locations.Where( l => l.SelectedForSchedule.Contains( currentSchedule.Schedule.Id ) ).ToList() :
         Locations.Where( l => l.Selected ).ToList();
 }
コード例 #13
0
ファイル: CheckInGroup.cs プロジェクト: NewSpring/Rock
 /// <summary>
 /// Gets the available locations.
 /// </summary>
 /// <param name="schedule">The schedule.</param>
 /// <returns></returns>
 public List<CheckInLocation> GetAvailableLocations( CheckInSchedule schedule )
 {
     var locations = Locations.Where( t => !t.ExcludedByFilter );
     if ( schedule != null )
     {
         locations = locations.Where( t => t.AvailableForSchedule.Contains( schedule.Schedule.Id ) );
     }
     return locations.ToList();
 }
コード例 #14
0
ファイル: CheckInLocation.cs プロジェクト: NewSpring/Rock
 /// <summary>
 /// Returns the locations valid schedules
 /// </summary>
 /// <param name="schedule">The schedule.</param>
 /// <returns></returns>
 public List<CheckInSchedule> ValidSchedules( CheckInSchedule schedule )
 {
     if ( schedule != null )
     {
         return Schedules
             .Where( s =>
                 s.Schedule.Id == schedule.Schedule.Id &&
                 !s.ExcludedByFilter )
             .ToList();
     }
     else
     {
         return Schedules
             .Where( s => !s.ExcludedByFilter )
             .ToList();
     }
 }
コード例 #15
0
        /// <summary>
        /// Processes the selection.
        /// </summary>
        /// <param name="person">The person.</param>
        /// <param name="schedule">The schedule.</param>
        /// <returns></returns>
        protected bool ProcessSelection( CheckInPerson person, CheckInSchedule schedule )
        {
            if ( person != null )
            {
                if ( !ProcessSelection(
                    maWarning,
                    () => person.SelectedGroupTypes( schedule )
                        .SelectMany( t => t.Groups.Where( g => !g.ExcludedByFilter ) )
                        .Count() <= 0,
                    string.Format( "<p>Sorry, based on your selection, there are currently not any available locations that {0} can check into.</p>", person.Person.NickName ),
                    true ) )
                {
                    ClearSelection();
                }
                else
                {
                    return true;
                }
            }

            return false;
        }
コード例 #16
0
        /// <summary>
        /// Processes the selection.
        /// </summary>
        /// <param name="person">The person.</param>
        /// <param name="schedule">The schedule.</param>
        /// <returns></returns>
        protected bool ProcessSelection( CheckInPerson person, CheckInSchedule schedule )
        {
            if ( person != null )
            {
                if ( !ProcessSelection(
                    maWarning,
                    () => person.SelectedGroupTypes( schedule )
                        .SelectMany( t => t.SelectedGroups( schedule )
                            .SelectMany( g => g.SelectedLocations( schedule )
                                .SelectMany( l => l.ValidSchedules( schedule ) ) ) )
                        .Count() <= 0,
                    "<p>Sorry, based on your selection, there are currently not any available times that can be checked into.</p>",
                    CurrentCheckInState.CheckInType.TypeOfCheckin == TypeOfCheckin.Family ) )
                {
                    ClearSelection();
                }
                else
                {
                    return true;
                }
            }

            return false;
        }
コード例 #17
0
ファイル: CheckInPerson.cs プロジェクト: SparkDevNetwork/Rock
 /// <summary>
 /// Gets the available group types.
 /// </summary>
 /// <param name="schedule">The schedule.</param>
 /// <returns></returns>
 public List<CheckInGroupType> GetAvailableGroupTypes( CheckInSchedule schedule )
 {
     var groupTypes = GroupTypes.Where( t => !t.ExcludedByFilter );
     if ( schedule != null )
     {
         groupTypes = groupTypes.Where( t => t.AvailableForSchedule.Contains( schedule.Schedule.Id ) );
     }
     return groupTypes.ToList();
 }
コード例 #18
0
ファイル: LoadSchedules.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Executes the specified workflow.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="action">The workflow action.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public override bool Execute( RockContext rockContext, Model.WorkflowAction action, Object entity, out List<string> errorMessages )
        {
            var checkInState = GetCheckInState( entity, out errorMessages );
            if ( checkInState != null )
            {
                bool loadAll = GetAttributeValue( action, "LoadAll" ).AsBoolean();

                foreach ( var family in checkInState.CheckIn.GetFamilies( true ) )
                {
                    foreach ( var person in family.GetPeople( true ) )
                    {
                        foreach ( var groupType in person.GetGroupTypes( !loadAll ) )
                        {
                            var kioskGroupType = checkInState.Kiosk.ActiveGroupTypes( checkInState.ConfiguredGroupTypes )
                                .Where( g => g.GroupType.Id == groupType.GroupType.Id )
                                .FirstOrDefault();

                            if ( kioskGroupType != null )
                            {
                                foreach ( var group in groupType.GetGroups( !loadAll ) )
                                {
                                    foreach ( var location in group.GetLocations( !loadAll ) )
                                    {
                                        var kioskGroup = kioskGroupType.KioskGroups
                                            .Where( g => g.Group.Id == group.Group.Id && g.IsCheckInActive )
                                            .FirstOrDefault();

                                        if ( kioskGroup != null )
                                        {
                                            var kioskLocation = kioskGroup.KioskLocations
                                                .Where( l => l.Location.Id == location.Location.Id && l.IsCheckInActive )
                                                .FirstOrDefault();

                                            if ( kioskLocation != null )
                                            {
                                                foreach ( var kioskSchedule in kioskLocation.KioskSchedules.Where( s => s.IsCheckInActive ) )
                                                {
                                                    if ( !location.Schedules.Any( s => s.Schedule.Id == kioskSchedule.Schedule.Id ) )
                                                    {
                                                        var checkInSchedule = new CheckInSchedule();
                                                        checkInSchedule.Schedule = kioskSchedule.Schedule.Clone( false );
                                                        checkInSchedule.StartTime = kioskSchedule.StartTime;
                                                        location.Schedules.Add( checkInSchedule );
                                                    }

                                                    if ( checkInState.CheckInType != null &&
                                                        checkInState.CheckInType.TypeOfCheckin == TypeOfCheckin.Family &&
                                                        !person.PossibleSchedules.Any( s => s.Schedule.Id == kioskSchedule.Schedule.Id ) )
                                                    {
                                                        var checkInSchedule = new CheckInSchedule();
                                                        checkInSchedule.Schedule = kioskSchedule.Schedule.Clone( false );
                                                        checkInSchedule.StartTime = kioskSchedule.StartTime;
                                                        person.PossibleSchedules.Add( checkInSchedule );
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return true;
            }

            return false;
        }