瀏覽代碼

Update non registered users

master
30117125 4 年之前
父節點
當前提交
08a1c262e0
共有 21 個檔案被更改,包括 7293 行新增21 行删除
  1. 1
    1
      UnivateProperties_API/Containers/ProcessFlow/BidItemDisplay.cs
  2. 1
    1
      UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs
  3. 16
    10
      UnivateProperties_API/Containers/Timeshare/WeekDto.cs
  4. 1
    0
      UnivateProperties_API/Context/DataContext.cs
  5. 38
    0
      UnivateProperties_API/Controllers/Users/NonRegIndividualController.cs
  6. 2
    2
      UnivateProperties_API/Helpers/Communication/EmailCodedFieldsPopulator.cs
  7. 1696
    0
      UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.Designer.cs
  8. 23
    0
      UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.cs
  9. 1723
    0
      UnivateProperties_API/Migrations/20201117074922_nonRegIndiv.Designer.cs
  10. 37
    0
      UnivateProperties_API/Migrations/20201117074922_nonRegIndiv.cs
  11. 1731
    0
      UnivateProperties_API/Migrations/20201117083414_nonRegUserUpdate.Designer.cs
  12. 53
    0
      UnivateProperties_API/Migrations/20201117083414_nonRegUserUpdate.cs
  13. 1731
    0
      UnivateProperties_API/Migrations/20201117095903_UpdatedBedrooms.Designer.cs
  14. 26
    0
      UnivateProperties_API/Migrations/20201117095903_UpdatedBedrooms.cs
  15. 38
    1
      UnivateProperties_API/Migrations/DataContextModelSnapshot.cs
  16. 4
    2
      UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs
  17. 22
    0
      UnivateProperties_API/Model/Users/NonRegIndividual.cs
  18. 2
    2
      UnivateProperties_API/Repository/Misc/CarouselRepository.cs
  19. 79
    2
      UnivateProperties_API/Repository/Timeshare/WeekRepository.cs
  20. 68
    0
      UnivateProperties_API/Repository/Users/NonRegIndividual.cs
  21. 1
    0
      UnivateProperties_API/Startup.cs

+ 1
- 1
UnivateProperties_API/Containers/ProcessFlow/BidItemDisplay.cs 查看文件

@@ -35,7 +35,7 @@ namespace UnivateProperties_API.Containers.ProcessFlow
35 35
     public class TenderWeek
36 36
     {
37 37
         public DateTime ArrivalDate { get; set; }
38
-        public int Bedrooms { get; set; }
38
+        public string Bedrooms { get; set; }
39 39
         public DateTime DepartureDate { get; set; }
40 40
         public decimal LevyAmount { get; set; }
41 41
         public int MaxSleeps { get; set; }

+ 1
- 1
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs 查看文件

@@ -63,7 +63,7 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
63 63
         public string Season { get; set; }
64 64
         public string Module { get; set; }
65 65
         public string UnitNumber { get; set; }
66
-        public int Bedrooms { get; set; }
66
+        public string Bedrooms { get; set; }
67 67
         public int MaxSleep { get; set; }
68 68
         public string WeekNumber { get; set; }
69 69
         public double LevyAmount { get; set; }

+ 16
- 10
UnivateProperties_API/Containers/Timeshare/WeekDto.cs 查看文件

@@ -2,7 +2,9 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using UnivateProperties_API.Helpers;
5
+using UnivateProperties_API.Migrations;
5 6
 using UnivateProperties_API.Model.Timeshare;
7
+using UnivateProperties_API.Model.Users;
6 8
 
7 9
 namespace UnivateProperties_API.Containers.Timeshare
8 10
 {
@@ -13,7 +15,7 @@ namespace UnivateProperties_API.Containers.Timeshare
13 15
 
14 16
         }
15 17
 
16
-        public WeekDto(int id,string line)
18
+        public WeekDto(int id, string line)
17 19
         {
18 20
             Id = id;
19 21
             List<string> split = line.Split(",").ToList();
@@ -50,12 +52,12 @@ namespace UnivateProperties_API.Containers.Timeshare
50 52
                 default:
51 53
                     Season = split[8].Trim();
52 54
                     break;
53
-            }            
55
+            }
54 56
             var size = split[3].Trim();
