Smaller fixes

This commit is contained in:
Adam 2025-04-07 14:05:38 +02:00
parent f6bc09c661
commit 7b5b279e10
36 changed files with 540 additions and 113 deletions

View File

@ -67,10 +67,10 @@ public static class TiamConstClient
};
#if RELEASE
public static string SystemEmailAddress = "system@touriam.com";
public static string SystemEmailAddress = "test@touriam.com";
public static LogLevel DefaultLogLevelClient = LogLevel.Debug;
#else
public static string SystemEmailAddress = "system@anataworld.com";
public static string SystemEmailAddress = "test@touriam.com";
public static LogLevel DefaultLogLevelClient = LogLevel.Detail;
#endif
}

View File

@ -14,7 +14,7 @@ using AyCode.Core.Extensions;
using Microsoft.Extensions.DependencyInjection;
using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Addresses;
using DevExpress.Pdf.Native.BouncyCastle.Asn1.Ocsp;
//using DevExpress.Pdf.Native.BouncyCastle.Asn1.Ocsp;
namespace TIAM.Database.Test
{

View File

@ -23,10 +23,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />

View File

@ -34,6 +34,7 @@ using AyCode.Interfaces.Entities;
using TIAM.Models;
using TIAM.Models.Dtos.Users;
using TIAM.Models.PageViewModels;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAM.Database.DataLayers.Admins
{

View File

@ -10,6 +10,7 @@ using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users;
using TIAM.Models;
using TIAM.Models.Dtos.Users;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAM.Database.DataLayers.Users
{

View File

@ -7,11 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Data" Version="24.1.3" />
<PackageReference Include="DevExpress.Data" Version="24.2.3" />
<PackageReference Include="MessagePack.Annotations" Version="2.5.187" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -0,0 +1,68 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Data" Version="24.2.3" />
<PackageReference Include="MessagePack.Annotations" Version="2.5.187" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataLayers\DTOs\" />
<Folder Include="DataLayers\Permissions\" />
<Folder Include="DataLayers\Products\" />
<Folder Include="DbSets\Addresses\" />
<Folder Include="Extensions\" />
<Folder Include="ModelBuilders\Emails\" />
<Folder Include="ModelBuilders\Profiles\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TIAM.Core\TIAM.Core.csproj" />
<ProjectReference Include="..\TIAM.Entities.Server\TIAM.Entities.Server.csproj" />
<ProjectReference Include="..\TIAM.Entities\TIAM.Entities.csproj" />
<ProjectReference Include="..\TIAM.Models\TIAM.Models.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Database">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Database.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models.Server">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -1,6 +1,7 @@
using AyCode.Blazor.Models.ViewModels;
using TIAM.Entities.Emails;
using TIAM.Models.PageViewModels;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAM.Models;

View File

@ -1,4 +1,5 @@
using System.Net;
using System.Net.Mail;
using AyCode.Core.Helpers;
using AyCode.Models.Enums;
using Microsoft.Extensions.Configuration;
@ -13,6 +14,11 @@ namespace TIAM.Services.Server
{
public class MessageSenderService(IConfiguration configuration, AdminDal adminDal) : IMessageSenderService
{
private readonly string smtpHost = "smtp.rackhost.hu";
private readonly int smtpPort = 587; // Change if needed
private readonly string smtpUser = "system@touriam.com";
private readonly string smtpPass = "Villany1";
public async Task<string> SendMessageAsync(EmailMessage message, int messageType)
{
var result = "";
@ -24,7 +30,8 @@ namespace TIAM.Services.Server
//var subject = emailMessage.Subject;
//adminDal.AddEmailMessageAsync(message).Forget();
result = (await SendMailWithSendgrid(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString();
//result = (await SendMailWithSendgrid(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString();
result = (await SendMailWithSmtp(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString();
break;
case (int)MessageTypesEnum.sms:
//await SendSmsWithTwilio(message.Message);
@ -159,6 +166,197 @@ namespace TIAM.Services.Server
}
//public async Task<HttpStatusCode> SendMailWithSmtp(EmailMessage message)
//{
// Console.WriteLine($"Sender: {message.SenderId}");
// Console.WriteLine($"Message: {message.Text}");
// if (message.Recipients == null || !message.Recipients.Any())
// {
// return HttpStatusCode.BadRequest;
// }
// using (var smtpClient = new SmtpClient(smtpHost, smtpPort))
// {
// smtpClient.Credentials = new NetworkCredential(smtpUser, smtpPass);
// smtpClient.EnableSsl = true;
// var fromAddress = new MailAddress(smtpUser, "Your Mail Service");
// List<Task> sendTasks = new List<Task>();
// foreach (var recipient in message.Recipients)
// {
// var toAddress = new MailAddress(recipient.EmailAddress);
// var mailMessage = new MailMessage(fromAddress, toAddress)
// {
// Subject = message.Subject,
// Body = message.Text,
// IsBodyHtml = true
// };
// //sendTasks.Add(Task.Run(() => smtpClient.SendMailAsync(mailMessage)));
// sendTasks.Add(smtpClient.SendMailAsync(mailMessage));
// }
// try
// {
// await Task.WhenAll(sendTasks);
// Console.WriteLine("All emails sent successfully");
// return HttpStatusCode.OK;
// }
// catch (Exception ex)
// {
// Console.WriteLine($"Failed to send emails: {ex.Message}");
// return HttpStatusCode.InternalServerError;
// }
// }
//}
//public async Task<HttpStatusCode> SendMailWithSmtp(EmailMessage message)
//{
// Console.WriteLine($"Sender: {message.SenderId}");
// Console.WriteLine($"Message: {message.Text}");
// if (message.Recipients == null || !message.Recipients.Any())
// {
// return HttpStatusCode.BadRequest;
// }
// List<Task> sendTasks = new List<Task>();
// foreach (var recipient in message.Recipients)
// {
// var smtpClient = new SmtpClient(smtpHost, smtpPort)
// {
// Credentials = new NetworkCredential(smtpUser, smtpPass),
// EnableSsl = true,
// TargetName = $"SMTPS/{smtpHost}"
// };
// var fromAddress = new MailAddress(smtpUser, "Your Mail Service");
// var toAddress = new MailAddress(recipient.EmailAddress);
// var mailMessage = new MailMessage(fromAddress, toAddress)
// {
// Subject = message.Subject,
// Body = message.Text,
// IsBodyHtml = true
// };
// sendTasks.Add(Task.Run(async () =>
// {
// try
// {
// await smtpClient.SendMailAsync(mailMessage);
// }
// catch (Exception ex)
// {
// Console.WriteLine($"Failed to send email to {recipient.EmailAddress}: {ex.Message}");
// throw; // Ensure exceptions bubble up
// }
// finally
// {
// smtpClient.Dispose();
// }
// }));
// }
// var timeoutTask = Task.Delay(TimeSpan.FromSeconds(30)); // Prevent indefinite waiting
// var allTasks = Task.WhenAll(sendTasks);
// var completedTask = await Task.WhenAny(allTasks, timeoutTask);
// if (completedTask == timeoutTask)
// {
// Console.WriteLine("Email sending timed out.");
// return HttpStatusCode.RequestTimeout;
// }
// try
// {
// await allTasks; // Rethrow if there were failures
// Console.WriteLine("All emails sent successfully");
// return HttpStatusCode.OK;
// }
// catch (Exception)
// {
// Console.WriteLine("Some emails failed to send");
// return HttpStatusCode.InternalServerError;
// }
//}
public async Task<HttpStatusCode> SendMailWithSmtp(EmailMessage message)
{
Console.WriteLine($"Sender: {message.SenderId}");
Console.WriteLine($"Message: {message.Text}");
if (message.Recipients == null || !message.Recipients.Any())
{
return HttpStatusCode.BadRequest;
}
List<Task> sendTasks = new List<Task>();
foreach (var recipient in message.Recipients)
{
sendTasks.Add(Task.Run(async () =>
{
try
{
using (var smtpClient = new SmtpClient(smtpHost, smtpPort))
{
smtpClient.Credentials = new NetworkCredential(smtpUser, smtpPass);
smtpClient.EnableSsl = true; // Try false for port 587
smtpClient.TargetName = $"SMTPS/{smtpHost}";
var fromAddress = new MailAddress(smtpUser, "Your Mail Service");
var toAddress = new MailAddress(recipient.EmailAddress);
var mailMessage = new MailMessage(fromAddress, toAddress)
{
Subject = message.Subject,
Body = message.Text,
IsBodyHtml = true
};
await smtpClient.SendMailAsync(mailMessage);
}
}
catch (Exception ex)
{
Console.WriteLine($"Failed to send email to {recipient.EmailAddress}: {ex.Message}");
if (ex.InnerException != null)
{
Console.WriteLine($"Inner Exception: {ex.InnerException.Message}");
}
throw;
}
}));
}
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(30)); // Prevent indefinite waiting
var allTasks = Task.WhenAll(sendTasks);
var completedTask = await Task.WhenAny(allTasks, timeoutTask);
if (completedTask == timeoutTask)
{
Console.WriteLine("Email sending timed out.");
return HttpStatusCode.RequestTimeout;
}
try
{
await allTasks; // Rethrow if there were failures
Console.WriteLine("All emails sent successfully");
return HttpStatusCode.OK;
}
catch (Exception)
{
Console.WriteLine("Some emails failed to send");
return HttpStatusCode.InternalServerError;
}
}
public string GenerateWelcomeEmail(string userName, string activationCode)
{
string template = EmailTemplateHelper.GetTemplate(TiamConstClient.WelcomeEmailTemplateName);

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>D:\REPOS\TOURIAM_PUBLISH</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>

View File

@ -53,7 +53,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp.Views.Desktop.Common" Version="2.88.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="7.0.1" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="7.0.1" Version="9.0.3" />
</ItemGroup>
<ItemGroup>

View File

@ -2,8 +2,8 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<ActiveDebugFramework>net8.0-windows10.0.19041.0</ActiveDebugFramework>
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
<ActiveDebugFramework>net8.0-maccatalyst</ActiveDebugFramework>
<ActiveDebugProfile>Mac Catalyst</ActiveDebugProfile>
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
<DefaultDevice>pixel_5_-_api_31</DefaultDevice>
</PropertyGroup>

View File

@ -38,15 +38,15 @@
</div>
<DxPopup CssClass="popup-demo-events"
@bind-Visible="@_popupVisible"
ShowFooter="true"
CloseOnEscape="true"
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="MessageBox"
Closing="EmailPopupClosing"
Closed="EmailPopupClosed"
SizeMode="SizeMode.Large">
@bind-Visible="@_popupVisible"
ShowFooter="true"
CloseOnEscape="true"
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="MessageBox"
Closing="EmailPopupClosing"
Closed="EmailPopupClosed"
SizeMode="SizeMode.Large">
<BodyContentTemplate>
@{
if(showResultMessage)
@ -56,14 +56,14 @@
else
{
<DynamicEditForm Data=@_messageWizardModel
OnSubmit="SubmitForm"
TitleString="New message"
ButtonTextString="Send message"
isEditing="true"
IgnoreReflection=@IgnoreList></DynamicEditForm>
OnSubmit="SubmitForm"
TitleString="New message"
ButtonTextString="Send message"
isEditing="true"
IgnoreReflection=@IgnoreList></DynamicEditForm>
}
}
</BodyContentTemplate>
<FooterContentTemplate Context="Context">
@{
@ -84,7 +84,7 @@
</div>
}
}
</FooterContentTemplate>
</DxPopup>
@ -92,8 +92,8 @@
{
<div class="text-center m-5">
<DxWaitIndicator Visible="true"
CssClass="m-auto"
AnimationType="WaitIndicatorAnimationType.Spin" />
CssClass="m-auto"
AnimationType="WaitIndicatorAnimationType.Spin" />
</div>
}
@ -152,11 +152,11 @@ else
}
}
<hr />
<p class="text-muted">Status on: <span class="text-body">@DateTime.Now.ToString("hh:mm tt"), @DateTime.Today.ToString("MMMM dd, yyyy")</span></p>
<h5 class="text-muted">@TransferStatusModel.GetStatusModel(_transfer.TransferStatusType);</h5>
</div>
</div>
<div class="d-flex justify-content-between align-items-center">
@ -175,7 +175,7 @@ else
<h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Warning" Click="CancelTransfer">Cancel</DxButton></h5>
}
}
<div class="vr"></div>
@{
if(_transfer.Price != null || _transfer.Price != 0)
@ -184,7 +184,7 @@ else
<div class="vr"></div>
}
}
@*<h5 class="fw-normal mb-0"><a class="btn btn-secondary" @onclick="SetEditMode">Modify</a></h5>*@
<h5 class="fw-normal mb-0"><DxButton RenderStyle="ButtonRenderStyle.Secondary" Click="SetEditMode">Modify</DxButton></h5>
</div>
@ -251,7 +251,7 @@ else
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Appointment">
<DxDateEdit TimeSectionVisible="true" @bind-Date="_transfer.Appointment" />
</DxFormLayoutItem>
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Passenger Count">
<DxSpinEdit @bind-Value="_transfer.PassengerCount" />
</DxFormLayoutItem>
@ -267,7 +267,7 @@ else
</div>
<div class="d-flex flex-row mb-4 pb-2">
<DxFormLayoutItem ColSpanLg="12" CssClass="form-field" Caption="Comment">
<DxMemo @bind-Text="_transfer.Comment" />
@ -276,6 +276,7 @@ else
</div>
<div class="card-footer p-4">
<div class="d-flex justify-content-between">
<DxButton RenderStyle="ButtonRenderStyle.Warning" Click="@((e) => CancelTransferEventHandler(e, true))">Discard changes</DxButton>
<DxButton Click="@((e) => UpdateTransferEventHandler(e, true))">Save Changes</DxButton>
</div>
</div>
@ -292,7 +293,7 @@ else
<div style="margin-top: 10px; margin-bottom: 10px;">
<DxButton Click="() => SendMail(_transfer)" Text="Send a message" RenderStyle="ButtonRenderStyle.Primary" />
</div>
<MessageDetailGridComponent ContextId="transferId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent>
<MessageDetailGridComponent ContextId="_transfer.Id" GetAllMessageTag="SignalRTags.GetMessagesByContextId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent>
</DxTabPage>
</DxTabs>
</div>
@ -527,6 +528,11 @@ else
navManager.NavigateTo("/mytransfers"); // Redirect to a list or another page after successful update
}
private async Task CancelTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false)
{
_editMode = false;
}
private async Task<Transfer?> UpdateTransfer(bool shouldRedirect = false)
{
try

View File

@ -35,15 +35,15 @@
@_localizer["LoginTitleText"]
</div>
<div class="form-field">
<DxMaskedInput @bind-Value="@emailAddress"
Id="Email"
CssClass="form-control"
Mask="@EmailMask"
MaskMode="MaskMode.RegEx">
<DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"
Placeholder="Placeholder"
PlaceholdersVisible="PlaceholderVisible" />
</DxMaskedInput>
<DxMaskedInput @bind-Value="@emailAddress"
Id="Email"
CssClass="form-control"
Mask="@EmailMask"
MaskMode="MaskMode.RegEx">
<DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"
Placeholder="Placeholder"
PlaceholdersVisible="PlaceholderVisible" />
</DxMaskedInput>
</div>
<DxButton CssClass="btn btn-primary mt-3" Click="() => SendMail(emailAddress)">Send</DxButton>
<div class="text-center fs-6">
@ -60,7 +60,7 @@
<Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
<p>
@msg;
</p>
</Animation>
@ -88,6 +88,6 @@
private void SendMail(string email)
{
var sendResult = UserDataService.SendForgottenPasswordMail(emailAddress).Forget;
msg = "We have sent you an email, with instructions on how to renew your password. ";
}
}

View File

@ -39,14 +39,14 @@
<h3>Partner:</h3>
<p>@SelectedHotel</p>
<div class="row py-3">
<DynamicEditForm Data="Data" isEditing="true" IgnoreReflection="TransferIgnorList" OnSubmit="SubmitForm"></DynamicEditForm>
</div>
<div class="row py-3">
<DxButton RenderStyle="ButtonRenderStyle.Primary" Click="@Reload" Visible="@isReloadVisible">Reload</DxButton>
</div>
@ -91,9 +91,10 @@
protected override async Task OnParametersSetAsync()
{
if(productId.IsNullOrEmpty())
if(!productId.IsNullOrEmpty())
{
var result = await _adminSignalRClient.GetByIdAsync<Product>(SignalRTags.GetCompaniesById, productId);
var result = await _adminSignalRClient.GetByIdAsync<Product>(SignalRTags.GetProductById, productId);
_logger.Debug($"Current product: {result.Name}");
if (result != null)
{
SelectedHotel = result;
@ -103,7 +104,7 @@
SelectedHotel = null;
}
}
_logger.Debug($"OnParameterSet, going forward");
if (!referralId.IsNullOrEmpty())
{
//check if storage has some other referralId already TODO

View File

@ -267,8 +267,7 @@
"Destination",
"UserId",
"ProductId",
"PaymentId",
"TripDate",
"PaymentId",
"FirstName",
"LastName",
"UserProductMappingId",
@ -283,8 +282,7 @@
"PickupAddress",
"UserId",
"ProductId",
"PaymentId",
"TripDate",
"PaymentId",
"FirstName",
"LastName",
"UserProductMappingId",
@ -405,7 +403,7 @@
var transfer = await WizardProcessor.ProcessWizardAsync<TransferWizardModel>(result.GetType(), result);
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
navManager.NavigateTo($"/transfer2/{resModel.Id}");
navManager.NavigateTo($"/mytransfers/{resModel.Id}");
}
protected override Task OnInitializedAsync()

View File

@ -116,7 +116,7 @@
void OnPasswordSet(string password)
{
msg = $"Password to set: {NewPassword}";
msg = $"Please type in again";
PasswordNotSet = false;
StateHasChanged();

View File

@ -103,6 +103,7 @@
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Appointment" SortOrder="GridColumnSortOrder.Descending" GroupIndex="0" GroupInterval="GridColumnGroupInterval.Custom" DisplayFormat="g" Width="125" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120" />

View File

@ -118,6 +118,7 @@
<DxGridDataColumn FieldName="Revenue" Caption="Revenue" Width="70" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120">
<CellDisplayTemplate>
@{
@ -165,6 +166,9 @@
<DxFormLayoutItem Caption=@_localizer.GetString(ResourceKeys.LastName) ColSpanMd="6">
@editFormContext.GetEditor("LastName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@_localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="6">
@editFormContext.GetEditor("ContactEmail")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@_localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@editFormContext.GetEditor("ToAddress")
</DxFormLayoutItem>

View File

@ -27,14 +27,15 @@
@inject AdminSignalRClient AdminSignalRClient;
@inject ISessionService sessionService
@inject IComponentUpdateService ComponentUpdateService
@inject ITransferDataService transferDataService
<MessageDetailGrid CssClass="my-grid" @ref="_messageGrid"
Logger="_logger"
SignalRClient="AdminSignalRClient"
GetAllMessageTag="GetAllMessageTag"
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
CustomizeElement="CustomizeElement"
ShowFilterRow="ShowFilterRow">
Logger="_logger"
SignalRClient="AdminSignalRClient"
GetAllMessageTag="GetAllMessageTag"
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
CustomizeElement="CustomizeElement"
ShowFilterRow="ShowFilterRow">
<Columns>
<DxGridCommandColumn Width="135" MinWidth="135" Visible="AcDomain.IsDeveloperVersion" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="SenderId" Caption=" " Width="30px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" DisplayFormat="N" AllowSort="false">
@ -163,10 +164,24 @@
private Guid? myUserId;
protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
_logger = new LoggerClient<MessageDetailGridComponent>(LogWriters.ToArray());
myUserId = _sessionService.User.UserId;
if(sessionService.User != null)
{
myUserId = _sessionService.User.UserId;
}
else
{
if(ContextId != null)
{
//should be transfer because in any other way, the user must be logged in
myUserId = Guid.Empty; //TODO get userId by transfer
var transfer = await AdminSignalRClient.GetTransferById((Guid)ContextId);
myUserId = transfer.UserId;
}
}
}
private void CustomizeElement(GridCustomizeElementEventArgs e)

View File

@ -18,7 +18,7 @@
<div class="page">
<TiamErrorBoundaryComponent LoggerCategory="AdminLayout" OnError="HandleError">
<AppLaunchComponent />
<AdminNavMenu />
<NavHelperComponent />

View File

@ -12,13 +12,14 @@
@inject NavigationManager NavigationManager
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject IJSRuntime jsRuntime
@inject IComponentUpdateService componentUpdateService
<div class="w-100" style="height:40px; position:fixed; z-index: 10000;">
<DxMenu CssClass="my-menu" SizeMode="SizeMode.Medium" Title="Tour I Am" ItemsPosition="ItemPosition.End" CollapseItemsToHamburgerMenu="true"
Orientation="Orientation"
DisplayMode="DisplayMode"
HamburgerButtonPosition="MenuHamburgerButtonPosition.Right">
Orientation="Orientation"
DisplayMode="DisplayMode"
HamburgerButtonPosition="MenuHamburgerButtonPosition.Right">
<TitleTemplate>
@{
if (_isMobile)
@ -32,29 +33,29 @@
@if (IsSysAdmin)
{
<DxToolbarItem Name="Transfers"
BeginGroup="true"
IconCssClass="fa-solid fa-face-smile"
Tooltip="Transfers"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url1)" />
BeginGroup="true"
IconCssClass="fa-solid fa-face-smile"
Tooltip="Transfers"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url1)" />
}
@if (IsDriver)
{
<DxToolbarItem Name="Transfers"
BeginGroup="true"
IconCssClass="fa-solid fa-taxi"
Tooltip="My tasks"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url2)" />
BeginGroup="true"
IconCssClass="fa-solid fa-taxi"
Tooltip="My tasks"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url2)" />
}
<DxToolbarItem Name="Messages"
BeginGroup="true"
IconCssClass="fa-solid fa-envelope"
Tooltip="Messages"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url3)" />
BeginGroup="true"
IconCssClass="fa-solid fa-envelope"
Tooltip="Messages"
Alignment="ToolbarItemAlignment.Right"
Click="() => NavigationManager.NavigateTo(url3)" />
</Items>
</DxToolbar>
}
@ -107,11 +108,11 @@
</DxMenuItem>
<!--DxMenuItem Text="HotelAdmin" IconCssClass="menu-icon-support menu-icon">
<Items>
<DxMenuItem NavigateUrl="user/hoteladmin/" Text="Dashboard" />
<DxMenuItem NavigateUrl="user/createAndManageTransfer" Text="Transfers" />
<DxMenuItem NavigateUrl="user/serviceprovider/5453-a87f77787d-khj899" Text="Manage hotel" />
</Items>
<Items>
<DxMenuItem NavigateUrl="user/hoteladmin/" Text="Dashboard" />
<DxMenuItem NavigateUrl="user/createAndManageTransfer" Text="Transfers" />
<DxMenuItem NavigateUrl="user/serviceprovider/5453-a87f77787d-khj899" Text="Manage hotel" />
</Items>
</DxMenuItem-->
@* <DxMenuItem NavigateUrl="user/messages" Text="Messages" IconCssClass="fa-solid fa-envelope" /> *@
@{
@ -153,6 +154,7 @@
private bool expandHotelAdminNav = false;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private bool myUser = false;
private bool userHasCompany;
private bool userHasHotels;
private bool IsDriver;
@ -237,4 +239,56 @@
SessionService.ClearAll();
NavigationManager.NavigateTo("/");
}
protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
if (firstRender)
componentUpdateService.GetOrAddComponent<AdminNavMenu>().RefreshRequested += RefreshMe;
}
private void RefreshMe()
{
_logger.Debug($"Navbar refresh called! {DateTime.Now} ");
//OnInitialized();
InitUser();
StateHasChanged();
}
private void InitUser()
{
if (SessionService.User != null)
{
myUser = true;
userId = SessionService.User.UserId;
userEmail = SessionService.User.Email;
if (SessionService.User.UserModelDto.ProfileDto.FullName != null)
{
userFullName = SessionService.User.UserModelDto.ProfileDto.FullName!;
}
}
else
{
_logger.Debug($"Navbar myUser false! {DateTime.Now} ");
myUser = false;
}
var properties = SessionService.User?.HasProperties;
if (properties == null) return;
userHasCompany = SessionService.HasCompany;
userHasHotels = properties.Count > 0;
IsSysAdmin = SessionService.IsSysAdmin;
IsDevAdmin = SessionService.IsDevAdmin;
IsDriver = SessionService.IsDriver;
driverPermissionId = SessionService.DriverPersmissionId;
foreach (var property in properties)
{
_logger.Detail($"First property: {property.Value} ");
}
}
}

