Example #1
0
        public override async Task <IActionResult> List(PropertyListModel model, string viewName = "_List_Properties")
        {
            model.LoadImages = true;
            model            = await _property.GetPropertiesAsync(model);

            return(View(viewName, model));
        }
        public async Task <IActionResult> Index(PropertyListCriteriaModel criteria, int pageIndex = 0, int pageSize = 20)
        {
            var properties = await _propertyService.ListAsync(pageIndex : pageIndex, pageSize : pageSize,
                                                              userId : criteria.UserId,
                                                              propertyType : (PropertyType?)criteria.PropertyType,
                                                              status : (PropertyStatus?)criteria.Status,
                                                              transactionType : (TransactionType?)criteria.TransactionType,
                                                              countyId : criteria.CountyId,
                                                              cityId : criteria.CityId,
                                                              priceFrom : criteria.PriceFrom,
                                                              priceTo : criteria.PriceTo,
                                                              telephone : criteria.Telephone,
                                                              code : criteria.Code
                                                              );

            var model = new PropertyListModel()
            {
                Criteria   = (criteria.UserId.HasValue || criteria.PropertyType.HasValue || criteria.Status.HasValue || criteria.TransactionType.HasValue || criteria.CountyId.HasValue || criteria.CityId.HasValue || criteria.PriceFrom.HasValue || criteria.PriceTo.HasValue || !string.IsNullOrEmpty(criteria.Telephone) || criteria.Code.HasValue) ? criteria : null,
                Properties = _mapper.Map <PagedResultModel <PropertyListItemModel> >(properties),
                Users      = _mapper.Map <IEnumerable <SelectListItem> >(await _userRepository.ListAsync(new UserFilterSpecification(onlyActive: true))),
                Counties   = _mapper.Map <IEnumerable <SelectListItem> >(await _countyRepository.ListAsync(new CountyFilterSpecification())),
                Cities     = criteria.CountyId.HasValue ? _mapper.Map <IEnumerable <SelectListItem> >(await _cityRepository.ListAsync(new CityFilterSpecification(criteria.CountyId.Value))) : null
            };

            return(View(model));
        }
Example #3
0
        public async Task <List <MapMarker> > GetLocationsAsync(PropertyListModel filters)
        {
            PropertyListModel propertiesQuery = await GetPropertiesAsync(filters);

            return(propertiesQuery.List.Select(p =>
                                               new MapMarker(p, p.Title, p.QuickInfo, p.Id.ToString(), p.Url, p.FeaturedImage.Url)
                                               ).ToList());
        }
Example #4
0
 public override async Task <IActionResult> Index(PropertyListModel model)
 {
     if (model.Type.Count == 0)
     {
         return(RedirectToActionPermanent(nameof(Index), new { type = "Student" }));
     }
     return(await List(model, nameof(Index)));
 }
Example #5
0
        public PartialViewResult GetProperties(int pageId)
        {
            var model = new PropertyListModel
            {
                PageProperties = _propertyService.GetPropertyNames(pageId)
            };

            return(PartialView("_PropertyList", model));
        }
Example #6
0
        public virtual async Task <IActionResult> List(PropertyListModel model, string viewName = "_List_Property")
        {
            PropertySettings propertySettings = Engine.Settings.Property;

            if (!propertySettings.Enabled || !propertySettings.ShowList)
            {
                return(NotFound());
            }
            model = await _property.GetPropertiesAsync(model);

            return(View(viewName, model));
        }
Example #7
0
        public IActionResult All()
        {
            PropertyListModel model = new PropertyListModel()
            {
                Properties = _properties.GetAll().Select(p => new PropertyItemModel
                {
                    Id              = p.Id,
                    Address         = p.Address,
                    NumberOfTenants = _tenants.GetAllFromProperty(p.Id).Count()
                })
            };

            return(View(model));
        }
