private static GroupEntry BuildGroup(Group group) { var entry = new GroupEntry { ReferenceId = group.Id, ExternalId = group.Id, Name = group.Name }; var memberRequest = _service.Members.List(group.Id); var pageStreamer = new PageStreamer <Member, MembersResource.ListRequest, Members, string>( (req, token) => req.PageToken = token, res => res.NextPageToken, res => res.MembersValue); foreach (var member in pageStreamer.Fetch(memberRequest)) { if (!member.Role.Equals("member", StringComparison.InvariantCultureIgnoreCase) || !member.Status.Equals("active", StringComparison.InvariantCultureIgnoreCase)) { continue; } if (member.Type.Equals("user", StringComparison.InvariantCultureIgnoreCase)) { entry.UserMemberExternalIds.Add(member.Id); } else if (member.Type.Equals("group", StringComparison.InvariantCultureIgnoreCase)) { entry.GroupMemberReferenceIds.Add(member.Id); } } return(entry); }
public async Task As_a_player_I_can_create_and_list_my_groups() { var client = await GetClientAsync(); string groupName = Guid.NewGuid().ToString(); var group = new GroupEntry { Name = groupName, Description = "fake" }; // validate group response var groupResponse = await CreateGroupAsync(client, group, HttpStatusCode.Created); Assert.Equal($"{BaseUrl}api/groups/" + groupName, groupResponse.Response.Headers.GetValues("Location").First()); await AddPlayerToGroupAsync(client, groupName); //list groups and check the created group is in the list GroupListResponse allGroups = await GetPlayerGroupsAsync(client); Assert.True(allGroups.Groups.Any(gr => gr.Name == groupName)); }
/// <summary> /// Updates an existing group in the domain. /// </summary> /// <param name="groupId">The ID of the group to be updated</param> /// <param name="groupName">The name of the group</param> /// <param name="description">The general description of the group</param> /// <param name="emailPermission">The permission level of the group</param> /// <returns>The updated entry</returns> public GroupEntry UpdateGroup(String groupId, String groupName, String description, PermissionLevel?emailPermission) { String requestUri = String.Format("{0}/{1}/{2}", AppsGroupsNameTable.AppsGoogleGroupsBaseFeedUri, domain, groupId); GroupEntry entry = new GroupEntry(); entry.EditUri = requestUri; entry.GroupId = groupId; entry.GroupName = groupName; if (!string.IsNullOrEmpty(description)) { entry.Description = description; } if (emailPermission != null) { entry.EmailPermission = (PermissionLevel)emailPermission; } return(Update(entry)); }
private async static Task <GroupEntry> BuildGroupAsync(Group group) { var entry = new GroupEntry { ReferenceId = group.Id, ExternalId = group.Id, Name = group.DisplayName }; var members = await _graphClient.Groups[group.Id].Members.Request().Select("id").GetAsync(); foreach (var member in members) { if (member is User) { entry.UserMemberExternalIds.Add(member.Id); } else if (member is Group) { entry.GroupMemberReferenceIds.Add(member.Id); } } return(entry); }
///// <summary> ///// Syncs groups. googleChanged and outlookChanged are needed because not always ///// when a google contact's groups have changed does it become dirty. ///// </summary> ///// <param name="match"></param> ///// <param name="googleChanged"></param> ///// <param name="outlookChanged"></param> //public void SaveContactGroups(ContactMatch match, out bool googleChanged, out bool outlookChanged) //{ // // get google groups // Collection<GroupEntry> groups = Utilities.GetGoogleGroups(this, match.GoogleContact); // // get outlook categories // string[] cats = Utilities.GetOutlookGroups(match.OutlookContact); // googleChanged = false; // outlookChanged = false; // if (groups.Count == 0 && cats.Length == 0) // return; // switch (SyncOption) // { // case SyncOption.MergeOutlookWins: // //overwrite google contact // OverwriteGoogleContactGroups(match.GoogleContact, groups, cats); // googleChanged = true; // break; // case SyncOption.MergeGoogleWins: // //overwrite outlook contact // OverwriteOutlookContactGroups(match.OutlookContact, cats, groups); // outlookChanged = true; // break; // case SyncOption.GoogleToOutlookOnly: // //overwrite outlook contact // OverwriteOutlookContactGroups(match.OutlookContact, cats, groups); // outlookChanged = true; // break; // case SyncOption.OutlookToGoogleOnly: // //overwrite google contact // OverwriteGoogleContactGroups(match.GoogleContact, groups, cats); // googleChanged = true; // break; // case SyncOption.MergePrompt: // //TODO: we can not rely on previously chosen option as it may be different for each contact. // if (CResolution == null) // { // //promp for sync option // ConflictResolver r = new ConflictResolver(); // CResolution = r.Resolve(match.OutlookContact, match.GoogleContact); // } // switch (CResolution) // { // case ConflictResolution.Cancel: // break; // case ConflictResolution.OutlookWins: // //overwrite google contact // OverwriteGoogleContactGroups(match.GoogleContact, groups, cats); // //TODO: we don't actually know if groups has changed. if all groups were the same it hasn't changed // googleChanged = true; // break; // case ConflictResolution.GoogleWins: // //overwrite outlook contact // OverwriteOutlookContactGroups(match.OutlookContact, cats, groups); // //TODO: we don't actually know if groups has changed. if all groups were the same it hasn't changed // outlookChanged = true; // break; // default: // break; // } // break; // } //} public GroupEntry SaveGoogleGroup(GroupEntry group) { //check if this group was not yet inserted on google. if (group.Id.Uri == null) { //insert group. Uri feedUri = new Uri(GroupsQuery.CreateGroupsUri("default")); try { GroupEntry createdEntry = _googleService.Insert(feedUri, group) as GroupEntry; return(createdEntry); } catch (Exception ex) { //TODO: save google group xml for diagnistics throw; } } else { try { //group already present in google. just update GroupEntry updatedEntry = group.Update() as GroupEntry; return(updatedEntry); } catch (Exception ex) { //TODO: save google group xml for diagnistics throw; } } }
public async Task <PersonGroup> GetCreateUserGroup() { if (string.IsNullOrWhiteSpace(_identityUser.RequestGroup)) { throw new BadRequestException("", "User has not properties set"); } GroupEntry groupInfo = null; var personGroupName = $"{SpisumNames.Prefixes.UserGroup}{_identityUser.Id}"; try { groupInfo = await _alfrescoHttpClient.GetGroup(personGroupName); } catch { throw new BadRequestException("", "User group not found"); } var groupMembers = await _alfrescoHttpClient.GetGroupMembers(personGroupName); if (groupMembers?.List?.Entries?.ToList().Find(x => x.Entry?.Id == _identityUser.Id) == null) { await _alfrescoHttpClient.CreateGroupMember(personGroupName, new GroupMembershipBodyCreate { Id = _identityUser.Id, MemberType = GroupMembershipBodyCreateMemberType.PERSON }); } return(new PersonGroup { PersonId = _identityUser.Id, GroupId = groupInfo.Entry.Id, GroupPrefix = _identityUser.RequestGroup }); }
private static PropertyDeclarationSyntax CreatePropertyDeclaration_Group(GroupEntry group) { var type = group.Type; var identifier = group.Identifier; var comment = SyntaxFactoryUtils.Comment("// Group: {0}", group.Name); return(SyntaxFactoryUtils.PropertyDeclaration(type, identifier, SyntaxFactoryUtils.ObjectCreationExpression(type)).WithTrailingTrivia(comment)); }
public GroupEntry CreateGroup(string name) { GroupEntry group = new GroupEntry(); group.Title.Text = name; group.Dirty = true; return(group); }
private void Write(GroupEntry entry, Stream sw) { sw.StartObject(); bool needComma = false; if (entry.Group.CityId > 0) { sw.Property("city", _storage.Cities.GetString(entry.Group.CityId)); needComma = true; } if (entry.Group.CountryId > 0) { if (needComma) { sw.Comma(); } sw.Property("country", _storage.Countries.GetString(entry.Group.CountryId)); needComma = true; } if (entry.Group.InterestId > 0) { if (needComma) { sw.Comma(); } sw.Property("interests", _storage.Interests.GetString(entry.Group.InterestId)); needComma = true; } if (((byte)entry.Group.Keys & (byte)GroupKey.Status) > 0) { if (needComma) { sw.Comma(); } sw.Property("status", StatusHelper.ToStr(entry.Group.Status)); needComma = true; } if (((byte)entry.Group.Keys & (byte)GroupKey.Sex) > 0) { if (needComma) { sw.Comma(); } sw.Property("sex", entry.Group.Sex ? "m" : "f"); needComma = true; } if (needComma) { sw.Comma(); } sw.Property("count", entry.Count); sw.EndObject(); }
protected void lbStep2_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(ddlDomains.SelectedValue)) { try { AppsService service = new AppsService(ddlDomains.SelectedValue, UserContext.Current.Organization.GoogleAdminAuthToken); AppsExtendedFeed groupsFeed = service.Groups.RetrieveAllGroups(); DataTable dt = new DataTable(); dt.Columns.Add(Resources.GoogleIntegrationControl_NameColumn_HeaderText, typeof(string)); dt.Columns.Add(Resources.GoogleIntegrationControl_IdColumn_HeaderText, typeof(string)); dt.Columns.Add(Resources.GoogleIntegrationControl_DescriptionColumn_HeaderText, typeof(string)); dt.Columns.Add(Resources.GoogleIntegrationControl_MembersColumn_HeaderText, typeof(string)); for (int i = 0; i < groupsFeed.Entries.Count; i++) { GroupEntry groupEntry = groupsFeed.Entries[i] as GroupEntry; MemberFeed memberFeed = service.Groups.RetrieveAllMembers(groupEntry.GroupId); StringBuilder sb = new StringBuilder(); for (int j = 0; j < memberFeed.Entries.Count; j++) { MemberEntry memberEntry = memberFeed.Entries[j] as MemberEntry; if (string.Compare(memberEntry.MemberId, "*", true) == 0) { sb.AppendFormat(Resources.GoogleIntegrationControl_MembersColumn_AllUsersValue); } else { sb.AppendFormat("{0}<br>", memberEntry.MemberId); } } dt.Rows.Add(groupEntry.GroupName, groupEntry.GroupId, groupEntry.Description, sb.ToString()); } gvStep2Results.DataSource = dt; gvStep2Results.DataBind(); mvStep2.SetActiveView(vwStep2Result); } catch (AppsException a) { lblStep2Error.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_GoogleAppsError_Text, a.ErrorCode, a.InvalidInput, a.Reason); mvStep2.SetActiveView(vwStep2Error); } catch (Exception ex) { ShowError(ex, lblStep2Error, mvStep2, vwStep2Error); } } else { lblStep2Error.Text = Resources.GoogleIntegrationControl_DomainMisingError_Text; mvStep2.SetActiveView(vwStep2Error); } }
private void btnGroupsAddFolder_Click(object sender, RoutedEventArgs e) { GroupEntry group; int index; bool editGroup; if (tvwGroups.Items.Count == 0) { group = new GroupEntry(QTUtility.TextResourcesDic["Options_Page09_Groups"][6]); CurrentGroups.Add(group); group.IsSelected = true; index = 0; editGroup = true; } else { object sel = tvwGroups.SelectedItem; if (sel == null) { return; } if (sel is FolderEntry) { FolderEntry entry = (FolderEntry)sel; group = (GroupEntry)entry.ParentItem; index = group.Folders.IndexOf(entry) + 1; } else { group = (GroupEntry)sel; index = group.Folders.Count; } editGroup = false; } FolderBrowserDialogEx dlg = new FolderBrowserDialogEx(); if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } FolderEntry folder = new FolderEntry(dlg.SelectedPath); group.Folders.Insert(index, folder); group.IsExpanded = true; if (editGroup) { group.IsSelected = true; group.IsEditing = true; } else { folder.IsSelected = true; } }
public static bool ContainsGroup(Syncronizer sync, ContactEntry googleContact, string groupName) { GroupEntry groupEntry = sync.GetGoogleGroupByName(groupName); if (groupEntry == null) { return(false); } return(ContainsGroup(googleContact, groupEntry)); }
public SDATInfoGROUP(NitroFile sdat, uint offset) { m_Offset = offset; m_Count = sdat.Read32(m_Offset + 0x00); m_GroupEntries = new GroupEntry[m_Count]; for (int i = 0; i < m_Count; i++) { m_GroupEntries[i] = new GroupEntry(sdat, m_Offset + 0x04 + (uint)(i * 8)); } }
public static bool ContainsGroup(ContactEntry googleContact, GroupEntry groupEntry) { foreach (GroupMembership m in googleContact.GroupMembership) { if (m.HRef == groupEntry.Id.AbsoluteUri) { return(true); } } return(false); }
public static void AddGoogleGroup(ContactEntry googleContact, GroupEntry groupEntry) { if (ContainsGroup(googleContact, groupEntry)) { return; } GroupMembership m = new GroupMembership(); m.HRef = groupEntry.Id.AbsoluteUri; googleContact.GroupMembership.Add(m); }
private void btnGroupsAddGroup_Click(object sender, RoutedEventArgs e) { GroupEntry item = new GroupEntry(QTUtility.TextResourcesDic["Options_Page09_Groups"][6]); tvwGroups.Focus(); IList col = (IList)tvwGroups.ItemsSource; object sel = tvwGroups.SelectedItem; int idx = sel == null ? tvwGroups.Items.Count : CurrentGroups.IndexOf(sel as GroupEntry ?? (GroupEntry)((FolderEntry)sel).ParentItem) + 1; col.Insert(idx, item); item.IsSelected = true; item.IsEditing = true; }
private static ClassDeclarationSyntax CreateClassDeclaration_Group(GroupEntry group) { var comment = SyntaxFactoryUtils.Comment("// Group: {0}", group.Name); var name = CreatePropertyDeclaration_Name(group.Name); var properties = group.Types.Select(CreatePropertyDeclaration_Type).ToArray(); return (SyntaxFactoryUtils.ClassDeclaration(group.Type, "GroupArchNode") .WithLeadingTrivia(comment) .AddMembers(name) .AddMembers(properties)); }
private async Task <ApiResponse> CreateGroupAsync(HttpClient client, GroupEntry group, HttpStatusCode expectedCode = HttpStatusCode.Created) { HttpResponseMessage response = await client.PostAsJsonAsync(BasePath + "groups", group); Assert.Equal(expectedCode, response.StatusCode); dynamic r = await response.Content.ReadAsAsync <dynamic>(); return(new ApiResponse { Response = response, ResponseBody = r }); }
/// <summary> /// Insert a fansub group into the database. /// </summary> public void InsertGroup(GroupEntry entry) { using (SQLiteCommand cmd = new SQLiteCommand(SQLConn)) { cmd.CommandText = @"INSERT OR REPLACE INTO groups VALUES (@gid, @group_name, @group_abbr);"; cmd.Parameters.AddWithValue("@gid", entry.gid); cmd.Parameters.AddWithValue("@group_name", entry.group_name); cmd.Parameters.AddWithValue("@group_abbr", entry.group_abbr); cmd.ExecuteNonQuery(); } }
private void btnGroupsAddGroup_Click(object sender, RoutedEventArgs e) { GroupEntry item = new GroupEntry(QTUtility.TextResourcesDic["Options_Page09_Groups"][6]); tvwGroups.Focus(); IList col = (IList)tvwGroups.ItemsSource; object sel = tvwGroups.SelectedItem; int idx = sel == null ? tvwGroups.Items.Count : CurrentGroups.IndexOf(sel as GroupEntry ?? (GroupEntry)((FolderEntry)sel).ParentItem) + 1; col.Insert(idx, item); item.IsSelected = true; item.IsEditing = true; }
public FileEntry(SQLiteDataReader reader) { fid = int.Parse(reader["fid"].ToString()); lid = int.Parse(reader["lid"].ToString()); eid = int.Parse(reader["eid"].ToString()); if ((epno = reader["spl_epno"].ToString().FormatNullable()) == null) { epno = reader["epno"].ToString(); } generic = !string.IsNullOrEmpty(reader["generic"].ToString()); if (!generic) { if (!string.IsNullOrWhiteSpace(reader["gid"].ToString())) { Group = new GroupEntry { gid = int.Parse(reader["gid"].ToString()), group_name = reader["group_name"].ToString(), group_abbr = reader["group_abbr"].ToString() }; } ed2k = reader["ed2k"].ToString(); length = double.Parse(reader["length"].ToString()); size = double.Parse(reader["size"].ToString()); source = reader["source"].ToString(); acodec = reader["acodec"].ToString(); vcodec = reader["vcodec"].ToString(); vres = reader["vres"].ToString(); path = !string.IsNullOrEmpty(reader["path"].ToString()) ? reader["path"].ToString() : null; } state = int.Parse(reader["state"].ToString()); if (!string.IsNullOrEmpty(reader["watcheddate"].ToString())) { watcheddate = double.Parse(reader["watcheddate"].ToString()); } watched = watcheddate != null; }
public async Task As_an_admin_I_can_create_and_list_groups() { var client = await GetAdminClientAsync(); string groupName = Guid.NewGuid().ToString(); var group = new GroupEntry { Description = "fake" }; // validate group response var groupResponse = await CreateGroupAsync(client, groupName, group); //list groups and check the created group is in the list GroupListResponse allGroups = await GetAllGroupsAdminAsync(client); Assert.True(allGroups.Groups.Any(g => g.Name == groupName)); }
public FileEntry(SQLiteDataReader reader) { fid = int.Parse(reader["fid"].ToString()); lid = int.Parse(reader["lid"].ToString()); eid = int.Parse(reader["eid"].ToString()); if ((epno = reader["spl_epno"].ToString().FormatNullable()) == null) epno = reader["epno"].ToString(); generic = !string.IsNullOrEmpty(reader["generic"].ToString()); if (!generic) { if (!string.IsNullOrWhiteSpace(reader["gid"].ToString())) { Group = new GroupEntry { gid = int.Parse(reader["gid"].ToString()), group_name = reader["group_name"].ToString(), group_abbr = reader["group_abbr"].ToString() }; } ed2k = reader["ed2k"].ToString(); length = double.Parse(reader["length"].ToString()); size = double.Parse(reader["size"].ToString()); source = reader["source"].ToString(); acodec = reader["acodec"].ToString(); vcodec = reader["vcodec"].ToString(); vres = reader["vres"].ToString(); path = !string.IsNullOrEmpty(reader["path"].ToString()) ? reader["path"].ToString() : null; } state = int.Parse(reader["state"].ToString()); if (!string.IsNullOrEmpty(reader["watcheddate"].ToString())) watcheddate = double.Parse(reader["watcheddate"].ToString()); watched = watcheddate != null; }
private void tvwGroups_PreviewKeyDown(object sender, KeyEventArgs e) { if (NewHotkeyRequested == null) { return; } GroupEntry entry = tvwGroups.SelectedItem as GroupEntry; if (entry == null) { return; } Keys newKey; if (!NewHotkeyRequested(e, entry.ShortcutKey, out newKey)) { return; } entry.ShortcutKey = newKey; e.Handled = true; }
private void btnGroupsAddFolder_Click(object sender, RoutedEventArgs e) { GroupEntry group; int index; bool editGroup; if(tvwGroups.Items.Count == 0) { group = new GroupEntry(QTUtility.TextResourcesDic["Options_Page09_Groups"][6]); CurrentGroups.Add(group); group.IsSelected = true; index = 0; editGroup = true; } else { object sel = tvwGroups.SelectedItem; if(sel == null) return; if(sel is FolderEntry) { FolderEntry entry = (FolderEntry)sel; group = (GroupEntry)entry.ParentItem; index = group.Folders.IndexOf(entry) + 1; } else { group = (GroupEntry)sel; index = group.Folders.Count; } editGroup = false; } FolderBrowserDialogEx dlg = new FolderBrowserDialogEx(); if(dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; FolderEntry folder = new FolderEntry(dlg.SelectedPath); group.Folders.Insert(index, folder); group.IsExpanded = true; if(editGroup) { group.IsSelected = true; group.IsEditing = true; } else { folder.IsSelected = true; } }
private ContactTag CreateTag(GroupEntry groupEntry) { if (groupEntry.Title == null || string.IsNullOrEmpty(groupEntry.Title.Text)) { return(null); } var key = groupEntry.Id.AbsoluteUri.Split('/').LastOrDefault(); if (string.IsNullOrEmpty(key)) { return(null); } var tag = new ContactTag() { Name = groupEntry.Title.Text, VersionKey = groupEntry.Updated.Ticks, Key = key, Color = "#000000" }; tag.IsChanged = false; return(tag); }
private List <GroupEntry> GetAllInGroup(string group, Dictionary <byte, TokenDictionaryEntry> tokens) { if (tokens == null) { return(null); } List <GroupEntry> ret = new List <GroupEntry>(); foreach (byte b in tokens.Keys) { if (tokens[b].Group == group && tokens[b].Name != null) { GroupEntry ge = new GroupEntry(tokens[b].Name); ge.Alts = tokens[b].Alts; ret.Add(ge); } if (tokens[b].SubTokens != null) { ret.AddRange(GetAllInGroup(group, tokens[b].SubTokens)); } } return(ret); }
public static void RemoveGoogleGroup(ContactEntry googleContact, GroupEntry groupEntry) { if (!ContainsGroup(googleContact, groupEntry)) { return; } // TODO: broken. removes group membership but does not remove contact // from group in the end. // look for id GroupMembership mem; for (int i = 0; i < googleContact.GroupMembership.Count; i++) { mem = googleContact.GroupMembership[i]; if (mem.HRef == groupEntry.Id.AbsoluteUri) { googleContact.GroupMembership.Remove(mem); return; } } throw new Exception("Did not find group"); }
public GroupEntry AddGroupEntry(string name, ArrayList items) { GroupEntry entry = new GroupEntry(name, items); this._groups.Add(entry); this.SetSaveOnExit(); return entry; }
/// <summary> /// rebuild the full list from scratch /// </summary> public void rebuildList() { // do nothing if the window is not visible // because we rebuild everything when it becomes visible if (!this.Visible) return; // clear everyting that we will rebuild mThumbnailImage.Clear(); mGroupEntryList.Clear(); this.listView.Groups.Clear(); this.listView.Items.Clear(); this.listView.SmallImageList.Images.Clear(); // create a default dictionnary if we don't use the layers if (!this.useGroupCheckBox.Checked) { GroupEntry groupEntry = new GroupEntry(null, null); mGroupEntryList.Add(groupEntry); } // iterate on all the brick of all the brick layers, // create on group per layer if needed, and create one entry // in the dictionnary foreach (Layer layer in Map.Instance.LayerList) { LayerBrick brickLayer = layer as LayerBrick; if (brickLayer != null) addLayer(brickLayer); } }
/// <summary> /// this method update the view by adding a brick or incrementing its count /// </summary> /// <param name="brickOrGroup">the brick to add in the view</param> /// <param name="groupEntry">the concerned group in which adding the brick</param> private void addBrick(Layer.LayerItem brickOrGroup, GroupEntry groupEntry) { // get a pointer on the current brick entry list Dictionary<string, BrickEntry> brickEntryList = groupEntry.mBrickEntryList; // get the part number string partNumber = brickOrGroup.PartNumber; // try to get an entry in the image dictionary, else add it IconEntry iconEntry = null; if (!mThumbnailImage.TryGetValue(partNumber, out iconEntry)) { iconEntry = new IconEntry(partNumber, this.listView.SmallImageList); mThumbnailImage.Add(partNumber, iconEntry); } // try to get an entry in the dictionnary for the current brick // to get the previous count, then increase the count and store the new value BrickEntry brickEntry = null; if (!brickEntryList.TryGetValue(partNumber, out brickEntry)) { // create a new entry and add it brickEntry = new BrickEntry(partNumber, iconEntry.mImageIndex); brickEntryList.Add(partNumber, brickEntry); } // affect the correct group to the item brickEntry.Item.Group = groupEntry.Group; // add the item in the list view if not already in if (brickEntry.IsQuantityNull) this.listView.Items.Add(brickEntry.Item); // and increment its count brickEntry.incrementQuantity(); }
public static void GetGroups( string street, string city, string state, string zip, GetGroupsComplete onCompletion ) { List<GroupEntry> groupEntries = new List<GroupEntry>(); GroupEntry sourceLocation = new GroupEntry( ); // first convert the address into a location object RockApi.Instance.GetLocationFromAddress( street, city, state, zip, delegate(System.Net.HttpStatusCode statusCode, string statusDescription, Rock.Client.Location model ) { // verify the call was successful AND it resulted in a valid location if ( Rock.Mobile.Network.Util.StatusInSuccessRange( statusCode ) == true && model != null && model.Latitude.HasValue == true && model.Longitude.HasValue == true ) { // take the source location so we can provide it to the caller sourceLocation.Latitude = model.Latitude.Value; sourceLocation.Longitude = model.Longitude.Value; // now get the groups RockApi.Instance.GetGroupsByLocation( PrivateGeneralConfig.NeighborhoodGroupGeoFenceValueId, PrivateGeneralConfig.NeighborhoodGroupValueId, model.Id, delegate(System.Net.HttpStatusCode groupStatusCode, string groupStatusDescription, List<Rock.Client.Group> rockGroupList ) { bool result = false; if ( Rock.Mobile.Network.Util.StatusInSuccessRange( statusCode ) == true ) { result = true; // first thing we receive is the "area" group(s) foreach ( Rock.Client.Group areaGroup in rockGroupList ) { // in each area, there's an actual small group foreach ( Rock.Client.Group smallGroup in areaGroup.Groups ) { // get the group location out of the small group enumerator IEnumerator enumerator = smallGroup.GroupLocations.GetEnumerator( ); enumerator.MoveNext( ); Rock.Client.Location location = ( (Rock.Client.GroupLocation)enumerator.Current ).Location; // and of course, each group has a location GroupEntry entry = new GroupEntry(); entry.Title = smallGroup.Name; entry.Address = location.Street1 + "\n" + location.City + ", " + location.State + " " + location.PostalCode.Substring( 0, Math.Max( 0, location.PostalCode.IndexOf( '-' ) ) ); entry.NeighborhoodArea = areaGroup.Name; entry.Id = smallGroup.Id; // get the distance entry.Distance = location.Distance; // get the meeting schedule if it's available if ( smallGroup.Schedule != null ) { entry.MeetingTime = smallGroup.Schedule.FriendlyScheduleText; // get the day of week /*if( smallGroup.Schedule.WeeklyDayOfWeek.HasValue == true ) { entry.Day = GeneralStrings.Days[ smallGroup.Schedule.WeeklyDayOfWeek.Value ]; } // get the meeting time, if set. if( smallGroup.Schedule.WeeklyTimeOfDay.HasValue == true ) { DateTime time_24 = ParseMilitaryTime( string.Format( "{0:D2}:{1:D2}:{2:D2}", smallGroup.Schedule.WeeklyTimeOfDay.Value.Hours, smallGroup.Schedule.WeeklyTimeOfDay.Value.Minutes, smallGroup.Schedule.WeeklyTimeOfDay.Value.Seconds) ); entry.Time = time_24.ToString( "t" ); }*/ } entry.Latitude = location.Latitude.Value; entry.Longitude = location.Longitude.Value; groupEntries.Add( entry ); } } } // our network delegate has been invoked and compelted, so now call whoever called us. onCompletion( sourceLocation, groupEntries, result ); } ); } else { onCompletion( sourceLocation, groupEntries, Rock.Mobile.Network.Util.StatusInSuccessRange( statusCode ) == true ? true : false ); } } ); }
/// <summary> /// Find and return the group entry in the list that correspond to the specified layer. /// </summary> /// <param name="layer">The layer you want to search</param> /// <param name="createOneIfMissing">if true a group entry will be created if we can't find a match, otherwise null will be returned</param> /// <returns>the group entry corresponding to the specified layer or null if it can't be find and it was not specified to create one</returns> private GroupEntry getGroupEntryFromLayer(LayerBrick layer, bool createOneIfMissing) { // search the group entry associated with this layer GroupEntry currentGroupEntry = null; if (this.useGroupCheckBox.Checked) { foreach (GroupEntry groupEntry in mGroupEntryList) if (groupEntry.mLayer == layer) { currentGroupEntry = groupEntry; break; } // if the group entry is not found we create one if ((currentGroupEntry == null) && createOneIfMissing) { currentGroupEntry = new GroupEntry(layer, this.listView); mGroupEntryList.Add(currentGroupEntry); this.listView.Groups.Add(currentGroupEntry.Group); } } else { currentGroupEntry = mGroupEntryList[0]; } return currentGroupEntry; }
/// <summary> /// update the view by decrementing the brick count or removing it /// </summary> /// <param name="brickOrGroup">the brick to remove from the view</param> /// <param name="brickEntryList">the concerned group from which removing the brick</param> private void removeBrick(Layer.LayerItem brickOrGroup, GroupEntry groupEntry) { BrickEntry brickEntry = null; if (groupEntry.mBrickEntryList.TryGetValue(brickOrGroup.PartNumber, out brickEntry)) { brickEntry.decrementQuantity(); if (brickEntry.IsQuantityNull) { this.listView.Items.Remove(brickEntry.Item); } } }
private async Task UpdateGroupAdminAsync(HttpClient client, string groupName, GroupEntry group, HttpStatusCode expectedCode = HttpStatusCode.NoContent) { HttpResponseMessage response = await client.PutAsJsonAsync($"{BasePath}admin/groups/{groupName}", group); Assert.Equal(expectedCode, response.StatusCode); }
public SDATInfoGROUP(NitroFile sdat, uint offset) { m_Offset = offset; m_Count = sdat.Read32(m_Offset + 0x00); m_GroupEntries = new GroupEntry[m_Count]; for (int i = 0; i < m_Count; i++) { m_GroupEntries[i] = new GroupEntry(sdat, m_Offset + 0x04 + (uint)(i * 8)); } }
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /// <summary>runs an basic auth test against the groups feed test</summary> ////////////////////////////////////////////////////////////////////// [Test] public void GroupsSystemTest() { Tracing.TraceMsg("Entering GroupsSystemTest"); GroupsQuery query = new GroupsQuery(ContactsQuery.CreateGroupsUri(this.userName + "@googlemail.com")); ContactsService service = new ContactsService("unittests"); if (this.userName != null) { service.Credentials = new GDataCredentials(this.userName, this.passWord); } GroupsFeed feed = service.Query(query); int i = 0; foreach (GroupEntry g in feed.Entries) { if (g.SystemGroup != null) { i++; } } Assert.IsTrue(i == 4, "There should be 4 system groups in the groups feed"); ObjectModelHelper.DumpAtomObject(feed, CreateDumpFileName("GroupsAuthTest")); GroupEntry newGroup = new GroupEntry(); newGroup.Title.Text = "Private Data"; GroupEntry insertedGroup = feed.Insert(newGroup); GroupEntry g2 = new GroupEntry(); g2.Title.Text = "Another Private Group"; GroupEntry insertedGroup2 = feed.Insert(g2); // now insert a new contact that belongs to that group ContactsQuery q = new ContactsQuery(ContactsQuery.CreateContactsUri(this.userName + "@googlemail.com")); ContactsFeed cf = service.Query(q); ContactEntry entry = ObjectModelHelper.CreateContactEntry(1); GroupMembership member = new GroupMembership(); member.HRef = insertedGroup.Id.Uri.ToString(); GroupMembership member2 = new GroupMembership(); member2.HRef = insertedGroup2.Id.Uri.ToString(); ContactEntry insertedEntry = cf.Insert(entry); // now change the group membership insertedEntry.GroupMembership.Add(member); insertedEntry.GroupMembership.Add(member2); ContactEntry currentEntry = insertedEntry.Update(); Assert.IsTrue(currentEntry.GroupMembership.Count == 2, "The entry should be in 2 groups"); currentEntry.GroupMembership.Clear(); currentEntry = currentEntry.Update(); // now we should have 2 new groups and one new entry with no groups anymore int oldCountGroups = feed.Entries.Count; int oldCountContacts = cf.Entries.Count; currentEntry.Delete(); insertedGroup.Delete(); insertedGroup2.Delete(); feed = service.Query(query); cf = service.Query(q); Assert.AreEqual(oldCountContacts, cf.Entries.Count, "Contacts count should be the same"); Assert.AreEqual(oldCountGroups, feed.Entries.Count, "Groups count should be the same"); }
public void TestSyncDeletedOutlookGroup() { sync.SyncOption = SyncOption.MergeOutlookWins; string groupName = "A_TEST_GROUP"; string timestamp = DateTime.Now.Ticks.ToString(); string name = "AN OUTLOOK TEST CONTACT"; string email = "*****@*****.**"; name = name.Replace(" ", "_"); // delete previously failed test contacts DeleteExistingTestContacts(name, email); sync.Load(); ContactsMatcher.SyncContacts(sync); // create new contact to sync Outlook.ContactItem outlookContact = sync.OutlookApplication.CreateItem(Outlook.OlItemType.olContactItem) as Outlook.ContactItem; outlookContact.FullName = name; outlookContact.FileAs = name; outlookContact.Email1Address = email; outlookContact.Email2Address = email.Replace("00", "01"); outlookContact.Email3Address = email.Replace("00", "02"); outlookContact.HomeAddress = "10 Parades"; outlookContact.PrimaryTelephoneNumber = "123"; outlookContact.Categories = groupName; outlookContact.Save(); ContactEntry googleContact = new ContactEntry(); ContactSync.UpdateContact(outlookContact, googleContact); ContactMatch match = new ContactMatch(outlookContact, googleContact); //save contact to google. sync.SaveContact(match); //load the same contact from google. sync.Load(); ContactsMatcher.SyncContacts(sync); match = sync.ContactByProperty(name, email); // delete group from outlook Utilities.RemoveOutlookGroup(match.OutlookContact, groupName); sync.SyncOption = SyncOption.OutlookToGoogleOnly; //save contact to google. sync.SaveContact(match); //load the same contact from google. sync.Load(); ContactsMatcher.SyncContacts(sync); match = sync.ContactByProperty(name, email); // google and outlook should now have no category Assert.AreEqual(null, match.OutlookContact.Categories); Assert.AreEqual(0, Utilities.GetGoogleGroups(sync, match.GoogleContact).Count); //delete test contacts match.Delete(); // delete test group GroupEntry group = sync.GetGoogleGroupByName(groupName); group.Delete(); }
private static GroupEntry BuildGroup(SearchResult item, Dictionary <string, string> userIndex) { var group = new GroupEntry { ReferenceId = DNFromPath(item.Path) }; if (group.ReferenceId == null) { return(null); } // External Id if (item.Properties.Contains("objectGUID") && item.Properties["objectGUID"].Count > 0) { group.ExternalId = item.Properties["objectGUID"][0].FromGuidToString(); } else { group.ExternalId = group.ReferenceId; } // Name if (item.Properties.Contains(SettingsService.Instance.Sync.Ldap.GroupNameAttribute) && item.Properties[SettingsService.Instance.Sync.Ldap.GroupNameAttribute].Count > 0) { group.Name = item.Properties[SettingsService.Instance.Sync.Ldap.GroupNameAttribute][0].ToString(); } else if (item.Properties.Contains("cn") && item.Properties["cn"].Count > 0) { group.Name = item.Properties["cn"][0].ToString(); } else { return(null); } // Dates group.CreationDate = item.Properties.ParseDateTime(SettingsService.Instance.Sync.Ldap.CreationDateAttribute); group.RevisionDate = item.Properties.ParseDateTime(SettingsService.Instance.Sync.Ldap.RevisionDateAttribute); // Members if (item.Properties.Contains(SettingsService.Instance.Sync.Ldap.MemberAttribute) && item.Properties[SettingsService.Instance.Sync.Ldap.MemberAttribute].Count > 0) { foreach (var member in item.Properties[SettingsService.Instance.Sync.Ldap.MemberAttribute]) { var memberDn = member.ToString(); if (userIndex.ContainsKey(memberDn) && !group.UserMemberExternalIds.Contains(userIndex[memberDn])) { group.UserMemberExternalIds.Add(userIndex[memberDn]); } else if (!group.GroupMemberReferenceIds.Contains(memberDn)) { group.GroupMemberReferenceIds.Add(memberDn); } } } return(group); }
private async Task <ApiResponse> CreateGroupAsync(HttpClient client, string groupName, GroupEntry group, HttpStatusCode expectedCode = HttpStatusCode.NoContent) { HttpResponseMessage response = await client.PutAsJsonAsync($"{BasePath}admin/groups/{groupName}", group); Assert.Equal(expectedCode, response.StatusCode); dynamic r = await response.Content.ReadAsAsync <dynamic>(); return(new ApiResponse { Response = response, ResponseBody = r }); }