Exemple #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">The name of the interface.</param>
 /// <param name="addPropertyCallback">A callback to be called when a property is added.</param>
 /// <param name="removePropertyCallback">A callback to be called when a property is removed.</param>
 /// <param name="validateCallback">A callback to be called when the data should be validated.</param>
 public EditInterface(String name, AddProperty addPropertyCallback, RemoveProperty removePropertyCallback, Validate validateCallback)
 {
     this.name = name;
     this.addPropertyCallback    = addPropertyCallback;
     this.removePropertyCallback = removePropertyCallback;
     this.validateCallback       = validateCallback;
 }
Exemple #2
0
        internal void AddNewProperty()
        {
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Config.Keys_Resource.ExcelPath, "Register");
            Thread.Sleep(1000);

            //calling the common methods
            Common_methods();
            Thread.Sleep(500);

            //Select properties page
            PropertiesPage.Click();

            //Click on Add New Property button
            AddProperty.Click();

            //Calling Property details method
            PropertyDetails();

            //Calling Finance details method
            FinanceDetails();

            //Calling Tenant details method
            TenantDetails();
        }
        /// <summary>
        ///     Show  "Add new Propery" View through set CurrentViewModel
        /// </summary>
        public void ShowAddNewPropertyView()
        {
            var p = new AddProperty {
                DataContext = new AddPropertiViewModel()
            };

            CurrentViewModel = p;
        }
Exemple #4
0
        public async Task <IActionResult> PostProperty([FromBody] AddProperty addProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var    userCp   = HttpContext.User;
            string landlord = TokenVerifier.GetLandlord(userCp);

            //Generate property
            Property property = _mapper.Map <AddProperty, Property>(addProperty);

            property.PropertyStatus = Property.VerificationStatus.Pending;
            property.AppUserRef     = landlord;

            //Validate property
            if (!TryValidateModel(property))
            {
                return(BadRequest());
            }

            List <BasicImage> images = new List <BasicImage>();

            int imgCount = 0;

            foreach (string imageStr in addProperty.Images)
            {
                BasicImage bi = WriteImage(imageStr, imgCount);

                if (bi != null)
                {
                    images.Add(bi);
                    imgCount++;
                }
                else
                {
                    CleanImages(images);
                    return(BadRequest());
                }
            }

            //All Images are valid and added
            _context.Property.Add(property);
            foreach (BasicImage bi in images)
            {
                bi.PropertyRef = property.ID;
                Image im = _mapper.Map <BasicImage, Image>(bi);
                _context.Image.Add(im);
            }

            await _context.SaveChangesAsync();

            return(Ok());
        }
Exemple #5
0
        public async Task AddProperty(Guid id, [FromBody] AddProperty model)
        {
            var value = await _metaDbContext.DomainEvents.Include(e => e.Properties).SingleAsync(e => e.Id == id);

            value.Properties.Add(new Property
            {
                Name         = model.Name,
                Description  = model.Description,
                IsCollection = model.IsCollection,
                SystemType   = model.SystemType,
                ValueTypeId  = model.ValueTypeId
            });
            await _metaDbContext.SaveChangesAsync();
        }
