소스 검색

Checkin timeshare

master
Kobus 5 년 전
부모
커밋
998226d891
24개의 변경된 파일3014개의 추가작업 그리고 51개의 파일을 삭제
  1. 7
    0
      UnivateProperties_API/Containers/IDisplay.cs
  2. 39
    0
      UnivateProperties_API/Containers/Timeshare/Detailed/DetailedAddress.cs
  3. 33
    0
      UnivateProperties_API/Containers/Timeshare/Detailed/DetailedBankDetails.cs
  4. 47
    0
      UnivateProperties_API/Containers/Timeshare/Detailed/DetailedOwner.cs
  5. 78
    0
      UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs
  6. 3
    1
      UnivateProperties_API/Containers/Timeshare/RegionDto.cs
  7. 3
    1
      UnivateProperties_API/Containers/Timeshare/ResortDto.cs
  8. 3
    5
      UnivateProperties_API/Containers/Timeshare/StatusDto.cs
  9. 20
    11
      UnivateProperties_API/Containers/Timeshare/WeekDto.cs
  10. 2
    0
      UnivateProperties_API/Context/DataContext.cs
  11. 1
    4
      UnivateProperties_API/Controllers/Timeshare/TimeshareWeekController.cs
  12. 1233
    0
      UnivateProperties_API/Migrations/20191021143440_MappingBank.Designer.cs
  13. 128
    0
      UnivateProperties_API/Migrations/20191021143440_MappingBank.cs
  14. 1239
    0
      UnivateProperties_API/Migrations/20191022055635_AddedWeekProps.Designer.cs
  15. 41
    0
      UnivateProperties_API/Migrations/20191022055635_AddedWeekProps.cs
  16. 31
    3
      UnivateProperties_API/Migrations/DataContextModelSnapshot.cs
  17. 5
    2
      UnivateProperties_API/Model/Banks/BankAccount.cs
  18. 3
    1
      UnivateProperties_API/Model/BaseEntity.cs
  19. 6
    4
      UnivateProperties_API/Model/Misc/Address.cs
  20. 5
    1
      UnivateProperties_API/Model/ProcessFlow/ProcessFlow.cs
  21. 1
    0
      UnivateProperties_API/Model/Timeshare/Status.cs
  22. 21
    0
      UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs
  23. 6
    1
      UnivateProperties_API/Model/Users/Individual.cs
  24. 59
    17
      UnivateProperties_API/Repository/Timeshare/WeekRepository.cs

+ 7
- 0
UnivateProperties_API/Containers/IDisplay.cs 파일 보기

@@ -0,0 +1,7 @@
1
+namespace UnivateProperties_API.Containers
2
+{
3
+    public interface IDisplay
4
+    {
5
+        string Display { get; }
6
+    }
7
+}

+ 39
- 0
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedAddress.cs 파일 보기

@@ -0,0 +1,39 @@
1
+using UnivateProperties_API.Model.Misc;
2
+
3
+namespace UnivateProperties_API.Containers.Timeshare.Detailed
4
+{
5
+    public class DetailedAddress
6
+    {
7
+        public DetailedAddress()
8
+        {
9
+
10
+        }
11
+
12
+        public DetailedAddress(int id, string streetNumber, string street, string suburb, string city, string postalCode)
13
+        {
14
+            Id = id;
15
+            StreetNumber = streetNumber;
16
+            Street = street;
17
+            Suburb = suburb;
18
+            City = city;
19
+            PostalCode = postalCode;
20
+        }
21
+
22
+        public DetailedAddress(Address address)
23
+        {
24
+            Id = address.Id;
25
+            StreetNumber = address.StreetNumber;
26
+            Street = address.Street;
27
+            Suburb = address.Suburb;
28
+            City = address.City;
29
+            PostalCode = address.PostalCode;
30
+        }
31
+
32
+        public int Id { get; set; }
33
+        public string StreetNumber { get; set; }
34
+        public string Street { get; set; }
35
+        public string Suburb { get; set; }
36
+        public string City { get; set; }
37
+        public string PostalCode { get; set; }
38
+    }
39
+}

+ 33
- 0
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedBankDetails.cs 파일 보기

@@ -0,0 +1,33 @@
1
+using UnivateProperties_API.Model.Banks;
2
+
3
+namespace UnivateProperties_API.Containers.Timeshare.Detailed
4
+{
5
+    public class DetailedBankDetails
6
+    {
7
+        public DetailedBankDetails()
8
+        {
9
+
10
+        }
11
+
12
+        public DetailedBankDetails(int id, int bankId, string accountNumber, string accountHolder)
13
+        {
14
+            Id = id;
15
+            BankId = bankId;
16
+            AccountHolder = accountHolder;
17
+            AccountNumber = accountNumber;
18
+        }
19
+
20
+        public DetailedBankDetails(BankAccount bankAccount)
21
+        {
22
+            Id = bankAccount.Id;
23
+            BankId = bankAccount.BankId;
24
+            AccountHolder = bankAccount.AccountHolder;
25
+            AccountNumber = bankAccount.AccountNumber;
26
+        }
27
+
28
+        public int Id { get; set; }
29
+        public int? BankId { get; set; }
30
+        public string AccountHolder { get; set; }
31
+        public string AccountNumber { get; set; }
32
+    }
33
+}

+ 47
- 0
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedOwner.cs 파일 보기

