Example #1
0
 /// <summary>
 ///   Initialises a new Content Model Group.
 /// </summary>
 /// <param name = "parent">The parent model group.</param>
 public Group(Group parent)
 {
     m_parent = parent;
     Members = new ArrayList();
     m_groupType = GroupType.None;
     m_occurrence = Occurrence.Required;
 }
Example #2
0
 public Group(GroupType grpType,string grpName)
 {
     id = 0;
     type = grpType;
     name = grpName;
     rights = "";
 }
Example #3
0
 public void AddConnector(char c)
 {
     if (!Mixed && Members.Count == 0)
     {
         throw new Exception(
             String.Format("Missing token before connector '{0}'.", c)
             );
     }
     GroupType gt = GroupType.None;
     switch (c)
     {
         case ',':
             gt = GroupType.Sequence;
             break;
         case '|':
             gt = GroupType.Or;
             break;
         case '&':
             gt = GroupType.And;
             break;
     }
     if (GroupType != GroupType.None && GroupType != gt)
     {
         throw new Exception(
             String.Format("Connector '{0}' is inconsistent with {1} group.", c, GroupType.ToString())
             );
     }
     GroupType = gt;
 }
Example #4
0
 /// <summary>
 /// Initializes a new Content Model Group.
 /// </summary>
 /// <param name="parent">The parent model group.</param>
 public Group(Group parent)
 {
     _parent = parent;
     _members = new ArrayList();
     _type = GroupType.None;
     _occurrence = Occurrence.Required;
 }
Example #5
0
 public Group(Group parent)
 {
     Parent = parent;
     Members = new ArrayList();
     this.GroupType = GroupType.None;
     Occurrence = Occurrence.Required;
 }
Example #6
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="groupTypeId">The groupType identifier.</param>
        public void ShowDetail( int groupTypeId )
        {
            pnlDetails.Visible = false;

            bool editAllowed = true;

            GroupType groupType = null;

            if ( !groupTypeId.Equals( 0 ) )
            {
                groupType = new GroupTypeService( new RockContext() ).Get( groupTypeId );
                pdAuditDetails.SetEntity( groupType, ResolveRockUrl( "~" ) );
            }

            if ( groupType == null )
            {
                groupType = new GroupType { Id = 0 };
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            if ( groupType != null )
            {
                editAllowed = groupType.IsAuthorized( Authorization.EDIT, CurrentPerson );

                pnlDetails.Visible = true;
                hfGroupTypeId.Value = groupType.Id.ToString();

                // render UI based on Authorized and IsSystem
                bool readOnly = false;

                nbEditModeMessage.Text = string.Empty;
                if ( !editAllowed || !IsUserAuthorized( Authorization.EDIT ) )
                {
                    readOnly = true;
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( GroupType.FriendlyTypeName );
                }

                if ( readOnly )
                {
                    btnEdit.Visible = false;
                    btnDelete.Visible = false;
                    ShowReadonlyDetails( groupType );
                }
                else
                {
                    btnEdit.Visible = true;
                    btnDelete.Visible = true;

                    if ( groupType.Id > 0 )
                    {
                        ShowReadonlyDetails( groupType );
                    }
                    else
                    {
                        ShowEditDetails( groupType );
                    }
                }
            }
        }
 public GroupMatcher(Person pers, GroupType gt, List<DayOfWeek> days)
 {
     person = pers;
     personLocation = pers.GetHomeLocation();
     daysOfWeek = days;
     groupType = gt;
 }
        // -------------------------------------------------------------------- Get

        public GroupEntity GetGroup(string userName, string groupSlug, GroupType groupType)
        {
            using (var db = new CollectionDbContext())
            {
                // return all contacts across all groups since groupSlug is empty
                if (groupSlug.IsNullOrEmpty())
                {
                    // TODO paging
                    // get all items across all groups
                    var itemEnts = (from g in db.GroupEntities
                                from i in g.ItemEntities
                                where g.UserName.Equals(userName, StringComparison.InvariantCultureIgnoreCase) &&
                                      g.Id == i.GroupId &&
                                      g.GroupType == groupType
                                select i ).ToList();
                    if (itemEnts == null) return null;

                    var groupEnt = new GroupEntity();
                    foreach (var item in itemEnts)
                    {
                        if (!groupEnt.ItemEntities.Any(i=>i.ItemId == item.ItemId)) // filter out existing for "all" group
                            groupEnt.ItemEntities.Add(item);
                    }
                    groupEnt.UserName = userName;
                    return groupEnt;
                }

                // return contacts for a specific group
                return db.GroupEntities.Include(g => g.ItemEntities)
                                    .FirstOrDefault(g => g.UserName.Equals(userName, StringComparison.InvariantCultureIgnoreCase)
                                        && g.Slug.Equals(groupSlug, StringComparison.InvariantCultureIgnoreCase)
                                        && g.GroupType == groupType);
            }
        }
Example #9
0
File: Group.cs Project: BjkGkh/Boon
        public Group(int Id, string Name, string Description, string Badge, int RoomId, int Owner, int Time, int Type, int Colour1, int Colour2, int AdminOnlyDeco)
        {
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.RoomId = RoomId;
            this.Badge = Badge;
            this.CreateTime = Time;
            this.CreatorId = Owner;
            this.Colour1 = (Colour1 == 0) ? 1 : Colour1;
            this.Colour2 = (Colour2 == 0) ? 1 : Colour2;

            switch (Type)
            {
                case 0:
                    this.GroupType = GroupType.OPEN;
                    break;
                case 1:
                    this.GroupType = GroupType.LOCKED;
                    break;
                case 2:
                    this.GroupType = GroupType.PRIVATE;
                    break;
            }

            this.AdminOnlyDeco = AdminOnlyDeco;
            this.ForumEnabled = ForumEnabled;

            this._members = new List<int>();
            this._requests = new List<int>();
            this._administrators = new List<int>();

            InitMembers();
        }
Example #10
0
 public void DeleteGroupType(GroupType groupType)
 {
     using (SPKTDataContext dc = conn.GetContext())
     {
         dc.GroupTypes.DeleteOnSubmit(groupType);
         dc.SubmitChanges();
     }
 }
Example #11
0
        /// <summary>
        /// Constructs a Group.
        /// <param name="type">The group construction.</param>
        /// <param name="q">The value q.</param>
        /// <param name="groupName">The group name.</param>
        /// </summary>
        protected Group(GroupType type, byte[] q, string groupName)
        {
            if (q== null) throw new ArgumentNullException("q");

            Type = type;
            Q = q;
            GroupName = groupName;
        }
 internal static string GroupTypeToDescription(GroupType type)
 {
     return type == GroupType.Equal ? "Identical clones"
         : type == GroupType.Offsetted ? "Offsetted clones"
         : type == GroupType.Different ? "Mismatching clones"
         : type == GroupType.Unverified ? "Not yet verified clones"
         : "Unique";
 }
 internal static string GroupTypeToIconTag(GroupType type)
 {
     return type == GroupType.Equal ? ".#picture"
         : type == GroupType.Offsetted ? ".#pictures"
         : type == GroupType.Different ? ".#images"
         : type == GroupType.Unverified ? ".#images_question"
         : ".#puzzle";
 }
        public List<GroupEntity> GetGroupList(string userName, GroupType groupType)
        {
            using (var db = new CollectionDbContext())
            {
                var groupEnts = db.GroupEntities.Include(g => g.ItemEntities)
                    .Where(g => g.UserName.Equals(userName, StringComparison.InvariantCultureIgnoreCase) 
                        && g.GroupType == groupType);

                return (groupEnts == null) ? null : groupEnts.ToList();
            }
        }
Example #15
0
 public static string GroupTypeToString(GroupType type)
 {
     string result;
     if (type == GroupType.Private)
     {
         result = "Частна";
     }
     else
     {
         result = "Публична";
     }
     return result;
 }
Example #16
0
        /// <summary>
        /// Verifies if the specified <see cref="Rock.Model.GroupType"/> can be deleted, and if so deletes it.
        /// </summary>
        /// <param name="item">The <see cref="Rock.Model.GroupType"/> to delete.</param>
        /// <param name="personId">A <see cref="System.Int32"/> representing the Id of the <see cref="Rock.Model.Person"/> who is attempting to delete the
        /// <see cref="Rock.Model.GroupType"/>.</param>
        /// <returns>A <see cref="System.Boolean"/> value that is <c>true</c> if the <see cref="Rock.Model.GroupType"/> was able to be successfully deleted, otherwise <c>false</c>.</returns>
        public override bool Delete( GroupType item, int? personId )
        {
            string message;
            if ( !CanDelete( item, out message ) )
            {
                return false;
            }

            item.ChildGroupTypes.Clear();
            this.Save( item, personId );

            return base.Delete( item, personId );
        }
Example #17
0
        public Group(ID<IUserOrGroup, Guid> id,
		    string name,
		    bool builtIn,
            bool automatic,
            GroupType type,
            FileHandlerFactoryLocator fileHandlerFactoryLocator,
            string displayName)
            : base(id, name, builtIn, fileHandlerFactoryLocator, displayName)
        {
            _Id = id;
            _Name = name;
            _Automatic = automatic;
            _Type = type;
        }
Example #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="type">The type of group this is</param>
        /// <param name="mediaType">Media type of the new group</param>
        /// <param name="timeline">Timeline to use for the group</param>
        /// <param name="fps">Fps for the group</param>
        public Group(ITimeline timeline, GroupType type, AMMediaType mediaType, string name, double fps)
            : base(timeline, name, -1)
        {
            if (timeline == null) throw new ArgumentNullException("timeline");
            if (mediaType == null) throw new ArgumentNullException("mediaType");
            if (fps <= 0) throw new SplicerException(Resources.ErrorFramesPerSecondMustBeGreaterThenZero);

            _timeline = timeline;
            _type = type;
            _fps = fps;

            _group = TimelineBuilder.InsertGroup(_timeline.DesTimeline, mediaType, name);
            TimelineComposition = (IAMTimelineComp) _group;
        }
Example #19
0
        public static Task<Search> Search(string access_token, string q, string fields = "members_count", int country_id = 0, int city_id = 0, byte sort = 0, short count = 1000, short offset = 0, GroupType type = GroupType.all, int future = 0)
        {
            return Task.Run<Search>(() =>
            {
                try
                {
                    //Собираем параметры
                    StringBuilder data = new StringBuilder();
                    data.Append("&sort=" + (sort == 6 ? 0 : sort));
                    data.Append("&offset=" + offset);
                    data.Append("&count=" + count);
                    data.Append("&future=" + future);

                    if (type != GroupType.all)
                        data.Append("&type=" + type.ToString());

                    if (country_id != 0)
                        data.Append("&country_id=" + country_id);

                    if (city_id != 0 && country_id != 0)
                        data.Append("&city_id=" + city_id);

                    if (q != null)
                        data.Append("&q=" + q);

                    if (fields != null)
                        data.Append("&fields=" + fields);

                    if (access_token != null)
                        data.Append("&access_token=" + access_token);
                    else if (VKdata.token != null)
                        data.Append("&access_token=" + VKdata.token);


                    //Получаем json данные
                    string json = Regex.Replace(result.get("groups.search", data.ToString(), true), "^{\"response\":\\[[0-9]+,{\"", "{\"response\":[{\"");

                    //Чистим ресурсы и возвращаем результаты
                    access_token = null; q = null; fields = null; data = null;
                    return JsonConvert.DeserializeObject<Search>(json);
                }
                catch (Newtonsoft.Json.JsonReaderException) { }
                catch { }

                //Ошибка
                access_token = null; q = null; fields = null;
                return new Search();
            });
        }
 internal SqlAzManApplicationGroup(NetSqlAzManStorageDataContext db, IAzManApplication application, int applicationGroupId, IAzManSid sid, string name, string description, string lDapQuery, GroupType groupType, SqlAzManENS ens)
 {
     this.db = db;
     this.application = application;
     this.applicationGroupId = applicationGroupId;
     this.sid = sid;
     this.name = name;
     this.description = description;
     this.lDapQuery = String.IsNullOrEmpty(lDapQuery) ? String.Empty : lDapQuery;
     this.groupType = groupType;
     this.ens = ens;
     if (groupType != GroupType.Basic)
     {
         this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>();
     }
 }
Example #21
0
 public Int64 SaveGroupType(GroupType groupType)
 {
     using (SPKTDataContext dc = conn.GetContext())
     {
         if (groupType.GroupTypeID > 0)
         {
             dc.GroupTypes.Attach(groupType, true);
         }
         else
         {
             dc.GroupTypes.InsertOnSubmit(groupType);
         }
         dc.SubmitChanges();
     }
     return groupType.GroupTypeID;
 }
Example #22
0
        private static IssuerKeyAndParameters SetupUProveIssuer(string UIDP, int numberOfAttributes, GroupType groupType = GroupType.Subgroup, bool supportDevice = false)
        {
            WriteLine("Setting up Issuer parameters");
            IssuerSetupParameters isp = new IssuerSetupParameters();
            // pick a unique identifier for the issuer params
            isp.UidP = encoding.GetBytes(UIDP);
            // set the number of attributes in the U-Prove tokens
            isp.NumberOfAttributes = numberOfAttributes;
            // an application profile would define the format of the specification field,
            // we use a dummy value in this sample
            isp.S = encoding.GetBytes("application-specific specification");
            // specify the group type: subgroup (default) or ECC
            isp.GroupConstruction = groupType;

            return isp.Generate(supportDevice);
        }
Example #23
0
        void AddGroups(Dictionary<string, List<HorseInfo>> groups, List<HorseInfo> hil, GroupType gt, string desc)
        {
            hil.ForEach(h=>
                            {
                                string key = desc + " " + h.GetKey(gt);

                                if(key.Substring(0,3).ToUpper() == "ALL")
                                {
                                    key = key.Substring(3);
                                }
                                if(!groups.ContainsKey(key))
                                {
                                    groups.Add(key, new List<HorseInfo>());
                                }
                                groups[key].Add(h);
                            }
                        );
        }
Example #24
0
        public async Task<Group> CreateGroupAsync(long personId, string groupName, GroupType groupType)
        {
            AssertUtil.Waterfall()
                .AreBigger(personId, 0, "personId must be greater than zero")
                .IsNotNull(groupType, "groupType can't be null")
                .Done();

            Group group = new Group()
            {
                PersonID = personId,
                Name = groupName,
                Type = groupType
            };

            this.Add(group);

            return await SaveChangesAsync() > 0 ? group : null;
        }
Example #25
0
        public GroupType GetParentPurposeGroupType( GroupType groupType, Guid purposeGuid )
        {
            if ( groupType != null &&
                groupType.GroupTypePurposeValue != null &&
                groupType.GroupTypePurposeValue.Guid.Equals( purposeGuid ) )
            {
                return groupType;
            }

            foreach ( var parentGroupType in groupType.ParentGroupTypes )
            {
                var testGroupType = GetParentPurposeGroupType( parentGroupType, purposeGuid );
                if ( testGroupType != null )
                {
                    return testGroupType;
                }
            }

            return null;
        }
        //TODO figure out how to regroup.
        public void CreateGroup(Document doc, UIDocument uidoc)
        {
            Transaction tx = new Transaction(doc);

            tx.Start("Group");

            Group grpNew = doc.Create.NewGroup(_newgrpElements);

            FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(GroupType));
            FilteredElementIterator itr = collector.GetElementIterator();

            _gp = grpNew.GroupType;
            while (itr.MoveNext())
            {

                GroupType groupType = (GroupType)itr.Current;
                //groupType = _gp;
            }

            tx.Commit();
        }
 public DataCollection(string uniqueId, string title, GroupType groupType) : base(uniqueId, title)
 {
     this.typeGroup = groupType;
     this.Items.CollectionChanged += this.ItemsCollectionChanged;
 }
