Lene hace 4 años
padre
commit
3bd8055cfa

+ 1
- 0
UnivateProperties_API/Containers/Property/GroupFields.cs Ver fichero

@@ -8,6 +8,7 @@
8 8
         public string Type { get; set; }
9 9
         public string Value { get; set; }                        
10 10
         public int ItemID { get; set; }
11
+        public int Rank { get; set; }
11 12
         #endregion
12 13
     }
13 14
 }

+ 3
- 0
UnivateProperties_API/Containers/Property/PropertyContainer.cs Ver fichero

@@ -13,6 +13,9 @@ namespace UnivateProperties_API.Containers.Property
13 13
         public string SalesTypeString { get; set; }
14 14
         public int UserId { get; set; }
15 15
         public string PropertyUsageType { get; set; }
16
+        public decimal OldPrice { get; set; }        
17
+        public string OldStatus { get; set; }
18
+        public string CutOffDisplayDateString { get; set; }
16 19
         public List<NewImage> NewImages { get; set; }
17 20
         public List<PropertyFieldGroup> PropertyOverviewFields { get; set; }
18 21
         public List<PropertyFieldGroup> PropertyFields { get; set; }

+ 2
- 2
UnivateProperties_API/Containers/Property/PropertyDisplay.cs Ver fichero

@@ -34,8 +34,8 @@ namespace UnivateProperties_API.Containers.Property
34 34
         public decimal Price { get; set; }        
35 35
         public DateTime DateCreated { get; set; }
36 36
         public DateTime DateAvailable { get; set; }
37
-        public string Available { get; set; }
38
-        public bool HasPendingOffer { get; set; }
37
+        public string DisplayColor { get; set; }
38
+        public string DisplayText { get; set; }
39 39
         #endregion
40 40
     }
41 41
 }

+ 70
- 1
UnivateProperties_API/Containers/Timeshare/ResortDisplay.cs Ver fichero

@@ -1,4 +1,6 @@
1
-namespace UnivateProperties_API.Containers.Timeshare
1
+using System.Collections.Generic;
2
+
3
+namespace UnivateProperties_API.Containers.Timeshare
2 4
 {
3 5
     public class ResortDisplay
4 6
     {
@@ -7,4 +9,71 @@
7 9
         public string ResortImage { get; set; }
8 10
         public int WeeksAvailable { get; set; }
9 11
     }
12
+
13
+    public class ResortData : GoMeloResort
14
+    {
15
+        public string Layout { get; set; }
16
+        public string Description { get; set; }        
17
+        public List<string> Images { get; set; }
18
+    }
19
+
20
+    public class GoMeloResort
21
+    {
22
+        public int PrIdx { get; set; }
23
+        public string PrProductIndex { get; set; }
24
+        public string PrProdType { get; set; }
25
+        public string PrName { get; set; }
26
+        public string PrPostAdd1 { get; set; }
27
+        public Coords PrPostAdd2 { get; set; }
28
+        public string PrPostTown { get; set; }
29
+        public string PrPostCountry { get; set; }
30
+        public string PrPostCode { get; set; }
31
+        public string PrStreetAdd1 { get; set; }
32
+        public string PrStreetAdd2 { get; set; }
33
+        public string PrStreetTown { get; set; }
34
+        public string PrStreetCountry { get; set; }
35
+        public string PrStreetCode { get; set; }
36
+        public string PrLastDate { get; set; }
37
+        public string PrManager { get; set; }
38
+        public string PrReservations { get; set; }
39
+        public string PrStartDate { get; set; }
40
+        public string PrStartYear { get; set; }
41
+        public string PrEndDate { get; set; }
42
+        public string PrNoYears { get; set; }
43
+        public string PrIntervals { get; set; }
44
+        public int PrIntervalWe { get; set; }
45
+        public int PrIntervalMw { get; set; }
46
+        public string PrRegion { get; set; }
47
+        public string PrCity { get; set; }
48
+        public string PrProvince { get; set; }
49
+        public string PrCheckin { get; set; }
50
+        public string PrCheckout { get; set; }
51
+        public string PrCheckInDay { get; set; }
52
+        public string PrNotes { get; set; }
53
+        public string PrDirections { get; set; }
54
+        public string PrUnitFacilities { get; set; }
55
+        public string PrAttractions { get; set; }
56
+        public string PrAlerts { get; set; }
57
+        public string PrManaged { get; set; }
58
+        public string PrCountry { get; set; }
59
+        public string PrWww { get; set; }
60
+        public string PrManAgent { get; set; }
61
+        public string PrImagePath { get; set; }
62
+        public string PrRciaffiliated { get; set; }
63
+        public string PrSelfCatering { get; set; }
64
+        public string PrLatitude { get; set; }
65
+        public string PrLongitude { get; set; }
66
+        public string PrAirport { get; set; }
67
+        public int PrAirportDistance { get; set; }
68
+        public string PrStadium { get; set; }
69
+        public int PrStadiumDistance { get; set; }
70
+        public string PrWcCity { get; set; }
71
+        public int PrWcCityDistance { get; set; }
72
+    }
73
+
74
+    public class Coords
75
+    {
76
+        public string Lat { get; set; }
77
+        public string Long { get; set; }
78
+    }
10 79
 }

+ 6
- 0
UnivateProperties_API/Controllers/Timeshare/ResortController.cs Ver fichero

@@ -37,5 +37,11 @@ namespace UnivateProperties_API.Controllers.Timeshare
37 37
         {
38 38
             return new OkObjectResult(_Repo.GetResortImages(code));
39 39
         }
40
+
41
+        [HttpGet("GetResortData/{code}")]
42
+        public IActionResult GetResortData(string code)
43
+        {
44
+            return new OkObjectResult(_Repo.GetResortData(code));
45
+        }
40 46
     }
41 47
 }

+ 1
- 1
UnivateProperties_API/Helpers/TenderWeeksHelper.cs Ver fichero

@@ -56,5 +56,5 @@ namespace UnivateProperties_API.Helpers
56 56
         public string Town { get; set; }
57 57
         public string City { get; set; }
58 58
         public int Id { get; set; }
59
-    }
59
+    }    
60 60
 }

+ 1623
- 0
UnivateProperties_API/Migrations/20200914092358_Update.Designer.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 17
- 0
UnivateProperties_API/Migrations/20200914092358_Update.cs Ver fichero

@@ -0,0 +1,17 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class Update : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+
10
+        }
11
+
12
+        protected override void Down(MigrationBuilder migrationBuilder)
13
+        {
14
+
15
+        }
16
+    }
17
+}

+ 1625
- 0
UnivateProperties_API/Migrations/20200917125427_priceredused.Designer.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 23
- 0
UnivateProperties_API/Migrations/20200917125427_priceredused.cs Ver fichero

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

+ 1627
- 0
UnivateProperties_API/Migrations/20200918092143_Added Cutoff show date.Designer.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 24
- 0
UnivateProperties_API/Migrations/20200918092143_Added Cutoff show date.cs Ver fichero

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

+ 4
- 0
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs Ver fichero

@@ -670,6 +670,8 @@ namespace UnivateProperties_API.Migrations
670 670
 
671 671
                     b.Property<DateTime>("Created");
672 672
 
673
+                    b.Property<DateTime>("CutOffDisplayDate");
674
+
673 675
                     b.Property<DateTime>("DateAvailable");
674 676
 
675 677
                     b.Property<DateTime>("DatePublished");
@@ -694,6 +696,8 @@ namespace UnivateProperties_API.Migrations
694 696
 
695 697
                     b.Property<string>("PricePer");
696 698
 
699
+                    b.Property<bool>("PriceRedused");
700
+
697 701
                     b.Property<string>("PropertCoords");
698 702
 
699 703
                     b.Property<string>("PropertyName");

+ 1
- 1
UnivateProperties_API/Model/Communication/Email.cs Ver fichero

@@ -47,7 +47,7 @@ namespace UnivateProperties_API.Model.Communication
47 47
                     SenderId = template.SenderId.Value;
48 48
                 }
49 49
                 Sender = template.Sender;
50
-                To = "jplouw@provision-sa.com"; // sendTo.Email;
50
+                To = "abigaildf@provision-sa.com"; // sendTo.Email;
51 51
                 ToDisplay = sendTo.FullName;
52 52
                 /*BCC = ConcatEmails(template.AgentBCC, template.IndividualBCC);*/
53 53
                 IsBodyHtml = true;

+ 5
- 17
UnivateProperties_API/Model/Properties/Property.cs Ver fichero

@@ -38,23 +38,10 @@ namespace UnivateProperties_API.Model.Properties
38 38
         public bool Published { get; set; }
39 39
         public DateTime DatePublished { get; set; }
40 40
         public string VirtualTour { get; set; }
41
+        public bool PriceRedused { get; set; }
41 42
         public string Video { get; set; }
42 43
         [ForeignKey("Status")]
43
-        public int? StatusId 
44
-        { 
45
-            get
46
-            {
47
-                return _StatusID;
48
-            }
49
-            set
50
-            {
51
-                _StatusID = value;
52
-                if (value != null)
53
-                {
54
-                    StatusDate = DateTime.Now;
55
-                }
56
-            }
57
-        }
44
+        public int? StatusId { get; set; }       
58 45
         [ForeignKey("Owner")]
59 46
         public int? OwnerId { get; set; }
60 47
         [ForeignKey("Agent")]
@@ -66,9 +53,10 @@ namespace UnivateProperties_API.Model.Properties
66 53
         public virtual PropertyType PropertyType { get; set; }            
67 54
         [NotMapped]
68 55
         public Status Status { get; set; }        
69
-        public virtual Individual Owner { get; set; }        
70
-        public virtual Agent Agent { get; set; }        
56
+        public virtual Individual Owner { get; set; }
57
+        public virtual Agent Agent { get; set; }
71 58
         public virtual Agency Agency { get; set; }
59
+        public DateTime CutOffDisplayDate { get; set; }        
72 60
 
73 61
         public ICollection<PropertyUserField> PropertyUserFields { get; set; }
74 62
         public ICollection<PropertyImage> PropertyImages { get; set; }

+ 1
- 1
UnivateProperties_API/Repository/Financial/PaygateRepository.cs Ver fichero

@@ -36,7 +36,7 @@ namespace UnivateProperties_API.Repository.Financial
36 36
 
37 37
             string amm = Math.Round((total * 100)).ToString();
38 38
             string currenc = "ZAR";
39
-            string retUrl = "http://localhost:57260/api/redirect";
39
+            string retUrl = "http://training.provision-sa.com:82/api/redirect";
40 40
             string transDate = utcDate;
41 41
             string loc = "en-za";
42 42
             string count = "ZAF";

+ 86
- 36
UnivateProperties_API/Repository/Properties/PropertyRepository.cs Ver fichero

@@ -114,22 +114,18 @@ namespace UnivateProperties_API.Repository.Properties
114 114
 
115 115
                         foreach (var val in groupFields)
116 116
                         {
117
-                            var item = new PropertyDetail()
117
+                            if (!string.IsNullOrEmpty(val.Value))
118 118
                             {
119
-                                Name = val.FieldName,
120
-                                Description = val.Description
121
-                            };
122
-
123
-                            detailGroup.Values.Add(item);
124
-
125
-                            //if (!string.IsNullOrEmpty(val.Value) && (val.FieldName == "Erf Size" || val.FieldName == "Floor Size") && val.Value.EndsWith("2"))
126
-                            //{
127
-                            //    item.Value = val.Value.Substring(0, val.Value.Length - 1) + "<sup>" + val.Value.Last() + "</sup>";
128
-                            //}
129
-                            //else
130
-                                item.Value = val.Value;
119
+                                var item = new PropertyDetail()
120
+                                {
121
+                                    Name = val.FieldName,
122
+                                    Description = val.Description,
123
+                                    Value = val.Value
124
+                                };
125
+
126
+                                detailGroup.Values.Add(item);
127
+                            }
131 128
                         }
132
-
133 129
                         property.DisplayData.Add(detailGroup);
134 130
                     }
135 131
                 }
@@ -142,7 +138,8 @@ namespace UnivateProperties_API.Repository.Properties
142 138
 
143 139
             var propertyDetails = new PropertyContainer();
144 140
 