Exemple #6
0
 set => SetValue(AddProperty, value);
        private async void ListItemClicked(int position)
        {
            Android.Support.V4.App.Fragment fragment = null;
            switch (position)
            {
            case 0:
                int       id   = int.Parse(ap.getAccessKey());
                string    url  = "http://housechecker.co.uk/api/export.php";
                JsonValue json = await FetchUserAsync(url);

                string         jsonString      = json.ToString();
                List <Student> listOfLandlords = JsonConvert.DeserializeObject <List <Student> >(jsonString);
                var            user            = listOfLandlords.Where(a => a.Id == id).FirstOrDefault();

                if (user.Type == "Landlord")
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Add Property");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Properties");
                    // If the user type is Landlord, it sets the two extra features to these options
                }
                else
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Favourite Properties");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Reviews");
                    // If you're a student the options are different
                }
                // Gets the list of users and finds the one that matches your ID

                usernameDisplay = FindViewById <TextView>(Resource.Id.navBarHeader);
                // Gets the display name for the nav bar


                if (user.Type == "Landlord")
                {
                    fragment             = LandlordDashboard.NewInstance();
                    usernameDisplay.Text = user.CompanyName;
                    // Sets the name to company name if you are a landlord
                }
                else
                {
                    fragment             = StudentDashboard.NewInstance();
                    usernameDisplay.Text = user.Name;
                    // And to username if you are a student
                }
                break;

            case 1:
                fragment = PropertyDetail.NewInstance();
                Bundle idBundle = new Bundle();
                idBundle.PutString("accomID", "77");
                fragment.Arguments = idBundle;
                // This code calls the new fragment and places it on the screen aka loading a new page
                break;

            case 2:
                fragment = SearchPage.NewInstance();
                break;

            case 3:
                fragment = Profile.NewInstance();
                break;

            case 4:
                if (userType == "Landlord")
                {
                    fragment = AddProperty.NewInstance();
                }
                else
                {
                    fragment = DisplayFavourites.NewInstance();
                }
                break;

            case 5:
                if (userType == "Landlord")
                {
                    fragment = MyProperties.NewInstance();
                }
                else
                {
                    fragment = MyReviews.NewInstance();
                }
                break;

            case 6:
                id   = int.Parse(ap.getAccessKey());
                url  = "http://housechecker.co.uk/api/export.php";
                json = await FetchUserAsync(url);

                jsonString      = json.ToString();
                listOfLandlords = JsonConvert.DeserializeObject <List <Student> >(jsonString);
                user            = listOfLandlords.Where(a => a.Id == id).FirstOrDefault();

                if (user.Type == "Landlord")
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Add Property");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Properties");
                    // If the user type is Landlord, it sets the two extra features to these options
                }
                else
                {
                    IMenuItem item1 = navigationView.Menu.FindItem(Resource.Id.nav_extra1);
                    item1.SetTitle("Favourite Properties");
                    IMenuItem item2 = navigationView.Menu.FindItem(Resource.Id.nav_extra2);
                    item2.SetTitle("My Reviews");
                    // If you're a student the options are different
                }
                // Gets the list of users and finds the one that matches your ID

                url  = "http://housechecker.co.uk/api/display.php";
                json = await FetchUserAsync(url);

                jsonString = json.ToString();
                var addressList = JsonConvert.DeserializeObject <List <Address> >(jsonString);

                accomID  = addressList.Where(a => a.address1 == markerTitle).FirstOrDefault().id;
                fragment = PropertyDetail.NewInstance();
                Bundle bundle = new Bundle();
                bundle.PutString("accomID", accomID.ToString());
                fragment.Arguments = bundle;
                // Gets the accomodation that has been clicked on from the map page and then loads it
                break;
            }

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
            // Commits the transaction
        }
Exemple #8
0
 private static extern bool GetProperties(Smoke* smoke, short classId, AddProperty addProp);
 private static extern bool GetProperties(Smoke *smoke, short classId, AddProperty addProp);
Exemple #10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">The name of the interface.</param>
 /// <param name="addPropertyCallback">A callback to be called when a property is added.</param>
 /// <param name="removePropertyCallback">A callback to be called when a property is removed.</param>
 public EditInterface(String name, AddProperty addPropertyCallback, RemoveProperty removePropertyCallback)
     : this(name, addPropertyCallback, removePropertyCallback, null)
 {
 }
Exemple #11
0
        public async Task <IActionResult> UpdateProperty([FromRoute] int id, [FromBody] AddProperty addProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var    userCp   = HttpContext.User;
            string landlord = TokenVerifier.GetLandlord(userCp);

            Property currentProperty = await _context.Property.FindAsync(id);

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

            if (landlord == null || landlord != currentProperty.AppUserRef)
            {
                return(Unauthorized());
            }

            //Generate property
            Property newproperty = _mapper.Map <AddProperty, Property>(addProperty);

            newproperty.PropertyStatus = Property.VerificationStatus.Pending;
            newproperty.AppUserRef     = landlord;

            //Validate new property
            if (!TryValidateModel(newproperty))
            {
                return(BadRequest());
            }

            List <BasicImage> images = new List <BasicImage>();

            int imgCount = 0;

            foreach (string imageStr in addProperty.Images)
            {
                BasicImage bi = WriteImage(imageStr, imgCount);

                if (bi != null)
                {
                    images.Add(bi);
                    imgCount++;
                }
                else
                {
                    CleanImages(images);
                    return(BadRequest());
                }
            }

            List <Image>      oldImages      = _context.Image.Where(i => i.PropertyRef == id).ToList();
            List <BasicImage> oldBasicImages = _mapper.Map <List <Image>, List <BasicImage> >(oldImages);

            //From DB
            foreach (Image i in oldImages)
            {
                _context.Image.Remove(i);
            }

            //From disk
            CleanImages(oldBasicImages);

            currentProperty.AddressLine1        = addProperty.AddressLine1;
            currentProperty.AddressLine2        = addProperty.AddressLine2;
            currentProperty.City                = addProperty.City;
            currentProperty.County              = addProperty.County;
            currentProperty.Postcode            = addProperty.Postcode;
            currentProperty.Longitude           = addProperty.Longitude;
            currentProperty.Latitude            = addProperty.Latitude;
            currentProperty.PropertyDescription = addProperty.PropertyDescription;
            currentProperty.PropertyStatus      = Property.VerificationStatus.Pending;

            foreach (BasicImage bi in images)
            {
                bi.PropertyRef = currentProperty.ID;
                Image im = _mapper.Map <BasicImage, Image>(bi);
                _context.Image.Add(im);
            }

            await _context.SaveChangesAsync();

            return(Ok());
        }