Example #8
0
        public ActionResult List(long id)
        {
            var status = this.propertyAdapter.GetPropertyListingInfo(id, User.Identity.Name);

            if (status.StatusCode != 200)
            {
                return(this.NotFoundException());
            }

            PropertyListModel model = new PropertyListModel(status.Result);

            model.StepsAvailable = GetStepsAvailable(status.Result);

            return(View(model));
        }
        public ActionResult List(Rentler.Common.Listing input)
        {
            if (ModelState.IsValid)
            {
                var status = this.propertyAdapter.UpdatePropertyListingInfo(input);

                if (status.StatusCode == 200)
                {
                    return(RedirectToAction("terms", new { id = input.BuildingId }));
                }

                HandleErrors(status);
            }

            var buildingVal = this.propertyAdapter.GetPropertyListingInfo(input.BuildingId, User.Identity.Name);

            if (buildingVal.StatusCode != 200)
            {
                return(this.NotFoundException());
            }

            PropertyListModel model = new PropertyListModel()
            {
                Input            = input,
                StepsAvailable   = GetStepsAvailable(buildingVal.Result),
                UserContacts     = buildingVal.Result.User.ContactInfos,
                TemporaryOrderId = buildingVal.Result.TemporaryOrderId
            };

            if (input.BuildingAmenities == null)
            {
                input.BuildingAmenities = new List <BuildingAmenity>();
            }

            if (input.CustomAmenities == null)
            {
                input.CustomAmenities = new List <CustomAmenity>();
            }

            return(View(model));
        }
Example #10
0
        public virtual async Task <IActionResult> List(PropertyListModel model, string viewName = "_List_Property")
        {
            var propertySettings = Engine.Settings.Property;

            if (!propertySettings.Enabled || !propertySettings.ShowList)
            {
                return(NotFound());
            }

            model.PublishStatus = ContentStatus.Published;
            model = await _property.GetPropertiesAsync(model);

            model.Locations = await _property.GetLocationsAsync(model);

            model.CentrePoint = GeoCalculations.GetCentralGeoCoordinate(model.Locations.Select(p => new GeoCoordinate(p.Latitude, p.Longitude)));
            PropertySettings settings = Engine.Settings.Property;

            model.AvailableTypes = settings.GetListingTypes();
            model.PlanningTypes  = settings.GetPlanningTypes();

            return(View(viewName, model));
        }
Example #11
0
        public async Task <IActionResult> FavouritesList(PropertyListModel model, List <int> f = null, string viewName = "_List_Favourites")
        {
            IQueryable <PropertyListing> properties = _db.Properties
                                                      .Include(p => p.Agent)
                                                      .Include(p => p.Metadata)
                                                      .Include(p => p.Media)
                                                      .Where(p => p.Status == model.PublishStatus);

            if (model.Search.IsSet())
            {
                properties = properties.Where(n =>
                                              n.Title.Contains(model.Search) ||
                                              n.Address1.Contains(model.Search) ||
                                              n.Address2.Contains(model.Search) ||
                                              n.City.Contains(model.Search) ||
                                              n.County.Contains(model.Search) ||
                                              n.Postcode.Contains(model.Search) ||
                                              n.ShortDescription.Contains(model.Search) ||
                                              n.Lease.Contains(model.Search) ||
                                              n.Location.Contains(model.Search) ||
                                              n.Planning.Contains(model.Search) ||
                                              n.Reference.Contains(model.Search)
                                              );
            }

            properties = properties.Where(p => f.Contains(p.Id));

            model.AvailableTypes = await _db.Properties.Select(p => p.ListingType).Distinct().ToListAsync();

            model.AvailableStatuses = await _db.Properties.Select(p => p.LeaseStatus).Distinct().ToListAsync();

            model.AvailablePlanningTypes = await _db.Properties.Select(p => p.Planning).Distinct().ToListAsync();

            model.PlanningTypes = Engine.Settings.Property.GetPlanningTypes();

            await model.ReloadAsync(properties);

            return(View(viewName, model));
        }
Example #12
0
 public PropertyListModel GetProperties(PropertyListModel model)
 {
     return(model);
 }