145
-            propertyDetails.SalesTypeString = property.IsSale ? "Sale" : "Rental";            
141
+            propertyDetails.SalesTypeString = property.IsSale ? "Sale" : "Rental";
142
+            propertyDetails.OldPrice = property.Price;
146 143
 
147 144
             foreach (string prop in property.GetAllProperties())
148 145
             {
@@ -151,7 +148,10 @@ namespace UnivateProperties_API.Repository.Properties
151 148
             }
152 149
 
153 150
             if (property.StatusId != null)
151
+            {
154 152
                 propertyDetails.StatusString = dBContext.Status.Where(s => s.Id == property.StatusId).FirstOrDefault()?.Description;
153
+                propertyDetails.OldStatus = propertyDetails.StatusString;
154
+            }
155 155
 
156 156
             propertyDetails.PropertyUsageType = propertyType.UsageType == PropertyUsageType.Commercial ? "Commercial" : "Residential";
157 157
 
@@ -161,7 +161,14 @@ namespace UnivateProperties_API.Repository.Properties
161 161
                 propertyDetails.UserId = (dBContext.Agents.Where(p => p.Id == property.AgentId).FirstOrDefault().UserId).Value;
162 162
 
163 163
             propertyDetails.NewImages = new List<NewImage>();
164
-            propertyDetails.DateAvailableString = string.Format("{0:yyyy-MM-dd}", property.DateAvailable);
164
+
165
+            if (property.DateAvailable != DateTime.MinValue)
166
+                propertyDetails.DateAvailableString = string.Format("{0:yyyy-MM-dd}", property.DateAvailable);
167
+
168
+            if (property.CutOffDisplayDate == DateTime.MinValue)
169
+                propertyDetails.CutOffDisplayDateString = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddMonths(1));
170
+            else
171
+                propertyDetails.CutOffDisplayDateString = string.Format("{0:yyyy-MM-dd}", property.CutOffDisplayDate);
165 172
 
166 173
             return propertyDetails;
167 174
         }
@@ -229,14 +236,34 @@ namespace UnivateProperties_API.Repository.Properties
229 236
             {
230 237
                 if (prop != "Item" && prop != "Display")
231 238
                     property[prop] = item[prop];
232
-            }
239
+            }            
233 240
 
234 241
             property.PropertyUserFields = null;
235 242
             property.PropertyImages = null;
236 243
 
244
+            if (item.Price < item.OldPrice)
245
+            {
246
+                property.PriceRedused = true;
247
+            }            
248
+
237 249
             if (!string.IsNullOrEmpty(item.StatusString))
238 250
             {
251
+                if (item.StatusString != item.OldStatus)
252
+                    property.StatusDate = DateTime.Now;
253
+
239 254
                 property.StatusId = dBContext.Status.Where(s => s.Description == item.StatusString && s.StatusType == StatusType.Property).FirstOrDefault()?.Id;
255
+                if ((item.StatusString.ToUpper() == "RENTED OUT" || item.StatusString.ToUpper() == "SOLD") && item.StatusString != item.OldStatus)  
256
+                {
257
+                    property.CutOffDisplayDate = DateTime.Now.AddMonths(1);
258
+                }
259
+                else
260
+                {
261
+                    property.CutOffDisplayDate = DateTime.MinValue;
262
+                }
263
+                if (item.StatusString.ToUpper() == "FOR SALE")
264
+                    property.IsSale = true;
265
+                if (item.StatusString.ToUpper() == "FOR RENT")
266
+                    property.IsSale = false;
240 267
             }
241 268
 
242 269
             if (!string.IsNullOrEmpty(item.DateAvailableString))
@@ -539,8 +566,7 @@ namespace UnivateProperties_API.Repository.Properties
539 566
                 PropertyDisplay display = new PropertyDisplay
