estimate to client
This commit is contained in:
parent
b7c9e93669
commit
3acb5bc922
13 changed files with 127 additions and 40 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
54
Yavsc/Models/Messaging/EstimationEvent.cs
Normal file
54
Yavsc/Models/Messaging/EstimationEvent.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Yavsc/Models/Messaging/ProviderClientInfo.cs
Normal file
8
Yavsc/Models/Messaging/ProviderClientInfo.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
namespace Yavsc.Models.Messaging
|
||||
{
|
||||
public class ProviderClientInfo : ClientProviderInfo
|
||||
{
|
||||
public int Rate { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue