Merge branch 'master' of http://git2.aycode.com/Adam/TourIAm
This commit is contained in:
commit
9d11b8756c
|
|
@ -378,7 +378,8 @@ namespace TIAM.Database.Test
|
|||
ToAddress = toAddress,
|
||||
PassengerCount = 3,
|
||||
Price = 20000,
|
||||
ContactName = "xyztest",
|
||||
FirstName = "xyzFirstName_Test",
|
||||
LastName = "xyzLastName_Test",
|
||||
ContactEmail = "xyztest@gmail.hu",
|
||||
ContactPhone = "+3671542771",
|
||||
TransferStatusType = TransferStatusType.OrderConfirmed,
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
public Task<bool> AddUser(User user) => TransactionAsync(ctx => ctx.AddUser(user));
|
||||
|
||||
public Task<bool> AddUser(User user, string profileName, Address address)
|
||||
public Task<bool> AddUser(User user, string profileName, Address address, string? firstName = null, string? lastName = null)
|
||||
{
|
||||
return TransactionAsync(ctx =>
|
||||
{
|
||||
|
|
@ -111,6 +111,8 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
profile.Id = Guid.NewGuid();
|
||||
profile.Name = profileName;
|
||||
profile.FirstName = firstName;
|
||||
profile.LastName = lastName;
|
||||
profile.Address = address;
|
||||
|
||||
user.Profile= profile;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
namespace TIAM.Entities.Transfers;
|
||||
using TIAM.Core.Enums;
|
||||
|
||||
namespace TIAM.Entities.Transfers;
|
||||
|
||||
public interface ITransfeDestinationPrices
|
||||
{
|
||||
|
|
@ -8,9 +10,10 @@ public interface ITransfeDestinationPrices
|
|||
public double? Price3 { get; set; }
|
||||
|
||||
public double ProductCommis { get; set; }
|
||||
public double? ExtraPrice { get; set; }
|
||||
|
||||
//public double? ExtraPrice { get; set; }
|
||||
/// <summary>
|
||||
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
|
||||
/// </summary>
|
||||
public bool? ExtraPriceType { get; set; }
|
||||
//public TransferExtraPriceType ExtraPriceType { get; set; }
|
||||
}
|
||||
|
|
@ -3,14 +3,16 @@ using AyCode.Interfaces.TimeStampInfo;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Dynamic;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using TIAM.Core.Enums;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.Profiles;
|
||||
using TIAM.Entities.Users;
|
||||
|
||||
namespace TIAM.Entities.Transfers;
|
||||
|
||||
[Table(nameof(Transfer))]
|
||||
public class Transfer: IEntityGuid, ITimeStampInfo, IProductForeignKey<Guid?>, IUserForeignKey
|
||||
public class Transfer: IEntityGuid, IAcFullName, ITimeStampInfo, IProductForeignKey<Guid?>, IUserForeignKey
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public Guid Id { get; set; }
|
||||
|
|
@ -33,12 +35,16 @@ public class Transfer: IEntityGuid, ITimeStampInfo, IProductForeignKey<Guid?>, I
|
|||
public bool Payed { get; set; }
|
||||
public double? Price { get; set; }
|
||||
public byte PassengerCount { get; set; }
|
||||
|
||||
public byte LuggageCount { get; set; }
|
||||
|
||||
[MaxLength(50)] public string? FlightNumber { get; set; }
|
||||
[MaxLength(200)] public string FromAddress { get; set; }
|
||||
[MaxLength(200)] public string? ToAddress { get; set; }
|
||||
|
||||
public string ContactName {get;set; }
|
||||
public string? FullName => Profile.GetFullName(FirstName, LastName);
|
||||
[Column("ContactFirstName")]public string? FirstName { get; set; }
|
||||
[Column("ContactLastName")]public string? LastName { get; set; }
|
||||
|
||||
public string ContactEmail {get;set; }
|
||||
public string ContactPhone {get;set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ namespace TIAM.Entities.Transfers
|
|||
public double? Price3 { get; set; }
|
||||
|
||||
public double ProductCommis { get;set; }
|
||||
public double? ExtraPrice { get; set; }
|
||||
/// <summary>
|
||||
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
|
||||
/// </summary>
|
||||
public bool? ExtraPriceType { get; set; }
|
||||
public double ExtraPrice { get; set; }
|
||||
///// <summary>
|
||||
///// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
|
||||
///// </summary>
|
||||
//public TransferExtraPriceType ExtraPriceType { get; set; }
|
||||
|
||||
//TEMPORARY!!!
|
||||
public string? AddressString { get; set; }
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@ namespace TIAM.Entities.Transfers
|
|||
public double? Price3 { get; set; }
|
||||
|
||||
public double ProductCommis { get;set; }
|
||||
public double? ExtraPrice { get; set; }
|
||||
/// <summary>
|
||||
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
|
||||
/// </summary>
|
||||
public bool? ExtraPriceType { get; set; }
|
||||
|
||||
//public double? ExtraPrice { get; set; }
|
||||
///// <summary>
|
||||
///// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
|
||||
///// </summary>
|
||||
//public TransferExtraPriceType ExtraPriceType { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
|
|
|||
|
|
@ -2,13 +2,18 @@
|
|||
|
||||
namespace TIAM.Models.Dtos.Profiles;
|
||||
|
||||
public class ProfileDto : IProfileDto
|
||||
public class ProfileDto : IProfileDto //TODO: AcProfileDtoBase - J.
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid? UserMediaId { get; set; }
|
||||
public Guid AddressId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string? FullName => Profile.GetFullName(FirstName, LastName);
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
//public string NickName { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? ThumbnailUrl { get; set; }
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
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.ExtraPriceType}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressString}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Description}");
|
||||
|
||||
|
|
|
|||
|
|
@ -6,16 +6,9 @@ using TIAM.Entities.Transfers;
|
|||
|
||||
namespace TIAMWebApp.Server.Services
|
||||
{
|
||||
public class TransferBackendService
|
||||
public class TransferBackendService(IConfiguration configuration, AdminDal adminDal)
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly AdminDal _adminDal;
|
||||
|
||||
public TransferBackendService(IConfiguration configuration, AdminDal adminDal)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_adminDal = adminDal;
|
||||
}
|
||||
//private readonly IConfiguration _configuration = configuration;
|
||||
|
||||
public double GetTransferPrice(Guid productId, Guid fromTransferDestinationId, Guid toTranferDestinationId, in byte seatNumber)
|
||||
{
|
||||
|
|
@ -24,7 +17,7 @@ namespace TIAMWebApp.Server.Services
|
|||
|
||||
public double GetTransferPrice(Guid productId, TransferDestination fromTransferDestination, TransferDestination toTransferDestination, in byte seatNumber)
|
||||
{
|
||||
var product = _adminDal.GetProductById(productId);
|
||||
var product = adminDal.GetProductById(productId);
|
||||
|
||||
if (product == null) return -1;
|
||||
|
||||
|
|
@ -35,20 +28,23 @@ namespace TIAMWebApp.Server.Services
|
|||
{
|
||||
var baseDestination = product.Profile.AddressId == fromTransferDestination.AddressId ? toTransferDestination : fromTransferDestination;
|
||||
|
||||
var transferDestinationToProduct = _adminDal.GetTransferDestinationToProduct(product.Id, baseDestination.Id);
|
||||
var transferDestinationToProduct = adminDal.GetTransferDestinationToProduct(product.Id, baseDestination.Id);
|
||||
|
||||
var tranferDestinationPrice = transferDestinationToProduct ?? baseDestination as ITransfeDestinationPrices;
|
||||
|
||||
//A ProductCommis nem ugyanaz mint az ExtraPrice?!? - J.
|
||||
var price = GetSeatNumberPrice(in tranferDestinationPrice, seatNumber) + tranferDestinationPrice.ProductCommis;
|
||||
var price = GetSeatNumberPrice(in tranferDestinationPrice, seatNumber) + tranferDestinationPrice.ProductCommis + GetExtraPrice(in fromTransferDestination);
|
||||
|
||||
//TODO: ExtraPrice - J. seatnum percent price, FirstName, LastName, CascadeDelete
|
||||
//if (baseDestination.Id == fromTransferDestination.Id && )
|
||||
return price;
|
||||
}
|
||||
|
||||
public double GetSeatNumberPrice(in ITransfeDestinationPrices transfeDestinationPrices, in byte seatNumber)
|
||||
=> GetSeatNumberPrice(transfeDestinationPrices.Price, transfeDestinationPrices.Price2, transfeDestinationPrices.Price3, seatNumber);
|
||||
public double GetExtraPrice(in TransferDestination fromTransferDestination)
|
||||
{
|
||||
return fromTransferDestination.ExtraPrice > 0 ? fromTransferDestination.ExtraPrice : 0;
|
||||
}
|
||||
|
||||
public double GetSeatNumberPrice(in ITransfeDestinationPrices transferDestinationPrices, in byte seatNumber)
|
||||
=> GetSeatNumberPrice(transferDestinationPrices.Price, transferDestinationPrices.Price2, transferDestinationPrices.Price3, seatNumber);
|
||||
|
||||
public double GetSeatNumberPrice(double price, in double? price2, in double? price3, in byte seatNumber)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue