improvements, fixes
This commit is contained in:
parent
fc0b725bc1
commit
4b4f45f63f
|
|
@ -59,6 +59,12 @@ namespace TIAM.Entities.Transfers
|
||||||
{
|
{
|
||||||
Description = description;
|
Description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{nameof(Id)}: {Id}; {nameof(AddressId)}: {AddressId}; {nameof(Name)}: {Name}; {nameof(Description)}: {Description}; {nameof(Price)}: {Price}; " +
|
||||||
|
$"{nameof(Price2)}: {Price2}; {nameof(Price3)}: {Price3}; {nameof(ProductCommis)}: {ProductCommis}; {nameof(ExtraPrice)}: {ExtraPrice}; {nameof(AddressString)}: {AddressString};";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,20 +5,14 @@ using Microsoft.AspNetCore.Components.Web;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
|
||||||
using TIAMWebApp.Shared.Application.Models.PageModels;
|
|
||||||
using DevExpress.Pdf.Native.BouncyCastle.Asn1.X509.Qualified;
|
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using TIAM.Resources;
|
using TIAM.Resources;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
using DevExpress.XtraPrinting;
|
|
||||||
using TIAMSharedUI.Shared;
|
using TIAMSharedUI.Shared;
|
||||||
using DevExpress.Pdf.Native.BouncyCastle.Asn1.Cms;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using AyCode.Core.Consts;
|
using AyCode.Core.Consts;
|
||||||
using AyCode.Core.Loggers;
|
|
||||||
using TIAM.Core.Loggers;
|
using TIAM.Core.Loggers;
|
||||||
using AyCode.Services.Loggers;
|
using AyCode.Services.Loggers;
|
||||||
|
|
||||||
|
|
@ -78,14 +72,14 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
_spinnerClass = "spinner-border spinner-border-sm";
|
_spinnerClass = "spinner-border spinner-border-sm";
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
|
|
||||||
string debugString = "Success: ";
|
var debugString = "Success: ";
|
||||||
|
|
||||||
Type myType = Data.GetType();
|
var myType = Data.GetType();
|
||||||
IList<PropertyInfo> props = new List<PropertyInfo>(myType.GetProperties());
|
IList<PropertyInfo> props = new List<PropertyInfo>(myType.GetProperties());
|
||||||
|
|
||||||
foreach (PropertyInfo prop in props)
|
foreach (var prop in props)
|
||||||
{
|
{
|
||||||
object propValue = prop.GetValue(Data, null);
|
var propValue = prop.GetValue(Data, null);
|
||||||
|
|
||||||
// Do something with propValue
|
// Do something with propValue
|
||||||
debugString += $"{prop.Name} = {propValue}\n";
|
debugString += $"{prop.Name} = {propValue}\n";
|
||||||
|
|
@ -116,24 +110,23 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
|
|
||||||
public RenderFragment CreateEditFormFields() => formLayoutBuilder =>
|
public RenderFragment CreateEditFormFields() => formLayoutBuilder =>
|
||||||
{
|
{
|
||||||
|
var type = Data.GetType();
|
||||||
var _type = Data.GetType();
|
|
||||||
|
|
||||||
//for (var i = 0; i < 1000; i++)
|
//for (var i = 0; i < 1000; i++)
|
||||||
_logger.Info("Hellooooo " + _type.AssemblyQualifiedName);
|
_logger.Info("Hellooooo " + type.AssemblyQualifiedName);
|
||||||
|
|
||||||
var propertyList = _type.GetProperties();
|
var propertyList = type.GetProperties();
|
||||||
var _length = propertyList.Length - IgnoreReflection.Count;
|
var length = propertyList.Length - IgnoreReflection.Count;
|
||||||
//var propertyList = typeof(TestUserData).GetProperties();
|
//var propertyList = typeof(TestUserData).GetProperties();
|
||||||
formLayoutBuilder.OpenComponent<DxFormLayout>(0);
|
formLayoutBuilder.OpenComponent<DxFormLayout>(0);
|
||||||
|
|
||||||
formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) =>
|
formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
var i = 0;
|
||||||
int k = 0;
|
var k = 0;
|
||||||
foreach (var property in propertyList)
|
foreach (var property in propertyList)
|
||||||
{
|
{
|
||||||
bool isActive = k == CurrentStep;
|
var isActive = k == CurrentStep;
|
||||||
//if (property.Name == "Id" || property.Name == "Latitude" || property.Name == "Longitude" || property.Name == "Created" || property.Name == "Modified")
|
//if (property.Name == "Id" || property.Name == "Latitude" || property.Name == "Longitude" || property.Name == "Created" || property.Name == "Modified")
|
||||||
//if (property.Name == "Id" || property.Name == "Created" || property.Name == "Modified")
|
//if (property.Name == "Id" || property.Name == "Created" || property.Name == "Modified")
|
||||||
if (IgnoreReflection.Contains(property.Name))
|
if (IgnoreReflection.Contains(property.Name))
|
||||||
|
|
@ -141,17 +134,17 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Guid _stepID = Guid.Empty;
|
Guid stepId;
|
||||||
|
|
||||||
if (!FormSteps.ContainsKey(k))
|
if (!FormSteps.ContainsKey(k))
|
||||||
{
|
{
|
||||||
_stepID = Guid.NewGuid();
|
stepId = Guid.NewGuid();
|
||||||
_logger.Detail($"Adding step {k}, {_stepID}, for {property.Name}");
|
_logger.Detail($"Adding step {k}, {stepId}, for {property.Name}");
|
||||||
FormSteps.Add(k, _stepID);
|
FormSteps.Add(k, stepId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_stepID = FormSteps[k];
|
stepId = FormSteps[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
//the following line creates an expression that accesses the property value by name
|
//the following line creates an expression that accesses the property value by name
|
||||||
|
|
@ -159,10 +152,10 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
//the following line creates a lambda expression that returns the value of the property
|
//the following line creates a lambda expression that returns the value of the property
|
||||||
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
||||||
|
|
||||||
_logger.Detail(lambda.ToString());
|
_logger.Detail($"lambda: {lambda.ToString()}");
|
||||||
|
|
||||||
layoutItemBuilder.OpenElement(i++, "div");//open div
|
layoutItemBuilder.OpenElement(i++, "div");//open div
|
||||||
layoutItemBuilder.AddAttribute(i++, "id", _stepID.ToString());
|
layoutItemBuilder.AddAttribute(i++, "id", stepId.ToString());
|
||||||
layoutItemBuilder.AddAttribute(i++, "class", "disply-flex align-items-center "+CssClass);
|
layoutItemBuilder.AddAttribute(i++, "class", "disply-flex align-items-center "+CssClass);
|
||||||
layoutItemBuilder.AddAttribute(i++, "style", "width: 100%;");
|
layoutItemBuilder.AddAttribute(i++, "style", "width: 100%;");
|
||||||
if (k != CurrentStep)
|
if (k != CurrentStep)
|
||||||
|
|
@ -176,8 +169,8 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
|
var attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
|
||||||
DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First();
|
var displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First();
|
||||||
layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++); //open dxformlayoutitem
|
layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++); //open dxformlayoutitem
|
||||||
layoutItemBuilder.AddAttribute(i++, "Caption", localizer.GetString(displayLabel.Name));
|
layoutItemBuilder.AddAttribute(i++, "Caption", localizer.GetString(displayLabel.Name));
|
||||||
layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12);
|
layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12);
|
||||||
|
|
@ -363,7 +356,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
{
|
{
|
||||||
|
|
||||||
editor.OpenComponent<SliderItemSelector>(j);
|
editor.OpenComponent<SliderItemSelector>(j);
|
||||||
editor.AddAttribute(j++, "OwlId", "owlSelector" + _stepID);
|
editor.AddAttribute(j++, "OwlId", "owlSelector" + stepId);
|
||||||
editor.AddAttribute(j++, "TextValue", property.GetValue(Data));
|
editor.AddAttribute(j++, "TextValue", property.GetValue(Data));
|
||||||
//editor.AddAttribute(j++, "TExpression", lambda);
|
//editor.AddAttribute(j++, "TExpression", lambda);
|
||||||
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
|
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||||
|
|
@ -400,16 +393,16 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
_logger.Detail($"FirstName changed to {result}");
|
_logger.Detail($"FirstName changed to {result}");
|
||||||
|
|
||||||
//find property with name FirstName
|
//find property with name FirstName
|
||||||
PropertyInfo firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||||
firstNameProperty.SetValue(Data, result);
|
firstNameProperty.SetValue(Data, result);
|
||||||
//find property with name LastName
|
//find property with name LastName
|
||||||
PropertyInfo lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
var lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
||||||
//combine the two values, if they are not null
|
//combine the two values, if they are not null
|
||||||
if (firstNameProperty != null && lastNameProperty != null)
|
if (firstNameProperty != null && lastNameProperty != null)
|
||||||
{
|
{
|
||||||
string firstName = result;
|
var firstName = result;
|
||||||
string lastName = (string)lastNameProperty.GetValue(Data);
|
var lastName = (string)lastNameProperty.GetValue(Data);
|
||||||
string fullName = $"{firstName} {lastName}";
|
var fullName = $"{firstName} {lastName}";
|
||||||
property.SetValue(Data, fullName);
|
property.SetValue(Data, fullName);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
@ -419,16 +412,16 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
_logger.Detail($"LastName changed to {result}");
|
_logger.Detail($"LastName changed to {result}");
|
||||||
|
|
||||||
//find property with name FirstName
|
//find property with name FirstName
|
||||||
PropertyInfo firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||||
//find property with name LastName
|
//find property with name LastName
|
||||||
PropertyInfo lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
var lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
||||||
lastNameProperty.SetValue(Data, result);
|
lastNameProperty.SetValue(Data, result);
|
||||||
//combine the two values, if they are not null
|
//combine the two values, if they are not null
|
||||||
if (firstNameProperty != null && lastNameProperty != null)
|
if (firstNameProperty != null && lastNameProperty != null)
|
||||||
{
|
{
|
||||||
string firstName = (string)firstNameProperty.GetValue(Data);
|
var firstName = (string)firstNameProperty.GetValue(Data);
|
||||||
string lastName = result;
|
var lastName = result;
|
||||||
string fullName = $"{firstName} {lastName}";
|
var fullName = $"{firstName} {lastName}";
|
||||||
property.SetValue(Data, fullName);
|
property.SetValue(Data, fullName);
|
||||||
}
|
}
|
||||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||||
|
|
@ -490,7 +483,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create<MouseEventArgs>(this, OnNext));
|
layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create<MouseEventArgs>(this, OnNext));
|
||||||
layoutItemBuilder.AddAttribute(i++, "SubmitFormOnClick", false);
|
layoutItemBuilder.AddAttribute(i++, "SubmitFormOnClick", false);
|
||||||
layoutItemBuilder.AddAttribute(i++, "CssClass", "btn btn-primary mt-3");
|
layoutItemBuilder.AddAttribute(i++, "CssClass", "btn btn-primary mt-3");
|
||||||
if (!(k < _length - 1))
|
if (!(k < length - 1))
|
||||||
{
|
{
|
||||||
layoutItemBuilder.AddAttribute(i++, "disabled", "true");
|
layoutItemBuilder.AddAttribute(i++, "disabled", "true");
|
||||||
|
|
||||||
|
|
@ -511,7 +504,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
layoutItemBuilder.CloseElement();
|
layoutItemBuilder.CloseElement();
|
||||||
|
|
||||||
|
|
||||||
_logger.Detail($"loop {k}, length: {_length}, formSteps: {FormSteps.Count} ");
|
_logger.Detail($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||||
k++;
|
k++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +519,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
editor.AddAttribute(i++, "type", "submit");
|
editor.AddAttribute(i++, "type", "submit");
|
||||||
editor.AddAttribute(i++, "class", "btn btn-primary mt-3 w-100");
|
editor.AddAttribute(i++, "class", "btn btn-primary mt-3 w-100");
|
||||||
editor.AddAttribute(i++, "style", "margin: 0 auto");
|
editor.AddAttribute(i++, "style", "margin: 0 auto");
|
||||||
if (CurrentStep < _length - 1)
|
if (CurrentStep < length - 1)
|
||||||
{
|
{
|
||||||
editor.AddAttribute(i++, "disabled", "true");
|
editor.AddAttribute(i++, "disabled", "true");
|
||||||
|
|
||||||
|
|
@ -571,7 +564,8 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
|
||||||
public class MinPasswordLengthAttribute : ValidationAttribute
|
public class MinPasswordLengthAttribute : ValidationAttribute
|
||||||
{
|
{
|
||||||
int MinLength { get; }
|
private int MinLength { get; }
|
||||||
|
|
||||||
public MinPasswordLengthAttribute(int minLength, string errorMsg) : base(errorMsg)
|
public MinPasswordLengthAttribute(int minLength, string errorMsg) : base(errorMsg)
|
||||||
{
|
{
|
||||||
MinLength = minLength;
|
MinLength = minLength;
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,19 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Services.Loggers;
|
using AyCode.Services.Loggers;
|
||||||
|
using TIAM.Core.Loggers;
|
||||||
using TIAMSharedUI.Resources;
|
using TIAMSharedUI.Resources;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
|
using TIAMSharedUI.Pages.Components;
|
||||||
|
|
||||||
namespace TIAMSharedUI.Shared.Components
|
namespace TIAMSharedUI.Shared.Components
|
||||||
{
|
{
|
||||||
public partial class Navbar : ComponentBase
|
public partial class Navbar : ComponentBase
|
||||||
{
|
{
|
||||||
|
[Inject]
|
||||||
|
public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public ISecureStorageHandler SecureStorageHandler { get; set; }
|
public ISecureStorageHandler SecureStorageHandler { get; set; }
|
||||||
|
|
||||||
|
|
@ -30,19 +35,19 @@ namespace TIAMSharedUI.Shared.Components
|
||||||
[Inject]
|
[Inject]
|
||||||
public IComponentUpdateService componentUpdateService { get; set; }
|
public IComponentUpdateService componentUpdateService { get; set; }
|
||||||
|
|
||||||
[Inject]
|
|
||||||
public IAcLogWriterClientBase BrowserConsoleLogWriter { get; set; }
|
|
||||||
|
|
||||||
private bool collapseNavMenu = true;
|
private bool collapseNavMenu = true;
|
||||||
private bool myUser = false;
|
private bool myUser = false;
|
||||||
private bool hasProperty = false;
|
private bool hasProperty = false;
|
||||||
|
|
||||||
|
private ILogger _logger;
|
||||||
|
|
||||||
//componentUpdateService.RefreshRequested += RefreshMe;
|
//componentUpdateService.RefreshRequested += RefreshMe;
|
||||||
|
|
||||||
|
|
||||||
private void RefreshMe()
|
private void RefreshMe()
|
||||||
{
|
{
|
||||||
BrowserConsoleLogWriter.Info($"Navbar refresh called! {DateTime.Now} ");
|
_logger.Info($"Navbar refresh called! {DateTime.Now} ");
|
||||||
|
|
||||||
OnInitialized();
|
OnInitialized();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
@ -67,36 +72,33 @@ namespace TIAMSharedUI.Shared.Components
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
||||||
|
_logger = new LoggerClient<Navbar>(LogWriters.ToArray());
|
||||||
|
|
||||||
componentUpdateService.RefreshRequested += RefreshMe;
|
componentUpdateService.RefreshRequested += RefreshMe;
|
||||||
BrowserConsoleLogWriter.Info($"Navbar OnInit {DateTime.Now} ");
|
_logger.Info($"Navbar OnInit {DateTime.Now} ");
|
||||||
|
|
||||||
if (sessionService.User != null)
|
if (sessionService.User != null)
|
||||||
{
|
{
|
||||||
myUser = true;
|
myUser = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BrowserConsoleLogWriter.Info($"Navbar myUser false! {DateTime.Now} ");
|
_logger.Info($"Navbar myUser false! {DateTime.Now} ");
|
||||||
myUser = false;
|
myUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var _properties = sessionService.User?.HasProperties;
|
var properties = sessionService.User?.HasProperties;
|
||||||
|
|
||||||
if (sessionService.User?.HasProperties != null)
|
if (properties == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hasProperty = properties.Count > 0;
|
||||||
|
|
||||||
|
foreach (var property in properties)
|
||||||
{
|
{
|
||||||
if(_properties.Count > 0)
|
_logger.Detail($"First property: {property.Value} ");
|
||||||
{
|
|
||||||
hasProperty = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hasProperty = false;
|
|
||||||
}
|
|
||||||
foreach (var property in _properties)
|
|
||||||
{
|
|
||||||
BrowserConsoleLogWriter.Info($"First property: {property.Value} ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
@using System.Linq.Expressions
|
@using System.Linq.Expressions
|
||||||
@using AyCode.Core.Loggers
|
@using AyCode.Core.Loggers
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
@using TIAM.Entities.Transfers
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAMSharedUI.Pages
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@inject IAcLogWriterClientBase BrowserConsoleLogWriter
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.underlineInput{
|
.underlineInput{
|
||||||
|
|
@ -45,7 +47,7 @@
|
||||||
<div class="item-desc text-center pt-3">
|
<div class="item-desc text-center pt-3">
|
||||||
|
|
||||||
<div class="align-content-center my-3">
|
<div class="align-content-center my-3">
|
||||||
<DxTextBox @ref="textField"
|
<DxTextBox @ref="TextField"
|
||||||
@bind-Text="@Content"
|
@bind-Text="@Content"
|
||||||
BindValueMode="BindValueMode.OnDelayedInput"
|
BindValueMode="BindValueMode.OnDelayedInput"
|
||||||
InputDelay="@InputDelay"
|
InputDelay="@InputDelay"
|
||||||
|
|
@ -201,13 +203,13 @@
|
||||||
|
|
||||||
public int SliderElementId = 0;
|
public int SliderElementId = 0;
|
||||||
|
|
||||||
private string content = "";
|
private string _content = "";
|
||||||
|
|
||||||
string Content
|
string Content
|
||||||
{
|
{
|
||||||
get { return content; }
|
get { return _content; }
|
||||||
set {
|
set {
|
||||||
content = value;
|
_content = value;
|
||||||
OnTextChanged(value);
|
OnTextChanged(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -226,13 +228,15 @@
|
||||||
|
|
||||||
public List<TransferDestination> Destinations = new List<TransferDestination>();
|
public List<TransferDestination> Destinations = new List<TransferDestination>();
|
||||||
|
|
||||||
public DxTextBox textField;
|
public DxTextBox TextField;
|
||||||
|
|
||||||
TransferDestination Result;
|
TransferDestination Result;
|
||||||
|
|
||||||
|
ILogger _logger;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
BrowserConsoleLogWriter.Info($"SliderItemSelector is initialized with OwlId: {OwlId}");
|
_logger.Info($"SliderItemSelector is initialized with OwlId: {OwlId}");
|
||||||
|
|
||||||
base.OnParametersSet();
|
base.OnParametersSet();
|
||||||
}
|
}
|
||||||
|
|
@ -254,7 +258,8 @@
|
||||||
[JSInvokable]
|
[JSInvokable]
|
||||||
public void ShowCoordinates(string coordinates, string itemId)
|
public void ShowCoordinates(string coordinates, string itemId)
|
||||||
{
|
{
|
||||||
BrowserConsoleLogWriter.Info($"Slider is changing: {coordinates}, {itemId}");
|
_logger.Info($"Slider is changing: {coordinates}, {itemId}");
|
||||||
|
|
||||||
//content = coordinates + "item = " + itemId;
|
//content = coordinates + "item = " + itemId;
|
||||||
SliderElementId = Convert.ToInt32(itemId);
|
SliderElementId = Convert.ToInt32(itemId);
|
||||||
|
|
||||||
|
|
@ -279,13 +284,13 @@
|
||||||
|
|
||||||
public void OnTextChanged(string text)
|
public void OnTextChanged(string text)
|
||||||
{
|
{
|
||||||
BrowserConsoleLogWriter.Info($"Slider text changed: {text}");
|
_logger.Info($"Slider text changed: {text}");
|
||||||
OnSliderChanged.InvokeAsync(text);
|
OnSliderChanged.InvokeAsync(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAddressFromSelectedSliderItem(int SliderListIndex)
|
public string GetAddressFromSelectedSliderItem(int sliderListIndex)
|
||||||
{
|
{
|
||||||
if(Destinations.Count >0 && Destinations.Count >= SliderListIndex)
|
if(Destinations.Count >0 && Destinations.Count >= sliderListIndex)
|
||||||
{
|
{
|
||||||
return Destinations[SliderElementId-1].AddressString;
|
return Destinations[SliderElementId-1].AddressString;
|
||||||
}
|
}
|
||||||
|
|
@ -294,6 +299,8 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
_logger = new LoggerClient<SliderItemSelector>(LogWriters.ToArray());
|
||||||
|
|
||||||
Destinations = await TransferDataService.GetDestinationsAsync();
|
Destinations = await TransferDataService.GetDestinationsAsync();
|
||||||
Content = TextValue;
|
Content = TextValue;
|
||||||
InitOwl();
|
InitOwl();
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,11 @@
|
||||||
using DevExpress.Drawing;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using QRCoder;
|
using QRCoder;
|
||||||
using SkiaSharp;
|
|
||||||
using SkiaSharp.Views.Desktop;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Net;
|
|
||||||
using System.Text.Json;
|
|
||||||
using AyCode.Core.Server.Loggers;
|
using AyCode.Core.Server.Loggers;
|
||||||
using TIAM.Database.DataLayers.Admins;
|
using TIAM.Database.DataLayers.Admins;
|
||||||
//using TIAM.Database.DataLayers.ServiceProviders;
|
//using TIAM.Database.DataLayers.ServiceProviders;
|
||||||
using TIAM.Entities.Permissions;
|
|
||||||
using TIAM.Entities.Products;
|
|
||||||
using TIAM.Entities.ServiceProviders;
|
using TIAM.Entities.ServiceProviders;
|
||||||
using TIAM.Entities.Users;
|
using TIAM.Entities.Users;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
|
|
@ -26,7 +18,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
public class ServiceProviderAPIController : ControllerBase
|
public class ServiceProviderAPIController : ControllerBase
|
||||||
{
|
{
|
||||||
private AdminDal _adminDal;
|
private readonly AdminDal _adminDal;
|
||||||
|
|
||||||
private readonly ILogger<ServiceProviderAPIController> _logger;
|
private readonly ILogger<ServiceProviderAPIController> _logger;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
using System.Text.Json;
|
||||||
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Utils.Extensions;
|
using AyCode.Utils.Extensions;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
@ -5,23 +7,12 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using System.Text.Json;
|
|
||||||
using TIAM.Core.Enums;
|
using TIAM.Core.Enums;
|
||||||
using TIAM.Database.DataLayers;
|
|
||||||
using TIAM.Database.DataLayers.Admins;
|
using TIAM.Database.DataLayers.Admins;
|
||||||
using TIAM.Database.DataLayers.TransferDestinations;
|
|
||||||
using TIAM.Database.DataLayers.Users;
|
|
||||||
using TIAM.Database.DbContexts;
|
|
||||||
using TIAM.Database.DbSets.Transfers;
|
|
||||||
using TIAM.Entities.Products;
|
|
||||||
using TIAM.Entities.Transfers;
|
using TIAM.Entities.Transfers;
|
||||||
using TIAM.Entities.Users;
|
|
||||||
using TIAM.Services.Server;
|
using TIAM.Services.Server;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
using TIAMWebApp.Shared.Application.Services;
|
||||||
using TIAMWebApp.Shared.Application.Models.PageModels;
|
|
||||||
|
|
||||||
namespace TIAMWebApp.Server.Controllers
|
namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -42,17 +33,16 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
|
|
||||||
//};
|
//};
|
||||||
|
|
||||||
private readonly TransferDestinationDal _transferDestinationDal;
|
|
||||||
private readonly AdminDal _adminDal;
|
private readonly AdminDal _adminDal;
|
||||||
private readonly ILogger<TransferDataAPIController> _logger;
|
private readonly TIAM.Core.Loggers.ILogger _logger;
|
||||||
private readonly TransferBackendService _transferBackendService;
|
private readonly TransferBackendService _transferBackendService;
|
||||||
|
|
||||||
public TransferDataAPIController(ILogger<TransferDataAPIController> logger, TransferDestinationDal transferDestinationDal, AdminDal adminDal, TransferBackendService transferBackendService)
|
public TransferDataAPIController(AdminDal adminDal, TransferBackendService transferBackendService, IEnumerable<IAcLogWriterBase> logWriters)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
|
||||||
_transferDestinationDal = transferDestinationDal;
|
|
||||||
_adminDal = adminDal;
|
_adminDal = adminDal;
|
||||||
_transferBackendService = transferBackendService;
|
_transferBackendService = transferBackendService;
|
||||||
|
|
||||||
|
_logger = new TIAM.Core.Loggers.Logger<TransferDataAPIController>(logWriters.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -86,7 +76,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.CreateTransferDestinationRouteName)]
|
[Route(APIUrls.CreateTransferDestinationRouteName)]
|
||||||
public async Task<IActionResult> CreateTransferDestination([FromBody] JsonElement serializedTransferDestinationModel)
|
public async Task<IActionResult> CreateTransferDestination([FromBody] JsonElement serializedTransferDestinationModel)
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"CreateTransferDestination called!");
|
_logger.Info(@"CreateTransferDestination called!");
|
||||||
if (string.IsNullOrEmpty(serializedTransferDestinationModel.GetRawText()))
|
if (string.IsNullOrEmpty(serializedTransferDestinationModel.GetRawText()))
|
||||||
{
|
{
|
||||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||||
|
|
@ -108,16 +98,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($@"TransferDestination to be created: {id}");
|
_logger.Debug(transferDestination.ToString());
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.AddressId}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.Name}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.Price}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.Price2}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.Price3}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.ExtraPrice}");
|
|
||||||
//Console.WriteLine($"TransferDestination to be created: {transferDestination.ExtraPriceType}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.AddressString}");
|
|
||||||
Console.WriteLine($@"TransferDestination to be created: {transferDestination.Description}");
|
|
||||||
|
|
||||||
//await _transferDestinationDal.Context.TransferDestinations.AddAsync(transferDestination);
|
//await _transferDestinationDal.Context.TransferDestinations.AddAsync(transferDestination);
|
||||||
await _adminDal.AddTransferDestinationAsync(transferDestination);
|
await _adminDal.AddTransferDestinationAsync(transferDestination);
|
||||||
|
|
@ -140,18 +121,18 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.UpdateTransferDestinationRouteName)]
|
[Route(APIUrls.UpdateTransferDestinationRouteName)]
|
||||||
public async Task<IActionResult> UpdateTransferDestination([FromBody]JsonElement serializedTransferDestination)
|
public async Task<IActionResult> UpdateTransferDestination([FromBody]JsonElement serializedTransferDestination)
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"UpdateTransferDestination called!");
|
_logger.Info(@"UpdateTransferDestination called!");
|
||||||
if (string.IsNullOrEmpty(serializedTransferDestination.GetRawText()))
|
if (string.IsNullOrEmpty(serializedTransferDestination.GetRawText()))
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"Bad request!");
|
_logger.Error(@"Bad request!");
|
||||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"Serialized model not empty!");
|
_logger.Info(@"Serialized model not empty!");
|
||||||
TransferDestination? transferDestination = JObject.Parse(serializedTransferDestination.GetRawText()).ToObject<TransferDestination>();
|
TransferDestination? transferDestination = JObject.Parse(serializedTransferDestination.GetRawText()).ToObject<TransferDestination>();
|
||||||
Console.WriteLine($@"TransferDestination to be updated: {serializedTransferDestination.GetRawText()}");
|
_logger.Info($@"TransferDestination to be updated: {serializedTransferDestination.GetRawText()}");
|
||||||
Console.WriteLine($@"TransferDestination to be updated: {transferDestination.AddressString}");
|
_logger.Info($@"TransferDestination to be updated: {transferDestination.AddressString}");
|
||||||
|
|
||||||
|
|
||||||
if (transferDestination != null)
|
if (transferDestination != null)
|
||||||
|
|
@ -162,7 +143,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
|
|
||||||
if (transferDestination.Id == Guid.Empty || string.IsNullOrEmpty(transferDestination.Name) || string.IsNullOrEmpty(transferDestination.AddressString))
|
if (transferDestination.Id == Guid.Empty || string.IsNullOrEmpty(transferDestination.Name) || string.IsNullOrEmpty(transferDestination.AddressString))
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"Serialized model not empty, but bad request!");
|
_logger.Error(@"Serialized model not empty, but bad request!");
|
||||||
return BadRequest("Invalid request");
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -178,7 +159,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
Console.WriteLine($@"TransferDestination to be updated new description: {transferDestination.Description}");
|
Console.WriteLine($@"TransferDestination to be updated new description: {transferDestination.Description}");
|
||||||
|
|
||||||
//var dbTransferDestinationJson = _adminDal.GetTransferDestinationJsonById(transferDestination.Id);
|
//var dbTransferDestinationJson = _adminDal.GetTransferDestinationJsonById(transferDestination.Id);
|
||||||
//Console.WriteLine($"TransferDestination JSON to be updated: {dbTransferDestinationJson}");
|
//_logger.Info($"TransferDestination JSON to be updated: {dbTransferDestinationJson}");
|
||||||
|
|
||||||
//var dbTransferDestination = JObject.Parse(dbTransferDestinationJson).ToObject<TransferDestination>();
|
//var dbTransferDestination = JObject.Parse(dbTransferDestinationJson).ToObject<TransferDestination>();
|
||||||
|
|
||||||
|
|
@ -216,7 +197,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.CreateTransferRouteName)]
|
[Route(APIUrls.CreateTransferRouteName)]
|
||||||
public async Task<IActionResult> CreateTransfer([FromBody] JsonElement serializedTransferModel)
|
public async Task<IActionResult> CreateTransfer([FromBody] JsonElement serializedTransferModel)
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"CreateTransfer called!");
|
_logger.Info(@"CreateTransfer called!");
|
||||||
if (string.IsNullOrEmpty(serializedTransferModel.GetRawText()))
|
if (string.IsNullOrEmpty(serializedTransferModel.GetRawText()))
|
||||||
{
|
{
|
||||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||||
|
|
@ -273,14 +254,14 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.CreateTransfersRouteName)]
|
[Route(APIUrls.CreateTransfersRouteName)]
|
||||||
public async Task<IActionResult> CreateTransfers([FromBody] JsonElement serializedTransferModel)
|
public async Task<IActionResult> CreateTransfers([FromBody] JsonElement serializedTransferModel)
|
||||||
{
|
{
|
||||||
Console.WriteLine(@"CreateTransfers called!");
|
_logger.Info(@"CreateTransfers called!");
|
||||||
if (string.IsNullOrEmpty(serializedTransferModel.GetRawText()))
|
if (string.IsNullOrEmpty(serializedTransferModel.GetRawText()))
|
||||||
{
|
{
|
||||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($@"Serialized model: {serializedTransferModel.GetRawText()}");
|
_logger.Info($@"Serialized model: {serializedTransferModel.GetRawText()}");
|
||||||
|
|
||||||
var settings = new JsonSerializerSettings
|
var settings = new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
|
|
@ -327,7 +308,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.UpdateTransferRouteName)]
|
[Route(APIUrls.UpdateTransferRouteName)]
|
||||||
public async Task<bool> UpdateTransfer(Transfer transferToModify)
|
public async Task<bool> UpdateTransfer(Transfer transferToModify)
|
||||||
{
|
{
|
||||||
Console.WriteLine("UpdateTransfer called!");
|
_logger.Info("UpdateTransfer called!");
|
||||||
return await _adminDal.UpdateTransferAsync(transferToModify);
|
return await _adminDal.UpdateTransferAsync(transferToModify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Transfers;
|
using TIAM.Entities.Transfers;
|
||||||
using TIAM.Resources;
|
using TIAM.Resources;
|
||||||
|
|
||||||
|
|
@ -136,8 +137,13 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
return FirstName + " " + LastName;
|
return FirstName + " " + LastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{nameof(Id)}: {Id}; {nameof(Destination)}: {Destination}; {nameof(PickupAddress)}: {PickupAddress}; {nameof(TripDate)}: {TripDate}; {nameof(NumberOfPassengers)}: {NumberOfPassengers}; " +
|
||||||
|
$"{nameof(FirstName)}: {FirstName}; {nameof(LastName)}: {LastName}; {nameof(PhoneNumber)}: {PhoneNumber}; {nameof(EmailAddress)}: {EmailAddress};";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
|
||||||
public class DestinationAttribute : ValidationAttribute
|
public class DestinationAttribute : ValidationAttribute
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
|
using AyCode.Services.Loggers;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using AyCode.Services.Loggers;
|
using TIAM.Core.Loggers;
|
||||||
using TIAM.Entities.Transfers;
|
using TIAM.Entities.Transfers;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
|
|
@ -13,13 +14,13 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
{
|
{
|
||||||
public class TransferDataService : ITransferDataService
|
public class TransferDataService : ITransferDataService
|
||||||
{
|
{
|
||||||
private readonly HttpClient http;
|
private readonly HttpClient _http;
|
||||||
private readonly IAcLogWriterClientBase _browserConsoleLogWriter;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public TransferDataService(HttpClient http, IAcLogWriterClientBase browserConsoleLogWriter)
|
public TransferDataService(HttpClient http, IEnumerable<IAcLogWriterClientBase> logWriters)
|
||||||
{
|
{
|
||||||
this.http = http;
|
_http = http;
|
||||||
this._browserConsoleLogWriter = browserConsoleLogWriter;
|
_logger = new LoggerClient<TransferDataService>(logWriters.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,8 +29,8 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
|
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinations}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinations}";
|
||||||
//var url = $"{APIUrls.GetTransferDestinations}";
|
//var url = $"{APIUrls.GetTransferDestinations}";
|
||||||
_browserConsoleLogWriter.Info(url);
|
_logger.Info(url);
|
||||||
List<TransferDestination>? response = await http.GetFromJsonAsync<List<TransferDestination>>(url);
|
List<TransferDestination>? response = await _http.GetFromJsonAsync<List<TransferDestination>>(url);
|
||||||
if(response == null)
|
if(response == null)
|
||||||
return new List<TransferDestination>();
|
return new List<TransferDestination>();
|
||||||
return response;
|
return response;
|
||||||
|
|
@ -38,19 +39,19 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
public async Task<TransferDestination?> GetTransferDestinationbyCoordinatesAsync(string destinationId)
|
public async Task<TransferDestination?> GetTransferDestinationbyCoordinatesAsync(string destinationId)
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByCoordinates}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByCoordinates}";
|
||||||
return await http.GetFromJsonAsync<TransferDestination>(url);
|
return await _http.GetFromJsonAsync<TransferDestination>(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TransferDestination?> GetTransferDestinationbyAddressAsync(string destinationId)
|
public async Task<TransferDestination?> GetTransferDestinationbyAddressAsync(string destinationId)
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByAddress}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByAddress}";
|
||||||
return await http.GetFromJsonAsync<TransferDestination>(url);
|
return await _http.GetFromJsonAsync<TransferDestination>(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TransferDestination?> CreateTransferDestination(TransferDestination model)
|
public async Task<TransferDestination?> CreateTransferDestination(TransferDestination model)
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransferDestination}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransferDestination}";
|
||||||
var response = await http.PostAsJsonAsync(url, model);
|
var response = await _http.PostAsJsonAsync(url, model);
|
||||||
|
|
||||||
//var result = new WizardProcessorResult();
|
//var result = new WizardProcessorResult();
|
||||||
|
|
||||||
|
|
@ -70,20 +71,16 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
|
|
||||||
public async Task<Transfer?> CreateTransfer(TransferWizardModel model)
|
public async Task<Transfer?> CreateTransfer(TransferWizardModel model)
|
||||||
{
|
{
|
||||||
_browserConsoleLogWriter.Info("CreateTransfer called");
|
_logger.Info("CreateTransfer called");
|
||||||
_browserConsoleLogWriter.Info(model.PickupAddress);
|
|
||||||
_browserConsoleLogWriter.Info(model.Destination);
|
|
||||||
_browserConsoleLogWriter.Info(model.EmailAddress);
|
|
||||||
_browserConsoleLogWriter.Info(model.PhoneNumber);
|
|
||||||
_browserConsoleLogWriter.Info(model.TripDate.ToString());
|
|
||||||
_browserConsoleLogWriter.Info(model.NumberOfPassengers.ToString());
|
|
||||||
model.Id = Guid.NewGuid();
|
model.Id = Guid.NewGuid();
|
||||||
|
_logger.Debug(model.ToString());
|
||||||
|
|
||||||
var transfer = model.CopyToTransfer();
|
var transfer = model.CopyToTransfer();
|
||||||
|
|
||||||
|
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransfer}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransfer}";
|
||||||
var response = await http.PostAsJsonAsync(url, transfer);
|
var response = await _http.PostAsJsonAsync(url, transfer);
|
||||||
|
|
||||||
|
|
||||||
//var result = new WizardProcessorResult();
|
//var result = new WizardProcessorResult();
|
||||||
|
|
@ -113,7 +110,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransfers}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransfers}";
|
||||||
var response = await http.PostAsJsonAsync(url, transferList);
|
var response = await _http.PostAsJsonAsync(url, transferList);
|
||||||
|
|
||||||
|
|
||||||
//var result = new WizardProcessorResult();
|
//var result = new WizardProcessorResult();
|
||||||
|
|
@ -135,7 +132,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
public async Task<TransferDestination?> UpdateTransferDestination(TransferDestination model)
|
public async Task<TransferDestination?> UpdateTransferDestination(TransferDestination model)
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransferDestination}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransferDestination}";
|
||||||
var response = await http.PostAsJsonAsync(url, model);
|
var response = await _http.PostAsJsonAsync(url, model);
|
||||||
|
|
||||||
//var result = new WizardProcessorResult();
|
//var result = new WizardProcessorResult();
|
||||||
|
|
||||||
|
|
@ -157,8 +154,8 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferById}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferById}";
|
||||||
//var url = $"{APIUrls.GetTransferDestinations}";
|
//var url = $"{APIUrls.GetTransferDestinations}";
|
||||||
_browserConsoleLogWriter.Info(url);
|
_logger.Info(url);
|
||||||
Transfer? response = await http.GetFromJsonAsync<Transfer>(url);
|
Transfer? response = await _http.GetFromJsonAsync<Transfer>(url);
|
||||||
if (response == null)
|
if (response == null)
|
||||||
return new Transfer();
|
return new Transfer();
|
||||||
return response;
|
return response;
|
||||||
|
|
@ -168,14 +165,14 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransfers}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransfers}";
|
||||||
//var url = $"{APIUrls.GetTransferDestinations}";
|
//var url = $"{APIUrls.GetTransferDestinations}";
|
||||||
_browserConsoleLogWriter.Info(url);
|
_logger.Info(url);
|
||||||
//add json settings ignore readonly properties
|
//add json settings ignore readonly properties
|
||||||
JsonSerializerOptions options = new JsonSerializerOptions
|
JsonSerializerOptions options = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
IgnoreReadOnlyProperties = true
|
IgnoreReadOnlyProperties = true
|
||||||
};
|
};
|
||||||
|
|
||||||
List<Transfer>? response = await http.GetFromJsonAsync<List<Transfer>>(url, options);
|
List<Transfer>? response = await _http.GetFromJsonAsync<List<Transfer>>(url, options);
|
||||||
if (response == null)
|
if (response == null)
|
||||||
return new List<Transfer>();
|
return new List<Transfer>();
|
||||||
return response;
|
return response;
|
||||||
|
|
@ -184,7 +181,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
public async Task<bool> UpdateTransferAsync(Transfer model)
|
public async Task<bool> UpdateTransferAsync(Transfer model)
|
||||||
{
|
{
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransfer}";
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransfer}";
|
||||||
var response = await http.PostAsJsonAsync(url, model);
|
var response = await _http.PostAsJsonAsync(url, model);
|
||||||
|
|
||||||
//var result = new WizardProcessorResult();
|
//var result = new WizardProcessorResult();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,6 @@ namespace TIAMWebApp.Shared.Application.Utility;
|
||||||
|
|
||||||
public class HttpClientLogItemWriter : AcHttpClientLogItemWriter<AcLogItemClient>
|
public class HttpClientLogItemWriter : AcHttpClientLogItemWriter<AcLogItemClient>
|
||||||
{
|
{
|
||||||
public HttpClientLogItemWriter(HttpClient httpClient) : base(httpClient)
|
public HttpClientLogItemWriter(HttpClient httpClient) : base(httpClient, $"{Setting.ApiBaseUrl}/{APIUrls.Logger}")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
protected override void WriteLogItemCallback(AcLogItemClient logItem)
|
|
||||||
{
|
|
||||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.Logger}";
|
|
||||||
|
|
||||||
//logItem.ThreadId = Environment.CurrentManagedThreadId;
|
|
||||||
_httpClient.PostAsJsonAsync(url, logItem).Forget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue