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 查看文件

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
 
1055
 
1056
                     b.Property<int>("OwnerId");
1056
                     b.Property<int>("OwnerId");
1057
 
1057
 
1058
+                    b.Property<bool>("Publish");
1059
+
1060
+                    b.Property<DateTime>("PulbishedDate");
1061
+
1058
                     b.Property<bool>("ReferedByAgent");
1062
                     b.Property<bool>("ReferedByAgent");
1059
 
1063
 
1060
                     b.Property<int>("RegionId");
1064
                     b.Property<int>("RegionId");
1075
 
1079
 
1076
                     b.Property<bool>("WeekPlacedForRental");
1080
                     b.Property<bool>("WeekPlacedForRental");
1077
 
1081
 
1082
+                    b.Property<string>("WeekStatus");
1083
+
1078
                     b.Property<int>("WeekType");
1084
                     b.Property<int>("WeekType");
1079
 
1085
 
1080
                     b.HasKey("Id");
1086
                     b.HasKey("Id");

+ 7
- 1
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs 查看文件

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
             ReferedByAgent = referedByAgent;
19
             ReferedByAgent = referedByAgent;
20
             AgentId = agentId;
20
             AgentId = agentId;
52
             Agency = agency;
52
             Agency = agency;
53
             BidItems = bidItems;
53
             BidItems = bidItems;
54
             ProcessFlows = processFlows;
54
             ProcessFlows = processFlows;
55
+            WeekStatus = weekStatus;
56
+            Publish = published;
57
+            PulbishedDate = datePublished;
55
         }
58
         }
56
 
59
 
57
         #region Properties
60
         #region Properties
97
         public int StatusId { get; set; }
100
         public int StatusId { get; set; }
98
 
101
 
99
         public WeekType WeekType { get; set; }
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
         #endregion
106
         #endregion
101
 
107
 
102
         #region Navigation
108
         #region Navigation

+ 16
- 17
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs 查看文件

223
                 };
223
                 };
224
                 repo.Insert(stat);
224
                 repo.Insert(stat);
225
             }
225
             }
226
-            item.Id = NewId();
226
+            //item.Id = NewId();
227
             item.ProcessFlows.Add(new Model.ProcessFlow.ProcessFlow()
227
             item.ProcessFlows.Add(new Model.ProcessFlow.ProcessFlow()
228
             {
228
             {
229
                 Status = item.Status,
229
                 Status = item.Status,
249
 
249
 
250
         public void Insert(IEnumerable<TimeshareWeek> items)
250
         public void Insert(IEnumerable<TimeshareWeek> items)
251
         {
251
         {
252
-            int id = NewId();
252
+            //int id = NewId();
253
             foreach (var item in items)
253
             foreach (var item in items)
254
             {
254
             {
255
-                item.Id = id;
255
+                //item.Id = id;
256
                 _dbContext.Add(item);
256
                 _dbContext.Add(item);
257
-                id += 1;
257
+                //id += 1;
258
             }
258
             }
259
             Save();
259
             Save();
260
         }
260
         }
294
             if (saved.Mandate != item.Mandate)
294
             if (saved.Mandate != item.Mandate)
295
             {
295
             {
296
                 if (item.Mandate)
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
             Save();
300
             Save();
302
         }
301
         }
303
 
302
 
329
             return item;
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
         private int _TenderId = 10000;
342
         private int _TenderId = 10000;
344
         private int GetTenderId()
343
         private int GetTenderId()

Loading…
取消
儲存