yavsc/Yavsc/Models/Messaging/EstimationEvent.cs

51 lines
1.4 KiB
C#
Raw Normal View History

using System.Linq;
2017-02-22 22:58:02 +01:00
using Microsoft.Data.Entity;
using Microsoft.Extensions.Localization;
namespace Yavsc.Models.Messaging
{
2017-02-22 22:58:02 +01:00
using Interfaces.Workflow;
using Billing;
using Yavsc.Helpers;
public class EstimationEvent: IEvent
{
public EstimationEvent(ApplicationDbContext context, Estimate estimate, IStringLocalizer SR)
{
2017-02-22 22:58:02 +01:00
Topic = "Estimation";
Estimation = estimate;
2017-02-22 22:58:02 +01:00
var perfer = context.Performers.Include(
p=>p.Performer
).FirstOrDefault(
p => p.PerformerId == estimate.OwnerId
);
// Use estimate.OwnerId;
ProviderInfo = new ProviderClientInfo {
Rate = perfer.Rate,
UserName = perfer.Performer.UserName,
Avatar = perfer.Performer.Avatar,
UserId = perfer.PerformerId
};
2017-03-02 23:47:44 +01:00
Sender = perfer.Performer.UserName;
Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
estimate.Title,estimate.GetTotal());
}
ProviderClientInfo ProviderInfo { get; set; }
Estimate Estimation { get; set; }
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;
}
2017-02-22 22:58:02 +01:00
public string Message
{
2017-02-22 22:58:02 +01:00
get; set;
}
}
}