Example #13
0
        public async Task <PropertyListModel> GetPropertiesAsync(PropertyListModel model)
        {
            IQueryable <PropertyListing> properties = _db.Properties
                                                      .Include(p => p.Agent)
                                                      .Include(p => p.Metadata);

            if (model.LoadImages)
            {
                properties = properties
                             .Include(p => p.Media)
                             .Include(p => p.FloorPlans);
            }

            if (model.PublishStatus.HasValue)
            {
                properties = properties.Where(p => p.Status == model.PublishStatus);
            }

            if (model.Type != null)
            {
                model.Type.RemoveAll(t => !t.IsSet());
                if (model.Type.Count > 0)
                {
                    properties = properties.Where(n => model.Type.Any(t => n.ListingType == t));
                }
            }

            if (model.Status != null)
            {
                model.Status.RemoveAll(t => !t.IsSet());
                if (model.Status.Count > 0)
                {
                    properties = properties.Where(n => model.Status.Any(t => n.LeaseStatus == t));
                }
            }

            if (model.Agent.IsSet())
            {
                properties = properties.Where(n => n.Agent.UserName == model.Agent);
            }

            if (model.Location.IsSet())
            {
                properties = properties.Where(n => n.Address2 == model.Location);
            }

            if (model.PlanningType.IsSet())
            {
                properties = properties.Where(n => n.Planning == model.PlanningType);
            }

            if (model.MinBedrooms.HasValue)
            {
                properties = properties.Where(n => n.Bedrooms >= model.MinBedrooms.Value);
            }

            if (model.MaxBedrooms.HasValue)
            {
                properties = properties.Where(n => n.Bedrooms <= model.MaxBedrooms.Value);
            }

            if (model.Bedrooms.HasValue)
            {
                properties = properties.Where(n => n.Bedrooms == model.Bedrooms.Value);
            }

            if (model.MinRent.HasValue)
            {
                properties = properties.Where(n => n.Rent >= model.MinRent.Value);
            }

            if (model.MaxRent.HasValue)
            {
                properties = properties.Where(n => n.Rent <= model.MaxRent.Value);
            }

            if (model.MinPremium.HasValue)
            {
                properties = properties.Where(n => n.Premium >= model.MinPremium.Value);
            }

            if (model.MaxPremium.HasValue)
            {
                properties = properties.Where(n => n.Premium <= model.MaxPremium.Value);
            }

            if (model.MinPrice.HasValue)
            {
                properties = properties.Where(n => n.AskingPrice >= model.MinPrice.Value);
            }

            if (model.MaxPrice.HasValue)
            {
                properties = properties.Where(n => n.AskingPrice <= model.MaxPrice.Value);
            }

            if (model.Search.IsSet())
            {
                properties = properties.Where(n =>
                                              n.Title.Contains(model.Search) ||
                                              n.Address1.Contains(model.Search) ||
                                              n.Address2.Contains(model.Search) ||
                                              n.City.Contains(model.Search) ||
                                              n.County.Contains(model.Search) ||
                                              n.Postcode.Contains(model.Search) ||
                                              n.ShortDescription.Contains(model.Search) ||
                                              n.Lease.Contains(model.Search) ||
                                              n.Location.Contains(model.Search) ||
                                              n.Planning.Contains(model.Search) ||
                                              n.Reference.Contains(model.Search)
                                              );
            }

            if (model.Order.IsSet())
            {
                switch (model.Order)
                {
                case "name":
                case "title":
                    properties = properties.OrderBy(n => n.Title);
                    break;

                case "date":
                    properties = properties.OrderBy(n => n.PublishDate);
                    break;

                case "views":
                    properties = properties.OrderBy(n => n.Views);
                    break;

                case "name+desc":
                case "title+desc":
                    properties = properties.OrderByDescending(n => n.Title);
                    break;

                case "date+desc":
                    properties = properties.OrderByDescending(n => n.PublishDate);
                    break;

                case "views+desc":
                    properties = properties.OrderByDescending(n => n.Views);
                    break;

                case "rent":
                    properties = properties.OrderBy(n => n.Rent);
                    break;

                case "planning":
                    properties = properties.OrderBy(n => n.Planning);
                    break;

                case "type":
                    properties = properties.OrderBy(n => n.ListingType);
                    break;

                case "premium":
                    properties = properties.OrderBy(n => n.Premium);
                    break;

                case "rent+desc":
                    properties = properties.OrderByDescending(n => n.Rent);
                    break;

                case "planning+desc":
                    properties = properties.OrderByDescending(n => n.Planning);
                    break;

                case "type+desc":
                    properties = properties.OrderByDescending(n => n.ListingType);
                    break;

                case "premium+desc":
                    properties = properties.OrderByDescending(n => n.Premium);
                    break;

                default:
                    properties = properties.OrderByDescending(n => n.PublishDate).ThenBy(n => n.Id);
                    break;
                }
            }

            model.AvailableTypes = await _db.Properties.Select(p => p.ListingType).Distinct().ToListAsync();

            model.AvailableStatuses = await _db.Properties.Select(p => p.LeaseStatus).Distinct().ToListAsync();

            model.AvailablePlanningTypes = await _db.Properties.Select(p => p.Planning).Distinct().ToListAsync();

            model.PlanningTypes = Engine.Settings.Property.GetPlanningTypes();

            await model.ReloadAsync(properties);

            if (model.List != null)
            {
                model.Locations   = model.List.Select(p => new MapMarker(p, p.Title, p.QuickInfo, p.Id.ToString(), p.Url, p.FeaturedImage.Url)).ToList();
                model.CentrePoint = GeoCalculations.GetCentralGeoCoordinate(model.Locations.Select(p => new GeoCoordinate(p.Latitude, p.Longitude)));
            }
            return(model);
        }