@@ -0,0 +1,47 @@
1
+using UnivateProperties_API.Model.Users;
2
+
3
+namespace UnivateProperties_API.Containers.Timeshare.Detailed
4
+{
5
+    public class DetailedOwner
6
+    {
7
+        public DetailedOwner()
8
+        {
9
+
10
+        }
11
+
12
+        public DetailedOwner(Individual individual)
13
+        {
14
+            Id = individual.Id;
15
+            Name = individual.Name;
16
+            Surname = individual.Surname;
17
+            IdNumber = individual.IdNumber;
18
+            CompanyRegNumber = individual.CompanyRegNumber;
19
+            MaritalStatus = individual.MaritalStatus;
20
+            EmailAddress = individual.Email;
21
+            CellNumber = individual.CellNumber;
22
+            LandlineNumber = individual.Telephone;
23
+            if (individual.Address != null)
24
+            {
25
+                Address = new DetailedAddress(individual.Address);
26
+            }
27
+            else Address = new DetailedAddress();
28
+            if (BankingDetails != null)
29
+            {
30
+                BankingDetails = new DetailedBankDetails(individual.BankAccount);
31
+            }
32
+            else BankingDetails = new DetailedBankDetails();
33
+        }
34
+
35
+        public int Id { get; set; }
36
+        public string Name { get; set; }
37
+        public string Surname { get; set; }
38
+        public string IdNumber { get; set; }
39
+        public string CompanyRegNumber { get; set; }
40
+        public string MaritalStatus { get; set; }
41
+        public string EmailAddress { get; set; }
42
+        public string CellNumber { get; set; }
43
+        public string LandlineNumber { get; set; }
44
+        public DetailedAddress Address { get; set; }
45
+        public DetailedBankDetails BankingDetails { get; set; }
46
+    }
47
+}

+ 78
- 0
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs 파일 보기

@@ -0,0 +1,78 @@
1
+using System;
2
+using UnivateProperties_API.Model.Timeshare;
3
+
4
+namespace UnivateProperties_API.Containers.Timeshare.Detailed
5
+{
6
+    public class DetailedWeekDto
7
+    {
8
+        public DetailedWeekDto()
9
+        {
10
+
11
+        }
12
+
13
+        public DetailedWeekDto(TimeshareWeek week)
14
+        {
15
+            Id = week.Id;
16
+            ReferedByAgent = week.ReferedByAgent;
17
+            AgentId = week.AgentId;
18
+            AgencyId = week.AgencyId;
19
+            OtherResort = week.OtherResort;
20
+            OtherResortName = week.OtherResortName;
21
+            Resort = new ResortDto(week.ResortCode, week.ResortName);
22
+            ResortCode = week.ResortCode;
23
+            ResortName = week.ResortName;
24
+            RegionId = week.RegionId;
25
+            Season = week.Season;
26
+            Module = week.Module;
27
+            UnitNumber = week.UnitNumber;
28
+            Bedrooms = week.Bedrooms;
29
+            MaxSleep = week.MaxSleep;
30
+            WeekNumber = week.WeekNumber;
31
+            LevyAmount = week.LevyAmount;
32
+            CurrentYearBanked = week.CurrentYearBanked;
33
+            BankedWith = week.BankedWith;
34
+            LeviesPaidInFull = week.LeviesPaidInFull;
35
+            WeekPlacedForRental = week.WeekPlacedForRental;
36
+            OriginalPurchaseDate = week.OriginalPurchaseDate.ToShortDateString().Replace('/', '-');
37
+            OriginalPurchasePrice = week.OriginalPurchasePrice;
38
+            ArrivalDate = week.ArrivalDate.ToShortDateString().Replace('/', '-');
39
+            DepartureDate = week.DepartureDate.ToShortDateString().Replace('/', '-');
40
+            SellPrice = week.SellPrice;
41
+            AgentCommission = week.AgentCommision;
42
+            Mandate = week.Mandate;
43
+            Status = week.Status.Display;
44
+            Owner = new DetailedOwner(week.Owner);
45
+        }
46
+
47
+        public int Id { get; set; }
48
+        public bool ReferedByAgent { get; set; }
49
+        public int? AgentId { get; set; }
50
+        public int? AgencyId { get; set; }
51
+        public bool OtherResort { get; set; }
52
+        public string OtherResortName { get; set; }
53
+        public ResortDto Resort { get; set; }
54
+        public string ResortCode { get; set; }
55
+        public string ResortName { get; set; }
56
+        public int RegionId { get; set; }
57
+        public string Season { get; set; }
58
+        public string Module { get; set; }
59
+        public string UnitNumber { get; set; }
60
+        public int Bedrooms { get; set; }
61
+        public int MaxSleep { get; set; }
62
+        public string WeekNumber { get; set; }
63
+        public double LevyAmount { get; set; }
64
+        public bool CurrentYearBanked { get; set; }
65
+        public string BankedWith { get; set; }
66
+        public bool LeviesPaidInFull { get; set; }
67
+        public bool WeekPlacedForRental { get; set; }
68
+        public double OriginalPurchasePrice { get; set; }
69
+        public string OriginalPurchaseDate { get; set; }
70
+        public string ArrivalDate { get; set; }
71
+        public string DepartureDate { get; set; }
72
+        public double SellPrice { get; set; }
73
+        public double AgentCommission { get; set; }
74
+        public string Mandate { get; set; }
75
+        public string Status { get; set; }
76
+        public DetailedOwner Owner { get; set; }
77
+    }
78
+}

