public async Task Update(GroupContract group) { await groupContractValidator.ValidateAndThrowAsync(group); var model = mapper.Map <GroupModel>(group); await groupRepository.Update(model); }
public async Task <long> Create(GroupContract group) { await groupContractValidator.ValidateAndThrowAsync(group); var model = mapper.Map <GroupModel>(group); return(await groupRepository.Insert(model)); }
public async Task UpdateGroup(GroupContract contract, string ownerId) { var group = _groupModelMapper.Map(contract, ownerId); var storageGroup = await GetGroup(contract.Id, ownerId); var updatedGroup = storageGroup.Update(group); await _repository.UpdateGroup(updatedGroup); }
public async Task CreateGroup(GroupContract contract, string ownerId) { if ((await _repository.GetGroups(ownerId)).Any(g => g.Name == contract.Name)) { throw new NameAlreadyUsedException(contract.Name); } var group = _groupModelMapper.Map(contract, ownerId); await _repository.AddGroup(group); }
public static List<Group> Convert(GroupContract[] groups) { List<Group> result = new List<Group>(); for (int i = 0; i <= groups.Length - 1; ++i) { result.Add(new Group(groups[i])); } return result; }
public async Task Should_throw_on_long_name() { var contract = new GroupContract { Name = "1234567890123456789012345678901234567890" }; var act = new Func <Task>(async() => await sut.Create(contract)); await act.Should().ThrowAsync <ValidationException>(); }
protected GroupContract GetParent(GroupContract group) { var dbGroup = DataContext.UM_Groups.Single(n => n.ID == group.ID); while (dbGroup.ParentID != null) { dbGroup = dbGroup.Parent; } return(dbGroup.ToContract()); }
/// <summary> /// Gets the group contract for the specified group id and assigns the users ids /// passed as argument to the contract. /// <p> /// Calls the UpdateGroup method on an instance of the InfoShareService.CommonClient /// class and passes the connection id of the administrator, and the group /// contract as arguments. /// </summary> /// <param name="connAdminUserID">the connection id of the administrator</param> /// <param name="userIDs">an array of user ids</param> /// <param name="groupID">the group id</param> public void AssignUserToGroup(string connAdminUserID, string[] userIDs, string groupID) { GroupContract groupContract = this.GetGroupContract(groupID); if (groupContract != null) { groupContract.UserIds = userIDs; this.CommonClient.UpdateGroup(connAdminUserID, groupContract); } this.RefreshUserStore(connAdminUserID); }
public static Group Create(GroupContract source) { return(new Group { Address1 = source.Address1, Address2 = source.Address2, AssetId = source.AssetId, GroupId = source.GroupId, IsColored = source.IsColored, HubAddress = source.HubAddress, Transactions = source.Transactions.Select(MixedTransaction.Create) }); }
/// <summary> /// Конструктор. /// Преобразует контракт данных в модель данных приложения /// </summary> /// <param name="group"></param> public Group(GroupContract group) { this.ID = group.ID; this.Name = group.Name; //this.StartYear = group.StartYear; //this.StopYear = group.StopYear; this.Persons = new ObservableCollection<Person>(); for (int i = 0; i < group.Persons.Length; ++i) { this.Persons.Add(new Person(group.Persons[i])); } }
/// <summary> /// Creates a group contract and sets mandatory and optional fields on the contract. /// /// The name of the group contract is passed as an argument. /// Calls the CreateGroup method on an instance of the InfoShareService.CommonClient /// class and passes the connection id of the administrator, and the group /// contract as arguments. /// </summary> /// <param name="connAdminUserID">the connection id of the administrator</param> /// <param name="userGroupName">the user group name</param> /// <param name="userGroupDisplayName">the user group display name</param> /// <returns>the group id of the created group</returns> public string CreateUserGroup(string connAdminUserID, string userGroupName, string userGroupDisplayName) { GroupContract groupContract = new GroupContract { // Sets mandatory fields Name = userGroupName, DisplayName = userGroupDisplayName }; string groupID = this.CommonClient.CreateGroup(connAdminUserID, groupContract); this.RefreshUserStore(connAdminUserID); return(groupID); }
public async Task Should_pass_params_Correctly() { var contract = new GroupContract { Name = "Test Group" }; groupRepository.Setup(r => r.Insert(It.IsAny <GroupModel>())).ReturnsAsync((GroupModel model) => { model.Name.Should().Be(contract.Name); return(1); }); var result = await sut.Create(contract); groupRepository.VerifyAll(); }
public static GroupContract ToContract(this UM_Group entity) { if (entity == null) { return(null); } var contract = new GroupContract(); contract.DateChanged = entity.DateChanged; contract.DateCreated = entity.DateCreated; contract.DateDeleted = entity.DateDeleted; contract.ID = entity.ID; contract.ParentID = entity.ParentID; contract.Name = entity.Name; contract.ProjectID = entity.ProjectID; return(contract); }
public static UM_Group ToEntity(this GroupContract contract) { if (contract == null) { return(null); } var entity = new UM_Group(); entity.DateChanged = contract.DateChanged; entity.DateCreated = contract.DateCreated; entity.DateDeleted = contract.DateDeleted; entity.ID = contract.ID; entity.ParentID = contract.ParentID; entity.Name = contract.Name; entity.ProjectID = contract.ProjectID; return(entity); }
/// <summary> /// Gets the group contract for the specified group id. /// /// Gets an array of user group contracts from the user store contract /// that is passed as an argument and searches for the group contract /// with the specified group id. Returns the group contract, if it finds /// the contract. /// </summary> /// <param name="userStore">the user store contract</param> /// <param name="connAdminUserID">the connection id of the administrator</param> /// <param name="groupID">the group id</param> /// <returns>the group contract</returns> private GroupContract GetGroupContract(string groupID) { GroupContract groupContract = null; // Searches for the group contract with the specified group id foreach (GroupContract group in this.UserStore.Groups) { if (group.Id == groupID) { // Contract found groupContract = group; break; } } if (groupContract == null) { throw new NotFoundException("No group contract found for group ID <" + groupID + ">."); } return(groupContract); }
public byte[] HandleQuery(string sourceUserID, int informationType, byte[] information) { if (informationType == this.groupInfoTypes.Recruit) { RecruitOrFireContract contract = CompactPropertySerializer.Default.Deserialize <RecruitOrFireContract>(information, 0); if (!this.userManager.IsUserOnLine(contract.MemberID)) { return(BitConverter.GetBytes(false)); } this.dynamicGroupManager.JoinGroup(contract.GroupID, contract.MemberID); return(BitConverter.GetBytes(true)); } if (informationType == this.groupInfoTypes.GetGroupMembers) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); List <string> members = this.dynamicGroupManager.GetGroupMembers(contract.GroupID); return(CompactPropertySerializer.Default.Serialize <List <string> >(members)); } return(null); }
public NodeKeyObject(String type, ProjectContract project, GroupContract group, UserContract user, Guid parentID) { Type = type; if (project != null) { ProjectID = project.ID; Project = project; } if (group != null) { GroupID = group.ID; Group = group; } if (user != null) { UserID = user.ID; User = user; } ParentID = parentID; }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { List <string> groupMembers; string destUserID; if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers) { GroupContract contract4 = this.interface9_0.imethod_1 <GroupContract>(interface37_0); groupMembers = this.igroupManager_0.GetGroupMembers(contract4.GroupID); GroupmatesContract body = null; if (groupMembers != null) { List <string> online = new List <string>(); List <string> offline = new List <string>(); foreach (string str in groupMembers) { if (this.iuserManager_0.IsUserOnLine(str)) { online.Add(str); } else { offline.Add(str); } } body = new GroupmatesContract(online, offline); } IHeader interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, body)); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer; destUserID = interface37_0.Header.DestUserID; BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); if (this.BroadcastReceived != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content); } groupMembers = this.igroupManager_0.GetGroupMembers(destUserID); if (groupMembers != null) { foreach (string str2 in groupMembers) { if (str2 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str2, contract2.ActionTypeOnChannelIsBusy); } } } return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { destUserID = interface37_0.Header.DestUserID; if (this.bool_4 && (this.BroadcastReceived != null)) { BlobFragmentContract contract3 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract3); if (information != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract3.InformationType, information.Content); } } groupMembers = this.igroupManager_0.GetGroupMembers(destUserID); if (groupMembers != null) { foreach (string str2 in groupMembers) { if (str2 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str2, ActionTypeOnChannelIsBusy.Continue); } } } return(null); } return(null); }
public static NodeKeyObject CreateForUser(ProjectContract project, GroupContract group, UserContract user) { return(new NodeKeyObject(UserType, project, group, user, Guid.Empty)); }
public static NodeKeyObject CreateForGroup(ProjectContract project, GroupContract group, Guid parentID) { return(new NodeKeyObject(ChildType, project, group, null, parentID)); }
public static NodeKeyObject CreateForGroup(ProjectContract project, GroupContract group) { return(new NodeKeyObject(GroupType, project, group, null, Guid.Empty)); }
public void HandleInformation(string sourceUserID, int informationType, byte[] information) { if (informationType == this.groupInfoTypes.P2PChannelOpen) { P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0); this.p2PChannelManager.Register(sourceUserID, contract.DestUserID); return; } if (informationType == this.groupInfoTypes.P2PChannelClose) { P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0); this.p2PChannelManager.Unregister(sourceUserID, contract.DestUserID); return; } if (informationType == this.groupInfoTypes.Join) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.JoinGroup(contract.GroupID, sourceUserID); return; } if (informationType == this.groupInfoTypes.DestroyGroup) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.DestroyGroup(sourceUserID, contract.GroupID); return; } if (informationType == this.groupInfoTypes.QuitGroup) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.QuitGroup(contract.GroupID, sourceUserID); return; } if (informationType == this.groupInfoTypes.Fire) { RecruitOrFireContract contract = CompactPropertySerializer.Default.Deserialize <RecruitOrFireContract>(information, 0); this.dynamicGroupManager.QuitGroup(contract.GroupID, contract.MemberID); return; } if (informationType == this.groupInfoTypes.Broadcast || informationType == this.groupInfoTypes.BroadcastByServer) { bool transfer = informationType == this.groupInfoTypes.BroadcastByServer; BroadcastContract contract = CompactPropertySerializer.Default.Deserialize <BroadcastContract>(information, 0); string groupID = contract.GroupID; if (this.BroadcastReceived != null) { this.BroadcastReceived(sourceUserID, groupID, contract.InformationType, contract.Content); } List <string> members = this.dynamicGroupManager.GetGroupMembers(groupID); if (members != null) { foreach (string memberID in members) { bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID); if (memberID != sourceUserID && !useP2PChannel) { this.customizeController.Send(memberID, informationType, information, true, contract.ActionTypeOnChannelIsBusy); } } } return; } if (informationType == this.groupInfoTypes.BroadcastBlob || informationType == this.groupInfoTypes.BroadcastBlobByServer) { BlobFragmentContract contract = CompactPropertySerializer.Default.Deserialize <BlobFragmentContract>(information, 0); if (this.BroadcastReceived != null) { Information info = this.blobReceiver.Receive(sourceUserID, contract.DestUserID, contract); if (info != null) { this.BroadcastReceived(sourceUserID, contract.DestUserID, info.InformationType, info.Content); } } bool transfer = informationType == this.groupInfoTypes.BroadcastBlobByServer; List <string> members = this.dynamicGroupManager.GetGroupMembers(contract.DestUserID); if (members != null) { foreach (string memberID in members) { bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID); if (memberID != sourceUserID && !useP2PChannel) { this.customizeController.Send(memberID, informationType, information, true, ActionTypeOnChannelIsBusy.Continue); } } } return; } }
/// <summary> /// List all Product Groups. /// </summary> /// <param name='nextLink'> /// Required. NextLink from the previous successful call to List /// operation. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// List Groups operation response details. /// </returns> public async Task <GroupListResponse> ListNextAsync(string nextLink, CancellationToken cancellationToken) { // Validate if (nextLink == null) { throw new ArgumentNullException("nextLink"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("nextLink", nextLink); TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters); } // Construct URL string url = ""; url = url + nextLink; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result GroupListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new GroupListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { GroupPaged resultInstance = new GroupPaged(); result.Result = resultInstance; JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { GroupContract groupContractInstance = new GroupContract(); resultInstance.Values.Add(groupContractInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); groupContractInstance.IdPath = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); groupContractInstance.Name = nameInstance; } JToken descriptionValue = valueValue["description"]; if (descriptionValue != null && descriptionValue.Type != JTokenType.Null) { string descriptionInstance = ((string)descriptionValue); groupContractInstance.Description = descriptionInstance; } JToken builtInValue = valueValue["builtIn"]; if (builtInValue != null && builtInValue.Type != JTokenType.Null) { bool builtInInstance = ((bool)builtInValue); groupContractInstance.System = builtInInstance; } JToken typeValue = valueValue["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { GroupTypeContract typeInstance = ((GroupTypeContract)Enum.Parse(typeof(GroupTypeContract), ((string)typeValue), true)); groupContractInstance.Type = typeInstance; } JToken externalIdValue = valueValue["externalId"]; if (externalIdValue != null && externalIdValue.Type != JTokenType.Null) { string externalIdInstance = ((string)externalIdValue); groupContractInstance.ExternalId = externalIdInstance; } } } JToken countValue = responseDoc["count"]; if (countValue != null && countValue.Type != JTokenType.Null) { long countInstance = ((long)countValue); resultInstance.TotalCount = countInstance; } JToken nextLinkValue = responseDoc["nextLink"]; if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) { string nextLinkInstance = ((string)nextLinkValue); resultInstance.NextLink = nextLinkInstance; } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
/// <summary> /// List all Product Groups. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the resource group. /// </param> /// <param name='serviceName'> /// Required. The name of the Api Management service. /// </param> /// <param name='pid'> /// Required. Identifier of the product. /// </param> /// <param name='query'> /// Optional. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// List Groups operation response details. /// </returns> public async Task <GroupListResponse> ListAsync(string resourceGroupName, string serviceName, string pid, QueryParameters query, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serviceName == null) { throw new ArgumentNullException("serviceName"); } if (pid == null) { throw new ArgumentNullException("pid"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("pid", pid); tracingParameters.Add("query", query); TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.ApiManagement"; url = url + "/service/"; url = url + Uri.EscapeDataString(serviceName); url = url + "/products/"; url = url + Uri.EscapeDataString(pid); url = url + "/groups"; List <string> queryParameters = new List <string>(); queryParameters.Add("api-version=2016-07-07"); List <string> odataFilter = new List <string>(); if (query != null && query.Filter != null) { odataFilter.Add(Uri.EscapeDataString(query.Filter)); } if (odataFilter.Count > 0) { queryParameters.Add("$filter=" + string.Join(null, odataFilter)); } if (query != null && query.Top != null) { queryParameters.Add("$top=" + Uri.EscapeDataString(query.Top.Value.ToString())); } if (query != null && query.Skip != null) { queryParameters.Add("$skip=" + Uri.EscapeDataString(query.Skip.Value.ToString())); } if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result GroupListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new GroupListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { GroupPaged resultInstance = new GroupPaged(); result.Result = resultInstance; JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { GroupContract groupContractInstance = new GroupContract(); resultInstance.Values.Add(groupContractInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); groupContractInstance.IdPath = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); groupContractInstance.Name = nameInstance; } JToken descriptionValue = valueValue["description"]; if (descriptionValue != null && descriptionValue.Type != JTokenType.Null) { string descriptionInstance = ((string)descriptionValue); groupContractInstance.Description = descriptionInstance; } JToken builtInValue = valueValue["builtIn"]; if (builtInValue != null && builtInValue.Type != JTokenType.Null) { bool builtInInstance = ((bool)builtInValue); groupContractInstance.System = builtInInstance; } JToken typeValue = valueValue["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { GroupTypeContract typeInstance = ((GroupTypeContract)Enum.Parse(typeof(GroupTypeContract), ((string)typeValue), true)); groupContractInstance.Type = typeInstance; } JToken externalIdValue = valueValue["externalId"]; if (externalIdValue != null && externalIdValue.Type != JTokenType.Null) { string externalIdInstance = ((string)externalIdValue); groupContractInstance.ExternalId = externalIdInstance; } } } JToken countValue = responseDoc["count"]; if (countValue != null && countValue.Type != JTokenType.Null) { long countInstance = ((long)countValue); resultInstance.TotalCount = countInstance; } JToken nextLinkValue = responseDoc["nextLink"]; if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) { string nextLinkInstance = ((string)nextLinkValue); resultInstance.NextLink = nextLinkInstance; } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
public Group Map(GroupContract contract, string ownerId) =>
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { string destUserID; List <string> groupMemberList; IHeader interface3; if (interface37_0.Header.MessageType == this.object_0.GetContracts) { ReqContactsContract contract4 = this.interface9_0.imethod_1 <ReqContactsContract>(interface37_0); List <string> users = new List <string>(); if (this.icontactsManager_0 != null) { users = this.icontactsManager_0.GetContacts(interface37_0.Header.UserID); if (contract4.JustOnline) { users = this.ginterface8_0.SelectOnlineUserFrom(users); } } ResContactsContract body = new ResContactsContract(users); interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <ResContactsContract>(interface3, body)); } if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers) { GroupContract contract7 = this.interface9_0.imethod_1 <GroupContract>(interface37_0); groupMemberList = this.icontactsManager_0.GetGroupMemberList(contract7.GroupID); GroupmatesContract contract = null; if (groupMemberList != null) { List <string> online = new List <string>(); List <string> offline = new List <string>(); foreach (string str2 in groupMemberList) { if (this.iuserManager_0.IsUserOnLine(str2)) { online.Add(str2); } else { offline.Add(str2); } } contract = new GroupmatesContract(online, offline); } interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, contract)); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer; destUserID = interface37_0.Header.DestUserID; BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); if (this.BroadcastReceived != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag); } groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID); if (groupMemberList != null) { BroadcastInformation information = new BroadcastInformation(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag); foreach (string str3 in groupMemberList) { if (str3 != interface37_0.Header.UserID) { if (this.ginterface8_0.IsUserOnLine(str3)) { this.interface40_0.PostMessage(interface37_0, str3, contract2.ActionTypeOnChannelIsBusy); } else if (this.BroadcastFailed != null) { this.BroadcastFailed(str3, information); } } } } return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { destUserID = interface37_0.Header.DestUserID; if (this.bool_4 && (this.BroadcastReceived != null)) { BlobFragmentContract contract5 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information2 = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract5); if (information2 != null) { BlobAndTagContract contract6 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information2.Content, 0); this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract5.InformationType, contract6.Message, contract6.Tag); } } groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID); if (groupMemberList != null) { foreach (string str3 in groupMemberList) { if (str3 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str3, ActionTypeOnChannelIsBusy.Continue); } } } return(null); } return(null); }