55
-            if(size.Length == 3 && !size.ToLower().StartsWith('s'))
57
+            if (size.Length == 3 && !size.ToLower().StartsWith('s'))
56 58
             {
57 59
                 int.TryParse(size.Substring(0, 1), out int temp);
58
-                Bedrooms = temp;
60
+                Bedrooms = temp.ToString();
59 61
                 int.TryParse(size.Substring(2, 1), out temp);
60 62
                 MaxSleep = temp;
61 63
             }
@@ -65,12 +67,12 @@ namespace UnivateProperties_API.Containers.Timeshare
65 67
             if (double.TryParse(amt, out double dAmt))
66 68
                 LevyAmount = dAmt;
67 69
             DateTime tempDate = MyCommon.GetDateFromString(currentYear ? split[6].Trim() : split[13].Trim());
68
-            if(tempDate != DateTime.MinValue)
70
+            if (tempDate != DateTime.MinValue)
69 71
             {
70 72
                 ArrivalDate = tempDate;
71 73
             }
72 74
             tempDate = MyCommon.GetDateFromString(currentYear ? split[7].Trim() : split[14].Trim());
73
-            if(tempDate != DateTime.MinValue)
75
+            if (tempDate != DateTime.MinValue)
74 76
             {
75 77
                 DepartureDate = tempDate;
76 78
             }
@@ -109,14 +111,15 @@ namespace UnivateProperties_API.Containers.Timeshare
109 111
             Resort = new ResortDto(week.ResortCode, week.ResortName);
110 112
             Region = new RegionDto(week.Region != null ? week.Region.Id : 0, week.Region?.Code, week.Region?.Description);
111 113
             Season = week.Season;
112
-            if(week.Status != null)
114
+            if (week.Status != null)
113 115
             {
114 116
                 Status = new StatusDto(week.Status.Id, week.Status.Code, week.Status.Description);
115
-            }            
117
+            }
116 118
             Bedrooms = week.Bedrooms;
117 119
             MaxSleep = week.MaxSleep;
118 120
             UnitNumber = week.UnitNumber;
119 121
             WeekNumber = week.WeekNumber;
122
+            Module = week.Module;
120 123
             LevyAmount = week.LevyAmount;
121 124
             CurrentYearBanked = week.CurrentYearBanked;
122 125
             ArrivalDate = week.ArrivalDate;
@@ -128,6 +131,7 @@ namespace UnivateProperties_API.Containers.Timeshare
128 131
             WeekStatus = week.WeekStatus;
129 132
             Publish = week.Publish;
130 133
             PulbishedDate = week.PulbishedDate;
134
+            CustomOwner = week.CustomOwner;
131 135
         }
132 136
 
133 137
         public int Id { get; set; }
@@ -144,9 +148,10 @@ namespace UnivateProperties_API.Containers.Timeshare
144 148
         public int? UserId { get; set; }
145 149
         public bool AgentAsRep { get; set; }
146 150
         public bool OtherResort { get; set; }
147
-        public int Bedrooms { get; set; }
151
+        public string Bedrooms { get; set; }
148 152
         public int MaxSleep { get; set; }
149 153
         public double LevyAmount { get; set; }
154
+        public string Module { get; set; }
150 155
         public bool CurrentYearBanked { get; set; }
151 156
         public string BankedWith { get; set; }
152 157
         public DateTime ArrivalDate { get; set; }
@@ -160,5 +165,6 @@ namespace UnivateProperties_API.Containers.Timeshare
160 165
         public string WeekStatus { get; set; }
161 166
         public bool Publish { get; set; }
162 167
         public DateTime PulbishedDate { get; set; }
163
-    }    
168
+        public bool CustomOwner {get; set;}
169
+    }
164 170
 }

+ 1
- 0
UnivateProperties_API/Context/DataContext.cs 查看文件