+ 3
- 1
UnivateProperties_API/Containers/Timeshare/RegionDto.cs 파일 보기

@@ -3,7 +3,7 @@ using System.Linq;
3 3
 
4 4
 namespace UnivateProperties_API.Containers.Timeshare
5 5
 {
6
-    public class RegionDto
6
+    public class RegionDto : IDisplay
7 7
     {
8 8
         public RegionDto()
9 9
         {
@@ -37,6 +37,8 @@ namespace UnivateProperties_API.Containers.Timeshare
37 37
             }
38 38
         }
39 39
 
40
+        public string Display => RegionName;
41
+
40 42
         public void TryAddResort(string resortCode, string resortName)
41 43
         {
42 44
             if (!Resorts.Any(x => x.ResortCode == resortCode))

+ 3
- 1
UnivateProperties_API/Containers/Timeshare/ResortDto.cs 파일 보기

@@ -1,6 +1,6 @@
1 1
 namespace UnivateProperties_API.Containers.Timeshare
2 2
 {
3
-    public class ResortDto
3
+    public class ResortDto : IDisplay
4 4
     {
5 5
         public ResortDto()
6 6
         {
@@ -16,5 +16,7 @@
16 16
         public string ResortCode { get; set; }
17 17
         public string ResortName { get; set; }
18 18
         public int Available { get; set; }
19
+
20
+        public string Display => ResortName;
19 21
     }
20 22
 }

+ 3
- 5
UnivateProperties_API/Containers/Timeshare/StatusDto.cs 파일 보기

@@ -1,6 +1,6 @@
1 1
 namespace UnivateProperties_API.Containers.Timeshare
2 2
 {
3
-    public class StatusDto
3
+    public class StatusDto : IDisplay
4 4
     {
5 5
         public StatusDto()
6 6
         {
@@ -17,9 +17,7 @@
17 17
         public int Id { get; set; }
18 18
         public string Code { get; set; }
19 19
         public string Description { get; set; }
20
-        public override string ToString()
21
-        {
22
-            return $"{Code} - {Description}";
23
-        }
20
+
21
+        public string Display => $"{Code} - {Description}";
24 22
     }
25 23
 }

+ 20
- 11
UnivateProperties_API/Containers/Timeshare/WeekDto.cs 파일 보기

@@ -6,15 +6,16 @@ using UnivateProperties_API.Model.Timeshare;
6 6
 
7 7
 namespace UnivateProperties_API.Containers.Timeshare
8 8
 {
9
-    public class WeekDto
9
+    public class WeekDto : IDisplay
10 10
     {
11 11
         public WeekDto()
12 12
         {
13 13
 
14 14
         }
15 15
 
16
-        public WeekDto(string line)
16
+        public WeekDto(int id,string line)
17 17
         {
18
+            Id = id;
18 19
             List<string> split = line.Split(",").ToList();
19 20
             AgentAsRep = false;
20 21
             Resort = new ResortDto(split[0].Trim(), split[0].Trim());
@@ -40,7 +41,9 @@ namespace UnivateProperties_API.Containers.Timeshare
40 41
             {
41 42
                 DepartureDate = tempDate;
42 43
             }
43
-            Region = new RegionDto() { RegionCode = split[24] };
44
+            Region = new RegionDto() { RegionCode = split[24].Trim() };
45
+            IsTender = true;
46
+            ReferedByAgent = false;
44 47
         }
45 48
 
46 49
         public WeekDto(TimeshareWeek week)
@@ -52,7 +55,7 @@ namespace UnivateProperties_API.Containers.Timeshare
52 55
             Agent = $"{week.Agent?.Name} {week.Agent?.Surname}";
53 56
             Owner = $"{week.Owner?.Name} {week.Owner?.Surname}";
54 57
             Resort = new ResortDto(week.ResortCode, week.ResortName);
55
-            Region = new RegionDto(week.Region != null ? week.Region.Id : 0, week.Region?.Description, week.Region?.Code);
58
+            Region = new RegionDto(week.Region != null ? week.Region.Id : 0, week.Region?.Code, week.Region?.Description);
56 59
             Status = new StatusDto(week.Status.Id, week.Status?.Code, week.Status?.Description);
57 60
             Bedrooms = week.Bedrooms;
58 61
             MaxSleep = week.MaxSleep;
@@ -63,26 +66,32 @@ namespace UnivateProperties_API.Containers.Timeshare
63 66
             ArrivalDate = week.ArrivalDate;
64 67
             DepartureDate = week.DepartureDate;
65 68
             SellPrice = week.SellPrice;
69
+            IsTender = false;
70
+            ReferedByAgent = week.ReferedByAgent;
66 71
         }
67 72
 
68 73
         public int Id { get; set; }
69
-        public bool AgentAsRep { get; set; }
70
-        public bool OtherResort { get; set; }
71
-        public string Agency { get; set; }
72
-        public string Agent { get; set; }
73
-        public string Owner { get; set; }
74 74
         public ResortDto Resort { get; set; }
75 75
         public RegionDto Region { get; set; }
76 76
         public StatusDto Status { get; set; }
77
-        public int Bedrooms { get; set; }
78
-        public int MaxSleep { get; set; }
79 77
         public string UnitNumber { get; set; }
80 78
         public string WeekNumber { get; set; }
79
+        public string Agency { get; set; }
80
+        public string Agent { get; set; }
81
+        public string Owner { get; set; }
82
+        public bool AgentAsRep { get; set; }
83
+        public bool OtherResort { get; set; }
84
+        public int Bedrooms { get; set; }
85
+        public int MaxSleep { get; set; }
81 86
         public double LevyAmount { get; set; }
82 87
         public bool CurrentYearBanked { get; set; }
83 88
         public string BankedWith { get; set; }
84 89
         public DateTime ArrivalDate { get; set; }
85 90
         public DateTime DepartureDate { get; set; }
86 91
         public double SellPrice { get; set; }
92
+        public bool IsTender { get; set; }
93
+        public bool ReferedByAgent { get; set; }
94
+
95
+        public string Display => $"{Resort.Display}  ({ArrivalDate.ToShortDateString()} - {DepartureDate.ToShortDateString()})";
87 96
     }
88 97
 }

+ 2
- 0
UnivateProperties_API/Context/DataContext.cs 파일 보기

@@ -169,6 +169,8 @@ namespace UnivateProperties_API.Context
169 169
             modelBuilder.Entity<BidItem>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
170 170
             modelBuilder.Entity<ProcessFlow>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
171 171
             modelBuilder.Entity<Template>().HasQueryFilter(m => EF.Property<bool>(m, "IsDeleted") == false);
172
+
173
+            
172 174
         }
173 175
     }
174 176
 }

