This commit is contained in:
thuannd88
2024-09-05 15:58:31 +07:00
parent acfa22a83a
commit 7e927dfcc9
10 changed files with 220 additions and 20 deletions
+52
View File
@@ -12,6 +12,8 @@ using System.Text.Json.Serialization;
using Newtonsoft.Json;
using System.Threading.Tasks;
using Serilog;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace SafeBagDE70.API
{
@@ -99,7 +101,37 @@ namespace SafeBagDE70.API
return bSuccess;
}
public static async Task<List<AeonMallCustomer>> GetAeonMallCustomers(int tenantId)
{
try
{
var url = URL + "GetAeonMallCustomers?tenantId="+tenantId;
HttpClientHandler clientHandler = new HttpClientHandler();
clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
// Pass the handler to httpclient(from you are calling api)
HttpClient client = new HttpClient(clientHandler);
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string jsonResponse = await response.Content.ReadAsStringAsync();
var tenants = JsonConvert.DeserializeObject<List<AeonMallCustomer>>(jsonResponse);
return tenants;
}
else
{
Log.Error($"Error: {response.StatusCode}");
return null;
}
}
catch (Exception ex)
{
Log.Fatal($"Exception: {ex.Message}");
return null;
}
}
private static string GetMACAddress()
@@ -130,6 +162,26 @@ namespace SafeBagDE70.API
}
}
public class AeonMallCustomer
{
public long Id { get; set; }
public DateTime CreationTime { get; set; }
public long? CreatorUserId { get; set; }
public long? DeleterUserId { get; set; }
public DateTime? DeletionTime { get; set; }
public bool IsDeleted { get; set; }
public DateTime? LastModificationTime { get; set; }
public long? LastModifierUserId { get; set; }
public int? TenantId { get; set; }
public string? Cards { get; set; }
public string? TenantCode { get; set; }
public string? TenantName { get; set; }
public string? TenantShortName { get; set; }
public string? OpenningDate { get; set; }
public string? Note { get; set; }
public string? Type { get; set; }
public string? TimeTag { get; set; }
}
}