public async Task <ResponseObject> GetRealEstatesByUmaAsync(string uma) { Query realEstateQuery = collection.WhereEqualTo("unmatriculatedArealDescription", uma); QuerySnapshot realEstatesSnapshot = await realEstateQuery.GetSnapshotAsync(); if (realEstatesSnapshot.Count > 0) { var selectedRealEstates = new List <RealEstate>(); foreach (var item in realEstatesSnapshot.Documents) { RealEstate realEstate = item.ConvertTo <RealEstate>(); if (realEstate != null) { selectedRealEstates.Add(realEstate); } } if (selectedRealEstates.Count > 0) { return(new ResponseObject { ResponseStatus = ResponseStatus.OK, Content = JsonConvert.SerializeObject(selectedRealEstates) }); } } return(await GetFromServiceByUmaAsync(uma)); }
public async Task <ResponseObject> GetRealEstatesByCertainNumberAsync(string certainNumber) { Query realEstateQuery = collection.WhereEqualTo("certainRealEstateNumber", certainNumber); QuerySnapshot realEstatesSnapshot = await realEstateQuery.GetSnapshotAsync(); if (realEstatesSnapshot.Count > 0) { var selectedRealEstates = new List <RealEstate>(); foreach (var item in realEstatesSnapshot.Documents) { RealEstate realEstate = item.ConvertTo <RealEstate>(); if (realEstate != null) { selectedRealEstates.Add(realEstate); } } if (selectedRealEstates.Count > 0) { return(new ResponseObject { ResponseStatus = ResponseStatus.OK, Content = JsonConvert.SerializeObject(selectedRealEstates) }); } } return(await GetFromServiceByCertianNumberAsync(certainNumber)); }
public IActionResult Edit(RealEstate realEstate, string password) { var realEstateUsername = realEstate.UserName; var realEstateIsAlready = _authService.RealEstateExists(realEstateUsername); var passwordHash = realEstate.PasswordHash; var passwordSalt = realEstate.PasswordSalt; if (realEstateIsAlready.Success) { if (ModelState.IsValid) { HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt); var realEstateUpdated = new RealEstate { Id = realEstate.Id, UserName = realEstate.UserName, CompanyName = realEstate.CompanyName, Mail = realEstate.Mail, Address = realEstate.Address, PasswordHash = passwordHash, PasswordSalt = passwordSalt }; var realEstateUpdate = _realEstateService.Update(realEstateUpdated); TempData["WarningMessage"] = realEstateUpdate.Message; return(RedirectToAction("List", "RealEstate")); } } else { TempData["DangerMessage"] = realEstateIsAlready.Message; } return(View(realEstate)); }
public async Task <string> CreateRealEstateAsync(RealEstateCreateServiceModel model) { if (model.Area <= 0 || model.Price <= 0) { throw new ArgumentNullException(InvalidMethodParametersMessage); } var city = await this.citiesServices.GetByNameAsync(model.City); var village = await this.villageServices.CreateVillageAsync(model.Village); var neighbourhood = await this.neighbourhoodServices.GetNeighbourhoodByNameAsync(model.Neighbourhood); var realEstate = new RealEstate { RealEstateType = await this.realEstateTypeServices.GetRealEstateTypeByNameAsync(model.RealEstateType), Address = await this.addressServices.CreateAddressAsync(city, model.Address, village, neighbourhood), BuildingType = await this.buildingTypeServices.GetBuildingTypeAsync(model.BuildingType), HeatingSystem = await this.heatingSystemServices.GetHeatingSystemAsync(model.HeatingSystem), PricePerSquareMeter = model.Price / (decimal)model.Area }; this.mapper.Map <RealEstateCreateServiceModel, RealEstate>(model, realEstate); var realEstateIdResult = await AddRealEstateToTheDb(realEstate); return(realEstateIdResult); }
/// <summary> /// Loads all the Model Names for Specific Category and SubcategoryID. /// </summary> /// <param name="intCategoryID"></param> /// <param name="intSubcategoryID"></param> private void LoadList_SecondSubcategory(int intSubcategoryID) { try { RealEstate objRealEstate = new RealEstate(); RealEstateManager manager = new RealEstateManager(); objRealEstate.SubcategoryID = intSubcategoryID; DataTable dt = manager.Load_LeftMenu_SecondSubcategory(objRealEstate); if (dt.Rows.Count > 0) { repList.DataSource = dt; repList.DataBind(); } else { repList.DataSource = null; repList.DataBind(); this.Visible = false; } } catch (Exception ex) { Response.Write(ex.Message); } }
public async Task <IActionResult> Edit(int id, [Bind("ID,AddressLine1,AddressLine2,PersonID,ServiceID,PostCode,RentalPrice,SalePrice,Town,PropertyType,BedroomQty,BathroomWCQty,BathroomQty,WCQty,FrontGarden,BackGarden,GenDescription")] RealEstate realEstate) { if (id != realEstate.ID) { return(NotFound()); } if (ModelState.IsValid) //if (true) { try { _context.Update(realEstate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RealEstateExists(realEstate.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["PersonID"] = new SelectList(_context.Persons, "ID", "FullName"); ViewData["ServiceID"] = new SelectList(_context.Services, "ID", "ID"); return(View(realEstate)); }
public void Add_ShouldCallAdd_ShouldAddRealEstate() { // Arrange var rating = new RealEstate() { Id = 3, Pictures = new List <Picture>(), User = new User(), Comments = new List <Comment>(), DateOfAdvertCreation = new DateTime(2020, 04, 30) }; dbSetRealEstateMock .Setup(ds => ds.Add(It.IsAny <RealEstate>())) .Callback <RealEstate>(testRealEstates.Add); // Act repo.Add(rating); // Assert testRealEstates.Should().Contain(rating); dbSetRealEstateMock.Verify(ds => ds.Add(It.IsAny <RealEstate>()), Times.Exactly(1)); // Clean up testRealEstates.Remove(rating); }
/// <summary> /// Publishes a RealEstate object. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <param name="channelId">The channelId of the channel to publish to.</param> /// <exception cref="IS24Exception"></exception> public async Task PublishAsync(RealEstate realEstate, int channelId) { var pos = await GetAsync(realEstate, channelId); if (pos.PublishObject == null || !pos.PublishObject.Any()) { var req = Connection.CreateRequest("publish", Method.POST); var p = new PublishObject { PublishChannel = new PublishChannel { Id = channelId }, RealEstate = new PublishObjectRealEstate { Id = realEstate.Id } }; req.AddBody(p); var pres = await ExecuteAsync <Messages>(Connection, req); if (!pres.IsSuccessful(MessageCode.MESSAGE_RESOURCE_CREATED)) { throw new IS24Exception(string.Format("Error publishing RealEstate {0}: {1}", realEstate.ExternalId, pres.ToMessage())) { Messages = pres } } ; } }
public void AddRealEstate(RealEstateDTO item) { RealEstate realEstate = new RealEstate() { RealEstateID = item.RealEstateID, Price = item.Price, Postcode = item.Postcode, Location = item.Location, Bathrooms = item.Bathrooms, Bedrooms = item.Bedrooms, Garden = item.Garden, LivingRooms = item.LivingRooms, Parking = item.Parking, Shower = item.Shower, Tenure = item.Tenure, PropertyStatus = item.PropertyStatus, SSTC = item.SSTC, Area = item.Area, SalesCorner = item.SalesCorner, ShortDescription = item.ShortDescription, LongDescription = item.LongDescription }; _testStoreContext.RealEstates.Add(realEstate); }
public RealEstateDTO GetLastAddRealEstate() { RealEstate real = (from u in _testStoreContext.RealEstates select u).Last(); RealEstateDTO realEstateDto = new RealEstateDTO() { Id = real.Id, RealEstateID = real.RealEstateID, Price = real.Price, Postcode = real.Postcode, Location = real.Location, Bathrooms = real.Bathrooms, Bedrooms = real.Bedrooms, Garden = real.Garden, LivingRooms = real.LivingRooms, Parking = real.Parking, Shower = real.Shower, Tenure = real.Tenure, PropertyStatus = real.PropertyStatus, SSTC = real.SSTC, Area = real.Area, SalesCorner = real.SalesCorner, ImagePath = real.ImagePath, ImageMimeType = real.ImageMimeType, ShortDescription = real.ShortDescription, LongDescription = real.LongDescription }; return(realEstateDto); }
public void UpdateRealEstate(RealEstateDTO item) { RealEstate real = new RealEstate() { Id = item.Id, RealEstateID = item.RealEstateID, Price = item.Price, Postcode = item.Postcode, Location = item.Location, Bathrooms = item.Bathrooms, Bedrooms = item.Bedrooms, Garden = item.Garden, LivingRooms = item.LivingRooms, Parking = item.Parking, Shower = item.Shower, Tenure = item.Tenure, PropertyStatus = item.PropertyStatus, SSTC = item.SSTC, Area = item.Area, SalesCorner = item.SalesCorner, ImagePath = item.ImagePath, ImageMimeType = item.ImageMimeType, ShortDescription = item.ShortDescription, LongDescription = item.LongDescription }; _testStoreContext.Entry(real).State = EntityState.Modified; }
public async Task <ActionResult <RealEstate> > PostRealEstate(RealEstate realEstate) { _context.RealEstate.Add(realEstate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetRealEstate", new { id = realEstate.Id }, realEstate)); }
public async Task <ActionResult <RealEstate> > PostRealEstate(RealEstate realEstate) { if (_context.Users.Find(realEstate.OwnerId) == null) { return(NotFound($"Owner with id = {realEstate.OwnerId} could not be found")); } _context.RealEstates.Add(realEstate); await _context.SaveChangesAsync(); return(CreatedAtAction("PostRealEstate", new { realEstate.Id, realEstate.Country, realEstate.City, realEstate.Street, realEstate.HouseNr, realEstate.Rooms, realEstate.ImageUrl, realEstate.Floor, realEstate.Area, realEstate.BuildYear, realEstate.OwnerId })); }
private void LoadList_RealEstate_BS_SellerProduct(int _CategoryID, int _SubcategoryID, int _ProfileID, string _Country) { RealEstate objRealEstate = new RealEstate(); RealEstateManager objrealEstatemanager = new RealEstateManager(); objRealEstate.CategoryID = _CategoryID; objRealEstate.SubcategoryID = _SubcategoryID; objRealEstate.ProfileID = _ProfileID; objRealEstate.Country = _Country; try { using (BC_CorporateSeller bs_Seller = new BC_CorporateSeller()) { DataTable dt = bs_Seller.LoadSpecific_BS_SellerProduct(_CategoryID, _SubcategoryID, _ProfileID, _Country); if (dt.Rows.Count > 0) { InitializeGridView(dt, grvRealEstate); } else { InitializeGridView(null, grvRealEstate); } } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
private void Page_ButtonDeleteImages_Click(object sender, RoutedEventArgs e) { if (_realtyListBox.SelectedIndex != -1) { RealEstate realEstate = (RealEstate)_realtyListBox.SelectedItem; if (realEstate.Pictures.Any()) { MessageBoxResult result = MessageBox.Show( $"Вы действительно хотите удалить изображения \"{realEstate}\"?", "Внимание!", MessageBoxButton.YesNo); if (result != MessageBoxResult.Yes) { return; } // удаляем все изображения недвижимости foreach (var p in _realtyDatabase.Pictures.Local.Where(image => image.RealEstateId == realEstate.Id).Reverse()) { _realtyDatabase.Pictures.Local.Remove(p); } _realtyDatabase.SaveChangesAsync(); RefreshListBox(); } } }
public async Task <IActionResult> applyForAppraisal([FromBody] RealEstate r) { dynamic result; if (r == null) { result = new JObject(); result.error = "Could not add real estate application."; return(new ObjectResult(result)); } context_.realEstates.Add(r); context_.SaveChanges(); var url = context_.realEstateCallbackURLs.FirstOrDefault(s => s.MLS_Id == r.MLS_Id && s.MortId == r.MortId); var callString = url.urlString; var stringTask = client_.PostAsync(callString, new StringContent("", Encoding.UTF8, "application/json")); var msg = await stringTask; //HttpResponse<String> jsonResponse = Unirest.post("https://prod-22.canadaeast.logic.azure.com:443/workflows/6663b6167d0f44b782fb91167859c27b/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Le5JWoPAlnfsOO_7Ub3wE2iL3XJb2gDg4ExElRfJ6qo") //.header("accept", "application/json") //.field("id", e.ID) //.asJson<String>(); return(new ObjectResult("{\"success\":\"The appraisal application was added.\"}")); }
void TcpProcess(TcpClient tcpClient) { try { stream = tcpClient.GetStream(); byte[] buff = new byte[256]; while (true) { StringBuilder builder = new StringBuilder(); do { int size = stream.Read(buff, 0, buff.Length); builder.Append(Encoding.UTF8.GetString(buff, 0, size)); } while (stream.DataAvailable); string[] ids = builder.ToString().Split('.'); realEstateId = Convert.ToInt32(ids[0]); clientId = Convert.ToInt32(ids[1]); tmpRealEstate = db.RealEstate.Single(x => x.Id == realEstateId); tmpClient = db.Clients.Single(x => x.Id == clientId); pendingClients.Add(tmpClient); listBoxPendingClients.DataSource = null; listBoxPendingClients.DataSource = pendingClients; listBoxPendingClients.DisplayMember = "FullName"; listBoxPendingClients.ValueMember = "Id"; Image bellImg = Image.FromFile(@"C:\Users\danle\source\repos\WindowsFormsExam\WindowsFormsRealEstateAdmin\img\yes_bell.png"); pictureBoxBell.Image = bellImg; } } catch (Exception) { } }
public async Task <IActionResult> PutRealEstate(int id, RealEstate realEstate) { if (id != realEstate.Id) { return(BadRequest()); } _context.Entry(realEstate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RealEstateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult ViewOrder(int OrderId) { if (OrderId <= 0) { return(Redirect("~/Home/Sorry")); } Order Order = db.Orders.Find(OrderId); if (Order == null) { return(Redirect("~/Home/Sorry")); } RealEstate r = db.RealEstates.Find(Order.RealEstateId); if (r == null) { return(Redirect("~/Home/Sorry")); } User us = Initialize().Result; if (us == null) { return(Redirect("~/Home/Sorry")); } ViewData["userHas"] = Convert.ToString(us.Orders != null); ViewData["orId"] = Convert.ToString(OrderId); ViewData["reId"] = Convert.ToString(Order.RealEstateId); return(View(Order)); }
/// <summary> /// Loads List of Real Estate of Classified Seller by Subcategory. /// </summary> /// <param name="_CategoryID"></param> /// <param name="_SubcategoryID"></param> private void LoadList_RealEstate_CL_SellerProduct(int _CategoryID, int _SubcategoryID) { RealEstate objRealEstate = new RealEstate(); RealEstateManager objrealEstatemanager = new RealEstateManager(); objRealEstate.CategoryID = _CategoryID; objRealEstate.SubcategoryID = _SubcategoryID; try { DataTable dt = objrealEstatemanager.Load_RealEstate_CLProductList_BySubcategory(objRealEstate); if (dt.Rows.Count > 0) { InitializeGridView(dt, grvRealEstate); } else { InitializeGridView(null, grvRealEstate); } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
private async void BtnCreate_Click(object sender, RoutedEventArgs e) { RealEstate realEstate = RealEstateFactory.addRealEstate( (Location)Enum.Parse(typeof(Location), cbxLocation.SelectedItem.ToString()), (RealEstateType)Enum.Parse(typeof(RealEstateType), cbxTypes.SelectedItem.ToString()), Convert.ToDouble(txtSquaremeter.Text, CultureInfo.InvariantCulture), Convert.ToInt32(txtRooms.Text), Convert.ToDouble(txtGardenSquaremeter.Text, CultureInfo.InvariantCulture), Convert.ToInt32(txtParkinglots.Text)); if (realEstate != null) { txtResult.Text = "Result: \n" + realEstate.ToString(); string stringPayload = await Task.Run(() => JsonConvert.SerializeObject(new RealEstateModel(realEstate.GetType().Name, realEstate.getLocation().ToString(), realEstate.getRooms(), realEstate.getSquaremeter(), realEstate.getGarden_squaremeter(), realEstate.getNum_of_parkinglots()))); StringContent httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json"); HttpResponseMessage response = await DAL.PostAsync(REST_URL, httpContent); if (response.IsSuccessStatusCode) { btnShowInList.IsEnabled = true; } else { btnShowInList.IsEnabled = false; } } else { txtResult.Text = "Not possible to create " + cbxTypes.SelectedItem.ToString() + " in " + cbxLocation.SelectedItem.ToString() + "."; } }
/// <summary> /// Before Update Checks if the Real estate title is duplicate, returns true if duplicate, false other wise. /// </summary> /// <param name="objReview"></param> /// <returns></returns> public bool BeforeUpdate_IsRealEstateTitle_Duplicate(RealEstate objRealEstate) { DataTable dt = null; Hashtable ht = new Hashtable(); ht.Add("@ProductID", objRealEstate.ProductID); ht.Add("@SubCategoryID", objRealEstate.SubcategoryID); ht.Add("@LocationID", objRealEstate.LocationID); ht.Add("@IsInsideDhaka", objRealEstate.IsInsideDhaka); ht.Add("@ProjectName", objRealEstate.ProjectName); try { dt = this.ExecuteStoredProcedureDataTable("USP_CP_RealEstate_BeforeUpdate_IsProjectNameDuplicate", ht); } catch { throw; } if (dt.Rows.Count > 0) { return(true); } else { return(false); } }
public int Add(RealEstate newRealEstate) { this.realEstates.Add(newRealEstate); this.realEstates.SaveChanges(); return(newRealEstate.Id); }
public async Task CreateAsync(CreateEstatesInputModel inputModel) { var estate = new RealEstate { Name = inputModel.Name, Municipality = inputModel.Municipality, Region = inputModel.Region, ResidentalArea = inputModel.ResidentalArea, Basements = inputModel.Basements, Floors = inputModel.Floors, BuildingNumber = inputModel.BuildingNumber, Attics = inputModel.Attics, Elevator = inputModel.Elevator, EntranceNumber = inputModel.EntranceNumber, Garages = inputModel.Garages, PostCode = inputModel.PostCode, StreetName = inputModel.StreetName, StreetNumber = inputModel.StreetNumber, Town = inputModel.Town, }; await this.repository.AddAsync(estate); await this.repository.SaveChangesAsync(); }
public IActionResult DeleteConfirm(RealEstate realEstate) { var realEstateDelete = _realEstateService.Delete(realEstate); TempData["DangerMessage"] = realEstateDelete.Message; return(RedirectToAction("Index", "RealEstate")); }
public FormRealEstateEditor(RealEstate realEstate) { InitializeComponent(); this.realEsate = realEstate; numericUpDownRooms.DecimalPlaces = 0; numericUpDownRooms.Minimum = 1; numericUpDownRooms.Maximum = 99; numericUpDownFloor.DecimalPlaces = 0; numericUpDownFloor.Minimum = 1; numericUpDownFloor.Maximum = 99; textBoxPrice.Text = "0"; comboBoxCity.DataSource = Enum.GetValues(typeof(Cities)); ofd.Title = "Select profile photo"; ofd.Filter = "JPG|*.jpg|PNG|*.png"; ofd.Multiselect = false; textBoxStreet.Text = realEstate.Street; comboBoxCity.SelectedItem = realEstate.City; textBoxPrice.Text = realEstate.Price.ToString(); numericUpDownFloor.Value = realEstate.Floor; numericUpDownRooms.Value = realEstate.Rooms; textBoxDescription.Text = realEstate.Description; photoSlider = ImageManip.ByteArrToPhotoSlider(realEstate.PhotoSlider); pictureBoxSlider.Image = ImageManip.ByteArrayToImage(photoSlider[photoNumber]); }
private void Page_ButtonAddImages_Click(object sender, RoutedEventArgs e) { RealEstate realEstate = (RealEstate)_realtyListBox.SelectedItem; if (realEstate == null) { return; } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Filter = "Images (*.jpg)|*.jpg|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == true) { foreach (string filename in openFileDialog.FileNames) { _realtyDatabase.Pictures.Local.Add(new Picture { Name = Path.GetFileName(filename), Content = File.ReadAllBytes(filename), RealEstateId = realEstate.Id }); } RefreshListBox(); } }
public List <RealEstate> getEstates() { RealEstate estate1 = new RealEstate(); estate1.Price = 123; estate1.Price = 23; estate1.Address = "ShenYang"; estate1.Bath = 2; estate1.Beds = 30; estate1.Soft = 2894; RealEstate estate2 = new RealEstate(); estate2.Price = 1223; estate2.Price = 232; estate2.Address = "Argentina"; estate2.Bath = 21; estate2.Beds = 301; estate2.Soft = 28914; List <RealEstate> arList = new List <RealEstate>(); arList.Add(estate1); arList.Add(estate2); return(arList); }
private void buttonEvict_Click(object sender, EventArgs e) { Client selectedClient = listBoxClients.SelectedItem as Client; if (selectedClient == null) { return; } if (selectedClient.Username == "admin") { MessageBox.Show("You cant evict admin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (selectedClient.Status == Status.Renting || selectedClient.Status == Status.Waiting) { Client client = db.Clients.Single(x => x.Id == selectedClient.Id); client.Status = Status.None; RealEstate tmp = db.RealEstate.Single(x => x.Id == selectedClient.Id); int realEstateClientId = tmp.Id; tmp = db.RealEstate.Single(x => x.Id == realEstateClientId); tmp.Client = db.Clients.FirstOrDefault(); tmp.Status = Status.None; } else { MessageBox.Show("This client not renting anything", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
/// <summary> /// Generates a list of seller specific by ProvinceID. /// </summary> /// <param name="intCategoryID"></param> /// <param name="intSubcategoryID"></param> /// <param name="intProfileID"></param> /// <param name="strCountry"></param> private void LoadList_LatestPosted_RealEstate_ByArea_InsideDhaka(int intCategoryID, int intSubcategoryID, int intAreaID) { try { using (BC_RealEstate bcRealEstate = new BC_RealEstate()) { RealEstate objRealEstate = new RealEstate(); objRealEstate.CategoryID = intCategoryID; objRealEstate.SubcategoryID = intSubcategoryID; objRealEstate.AreaID = intAreaID; DataTable dt = bcRealEstate.Load_List_RealEstate_ByArea_InsideDhaka(objRealEstate); if (dt.Rows.Count > 0) { InitializeGridView(dt, grvRealEstate); } else { InitializeGridView(null, grvRealEstate); } } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
public int Add(RealEstate newRealEstate) { this.realEstates.Add(newRealEstate); this.realEstates.SaveChanges(); return newRealEstate.Id; }
public void FilterRealEstates_ReturnTheWholeList(int numberReturned, bool expected) { var re = new RealEstate(); var list = _fm.FilterRealEstates(_cp, re); Assert.AreEqual(expected ,list.Count == numberReturned); }
/// <summary> /// Gets all <see cref="PublishObject"/>s for a RealEstate object. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <param name="channelId">The channelId of the channel (default is all).</param> /// <exception cref="IS24Exception"></exception> public async Task<PublishObjects> GetAsync(RealEstate realEstate, int? channelId = null) { var req = Connection.CreateRequest("publish"); req.AddParameter("realestate", realEstate.Id); if (channelId != null) req.AddParameter("publishchannel", channelId.Value); var pos = await ExecuteAsync<PublishObjects>(Connection, req); return pos; }
public ActionResult RealEstates_Destroy([DataSourceRequest]DataSourceRequest request, RealEstate realEstate) { var realEstateFromDb = this.realEstatesService.GetById(realEstate.Id).First(); this.realEstatesService.Delete(realEstateFromDb); return Json(new[] { realEstate }.ToDataSourceResult(request, this.ModelState)); }
/// <summary> /// Creates a new <see cref="RealEstateItem"/> instance /// </summary> /// <param name="realEstate"><see cref="RealEstate"/> data item</param> /// <param name="connection">The <see cref="IIS24Connection"/> used for querying the API</param> public RealEstateItem(RealEstate realEstate, IIS24Connection connection) { RealEstate = realEstate; Attachments = new AttachmentResource(realEstate, connection); Publish = new PublishResource(connection); PremiumPlacements = new PremiumPlacementResource(connection, realEstate); TopPlacements = new TopPlacementResource(connection, realEstate); ShowcasePlacements = new ShowcasePlacementResource(connection, realEstate); }
public int AddNew(RealEstate newRealEstate, string userId) { newRealEstate.CreatedOn = DateTime.Now; newRealEstate.UserId = userId; this.realEstates.Add(newRealEstate); this.realEstates.SaveChanges(); return newRealEstate.Id; }
public void FilterRealEstates_ReturnOneElement(int numberReturned,int codePassed, bool expected) { var re = new RealEstate() { code = codePassed }; var list = _fm.FilterRealEstates(_cp, re); Assert.AreEqual(expected, list.Count == numberReturned); }
//Work In Progress public List<RealEstate> FilterRealEstates(Corporation cp, RealEstate re) { List<RealEstate> resultList = new List<RealEstate>(); foreach (var item in cp.RealEstates) { bool ToAdd = true; if (ToAdd && re.code != 0) { if (!item.code.Equals(re.code)) ToAdd = false; } if (ToAdd && re.zip != 0) { if (!item.zip.Equals(re.zip)) ToAdd = false; } if (ToAdd && !String.IsNullOrWhiteSpace(re.city)) { if (item.city == null) { ToAdd = false; } else if (!item.city.ToLower().Contains(re.city.ToLower())) ToAdd = false; } if (ToAdd && !String.IsNullOrWhiteSpace(re.state)) { if (item.state == null) { ToAdd = false; } else if (!item.state.ToLower().Contains(re.city.ToLower())) ToAdd = false; } if (ToAdd && !String.IsNullOrWhiteSpace(re.street)) { if (item.street == null) { ToAdd = false; } else if (!item.street.ToLower().Contains(re.street.ToLower())) ToAdd = false; } if (ToAdd == true) { resultList.Add(item); } } return resultList; }
/// <summary> /// Creates a RealEstate object. /// </summary> /// <param name="re">The RealEstate object.</param> public async Task CreateAsync(RealEstate re) { var req = Connection.CreateRequest("realestate", Method.POST); req.AddParameter("usenewenergysourceenev2014values", "true", ParameterType.QueryString); req.AddBody(re); var resp = await ExecuteAsync<Messages>(Connection, req); var id = resp.ExtractCreatedResourceId(); if (!id.HasValue) { throw new IS24Exception(string.Format("Error creating RealEstate {0}: {1}", re.ExternalId, resp.ToMessage())) { Messages = resp }; } re.Id = id.Value; }
/// <summary> /// Depublishes a RealEstate object. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <param name="channelId">The channelId of the channel to depublish from.</param> /// <exception cref="IS24Exception"></exception> public async Task UnpublishAsync(RealEstate realEstate, int channelId) { var pos = await GetAsync(realEstate, channelId); if (pos.PublishObject != null && pos.PublishObject.Any()) { var req = Connection.CreateRequest("publish/{id}", Method.DELETE); req.AddParameter("id", pos.PublishObject[0].Id, ParameterType.UrlSegment); var pres = await ExecuteAsync<Messages>(Connection, req); if (!pres.IsSuccessful(MessageCode.MESSAGE_RESOURCE_DELETED)) { throw new IS24Exception(string.Format("Error depublishing RealEstate {0}: {1}", realEstate.ExternalId, pres.ToMessage())) { Messages = pres }; } } }
/// <summary> /// Publishes a RealEstate object. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <param name="channelId">The channelId of the channel to publish to.</param> /// <exception cref="IS24Exception"></exception> public async Task PublishAsync(RealEstate realEstate, int channelId) { var pos = await GetAsync(realEstate, channelId); if (pos.PublishObject == null || !pos.PublishObject.Any()) { var req = Connection.CreateRequest("publish", Method.POST); var p = new PublishObject { PublishChannel = new PublishChannel { Id = channelId }, RealEstate = new PublishObjectRealEstate { Id = realEstate.Id } }; req.AddBody(p); var pres = await ExecuteAsync<Messages>(Connection, req); if (!pres.IsSuccessful(MessageCode.MESSAGE_RESOURCE_CREATED)) throw new IS24Exception(string.Format("Error publishing RealEstate {0}: {1}", realEstate.ExternalId, pres.ToMessage())) { Messages = pres }; } }
public bool AddRealEstate(string id, RealEstate estate) { var corporation = GetCorporation(id); if (corporation.RealEstates == null) { corporation.RealEstates = new List<RealEstate>(); } corporation.RealEstates.Add(estate); _corporation.Save<Corporation>(corporation); //MANCA LA GESTIONE DELL'ERRORE --- DA FARE //WriteConcernResult x = new WriteConcernResult(response: corporation.ToBsonDocument()); //if (x.HasLastErrorMessage) // return false; return true; }
public int Add(string title, string description, string address, string contact, int construcionYear, int type) { RealEstate newEstate = new RealEstate() { Title = title, Description = description, Type = (Type)type, SellOption = SellOption.ForRenting, Address = address, ConstructionYear = construcionYear, Contact = contact, }; this.realEstates.Add(newEstate); this.realEstates.SaveChanges(); return newEstate.Id; }
public RealEstate CreateRealEstate(string title, string description, string address, string contact, int constructionYear, decimal sellingPrice, decimal rentingPrice, RealEstateBuildingType realEstateBuildingType, RealEstateContractType realEstateContractType, string userId) { var newRealEstate = new RealEstate() { Title = title, Description = description, Address = address, Contact = contact, ConstructionYear = constructionYear, SellingPrice = sellingPrice, RentingPrice = rentingPrice, RealEstateBuildingType = realEstateBuildingType, RealEstateContractType = realEstateContractType, UserId = userId }; this.realEstates.Add(newRealEstate); this.realEstates.SaveChanges(); return newRealEstate; }
public void SavePhoto(RealEstate dbRealEstate, string realEstateEncodedId, HttpPostedFileBase photo) { if (photo != null && photo.ContentLength > 0 && photo.ContentLength < (1 * 1024 * 1024) && photo.ContentType == "image/jpeg") { string directory = HttpContext.Current.Server.MapPath("~/UploadedFiles/RealEstatePhotos/") + realEstateEncodedId; if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } string filename = Guid.NewGuid().ToString() + ".jpg"; string path = directory + "/" + filename; string url = "~/UploadedFiles/RealEstatePhotos/" + realEstateEncodedId + "/" + filename; photo.SaveAs(path); var newPhoto = new Photo { SourceUrl = url, RealEstate = dbRealEstate }; this.photosService.Add(newPhoto); } }
public void Update(RealEstate realEstate) { this.realEstates.Update(realEstate); this.realEstates.SaveChanges(); }
public void Delete(RealEstate realEstateFromDb) { this.realEstates.Delete(realEstateFromDb); }
public void UpdateRealEstate(RealEstate realEstate) { this.realEstates.Update(realEstate); }
public bool AddRealEstate( int realEstateTier ) { float realEstateCost = RealEstate.RealEstatePrices[realEstateTier]; if (playerRealEstate.Count >= MAX_REALESTATE) { Debug.LogWarning("MAX REALESTATE REACHED"); return false; } if (realEstateCost <= money) { Debug.Log ("REAL ESTATE COST " + realEstateCost); AddLoanCost(realEstateCost, Loan.LoanType.RealEstate); RealEstate newRealEstate = new RealEstate(); newRealEstate.SetTier( (RealEstate.RealEstateTier)realEstateTier ); playerRealEstate.Add( newRealEstate ); GUIManager.s_instance.DisplayNotification("Notice!", "Real Estate Loan Added."); return true; } else { GUIManager.s_instance.DisplayNotification( "Notice!", "Insufficient Funds." ); return false; } }
public bool UpdateRealEstate(IRepository repository, string id, int position, RealEstate realEstate) { var result = repository.UpdateRealEstate(id, position, realEstate); return result; }
/// <summary> /// Publishes a RealEstate object to the IS24 channel. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <returns></returns> public Task PublishAsync(RealEstate realEstate) { return PublishAsync(realEstate, ImportExportClient.ImmobilienscoutPublishChannelId); }
/// <summary> /// Publishes a RealEstate object. /// </summary> /// <param name="realEstate">The RealEstate object.</param> /// <param name="publishChannel">The channel to publish to.</param> /// <returns></returns> public Task PublishAsync(RealEstate realEstate, PublishChannel publishChannel) { return PublishAsync(realEstate, (int)publishChannel.Id); }
/// <summary> /// Adds a real estate object to the real estate project identified by the specified id. /// </summary> /// <param name="realEstateProjectId">The id.</param> /// <param name="realEstate">Identifies the real estate object.</param> /// <returns> /// The task object representing the asynchronous operation. /// </returns> public Task<RealEstateProjectEntries> AddAsync(long realEstateProjectId, RealEstate realEstate) { return AddAsync(realEstateProjectId, new[] { realEstate }); }
/// <summary> /// Creates a new <see cref="RealEstateItem"/> instance /// </summary> /// <param name="realEstate"><see cref="RealEstate"/> data item</param> /// <param name="connection">The <see cref="IIS24Connection"/> used for querying the API</param> public RealEstateItem(RealEstate realEstate, IIS24Connection connection) { RealEstate = realEstate; Attachments = new AttachmentResource(realEstate, connection); }
public bool UpdateRealEstate(string Id, int position, RealEstate estate) { var _id = ObjectId.Parse(Id); IMongoQuery query = Query.And(Query<Corporation>.EQ(t => t.Id, _id)); IMongoUpdate update = Update<Corporation> .Set(y => y.RealEstates[position].city, estate.city) .Set(y => y.RealEstates[position].code, estate.code) .Set(y => y.RealEstates[position].state, estate.state) .Set(y => y.RealEstates[position].street, estate.street) .Set(y => y.RealEstates[position].zip, estate.zip); _corporation.Update(query, update); //_realEstate.Update(query, update); //MANCA LA GESTIONE DELL'ERRORE --- DA FARE //WriteConcernResult x = new WriteConcernResult(response: update.ToBsonDocument()); //if (!x.UpdatedExisting) // return false; return true; }
public bool AddRealEstate(IRepository repository, string id, RealEstate realEstate) { var result = repository.AddRealEstate(id, realEstate); return result; }
/// <summary> /// Creates a new <see cref="AttachmentResource"/> instance /// </summary> /// <param name="realEstate"></param> /// <param name="connection"></param> public AttachmentResource(RealEstate realEstate, IIS24Connection connection) { RealEstate = realEstate; Connection = connection; AttachmentsOrder = new AttachmentsOrderResource(realEstate, connection); }
/// <summary> /// Updates a RealEstate object. /// </summary> /// <param name="re">The RealEstate object.</param> public async Task UpdateAsync(RealEstate re) { var req = Connection.CreateRequest("realestate/{id}", Method.PUT); req.AddParameter("usenewenergysourceenev2014values", "true", ParameterType.QueryString); req.AddParameter("id", re.Id, ParameterType.UrlSegment); req.AddBody(re); var messages = await ExecuteAsync<Messages>(Connection, req); if (!messages.IsSuccessful()) { throw new IS24Exception(string.Format("Error updating RealEstate {0}: {1}", re.ExternalId, messages.ToMessage())) { Messages = messages }; } }