+ 1
- 4
UnivateProperties_API/Controllers/Timeshare/TimeshareWeekController.cs 파일 보기

@@ -1,7 +1,4 @@
1 1
 using Microsoft.AspNetCore.Mvc;
2
-using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5 2
 using System.Transactions;
6 3
 using UnivateProperties_API.Containers.Timeshare;
7 4
 using UnivateProperties_API.Model.Timeshare;
@@ -31,7 +28,7 @@ namespace UnivateProperties_API.Controllers.Timeshare
31 28
         [HttpGet("{id}")]
32 29
         public IActionResult Get(int id)
33 30
         {
34
-            var item = _Repo.Get(x => x.Id == id);
31
+            var item = (_Repo as WeekRepository).GetMyDetailed(x => x.Id == id);
35 32
             return new OkObjectResult(item);
36 33
         }
37 34
 

+ 1233
- 0
UnivateProperties_API/Migrations/20191021143440_MappingBank.Designer.cs
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 128
- 0
UnivateProperties_API/Migrations/20191021143440_MappingBank.cs 파일 보기

@@ -0,0 +1,128 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class MappingBank : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.DropForeignKey(
10
+                name: "FK_BankAccounts_Banks_BankId",
11
+                table: "BankAccounts");
12
+
13
+            migrationBuilder.AddColumn<string>(
14
+                name: "Video",
15
+                table: "Properties",
16
+                nullable: true);
17
+
18
+            migrationBuilder.AddColumn<string>(
19
+                name: "VirtualTour",
20
+                table: "Properties",
21
+                nullable: true);
22
+
23
+            migrationBuilder.AddColumn<int>(
24
+                name: "BankAccountId",
25
+                table: "Individuals",
26
+                nullable: true);
27
+
28
+            migrationBuilder.AlterColumn<int>(
29
+                name: "BankId",
30
+                table: "BankAccounts",
31
+                nullable: true,
32
+                oldClrType: typeof(int));
33
+
34
+            migrationBuilder.AddColumn<int>(
35
+                name: "OwnerId",
36
+                table: "Addresses",
37
+                nullable: true);
38
+
39
+            migrationBuilder.CreateIndex(
40
+                name: "IX_Individuals_BankAccountId",
41
+                table: "Individuals",
42
+                column: "BankAccountId");
43
+
44
+            migrationBuilder.CreateIndex(
45
+                name: "IX_Addresses_OwnerId",
46
+                table: "Addresses",
47
+                column: "OwnerId");
48
+
49
+            migrationBuilder.AddForeignKey(
50
+                name: "FK_Addresses_Individuals_OwnerId",
51
+                table: "Addresses",
52
+                column: "OwnerId",
53
+                principalTable: "Individuals",
54
+                principalColumn: "Id",
55
+                onDelete: ReferentialAction.Restrict);
56
+
57
+            migrationBuilder.AddForeignKey(
58
+                name: "FK_BankAccounts_Banks_BankId",
59
+                table: "BankAccounts",
60
+                column: "BankId",
61
+                principalTable: "Banks",
62
+                principalColumn: "Id",
63
+                onDelete: ReferentialAction.Restrict);
64
+
65
+            migrationBuilder.AddForeignKey(
66
+                name: "FK_Individuals_BankAccounts_BankAccountId",
67
+                table: "Individuals",
68
+                column: "BankAccountId",
69
+                principalTable: "BankAccounts",
70
+                principalColumn: "Id",
71
+                onDelete: ReferentialAction.Restrict);
72
+        }
73
+
74
+        protected override void Down(MigrationBuilder migrationBuilder)
75
+        {
76
+            migrationBuilder.DropForeignKey(
77
+                name: "FK_Addresses_Individuals_OwnerId",
78
+                table: "Addresses");
79
+
80
+            migrationBuilder.DropForeignKey(
81
+                name: "FK_BankAccounts_Banks_BankId",
82
+                table: "BankAccounts");
83
+
84
+            migrationBuilder.DropForeignKey(
85
+                name: "FK_Individuals_BankAccounts_BankAccountId",
86
+                table: "Individuals");
87
+
88
+            migrationBuilder.DropIndex(
89
+                name: "IX_Individuals_BankAccountId",
90
+                table: "Individuals");
91
+
92
+            migrationBuilder.DropIndex(
93
+                name: "IX_Addresses_OwnerId",
94
+                table: "Addresses");
95
+
96
+            migrationBuilder.DropColumn(
97
+                name: "Video",
98
+                table: "Properties");
99
+
100
+            migrationBuilder.DropColumn(
101
+                name: "VirtualTour",
102
+                table: "Properties");
103
+
104
+            migrationBuilder.DropColumn(
105
+                name: "BankAccountId",
106
+                table: "Individuals");
107
+
108
+            migrationBuilder.DropColumn(
109
+                name: "OwnerId",
110
+                table: "Addresses");
111
+
112
+            migrationBuilder.AlterColumn<int>(
113
+                name: "BankId",
114
+                table: "BankAccounts",
115
+                nullable: false,
116
+                oldClrType: typeof(int),
117
+                oldNullable: true);
118
+
119
+            migrationBuilder.AddForeignKey(
120
+                name: "FK_BankAccounts_Banks_BankId",
121
+                table: "BankAccounts",
122
+                column: "BankId",
123
+                principalTable: "Banks",
124
+                principalColumn: "Id",
125
+                onDelete: ReferentialAction.Cascade);
126
+        }
127
+    }
128
+}