Example #28
0
 /// <summary>
 /// Creates the store group.
 /// </summary>
 /// <param name="storeGroupSid">The store group sid.</param>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="lDapQuery">The ldap query.</param>
 /// <param name="groupType">Type of the group.</param>
 /// <returns></returns>
 public IAzManStoreGroup CreateStoreGroup(IAzManSid storeGroupSid, string name, string description, string lDapQuery, GroupType groupType)
 {
     try
     {
         if (DirectoryServices.DirectoryServicesUtils.TestLDAPQuery(lDapQuery))
         {
             this.db.StoreGroupInsert(this.storeId, storeGroupSid.BinaryValue, name, description, lDapQuery, (byte)groupType);
             IAzManStoreGroup result = this.GetStoreGroup(name);
             this.raiseStoreGroupCreated(this, result);
             if (this.ens != null)
             {
                 this.ens.AddPublisher(result);
             }
             this.storeGroups = null; //Force cache refresh
             return(result);
         }
         else
         {
             throw new ArgumentException("LDAP Query syntax error or unavailable Domain.", "lDapQuery");
         }
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.StoreGroupDuplicateException(name, this, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }
Example #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KioskGroupType" /> class.
 /// </summary>
 /// <param name="groupType">Type of the group.</param>
 public KioskGroupType(GroupType groupType)
     : this(groupType != null ? groupType.Id : 0)
 {
 }
Example #30
0
 public bool IsDefault()
 {
     return(GroupType.Equals("SelectAll") || (!HasSiblings() &&
                                              (GroupType.Equals("SelectAtLeastOne") || GroupType.Equals("SelectExactlyOne"))));
 }
Example #31
0
        /// <summary>
        /// If groupid is negatif
        ///		Get The list of created, joined and pending groups for a member
        /// else
        ///		Get the view information of a single group
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="Type"></param>
        /// <param name="GroupId"></param>
        /// <returns></returns>
        public DataTable GetMemberGroups(int memberId, GroupType Type, int GroupId)
        {
            string sql = GetMemberGroupsSelectCommand(memberId, Type, GroupId);

            return(DBUtils.GetDataSet(sql, cte.lib).Tables[0]);
        }
Example #32
0
 /// <summary>
 /// If groupid is negatif
 ///		Get The list of created, joined and pending groups for a member
 /// else
 ///		Get the view information of a single group
 /// </summary>
 /// <param name="memberId"></param>
 /// <param name="Type"></param>
 /// <param name="GroupId"></param>
 /// <returns>The sql select string for membergroups</returns>
 public string GetMemberGroupsSelectCommand(int memberId, GroupType Type, int GroupId, string cond)
 {
     return(GetMemberGroupsSelectCommand(memberId, Type, GroupId, null, cond));
 }
Example #33
0
        public static void SurvivorGroupSpawn(Vector3 pos, GroupType groupType = GroupType.Random, int groupSize = -1, PedTasks pedTasks = PedTasks.Wander)
        {
            if (groupType == GroupType.Random)
            {
                int rndGroupType = RandoMath.CachedRandom.Next(0, 3);
                if (rndGroupType == 0)
                {
                    groupType = GroupType.Friendly;
                }
                if (rndGroupType == 1)
                {
                    groupType = GroupType.Neutral;
                }
                if (rndGroupType == 2)
                {
                    groupType = GroupType.Hostile;
                }
            }
            List <Ped> peds  = new List <Ped>();
            PedGroup   group = new PedGroup();

            if (groupSize == -1)
            {
                groupSize = RandoMath.CachedRandom.Next(3, 9);
            }
            for (int i = 0; i < groupSize; i++)
            {
                SurvivorPed sPed = SurvivorSpawn(pos);
                if (groupType == GroupType.Friendly)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.FriendlyGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Blue;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Friendly";
                }
                else if (groupType == GroupType.Neutral)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.NeutralGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Yellow;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Neutral";
                }
                else if (groupType == GroupType.Hostile)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.HostileGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Red;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Hostile";
                }
                peds.Add(sPed.pedEntity);
            }
            foreach (Ped ped in peds)
            {
                if (group.MemberCount < 1)
                {
                    group.Add(ped, true);
                }
                else
                {
                    group.Add(ped, false);
                }
            }
            group.FormationType = 0;
            List <Ped> groupPeds = group.ToList(true);

            foreach (Ped ped in groupPeds)
            {
                PlayerGroup.SetPedTasks(ped, pedTasks);
            }
        }
Example #34
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="groupTypeId">The groupType identifier.</param>
        public void ShowDetail(int groupTypeId)
        {
            pnlDetails.Visible = false;

            bool editAllowed = true;

            GroupType groupType = null;

            if (!groupTypeId.Equals(0))
            {
                groupType = new GroupTypeService(new RockContext()).Get(groupTypeId);
                pdAuditDetails.SetEntity(groupType, ResolveRockUrl("~"));
            }

            if (groupType == null)
            {
                groupType = new GroupType {
                    Id = 0
                };
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            if (groupType != null)
            {
                editAllowed = groupType.IsAuthorized(Authorization.EDIT, CurrentPerson);

                pnlDetails.Visible  = true;
                hfGroupTypeId.Value = groupType.Id.ToString();

                // render UI based on Authorized and IsSystem
                bool readOnly = false;

                nbEditModeMessage.Text = string.Empty;
                if (!editAllowed || !IsUserAuthorized(Authorization.EDIT))
                {
                    readOnly = true;
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(GroupType.FriendlyTypeName);
                }

                if (readOnly)
                {
                    btnEdit.Visible   = false;
                    btnDelete.Visible = false;
                    ShowReadonlyDetails(groupType);
                }
                else
                {
                    btnEdit.Visible   = true;
                    btnDelete.Visible = true;

                    if (groupType.Id > 0)
                    {
                        ShowReadonlyDetails(groupType);
                    }
                    else
                    {
                        ShowEditDetails(groupType);
                    }
                }
            }
        }
Example #35
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            GroupType groupType = null;

            var rockContext = new RockContext();
            GroupTypeService          groupTypeService          = new GroupTypeService(rockContext);
            AttributeService          attributeService          = new AttributeService(rockContext);
            AttributeQualifierService attributeQualifierService = new AttributeQualifierService(rockContext);

            int?groupTypeId = hfGroupTypeId.ValueAsInt();

            if (groupTypeId.HasValue && groupTypeId.Value > 0)
            {
                groupType = groupTypeService.Get(groupTypeId.Value);
            }

            bool newGroupType = false;

            if (groupType == null)
            {
                groupType = new GroupType();
                groupTypeService.Add(groupType);

                var templatePurpose = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_TEMPLATE.AsGuid());
                if (templatePurpose != null)
                {
                    groupType.GroupTypePurposeValueId = templatePurpose.Id;
                }

                newGroupType = true;
            }

            if (groupType != null)
            {
                groupType.Name        = tbName.Text;
                groupType.Description = tbDescription.Text;

                groupType.LoadAttributes(rockContext);
                Rock.Attribute.Helper.GetEditValues(phAttributeEdits, groupType);

                groupType.SetAttributeValue("core_checkin_AgeRequired", cbAgeRequired.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_GradeRequired", cbGradeRequired.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_HidePhotos", cbHidePhotos.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_PreventDuplicateCheckin", cbPreventDuplicateCheckin.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_PreventInactivePeople", cbPreventInactivePeople.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_CheckInType", ddlType.SelectedValue);
                groupType.SetAttributeValue("core_checkin_DisplayLocationCount", cbDisplayLocCount.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_EnableManagerOption", cbEnableManager.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_EnableOverride", cbEnableOverride.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_MaximumPhoneSearchLength", nbMaxPhoneLength.Text);
                groupType.SetAttributeValue("core_checkin_MaxSearchResults", nbMaxResults.Text);
                groupType.SetAttributeValue("core_checkin_MinimumPhoneSearchLength", nbMinPhoneLength.Text);
                groupType.SetAttributeValue("core_checkin_UseSameOptions", cbUseSameOptions.Checked.ToString());
                groupType.SetAttributeValue("core_checkin_PhoneSearchType", ddlPhoneSearchType.SelectedValue);
                groupType.SetAttributeValue("core_checkin_RefreshInterval", nbRefreshInterval.Text);
                groupType.SetAttributeValue("core_checkin_RegularExpressionFilter", tbSearchRegex.Text);
                groupType.SetAttributeValue("core_checkin_ReuseSameCode", cbReuseCode.Checked.ToString());

                var searchType = DefinedValueCache.Read(ddlSearchType.SelectedValueAsInt() ?? 0);
                if (searchType != null)
                {
                    groupType.SetAttributeValue("core_checkin_SearchType", searchType.Guid.ToString());
                }
                else
                {
                    groupType.SetAttributeValue("core_checkin_SearchType", Rock.SystemGuid.DefinedValue.CHECKIN_SEARCH_TYPE_PHONE_NUMBER);
                }

                groupType.SetAttributeValue("core_checkin_SecurityCodeLength", nbSecurityCodeLength.Text);
                groupType.SetAttributeValue("core_checkin_AutoSelectDaysBack", nbAutoSelectDaysBack.Text);

                rockContext.WrapTransaction(() =>
                {
                    rockContext.SaveChanges();
                    groupType.SaveAttributeValues(rockContext);
                });

                if (newGroupType)
                {
                    var pageRef = new PageReference(CurrentPageReference.PageId, CurrentPageReference.RouteId);
                    pageRef.Parameters.Add("CheckinTypeId", groupType.Id.ToString());
                    NavigateToPage(pageRef);
                }
                else
                {
                    groupType = groupTypeService.Get(groupType.Id);
                    ShowReadonlyDetails(groupType);
                }

                GroupTypeCache.Flush(groupType.Id);
                Rock.CheckIn.KioskDevice.FlushAll();
            }
        }
Example #36
0
 /// <inheritdoc />
 public async Task <Group> CreateAsync(string title, string description, GroupType type, GroupSubType?subtype,
                                       uint?publicCategory = null)
 {
     return(await TypeHelper.TryInvokeMethodAsync(() =>
                                                  _vk.Groups.Create(title, description, type, subtype, publicCategory)));
 }
Example #37
0
        public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCount, uint? offset = null, uint? count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint? countryId = null, uint? cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new VkParameters
            {
                { "q", query },
                { "offset", offset },
                { "count", count },
                { "future", future },
                { "sort", sort },
                { "type", type },
                { "country_id", countryId },
                { "city_id", cityId }
            };

            VkResponseArray response = _vk.Call("groups.search", parameters);

            totalCount = response[0];

            return response.Skip(1).ToReadOnlyCollectionOf<Group>(r => r);
        }