View File

@ -19,7 +19,7 @@
<ItemGroup>
<PackageReference Include="Blazor.AnimateOnScroll" Version="1.1.0" />
<PackageReference Include="BlazorAnimation" Version="2.2.0" />
<PackageReference Include="DevExpress.Blazor" Version="24.1.3" />
<PackageReference Include="DevExpress.Blazor" Version="24.2.3" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />

View File

@ -6,6 +6,11 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="Pages\Utility\DynamicForm.razor" />
<Content Remove="Shared\Users\NavigationHelperComponent.razor" />
</ItemGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
@ -14,10 +19,10 @@
<ItemGroup>
<PackageReference Include="Blazor.AnimateOnScroll" Version="1.1.0" />
<PackageReference Include="BlazorAnimation" Version="2.2.0" />
<PackageReference Include="DevExpress.Blazor" Version="23.2.3" />
<PackageReference Include="MessagePack" Version="2.5.168" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.6" />
<PackageReference Include="DevExpress.Blazor" Version="24.1.3" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
@ -74,9 +79,39 @@
</ItemGroup>
<ItemGroup>
<Content Update="Pages\RoadmapPage.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Pages\User\CardComponents\CompanyCardComponent.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Pages\User\Drivers\DriverManageCars.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Pages\User\Hotels\HotelEditTransfers.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Pages\User\SysAdmins\AddressDetailGridComponent.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Pages\Utility\DynamicForm.razor" />
<_ContentIncludedByDefault Remove="Shared\Users\NavigationHelperComponent.razor" />
</ItemGroup>
<ItemGroup>
<None Include="Pages\Utility\DynamicForm.razor" />
<None Include="Shared\Users\NavigationHelperComponent.razor" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Pages\Utility\DynamicForm.razor" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Shared\Users\NavigationHelperComponent.razor" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\REPOS\AYCODE\Publish\ServerRelease</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<ProjectGuid>2091d897-ba49-4fc1-808f-036fa040376e</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

