Explorar el Código

Fixes - Override emails to send to Abi

master
George Williams hace 4 años
padre
commit
756e68eed3

+ 1
- 1
UnivateProperties_API/Model/Communication/Email.cs Ver fichero

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

+ 4
- 18
UnivateProperties_API/Repository/Communication/EmailRepository.cs Ver fichero

@@ -63,21 +63,17 @@ namespace UnivateProperties_API.Repository.Communication
63 63
         {
64 64
             SMTPAccountRepository account = new SMTPAccountRepository(_dbContext);
65 65
             item = GetDetailedObject(item, account);
66
-            item.Id = NewId();
67 66
             item.SendMail();
68 67
             _dbContext.Add(item);
69 68
             Save();
70 69
         }
71 70
 
72 71
         public void Insert(IEnumerable<Email> items)
73
-        {
74
-            int id = NewId();
72
+        {          
75 73
             foreach (var item in items)
76
-            {
77
-                item.Id = id;
74
+            {                
78 75
                 item.SendMail();
79
-                _dbContext.Add(item);
80
-                id += 1;
76
+                _dbContext.Add(item);                
81 77
             }
82 78
             Save();
83 79
         }
@@ -116,16 +112,6 @@ namespace UnivateProperties_API.Repository.Communication
116 112
         {
117 113
             _dbContext.SaveChanges();
118 114
         }
119
-
120
-        public int NewId()
121
-        {
122
-            int id = 0;
123
-            if (_dbContext.Emails.Count() > 0)
124
-            {
125
-                id = _dbContext.Emails.Max(x => x.Id);
126
-            }
127
-            id += 1;
128
-            return id;
129
-        }
115
+        
130 116
     }
131 117
 }

+ 8
- 1
UnivateProperties_API/Repository/ProccessFlow/BidRepository.cs Ver fichero

@@ -142,7 +142,8 @@ namespace UnivateProperties_API.Repository.ProccessFlow
142 142
             foreach (BidItem item in bids)
143 143
             {
144 144
                 BidItemDisplay bid = BidItemDisplay(item);
145
-                list.Add(bid);
145
+                if (bid != null)
146
+                    list.Add(bid);
146 147
             }
147 148
             return list;
148 149
         }
@@ -469,6 +470,9 @@ namespace UnivateProperties_API.Repository.ProccessFlow
469 470
 
470 471
             if (item.PropertyId != null)
471 472
             {
473
+                if (item.Property == null)
474
+                    return null;
475
+
472 476
                 bid.Type = "Property";
473 477
                 bid.ShortDescription = item.Property.ShortDescription;
474 478
                 bid.Description = item.Property.Description;
@@ -476,6 +480,9 @@ namespace UnivateProperties_API.Repository.ProccessFlow
476 480
             }
477 481
             if (item.TimeshareWeekId != null)
478 482
             {
483
+                if (item.TimeshareWeek == null)
484
+                    return null; 
485
+
479 486
                 bid.Type = "Timeshare";
480 487
                 bid.ShortDescription = string.Format("{0} {1} {2}", item.TimeshareWeek.ResortCode, item.TimeshareWeek.WeekNumber, item.TimeshareWeek.UnitNumber);
481 488
                 bid.SellPrice = (decimal)item.TimeshareWeek.SellPrice;

Loading…
Cancelar
Guardar