Example #14
0
        public override async Task <IActionResult> Map(PropertyListModel model)
        {
            var locations = await _property.GetLocationsAsync(model);

            return(View("_Map_Properties", locations));
        }
Example #15
0
 public virtual async Task <IActionResult> Index(PropertyListModel model)
 {
     return(await List(model, "Index"));
 }
Example #16
0
 public async Task <IActionResult> ShareFavourites(PropertyListModel model, List <int> f = null)
 {
     model.Type = new List <string>();
     return(await FavouritesList(model, f, nameof(ShareFavourites)));
 }
Example #17
0
        public ActionResult Index(string UserName, string MobileNo, string StartDate, string EndDate, string TrebId, string PropertyType)
        {
            UserPermissionAction("home", RoleAction.view.ToString());
            CheckPermission();
            List <PropertyModel> PropertyModelList = new List <PropertyModel>();
            PropertyListModel    PropertyListModel = new PropertyListModel();

            PropertyListModel.UserName          = UserName;
            PropertyListModel.StartDate         = StartDate;
            PropertyListModel.EndDate           = EndDate;
            PropertyListModel.PropertyModelList = PropertyModelList;

            if (!string.IsNullOrEmpty(StartDate))
            {
                if (CheckDate(StartDate) == false)
                {
                    TempData["ShowMessage"] = "error";
                    TempData["MessageBody"] = "Please select a valid From Date.";
                    return(View("WelcomeHome", PropertyListModel));
                }
            }
            if (!string.IsNullOrEmpty(EndDate))
            {
                if (CheckDate(EndDate) == false)
                {
                    TempData["ShowMessage"] = "error";
                    TempData["MessageBody"] = "Please select a valid To Date.";
                    return(View("WelcomeHome", PropertyListModel));
                }
            }

            if (!string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate))
            {
                if (Convert.ToDateTime(Convert.ToDateTime(StartDate).ToString("MM/dd/yyyy")) > Convert.ToDateTime(Convert.ToDateTime(EndDate).ToString("MM/dd/yyyy")))
                {
                    TempData["ShowMessage"] = "error";
                    TempData["MessageBody"] = "Please select a valid date range.";

                    return(View("WelcomeHome", PropertyListModel));
                }
            }
            var PropertyList = _PropertyService.GetPropertys().OrderByDescending(c => c.IsActive == false).ToList();

            //For Search By Name
            if (!string.IsNullOrEmpty(UserName))
            {
                PropertyList = PropertyList.Where(c => c.Customers.FirstName.ToLower().Contains(UserName.ToLower().Trim())).ToList();//.Where(c => c.FirstName.ToLower().Contains(FirstName.ToLower()));
            }
            //For Search By PropertyType
            if (!string.IsNullOrEmpty(PropertyType))
            {
                if (Convert.ToInt32(PropertyType) == 0)
                {
                    PropertyList = PropertyList.ToList();
                }
                else
                {
                    PropertyList = PropertyList.Where(c => c.PropertyStatusId == Convert.ToInt32(PropertyType)).ToList();
                }
            }

            //For Search By TrebId
            if (!string.IsNullOrEmpty(TrebId) && !string.IsNullOrEmpty(TrebId) && TrebId.Trim() != "" && TrebId.Trim() != "")
            {
                PropertyList = PropertyList.Where(c => c.Customers.TrebId == TrebId).ToList();
            }
            PropertyModelList = GetPropertyList(PropertyList);
            PropertyListModel.PropertyModelList = PropertyModelList;
            IEnumerable <EnumValue.PropertySatus> propertyStatusValues = System.Enum.GetValues(typeof(EnumValue.PropertySatus)).Cast <EnumValue.PropertySatus>();

            List <SelectListItem> PropertyTypeList = new List <SelectListItem>();

            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "--All--", Value = "0", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Residential", Value = "1", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Commercial", Value = "2", Selected = true
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Condo", Value = "9", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Commercial", Value = "3", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Residential", Value = "4", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Condo", Value = "8", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Commercial", Value = "5", Selected = true
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Residential", Value = "6", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Condo", Value = "7", Selected = false
            });


            ViewBag.PropertyType = new SelectList(PropertyTypeList, "Value", "Text");
            return(View("WelcomeHome", PropertyListModel));
        }
