예제 #1
0
 public static async Task<Results> ListAll()
 {
     var client = ClientConnection.GetCmsConnection();
     try
     {
         client.Open();
         var response = await client.GetClientsAsync(new GetClientsRequest()
         {
             CorporationRID = 10,
             MessageGuid = Guid.NewGuid()
         });
         client.Close();
         var results = new Results();
         response.Clients.ForEach(record => results.List.Add(
             ParseClient(record)));
         return results;
     }
     catch (Exception ex)
     {
         client.Close();
         return new LG.Data.Models.Clients.Results
         {
             IsError = true,
             Message = ex.Message.ToString(CultureInfo.InvariantCulture)
         };
     }
 }
예제 #2
0
 public static async Task<Results> Search(LG.Data.Models.Shared.ValueItem item)
 {
     var client = ClientConnection.GetCmsConnection();
     try
     {
         client.Open();
         var response = await client.SearchClientAsync(new SearchClientRequest()
         {
             SearchInput = item.Value,
             IsIncludeStartsWith = true,
             IsIncludeContains = true,
             MessageGuid = Guid.NewGuid()
         });
         client.Close();
         var results = new Results();
         response.Clients.ForEach(record => results.List.Add(
             ParseClient(record)));
         return results;
     }
     catch (Exception ex)
     {
         client.Close();
         return new LG.Data.Models.Clients.Results
         {
             IsError = true,
             Message = ex.Message.ToString(CultureInfo.InvariantCulture)
         };
     }
 }