2 Коміти

Автор SHA1 Повідомлення Дата
  Lene 3bd8055cfa Merge branch 'master' of http://provision-sa.co.za:3000/Provision/UnivatePropertiesAPI 4 роки тому
  Lene 3b3ca9fd7e Changes to save edit of timeshare weeks 4 роки тому

+ 1629
- 0
UnivateProperties_API/Migrations/20200915123751_timeshareNewCols.Designer.cs
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 43
- 0
UnivateProperties_API/Migrations/20200915123751_timeshareNewCols.cs Переглянути файл

@@ -0,0 +1,43 @@
1
+using System;
2
+using Microsoft.EntityFrameworkCore.Migrations;
3
+
4
+namespace UnivateProperties_API.Migrations
5
+{
6
+    public partial class timeshareNewCols : Migration
7
+    {
8
+        protected override void Up(MigrationBuilder migrationBuilder)
9
+        {
10
+            migrationBuilder.AddColumn<bool>(
11
+                name: "Publish",
12
+                table: "Weeks",
13
+                nullable: false,
14
+                defaultValue: false);
15
+
16
+            migrationBuilder.AddColumn<DateTime>(
17
+                name: "PulbishedDate",
18
+                table: "Weeks",
19
+                nullable: false,
20
+                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
21
+
22
+            migrationBuilder.AddColumn<string>(
23
+                name: "WeekStatus",
24
+                table: "Weeks",
25
+                nullable: true);
26
+        }
27
+
28
+        protected override void Down(MigrationBuilder migrationBuilder)
29
+        {
30
+            migrationBuilder.DropColumn(
31
+                name: "Publish",
32
+                table: "Weeks");
33
+
34
+            migrationBuilder.DropColumn(
35
+                name: "PulbishedDate",
36
+                table: "Weeks");
37
+
38
+            migrationBuilder.DropColumn(
39
+                name: "WeekStatus",
40
+                table: "Weeks");
41
+        }
42
+    }
43
+}

+ 6
- 0
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs Переглянути файл

@@ -1055,6 +1055,10 @@ namespace UnivateProperties_API.Migrations
1055 1055
 
1056 1056
                     b.Property<int>("OwnerId");
1057 1057
 
1058
+                    b.Property<bool>("Publish");
1059
+
1060
+                    b.Property<DateTime>("PulbishedDate");
1061
+
1058 1062
                     b.Property<bool>("ReferedByAgent");
1059 1063
 
1060 1064
                     b.Property<int>("RegionId");
@@ -1075,6 +1079,8 @@ namespace UnivateProperties_API.Migrations
1075 1079
 
1076 1080
                     b.Property<bool>("WeekPlacedForRental");
1077 1081
 
1082
+                    b.Property<string>("WeekStatus");
1083
+
1078 1084
                     b.Property<int>("WeekType");
1079 1085
 
1080 1086
                     b.HasKey("Id");

+ 7
- 1
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs Переглянути файл

@@ -14,7 +14,7 @@ namespace UnivateProperties_API.Model.Timeshare
14 14
         {
15 15
         }
16 16
 
17
-        public TimeshareWeek(bool referedByAgent, int? agentId, int? agencyId, int ownerId, bool agentAsRep, bool otherResort, string otherResortName, string resortCode, string resortName, int regionId, string season, string module, int bedrooms, int maxSleep, string unitNumber, string weekNumber, double levyAmount, bool currentYearBanked, string bankedWith, bool leviesPaidInFull, bool weekPlacedForRental, double originalPurchasePrice, DateTime originalPurchaseDate, DateTime arrivalDate, DateTime departureDate, double sellPrice, double agentCommision, bool mandate, int statusId, Status status, Province region, Individual owner, Agent agent, Agency agency, ICollection<BidItem> bidItems, ICollection<ProcessFlow.ProcessFlow> processFlows)
17
+        public TimeshareWeek(bool referedByAgent, int? agentId, int? agencyId, int ownerId, bool agentAsRep, bool otherResort, string otherResortName, string resortCode, string resortName, int regionId, string season, string module, int bedrooms, int maxSleep, string unitNumber, string weekNumber, double levyAmount, bool currentYearBanked, string bankedWith, bool leviesPaidInFull, bool weekPlacedForRental, double originalPurchasePrice, DateTime originalPurchaseDate, DateTime arrivalDate, DateTime departureDate, double sellPrice, double agentCommision, bool mandate, int statusId, Status status, Province region, Individual owner, Agent agent, Agency agency, ICollection<BidItem> bidItems, ICollection<ProcessFlow.ProcessFlow> processFlows, string weekStatus, DateTime datePublished, bool published)
18 18
         {
19 19
             ReferedByAgent = referedByAgent;
20 20
             AgentId = agentId;
@@ -52,6 +52,9 @@ namespace UnivateProperties_API.Model.Timeshare
52 52
             Agency = agency;
53 53
             BidItems = bidItems;
54 54
             ProcessFlows = processFlows;
55
+            WeekStatus = weekStatus;
56
+            Publish = published;
57
+            PulbishedDate = datePublished;
55 58
         }
56 59
 
57 60
         #region Properties
@@ -97,6 +100,9 @@ namespace UnivateProperties_API.Model.Timeshare
97 100
         public int StatusId { get; set; }
98 101
 
99 102
         public WeekType WeekType { get; set; }
103
+        public string WeekStatus { get; set; }
104
+        public bool Publish { get; set; }
105
+        public DateTime PulbishedDate { get; set; }
100 106
         #endregion
101 107
 
102 108
         #region Navigation

+ 16
- 17
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs Переглянути файл

@@ -223,7 +223,7 @@ namespace UnivateProperties_API.Repository.Timeshare
223 223
                 };