@@ -41,6 +41,7 @@ namespace UnivateProperties_API.Context
41 41
         public virtual DbSet<Individual> Individuals { get; set; }
42 42
         public virtual DbSet<Address> Addresses { get; set; }
43 43
         public virtual DbSet<UserRole> Roles { get; set; }
44
+        public virtual DbSet<NonRegIndividual> NonRegIndividuals { get; set; }
44 45
         #endregion User
45 46
 
46 47
         #region Communication

+ 38
- 0
UnivateProperties_API/Controllers/Users/NonRegIndividualController.cs 查看文件

@@ -0,0 +1,38 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using Microsoft.AspNetCore.Http;
6
+using Microsoft.AspNetCore.Mvc;
7
+using UnivateProperties_API.Model.Users;
8
+using UnivateProperties_API.Repository;
9
+
10
+namespace UnivateProperties_API.Controllers.Users
11
+{
12
+    [Route("api/[controller]")]
13
+    [ApiController]
14
+    public class NonRegIndividualController : ControllerBase
15
+    {
16
+        private readonly IRepository<NonRegIndividual> _Repo;
17
+
18
+        public NonRegIndividualController(IRepository<NonRegIndividual> rp)
19
+        {
20
+            _Repo = rp;
21
+        }
22
+
23
+        [HttpGet]
24
+        public IActionResult Get()
25
+        {
26
+            var roles = _Repo.GetAll();
27
+            return new OkObjectResult(roles);
28
+        }
29
+
30
+        [HttpGet("{id}")]
31
+        public IActionResult Get(int id)
32
+        {
33
+            return new OkObjectResult(_Repo.Get(x => x.WeekId == id));
34
+        }
35
+
36
+       
37
+    }
38
+}

+ 2
- 2
UnivateProperties_API/Helpers/Communication/EmailCodedFieldsPopulator.cs 查看文件

@@ -28,8 +28,8 @@ namespace UnivateProperties_API.Helpers.Communication
28 28
             htmlBody = htmlBody.Replace("[AgentAsRep]", sellItem.AgentAsRep.ToString());
29 29
             htmlBody = htmlBody.Replace("[OtherResort]", sellItem.OtherResort.ToString());
30 30
             htmlBody = htmlBody.Replace("[OtherResortName]", sellItem.OtherResortName != null ? sellItem.OtherResortName.ToString() : "");
31
-            htmlBody = htmlBody.Replace("[ResortCode]", sellItem.ResortCode.ToString());
32
-            htmlBody = htmlBody.Replace("[ResortName]", sellItem.ResortName.ToString());
31
+            htmlBody = htmlBody.Replace("[ResortCode]", sellItem.ResortCode != null ? sellItem.ResortCode.ToString() : "");
32
+            htmlBody = htmlBody.Replace("[ResortName]", sellItem.ResortName == null ? sellItem.OtherResortName.ToString() : "");
33 33
             htmlBody = htmlBody.Replace("[RegionId]", sellItem.RegionId.ToString());
34 34
             htmlBody = htmlBody.Replace("[Season]", sellItem.Season.ToString());
35 35
             htmlBody = htmlBody.Replace("[Module]", sellItem.Module.ToString());

+ 1696
- 0
UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.Designer.cs
文件差異過大導致無法顯示
查看文件


+ 23
- 0
UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.cs 查看文件

@@ -0,0 +1,23 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class customOwnerCheck : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.AddColumn<bool>(
10
+                name: "CustomOwner",
11
+                table: "Weeks",
12
+                nullable: false,
13
+                defaultValue: false);
14
+        }
15
+
16
+        protected override void Down(MigrationBuilder migrationBuilder)
17
+        {
18
+            migrationBuilder.DropColumn(
19
+                name: "CustomOwner",
20
+                table: "Weeks");
21
+        }
22
+    }
23
+}

+ 1723
- 0
UnivateProperties_API/Migrations/20201117074922_nonRegIndiv.Designer.cs
文件差異過大導致無法顯示
查看文件


