ソースを参照

Changes to save edit of timeshare weeks

master
Lene 4年前
コミット
3b3ca9fd7e

+ 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 ファイルの表示

@@ -1051,6 +1051,10 @@ namespace UnivateProperties_API.Migrations
1051 1051
 
1052 1052
                     b.Property<int>("OwnerId");
1053 1053
 
1054
+                    b.Property<bool>("Publish");
1055
+
1056
+                    b.Property<DateTime>("PulbishedDate");
1057
+
1054 1058
                     b.Property<bool>("ReferedByAgent");
1055 1059
 
1056 1060
                     b.Property<int>("RegionId");
@@ -1071,6 +1075,8 @@ namespace UnivateProperties_API.Migrations
1071 1075
 
1072 1076
                     b.Property<bool>("WeekPlacedForRental");
1073 1077
 
1078
+                    b.Property<string>("WeekStatus");
1079
+
1074 1080
                     b.Property<int>("WeekType");
1075 1081
 
1076 1082
                     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()

読み込み中…
キャンセル
保存