Browse Source

Update non registered users

master
30117125 4 years ago
parent
commit
08a1c262e0
21 changed files with 7293 additions and 21 deletions
  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 View File

35
     public class TenderWeek
35
     public class TenderWeek
36
     {
36
     {
37
         public DateTime ArrivalDate { get; set; }
37
         public DateTime ArrivalDate { get; set; }
38
-        public int Bedrooms { get; set; }
38
+        public string Bedrooms { get; set; }
39
         public DateTime DepartureDate { get; set; }
39
         public DateTime DepartureDate { get; set; }
40
         public decimal LevyAmount { get; set; }
40
         public decimal LevyAmount { get; set; }
41
         public int MaxSleeps { get; set; }
41
         public int MaxSleeps { get; set; }

+ 1
- 1
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs View File

63
         public string Season { get; set; }
63
         public string Season { get; set; }
64
         public string Module { get; set; }
64
         public string Module { get; set; }
65
         public string UnitNumber { get; set; }
65
         public string UnitNumber { get; set; }
66
-        public int Bedrooms { get; set; }
66
+        public string Bedrooms { get; set; }
67
         public int MaxSleep { get; set; }
67
         public int MaxSleep { get; set; }
68
         public string WeekNumber { get; set; }
68
         public string WeekNumber { get; set; }
69
         public double LevyAmount { get; set; }
69
         public double LevyAmount { get; set; }

+ 16
- 10
UnivateProperties_API/Containers/Timeshare/WeekDto.cs View File

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

+ 1
- 0
UnivateProperties_API/Context/DataContext.cs View File

41
         public virtual DbSet<Individual> Individuals { get; set; }
41
         public virtual DbSet<Individual> Individuals { get; set; }
42
         public virtual DbSet<Address> Addresses { get; set; }
42
         public virtual DbSet<Address> Addresses { get; set; }
43
         public virtual DbSet<UserRole> Roles { get; set; }
43
         public virtual DbSet<UserRole> Roles { get; set; }
44
+        public virtual DbSet<NonRegIndividual> NonRegIndividuals { get; set; }
44
         #endregion User
45
         #endregion User
45
 
46
 
46
         #region Communication
47
         #region Communication

+ 38
- 0
UnivateProperties_API/Controllers/Users/NonRegIndividualController.cs View File

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 View File

28
             htmlBody = htmlBody.Replace("[AgentAsRep]", sellItem.AgentAsRep.ToString());
28
             htmlBody = htmlBody.Replace("[AgentAsRep]", sellItem.AgentAsRep.ToString());
29
             htmlBody = htmlBody.Replace("[OtherResort]", sellItem.OtherResort.ToString());
29
             htmlBody = htmlBody.Replace("[OtherResort]", sellItem.OtherResort.ToString());
30
             htmlBody = htmlBody.Replace("[OtherResortName]", sellItem.OtherResortName != null ? sellItem.OtherResortName.ToString() : "");
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
             htmlBody = htmlBody.Replace("[RegionId]", sellItem.RegionId.ToString());
33
             htmlBody = htmlBody.Replace("[RegionId]", sellItem.RegionId.ToString());
34
             htmlBody = htmlBody.Replace("[Season]", sellItem.Season.ToString());
34
             htmlBody = htmlBody.Replace("[Season]", sellItem.Season.ToString());
35
             htmlBody = htmlBody.Replace("[Module]", sellItem.Module.ToString());
35
             htmlBody = htmlBody.Replace("[Module]", sellItem.Module.ToString());

+ 1696
- 0
UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.Designer.cs
File diff suppressed because it is too large
View File


+ 23
- 0
UnivateProperties_API/Migrations/20201117073109_customOwnerCheck.cs View File

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
File diff suppressed because it is too large
View File


+ 37
- 0
UnivateProperties_API/Migrations/20201117074922_nonRegIndiv.cs View File

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
File diff suppressed because it is too large
View File


+ 53
- 0
UnivateProperties_API/Migrations/20201117083414_nonRegUserUpdate.cs View File

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
File diff suppressed because it is too large
View File


+ 26
- 0
UnivateProperties_API/Migrations/20201117095903_UpdatedBedrooms.cs View File

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 View File

1052
 
1052
 
1053
                     b.Property<string>("BankedWith");
1053
                     b.Property<string>("BankedWith");
1054
 
1054
 
1055
-                    b.Property<int>("Bedrooms");
1055
+                    b.Property<string>("Bedrooms");
1056
 
1056
 
1057
                     b.Property<DateTime>("Created");
1057
                     b.Property<DateTime>("Created");
1058
 
1058
 
1059
                     b.Property<bool>("CurrentYearBanked");
1059
                     b.Property<bool>("CurrentYearBanked");
1060
 
1060
 
1061
+                    b.Property<bool>("CustomOwner");
1062
+
1061
                     b.Property<DateTime>("DateMandated");
1063
                     b.Property<DateTime>("DateMandated");
1062
 
1064
 
1063
                     b.Property<DateTime>("DepartureDate");
1065
                     b.Property<DateTime>("DepartureDate");
1322
                     b.ToTable("Individuals");
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
             modelBuilder.Entity("UnivateProperties_API.Model.Users.Person", b =>
1362
             modelBuilder.Entity("UnivateProperties_API.Model.Users.Person", b =>
1326
                 {
1363
                 {
1327
                     b.Property<int>("Id")
1364
                     b.Property<int>("Id")

+ 4
- 2
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs View File

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

+ 22
- 0
UnivateProperties_API/Model/Users/NonRegIndividual.cs View File

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 View File

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

+ 79
- 2
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs View File

1
 using Abp.Domain.Entities;
1
 using Abp.Domain.Entities;
2
 using Abp.Extensions;
2
 using Abp.Extensions;
3
+using Microsoft.CodeAnalysis;
3
 using Microsoft.EntityFrameworkCore;
4
 using Microsoft.EntityFrameworkCore;
4
 using System;
5
 using System;
5
 using System.Collections.Generic;
6
 using System.Collections.Generic;
18
 using UnivateProperties_API.Model.Communication;
19
 using UnivateProperties_API.Model.Communication;
19
 using UnivateProperties_API.Model.Region;
20
 using UnivateProperties_API.Model.Region;
20
 using UnivateProperties_API.Model.Timeshare;
21
 using UnivateProperties_API.Model.Timeshare;
22
+using UnivateProperties_API.Model.Users;
21
 using UnivateProperties_API.Repository.Communication;
23
 using UnivateProperties_API.Repository.Communication;
22
 using UnivateProperties_API.Repository.Region;
24
 using UnivateProperties_API.Repository.Region;
23
 using UnivateProperties_API.Repository.Users;
25
 using UnivateProperties_API.Repository.Users;
416
                 saved.OwnerId = item.OwnerId;
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
             /*var owner = _dbContext.Individuals.Where(x => x.Id == item.OwnerId).FirstOrDefault();
501
             /*var owner = _dbContext.Individuals.Where(x => x.Id == item.OwnerId).FirstOrDefault();

+ 68
- 0
UnivateProperties_API/Repository/Users/NonRegIndividual.cs View File

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 View File

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

Loading…
Cancel
Save