View File

@ -3,6 +3,7 @@ using TIAM.Entities.Emails;
//using TIAM.Entities.TransferDestinations;
using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAMWebApp.Client.Services
{

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>http</ActiveDebugProfile>
<ActiveDebugProfile>https</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>D:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Client\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

View File

@ -115,7 +115,13 @@ namespace TIAMWebApp.Server.Controllers
if (!loggedInModel.IsLoggedIn)
{
_logger.Warning(@"User not valid! errorCode: " + loggedInModel.LoginErrorCode);
return null;
//return null;
return new MainResponse
{
Content = loggedInModel.LoginErrorCode,
IsSuccess = false,
ErrorMessage = "Not valid login."
};
}
var response = new MainResponse
@ -550,7 +556,7 @@ namespace TIAMWebApp.Server.Controllers
//send email
_logger.Info($"Created transfer, send emailMessage!!!");
var message = new MessageSenderModel<EmailMessage>();
var message = new MessageSenderModel<TIAM.Entities.Emails.EmailMessage>();
message.Message = new EmailMessage();
message.Message.EmailAddress = email;
message.Message.Id = Guid.NewGuid();

View File

@ -64,7 +64,8 @@ builder.Services.AddCors(options =>
{
options.AddPolicy(myAllowSpecificOrigins, policy =>
{
policy.AllowAnyOrigin();
policy.WithOrigins("http://touriam.com",
"http://www.touriam.com");
});
});

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.22" />
<PackageReference Include="QRCoderNetCore" Version="1.0.0" />
<PackageReference Include="SendGrid" Version="9.29.3" />
@ -27,6 +27,7 @@
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.1.2" />
</ItemGroup>
<ItemGroup>

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>https</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>C:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\ReleaseDeployProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\ReleaseDeployProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

View File

@ -1,6 +1,7 @@
{
"ConnectionStrings": {
"DeveloperDbConnection": "Data Source=185.51.190.197;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true"
//"DeveloperDbConnection": "Data Source=185.51.190.197;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true"
"DeveloperDbConnection": "Data Source=194.164.235.47;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {

View File

@ -1,4 +1,5 @@
using TIAM.Entities.Emails;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAMWebApp.Shared.Application.Interfaces
{

View File

@ -8,10 +8,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide
//public static string BaseUrl = "https://touriam.mangoweb.hu";
//public static string ApiBaseUrl = "https://touriam.mangoweb.hu";
#if RELEASE
public static string BaseUrl = "https://test.touriam.com";
public static string ApiBaseUrl = "https://test.touriam.com";
//public static string BaseUrl = "https://touriam.com";
//public static string ApiBaseUrl = "https://touriam.com";
//public static string BaseUrl = "https://test.touriam.com";
//public static string ApiBaseUrl = "https://test.touriam.com";
public static string BaseUrl = "https://touriam.com";
public static string ApiBaseUrl = "https://touriam.com";
//public static string BaseUrl = "https://qa.touriam.com";
//public static string ApiBaseUrl = "https://qa.touriam.com";
#else

View File

@ -5,6 +5,7 @@ using System.Net.Http.Json;
//using AyCode.Models.Messages;
using TIAM.Entities.Emails;
using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
using EmailMessage = TIAM.Entities.Emails.EmailMessage;
namespace TIAMWebApp.Shared.Application.Services
{

View File

@ -80,8 +80,8 @@ public abstract class UserDataServiceClientBase : IUserDataService
public async Task<MainResponse?> AuthenticateUser(LoginModel loginModel)
{
Logger.Debug($"AuthenticateUser; email: {loginModel.Email}");
return await AdminSignalRClient.PostDataAsync<LoginModel, MainResponse>(SignalRTags.AuthenticateUser, loginModel);
var result = await AdminSignalRClient.PostDataAsync<LoginModel, MainResponse>(SignalRTags.AuthenticateUser, loginModel);
return result;
//var result = string.Empty;
//var url = $"{Setting.ApiBaseUrl}/{APIUrls.AuthenticateUser}";