/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileAsync() { // Snippet: CreateProfileAsync(string, Profile, CallSettings) // Additional: CreateProfileAsync(string, Profile, CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/tenants/[TENANT]"; Profile profile = new Profile(); // Make the request Profile response = await profileServiceClient.CreateProfileAsync(parent, profile); // End snippet }
/// <summary>Snippet for CreateProfile</summary> public void CreateProfileRequestObject() { // Snippet: CreateProfile(CreateProfileRequest, CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"), Profile = new Profile(), }; // Make the request Profile response = profileServiceClient.CreateProfile(request); // End snippet }
/// <summary>Snippet for DeleteProfile</summary> public void DeleteProfile_RequestObject() { // Snippet: DeleteProfile(DeleteProfileRequest,CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) DeleteProfileRequest request = new DeleteProfileRequest { ProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"), }; // Make the request profileServiceClient.DeleteProfile(request); // End snippet }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileAsync() { // Snippet: CreateProfileAsync(TenantName,Profile,CallSettings) // Additional: CreateProfileAsync(TenantName,Profile,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) TenantName parent = new TenantName("[PROJECT]", "[TENANT]"); Profile profile = new Profile(); // Make the request Profile response = await profileServiceClient.CreateProfileAsync(parent, profile); // End snippet }
/// <summary>Snippet for SearchProfilesAsync</summary> public async Task SearchProfilesAsync_RequestObject() { // Snippet: SearchProfilesAsync(SearchProfilesRequest,CallSettings) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) SearchProfilesRequest request = new SearchProfilesRequest { ParentAsCompanyName = new CompanyName("[PROJECT]", "[COMPANY]"), RequestMetadata = new RequestMetadata(), }; // Make the request PagedAsyncEnumerable <SearchProfilesResponse, HistogramQueryResult> response = profileServiceClient.SearchProfilesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((HistogramQueryResult item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((SearchProfilesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (HistogramQueryResult item in page) { Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <HistogramQueryResult> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (HistogramQueryResult item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for SearchProfiles</summary> public void SearchProfiles_RequestObject() { // Snippet: SearchProfiles(SearchProfilesRequest,CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) SearchProfilesRequest request = new SearchProfilesRequest { ParentAsTenantName = new TenantName("[PROJECT]", "[TENANT]"), RequestMetadata = new RequestMetadata(), }; // Make the request PagedEnumerable <SearchProfilesResponse, SummarizedProfile> response = profileServiceClient.SearchProfiles(request); // Iterate over all response items, lazily performing RPCs as required foreach (SummarizedProfile item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (SearchProfilesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (SummarizedProfile item in page) { Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <SummarizedProfile> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (SummarizedProfile item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
public bool LoadProfileTypes() { ProfileServiceClient client = null; bool result = false; try { client = new ProfileServiceClient(); ProfileType [] profileTypes = client.RetrieveProfileTypes(); CommonLibrary.Utilty.Sort.GenericList <ProfileType> genericList = new CommonLibrary.Utilty.Sort.GenericList <ProfileType>(); genericList.AddRange(profileTypes); genericList.Sort("ProfileName", CommonLibrary.Utilty.Sort.CollectionSortDirection.Ascending); if (genericList != null && genericList.Count > 0) { _view.ProfileTypes = genericList; result = true; } } catch (TimeoutException te) { _log.Fatal(te); } catch (FaultException fe) { _log.Fatal(fe); } catch (CommunicationException ce) { _log.Fatal(ce); } catch (Exception ex) { _log.Fatal(ex); } finally { if (client != null) { client.CloseProxy(); } } return(result); }
/// <summary>Snippet for DeleteProfileAsync</summary> public async Task DeleteProfileRequestObjectAsync() { // Snippet: DeleteProfileAsync(DeleteProfileRequest, CallSettings) // Additional: DeleteProfileAsync(DeleteProfileRequest, CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) DeleteProfileRequest request = new DeleteProfileRequest { ProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"), }; // Make the request await profileServiceClient.DeleteProfileAsync(request); // End snippet }
/// <summary>Snippet for UpdateProfileAsync</summary> public async Task UpdateProfileAsync_RequestObject() { // Snippet: UpdateProfileAsync(UpdateProfileRequest,CallSettings) // Additional: UpdateProfileAsync(UpdateProfileRequest,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) UpdateProfileRequest request = new UpdateProfileRequest { Profile = new Profile(), }; // Make the request Profile response = await profileServiceClient.UpdateProfileAsync(request); // End snippet }
public ActionResult CreateProfile(FormCollection collection) { var nickname = collection["nickname"]; var username = collection["username"]; var email = collection["email"]; ProfileServiceClient client = new ProfileServiceClient(); Profile profile = new Profile { Username = username, Nickname = nickname, Email = email, }; int i = client.CreateProfile(profile); ViewBag.i = i; return(View()); }
/// <summary>Snippet for GetProfileAsync</summary> public async Task GetProfileAsync_RequestObject() { // Snippet: GetProfileAsync(GetProfileRequest,CallSettings) // Additional: GetProfileAsync(GetProfileRequest,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) GetProfileRequest request = new GetProfileRequest { ProfileName = new ProfileName("[PROJECT]", "[COMPANY]", "[PROFILE]"), }; // Make the request Profile response = await profileServiceClient.GetProfileAsync(request); // End snippet }
/// <summary>Snippet for DeleteProfileAsync</summary> public async Task DeleteProfileAsync_RequestObject() { // Snippet: DeleteProfileAsync(DeleteProfileRequest,CallSettings) // Additional: DeleteProfileAsync(DeleteProfileRequest,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) DeleteProfileRequest request = new DeleteProfileRequest { Name = new ProfileName("[PROJECT]", "[COMPANY]", "[PROFILE]").ToString(), }; // Make the request await profileServiceClient.DeleteProfileAsync(request); // End snippet }
/// <summary>Snippet for ListProfilesAsync</summary> public async Task ListProfilesResourceNamesAsync() { // Snippet: ListProfilesAsync(TenantName, string, int?, CallSettings) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) TenantName parent = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"); // Make the request PagedAsyncEnumerable <ListProfilesResponse, Profile> response = profileServiceClient.ListProfilesAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Profile item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListProfilesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Profile item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Profile> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Profile item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileAsync_RequestObject() { // Snippet: CreateProfileAsync(CreateProfileRequest,CallSettings) // Additional: CreateProfileAsync(CreateProfileRequest,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { Parent = new CompanyName("[PROJECT]", "[COMPANY]").ToString(), Profile = new Profile(), }; // Make the request Profile response = await profileServiceClient.CreateProfileAsync(request); // End snippet }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileRequestObjectAsync() { // Snippet: CreateProfileAsync(CreateProfileRequest, CallSettings) // Additional: CreateProfileAsync(CreateProfileRequest, CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"), Profile = new Profile(), }; // Make the request Profile response = await profileServiceClient.CreateProfileAsync(request); // End snippet }
public StudentRecord getStudentRecordFromSouce(string id, string session, out int categoryid) { ProfileServiceClient client = new ProfileServiceClient(); categoryid = 1; StudentRecord sr = client.getStudentRecordWithSession(id, session); if (sr == null || sr.MatricNo == null) { if (dbcontext.Configs.Any(p => p.ConfigName == "PGCurrentSession")) { session = dbcontext.Configs.First(p => p.ConfigName == "PGCurrentSession").ConfigValue; } sr = getStudentRecordFromPGSouce(id, session); categoryid = 2; } return(sr); }
/// <summary>Snippet for ListProfiles</summary> public void ListProfiles() { // Snippet: ListProfiles(string, string, int?, CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/tenants/[TENANT]"; // Make the request PagedEnumerable <ListProfilesResponse, Profile> response = profileServiceClient.ListProfiles(parent); // Iterate over all response items, lazily performing RPCs as required foreach (Profile item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListProfilesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Profile item in page) { // Do something with each item Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Profile> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Profile item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
public ActionResult LogIn(FormCollection collection) { ProfileServiceClient client = new ProfileServiceClient(); var username = collection["username"]; var password = collection["password"]; Profile profile = new Profile(); profile.Username = username; profile.Password = password; var profileId = client.Authenticate(profile); ViewBag.LoginStatus = profileId; var cookie = new HttpCookie("aCookie"); cookie.Value = profileId.ToString(); //var cookieValue = Request.Cookies.Get("aCookie").Value; Response.Cookies.Add(cookie); return(Redirect("/Chat/GetChats")); }
void GetProfileInfo(CookieContainer cookieContainer) { string endPtAddr = strEndPtAddr("MyProfileSvcWrap"); ProfileServiceClient profileSvc = new ProfileServiceClient(new BasicHttpBinding(), new EndpointAddress(endPtAddr)); string[] strProfileProps = new string[] { "FirstName", "LastName", "PhoneNumber" }; using (new OperationContextScope(profileSvc.InnerChannel)) { SetCookies(OperationContext.Current, cookieContainer); Dictionary <string, object> profileData = profileSvc.GetPropertiesForCurrentUser(strProfileProps, true); foreach (string sProp in strProfileProps) { Console.WriteLine(sProp + ": " + profileData[sProp]); } } }
public void AddContactsTest() { ProfileServiceClient client = new ProfileServiceClient(); string spidermanID = client.CreateProfile("spiderman", "morpheus", "*****@*****.**", "Peter", "Parker"); string batmanID = client.CreateProfile("batman", "morpheus", "*****@*****.**", "Bruce", "Wayne"); string supermanID = client.CreateProfile("superman", "morpheus", "*****@*****.**", "Clark", "Kent"); List<Profile> profiles = client.GetAllProfiles(); Assert.AreEqual<int>(3, profiles.Count); client.AddContact(spidermanID, batmanID); client.AddContact(batmanID, supermanID); client.AddContacts(supermanID, new ArrayOfguid { spidermanID, batmanID }); List<Profile> spidermanContacts = client.GetContacts(spidermanID); Assert.AreEqual<int>(2, spidermanContacts.Count); List<Profile> batmanContacts = client.GetContacts(batmanID); Assert.AreEqual<int>(3, batmanContacts.Count); List<Profile> supermanContacts = client.GetContacts(supermanID); Assert.AreEqual<int>(3, supermanContacts.Count); client.RemoveAllContacts(spidermanID); client.RemoveAllContacts(batmanID); client.RemoveAllContacts(supermanID); client.DeleteProfile(spidermanID); client.DeleteProfile(batmanID); client.DeleteProfile(supermanID); profiles = client.GetAllProfiles(); Assert.AreEqual<int>(0, profiles.Count); }
static void Main(string[] args) { ProfileServiceClient client = new ProfileServiceClient("WSHttpBinding_ProfileService"); // AddProfile Profile newProfile = new Profile() { Username = "******", Password = "******", Name = "Guillermo", Surname = "Schlereth Lamas", Email = "*****@*****.**", DateOfBirth = DateTime.Parse("12/06/1972"), Description = "Hola soy Guillermo", Gender = Gender.Male, Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" } }; Guid guilleID = client.AddProfile(newProfile); newProfile = new Profile() { Username = "******", Password = "******", Name = "Lidia", Surname = "Lluch Fuentes", Email = "*****@*****.**", DateOfBirth = DateTime.Parse("21/07/1973"), Description = "Hola soy Lidia", Gender = Gender.Female, Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" } }; Guid lidiaID = client.AddProfile(newProfile); newProfile = new Profile() { Username = "******", Password = "******", Name = "Liam", Surname = "Schlereth Lluch", Email = "*****@*****.**", DateOfBirth = DateTime.Parse("25/03/2008"), Description = "Hola soy Liam", Gender = Gender.Male, Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" } }; Guid liamID = client.AddProfile(newProfile); // CreateProfile Guid sergioID = client.CreateProfile("sergio", "admin123", "*****@*****.**", "Sergio", "Schlereth Lamas"); Guid mariaID = client.CreateProfile("mariluz", "admin123", "*****@*****.**", "Mariluz", "Schlereth Lamas"); Guid pericoID = client.CreateProfile("perico", "admin123", "*****@*****.**", "Pedro", "Delgado"); // GetAllProfiles List<Profile> allProfiles = client.GetAllProfiles(); WriteProfiles(allProfiles, "All profiles -->"); // GetProfileByID and GetProfileByCredentials Profile liamProfile = client.GetProfileByID(liamID); Profile sergioProfile = client.GetProfileByID(sergioID); Profile lidiaProfile = client.GetProfileByCredentials("lidia", "admin123"); List<Profile> selectProfiles = new List<Profile>(); selectProfiles.Add(liamProfile); selectProfiles.Add(sergioProfile); selectProfiles.Add(lidiaProfile); WriteProfiles(selectProfiles, "Liam, Sergio and Lidia profiles -->"); // ModifyProfile sergioProfile.Description = "Hola soy Sergio ..."; sergioProfile.Email = "*****@*****.**"; sergioProfile.DateOfBirth = DateTime.Parse("25/06/1986"); sergioProfile.Gender = Gender.Male; sergioProfile.Address = new Address { Street = "Avda. Bellamina, 3", City = "Torremolinos", PostalCode = "29620" }; client.ModifyProfile(sergioProfile); WriteProfiles(new List<Profile>() { client.GetProfileByID(sergioID) }, "Sergio profile modified -->"); // DeleteProfile client.DeleteProfile(pericoID); WriteProfiles(client.GetAllProfiles(), "Perico profile deleted -->"); // SearchProfiles ProfileFilter filter = new ProfileFilter() { Street = "Mompou" }; List<Profile> searchResult = client.SearchProfiles(filter); WriteProfiles(searchResult, "Profiles living in Mompou street -->"); // AddContact client.AddContact(guilleID, lidiaID); client.AddContact(guilleID, liamID); // AddContacts client.AddContacts(guilleID, new List<Guid>() { sergioID, mariaID }); // GetContacts WriteProfiles(client.GetContacts(guilleID), "Guille contacts -->"); // RemoveContact client.RemoveContact(guilleID, sergioID); WriteProfiles(client.GetContacts(guilleID), "Sergio removed from guille contacts -->"); // RemoveAllContacts client.RemoveAllContacts(guilleID); WriteProfiles(client.GetContacts(guilleID), "Guille contacts removed -->"); // Delete Profiles client.DeleteProfile(guilleID); client.DeleteProfile(lidiaID); client.DeleteProfile(sergioID); client.DeleteProfile(mariaID); client.DeleteProfile(liamID); WriteProfiles(client.GetAllProfiles(), "All contacts deleted -->"); Console.ReadLine(); }
public void CreateProfile() { ProfileServiceClient client = new ProfileServiceClient(); string spidermanID = client.CreateProfile("spiderman", "morpheus", "*****@*****.**", "Peter", "Parker"); string batmanID = client.CreateProfile("batman", "morpheus", "*****@*****.**", "Bruce", "Wayne"); string supermanID = client.CreateProfile("superman", "morpheus", "*****@*****.**", "Clark", "Kent"); List<Profile> profiles = client.GetAllProfiles(); Assert.AreEqual<int>(3, profiles.Count); client.DeleteProfile(spidermanID); client.DeleteProfile(batmanID); client.DeleteProfile(supermanID); profiles = client.GetAllProfiles(); Assert.AreEqual<int>(0, profiles.Count); }
public void AddProfileTest() { ProfileServiceClient client = new ProfileServiceClient(); Profile profile = new Profile { Username = "******", Password = "******", Name = "Bruce", Surname = "Wayne", Gender = Gender.Male, DateOfBirth = DateTime.Parse("31/12/1970"), Description = "Batman's profile", Email = "*****@*****.**", Address = new Address { Street = "Bat Cave", City = "Gotham", PostalCode = "67890" } }; string profileID = client.AddProfile(profile); Profile profileFromService = client.GetProfileByID(profileID); Assert.AreEqual<string>("batman", profileFromService.Username); Assert.AreEqual<string>("Bruce", profileFromService.Name); Assert.AreEqual<string>("Wayne", profileFromService.Surname); Assert.AreEqual<string>("*****@*****.**", profileFromService.Email); Assert.AreEqual<DateTime?>(DateTime.Parse("31/12/1970"), profileFromService.DateOfBirth); Assert.AreEqual<string>("Bat Cave", profileFromService.Address.Street); Assert.AreEqual<string>("Gotham", profileFromService.Address.City); Assert.AreEqual<string>("67890", profileFromService.Address.PostalCode); client.DeleteProfile(profileID); List<Profile> profiles = client.GetAllProfiles(); Assert.AreEqual<int>(0, profiles.Count); }