Example #38
0
        /// <summary>
        /// Create a group for a list of lights
        /// </summary>
        /// <param name="lights">List of lights in the group</param>
        /// <param name="name">Optional name</param>
        /// <param name="roomClass">for room creation the room class has to be passed, without class it will get the default: "Other" class.</param>
        /// <returns></returns>
        public async Task <string?> CreateGroupAsync(IEnumerable <string> lights, string?name = null, RoomClass?roomClass = null, GroupType groupType = GroupType.Room)
        {
            CheckInitialized();

            if (lights == null)
            {
                throw new ArgumentNullException(nameof(lights));
            }

            CreateGroupRequest jsonObj = new CreateGroupRequest();

            jsonObj.Lights = lights;

            if (!string.IsNullOrEmpty(name))
            {
                jsonObj.Name = name !;
            }

            if (roomClass.HasValue)
            {
                jsonObj.Class = roomClass.Value;
            }

            jsonObj.Type = groupType;

            string jsonString = JsonConvert.SerializeObject(jsonObj, new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            HttpClient client = await GetHttpClient().ConfigureAwait(false);

            //Create group with the lights we want to target
            var response = await client.PostAsync(new Uri(String.Format("{0}groups", ApiBase)), new JsonContent(jsonString)).ConfigureAwait(false);

            var jsonResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            HueResults groupResult = DeserializeDefaultHueResult(jsonResult);

            if (groupResult.Count > 0 && groupResult[0].Success != null && !string.IsNullOrEmpty(groupResult[0].Success.Id))
            {
                return(groupResult[0].Success.Id.Replace("/groups/", string.Empty));
            }

            if (groupResult.HasErrors())
            {
                throw new HueException(groupResult.Errors.First().Error.Description);
            }

            return(null);
        }
Example #39
0
        /// <summary>
        /// Imports the specified XML reader.
        /// </summary>
        /// <param name="xmlNode">The XML node.</param>
        /// <param name="includeWindowsUsersAndGroups">if set to <c>true</c> [include windows users and groups].</param>
        /// <param name="includeDBUsers">if set to <c>true</c> [include DB users].</param>
        /// <param name="includeAuthorizations">if set to <c>true</c> [include authorizations].</param>
        /// <param name="mergeOptions">The merge options.</param>
        public void ImportChildren(XmlNode xmlNode, bool includeWindowsUsersAndGroups, bool includeDBUsers, bool includeAuthorizations, SqlAzManMergeOptions mergeOptions)
        {
            //Create Store Groups
            foreach (XmlNode node in xmlNode.ChildNodes)
            {
                if (node.Name == "Attributes")
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "Attribute")
                        {
                            if (!this.Attributes.ContainsKey(childNode.Attributes["Key"].Value))
                            {
                                IAzManAttribute <IAzManStore> newStoreAttribute = this.CreateAttribute(childNode.Attributes["Key"].Value, childNode.Attributes["Value"].Value);
                            }
                            else
                            {
                                this.Attributes[childNode.Attributes["Key"].Value].Update(childNode.Attributes["Key"].Value, childNode.Attributes["Value"].Value);
                            }
                        }
                    }
                }
                else if (node.Name == "Attribute")
                {
                    if (!this.Attributes.ContainsKey(node.Attributes["Key"].Value))
                    {
                        IAzManAttribute <IAzManStore> newStoreAttribute = this.CreateAttribute(node.Attributes["Key"].Value, node.Attributes["Value"].Value);
                    }
                    else
                    {
                        this.Attributes[node.Attributes["Key"].Value].Update(node.Attributes["Key"].Value, node.Attributes["Value"].Value);
                    }
                }
                if (node.Name == "Permissions")
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "Managers")
                        {
                            foreach (XmlNode childChildNode in childNode.ChildNodes)
                            {
                                if (childChildNode.Name == "Manager")
                                {
                                    this.GrantAccessAsManager(childChildNode.Attributes["SqlUserOrRole"].Value);
                                }
                            }
                        }
                        else if (childNode.Name == "Users")
                        {
                            foreach (XmlNode childChildNode in childNode.ChildNodes)
                            {
                                if (childChildNode.Name == "User")
                                {
                                    this.GrantAccessAsUser(childChildNode.Attributes["SqlUserOrRole"].Value);
                                }
                            }
                        }
                        else if (childNode.Name == "Readers")
                        {
                            foreach (XmlNode childChildNode in childNode.ChildNodes)
                            {
                                if (childChildNode.Name == "Reader")
                                {
                                    this.GrantAccessAsReader(childChildNode.Attributes["SqlUserOrRole"].Value);
                                }
                            }
                        }
                    }
                }
                if (node.Name == "StoreGroups")
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "StoreGroup")
                        {
                            GroupType groupType = GroupType.Basic;
                            if (childNode.Attributes["GroupType"].Value == GroupType.LDapQuery.ToString())
                            {
                                groupType = GroupType.LDapQuery;
                            }
                            IAzManStoreGroup storeGroup = null;
                            string           sid        = null;
                            if (this.StoreGroups.ContainsKey(childNode.Attributes["Name"].Value))
                            {
                                storeGroup = this.StoreGroups[childNode.Attributes["Name"].Value];
                                sid        = storeGroup.SID.StringValue;
                                //Change Store Group SID
                                MergeUtilities.changeSid(childNode.OwnerDocument.DocumentElement, childNode.Attributes["Sid"].Value, sid);
                            }
                            else
                            {
                                sid        = SqlAzManSID.NewSqlAzManSid().StringValue;
                                storeGroup = this.CreateStoreGroup(new SqlAzManSID(sid), childNode.Attributes["Name"].Value, childNode.Attributes["Description"].Value, childNode.Attributes["LDAPQuery"].Value, groupType);
                                //Change Store Group SID
                                MergeUtilities.changeSid(childNode.OwnerDocument.DocumentElement, childNode.Attributes["Sid"].Value, sid);
                            }

                            //newStoreGroup.ImportChildren(childNode, includeWindowsUsersAndGroups, includeAuthorizations);
                        }
                    }
                }
                else if (node.Name == "StoreGroup")
                {
                    GroupType groupType = GroupType.Basic;
                    if (node.Attributes["GroupType"].Value == GroupType.LDapQuery.ToString())
                    {
                        groupType = GroupType.LDapQuery;
                    }

                    IAzManStoreGroup storeGroup = null;
                    string           sid        = null;
                    if (this.StoreGroups.ContainsKey(node.Attributes["Name"].Value))
                    {
                        storeGroup = this.StoreGroups[node.Attributes["Name"].Value];
                        sid        = storeGroup.SID.StringValue;
                        //Change Store Group SID
                        MergeUtilities.changeSid(node.OwnerDocument.DocumentElement, node.Attributes["Sid"].Value, sid);
                    }
                    else
                    {
                        sid        = SqlAzManSID.NewSqlAzManSid().StringValue;
                        storeGroup = this.CreateStoreGroup(new SqlAzManSID(sid), node.Attributes["Name"].Value, node.Attributes["Description"].Value, node.Attributes["LDAPQuery"].Value, groupType);
                        //Change Store Group SID
                        MergeUtilities.changeSid(node.OwnerDocument.DocumentElement, node.Attributes["Sid"].Value, sid);
                    }
                    //newStoreGroup.ImportChildren(node, includeWindowsUsersAndGroups, includeAuthorizations);
                }
            }
            //Create Applications & Store Group Members
            foreach (XmlNode node in xmlNode.ChildNodes)
            {
                System.Windows.Forms.Application.DoEvents();
                if (node.Name == "Applications")
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "Application")
                        {
                            IAzManApplication newApplication =
                                this.Applications.ContainsKey(childNode.Attributes["Name"].Value) ?
                                this.Applications[childNode.Attributes["Name"].Value] :
                                this.CreateApplication(childNode.Attributes["Name"].Value, childNode.Attributes["Description"].Value);
                            newApplication.ImportChildren(childNode, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, mergeOptions);
                        }
                    }
                }
                else if (node.Name == "Application")
                {
                    IAzManApplication newApplication =
                        this.Applications.ContainsKey(node.Attributes["Name"].Value) ?
                        this.Applications[node.Attributes["Name"].Value] :
                        this.CreateApplication(node.Attributes["Name"].Value, node.Attributes["Description"].Value);
                    newApplication.ImportChildren(node, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, mergeOptions);
                }
                else if (node.Name == "StoreGroups")
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "StoreGroup")
                        {
                            GroupType groupType = GroupType.Basic;
                            if (childNode.Attributes["GroupType"].Value == GroupType.LDapQuery.ToString())
                            {
                                groupType = GroupType.LDapQuery;
                            }
                            if (groupType == GroupType.Basic)
                            {
                                IAzManStoreGroup newStoreGroup = this.StoreGroups[childNode.Attributes["Name"].Value];
                                newStoreGroup.ImportChildren(childNode, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, mergeOptions);
                            }
                        }
                    }
                }
                else if (node.Name == "StoreGroup")
                {
                    GroupType groupType = GroupType.Basic;
                    if (node.Attributes["GroupType"].Value == GroupType.LDapQuery.ToString())
                    {
                        groupType = GroupType.LDapQuery;
                    }
                    if (groupType == GroupType.Basic)
                    {
                        IAzManStoreGroup newStoreGroup = this.StoreGroups[node.Attributes["Name"].Value];
                        newStoreGroup.ImportChildren(node, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, mergeOptions);
                    }
                }
            }
            this.applications = null; //Force refresh
        }
