fb9e3d0109
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 13m4s
- Updated GetAllDiscountOrdersQueryHandler to enhance order data mapping by using a more structured approach with AdminOrderDto. - Refactored user full name construction in GetCustomerOrderQueryHandler and GetCustomerOrdersQueryHandler to utilize UserDisplayName for better readability. - Added necessary using directives for consistency across query handlers.
30 lines
893 B
C#
30 lines
893 B
C#
namespace CMSMicroservice.Application.Common;
|
|
|
|
/// <summary>
|
|
/// نام نمایشی کاربر برای گزارشها؛ اگر نام خالی باشد موبایل یا شناسه.
|
|
/// </summary>
|
|
public static class UserDisplayName
|
|
{
|
|
public static string From(string? firstName, string? lastName, string? mobile, long userId)
|
|
{
|
|
var name = string.Join(" ",
|
|
new[] { firstName, lastName }.Where(s => !string.IsNullOrWhiteSpace(s)));
|
|
|
|
if (!string.IsNullOrWhiteSpace(name))
|
|
return name;
|
|
|
|
if (!string.IsNullOrWhiteSpace(mobile))
|
|
return mobile.Trim();
|
|
|
|
return userId > 0 ? $"کاربر {userId}" : "—";
|
|
}
|
|
|
|
public static string From(Domain.Entities.User? user)
|
|
{
|
|
if (user is null)
|
|
return string.Empty;
|
|
|
|
return From(user.FirstName, user.LastName, user.Mobile, user.Id);
|
|
}
|
|
}
|