+ 1239
- 0
UnivateProperties_API/Migrations/20191022055635_AddedWeekProps.Designer.cs
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 41
- 0
UnivateProperties_API/Migrations/20191022055635_AddedWeekProps.cs 파일 보기

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

+ 31
- 3
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs 파일 보기

@@ -50,7 +50,7 @@ namespace UnivateProperties_API.Migrations
50 50
 
51 51
                     b.Property<string>("AccountNumber");
52 52
 
53
-                    b.Property<int>("BankId");
53
+                    b.Property<int?>("BankId");
54 54
 
55 55
                     b.Property<DateTime>("Created");
56 56
 
@@ -254,6 +254,8 @@ namespace UnivateProperties_API.Migrations
254 254
 
255 255
                     b.Property<string>("ModifiedBy");
256 256
 
257
+                    b.Property<int?>("OwnerId");
258
+
257 259
                     b.Property<string>("PostalCode");
258 260
 
259 261
                     b.Property<string>("Street");
@@ -264,6 +266,8 @@ namespace UnivateProperties_API.Migrations
264 266
 
265 267
                     b.HasKey("Id");
266 268
 
269
+                    b.HasIndex("OwnerId");
270
+
267 271
                     b.ToTable("Addresses");
268 272
                 });
269 273
 
@@ -412,6 +416,10 @@ namespace UnivateProperties_API.Migrations
412 416
 
413 417
                     b.Property<string>("Unit");
414 418
 
419
+                    b.Property<string>("Video");
420
+
421
+                    b.Property<string>("VirtualTour");
422
+
415 423
                     b.HasKey("Id");
416 424
 
417 425
                     b.HasIndex("AgencyId");
@@ -690,6 +698,8 @@ namespace UnivateProperties_API.Migrations
690 698
 
691 699
                     b.Property<bool>("AgentAsRep");
692 700
 
701
+                    b.Property<double>("AgentCommision");
702
+
693 703
                     b.Property<int?>("AgentId");
694 704
 
695 705
                     b.Property<DateTime>("ArrivalDate");
@@ -710,6 +720,8 @@ namespace UnivateProperties_API.Migrations
710 720
 
711 721
                     b.Property<double>("LevyAmount");
712 722
 
723
+                    b.Property<string>("Mandate");
724
+
713 725
                     b.Property<int>("MaxSleep");
714 726
 
715 727
                     b.Property<DateTime>("Modified");
@@ -724,6 +736,8 @@ namespace UnivateProperties_API.Migrations
724 736
 
725 737
                     b.Property<bool>("OtherResort");
726 738
 
739
+                    b.Property<string>("OtherResortName");
740
+
727 741
                     b.Property<int>("OwnerId");
728 742
 
729 743
                     b.Property<bool>("ReferedByAgent");
@@ -881,6 +895,8 @@ namespace UnivateProperties_API.Migrations
881 895
 
882 896
                     b.Property<int?>("AddressId");
883 897
 
898
+                    b.Property<int?>("BankAccountId");
899
+
884 900
                     b.Property<string>("CellNumber");
885 901
 
886 902
                     b.Property<string>("CompanyRegNumber");
@@ -913,6 +929,8 @@ namespace UnivateProperties_API.Migrations
913 929
 
914 930
                     b.HasIndex("AddressId");
915 931
 
932
+                    b.HasIndex("BankAccountId");
933
+
916 934
                     b.HasIndex("UserId");
917 935
 
918 936
                     b.HasIndex("Telephone", "CellNumber", "Email")