+ 37
- 0
UnivateProperties_API/Migrations/20201117074922_nonRegIndiv.cs 查看文件

@@ -0,0 +1,37 @@
1
+using Microsoft.EntityFrameworkCore.Metadata;
2
+using Microsoft.EntityFrameworkCore.Migrations;
3
+
4
+namespace UnivateProperties_API.Migrations
5
+{
6
+    public partial class nonRegIndiv : Migration
7
+    {
8
+        protected override void Up(MigrationBuilder migrationBuilder)
9
+        {
10
+            migrationBuilder.CreateTable(
11
+                name: "NonRegIndividuals",
12
+                columns: table => new
13
+                {
14
+                    Id = table.Column<int>(nullable: false)
15
+                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
16
+                    Name = table.Column<string>(nullable: true),
17
+                    Surname = table.Column<string>(nullable: true),
18
+                    IDNumber = table.Column<string>(nullable: true),
19
+                    CompanyRegNumber = table.Column<string>(nullable: true),
20
+                    EmailAddress = table.Column<string>(nullable: true),
21
+                    CellNumber = table.Column<string>(nullable: true),
22
+                    TelephoneNumber = table.Column<string>(nullable: true),
23
+                    WeekId = table.Column<int>(nullable: true)
24
+                },
25
+                constraints: table =>
26
+                {
27
+                    table.PrimaryKey("PK_NonRegIndividuals", x => x.Id);
28
+                });
29
+        }
30
+
31
+        protected override void Down(MigrationBuilder migrationBuilder)
32
+        {
33
+            migrationBuilder.DropTable(
34
+                name: "NonRegIndividuals");
35
+        }
36
+    }
37
+}

+ 1731
- 0
UnivateProperties_API/Migrations/20201117083414_nonRegUserUpdate.Designer.cs
文件差異過大導致無法顯示
查看文件


+ 53
- 0
UnivateProperties_API/Migrations/20201117083414_nonRegUserUpdate.cs 查看文件

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

+ 1731
- 0
UnivateProperties_API/Migrations/20201117095903_UpdatedBedrooms.Designer.cs
文件差異過大導致無法顯示
查看文件


+ 26
- 0
UnivateProperties_API/Migrations/20201117095903_UpdatedBedrooms.cs 查看文件

@@ -0,0 +1,26 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class UpdatedBedrooms : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.AlterColumn<string>(
10
+                name: "Bedrooms",
11
+                table: "Weeks",
12
+                nullable: true,
13
+                oldClrType: typeof(int));
14
+        }
15
+
16
+        protected override void Down(MigrationBuilder migrationBuilder)
17
+        {
18
+            migrationBuilder.AlterColumn<int>(
19
+                name: "Bedrooms",
20
+                table: "Weeks",
21
+                nullable: false,
22
+                oldClrType: typeof(string),
23
+                oldNullable: true);
24
+        }
25
+    }
26
+}

+ 38
- 1
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs 查看文件

@@ -1052,12 +1052,14 @@ namespace UnivateProperties_API.Migrations
1052 1052
 
1053 1053
                     b.Property<string>("BankedWith");
1054 1054
 
1055
-                    b.Property<int>("Bedrooms");
1055
+                    b.Property<string>("Bedrooms");
1056 1056
 
1057 1057
                     b.Property<DateTime>("Created");
1058 1058
 
1059 1059
                     b.Property<bool>("CurrentYearBanked");
1060 1060
 
1061
+                    b.Property<bool>("CustomOwner");
1062
+
1061 1063
                     b.Property<DateTime>("DateMandated");
1062 1064
 
1063 1065
                     b.Property<DateTime>("DepartureDate");
@@ -1322,6 +1324,41 @@ namespace UnivateProperties_API.Migrations
1322 1324
                     b.ToTable("Individuals");
1323 1325
                 });
1324 1326
 
