Example #1
0
        public async Task <IActionResult> GetLastPropertyByOwnerId([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var owner = await _dataContext.Owners
                        .Include(o => o.Properties)
                        .ThenInclude(p => p.PropertyType)
                        .FirstOrDefaultAsync(o => o.Id == id);

            if (owner == null)
            {
                return(NotFound());
            }

            var property = owner.Properties.LastOrDefault();
            var response = new PropertyResponse
            {
                Address       = property.Address,
                HasParkingLot = property.HasParkingLot,
                Id            = property.Id,
                IsAvailable   = property.IsAvailable,
                Neighborhood  = property.Neighborhood,
                Price         = property.Price,
                PropertyType  = property.PropertyType.Name,
                Remarks       = property.Remarks,
                Rooms         = property.Rooms,
                SquareMeters  = property.SquareMeters,
                Stratum       = property.Stratum
            };

            return(Ok(response));
        }
Example #2
0
        public PropertyResponse Read(long ProID)
        {
            PropertyResponse response = new PropertyResponse();

            try
            {
                using (IDbConnection conn = GetConnection())
                {
                    response.property = conn.Get <Property>(ProID);
                    if (response.property != null)
                    {
                        response.Status      = true;
                        response.Description = "Successful";
                    }
                    else
                    {
                        response.Status      = false;
                        response.Description = "No data";
                    }
                }
            }
            catch (Exception ex)
            {
                response.Status      = false;
                response.Description = ex.Message;
            }
            return(response);
        }
 public Property Map(PropertyResponse property)
 {
     if (property == null)
     {
         return(null);
     }
     return(new Property {
         Name = property.Name,
         Value = property.Value
     });
 }
 private async void SelectProperty()
 {
     Settings.Property = JsonConvert.SerializeObject(this);
     _owner            = JsonConvert.DeserializeObject <OwnerResponse>(Settings.Owner);
     _property         = JsonConvert.DeserializeObject <PropertyResponse>(Settings.Property);
     if (_owner.RoleId == 1 && _property.Contracts != null)
     {
         await _navigationService.NavigateAsync("PropertyTabbedPage");
     }
     else
     {
         await _navigationService.NavigateAsync("PropertyPage");
     }
 }
Example #5
0
        public async Task <IActionResult> Get110Event()
        {
            Event110         request          = new Event110();
            ResponseData     responseData     = new ResponseData();
            PropertyResponse propertyResponse = new PropertyResponse();

            request.responseData = new List <ResponseData>();

            responseData.comment     = "";
            responseData.description = "";

            propertyResponse.uniqueID     = new Guid();
            propertyResponse.eventCode    = 115;
            responseData.propertyResponse = new List <PropertyResponse>();
            responseData.propertyResponse.Add(propertyResponse);
            request.responseData.Add(responseData);

            return(Ok(new { request = request }));
        }
Example #6
0
 private IEnumerable <SonarQubeProperty> ToProperties(PropertyResponse arg)
 {
     if (arg.FieldValues != null)
     {
         for (int i = 0; i < arg.FieldValues.Length; i++)
         {
             var fieldValue = arg.FieldValues[i];
             foreach (var item in fieldValue)
             {
                 yield return(new SonarQubeProperty($"{arg.Key}.{i + 1}.{item.Key}", item.Value));
             }
         }
     }
     else if (arg.Values != null)
     {
         yield return(new SonarQubeProperty(arg.Key, string.Join(",", arg.Values)));
     }
     else
     {
         yield return(new SonarQubeProperty(arg.Key, arg.Value));
     }
 }
 private SonarQubeProperty ToProperty(PropertyResponse arg) =>
 new SonarQubeProperty(arg.Key, arg.Value);
Example #8
0
        public void SendAsyncResponse(string url,
                                      int interfaceId,
                                      string interfaceUniqueId,
                                      string orderUniqueId,
                                      string userName,
                                      string password,
                                      int accountID,
                                      DateTime eventDate,
                                      string comment,
                                      int eventCode,
                                      int statusCode)
        {
            AsyncResponse    response         = new AsyncResponse();
            ResponseData     responseData     = new ResponseData();
            PropertyResponse propertyResponse = new PropertyResponse();
            string           log = "Send Async - " + ", " + interfaceUniqueId + ", " + userName + ", " + password + ", ";
            Task <int>       res;

            try {
                res = _logService.SaveLogEntry(interfaceId, log, interfaceUniqueId);

                HttpResponse httpResponse = new HttpResponse();

                response.responseDateTime          = System.DateTime.Now;
                response.responseData              = new List <ResponseData>();
                responseData.description           = "";
                response.internalAccountIdentifier = interfaceUniqueId;
                responseData.comment    = comment;
                responseData.statusCode = statusCode;
                response.responseData.Add(responseData);
                response.responseData[0].propertyResponse = new List <PropertyResponse>();
                response.responseData[0].propertyResponse.Add(new PropertyResponse());
                response.responseData[0].propertyResponse[0].eventCode   = eventCode;
                response.responseData[0].propertyResponse[0].uniqueID    = new Guid(orderUniqueId);
                response.responseData[0].propertyResponse[0].customerFee = null;

                var payload = new { response = response };
                JsonSerializerSettings jss = new JsonSerializerSettings();
                jss.NullValueHandling = NullValueHandling.Ignore;
                httpResponse          = _httpService.PostMessage(url,
                                                                 JsonConvert.SerializeObject(payload, jss),
                                                                 "",
                                                                 "");
                if (httpResponse.success == true)
                {
                    //check status code
                    JToken avsResponse = JToken.Parse(httpResponse.responseData);
                    int    retval      = 0;
                    int.TryParse(avsResponse["response"]["responseData"][0]["statusCode"].ToString(), out retval);
                    if (retval != 0)
                    {
                        res = _commonRepository.SaveInterfaceData(interfaceId,
                                                                  JsonConvert.SerializeObject(payload, jss),
                                                                  "App",
                                                                  "Resend");
                    }
                }
            }
            catch (Exception ex)
            {
                log = "Send Async error - " + ex.Message + "\n" + ", " + interfaceUniqueId + ", " + userName + ", " + password + ", ";
                res = _logService.SaveLogEntry(interfaceId, log, interfaceUniqueId);
            }
        }
 public static SonarQubeProperty FromResponse(PropertyResponse response)
 {
     return(new SonarQubeProperty(response.Key, response.Value));
 }