Example #40
0
        /// <summary>
        /// Loads the <see cref="P:IHasAttributes.Attributes" /> and <see cref="P:IHasAttributes.AttributeValues" /> of any <see cref="IHasAttributes" /> object
        /// </summary>
        /// <param name="entity">The item.</param>
        /// <param name="rockContext">The rock context.</param>
        public static void LoadAttributes(Rock.Attribute.IHasAttributes entity, RockContext rockContext)
        {
            if (entity != null)
            {
                Dictionary <string, PropertyInfo> properties = new Dictionary <string, PropertyInfo>();

                Type entityType = entity.GetType();
                if (entityType.Namespace == "System.Data.Entity.DynamicProxies")
                {
                    entityType = entityType.BaseType;
                }

                rockContext = rockContext ?? new RockContext();

                // Check for group type attributes
                var groupTypeIds = new List <int>();
                if (entity is GroupMember || entity is Group || entity is GroupType)
                {
                    // Can't use GroupTypeCache here since it loads attributes and would result in a recursive stack overflow situation
                    var       groupTypeService = new GroupTypeService(rockContext);
                    GroupType groupType        = null;

                    if (entity is GroupMember)
                    {
                        var group = ((GroupMember)entity).Group ?? new GroupService(rockContext)
                                    .Queryable().AsNoTracking().FirstOrDefault(g => g.Id == ((GroupMember)entity).GroupId);
                        if (group != null)
                        {
                            groupType = group.GroupType ?? groupTypeService
                                        .Queryable().AsNoTracking().FirstOrDefault(t => t.Id == group.GroupTypeId);
                        }
                    }
                    else if (entity is Group)
                    {
                        groupType = ((Group)entity).GroupType ?? groupTypeService
                                    .Queryable().AsNoTracking().FirstOrDefault(t => t.Id == ((Group)entity).GroupTypeId);
                    }
                    else
                    {
                        groupType = ((GroupType)entity);
                    }

                    while (groupType != null)
                    {
                        groupTypeIds.Insert(0, groupType.Id);

                        // Check for inherited group type id's
                        if (groupType.InheritedGroupTypeId.HasValue)
                        {
                            groupType = groupType.InheritedGroupType ?? groupTypeService
                                        .Queryable().AsNoTracking().FirstOrDefault(t => t.Id == (groupType.InheritedGroupTypeId ?? 0));
                        }
                        else
                        {
                            groupType = null;
                        }
                    }
                }

                foreach (PropertyInfo propertyInfo in entityType.GetProperties())
                {
                    properties.Add(propertyInfo.Name.ToLower(), propertyInfo);
                }

                Rock.Model.AttributeService      attributeService      = new Rock.Model.AttributeService(rockContext);
                Rock.Model.AttributeValueService attributeValueService = new Rock.Model.AttributeValueService(rockContext);

                var inheritedAttributes = new Dictionary <int, List <Rock.Web.Cache.AttributeCache> >();
                if (groupTypeIds.Any())
                {
                    groupTypeIds.ForEach(g => inheritedAttributes.Add(g, new List <Rock.Web.Cache.AttributeCache>()));
                }
                else
                {
                    inheritedAttributes.Add(0, new List <Rock.Web.Cache.AttributeCache>());
                }

                var attributes = new List <Rock.Web.Cache.AttributeCache>();

                // Get all the attributes that apply to this entity type and this entity's properties match any attribute qualifiers
                var entityTypeCache = Rock.Web.Cache.EntityTypeCache.Read(entityType);
                if (entityTypeCache != null)
                {
                    int entityTypeId = entityTypeCache.Id;
                    foreach (var attribute in attributeService.Queryable()
                             .AsNoTracking()
                             .Where(a => a.EntityTypeId == entityTypeCache.Id)
                             .Select(a => new
                    {
                        a.Id,
                        a.EntityTypeQualifierColumn,
                        a.EntityTypeQualifierValue
                    }
                                     ))
                    {
                        // group type ids exist (entity is either GroupMember, Group, or GroupType) and qualifier is for a group type id
                        if (groupTypeIds.Any() && (
                                (entity is GroupMember && string.Compare(attribute.EntityTypeQualifierColumn, "GroupTypeId", true) == 0) ||
                                (entity is Group && string.Compare(attribute.EntityTypeQualifierColumn, "GroupTypeId", true) == 0) ||
                                (entity is GroupType && string.Compare(attribute.EntityTypeQualifierColumn, "Id", true) == 0)))
                        {
                            int groupTypeIdValue = int.MinValue;
                            if (int.TryParse(attribute.EntityTypeQualifierValue, out groupTypeIdValue) && groupTypeIds.Contains(groupTypeIdValue))
                            {
                                inheritedAttributes[groupTypeIdValue].Add(Rock.Web.Cache.AttributeCache.Read(attribute.Id));
                            }
                        }

                        else if (string.IsNullOrEmpty(attribute.EntityTypeQualifierColumn) ||
                                 (properties.ContainsKey(attribute.EntityTypeQualifierColumn.ToLower()) &&
                                  (string.IsNullOrEmpty(attribute.EntityTypeQualifierValue) ||
                                   (properties[attribute.EntityTypeQualifierColumn.ToLower()].GetValue(entity, null) ?? "").ToString() == attribute.EntityTypeQualifierValue)))
                        {
                            attributes.Add(Rock.Web.Cache.AttributeCache.Read(attribute.Id));
                        }
                    }
                }

                var allAttributes = new List <Rock.Web.Cache.AttributeCache>();

                foreach (var attributeGroup in inheritedAttributes)
                {
                    foreach (var attribute in attributeGroup.Value)
                    {
                        allAttributes.Add(attribute);
                    }
                }
                foreach (var attribute in attributes)
                {
                    allAttributes.Add(attribute);
                }

                var attributeValues = new Dictionary <string, Rock.Model.AttributeValue>();

                if (allAttributes.Any())
                {
                    foreach (var attribute in allAttributes)
                    {
                        // Add a placeholder for this item's value for each attribute
                        attributeValues.Add(attribute.Key, null);
                    }

                    // If loading attributes for a saved item, read the item's value(s) for each attribute
                    if (!entityTypeCache.IsEntity || entity.Id != 0)
                    {
                        List <int> attributeIds = allAttributes.Select(a => a.Id).ToList();
                        foreach (var attributeValue in attributeValueService.Queryable().AsNoTracking()
                                 .Where(v => v.EntityId == entity.Id && attributeIds.Contains(v.AttributeId)))
                        {
                            var attributeKey = AttributeCache.Read(attributeValue.AttributeId).Key;
                            attributeValues[attributeKey] = attributeValue.Clone(false) as Rock.Model.AttributeValue;
                        }
                    }

                    // Look for any attributes that don't have a value and create a default value entry
                    foreach (var attribute in allAttributes)
                    {
                        if (attributeValues[attribute.Key] == null)
                        {
                            var attributeValue = new Rock.Model.AttributeValue();
                            attributeValue.AttributeId = attribute.Id;
                            if (entity.AttributeValueDefaults != null && entity.AttributeValueDefaults.ContainsKey(attribute.Name))
                            {
                                attributeValue.Value = entity.AttributeValueDefaults[attribute.Name];
                            }
                            else
                            {
                                attributeValue.Value = attribute.DefaultValue;
                            }
                            attributeValues[attribute.Key] = attributeValue;
                        }
                        else
                        {
                            if (!String.IsNullOrWhiteSpace(attribute.DefaultValue) &&
                                String.IsNullOrWhiteSpace(attributeValues[attribute.Key].Value))
                            {
                                attributeValues[attribute.Key].Value = attribute.DefaultValue;
                            }
                        }
                    }
                }

                entity.Attributes = new Dictionary <string, Web.Cache.AttributeCache>();
                allAttributes.ForEach(a => entity.Attributes.Add(a.Key, a));

                entity.AttributeValues = attributeValues;
            }
        }
Example #41
0
 public override string ToString()
 {
     return((GroupType.ToString().ToUpperInvariant() ?? "") + " " + ("(" + string.Join("\n", Conditions) + (Groups.Any() ? "\n" + string.Join("\n", Groups) : string.Empty) + ")"));
 }
Example #42
0
        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="groupType">The groupType.</param>
        private void ShowReadonlyDetails(GroupType groupType)
        {
            SetEditMode(false);

            if (groupType != null)
            {
                hfGroupTypeId.SetValue(groupType.Id);
                lReadOnlyTitle.Text = groupType.ToString().FormatAsHtmlTitle();

                lDescription.Text = groupType.Description;

                groupType.LoadAttributes();

                hlType.Text    = groupType.GetAttributeValue("CheckInType");
                hlType.Visible = true;

                DescriptionList mainDetailsDescList  = new DescriptionList();
                DescriptionList leftDetailsDescList  = new DescriptionList();
                DescriptionList rightDetailsDescList = new DescriptionList();

                string scheduleList = string.Empty;
                using (var rockContext = new RockContext())
                {
                    var descendantGroupTypeIds = new GroupTypeService(rockContext).GetAllAssociatedDescendents(groupType.Id).Select(a => a.Id);
                    scheduleList = new GroupLocationService(rockContext)
                                   .Queryable().AsNoTracking()
                                   .Where(a =>
                                          a.Group.GroupType.Id == groupType.Id ||
                                          descendantGroupTypeIds.Contains(a.Group.GroupTypeId))
                                   .SelectMany(a => a.Schedules)
                                   .Select(s => s.Name)
                                   .Distinct()
                                   .OrderBy(s => s)
                                   .ToList()
                                   .AsDelimited(", ");
                }

                if (!string.IsNullOrWhiteSpace(scheduleList))
                {
                    mainDetailsDescList.Add("Scheduled Times", scheduleList);
                }

                groupType.LoadAttributes();

                if (groupType.AttributeValues.ContainsKey("core_checkin_CheckInType"))
                {
                    leftDetailsDescList.Add("Check-in Type", groupType.AttributeValues["core_checkin_CheckInType"].ValueFormatted);
                }
                if (groupType.AttributeValues.ContainsKey("core_checkin_SecurityCodeLength"))
                {
                    leftDetailsDescList.Add("Security Code Length", groupType.AttributeValues["core_checkin_SecurityCodeLength"].ValueFormatted);
                }
                if (groupType.AttributeValues.ContainsKey("core_checkin_SearchType"))
                {
                    rightDetailsDescList.Add("Search Type", groupType.AttributeValues["core_checkin_SearchType"].ValueFormatted);
                }
                if (groupType.AttributeValues.ContainsKey("core_checkin_PhoneSearchType"))
                {
                    rightDetailsDescList.Add("Phone Number Compare", groupType.AttributeValues["core_checkin_PhoneSearchType"].ValueFormatted);
                }

                lblMainDetails.Text  = mainDetailsDescList.Html;
                lblLeftDetails.Text  = leftDetailsDescList.Html;
                lblRightDetails.Text = rightDetailsDescList.Html;
            }
        }
Example #43
0
 /// <summary>
 /// Finds all items in the collection belongong to this <paramref name="groupType"/>.
 /// </summary>
 /// <param name="groupType"></param>
 public IEnumerable <KeyValuePair <string, IMRUEntryViewModel> > FindEntries(GroupType groupType)
 {
     return(this.Entries.Where(x => x.Value.GroupItem.Group == groupType).Cast <KeyValuePair <string, IMRUEntryViewModel> >());
 }
Example #44
0
 internal GroupBuilder(SymbolTable scope, GroupType groupType) : base(scope)
 {
     _groupType = groupType;
 }
