Selaa lähdekoodia

Property Reference & Timeshare Sell Email

master
30117125 4 vuotta sitten
vanhempi
commit
24f9ae9f73

+ 1553
- 0
UnivateProperties_API/Migrations/20200903080450_PropertyRefUpdate.Designer.cs
File diff suppressed because it is too large
Näytä tiedosto


+ 22
- 0
UnivateProperties_API/Migrations/20200903080450_PropertyRefUpdate.cs Näytä tiedosto

@@ -0,0 +1,22 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class PropertyRefUpdate : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.AddColumn<string>(
10
+                name: "PropertyRef",
11
+                table: "Properties",
12
+                nullable: true);
13
+        }
14
+
15
+        protected override void Down(MigrationBuilder migrationBuilder)
16
+        {
17
+            migrationBuilder.DropColumn(
18
+                name: "PropertyRef",
19
+                table: "Properties");
20
+        }
21
+    }
22
+}

+ 2
- 0
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs Näytä tiedosto

@@ -650,6 +650,8 @@ namespace UnivateProperties_API.Migrations
650 650
 
651 651
                     b.Property<string>("PropertyName");
652 652
 
653
+                    b.Property<string>("PropertyRef");
654
+
653 655
                     b.Property<int>("PropertyTypeId");
654 656
 
655 657
                     b.Property<int>("ProvinceId");

+ 2
- 2
UnivateProperties_API/Model/Communication/Email.cs Näytä tiedosto

@@ -43,9 +43,9 @@ namespace UnivateProperties_API.Model.Communication
43 43
                     SenderId = template.SenderId.Value;
44 44
                 }
45 45
                 Sender = template.Sender;
46
-                To = "abigaildf@provision-sa.com"; // sendTo.Email;
46
+                To = "jplouw@provision-sa.com"; // sendTo.Email;
47 47
                 ToDisplay = sendTo.FullName;
48
-                BCC = ConcatEmails(template.AgentBCC, template.IndividualBCC);
48
+                /*BCC = ConcatEmails(template.AgentBCC, template.IndividualBCC);*/
49 49
                 IsBodyHtml = true;
50 50
                 Body = template.Body;
51 51
                 Subject = template.Subject;

+ 1
- 0
UnivateProperties_API/Model/Properties/Property.cs Näytä tiedosto

@@ -27,6 +27,7 @@ namespace UnivateProperties_API.Model.Properties
27 27
         public string AddressLine2 { get; set; }
28 28
         public string AddressLine3 { get; set; }
29 29
         public string PropertCoords { get; set; }
30
+        public string PropertyRef { get; set; }
30 31
         public int SuburbId { get; set; }
31 32
         public int CityId { get; set; }
32 33
         public int ProvinceId { get; set; }

+ 30
- 1
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs Näytä tiedosto

@@ -447,6 +447,7 @@ namespace UnivateProperties_API.Repository.Timeshare
447 447
             var address = _dbContext.Addresses.Where(a => a.Id == sellItem.OwnerObject.Address.Id).FirstOrDefault();
448 448
             var banking = _dbContext.BankAccounts.Where(b => b.Id == sellItem.OwnerObject.BankingDetails.Id).FirstOrDefault();
449 449
             var status = _dbContext.Status.Where(s => s.Code == "A1" && s.StatusType == StatusType.Timeshare).FirstOrDefault();
450
+            var agent = _dbContext.Agents.Where(ag => ag.Id == sellItem.AgentId).FirstOrDefault();
450 451
 
451 452
             #region Address
452 453
             if (sellItem.OwnerObject.Address.PostalCode != "")
@@ -536,7 +537,7 @@ namespace UnivateProperties_API.Repository.Timeshare
536 537
             #endregion
537 538
 
538 539
             var week = new TimeshareWeek();
539
-            foreach(string prop in week.GetAllProperties())
540
+            foreach (string prop in week.GetAllProperties())
540 541
             {
541 542
                 if (prop != "Item" && prop != "Display")
542 543
                     week[prop] = sellItem[prop];
@@ -545,6 +546,34 @@ namespace UnivateProperties_API.Repository.Timeshare
545 546
             week.RegionId = sellItem.Region.Id;
546 547
             week.OwnerId = owner.Id;
547 548
 
549
+            TemplateRepository templateRepository = new TemplateRepository(_dbContext);
550
+            
551
+            var template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Owner");
552
+            if (agent != null)
553
+            {
554
+                sellItem.Agent = agent;
555
+                template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Agent");
556
+                if (template != null)
557
+                {
558
+                    templateRepository.SendEmailTemplate(template, agent, new List<BaseEntity>() { sellItem, sellItem.Owner });
559
+                }
560
+            }
561
+            else if (sellItem.Owner != null)
562
+            {
563
+                
564
+                if (template != null)
565
+                {
566
+                    templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
567
+                }
568
+                template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-UV");
569
+                if (template != null)
570
+                {
571
+                    templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
572
+                }
573
+                
574
+            }
575
+
576
+
548 577
             week.StatusId = status.Id;
549 578
             _dbContext.Add(week);
550 579
             Save();

+ 1
- 1
UnivateProperties_API/appsettings.json Näytä tiedosto

@@ -9,7 +9,7 @@
9 9
   },
10 10
   "AllowedHosts": "*",
11 11
   "ConnectionStrings": {
12
-    "DefaultConnection": "Data Source=localhost;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
12
+    "DefaultConnection": "Data Source=192.168.0.219;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
13 13
     "TenderConnection": "http://www.unipoint-consoft.co.za/nph-srep.exe?cluvavail_test.sch&CLUB=LPA&RESORT=ALL&SUMMARY=N&HEAD=N"
14 14
   }
15 15
 }

Loading…
Peruuta
Tallenna