1327
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.NonRegIndividual", b =>
1328
+                {
1329
+                    b.Property<int>("Id")
1330
+                        .ValueGeneratedOnAdd()
1331
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
1332
+
1333
+                    b.Property<string>("CellNumber");
1334
+
1335
+                    b.Property<string>("CompanyRegNumber");
1336
+
1337
+                    b.Property<DateTime>("Created");
1338
+
1339
+                    b.Property<string>("EmailAddress");
1340
+
1341
+                    b.Property<string>("IDNumber");
1342
+
1343
+                    b.Property<bool>("IsDeleted");
1344
+
1345
+                    b.Property<DateTime>("Modified");
1346
+
1347
+                    b.Property<string>("ModifiedBy");
1348
+
1349
+                    b.Property<string>("Name");
1350
+
1351
+                    b.Property<string>("Surname");
1352
+
1353
+                    b.Property<string>("TelephoneNumber");
1354
+
1355
+                    b.Property<int?>("WeekId");
1356
+
1357
+                    b.HasKey("Id");
1358
+
1359
+                    b.ToTable("NonRegIndividuals");
1360
+                });
1361
+
1325 1362
             modelBuilder.Entity("UnivateProperties_API.Model.Users.Person", b =>
1326 1363
                 {
1327 1364
                     b.Property<int>("Id")

+ 4
- 2
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 askingPrice, 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, string displayOwner)
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, string 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 askingPrice, 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, string displayOwner, bool customOwner)
18 18
         {
19 19
             ReferedByAgent = referedByAgent;
20 20
             AgentId = agentId;
@@ -57,6 +57,7 @@ namespace UnivateProperties_API.Model.Timeshare
57 57
             Publish = published;
58 58
             PulbishedDate = datePublished;
59 59
             DisplayOwner = displayOwner;
60
+            CustomOwner = customOwner;
60 61
         }
61 62
 
62 63
         #region Properties
@@ -67,6 +68,7 @@ namespace UnivateProperties_API.Model.Timeshare
67 68
         public int? AgencyId { get; set; }
68 69
         [ForeignKey("Owner")]
69 70
         public int OwnerId { get; set; }
71
+        public bool CustomOwner { get; set; }
70 72
 
71 73
         public bool AgentAsRep { get; set; }
72 74
         public bool OtherResort { get; set; }
@@ -77,7 +79,7 @@ namespace UnivateProperties_API.Model.Timeshare
77 79
         public int RegionId { get; set; }
78 80
         public string Season { get; set; }
79 81
         public string Module { get; set; }
80
-        public int Bedrooms { get; set; }
82
+        public string Bedrooms { get; set; }
81 83
         public int MaxSleep { get; set; }
82 84
         public string UnitNumber { get; set; }
83 85
         public string WeekNumber { get; set; }

+ 22
- 0
UnivateProperties_API/Model/Users/NonRegIndividual.cs 查看文件

@@ -0,0 +1,22 @@
1
+using System.ComponentModel.DataAnnotations;
2
+using System.ComponentModel.DataAnnotations.Schema;
3
+
4
+namespace UnivateProperties_API.Model.Users
5
+{
6
+    public class NonRegIndividual : BaseEntity
7
+    {
8
+        public string Name { get; set; }
9
+        public string Surname { get; set; }
10
+        public string IDNumber { get; set; }
11
+        public string CompanyRegNumber { get; set; }
12
+        [DataType(DataType.EmailAddress)]
13
+        public string EmailAddress { get; set; }
14
+        [Phone]
15
+        public string CellNumber { get; set; }
16
+        [Phone]
17
+        public string TelephoneNumber { get; set; }
18
+
19
+        [ForeignKey("TimeshareWeek")]
20
+        public int? WeekId { get; set; }
21
+    }
22
+}

+ 2
- 2
UnivateProperties_API/Repository/Misc/CarouselRepository.cs 查看文件

@@ -174,7 +174,7 @@ namespace UnivateProperties_API.Repository.Misc
174 174
                 if (item.TimeshareId > 0)
