|
@@ -0,0 +1,80 @@
|
|
1
|
+using System.Linq;
|
|
2
|
+using UnivateProperties_API.Containers.Timeshare;
|
|
3
|
+using UnivateProperties_API.Context;
|
|
4
|
+using UnivateProperties_API.Model.Users;
|
|
5
|
+
|
|
6
|
+namespace UnivateProperties_API.Helpers.Communication
|
|
7
|
+{
|
|
8
|
+ public class EmailCodedFieldsPopulator
|
|
9
|
+ {
|
|
10
|
+ private readonly DataContext _dbContext;
|
|
11
|
+
|
|
12
|
+ public EmailCodedFieldsPopulator(DataContext dataContext)
|
|
13
|
+ {
|
|
14
|
+ _dbContext = dataContext;
|
|
15
|
+ }
|
|
16
|
+ public EmailCodedFieldsPopulator( )
|
|
17
|
+ {
|
|
18
|
+
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ public string getCodedBody(string htmlBody, Person sendTo, TimeshareWeekDto sellItem)
|
|
22
|
+ {
|
|
23
|
+ var agent = _dbContext.Agents.Where(ag => ag.Id == sellItem.AgentId).FirstOrDefault();
|
|
24
|
+ htmlBody = htmlBody.Replace("[ReferedByAgent]", sellItem.ReferedByAgent.ToString());
|
|
25
|
+ htmlBody = htmlBody.Replace("[AgentId]", sellItem.AgentId.ToString());
|
|
26
|
+ htmlBody = htmlBody.Replace("[AgencyId]", sellItem.AgencyId.ToString());
|
|
27
|
+ htmlBody = htmlBody.Replace("[OwnerId]", sellItem.OwnerId.ToString());
|
|
28
|
+ htmlBody = htmlBody.Replace("[AgentAsRep]", sellItem.AgentAsRep.ToString());
|
|
29
|
+ htmlBody = htmlBody.Replace("[OtherResort]", sellItem.OtherResort.ToString());
|
|
30
|
+ htmlBody = htmlBody.Replace("[OtherResortName]", sellItem.OtherResortName != null ? sellItem.OtherResortName.ToString() : "");
|
|
31
|
+ htmlBody = htmlBody.Replace("[ResortCode]", sellItem.ResortCode.ToString());
|
|
32
|
+ htmlBody = htmlBody.Replace("[ResortName]", sellItem.ResortName.ToString());
|
|
33
|
+ htmlBody = htmlBody.Replace("[RegionId]", sellItem.RegionId.ToString());
|
|
34
|
+ htmlBody = htmlBody.Replace("[Season]", sellItem.Season.ToString());
|
|
35
|
+ htmlBody = htmlBody.Replace("[Module]", sellItem.Module.ToString());
|
|
36
|
+ htmlBody = htmlBody.Replace("[Bedrooms]", sellItem.Bedrooms.ToString());
|
|
37
|
+ htmlBody = htmlBody.Replace("[MaxSleep]", sellItem.MaxSleep.ToString());
|
|
38
|
+ htmlBody = htmlBody.Replace("[UnitNumber]", sellItem.UnitNumber.ToString());
|
|
39
|
+ htmlBody = htmlBody.Replace("[WeekNumber]", sellItem.WeekNumber != null ? sellItem.WeekNumber.ToString() : "");
|
|
40
|
+ htmlBody = htmlBody.Replace("[LevyAmount]", sellItem.LevyAmount.ToString());
|
|
41
|
+ htmlBody = htmlBody.Replace("[CurrentYearBanked]", sellItem.CurrentYearBanked.ToString());
|
|
42
|
+ htmlBody = htmlBody.Replace("[BankedWith]", sellItem.BankedWith != null ? sellItem.BankedWith.ToString() : "");
|
|
43
|
+ htmlBody = htmlBody.Replace("[Valid]", sellItem.Valid != null ? sellItem.Valid.ToString() : "");
|
|
44
|
+ htmlBody = htmlBody.Replace("[IsDeleted]", sellItem.IsDeleted.ToString());
|
|
45
|
+ htmlBody = htmlBody.Replace("[Display]", sellItem.Display.ToString());
|
|
46
|
+ htmlBody = htmlBody.Replace("[LeviesPaidInFull]", sellItem.LeviesPaidInFull.ToString());
|
|
47
|
+ htmlBody = htmlBody.Replace("[WeekPlacedForRental]", sellItem.WeekPlacedForRental.ToString());
|
|
48
|
+ htmlBody = htmlBody.Replace("[OriginalPurchaseDate]", sellItem.OriginalPurchaseDate.ToString());
|
|
49
|
+ htmlBody = htmlBody.Replace("[OriginalPurchasePrice]", sellItem.OriginalPurchasePrice.ToString());
|
|
50
|
+ htmlBody = htmlBody.Replace("[ArrivalDate]", sellItem.ArrivalDate.ToString());
|
|
51
|
+ htmlBody = htmlBody.Replace("[DepartureDate]", sellItem.DepartureDate.ToString());
|
|
52
|
+ htmlBody = htmlBody.Replace("[SellPrice]", sellItem.SellPrice.ToString());
|
|
53
|
+ htmlBody = htmlBody.Replace("[AgentCommision]", sellItem.AgentCommision.ToString());
|
|
54
|
+ htmlBody = htmlBody.Replace("[Mandate]", sellItem.Mandate != null ? sellItem.Mandate.ToString() : "");
|
|
55
|
+ htmlBody = htmlBody.Replace("[StatusId]", sellItem.StatusId.ToString());
|
|
56
|
+ htmlBody = htmlBody.Replace("[Status]", sellItem.Status != null ? sellItem.Status.ToString() : "");
|
|
57
|
+ htmlBody = htmlBody.Replace("[Region]", sellItem.Region.ToString());
|
|
58
|
+
|
|
59
|
+ if (agent != null)
|
|
60
|
+ {
|
|
61
|
+ htmlBody = htmlBody.Replace("[Agent]", agent.FullName != null ? agent.FullName.ToString() : "");
|
|
62
|
+ htmlBody = htmlBody.Replace("[Agency]", agent.Agency != null ? agent.Agency.ToString() : "");
|
|
63
|
+ }
|
|
64
|
+ else
|
|
65
|
+ {
|
|
66
|
+ htmlBody = htmlBody.Replace("[Agent]", "");
|
|
67
|
+ htmlBody = htmlBody.Replace("[Agency]", "");
|
|
68
|
+ htmlBody = htmlBody.Replace("[Owner]", sendTo.FullName != null ? sendTo.FullName.ToString() : "");
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ htmlBody = htmlBody.Replace("[BidItems]", sellItem.BidItems != null ? sellItem.BidItems.ToString() : "");
|
|
72
|
+ htmlBody = htmlBody.Replace("[ProcessFlows]", sellItem.ProcessFlows != null ? sellItem.ProcessFlows.ToString() : "");
|
|
73
|
+ htmlBody = htmlBody.Replace("[Id]", sellItem.Id.ToString());
|
|
74
|
+ htmlBody = htmlBody.Replace("[Created]", sellItem.Created.ToString());
|
|
75
|
+ htmlBody = htmlBody.Replace("[Modified]", sellItem.Modified.ToString());
|
|
76
|
+ htmlBody = htmlBody.Replace("[ModifiedBy]", sellItem.ModifiedBy != null ? sellItem.ModifiedBy.ToString() : "");
|
|
77
|
+ return htmlBody;
|
|
78
|
+ }
|
|
79
|
+ }
|
|
80
|
+}
|