소스 검색

Timeshare Sell & Property Listing Fix

master
30117125 3 년 전
부모
커밋
c04fba975d

+ 1
- 0
UnivateProperties_API/Containers/Property/PropertyContainer.cs 파일 보기

@@ -16,6 +16,7 @@ namespace UnivateProperties_API.Containers.Property
16 16
         public decimal OldPrice { get; set; }        
17 17
         public string OldStatus { get; set; }
18 18
         public string CutOffDisplayDateString { get; set; }
19
+        public string StatusCode { get; set; }
19 20
         public List<NewImage> NewImages { get; set; }
20 21
         public List<PropertyFieldGroup> PropertyOverviewFields { get; set; }
21 22
         public List<PropertyFieldGroup> PropertyFields { get; set; }

+ 1866
- 0
UnivateProperties_API/Migrations/20210628145251_dotNet5Update.Designer.cs
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 17
- 0
UnivateProperties_API/Migrations/20210628145251_dotNet5Update.cs 파일 보기

@@ -0,0 +1,17 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class dotNet5Update : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+
10
+        }
11
+
12
+        protected override void Down(MigrationBuilder migrationBuilder)
13
+        {
14
+
15
+        }
16
+    }
17
+}

+ 4
- 1
UnivateProperties_API/Repository/Properties/PropertyRepository.cs 파일 보기

@@ -133,9 +133,10 @@ namespace UnivateProperties_API.Repository.Properties
133 133
             else
134 134
             {
135 135
                 if (!string.IsNullOrEmpty(property.Video))
136
-                    property.Video = string.Format("https://www.youtube.com/watch?v={0}", property.Video);
136
+                    property.Video = string.Format("https://www.youtube.com/watch?v={0}", property.Video);            
137 137
             }
138 138
 
139
+
139 140
             var propertyDetails = new PropertyContainer();
140 141
 
141 142
             propertyDetails.SalesTypeString = property.IsSale ? "Sale" : "Rental";
@@ -147,6 +148,8 @@ namespace UnivateProperties_API.Repository.Properties
147 148
                     propertyDetails[prop] = property[prop];
148 149
             }
149 150
 
151
+            propertyDetails.StatusCode = dBContext.Status.Where(x => x.Id == property.StatusId).FirstOrDefault().Code;
152
+
150 153
             if (property.StatusId != null)