540 567
                 {
541 568
                     PropertyReference = item.PropertyRef,
542
-                    DateAvailable = item.DateAvailable,
543
-                    Available = item.DateAvailable.Date > DateTime.Now.Date ? string.Format("Available form: {0: dd MMM yyyy}", item.DateAvailable) : "Available Now",
569
+                    DateAvailable = item.DateAvailable,                    
544 570
                     Id = item.Id,
545 571
                     ShortDescription = item.ShortDescription,
546 572
                     IsSale = item.IsSale,
@@ -576,29 +602,51 @@ namespace UnivateProperties_API.Repository.Properties
576 602
                     DateCreated = item.Created,
577 603
                     PropertyUsageType = (from p in dBContext.PropertyTypes
578 604
                                          where p.Id == item.PropertyTypeId
579
-                                         select p.UsageType.ToString()).FirstOrDefault(),
580
-                    HasPendingOffer = false
581
-                };                
605
+                                         select p.UsageType.ToString()).FirstOrDefault()
606
+                };
582 607
 
583
-                if (item.StatusId != null)
608
+                var status = dBContext.Status.Where(s => s.Id == item.StatusId).FirstOrDefault();
609
+                switch (status.Description.ToUpper())
584 610
                 {
585
-                    var status = dBContext.Status.Where(s => s.Id == item.StatusId).FirstOrDefault();
586
-                    if (status.Description.ToUpper() == "OFFER PENDING")
587
-                        display.HasPendingOffer = true;                    
611
+                    case "FOR RENT":
612
+                        if (item.DateAvailable < DateTime.Now)
613
+                        {
614
+                            display.DisplayText = "Available Now";
615
+                            display.DisplayColor = "green";
616
+                        }
617
+                        else
618
+                        {
619
+                            display.DisplayText = string.Format("Available From: {0:dd MMM yyyy}", item.DateAvailable);
620
+                            display.DisplayColor = "blue";
621
+                        }
622
+                        break;
623
+                    case "FOR SALE":
624
+                        if (item.PriceRedused)
625
+                        {
626
+                            display.DisplayText = "Price Redused";
627
+                            display.DisplayColor = "green";
628
+                        }
629
+                        else
630
+                        {
631
+                            display.DisplayText = "For Sale";
632
+                            display.DisplayColor = "blue";
633
+                        }
634
+                        break;
635
+                    case "OFFER PENDING":
636
+                        display.DisplayText = "Offer Pending";
637
+                        display.DisplayColor = "orange";
638
+                        break;
639
+                    default:
640
+                        display.DisplayText = status.Description;
641
+                        display.DisplayColor = "red";
642
+                        break;
643
+
588 644
                 }
589 645
 
590 646
                 if (display.DisplayImage != null && !display.DisplayImage.StartsWith("data:image"))
591 647
                 {
592 648
                     display.DisplayImage = ImageFormatter.ImageToBase64(display.DisplayImage);
593 649
                 }
594
-
595
-                //if (!string.IsNullOrEmpty(display.Area) && display.Area.EndsWith("2"))
596
-                //{
597
-                //    display.Area = display.Area.Substring(0, display.Area.Length - 1) + "<sup>" + display.Area.Last() + "</sup>";
598
-                //}
599
-
600
-                if (display.HasPendingOffer)
601
-                    display.Available = "Offer Pending";
602 650
 #if !ReturnImages
603 651
                 display.DisplayImage = "";
604 652
 #endif
@@ -621,7 +669,7 @@ namespace UnivateProperties_API.Repository.Properties
621 669
 
622 670
         public List<PropertyDisplay> GetLatestDisplay()
623 671
         {
624
-            List<Property> props = GetAll().Where(x => x.Published).OrderByDescending(x => x.DatePublished).Take(4).ToList();
672
+            List<Property> props = GetAll().Where(x => x.Published && (x.CutOffDisplayDate == DateTime.MinValue || x.CutOffDisplayDate.Date > DateTime.Now.Date)).OrderByDescending(x => x.DatePublished).Take(4).ToList();
625 673
             return GetDisplayDetails(props);
626 674
         }
627 675
 
@@ -638,7 +686,9 @@ namespace UnivateProperties_API.Repository.Properties
638 686
                     break;
639 687
             }
640 688
 