Example #45
0
        public int CreateGroup(int memberId, string Name, string City, int?Region, int?Country, int?University, System.Web.HttpPostedFile Picture,
                               int?Privacy, bool MembershipApproval, string Description, string Mission, int?Security, GroupType Type, string LegalStatus,
                               GroupStatus Status, string Phone, string Address, string ParentUniqueName)
        {
            var test = TestIfGroupUnique(Name, Type);

            if (test != null)
            {
                return(-1);
            }

            Group g = new Group
            {
                Guid               = System.Guid.NewGuid(),
                CreatorID          = memberId,
                Name               = Name,
                UniqueName         = StringUtils.ToURL(ParentUniqueName != null ? string.Format("{0}-{1}", ParentUniqueName, Name) : Name),
                Phone              = Phone,
                Address            = Address,
                City               = City,
                Region             = Region,
                Country            = Country,
                University         = University,
                Privacy            = Privacy,
                MembershipApproval = MembershipApproval,
                Description        = Description,
                Mission            = Mission,
                Security           = Security,
                Type               = (int)Type,
                LegalStatus        = LegalStatus,
                Status             = (int)Status,
                DateCreated        = DateTime.Now,
                DateModified       = DateTime.Now
            };

            DataContext.Groups.InsertOnSubmit(g);
            DataContext.SubmitChanges();
            if (Picture != null)
            {
                updateGroupPicture(g.ID, Picture, false);
            }


            return(g.ID);
        }
Example #46
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool hasValidationErrors = false;

            using (new UnitOfWorkScope())
            {
                GroupTypeService groupTypeService = new GroupTypeService();
                GroupService     groupService     = new GroupService();
                AttributeService attributeService = new AttributeService();

                int parentGroupTypeId = hfParentGroupTypeId.ValueAsInt();

                var groupTypeUIList = new List <GroupType>();

                foreach (var checkinGroupTypeEditor in phCheckinGroupTypes.Controls.OfType <CheckinGroupTypeEditor>().ToList())
                {
                    var groupType = checkinGroupTypeEditor.GetCheckinGroupType();
                    groupTypeUIList.Add(groupType);
                }

                var groupTypeDBList = new List <GroupType>();

                var groupTypesToDelete = new List <GroupType>();
                var groupsToDelete     = new List <Group>();

                var groupTypesToAddUpdate = new List <GroupType>();
                var groupsToAddUpdate     = new List <Group>();

                GroupType parentGroupTypeDB = groupTypeService.Get(parentGroupTypeId);
                GroupType parentGroupTypeUI = parentGroupTypeDB.Clone(false);
                parentGroupTypeUI.ChildGroupTypes = groupTypeUIList;

                PopulateDeleteLists(groupTypesToDelete, groupsToDelete, parentGroupTypeDB, parentGroupTypeUI);
                PopulateAddUpdateLists(groupTypesToAddUpdate, groupsToAddUpdate, parentGroupTypeUI);

                int binaryFileFieldTypeID = new FieldTypeService().Get(new Guid(Rock.SystemGuid.FieldType.BINARY_FILE)).Id;
                int binaryFileTypeId      = new BinaryFileTypeService().Get(new Guid(Rock.SystemGuid.BinaryFiletype.CHECKIN_LABEL)).Id;

                RockTransactionScope.WrapTransaction(() =>
                {
                    // delete in reverse order to get deepest child items first
                    groupsToDelete.Reverse();
                    foreach (var groupToDelete in groupsToDelete)
                    {
                        groupService.Delete(groupToDelete, this.CurrentPersonId);
                        groupService.Save(groupToDelete, this.CurrentPersonId);
                    }

                    // delete in reverse order to get deepest child items first
                    groupTypesToDelete.Reverse();
                    foreach (var groupTypeToDelete in groupTypesToDelete)
                    {
                        groupTypeService.Delete(groupTypeToDelete, this.CurrentPersonId);
                        groupTypeService.Save(groupTypeToDelete, this.CurrentPersonId);
                    }

                    // Add/Update grouptypes and groups that are in the UI
                    // Note:  We'll have to save all the groupTypes without changing the DB value of ChildGroupTypes, then come around again and save the ChildGroupTypes
                    // since the ChildGroupTypes may not exist in the database yet
                    foreach (GroupType groupTypeUI in groupTypesToAddUpdate)
                    {
                        GroupType groupTypeDB = groupTypeService.Get(groupTypeUI.Guid);
                        if (groupTypeDB == null)
                        {
                            groupTypeDB      = new GroupType();
                            groupTypeDB.Id   = 0;
                            groupTypeDB.Guid = groupTypeUI.Guid;
                        }

                        groupTypeDB.Name  = groupTypeUI.Name;
                        groupTypeDB.Order = groupTypeUI.Order;
                        groupTypeDB.InheritedGroupTypeId = groupTypeUI.InheritedGroupTypeId;

                        groupTypeDB.Attributes      = groupTypeUI.Attributes;
                        groupTypeDB.AttributeValues = groupTypeUI.AttributeValues;

                        if (groupTypeDB.Id == 0)
                        {
                            groupTypeService.Add(groupTypeDB, this.CurrentPersonId);
                        }

                        if (!groupTypeDB.IsValid)
                        {
                            hasValidationErrors = true;
                            CheckinGroupTypeEditor groupTypeEditor = phCheckinGroupTypes.ControlsOfTypeRecursive <CheckinGroupTypeEditor>().First(a => a.GroupTypeGuid == groupTypeDB.Guid);
                            groupTypeEditor.ForceContentVisible    = true;

                            return;
                        }

                        groupTypeService.Save(groupTypeDB, this.CurrentPersonId);

                        Rock.Attribute.Helper.SaveAttributeValues(groupTypeDB, this.CurrentPersonId);

                        // get fresh from database to make sure we have Id so we can update the CheckinLabel Attributes
                        groupTypeDB = groupTypeService.Get(groupTypeDB.Guid);

                        // rebuild the CheckinLabel attributes from the UI (brute-force)
                        foreach (var labelAttributeDB in CheckinGroupTypeEditor.GetCheckinLabelAttributes(groupTypeDB))
                        {
                            var attribute = attributeService.Get(labelAttributeDB.Value.Guid);
                            Rock.Web.Cache.AttributeCache.Flush(attribute.Id);
                            attributeService.Delete(attribute, this.CurrentPersonId);
                        }

                        foreach (var checkinLabelAttributeInfo in GroupTypeCheckinLabelAttributesState[groupTypeUI.Guid])
                        {
                            var attribute = new Rock.Model.Attribute();
                            attribute.AttributeQualifiers.Add(new AttributeQualifier {
                                Key = "binaryFileType", Value = binaryFileTypeId.ToString()
                            });
                            attribute.Guid         = Guid.NewGuid();
                            attribute.FieldTypeId  = binaryFileFieldTypeID;
                            attribute.EntityTypeId = EntityTypeCache.GetId(typeof(GroupType));
                            attribute.EntityTypeQualifierColumn = "Id";
                            attribute.EntityTypeQualifierValue  = groupTypeDB.Id.ToString();
                            attribute.DefaultValue = checkinLabelAttributeInfo.BinaryFileId.ToString();
                            attribute.Key          = checkinLabelAttributeInfo.AttributeKey;
                            attribute.Name         = checkinLabelAttributeInfo.FileName;

                            if (!attribute.IsValid)
                            {
                                hasValidationErrors = true;
                                CheckinGroupTypeEditor groupTypeEditor = phCheckinGroupTypes.ControlsOfTypeRecursive <CheckinGroupTypeEditor>().First(a => a.GroupTypeGuid == groupTypeDB.Guid);
                                groupTypeEditor.ForceContentVisible    = true;

                                return;
                            }

                            attributeService.Add(attribute, this.CurrentPersonId);
                            attributeService.Save(attribute, this.CurrentPersonId);
                        }
                    }

                    // Add/Update Groups
                    foreach (var groupUI in groupsToAddUpdate)
                    {
                        Group groupDB = groupService.Get(groupUI.Guid);
                        if (groupDB == null)
                        {
                            groupDB      = new Group();
                            groupDB.Guid = groupUI.Guid;
                        }

                        groupDB.Name = groupUI.Name;

                        // delete any GroupLocations that were removed in the UI
                        foreach (var groupLocationDB in groupDB.GroupLocations.ToList())
                        {
                            if (!groupUI.GroupLocations.Select(a => a.LocationId).Contains(groupLocationDB.LocationId))
                            {
                                groupDB.GroupLocations.Remove(groupLocationDB);
                            }
                        }

                        // add any GroupLocations that were added in the UI
                        foreach (var groupLocationUI in groupUI.GroupLocations)
                        {
                            if (!groupDB.GroupLocations.Select(a => a.LocationId).Contains(groupLocationUI.LocationId))
                            {
                                GroupLocation groupLocationDB = new GroupLocation {
                                    LocationId = groupLocationUI.LocationId
                                };
                                groupDB.GroupLocations.Add(groupLocationDB);
                            }
                        }

                        groupDB.Order = groupUI.Order;

                        // get GroupTypeId from database in case the groupType is new
                        groupDB.GroupTypeId     = groupTypeService.Get(groupUI.GroupType.Guid).Id;
                        groupDB.Attributes      = groupUI.Attributes;
                        groupDB.AttributeValues = groupUI.AttributeValues;

                        if (groupDB.Id == 0)
                        {
                            groupService.Add(groupDB, this.CurrentPersonId);
                        }

                        if (!groupDB.IsValid)
                        {
                            hasValidationErrors             = true;
                            hasValidationErrors             = true;
                            CheckinGroupEditor groupEditor  = phCheckinGroupTypes.ControlsOfTypeRecursive <CheckinGroupEditor>().First(a => a.GroupGuid == groupDB.Guid);
                            groupEditor.ForceContentVisible = true;

                            return;
                        }

                        groupService.Save(groupDB, this.CurrentPersonId);

                        Rock.Attribute.Helper.SaveAttributeValues(groupDB, this.CurrentPersonId);
                    }

                    /* now that we have all the grouptypes saved, now lets go back and save them again with the current UI ChildGroupTypes */

                    // save main parentGroupType with current UI ChildGroupTypes
                    parentGroupTypeDB.ChildGroupTypes = new List <GroupType>();
                    parentGroupTypeDB.ChildGroupTypes.Clear();
                    foreach (var childGroupTypeUI in parentGroupTypeUI.ChildGroupTypes)
                    {
                        var childGroupTypeDB = groupTypeService.Get(childGroupTypeUI.Guid);
                        parentGroupTypeDB.ChildGroupTypes.Add(childGroupTypeDB);
                    }

                    groupTypeService.Save(parentGroupTypeDB, this.CurrentPersonId);

                    // loop thru all the other GroupTypes in the UI and save their childgrouptypes
                    foreach (var groupTypeUI in groupTypesToAddUpdate)
                    {
                        var groupTypeDB             = groupTypeService.Get(groupTypeUI.Guid);
                        groupTypeDB.ChildGroupTypes = new List <GroupType>();
                        groupTypeDB.ChildGroupTypes.Clear();
                        foreach (var childGroupTypeUI in groupTypeUI.ChildGroupTypes)
                        {
                            var childGroupTypeDB = groupTypeService.Get(childGroupTypeUI.Guid);
                            groupTypeDB.ChildGroupTypes.Add(childGroupTypeDB);
                        }

                        groupTypeService.Save(groupTypeDB, this.CurrentPersonId);
                    }
                });
            }

            if (!hasValidationErrors)
            {
                NavigateToParentPage();
            }
        }
Example #47
0
 public DataTable SearchGroups(string name, GroupType Type, string max)
 {
     return(DBUtils.GetDataSet(GetSearchGroupsString(name, Type, max), cte.lib).Tables[0]);
 }
