Sfoglia il codice sorgente

Fixes - Override emails to send to Abi

master
George Williams 4 anni fa
parent
commit
756e68eed3

+ 1
- 1
UnivateProperties_API/Model/Communication/Email.cs Vedi File

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

+ 4
- 18
UnivateProperties_API/Repository/Communication/EmailRepository.cs Vedi File

63
         {
63
         {
64
             SMTPAccountRepository account = new SMTPAccountRepository(_dbContext);
64
             SMTPAccountRepository account = new SMTPAccountRepository(_dbContext);
65
             item = GetDetailedObject(item, account);
65
             item = GetDetailedObject(item, account);
66
-            item.Id = NewId();
67
             item.SendMail();
66
             item.SendMail();
68
             _dbContext.Add(item);
67
             _dbContext.Add(item);
69
             Save();
68
             Save();
70
         }
69
         }
71
 
70
 
72
         public void Insert(IEnumerable<Email> items)
71
         public void Insert(IEnumerable<Email> items)
73
-        {
74
-            int id = NewId();
72
+        {          
75
             foreach (var item in items)
73
             foreach (var item in items)
76
-            {
77
-                item.Id = id;
74
+            {                
78
                 item.SendMail();
75
                 item.SendMail();
79
-                _dbContext.Add(item);
80
-                id += 1;
76
+                _dbContext.Add(item);                
81
             }
77
             }
82
             Save();
78
             Save();
83
         }
79
         }
116
         {
112
         {
117
             _dbContext.SaveChanges();
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 Vedi File

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

Loading…
Annulla
Salva