@@ -990,8 +1008,7 @@ namespace UnivateProperties_API.Migrations
990 1008
                 {
991 1009
                     b.HasOne("UnivateProperties_API.Model.Banks.Bank", "Bank")
992 1010
                         .WithMany()
993
-                        .HasForeignKey("BankId")
994
-                        .OnDelete(DeleteBehavior.Cascade);
1011
+                        .HasForeignKey("BankId");
995 1012
 
996 1013
                     b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
997 1014
                         .WithMany()
@@ -1022,6 +1039,13 @@ namespace UnivateProperties_API.Migrations
1022 1039
                         .OnDelete(DeleteBehavior.Cascade);
1023 1040
                 });
1024 1041
 
1042
+            modelBuilder.Entity("UnivateProperties_API.Model.Misc.Address", b =>
1043
+                {
1044
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
1045
+                        .WithMany()
1046
+                        .HasForeignKey("OwnerId");
1047
+                });
1048
+
1025 1049
             modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.BidItem", b =>
1026 1050
                 {
1027 1051
                     b.HasOne("UnivateProperties_API.Model.Users.Individual", "BidMaker")
@@ -1192,6 +1216,10 @@ namespace UnivateProperties_API.Migrations
1192 1216
                         .WithMany()
1193 1217
                         .HasForeignKey("AddressId");
1194 1218
 
1219
+                    b.HasOne("UnivateProperties_API.Model.Banks.BankAccount", "BankAccount")
1220
+                        .WithMany()
1221
+                        .HasForeignKey("BankAccountId");
1222
+
1195 1223
                     b.HasOne("UnivateProperties_API.Model.Users.User", "User")
1196 1224
                         .WithMany()
1197 1225
                         .HasForeignKey("UserId");

+ 5
- 2
UnivateProperties_API/Model/Banks/BankAccount.cs 파일 보기

@@ -1,4 +1,5 @@
1
-using UnivateProperties_API.Model.Users;
1
+using System.ComponentModel.DataAnnotations.Schema;
2
+using UnivateProperties_API.Model.Users;
2 3
 
3 4
 namespace UnivateProperties_API.Model.Banks
4 5
 {
@@ -7,7 +8,9 @@ namespace UnivateProperties_API.Model.Banks
7 8
         #region Properties
8 9
         public string AccountHolder { get; set; }
9 10
         public string AccountNumber { get; set; }
10
-        public int BankId { get; set; }
11
+        [ForeignKey("Bank")]
12
+        public int? BankId { get; set; }
13
+        [ForeignKey("Owner")]
11 14
         public int? OwnerId { get; set; }
12 15
         #endregion Properties
13 16
 

+ 3
- 1
UnivateProperties_API/Model/BaseEntity.cs 파일 보기

@@ -7,7 +7,7 @@ using UnivateProperties_API.Containers;
7 7
 
8 8
 namespace UnivateProperties_API.Model
9 9
 {
10
-    public class BaseEntity
10
+    public class BaseEntity : IDisplay
11 11
     {
12 12
         #region Properties
13 13
         [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -19,6 +19,8 @@ namespace UnivateProperties_API.Model
19 19
         [NotMapped]
20 20
         public ValidateEntity Valid { get; set; }
21 21
         public bool IsDeleted { get; set; } = false;
22
+        [NotMapped]
23
+        public virtual string Display { get { return ToString(); } }
22 24
         #endregion
23 25
 
24 26
         #region Methods

+ 6
- 4
UnivateProperties_API/Model/Misc/Address.cs 파일 보기

@@ -1,7 +1,5 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Threading.Tasks;
1
+using System.ComponentModel.DataAnnotations.Schema;
2
+using UnivateProperties_API.Model.Users;
5 3
 
6 4
 namespace UnivateProperties_API.Model.Misc
7 5
 {
@@ -12,5 +10,9 @@ namespace UnivateProperties_API.Model.Misc
12 10
         public string Suburb { get; set; }
13 11
         public string City { get; set; }
14 12
         public string PostalCode { get; set; }
13
+        [ForeignKey("Owner")]
14
+        public int? OwnerId { get; set; }
15
+
16
+        public virtual Individual Owner { get; set; }
15 17
     }
16 18
 }

+ 5
- 1
UnivateProperties_API/Model/ProcessFlow/ProcessFlow.cs 파일 보기

@@ -1,11 +1,15 @@
1
-using UnivateProperties_API.Model.Timeshare;
1
+using System.ComponentModel.DataAnnotations.Schema;
2
+using UnivateProperties_API.Model.Timeshare;
2 3
 
3 4
 namespace UnivateProperties_API.Model.ProcessFlow
4 5
 {
5 6
     public class ProcessFlow : BaseEntity
6 7
     {
8
+        [ForeignKey("Timeshare")]
7 9
         public int? TimeshareID { get; set; }
10
+        [ForeignKey("Property")]
8 11
         public int? PropertyID { get; set; }
12
+        [ForeignKey("Status")]
9 13
         public int StatusID { get; set; }
10 14
 
11 15
 

+ 1
- 0
UnivateProperties_API/Model/Timeshare/Status.cs 파일 보기

@@ -5,5 +5,6 @@
5 5
         public string Code { get; set; }
6 6
         public string Description { get; set; }
7 7
         public StatusType StatusType { get; set; }
8
+        public override string Display => $"{Description} ({Code})";
8 9
     }
9 10
 }

+ 21
- 0
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs 파일 보기

@@ -1,6 +1,7 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.ComponentModel.DataAnnotations.Schema;
4
+using UnivateProperties_API.Containers.Timeshare;
4 5
 using UnivateProperties_API.Model.ProcessFlow;
5 6
 using UnivateProperties_API.Model.Region;
6 7
 using UnivateProperties_API.Model.Users;
@@ -9,6 +10,23 @@ namespace UnivateProperties_API.Model.Timeshare
9 10
 {
10 11
     public class TimeshareWeek : BaseEntity
11 12
     {
13
+        TimeshareWeek()
14
+        {
15
+
16
+        }
17
+
18
+        TimeshareWeek(WeekDto week)
19
+        {
20
+            ReferedByAgent = week.ReferedByAgent;
21
+            AgentAsRep = false;
22
+            ResortCode = week.Resort.ResortCode;
23
+            ResortName = week.Resort.ResortName;
24
+            RegionId = week.Region.Id;
25
+            Bedrooms = week.Bedrooms;
26
+            MaxSleep = week.MaxSleep;
27
+            UnitNumber = week.UnitNumber;
28
+        }
29
+
12 30
         #region Properties
13 31
         public bool ReferedByAgent { get; set; }
14 32
         [ForeignKey("Agent")]
@@ -20,6 +38,7 @@ namespace UnivateProperties_API.Model.Timeshare
20 38
 
21 39
         public bool AgentAsRep { get; set; }
22 40
         public bool OtherResort { get; set; }
41
+        public string OtherResortName { get; set; }
23 42
         public string ResortCode { get; set; }
24 43
         public string ResortName { get; set; }
25 44
         [ForeignKey("Region")]
@@ -43,6 +62,8 @@ namespace UnivateProperties_API.Model.Timeshare
43 62
         public DateTime DepartureDate { get; set; }
44 63
         
45 64
         public double SellPrice { get; set; }
65
+        public double AgentCommision { get; set; }
66
+        public string Mandate { get; set; }
46 67
 
47 68
         [ForeignKey("Status")]
48 69
         public int StatusId { get; set; }

+ 6
- 1
UnivateProperties_API/Model/Users/Individual.cs 파일 보기

@@ -1,6 +1,7 @@
1 1
 using System.Collections.Generic;
2 2
 using System.ComponentModel.DataAnnotations;
3 3
 using System.ComponentModel.DataAnnotations.Schema;
4
+using UnivateProperties_API.Model.Banks;
4 5
 using UnivateProperties_API.Model.Misc;
5 6
 using UnivateProperties_API.Model.Properties;
6 7
 
@@ -19,10 +20,14 @@ namespace UnivateProperties_API.Model.Users
19 20
         public string IdNumber { get; set; }
20 21
         public string CompanyRegNumber { get; set; }
21 22
         public string MaritalStatus { get; set; }
23
+        [ForeignKey("Address")]
22 24
         public int? AddressId { get; set; }
23 25
         public string IncomeTaxNumber { get; set; }
24
-        public virtual Address Address { get; set; }
26
+        [ForeignKey("BankAccount")]
27
+        public int? BankAccountId { get; set; }
25 28
 
29
+        public virtual Address Address { get; set; }
30
+        public virtual BankAccount BankAccount { get; set; }
26 31
         public virtual ICollection<Property> Properties { get; set; }
27 32
         #endregion Properties
28 33
     }

+ 59
- 17
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs 파일 보기

@@ -7,6 +7,7 @@ using System.Linq;
7 7
 using System.Net;
8 8
 using System.Text;
9 9
 using UnivateProperties_API.Containers.Timeshare;
10
+using UnivateProperties_API.Containers.Timeshare.Detailed;
10 11
 using UnivateProperties_API.Containers.Users;
11 12
 using UnivateProperties_API.Context;
12 13
 using UnivateProperties_API.Helpers;
@@ -43,6 +44,16 @@ namespace UnivateProperties_API.Repository.Timeshare
43 44
             return item;
44 45
         }
45 46
 
47
+        public DetailedWeekDto GetMyDetailed(Func<TimeshareWeek, bool> first)
48
+        {
49
+            var item = GetDetailed(first);
50
+            if(item != null)
51
+            {
52
+                return new DetailedWeekDto(item);
53
+            }
54
+            return null;
55
+        }
56
+
46 57
         public List<WeekDto> GetDtoListAll()
47 58
         {
48 59
             List<WeekDto> list = new List<WeekDto>();
@@ -71,24 +82,36 @@ namespace UnivateProperties_API.Repository.Timeshare
71 82
             }
72 83
             else if (user.IsUserInRole(Role.Agency))
73 84
             {
74
-                foreach (var item in GetDetailedAll().Where(x => x.AgencyId == userId))
85
+                var agent = _dbContext.Agents.FirstOrDefault(x => x.UserId == userId);
86
+                if(agent != null)
75 87
                 {
76
-                    list.Add(new WeekDto(item));
77
-                }
88
+                    foreach (var item in GetDetailedAll().Where(x => x.AgencyId == agent.AgencyId))
89
+                    {
90
+                        list.Add(new WeekDto(item));
91
+                    }
92
+                }                
78 93
             }
79 94
             else if (user.IsUserInRole(Role.Agent) || user.IsUserInRole(Role.ManagingAgent))
80 95
             {
81
-                foreach (var item in GetDetailedAll().Where(x => x.AgentId == userId))
96
+                var agent = _dbContext.Agents.FirstOrDefault(x => x.UserId == userId);
97
+                if(agent != null)
82 98
                 {
83
-                    list.Add(new WeekDto(item));
99
+                    foreach (var item in GetDetailedAll().Where(x => x.AgentId == agent.Id))
100
+                    {
101
+                        list.Add(new WeekDto(item));
102
+                    }
84 103
                 }
85 104
             }
86 105
             else
87 106
             {
88
-                foreach (var item in GetDetailedAll().Where(x => x.OwnerId == userId))
107
+                var individual = _dbContext.Individuals.FirstOrDefault(x => x.UserId == userId);
108
+                if(individual != null)
89 109
                 {
90
-                    list.Add(new WeekDto(item));
91
-                }
110
+                    foreach (var item in GetDetailedAll().Where(x => x.OwnerId == userId))
111
+                    {
112
+                        list.Add(new WeekDto(item));
113
+                    }
114
+                }                
92 115
             }
93 116
             return list;
94 117
         }
@@ -96,18 +119,18 @@ namespace UnivateProperties_API.Repository.Timeshare
96 119
         public List<RegionDto> GetAvailResort()
97 120
         {
98 121
             List<RegionDto> list = new List<RegionDto>();
99
-            var allItems = GetDetailedAll();
122
+            var allItems = GetDtoListAll();
100 123
             foreach (var item in allItems)
101 124
             {
102 125
                 if (item.Region != null)
103 126
                 {
104
-                    if (!list.Any(x => x.RegionCode == item.Region.Code))
127
+                    if (!list.Any(x => x.RegionCode == item.Region.RegionCode))
105 128
                     {
106
-                        list.Add(new RegionDto(item.Region.Code, item.Region.Description));
129
+                        list.Add(new RegionDto(item.Region.RegionCode, item.Region.RegionName));
107 130
                     }
108
-                    foreach (var i in list.Where(x => x.RegionCode == item.Region.Code))
131
+                    foreach (var i in list.Where(x => x.RegionCode == item.Region.RegionCode))
109 132
                     {
110
-                        i.TryAddResort(item.ResortCode, item.ResortName);
133
+                        i.TryAddResort(item.Resort.ResortCode, item.Resort.ResortName);
111 134
                     }
112 135
                 }
113 136
             }
@@ -117,7 +140,7 @@ namespace UnivateProperties_API.Repository.Timeshare
117 140
                 region.OrderResorts();
118 141
                 foreach (var resort in region.Resorts)
119 142
                 {
120
-                    resort.Available = allItems.Count(x => x.ResortCode == resort.ResortCode);
143
+                    resort.Available = allItems.Count(x => x.Resort.ResortCode == resort.ResortCode);
121 144
                 }
122 145
             }
123 146
             return list;
@@ -192,7 +215,13 @@ namespace UnivateProperties_API.Repository.Timeshare
192 215
                 };