Example #18
0
 public async Task <IActionResult> Favourites(PropertyListModel model)
 {
     model.Type = new List <string>();
     return(await FavouritesList(model, new List <int>(), nameof(Favourites)));
 }
Example #19
0
        public ActionResult WelcomeHome(int?id)
        {
            var CustomerId = 0;

            if (id != 0 && id != null)
            {
                CustomerId            = Convert.ToInt32(id);
                Session["CustomerId"] = CustomerId;
                Session["UserName"]   = "";
            }
            else
            {
                CustomerId = Convert.ToInt32(Session["CustomerId"]);
                return(RedirectToAction("Index", "Admin"));
            }
            var Customer = _CustomerService.GetCustomer(CustomerId);

            if (Customer != null)
            {
                Session["CompanyID"]    = Customer.CompanyID;
                Session["adminphoto"]   = Customer.PhotoPath;
                Session["FullUserName"] = (Customer.FirstName + " " + Customer.LastName).Trim();
            }

            UserPermissionAction("home", RoleAction.view.ToString());
            CheckPermission();
            List <PropertyModel> PropertyModelList = new List <PropertyModel>();
            CommonClass          CommonClass       = new CommonClass();
            string    QStr = "";
            DataTable dt   = new DataTable();

            QStr  = "select * from Property ";
            QStr += "Inner join Customer on Customer.CustomerId=Property.CustomerId ";
            if (CustomerId != 0)
            {
                QStr += "Where Customer.ParentId='" + CustomerId + "'  Order By Property.IsActive asc, Property.CreatedOn desc";
            }
            else
            {
                QStr += "Order By Property.IsActive asc, Property.CreatedOn desc";
            }

            dt = CommonClass.GetDataSet(QStr).Tables[0];
            List <Property> PropertyList = new List <Property>();

            foreach (DataRow dr in dt.Rows)
            {
                Property Property = new Property();
                Property.PropertyId = Convert.ToInt32(dr["PropertyId"]);
                Property.CustomerId = Convert.ToInt32(dr["CustomerId"]);

                Property.PropertyStatusId = Convert.ToInt32(dr["PropertyStatusId"]);
                Property.MLS                = (dr["MLS"]).ToString();
                Property.Price              = (dr["Price"]).ToString();
                Property.MininumPrice       = (dr["MininumPrice"]).ToString();
                Property.MaximumPrice       = (dr["MaximumPrice"]).ToString();
                Property.LocationPrefered   = (dr["LocationPrefered"]).ToString();
                Property.Style              = (dr["Style"]).ToString();
                Property.Age                = (dr["Age"]).ToString();
                Property.Garage             = (dr["Garage"]).ToString();
                Property.Bedrooms           = (dr["Bedrooms"]).ToString();
                Property.Bathrooms          = (dr["Bathrooms"]).ToString();
                Property.PropertyType       = (dr["PropertyType"]).ToString();
                Property.Basement           = (dr["Basement"]).ToString();
                Property.BasementValue      = (dr["BasementValue"]).ToString();
                Property.Community          = (dr["Community"]).ToString();
                Property.Size               = (dr["Size"]).ToString();
                Property.Remark             = (dr["Remark"]).ToString();
                Property.Kitchen            = (dr["Kitchen"]).ToString();
                Property.Type               = (dr["Type"]).ToString();
                Property.Alivator           = (dr["Alivator"]).ToString();
                Property.GarageType         = (dr["GarageType"]).ToString();
                Property.SideDoorEntrance   = (dr["SideDoorEntrance"]).ToString();
                Property.Loundry            = (dr["Loundry"]).ToString();
                Property.Level              = (dr["Level"]).ToString();
                Property.ListPriceCode      = (dr["ListPriceCode"]).ToString();
                Property.TypeTaxes          = (dr["TypeTaxes"]).ToString();
                Property.TypeCommercial     = (dr["TypeCommercial"]).ToString();
                Property.CategoryCommercial = (dr["CategoryCommercial"]).ToString();
                Property.Use                = (dr["Use"]).ToString();
                Property.Zoning             = (dr["Zoning"]).ToString();
                if (dr["CreatedOn"] != DBNull.Value)
                {
                    Property.CreatedOn = Convert.ToDateTime((dr["CreatedOn"]));
                }
                //Property.LastUpdatedon = Convert.ToDateTime((dr["LastUpdatedon"]));
                Property.IsActive = Convert.ToBoolean(dr["IsActive"]);


                PropertyList.Add(Property);
            }

            PropertyModelList = GetPropertyList(PropertyList);
            ViewBag.Title     = "Welcome";


            SessionBatches(id);
            PropertyListModel PropertyListModel = new PropertyListModel();

            PropertyListModel.UserName          = "";
            PropertyListModel.StartDate         = "";
            PropertyListModel.EndDate           = "";
            PropertyListModel.PropertyModelList = PropertyModelList;

            IEnumerable <EnumValue.PropertySatus> propertyStatusValues = System.Enum.GetValues(typeof(EnumValue.PropertySatus)).Cast <EnumValue.PropertySatus>();
            List <SelectListItem> PropertyTypeList = new List <SelectListItem>();

            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "-- All --", Value = "0", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Residential", Value = "1", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Commercial", Value = "2", Selected = true
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Exclusive Condo", Value = "9", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Commercial", Value = "3", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Residential", Value = "4", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "New/Hot Condo", Value = "8", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Commercial", Value = "5", Selected = true
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Residential", Value = "6", Selected = false
            });
            PropertyTypeList.Add(new SelectListItem()
            {
                Text = "Looking For Condo", Value = "7", Selected = false
            });
            ViewBag.PropertyType = new SelectList(PropertyTypeList, "Value", "Text");

            return(View(PropertyListModel));
        }