public bool UpdatePropertyPortfolio(PropertyVo propertyVo, int userId) { PropertyDao propertyDao = new PropertyDao(); bool bResult = false; try { bResult = propertyDao.UpdatePropertyPortfolio(propertyVo, userId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyBo.cs:UpdatePropertyPortfolio()"); object[] objects = new object[2]; objects[0] = propertyVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
public IHttpActionResult Get(Guid?ownerId = null) { var propertyDao = new PropertyDao(); if (ownerId.HasValue) { return(Ok(propertyDao.GetPropertiesForOwner(ownerId.Value))); } else { return(Ok(propertyDao.GetAllProperties())); } }
// DELETE: api/Owners/5 public IHttpActionResult Delete(Guid id) { var propertyDao = new PropertyDao(); var didDelete = propertyDao.DeleteProperty(id); if (didDelete) { return(StatusCode(HttpStatusCode.NoContent)); } else { return(NotFound()); } }
// PUT: api/Ownerss/5 public IHttpActionResult Put(Guid id, [FromBody] EditableProperty editableProperty) { var propertyDao = new PropertyDao(); var foundProperty = propertyDao.UpdateProperty(id, editableProperty); if (foundProperty == null) { return(NotFound()); } else { return(Ok(foundProperty)); } }
// GET: api/Owners/5 public IHttpActionResult Get(Guid id) { var propertyDao = new PropertyDao(); var foundProperty = propertyDao.GetPropertyById(id); if (foundProperty == null) { return(NotFound()); } else { return(Ok(foundProperty)); } }
public IEnumerable<Position> Get(double north, double east, double south, double west) { // need to call DB twice. workaround for now if (west > east) { west = -180; } PropertyDao dao = new PropertyDao(); List<Position> data = dao.GetByPositionRange(north, east, south, west) .Select(r => new Position { Lat = r.Latitude.Value, Lng = r.Longitude.Value }) .ToList(); return data; }
public void PropertyGetByPositionRange() { // North-East // +---------------+ // | |+90 // | | // | | Latitude // | -180 +180 | // | Longitude |-90 // +---------------+ // South-West // // North-East // +---------------+ // | | // | | // | * +40 -70 | // | | // | | // +---------------+ // South-West using (new TransactionScope()) { Client client = NewClient(); PropertyDao dao = new PropertyDao(); Property entity = new Property { Id = Guid.NewGuid(), Client = client, Name = "foo", Latitude = 40, Longitude = -70 }; dao.Add(entity); dao.SaveChanges(); dao.Detach(entity); List<Property> list1 = dao.GetByPositionRange(40.1, -69.9, 39.9, -71.1); Assert.AreEqual(1, list1.Count); List<Property> list2 = dao.GetByPositionRange(39.9, -69.9, 39.8, -71.1); Assert.AreEqual(0, list2.Count); } }
public void PropertySaveAndGet() { using (new TransactionScope()) { Client client = NewClient(); PropertyDao dao = new PropertyDao(); Property entity = new Property { Id = Guid.NewGuid(), Client = client, Name = "foo" }; dao.Add(entity); dao.SaveChanges(); dao.Detach(entity); Property writtenEntity = dao.GetById(entity.Id); Assert.AreEqual(entity.Name, writtenEntity.Name); } }
public Property GetPropertyByTableAndColumn(string tableName, string columnName, Guid applicationId) { return(PropertyDao.FindAllByTableAndColumn(tableName, columnName, applicationId).FirstOrDefault()); }