Initial Commit
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MarketData.DataAccess;
|
||||
using MarketData.Generator.Interface;
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.Utils;
|
||||
using PortfolioManager.ViewModels;
|
||||
|
||||
namespace PortfolioManager.Dialogs
|
||||
{
|
||||
public partial class EditPositionDialogNoStopViewModel : DialogViewModelBase
|
||||
{
|
||||
private IPurePosition sourcePosition;
|
||||
|
||||
public EditPositionDialogNoStopViewModel(Window dialogWindow, IPurePosition clonedPosition)
|
||||
: base(dialogWindow)
|
||||
{
|
||||
sourcePosition = clonedPosition;
|
||||
DisplayName = "Edit Position";
|
||||
}
|
||||
|
||||
public String Symbol
|
||||
{
|
||||
get { return sourcePosition.Symbol; }
|
||||
}
|
||||
|
||||
public String CompanyName
|
||||
{
|
||||
get
|
||||
{
|
||||
CompanyProfile companyProfile = CompanyProfileDA.GetCompanyProfile(sourcePosition.Symbol);
|
||||
return companyProfile.CompanyName;
|
||||
}
|
||||
}
|
||||
|
||||
public String PurchaseDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return sourcePosition.PurchaseDate.ToShortDateString();
|
||||
}
|
||||
}
|
||||
|
||||
public String PurchasePrice
|
||||
{
|
||||
get
|
||||
{
|
||||
return Utility.FormatCurrency(sourcePosition.PurchasePrice);
|
||||
}
|
||||
set
|
||||
{
|
||||
sourcePosition.PurchasePrice = Utility.ParseCurrency(value);
|
||||
base.OnPropertyChanged("PurchasePrice");
|
||||
}
|
||||
}
|
||||
|
||||
public IPurePosition GetResult()
|
||||
{
|
||||
return sourcePosition;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task OkButtonClick()
|
||||
{
|
||||
IsSuccess = true;
|
||||
await Close();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task CancelButtonClick()
|
||||
{
|
||||
await Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user