151 154
             {
152 155
                 propertyDetails.StatusString = dBContext.Status.Where(s => s.Id == property.StatusId).FirstOrDefault()?.Description;

+ 66
- 55
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs 파일 보기

@@ -1095,81 +1095,92 @@ namespace UnivateProperties_API.Repository.Timeshare
1095 1095
             #endregion           
1096 1096
 
1097 1097
             var week = new TimeshareWeek();
1098
-            foreach (string prop in week.GetAllProperties())
1099
-            {
1100
-                if (prop != "Item" && prop != "Display")
1101
-                    week[prop] = sellItem[prop];
1102
-            }
1103
-            week.Region = null;
1104
-            week.RegionId = sellItem.Region.Id;
1105
-
1106
-            //if agentWeek then set week owner equal to agentWeek.id else
1107
-            if (agentWeek != null)
1108
-            {
1109
-                week.OwnerId = agentWeek.Id;
1110
-            }
1111
-            else
1112
-            {
1113
-                week.OwnerId = owner.Id;
1114
-            }
1115
-
1116
-            if (week.Mandate)
1117
-                week.DateMandated = DateTime.Now;
1118
-
1119
-            TemplateRepository templateRepository = new TemplateRepository(_dbContext);
1120
-            MailRepository mailRepository = new MailRepository(_dbContext);
1121
-            var template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Owner");
1122 1098
 
1123 1099
             try
1124 1100
             {
1101
+                foreach (string prop in week.GetAllProperties())
1102
+                {
1103
+                    if (prop != "Item" && prop != "Display")
1104
+                        week[prop] = sellItem[prop];
1105
+                }
1106
+                week.Region = null;
1107
+                week.RegionId = sellItem.Region.Id;
1108
+
1109
+                //if agentWeek then set week owner equal to agentWeek.id else
1125 1110
                 if (agentWeek != null)
1126 1111
                 {
1127
-                    template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Agent");
1128
-                    if (template != null)
1129
-                    {
1130
-                        mailRepository.WeekLoadedAgent(sellItem);
1131
-                        //templateRepository.SendEmailTemplateWeek(template, agent, sellItem);
1132
-                    }
1112
+                    week.OwnerId = agentWeek.Id;
1133 1113
                 }
1134 1114
                 else
1135 1115
                 {
1136
-                    if (template != null)
1116
+                    week.OwnerId = owner.Id;
1117
+                }
1118
+
1119
+                if (week.Mandate)
1120
+                    week.DateMandated = DateTime.Now;
1121
+
1122
+                TemplateRepository templateRepository = new TemplateRepository(_dbContext);
1123
+                MailRepository mailRepository = new MailRepository(_dbContext);
1124
+                var template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Owner");
1125
+
1126
+                try
1127
+                {
1128
+                    if (agentWeek != null)
1137 1129
                     {
1138
-                        mailRepository.WeekLoadedOwner(sellItem);
1139
-                        //templateRepository.SendEmailTemplateWeek(template, owner, sellItem);
1130
+                        template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-Agent");
1131
+                        if (template != null)
1132
+                        {
1133
+                            mailRepository.WeekLoadedAgent(sellItem);
1134
+                            //templateRepository.SendEmailTemplateWeek(template, agent, sellItem);
1135
+                        }
1140 1136
                     }
1141
-                    /*template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-UV");
1142
-                    if (template != null)
1137
+                    else
1143 1138
                     {
1144
-                        templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
1145
-                    }*/
1139
+                        if (template != null)
1140
+                        {
1141
+                            mailRepository.WeekLoadedOwner(sellItem);
1142
+                            //templateRepository.SendEmailTemplateWeek(template, owner, sellItem);
1143
+                        }
1144
+                        /*template = _dbContext.Templates.FirstOrDefault(x => x.Name == "WeekLoaded-UV");
1145
+                        if (template != null)
1146
+                        {
1147
+                            templateRepository.SendEmailTemplate(template, sellItem.Owner, new List<BaseEntity>() { sellItem, sellItem.Owner });
1148
+                        }*/
1146 1149
 
1150
+                    }
1151
+                }
1152
+                catch (Exception ex)
1153
+                {
1154
+                    MailModel mm = new MailModel();
1155
+                    mm.ComType = "WeekLoad";
1156
+                    mm.Error = ex.ToString();
1157
+                    _dbContext.CommunicationLog.Add(mm);
1147 1158
                 }
1148
-            }
1149
-            catch (Exception ex)
1150
-            {
1151
-                throw (ex);
1152
-            }
1153 1159
 
1154
-            if (sellItem.StatusId == 0)
1155
-            {
1156
-                var statuses = _dbContext.Status.ToList();
1157
-                foreach (var statusItem in statuses)
1160
+                if (sellItem.StatusId == 0)
1158 1161
                 {
1159
-                    if (statusItem.Code == "AP")
1162
+                    var statuses = _dbContext.Status.ToList();
1163
+                    foreach (var statusItem in statuses)
1160 1164
                     {
1161
-                        week.StatusId = statusItem.Id;
1165
+                        if (statusItem.Code == "AP")
1166
+                        {
1167
+                            week.StatusId = statusItem.Id;
1168
+                        }
1162 1169
                     }
1163 1170
                 }
1164
-            }
1165 1171
 
1166
-            _dbContext.Add(week);
1167
-            Save();
1168
-            if (sellItem.CustomOwner)
1169
-            {
1170
-                indiv.WeekId = week.Id;
1171
-                _dbContext.NonRegIndividuals.Update(indiv);
1172
+                _dbContext.Add(week);
1172 1173
                 Save();
1174
+                if (sellItem.CustomOwner)
1175
+                {
1176
+                    indiv.WeekId = week.Id;
1177
+                    _dbContext.NonRegIndividuals.Update(indiv);
1178
+                    Save();
1179
+                }
1180
+            }
1181
+            catch (Exception ex)
1182
+            {
1183
+                throw (ex);
1173 1184
             }
1174 1185
             return week.Id;
1175 1186
         }

+ 4
- 0
UnivateProperties_API/UnivateProperties_API.csproj 파일 보기

@@ -23,6 +23,10 @@
23 23
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
24 24
     <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
25 25
     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
26
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0">
27
+      <PrivateAssets>all</PrivateAssets>
28
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
29
+    </PackageReference>
26 30
     <PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="5.0.1" />
27 31
     <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
28 32
     <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />

Loading…
취소
저장