public Task Handle(AdditionalLocationImageCreatedEvent message) { Location location = _locationRepository.Find(message.LocationId); if (location == null) { return(Task.FromResult(0)); } LocationImage image = new LocationImage { Id = message.Id, LocationId = message.LocationId, SiteId = message.SiteId, Image = message.Image }; if (location.AdditionalLocationImages == null) { location.AdditionalLocationImages = new ObservableCollection <LocationImage>(); } location.AdditionalLocationImages.Add(image); _locationRepository.SaveChanges(); return(Task.CompletedTask); }
public static void FillLocationImageUrl(this LocationImage locationImage, string picBaseUrl, bool azureStorageEnabled) { locationImage.ImageUri = azureStorageEnabled ? picBaseUrl + locationImage.Image : picBaseUrl.Replace("[0]", locationImage.SiteId.ToString()) .Replace("[1]", locationImage.LocationId.ToString()) .Replace("[2]", locationImage.Id.ToString()); }
public ActionResult DeleteConfirmed(int id) { LocationImage locationImage = db.LocationImages.Find(id); db.LocationImages.Remove(locationImage); db.SaveChanges(); return(RedirectToAction("Index")); }
// on click public void showLocation() { if (profileManager == null) { return; } LocationImage location = Instantiate(locationImagePrefab, profileManager.GetComponentInParent <Canvas>().transform) as LocationImage; location.setup(profileManager, sprite); }
public ActionResult Edit([Bind(Include = "ImageId,ImageURL,LocationId")] LocationImage locationImage) { if (ModelState.IsValid) { db.Entry(locationImage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Tourisms, "LocationId", "LocationName", locationImage.LocationId); return(View(locationImage)); }
public ActionResult Create([Bind(Include = "ImageId,ImageURL,LocationId")] LocationImage locationImage) { if (ModelState.IsValid) { db.LocationImages.Add(locationImage); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Tourisms, "LocationId", "LocationName", locationImage.LocationId); return(View(locationImage)); }
// GET: Panel/LocationImages/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationImage locationImage = db.LocationImages.Find(id); if (locationImage == null) { return(HttpNotFound()); } return(View(locationImage)); }
// GET: Panel/LocationImages/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationImage locationImage = db.LocationImages.Find(id); if (locationImage == null) { return(HttpNotFound()); } ViewBag.LocationId = new SelectList(db.Tourisms, "LocationId", "LocationName", locationImage.LocationId); return(View(locationImage)); }
public async Task AddAdditionalLocationImage(Guid siteId, Guid locationId, byte[] image) { var location = FindExistingLocation(siteId, locationId); var locationImage = new LocationImage(siteId, locationId, image); location.AddImage(locationImage); //await _eventStoreSession.Add<Location>(location); //await _eventStoreSession.Commit(); //_locationRepository.Update(location); //_locationRepository.UnitOfWork.Commit(); await _businessIntegrationEventService .PublishThroughEventBusAsync(new AdditionalLocationImageCreatedEvent(location.Id, location.SiteId, image)); }
void ReleaseDesignerOutlets() { if (EmailImage != null) { EmailImage.Dispose(); EmailImage = null; } if (EmailTF != null) { EmailTF.Dispose(); EmailTF = null; } if (FaxusTF != null) { FaxusTF.Dispose(); FaxusTF = null; } if (InternationalCallerTF != null) { InternationalCallerTF.Dispose(); InternationalCallerTF = null; } if (LocationImage != null) { LocationImage.Dispose(); LocationImage = null; } if (PhoneNumberTF != null) { PhoneNumberTF.Dispose(); PhoneNumberTF = null; } if (PostusTF != null) { PostusTF.Dispose(); PostusTF = null; } if (SendDX != null) { SendDX.Dispose(); SendDX = null; } if (TeleImage != null) { TeleImage.Dispose(); TeleImage = null; } if (EmailButton != null) { EmailButton.Dispose(); EmailButton = null; } }
private Location UpdateLocation(BusinessDbContext context, string[] column, string[] headers, Dictionary <String, Guid> siteIdLookup, string contentRootPath) { if (column.Count() != headers.Count()) { throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'"); } var location = context.Locations.Where(y => y.Name.Equals(column[Array.IndexOf(headers, "storename")].Trim('"').Trim())).SingleOrDefault(); Address address = new Address(column[Array.IndexOf(headers, "shopaddress")].Trim('"').Trim(), "Hongkong", "Hongkong", "", "China"); Geolocation geolocation = new Geolocation( double.Parse(column[Array.IndexOf(headers, "latitude")].Trim('"').Trim()), double.Parse(column[Array.IndexOf(headers, "longitude")].Trim('"').Trim()) ); ContactInformation contactInformation = new ContactInformation("Chanel", column[Array.IndexOf(headers, "telephone")].Trim('"').Trim(), column[Array.IndexOf(headers, "telephone")].Trim('"').Trim(), "*****@*****.**" ); location.ChangeAddress(address); location.ChangeGeolocation(geolocation); location.ChangeContactInformation(contactInformation); string picFileLogo = Path.Combine(contentRootPath, "Setup", "ChanelLogoMini.png"); string picFileLocation = Path.Combine(contentRootPath, "Setup", "*****@*****.**"); //byte[] logo; //using (var memoryStream = new MemoryStream()) //{ // (new StreamReader(picFileLogo)).BaseStream.CopyTo(memoryStream); // logo = memoryStream.ToArray(); //} var dir = siteIdLookup["Chanel"].ToString() + "/" + location.Id.ToString(); var abs_dir = Path.Combine(contentRootPath + "/Pics/", dir); if (!Directory.Exists(abs_dir)) { Directory.CreateDirectory(abs_dir); } var fileName = "1.png"; var path = Path.Combine(abs_dir, fileName); //using (var memoryStream = new MemoryStream()) //{ //(new StreamReader(picFileLogo)).BaseStream.CopyTo(memoryStream); using (var stream = new FileStream(path, FileMode.Create)) { (new StreamReader(picFileLogo)).BaseStream.CopyTo(stream); stream.Flush(); } //} location.ChangeImage(dir + "/" + fileName); fileName = "2.png"; path = Path.Combine(abs_dir, fileName); //using (var memoryStream = new MemoryStream()) //{ //(new StreamReader(picFileLocation)).BaseStream.CopyTo(memoryStream); using (var stream = new FileStream(path, FileMode.Create)) { (new StreamReader(picFileLocation)).BaseStream.CopyTo(stream); stream.Flush(); } //} LocationImage locationImage = new LocationImage(siteIdLookup["Chanel"], location.Id, dir + "/" + fileName); location.AddAdditionalImage(locationImage); return(location); }