public CustomPlace(PlaceEntity place) { this.Id = place.Id; this.Name = place.Name; this.Latitude = place.Location.Latitude; this.Longitude = place.Location.Longitude; }
public int Add(PlaceEntity place) { int new_id = _unitOfWork.PlaceRepository.Insert(place, _unitOfWork.Save); //_unitOfWork.Save(); return(new_id); }
public int Insert(PlaceEntity entity) { _context.Places.Add(entity); _context.SaveChanges(); return(entity.PlaceId); }
private void ProvidePlaceExistence(AlbumEntity album) { PlaceEntity place = _context.Places.FirstOrDefault(p => p.Id == album.PlaceId); if (place != null && PlaceEqualityComparer.AreEqual(album.Place, place)) { return; } place = _context.Places.AsEnumerable() .Where(p => PlaceEqualityComparer.AreEqual(p, album.Place)) .FirstOrDefault(); if (place != null) { album.PlaceId = place.Id; album.Place = place; return; } PlaceEntity newPlace = new PlaceEntity { Name = album.Place.Name, City = album.Place.City, Country = album.Place.Country }; newPlace = _context.Places.Add(newPlace); _context.SaveChanges(); album.PlaceId = newPlace.Id; album.Place = null; }
public IHttpActionResult AddWithPlace([FromBody] InfoPlacePostDTO info) { int id = 0; if (ModelState.IsValid) { try { PlaceEntity placeDomain = _DTOAssempler.CreatePlaceEntity(info); InfoEntity infoDomain = _DTOAssempler.CreateInfoEntity(info); IInfoServices infoService = ServiceFactory.getInfoServices(); id = infoService.NewInfo(infoDomain, placeDomain); } catch (Exception e) { return(BadRequest(e.Message)); } } else { return(BadRequest("Neispravni podaci")); } return(Ok(id)); }
public CRUD_Place(PlaceEntity newPlace) { InitializeComponent(); place = newPlace; btnPlaceCrudOK.DialogResult = DialogResult.None; btnPlaceCrudCancel.DialogResult = DialogResult.Cancel; #region Initialization if (place.Id != 0) { tbPlaceCrudID.Text = place.Id.ToString(); } else { tbPlaceCrudID.Text = ""; } tbPlaceCrudName.Text = place.Name; try { tbPlaceCrudLat.Text = place.Location.Latitude.ToString(); tbPlaceCrudLon.Text = place.Location.Longitude.ToString(); } catch (System.NullReferenceException e) { tbPlaceCrudLat.Text = ""; tbPlaceCrudLon.Text = ""; } #endregion }
public bool SavePlace(Place place) { bool result = false; ISession session = SessionFactory.GetSession(); ITransaction tx = session.BeginTransaction(); try { EntityConverter converter = new EntityConverter(); PlaceEntity dataEntity = converter.FromBusinessEntity(place); session.SaveOrUpdate(dataEntity); tx.Commit(); place.ID = dataEntity.ID; result = true; } catch (Exception ex) { Logger.Write(ex); tx.Rollback(); } finally { session.Close(); tx.Dispose(); } return(result); }
public async Task <ResourceResponse <Document> > Add(PlaceEntity record) { using (var client = new DocumentClient(new Uri(Endpoint), Key)) { return(await client.CreateDocumentAsync(_collectionUri, record)); } }
public static PlaceResultModel ToPlaceResultModel(PlaceEntity entity) { return(new PlaceResultModel { Id = entity.Id, Name = entity.Name }); }
private async Task <Place> GetPlaceFromEntity(PlaceEntity entity) { Place place = new Place(entity); place.ListPicturePlace = await this.picturePlaceBusiness.FindAllFromPlaceId(entity.Id); return(place); }
public int NewInfo(InfoEntity info, PlaceEntity place) { info.placeId = _unitOfWork.PlaceRepository.Insert(place, _unitOfWork.Save); int new_id = _unitOfWork.InfoRepository.Insert(info, _unitOfWork.Save); //_unitOfWork.Save(); return(new_id); }
public PestForm(PlaceEntity place) { InitializeComponent(); this.place = place; lblPestDialog.Text = "Are you sure you want to delete place " + place.Name + "?\n This cannot be undone."; btnPestYes.DialogResult = DialogResult.Yes; btnPestNo.DialogResult = DialogResult.No; }
public void Update(PlaceEntity entity) { string sql = "update place set name = @Name, longitude = @Longitude, latitude = @Latitude, time_machine_id = @TimeMachineId where id = @Id;"; using (var sqliteConn = connectionProvider.GetConnection()) { sqliteConn.Execute(sql, new { id = entity.Id, Name = entity.Name, Longitude = entity.Longitude, Latitude = entity.Latitude, TimeMachineId = entity.TimeMachineId }); } }
public void Create(PlaceEntity entity) { string sql = "insert into place(name, longitude, latitude, time_machine_id) values (@Name, @Longitude, @Latitude, @TimeMachineId);"; using (var sqliteConn = connectionProvider.GetConnection()) { sqliteConn.Execute(sql, new { Name = entity.Name, Longitude = entity.Longitude, Latitude = entity.Latitude, TimeMachineId = entity.TimeMachineId }); } }
public AlbumCreator(IPhotosDbContext context, AlbumOverview photosOverview, PlaceRegister placeRegister, IEnumerable <IPhotoImage> photoImages) { Verifiers.ArgNullVerify(photosOverview, nameof(photosOverview)); _context = context; _photosOverview = photosOverview; _place = placeRegister.Register(_photosOverview.Place, _photosOverview.City, _photosOverview.Country); _photoImages = photoImages; }
private void btnPlaceDetails_Click(object sender, EventArgs e) { int placeIndex = dgvPlaceTable.CurrentCell.RowIndex; PlaceEntity place = AllPlaces.ElementAt(placeIndex); CRUD_Place crudPlace = new CRUD_Place(place); crudPlace.makeReadOnly(); crudPlace.Show(); }
public Place ReadPlaceById(long idPlace) { PlaceEntity placeEntity = new PlaceEntity(); placeEntity = dbCtx.PlaceEntity.Where(c => c.IdPlace == idPlace).FirstOrDefault(); IMapper mapper = _placeConfig.CreateMapper(); return(mapper.Map <PlaceEntity, Place>(placeEntity)); }
public PlaceEntity CreatePlaceEntity(InfoPlacePostDTO info) { PlaceEntity placeDomain = new PlaceEntity() { Name = info.Name, Location = new GeoCoordinate(info.Latitude, info.Longitude) }; return(placeDomain); }
private static PhotoEntity CreatePhoto(IHttpFile httpFile, PlaceEntity place) { return(new PhotoEntity { Title = httpFile.FileName, Image = httpFile.Data, ImageType = ImageMimeTypeConverter.ToImageType(httpFile.ContentType), Place = place }); }
public Place ToDALModel(PlaceEntity place) { Place placeDAL = new Place() { Name = place.Name, Location = DbGeography.PointFromText(String.Format("POINT({0} {1})", place.Location.Longitude.ToString().Replace(',', '.'), place.Location.Latitude.ToString().Replace(',', '.')), 4326) }; return(placeDAL); }
public PlaceVo toMoreVo(PlaceEntity entity) { PlaceVo vo = toVo(entity); List <TheTimeMachineEntity> theTimeMachineEntityList = theTimeMachineMeta.GetEntityList(); vo.TimeMachineId = theTimeMachineConvertor.getMoreVoList(theTimeMachineEntityList, entity.TimeMachineId); return(vo); }
public PlaceEntity CustomToDomain() { PlaceEntity place = new PlaceEntity(); place.Id = this.Id; place.Name = this.Name; place.Location = new GeoCoordinate(Latitude, Longitude); return(place); }
public PlaceEntity ToDomainModel(Place place) { PlaceEntity placeDomain = new PlaceEntity() { Id = place.Id, Name = place.Name, Location = new GeoCoordinate(place.Location.Latitude, place.Location.Longitude) }; return(placeDomain); }
public PestForm(UserEntity user) { InitializeComponent(); this.user = user; this.info = null; this.place = null; lblPestDialog.Text = "Are you sure you want to delete user " + user.Username + "?\n This cannot be undone."; btnPestYes.DialogResult = DialogResult.Yes; btnPestNo.DialogResult = DialogResult.No; }
public PlaceEntity toEntity(PlaceCreateRequest request) { PlaceEntity entity = new PlaceEntity(); entity.Name = request.Name; entity.Longitude = request.Longitude; entity.Latitude = request.Latitude; entity.TimeMachineId = request.TimeMachineId != null ? request.TimeMachineId.Value : 0; return(entity); }
/// <summary> /// 将entity转换为vo。不包括来自元数据的属性 /// </summary> private PlaceVo toVo(PlaceEntity entity) { PlaceVo vo = new PlaceVo(); vo.Id = entity.Id; vo.Name = entity.Name; vo.Longitude = entity.Longitude; vo.Latitude = entity.Latitude; return(vo); }
private void btnPlaceAdd_Click(object sender, EventArgs e) { PlaceEntity place = new PlaceEntity(); CRUD_Place crudPlace = new CRUD_Place(place); crudPlace.ShowDialog(); if (crudPlace.DialogResult == DialogResult.OK) { AllPlaces.Add(place); dgvPlaceTable.Invalidate(); } }
public void BasicPlaceTest() { var pe = new PlaceEntity(); pe.Id = 7; pe.Name = "FER"; var loc = new GeoCoordinate(12.25, 25.5); pe.Location = loc; Assert.AreEqual(pe.Id, 7, "Wrong Id"); Assert.AreEqual(pe.Name, "FER", "Wrong Name"); Assert.AreEqual(pe.Location, loc, "Wrong Location"); }
private void btnPlaceDelete_Click(object sender, EventArgs e) { int placeIndex = dgvPlaceTable.CurrentCell.RowIndex; PlaceEntity place = AllPlaces.ElementAt(placeIndex); PestForm areYouSure = new PestForm(place); areYouSure.ShowDialog(); if (areYouSure.DialogResult == DialogResult.Yes) { dgvPlaceTable.Rows.RemoveAt(placeIndex); dgvPlaceTable.Invalidate(); } }
private void btnPlaceEdit_Click(object sender, EventArgs e) { int placeIndex = dgvPlaceTable.CurrentCell.RowIndex; PlaceEntity place = AllPlaces.ElementAt(placeIndex); CRUD_Place crudPlace = new CRUD_Place(place); crudPlace.editing = true; crudPlace.ShowDialog(); if (crudPlace.DialogResult == DialogResult.OK) { dgvPlaceTable.InvalidateRow(placeIndex); } }
public void Add(Place place, long userId) { if (place == null) { throw new ArgumentNullException("place"); } if (string.IsNullOrEmpty(place.Description.Trim())) { throw new ArgumentNullException("place.Description"); } if (place.Location == null) { throw new ArgumentNullException("place.Location"); } // try to set the place page name var name = this.GetAscii(place.Description); if (!this.IsAvailable(name)) { // if it's not available, try to concat the location to the name name = GetAscii(name + place.Location.Description); // if it's not available, try to concat a number if (!this.IsAvailable(name)) { name = this.GetAscii(place.Description); int c = 1; while (!this.IsAvailable(name + c)) { c++; } name = name + c; } } var placeEntity = new PlaceEntity { Name = place.Description, Description = place.Info, Address = place.Address, LocationId = place.Location.Id, MapUa = place.MapUa, MapVa = place.MapVa, Phone = place.Phone, HowToArrive = place.HowToArrive, DateFrom = DateTime.Now, IsActive = false, Page = name, CreatedBy = userId, }; foreach (var s in place.Services) placeEntity.Services.Add(new Fulbaso.EntityFramework.PlaceService { Service = (byte)s }); _context.AddToPlaces(placeEntity); _context.SaveChanges(); place.Id = placeEntity.Id; place.Page = placeEntity.Page; _context.AddToUserPlaces(new UserPlaceEntity { PlaceId = place.Id, UserId = userId, Role = "Owner", }); _context.SaveChanges(); }