641
-            List<Property> props = dBContext.Properties.Include("PropertyType").Where(x => x.Published && x.PropertyType.UsageType == type).OrderByDescending(x => x.DatePublished).Take(4).ToList();
689
+            List<Property> props = dBContext.Properties.Include("PropertyType").Where(x => x.Published 
690
+                        && x.PropertyType.UsageType == type 
691
+                        && (x.CutOffDisplayDate == DateTime.MinValue || x.CutOffDisplayDate.Date > DateTime.Now.Date)).OrderByDescending(x => x.DatePublished).Take(4).ToList();
642 692
             return GetDisplayDetails(props);
643 693
         }
644 694
 

+ 6
- 1
UnivateProperties_API/Repository/Properties/UserDefinedGroupRepository.cs Ver fichero

@@ -136,9 +136,11 @@ namespace UnivateProperties_API.Repository.Properties
136 136
                         {
137 137
                             ID = field.Id,
138 138
                             Name = field.FieldName,
139
-                            Type = field.FieldType
139
+                            Type = field.FieldType,
140
+                            Rank = field.Rank
140 141
                         });
141 142
                     }
143
+                   
142 144
                 }
143 145
             }
144 146
 
@@ -204,6 +206,9 @@ namespace UnivateProperties_API.Repository.Properties
204 206
 
205 207
         public List<Group> GetSavedList(int PropertyId)
206 208
         {
209
+            if (PropertyId == 0)
210
+                return null;
211
+
207 212
             var prop = dBContext.Properties.Include("PropertyType").Where(p => p.Id == PropertyId).FirstOrDefault();
208 213
             var all = GetFieldListByPropType(prop.PropertyType.PropertyUsageType);
209 214
 

+ 55
- 0
UnivateProperties_API/Repository/Timeshare/IResortRepository.cs Ver fichero

@@ -15,6 +15,7 @@ namespace UnivateProperties_API.Repository.Timeshare
15 15
         List<ResortDisplay> GetResortsByRegion(string regionCode);
16 16
         string GetResortDescription(string resortCode);
17 17
         List<string> GetResortImages(string resortCode);
18
+        ResortData GetResortData(string resortCode);
18 19
     }
19 20
 
20 21
     public class ResortRepository : IResortRepository
@@ -151,5 +152,59 @@ namespace UnivateProperties_API.Repository.Timeshare
151 152
 
152 153
             return resorts.OrderBy(r => r.ResortCode).ToList();
153 154
         }
155
+
156
+        public ResortData GetResortData(string resortCode)
157
+        {             
158
+            #region Get Resort Data
159
+            var client = new RestClient(string.Format("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/TRESORT/{0}", resortCode))
160
+            {
161
+                Timeout = -1
162
+            };
163
+            var request = new RestRequest(Method.GET);
164
+            IRestResponse response = client.Execute(request);
165
+            ResortData data = JsonConvert.DeserializeObject<ResortData>(response.Content);
166
+            #endregion
167
+
168
+            #region Get Layout
169
+            client = new RestClient(string.Format("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/{0}/layout", resortCode))
170
+            {
171
+                Timeout = -1
172
+            };
173
+            request = new RestRequest(Method.GET);
174
+            response = client.Execute(request);
175
+            data.Layout = response.Content;
176
+            if (!string.IsNullOrEmpty(data.Layout))
177
+            {
178
+                data.Layout = "data:image/jpeg;base64," + data.Layout;
179
+            }
180
+            #endregion
181
+
182
+            #region GetImages
183
+            data.Images = GetResortImages(resortCode);
184
+            if (data.Images == null || data.Images.Count == 0)
185
+            {
186
+                data.Images = new List<string>();
187
+                int count = 1; 
188
+                while( count < 5)
189
+                {
190
+                    client = new RestClient(string.Format("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/{0}/image/{1}", resortCode, count))
191
+                    {
192
+                        Timeout = -1
193
+                    };
194
+                    request = new RestRequest(Method.GET);
195
+                    response = client.Execute(request);
196
+                    var img = string.Format("data:image/jpeg;base64,{0}", response.Content);
197
+                    data.Images.Add(img);
198
+                    count++;
199
+                }
200
+            }
201
+            #endregion
202
+
203
+            #region Get Description
204
+            data.Description = GetResortDescription(resortCode);            
205
+            #endregion
206
+
207
+            return data; 
208
+        }
154 209
     }
155 210
 }

Loading…
Cancelar
Guardar