Example #48
0
        /// <summary>
        /// Populates the delete lists (recursive)
        /// </summary>
        /// <param name="groupTypesToDelete">The group types to delete.</param>
        /// <param name="groupsToDelete">The groups to delete.</param>
        /// <param name="groupTypeDB">The group type DB.</param>
        /// <param name="groupTypeUI">The group type UI.</param>
        private static void PopulateDeleteLists(List <GroupType> groupTypesToDelete, List <Group> groupsToDelete, GroupType groupTypeDB, GroupType groupTypeUI)
        {
            // limit to child group types that are not Templates
            int[] templateGroupTypes = new int[] {
                DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_TEMPLATE).Id,
                DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER).Id
            };

            // delete non-template childgrouptypes that were deleted in this ui
            foreach (var childGroupTypeDB in groupTypeDB.ChildGroupTypes)
            {
                if (!templateGroupTypes.Contains(childGroupTypeDB.GroupTypePurposeValueId ?? 0))
                {
                    GroupType childGroupTypeUI = null;
                    if (groupTypeUI != null)
                    {
                        childGroupTypeUI = groupTypeUI.ChildGroupTypes.FirstOrDefault(a => a.Guid == childGroupTypeDB.Guid);
                    }

                    PopulateDeleteLists(groupTypesToDelete, groupsToDelete, childGroupTypeDB, childGroupTypeUI);

                    if (childGroupTypeUI == null)
                    {
                        groupTypesToDelete.Add(childGroupTypeDB);

                        // delete all the groups that are in the GroupType that is getting deleted
                        foreach (var group in childGroupTypeDB.Groups)
                        {
                            groupsToDelete.Add(group);
                        }
                    }
                    else
                    {
                        // delete all the groups that are no longer in the UI for this groupType
                        foreach (var childGroupDB in childGroupTypeDB.Groups)
                        {
                            if (childGroupTypeUI.Groups.FirstOrDefault(a => a.Guid == childGroupDB.Guid) == null)
                            {
                                groupsToDelete.Add(childGroupDB);
                            }
                        }
                    }
                }
            }
        }
Example #49
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     return(GroupType.ToString());
 }
Example #50
0
        public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCount, uint? offset = null, uint? count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint? countryId = null, uint? cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new GroupsSearchParams
            {
                Query = query,
                Sort = sort,
                Count = count,
                Offset = offset,
                Type = type,
                CityId = cityId,
                CountryId = countryId,
                Future = future
            };
            var result = Search(parameters);

            totalCount = Convert.ToInt32(result.TotalCount);

            return result.ToReadOnlyCollection();
        }
Example #51
0
        /// <summary>
        /// Populates the add update lists.
        /// </summary>
        /// <param name="groupTypesToAddUpdate">The group types to add update.</param>
        /// <param name="groupsToAddUpdate">The groups to add update.</param>
        /// <param name="groupTypeUI">The group type UI.</param>
        private static void PopulateAddUpdateLists(List <GroupType> groupTypesToAddUpdate, List <Group> groupsToAddUpdate, GroupType groupTypeUI)
        {
            int groupTypeSortOrder = 0;
            int groupSortOrder     = 0;

            foreach (var childGroupTypeUI in groupTypeUI.ChildGroupTypes)
            {
                PopulateAddUpdateLists(groupTypesToAddUpdate, groupsToAddUpdate, childGroupTypeUI);
                childGroupTypeUI.Order = groupTypeSortOrder++;
                groupTypesToAddUpdate.Add(childGroupTypeUI);
                foreach (var groupUI in childGroupTypeUI.Groups)
                {
                    groupUI.Order = groupSortOrder++;
                    groupsToAddUpdate.Add(groupUI);
                }
            }
        }
Example #52
0
 internal static Exception InconsistentConnector(char ch, GroupType type)
 {
     return(new SgmlParseException(String.Format(
                                       Resources.Resources.Error_InconsistentConnector, ch, type.ToString())));
 }