193 216
             }
194 217
             item.Id = NewId();
218
+            UnivateProperties_API.Model.ProcessFlow.ProcessFlow flowItem = new Model.ProcessFlow.ProcessFlow()
219
+            {
220
+                Status = item.Status,
221
+                Timeshare = item
222
+            };
195 223
             _dbContext.Add(item);
224
+            _dbContext.Add(flowItem);
196 225
             Save();
197 226
         }
198 227
 
@@ -282,6 +311,12 @@ namespace UnivateProperties_API.Repository.Timeshare
282 311
             return id;
283 312
         }
284 313
 
314
+        private int _TenderId = 10000;
315
+        private int GetTenderId()
316
+        {
317
+            return _TenderId++;
318
+        }
319
+
285 320
         private List<WeekDto> GetTenderWeeks()
286 321
         {
287 322
             List<WeekDto> list = new List<WeekDto>();
@@ -299,8 +334,10 @@ namespace UnivateProperties_API.Repository.Timeshare
299 334
                     foreach (string line in lines)
300 335
                     {
301 336
                         cleanLine = line.Replace("<br>", "");
302
-                        cleanLine = line.Replace("<br/>", "");
303
-                        list.Add(new WeekDto(cleanLine));
337
+                        cleanLine = cleanLine.Replace("<br >", "");
338
+                        cleanLine = cleanLine.Replace("<br/>", "");
339
+                        cleanLine = cleanLine.Replace("<br />", "");
340
+                        list.Add(new WeekDto(GetTenderId(),cleanLine));
304 341
                     }
305 342
                 }
306 343
             }
@@ -320,7 +357,10 @@ namespace UnivateProperties_API.Repository.Timeshare
320 357
             foreach(var item in list)
321 358
             {
322 359
                 prov = province.GetDetailed(x => x.Code == item.Region.RegionCode);
323
-                item.Region = new RegionDto(prov.Id, prov.Code, prov.Description);
360
+                if(prov != null)
361
+                {
362
+                    item.Region = new RegionDto(prov.Id, prov.Code, prov.Description);
363
+                }                
324 364
             }
325 365
             return list;
326 366
         }
@@ -331,6 +371,8 @@ namespace UnivateProperties_API.Repository.Timeshare
331 371
             {
332 372
                 case "FN":
333 373
                     return "KZN";
374
+                case "L":
375
+                    return "LI";
334 376
                 default:
335 377
                     return value;
336 378
             }

Loading…
취소
저장