estimate to client

This commit is contained in:
Paul Schneider 2016-12-11 14:45:51 +01:00
commit 3acb5bc922
13 changed files with 127 additions and 40 deletions

View file

@ -12,8 +12,8 @@ using Yavsc.Models.OAuth;
using Yavsc.Models.Workflow;
using Yavsc.Models.Identity;
using Yavsc.Models.Market;
using Yavsc.Model;
using Yavsc.Model.Chat;
using Yavsc.Models.Messaging;
namespace Yavsc.Models
{

View file

@ -2,6 +2,7 @@ using System;
namespace Yavsc.Model
{
using Models.Messaging;
public class BookQueryProviderInfo
{
@ -15,4 +16,5 @@ namespace Yavsc.Model
public string Reason { get; set; }
}
}

View file

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model
namespace Yavsc.Models.Messaging
{
public class ClientProviderInfo
{
@ -8,10 +8,8 @@ namespace Yavsc.Model
public string Avatar { get; set; }
[Key]
public string UserId { get; set; }
public int Rate { get; set; }
public string EMail { get; set; }
public string Phone { get; set; }
public Location BillingAddress { get; set; }
public string ChatHubConnectionId { get; set; }
}
}

View file

@ -0,0 +1,54 @@
using System.Linq;
using Microsoft.Extensions.Localization;
using Yavsc.Helpers;
using Yavsc.Models.Billing;
namespace Yavsc.Models.Messaging
{
public class EstimationEvent: IEvent
{
public EstimationEvent(ApplicationDbContext context, Estimate estimate, IStringLocalizer SR)
{
Estimation = estimate;
var perfer = context.Performers.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
};
((IEvent)this).Sender = perfer.Performer.UserName;
((IEvent)this).Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
estimate.Title,estimate.GetTotal());
}
ProviderClientInfo ProviderInfo { get; set; }
Estimate Estimation { get; set; }
private string subtopic = null;
string IEvent.Topic
{
get
{
return "/topic/estimate"+subtopic!=null?"/"+subtopic:"";
}
set
{
subtopic = value;
}
}
string IEvent.Sender
{
get; set;
}
string IEvent.Message
{
get; set;
}
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Models.Messaging
{
public class ProviderClientInfo : ClientProviderInfo
{
public int Rate { get; set; }
}
}