Example #53
0
        public static void Initialize(FireteamDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return; // Context has already been seeded
            }

            var users = new User[]
            {
                new User()
                {
                    ID                = 1,
                    UserName          = "******",
                    FirstName         = "Leroy",
                    LastName          = "Jenkins",
                    CanShowInSearches = true,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Central Time",
                    Birthday          = DateTime.Parse("6/15/1983"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                },
                new User()
                {
                    ID                = 2,
                    UserName          = "******",
                    FirstName         = "Darth",
                    LastName          = "Maul",
                    CanShowInSearches = true,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Pacific Time",
                    Birthday          = DateTime.Parse("9/02/1972"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                },
                new User()
                {
                    ID                = 3,
                    UserName          = "******",
                    FirstName         = "Kate",
                    LastName          = "Beckinsale",
                    CanShowInSearches = false,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Eastern Time",
                    Birthday          = DateTime.Parse("8/06/1973"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                }
            };

            foreach (var user in users)
            {
                context.Users.Add(user);
            }

            var userFriends = new UserFriend[]
            {
                new UserFriend()
                {
                    ID = 1, UserID = 1, FriendID = 2, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 2, UserID = 1, FriendID = 3, CanAddToActivities = false, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 3, UserID = 3, FriendID = 1, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 4, UserID = 2, FriendID = 1, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var userFriend in userFriends)
            {
                context.UserFriends.Add(userFriend);
            }
            context.SaveChanges();


            context.SaveChanges();

            var consoleModels = new ConsoleModel[]
            {
                new ConsoleModel()
                {
                    ID           = 1,
                    Name         = "Playstation 4",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 2,
                    Name         = "Playstation 3",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 3,
                    Name         = "PS Vita",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 4,
                    Name         = "XBox 360",
                    Manufacturer = "Microsoft",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 5,
                    Name         = "XBox One",
                    Manufacturer = "Microsoft",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 6,
                    Name         = "Wii",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 7,
                    Name         = "Wii U",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 8,
                    Name         = "Switch",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 9,
                    Name         = "DS/DSXL/3DS/2DS",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                }
            };

            foreach (var consoleModel in consoleModels)
            {
                context.ConsoleModels.Add(consoleModel);
            }
            context.SaveChanges();

            var groupTypes = new GroupType[]
            {
                new GroupType()
                {
                    ID          = 1,
                    Name        = "Clan",
                    Description = "A group of team mates with a loose but solid leadership structure",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new GroupType()
                {
                    ID          = 2,
                    Name        = "Guild",
                    Description =
                        "A group of team mates with a common set of skills that often teach or train newcomers",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new GroupType()
                {
                    ID          = 3,
                    Name        = "Friends",
                    Description = "A group of friends that enjoy playing games together",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                }
            };

            foreach (var groupType in groupTypes)
            {
                context.GroupTypes.Add(groupType);
            }
            context.SaveChanges();

            var groups = new Group[]
            {
                new Group()
                {
                    ID           = 1,
                    Name         = "Master Blasters",
                    Description  = "Two men enter, one man leaves...",
                    GroupTypeID  = 1,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 2,
                    Name        = "All_the_victories",
                    Description =
                        "A dedicated guild of PvP players who seek to hone their craft and help others learn it as well",
                    GroupTypeID  = 2,
                    IsHidden     = false,
                    IsInviteOnly = false,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 3,
                    Name        = "Colpeck Game Night Friends",
                    Description =
                        "A group of friends that meet at the Colpecks to play silly games and get a little drunk",
                    GroupTypeID  = 3,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 4,
                    Name        = "Death Dealers",
                    Description =
                        "We wage a war that has raged on for over a thousand years.  Only Vampires need apply.",
                    GroupTypeID  = 1,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                }
            };

            foreach (var group in groups)
            {
                context.Groups.Add(group);
            }
            context.SaveChanges();

            var userGroups = new UserGroup[]
            {
                new UserGroup()
                {
                    ID        = 1,
                    GroupID   = 1,
                    UserID    = 2,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 2,
                    GroupID   = 2,
                    UserID    = 1,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 3,
                    GroupID   = 2,
                    UserID    = 1,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 4,
                    GroupID   = 3,
                    UserID    = 3,
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var userGroup in userGroups)
            {
                context.UserGroups.Add(userGroup);
            }
            context.SaveChanges();

            var groupUsers = new GroupUser[]
            {
                new GroupUser()
                {
                    ID = 1, GroupID = 4, UserID = 3, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 2, GroupID = 1, UserID = 2, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 3, GroupID = 2, UserID = 1, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 4, GroupID = 2, UserID = 2, IsDeleted = false, IsGroupLeadership = false, Created = DateTime.Now
                }
            };

            foreach (var groupUser in groupUsers)
            {
                context.GroupUsers.Add(groupUser);
            }
            context.SaveChanges();

            var activityTypes = new ActivityType[]
            {
                new ActivityType()
                {
                    ID          = 1,
                    Name        = "Mission",
                    Description = "An in-game mission requring multi-player participation",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new ActivityType()
                {
                    ID          = 2,
                    Name        = "Quest",
                    Description = "A multi-part quest line that encompasses several missions",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new ActivityType()
                {
                    ID          = 3,
                    Name        = "Raid / Multi-player instance",
                    Description =
                        "An activity that requires specific fireteam composition and planning, usually granting end-game awards",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new ActivityType()
                {
                    ID          = 4,
                    Name        = "Player vs Player (PVP)",
                    Description =
                        "PvP activities like \"Death Matches\" as well as objective based activities like \"Capture the Flag\"",
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var activityType in activityTypes)
            {
                context.ActivityTypes.Add(activityType);
            }

            context.SaveChanges();

            var gameTypes = new GameType[]
            {
                new GameType()
                {
                    ID          = 1,
                    Name        = "Multiplayer FPS",
                    Description = "A multiplayer online first-person shooter",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new GameType()
                {
                    ID          = 2,
                    Name        = "PvP Arena",
                    Description = "A game that pits teams of players against each other who then battle for supremacy",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                }
            };

            foreach (var gameType in gameTypes)
            {
                context.GameTypes.Add(gameType);
            }
            context.SaveChanges();

            var games = new Game[]
            {
                new Game()
                {
                    ID          = 1,
                    Title       = "Destiny",
                    Description =
                        "Guardians, the last hope of the light, battle darkness in and around the last city on Earth.",
                    GameTypeID = 1,
                    Publisher  = "Activision",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new Game()
                {
                    ID          = 2,
                    Title       = "Overwatch",
                    Description =
                        "In a time of global crisis, an international task force of heroes banded together to restore peace to a war-torn world: OVERWATCH.",
                    GameTypeID = 1,
                    Publisher  = "Blizzard",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new Game()
                {
                    ID          = 3,
                    Title       = "Mass Effect: Andromeda",
                    Description =
                        "Chart your own course in a dangerous new galaxy. Unravel the mysteries of the Andromeda galaxy as you discover rich, alien worlds in the search for humanity's new home",
                    GameTypeID = 1,
                    Publisher  = "Electronic Arts",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                }
            };

            foreach (var game in games)
            {
                context.Games.Add(game);
            }
            context.SaveChanges();

            var platforms = new Platform[]
            {
                new Platform()
                {
                    ID        = 1,
                    Name      = "Playstation",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 2,
                    Name      = "XBox",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 3,
                    Name      = "Nintendo",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 4,
                    Name      = "PC",
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var platform in platforms)
            {
                context.Platforms.Add(platform);
            }
            context.SaveChanges();

            var gamePlatforms = new GamePlatform[]
            {
                new GamePlatform()
                {
                    ID = 1, GameID = 1, PlatformID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new GamePlatform()
                {
                    ID = 2, GameID = 1, PlatformID = 2, Created = DateTime.Now, IsDeleted = false
                },
                new GamePlatform()
                {
                    ID = 3, GameID = 1, PlatformID = 4, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var gamePlatform in gamePlatforms)
            {
                context.GamePlatforms.Add(gamePlatform);
            }
            context.SaveChanges();

            var platformAccounts = new PlatformAccount[]
            {
                new PlatformAccount()
                {
                    ID = 1, ConsoleModelID = 1, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 2, ConsoleModelID = 2, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 3, ConsoleModelID = 3, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 4, ConsoleModelID = 4, UserID = 2, PlatformID = 2, GamerTag = "XxDarthDudexX", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 5, UserID = 1, PlatformID = 4, GamerTag = "lroy_JEENKINS", Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var platformAccount in platformAccounts)
            {
                context.PlatformAccounts.Add(platformAccount);
            }
            context.SaveChanges();

            var activities = new Activity[]
            {
                new Activity()
                {
                    ID             = 1,
                    ActivityTypeID = 1,
                    AvailableSlots = 2,
                    Description    = "Black Spindle mission.  Come have a chill run and get things done!  Looking for a good team to get through this.",
                    Duration       = "00:02:00",
                    GameID         = 1,
                    UserID         = 2,
                    Requirements   = "Must have Y4 Ice Breaker... just cuz.",
                    TimeZone       = "Central Time",
                    StartTime      = DateTime.Parse("5/02/2017 01:30:00 PM"),
                    IsHidden       = false,
                    IsInviteOnly   = false,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new Activity()
                {
                    ID             = 2,
                    ActivityTypeID = 2,
                    AvailableSlots = 2,
                    Description    = "Trying to get this stupid exotic quest done.  Need two to run some strikes with.",
                    Duration       = "00:01:30",
                    GameID         = 1,
                    UserID         = 2,
                    Requirements   = "Need a Hunter and a Warlock.  I'll bring my Titan",
                    TimeZone       = "Pacific Time",
                    StartTime      = DateTime.Parse("5/14/2017 04:00:00 PM"),
                    IsHidden       = false,
                    IsInviteOnly   = false,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new Activity()
                {
                    ID             = 3,
                    ActivityTypeID = 1,
                    AvailableSlots = 5,
                    Description    = "Private raid with 'Selene' to expterminate these Lycans.. I mean Fallen... once and for all.",
                    Duration       = "00:04:00",
                    GameID         = 1,
                    UserID         = 3,
                    GroupID        = 4,
                    Requirements   = "Request to join.  Your credentials will be checked at the door... by force, if necessary",
                    TimeZone       = "Eastern Time",
                    StartTime      = DateTime.Parse("5/28/2017 07:00:00 AM"),
                    IsHidden       = false,
                    IsInviteOnly   = true,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                }
            };

            foreach (var activity in activities)
            {
                context.Activities.Add(activity);
            }
            context.SaveChanges();


            var userGames = new UserGame[]
            {
                new UserGame()
                {
                    ID = 1, UserID = 2, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new UserGame()
                {
                    ID = 2, UserID = 3, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new UserGame()
                {
                    ID = 3, UserID = 1, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
            };

            foreach (var userGame in userGames)
            {
                context.UserGames.Add(userGame);
            }
            context.SaveChanges();


            var activityUsers = new ActivityUser[]
            {
                new ActivityUser()
                {
                    ID            = 1,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = false,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.None,
                    UserID        = 1
                },
                new ActivityUser()
                {
                    ID            = 2,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = true,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.Unfriendly,
                    UserID        = 2
                },
                new ActivityUser()
                {
                    ID            = 3,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = false,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.None,
                    UserID        = 3
                }
            };

            foreach (var activityUser in activityUsers)
            {
                context.ActivityUsers.Add(activityUser);
            }
            context.SaveChanges();

            var blockedUsers = new BlockedUser[]
            {
                new BlockedUser()
                {
                    ID         = 1,
                    ActivityID = 1,
                    UserID     = 2,
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new BlockedUser()
                {
                    ID             = 2,
                    BlockingUserID = 3,
                    UserID         = 2,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new BlockedUser()
                {
                    ID = 3,
                    BlockingGroupID = 1,
                    UserID          = 2,
                    Created         = DateTime.Now,
                    IsDeleted       = false
                }
            };

            foreach (var blockedUser in blockedUsers)
            {
                context.BlockedUsers.Add(blockedUser);
            }
            context.SaveChanges();

            var gameConsoleModels = new GameConsoleModel[]
            {
                new GameConsoleModel()
                {
                    ID = 1, GameID = 1, ConsoleModelID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new GameConsoleModel()
                {
                    ID = 2, GameID = 1, ConsoleModelID = 2, Created = DateTime.Now, IsDeleted = false
                },
                new GameConsoleModel()
                {
                    ID = 3, GameID = 1, ConsoleModelID = 4, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var gameConsoleModel in gameConsoleModels)
            {
                context.GameConsoleModels.Add(gameConsoleModel);
            }
            context.SaveChanges();
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="pledgeId">The pledge identifier.</param>
        public void ShowDetail(int pledgeId)
        {
            pnlDetails.Visible = true;
            var frequencyTypeGuid = new Guid(Rock.SystemGuid.DefinedType.FINANCIAL_FREQUENCY);

            dvpFrequencyType.DefinedTypeId = DefinedTypeCache.Get(frequencyTypeGuid).Id;

            using (var rockContext = new RockContext())
            {
                FinancialPledge pledge = null;

                if (pledgeId > 0)
                {
                    pledge            = new FinancialPledgeService(rockContext).Get(pledgeId);
                    lActionTitle.Text = ActionTitle.Edit(FinancialPledge.FriendlyTypeName).FormatAsHtmlTitle();
                    pdAuditDetails.SetEntity(pledge, ResolveRockUrl("~"));
                }

                if (pledge == null)
                {
                    pledge            = new FinancialPledge();
                    lActionTitle.Text = ActionTitle.Add(FinancialPledge.FriendlyTypeName).FormatAsHtmlTitle();
                    // hide the panel drawer that show created and last modified dates
                    pdAuditDetails.Visible = false;
                }

                var isReadOnly  = !IsUserAuthorized(Authorization.EDIT);
                var isNewPledge = pledge.Id == 0;

                hfPledgeId.Value = pledge.Id.ToString();
                if (pledge.PersonAlias != null)
                {
                    ppPerson.SetValue(pledge.PersonAlias.Person);
                }
                else
                {
                    Person person     = null;
                    var    personGuid = PageParameter(PageParameterKey.PersonGuid).AsGuidOrNull();
                    if (personGuid.HasValue)
                    {
                        person = new PersonService(rockContext).Get(personGuid.Value);
                    }

                    ppPerson.SetValue(person);
                }
                ppPerson.Enabled = !isReadOnly;

                GroupType groupType     = null;
                Guid?     groupTypeGuid = GetAttributeValue("SelectGroupType").AsGuidOrNull();
                if (groupTypeGuid.HasValue)
                {
                    groupType = new GroupTypeService(rockContext).Get(groupTypeGuid.Value);
                }

                if (groupType != null)
                {
                    ddlGroup.Label   = groupType.Name;
                    ddlGroup.Visible = true;
                    LoadGroups(pledge.GroupId);
                    ddlGroup.Enabled = !isReadOnly;
                }
                else
                {
                    ddlGroup.Visible = false;
                }

                apAccount.SetValue(pledge.Account);
                apAccount.Enabled = !isReadOnly;
                tbAmount.Value    = !isNewPledge ? pledge.TotalAmount : ( decimal? )null;
                tbAmount.ReadOnly = isReadOnly;

                dpDateRange.LowerValue = pledge.StartDate;
                dpDateRange.UpperValue = pledge.EndDate;
                dpDateRange.ReadOnly   = isReadOnly;

                dvpFrequencyType.SelectedValue = !isNewPledge?pledge.PledgeFrequencyValueId.ToString() : string.Empty;

                dvpFrequencyType.Enabled = !isReadOnly;

                if (isReadOnly)
                {
                    nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FinancialPledge.FriendlyTypeName);
                    lActionTitle.Text      = ActionTitle.View(BlockType.FriendlyTypeName);
                    btnCancel.Text         = "Close";
                }

                btnSave.Visible = !isReadOnly;
            }
        }
Example #55
0
        //********************
        // Index
        public ActionResult Index(GroupType _GroupId)
        {
            int _CompanyId;

            try { _CompanyId = int.Parse(User.FindFirst("CompanyId").Value); }
            catch (Exception) { return(RedirectToAction(nameof(Error), new { _Message = "Login Necessário!" })); }
            //
            Class_Cadaster _Cadaster = new Class_Cadaster
            {
                CompanyId = _CompanyId,
                GroupId   = _GroupId,
                GroupName = _GroupId.ToString()
            };

            //1o estagio
            var _GL = from s in _context.Class_GroupLevel
                      where s.CompanyId == _CompanyId && s.GroupId == _GroupId
                      orderby s.StatusId, s.Name
            select s;

            //
            foreach (var _Lgl in _GL)
            {
                var _Ig = new Class_CadasterItem()
                {
                    TypeLine = "Cabec",

                    GroupLevelId        = 0,
                    GroupLevelItemId    = 0,
                    GroupLevelItemTaxID = 0,

                    ItemDesc = "Grupo",
                };
                _Cadaster.CadasterLIST.Add(_Ig);
                //
                var _Igl = new Class_CadasterItem()
                {
                    TypeLine = "Item",

                    GroupLevelId        = _Lgl.Id,
                    GroupLevelName      = _Lgl.Name,
                    GroupLevelItemId    = 0,
                    GroupLevelItemTaxID = 0,

                    ItemDesc = "| " + _Lgl.Name
                };
                if (_Lgl.StatusId != GroupLevelStatus.Ativo)
                {
                    _Igl.ItemDesc = "| " + _Lgl.StatusId.ToString() + "  " + _Igl.ItemDesc;
                }
                _Cadaster.CadasterLIST.Add(_Igl);

                if (_Lgl.StatusId != GroupLevelStatus.Suspenso)
                {
                    _Igl = new Class_CadasterItem()
                    {
                        TypeLine = "Cabec",

                        GroupLevelId        = _Lgl.Id,
                        GroupLevelName      = _Lgl.Name,
                        GroupLevelItemId    = 0,
                        GroupLevelItemTaxID = 0,

                        ItemDesc = "Item do Grupo"
                    };
                    _Cadaster.CadasterLIST.Add(_Igl);
                    //

                    //2o estagio
                    var _GLI = from s in _context.Class_GroupLevelItem
                               where s.GroupLevelId == _Lgl.Id
                               orderby s.StatusId, s.Name
                    select s;
                    //
                    foreach (var _Lgli in _GLI)
                    {
                        var _Igli = new Class_CadasterItem()
                        {
                            TypeLine = "Item",

                            GroupLevelId        = _Lgl.Id,
                            GroupLevelItemId    = _Lgli.Id,
                            GroupLevelItemName  = _Lgli.Name,
                            GroupLevelItemTaxID = 0,

                            ItemDesc = "| " + _Lgli.Name
                        };
                        if (_Lgli.StatusId != GroupLevelItemStatus.Ativo)
                        {
                            _Igli.ItemDesc = "| " + _Lgli.StatusId.ToString() + "  " + _Igli.ItemDesc;
                        }
                        if (_Lgl.GroupId == GroupType.ACOMODACAO)
                        {
                            _Igli.ItemDesc = string.Format("{0} - No.Ocup. {1} - Prep.PCD? {2}", _Igli.ItemDesc, _Lgli.OccupantsNum, _Lgli.PCD.ToString());
                        }
                        _Cadaster.CadasterLIST.Add(_Igli);

                        if (_Lgli.StatusId != GroupLevelItemStatus.Suspenso)
                        {
                            //3o estagio
                            var _SI = from s1 in _context.Class_SeasonItem
                                      join s2 in _context.Class_Season on s1.SeasonId equals s2.Id
                                      where s1.GroupLevelItemId == _Lgli.Id
                                      orderby s2.Name
                                      select new { SeasonItemID = s1.Id, SeasonItemTAX = s1.Tax, SeasonItemNAME = s2.Name };
                            //
                            if (_SI.Count() > 0)
                            {
                                _Igli = new Class_CadasterItem()
                                {
                                    TypeLine = "Item",

                                    GroupLevelId          = _Lgl.Id,
                                    GroupLevelItemId      = _Lgli.Id,
                                    GroupLevelItemTaxID   = 0,
                                    GroupLevelItemTaxNAME = "",

                                    ItemDesc = "| " + _Lgli.Name
                                };
                                _Cadaster.CadasterLIST.Add(_Igli);
                                //
                                foreach (var _SIitem in _SI)
                                {
                                    var _Iglit = new Class_CadasterItem()
                                    {
                                        TypeLine = "Item",

                                        GroupLevelId          = _Lgl.Id,
                                        GroupLevelItemId      = _Lgli.Id,
                                        GroupLevelItemName    = _Lgli.Name,
                                        GroupLevelItemTaxID   = _SIitem.SeasonItemID,
                                        GroupLevelItemTaxNAME = _SIitem.SeasonItemNAME,
                                        GroupLevelItemTaxTAX  = _SIitem.SeasonItemTAX,

                                        ItemDesc = string.Format("{0} - {1}", _SIitem.SeasonItemNAME, _SIitem.SeasonItemTAX.ToString("C2"))
                                    };
                                    _Cadaster.CadasterLIST.Add(_Iglit);
                                }
                            }

                            _Igli = new Class_CadasterItem()
                            {
                                TypeLine = "Linha",

                                GroupLevelId        = 0,
                                GroupLevelItemId    = 0,
                                GroupLevelItemTaxID = 0,

                                ItemDesc = ""
                            };
                            _Cadaster.CadasterLIST.Add(_Igli);
                        }
                    }
                }
            }
            return(View(_Cadaster));
        }
Example #56
0
        /// <summary>
        /// Exports any groups found.  Currently, this export doesn't support
        ///  group heirarchies and all groups will be imported to the
        ///  root of the group viewer.
        /// </summary>
        public static void ExportGroups(string Selections)
        {
            // Make sure some group was selected
            if (Selections.Length == 0)
            {
                return;
            }
            _SelectedGroupIDs = Selections;

            // Create a Group Type and Parent Group to house these groups
            var type = new GroupType()
            {
                Id   = 9999,
                Name = "ShelbyNext"
            };

            ImportPackage.WriteToPackage(type);
            var ParentGroup = new Core.Model.Group()
            {
                Id          = 9999,
                Name        = "From ShelbyNext",
                IsActive    = true,
                IsPublic    = true,
                GroupTypeId = type.Id
            };

            ImportPackage.WriteToPackage(ParentGroup);

            // Retrieve the information for the selected Group IDs
            try
            {
                using (DataTable dtGroups = GetTableData(SQL_SELECTED_GROUPS))
                {
                    Regex regex = new Regex($@"(?:(?<logic>OR|AND)\|)?[0-9]+~~(?<table>[A-Z]+)->(?<column>[A-Z0-9_]+).*?~[=|b]~""(?<value>.*?)""~~");

                    // Process each selected group
                    foreach (DataRow row in dtGroups.Rows)
                    {
                        var group = SNGroup.Translate(row, ParentGroup);
                        if (group == null)
                        {
                            continue;
                        }

                        // Initialize the Group Members SQL clause. Does this group include Disabled/Inactive people?
                        if (row.Field <string>("INC_DISABLED") == "1")
                        {
                            _SQLClause = "";
                        }
                        else
                        {
                            _SQLClause = "(I.ACTIVE_IND <> '1' OR I.ACTIVE_IND is null) AND ";
                        }

                        // Decode the Shelby Next group definiton. Construct a SQL clause to get the Members.
                        string definition = row.Field <string>("CONDITION");
                        foreach (Match match in regex.Matches(definition))
                        {
                            // Add in logic operators as needed
                            switch (match.Groups["logic"].Value)
                            {
                            case "AND": _SQLClause += " AND "; break;

                            case "OR": _SQLClause += ") OR ("; break;
                            }

                            // Groups can be defined using an csIND, csATTR or csFamily table value.
                            switch (match.Groups["table"].Value)
                            {
                            case "CSATTR":
                                _SQLClause += "A.TBL_ID='" + match.Groups["value"].Value.Trim() + "'";
                                break;

                            case "CSIND":
                                _SQLClause += "I." + match.Groups["column"].Value + "='" + match.Groups["value"].Value.Trim() + "'";
                                break;

                            case "CSFAMILY":
                                _SQLClause += "F." + match.Groups["column"].Value + "='" + match.Groups["value"].Value.Trim() + "'";
                                break;
                            }
                        }
                        _SQLClause = "(" + _SQLClause + ")";

                        // Retrieve the Members of this Group
                        using (DataTable dtGroupMembers = GetTableData(SQL_GROUPMEMBERS))
                            foreach (DataRow GM_row in dtGroupMembers.Rows)
                            {
                                var member = SNGroupMember.Translate(GM_row, group.Id);
                                if (member == null)
                                {
                                    continue;
                                }

                                group.GroupMembers.Add(member);
                            }

                        // Export this Group with Members
                        ImportPackage.WriteToPackage(group);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
        }
Example #57
0
 public Group Create(string title, string description, GroupType type = null, GroupSubType subtype = GroupSubType.PlaceOrSmallCompany)
 {
     var parameters = new VkParameters
     {
         { "title", title },
         { "description", description },
         { "type", type },
         { "subtype", subtype }
     };
     return _vk.Call("groups.create", parameters);
 }
Example #58
0
        Stream(ArrayList data, ElementType sym)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(ElementType)));

            // no data at this level yet

            AnnotationSymbolType annoType = sym as AnnotationSymbolType;

            if (annoType != null)
            {
                Stream(data, annoType);
                return;
            }

            AreaReinforcementType areaReinforcementType = sym as AreaReinforcementType;

            if (areaReinforcementType != null)
            {
                Stream(data, areaReinforcementType);
                return;
            }

            AreaTagType areaTagType = sym as AreaTagType;

            if (areaTagType != null)
            {
                Stream(data, areaTagType);
                return;
            }

            BeamSystemType beamSystemType = sym as BeamSystemType;

            if (beamSystemType != null)
            {
                Stream(data, beamSystemType);
                return;
            }

            DimensionType dimType = sym as DimensionType;

            if (dimType != null)
            {
                Stream(data, dimType);
                return;
            }

            //TF
            FabricSheetType fabricST = sym as FabricSheetType;

            if (fabricST != null)
            {
                Stream(data, fabricST);
                return;
            }

            FabricWireType fabricWT = sym as FabricWireType;

            if (fabricWT != null)
            {
                Stream(data, fabricWT);
                return;
            }
            //TFEND

            GroupType groupType = sym as GroupType;

            if (groupType != null)
            {
                Stream(data, groupType);
                return;
            }

            HostObjAttributes hostAtt = sym as HostObjAttributes;

            if (hostAtt != null)
            {
                Stream(data, hostAtt);
                return;
            }

            InsertableObject insObj = sym as InsertableObject;

            if (insObj != null)
            {
                Stream(data, insObj);
                return;
            }

            LevelType levelType = sym as LevelType;

            if (levelType != null)
            {
                Stream(data, levelType);
                return;
            }

            LineAndTextAttrSymbol lineAndTextAttr = sym as LineAndTextAttrSymbol;

            if (lineAndTextAttr != null)
            {
                Stream(data, lineAndTextAttr);
                return;
            }

            LoadTypeBase loadTypeBase = sym as LoadTypeBase;

            if (loadTypeBase != null)
            {
                Stream(data, loadTypeBase);
                return;
            }

            MEPBuildingConstruction mepBldConst = sym as MEPBuildingConstruction;

            if (mepBldConst != null)
            {
                Stream(data, mepBldConst);
                return;
            }

            PathReinforcementType pathReinforcementType = sym as PathReinforcementType;

            if (pathReinforcementType != null)
            {
                Stream(data, pathReinforcementType);
                return;
            }

            RebarBarType rebarBarType = sym as RebarBarType;

            if (rebarBarType != null)
            {
                Stream(data, rebarBarType);
                return;
            }

            RebarCoverType rebarCoverType = sym as RebarCoverType;

            if (rebarCoverType != null)
            {
                Stream(data, rebarCoverType);
                return;
            }

            RebarHookType rebarHookType = sym as RebarHookType;

            if (rebarHookType != null)
            {
                Stream(data, rebarHookType);
                return;
            }

            RebarShape rebarShape = sym as RebarShape;

            if (rebarShape != null)
            {
                Stream(data, rebarShape);
                return;
            }

            RoomTagType roomTagType = sym as RoomTagType;

            if (roomTagType != null)
            {
                Stream(data, roomTagType);
                return;
            }

            SpaceTagType spaceTagType = sym as SpaceTagType;

            if (spaceTagType != null)
            {
                Stream(data, spaceTagType);
                return;
            }

            TrussType trussType = sym as TrussType;

            if (trussType != null)
            {
                Stream(data, trussType);
                return;
            }

            DistributionSysType distSysType = sym as DistributionSysType;

            if (distSysType != null)
            {
                Stream(data, distSysType);
                return;
            }

            MEPCurveType mepCurType = sym as MEPCurveType;

            if (mepCurType != null)
            {
                Stream(data, mepCurType);
                return;
            }

            FluidType fluidType = sym as FluidType;

            if (fluidType != null)
            {
                Stream(data, fluidType);
                return;
            }

            PipeScheduleType pipeSchedType = sym as PipeScheduleType;

            if (pipeSchedType != null)
            {
                Stream(data, pipeSchedType);
                return;
            }

            VoltageType voltType = sym as VoltageType;

            if (voltType != null)
            {
                Stream(data, voltType);
                return;
            }

            WireType wireType = sym as WireType;

            if (wireType != null)
            {
                Stream(data, wireType);
                return;
            }

            ModelTextType modelTxtType = sym as ModelTextType;

            if (modelTxtType != null)
            {
                Stream(data, modelTxtType);
                return;
            }
        }
        /// <summary>
        /// Adds the group type controls.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="pnlGroupTypes">The PNL group types.</param>
        private void AddGroupTypeControls( GroupType groupType, HtmlGenericContainer liGroupTypeItem )
        {
            if ( groupType.Groups.Any() )
            {
                var cblGroupTypeGroups = new RockCheckBoxList { ID = "cblGroupTypeGroups" + groupType.Id };

                cblGroupTypeGroups.Label = groupType.Name;
                cblGroupTypeGroups.Items.Clear();
                foreach ( var group in groupType.Groups.OrderBy( a => a.Order ).ThenBy( a => a.Name ).Select( a => new { a.Id, a.Name } ).ToList() )
                {
                    cblGroupTypeGroups.Items.Add( new ListItem( group.Name, group.Id.ToString() ) );
                }

                liGroupTypeItem.Controls.Add( cblGroupTypeGroups );
            }
            else
            {
                if ( groupType.ChildGroupTypes.Any() )
                {
                    liGroupTypeItem.Controls.Add( new Label { Text = groupType.Name, ID = "lbl" + groupType.Name } );
                }
            }
            
            if ( groupType.ChildGroupTypes.Any() )
            {
                var ulGroupTypeList = new HtmlGenericContainer( "ul", "rocktree-children" );

                liGroupTypeItem.Controls.Add( ulGroupTypeList );
                foreach ( var childGroupType in groupType.ChildGroupTypes.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
                {
                    var liChildGroupTypeItem = new HtmlGenericContainer( "li", "rocktree-item rocktree-folder" );
                    liChildGroupTypeItem.ID = "liGroupTypeItem" + groupType.Id;
                    ulGroupTypeList.Controls.Add( liChildGroupTypeItem );
                    AddGroupTypeControls( childGroupType, liChildGroupTypeItem );
                }
            }
        }
Example #60
0
        Stream(ArrayList data, GroupType groupType)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(GroupType)));

            data.Add(new Snoop.Data.Enumerable("Groups", groupType.Groups));
        }