yavsc/src/Yavsc.Server/Models/Messaging/EstimationEvent.cs

53 lines
1.5 KiB
C#
Raw Normal View History

using Microsoft.Extensions.Localization;
namespace Yavsc.Models.Messaging
{
2017-02-22 22:58:02 +01:00
using Interfaces.Workflow;
using Billing;
using Yavsc.Helpers;
2018-02-03 20:17:29 +01:00
using Yavsc.Models.Workflow;
2017-02-22 22:58:02 +01:00
public class EstimationEvent: IEvent
{
public EstimationEvent( Estimate estimate, IStringLocalizer SR)
{
2017-02-22 22:58:02 +01:00
Topic = "Estimation";
Estimation = estimate;
2026-09-04 14:53:00 +01:00
performer = estimate.Owner;
ProviderInfo = new ProviderClientInfo {
2026-09-04 14:53:00 +01:00
Rate = performer.Rate,
UserName = performer.Performer.UserName,
Avatar = performer.Performer.Avatar,
UserId = performer.PerformerId
};
2026-09-04 14:53:00 +01:00
Sender = performer.Performer.UserName;
2018-02-03 20:17:29 +01:00
_localizer = SR;
}
2020-09-12 01:11:30 +01:00
// TODO via e-mail only: Message = string.Format(
// SR["EstimationMessageToClient"],perfer.Performer.UserName, estimate.Title,estimate.Bill.Addition());
ProviderClientInfo ProviderInfo { get; set; }
Estimate Estimation { get; set; }
2026-09-04 14:53:00 +01:00
private readonly PerformerProfile performer;
2018-02-03 20:17:29 +01:00
2017-02-22 22:58:02 +01:00
public string Topic
{
2017-02-22 22:58:02 +01:00
get; set;
}
2017-02-22 22:58:02 +01:00
public string Sender
{
2017-02-22 22:58:02 +01:00
get; set;
}
2018-02-03 20:17:29 +01:00
private IStringLocalizer _localizer;
public string CreateBody()
{
2026-09-04 14:53:00 +01:00
return string.Format(_localizer["EstimationMessageToClient"], performer.Performer.UserName, this.Estimation.Bill.Addition());
}
}
2017-06-02 10:13:55 +02:00
}