175 175
                 {
176 176
                     var timeshare = dBContext.Weeks.Where(t => t.Id == item.TimeshareId).FirstOrDefault();
177
-                    carItem.Bedrooms = timeshare.Bedrooms;
177
+                    //carItem.Bedrooms = timeshare.Bedrooms;
178 178
                     carItem.Sleeps = timeshare.MaxSleep;
179 179
                     carItem.Arrival = timeshare.ArrivalDate;
180 180
                     carItem.Departure = timeshare.DepartureDate;
@@ -216,7 +216,7 @@ namespace UnivateProperties_API.Repository.Misc
216 216
                 if (item.TimeshareId > 0)
217 217
                 {
218 218
                     var timeshare = dBContext.Weeks.Where(t => t.Id == item.TimeshareId).FirstOrDefault();
219
-                    item.Bedrooms = timeshare.Bedrooms;
219
+                    //item.Bedrooms = timeshare.Bedrooms;
220 220
                     item.Sleeps = timeshare.MaxSleep;
221 221
                     item.Arrival = timeshare.ArrivalDate;
222 222
                     item.Departure = timeshare.DepartureDate;

+ 79
- 2
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs 查看文件

@@ -1,5 +1,6 @@
1 1
 using Abp.Domain.Entities;
2 2
 using Abp.Extensions;
3
+using Microsoft.CodeAnalysis;
3 4
 using Microsoft.EntityFrameworkCore;
4 5
 using System;
5 6
 using System.Collections.Generic;
@@ -18,6 +19,7 @@ using UnivateProperties_API.Model;
18 19
 using UnivateProperties_API.Model.Communication;
19 20
 using UnivateProperties_API.Model.Region;
20 21
 using UnivateProperties_API.Model.Timeshare;
22
+using UnivateProperties_API.Model.Users;
21 23
 using UnivateProperties_API.Repository.Communication;
22 24
 using UnivateProperties_API.Repository.Region;
23 25
 using UnivateProperties_API.Repository.Users;
@@ -416,9 +418,84 @@ namespace UnivateProperties_API.Repository.Timeshare
416 418
                 saved.OwnerId = item.OwnerId;
417 419
             }
418 420
 
419
-            if (saved.DisplayOwner != item.Owner.Name + " " + item.Owner.Surname)
421
+            
422
+
423
+            if (saved.CustomOwner != item.CustomOwner)
424
+            {
425
+                saved.CustomOwner = item.CustomOwner;
426
+            }
427
+
428
+            if (item.CustomOwner)
429
+            {
430
+                var customOwner = _dbContext.NonRegIndividuals.Where(x => x.WeekId == item.Id).FirstOrDefault();
431
+
432
+                if (customOwner != null)
433
+                {
434
+                    if (item.Owner.Name != customOwner.Name)
435
+                    {
436
+                        customOwner.Name = item.Owner.Name;
437
+                    }
438
+
439
+                    if (item.Owner.Surname != customOwner.Surname)
440
+                    {
441
+                        customOwner.Surname = item.Owner.Surname;
442
+                    }
443
+
444
+                    if (item.Owner.IdNumber != customOwner.IDNumber)
445
+                    {
446
+                        customOwner.IDNumber = item.Owner.IdNumber;
447
+                    }
448
+
449
+                    if (item.Owner.CompanyRegNumber != customOwner.CompanyRegNumber)
450
+                    {
451
+                        customOwner.CompanyRegNumber = item.Owner.CompanyRegNumber;
452
+                    }
453
+
454
+                    if (item.Owner.Email != customOwner.EmailAddress)
455
+                    {
456
+                        customOwner.EmailAddress = item.Owner.Email;
457
+                    }
458
+
459
+                    if (item.Owner.CellNumber != customOwner.CellNumber)
460
+                    {
461
+                        customOwner.CellNumber = item.Owner.CellNumber;
462
+                    }
463
+
464
+                    if (item.Owner.Telephone != customOwner.TelephoneNumber)
465
+                    {
466
+                        customOwner.TelephoneNumber = item.Owner.Telephone;
467
+                    }
468
+                    saved.DisplayOwner = item.Owner.Name + " " + item.Owner.Surname;
469
+                    _dbContext.NonRegIndividuals.Update(customOwner);
470
+                    _dbContext.SaveChanges();
471
+                }
472
+                else
473
+                {
474
+                    var nonRegUserObj = new NonRegIndividual
475
+                    {
476
+                        Name = item.Owner.Name,
477
+                        Surname = item.Owner.Surname,
478
+                        IDNumber = item.Owner.IdNumber,
479
+                        CompanyRegNumber = item.Owner.CompanyRegNumber,
480
+                        EmailAddress = item.Owner.Email,
481
+                        CellNumber = item.Owner.CellNumber,
482
+                        TelephoneNumber = item.Owner.Telephone,
483
+                        WeekId = item.Id
484
+                    };
485
+                    _dbContext.NonRegIndividuals.Add(nonRegUserObj);
486
+                    _dbContext.SaveChanges();
487
+
488
+                    
489
+                    saved.DisplayOwner = item.Owner.Name + " " + item.Owner.Surname;
490
+                }
491
+                
492
+            }
493
+            else 
420 494
             {
421
-                saved.DisplayOwner = item.Owner.Name + " " + item.Owner.Surname;
495
+                if (saved.DisplayOwner != item.Owner.Name + " " + item.Owner.Surname)
496
+                {
497
+                    saved.DisplayOwner = item.Owner.Name + " " + item.Owner.Surname;
498
+                }
422 499
             }
423 500
 
424 501
             /*var owner = _dbContext.Individuals.Where(x => x.Id == item.OwnerId).FirstOrDefault();

+ 68
- 0
UnivateProperties_API/Repository/Users/NonRegIndividual.cs 查看文件

@@ -0,0 +1,68 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using UnivateProperties_API.Context;
6
+using UnivateProperties_API.Model.Users;
7
+
8
+namespace UnivateProperties_API.Repository.Users
9
+{
10
+    public class NonRegIndividualRepo : IRepository<NonRegIndividual>
11
+    {
12
+        private readonly DataContext _dbContext;
13
+
14
+        public NonRegIndividualRepo(DataContext db)
15
+        {
16
+            _dbContext = db;
17
+        }
18
+
19
+        public List<NonRegIndividual> GetAll()
20
+        {
21
+            return _dbContext.NonRegIndividuals.ToList();
22
+        }
23
+
24
+        public List<NonRegIndividual> Get(Func<NonRegIndividual, bool> where)
25
+        {
26
+            return _dbContext.NonRegIndividuals.Where(where).ToList();
27
+        }
28
+
29
+        public NonRegIndividual GetDetailed(Func<NonRegIndividual, bool> first)
30
+        {
31
+            return null;
32
+        }
33
+
34
+        public List<NonRegIndividual> GetDetailedAll()
35
+        {
36
+            return null;
37
+        }
38
+
39
+        public void Insert(NonRegIndividual item)
40
+        { 
41
+        }
42
+
43
+        public void Insert(IEnumerable<NonRegIndividual> items)
44
+        { 
45
+        }
46
+
47
+        public void Remove(NonRegIndividual item)
48
+        { 
49
+        }
50
+
51
+        public void Remove(IEnumerable<NonRegIndividual> items)
52
+        { 
53
+        }
54
+
55
+        public void RemoveAtId(int item)
56
+        { 
57
+        }
58
+
59
+        public void Update(NonRegIndividual item)
60
+        {
61
+        
62
+        }
63
+        //int NewId();
64
+        public void Save() 
65
+        {
66
+        }
67
+    }
68
+}

+ 1
- 0
UnivateProperties_API/Startup.cs 查看文件

@@ -149,6 +149,7 @@ namespace UnivateProperties_API
149 149
             services.AddTransient<IRepository<Agency>, AgencyRepository>();
150 150
             services.AddTransient<IUserRepository, UserRepository>();
151 151
             services.AddTransient<IRepository<Individual>, IndividualRepository>();
152
+            services.AddTransient<IRepository<NonRegIndividual>, NonRegIndividualRepo>();
152 153
             #endregion User
153 154
             #region Communication
154 155
             services.AddTransient<IRepository<Template>, TemplateRepository>();

Loading…
取消
儲存