224 224
                 repo.Insert(stat);
225 225
             }
226
-            item.Id = NewId();
226
+            //item.Id = NewId();
227 227
             item.ProcessFlows.Add(new Model.ProcessFlow.ProcessFlow()
228 228
             {
229 229
                 Status = item.Status,
@@ -249,12 +249,12 @@ namespace UnivateProperties_API.Repository.Timeshare
249 249
 
250 250
         public void Insert(IEnumerable<TimeshareWeek> items)
251 251
         {
252
-            int id = NewId();
252
+            //int id = NewId();
253 253
             foreach (var item in items)
254 254
             {
255
-                item.Id = id;
255
+                //item.Id = id;
256 256
                 _dbContext.Add(item);
257
-                id += 1;
257
+                //id += 1;
258 258
             }
259 259
             Save();
260 260
         }
@@ -294,10 +294,9 @@ namespace UnivateProperties_API.Repository.Timeshare
294 294
             if (saved.Mandate != item.Mandate)
295 295
             {
296 296
                 if (item.Mandate)
297
-                    item.DateMandated = DateTime.Now;
297
+                    saved.DateMandated = DateTime.Now;
298 298
             }
299
-
300
-            _dbContext.Entry(item).State = EntityState.Modified;
299
+            _dbContext.Entry(saved).State = EntityState.Modified;
301 300
             Save();
302 301
         }
303 302
 
@@ -329,16 +328,16 @@ namespace UnivateProperties_API.Repository.Timeshare
329 328
             return item;
330 329
         }
331 330
 
332
-        public int NewId()
333
-        {
334
-            int id = 0;
335
-            if (_dbContext.Weeks.Count() > 0)
336
-            {
337
-                id = _dbContext.Weeks.Max(x => x.Id);
338
-            }
339
-            id += 1;
340
-            return id;
341
-        }
331
+        //public int NewId()
332
+        //{
333
+        //    int id = 0;
334
+        //    if (_dbContext.Weeks.Count() > 0)
335
+        //    {
336
+        //        id = _dbContext.Weeks.Max(x => x.Id);
337
+        //    }
338
+        //    id += 1;
339
+        //    return id;
340
+        //}
342 341
 
343 342
         private int _TenderId = 10000;
344 343
         private int GetTenderId()

Завантаження…
Відмінити
Зберегти