public async Task <ActionResult <İcraSonuç> > Put(Restoran restoran) { try { var sonuç = await BisiparişVeriAltYapı.RestoranlarVeriYardımcı.RestoranDeğiştir(restoran); return(sonuç); //if (sonuç.BaşarılıMı) // return Ok(); //else // return BadRequest(sonuç.Mesaj); } catch (Exception ex) { throw ex; } }
public RestoranGörünümModel(Restoran rst) { Id = rst.Id; İsim = rst.İsim; Tür = rst.Tür; İletişimId = rst.İletişimId; RestoranTürler = new Dictionary <RestoranTürler, string>() { { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.CafeVeİçecek, "Cafe ve İçecek" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.Kahvaltı, "Kahvaltı" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.Lokanta, "Lokanta" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.LüksYemek, "Lüks Yemek" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.Pastaneler, "Pastaneler" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.RomantikMekanlar, "Romantik Mekanlar" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.SokakLezzetleri, "Sokak Lezzetleri" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.Yemek, "Yemek" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.YeVeKalk, "Ye ve Kalk" }, { BisiparişÇekirdek.Valıklar.Erzak.RestoranTürler.Tatlıcı, "Tatlıcı" }, }; }
private void button1_Click(object sender, EventArgs e) { if (Atama.kategori == "Muze") { this.Hide(); Muze muze = new Muze(); muze.Show(); } if (Atama.kategori == "Tur") { this.Hide(); Tur tur = new Tur(); tur.Show(); } if (Atama.kategori == "Otel") { this.Hide(); Otel otel = new Otel(); otel.Show(); } if (Atama.kategori == "Restoran") { this.Hide(); Restoran rest = new Restoran(); rest.Show(); } if (Atama.kategori == "Odeme") { this.Hide(); Odeme odeme = new Odeme(); odeme.Show(); } if (Atama.kategori == "Anasayfa") { this.Hide(); anasayfa ana = new anasayfa(); ana.Show(); } }
public void dodajRestoran() { Random rand = new Random(); int x = rand.Next(100, 1000); string id = x.ToString(); Restoran daLiPostoji = DataProvider.GetRestoran(id); string naziv = this.txtNaziv.Text; string adresa = this.txtAdresa.Text; //string lokacija = this.txtLokacija.Text; string lokacija = this.cboxLokacija.SelectedItem.ToString(); string radnoV = this.txtRadnoVreme.Text; string telefon = this.txtTelefon.Text; int vremeCekanja = (int)this.numVremeCekanja.Value; int ocena = (int)this.numOcena.Value; string muzika; if (this.cbMuzika.Checked == true) { muzika = "da"; } else { muzika = "ne"; } if (daLiPostoji.naziv == null) { bool dodat = DataProvider.AddRestoran(id, naziv, adresa, lokacija, radnoV, telefon, vremeCekanja, ocena, muzika); if (dodat) { MessageBox.Show("Uspesno ste dodali restoran: " + naziv); } else { MessageBox.Show("Neuspesno dodavanje restorana!"); } } else { MessageBox.Show("Postoji vec restoran sa tim id-jem."); dodajRestoran(); } Close(); }
private void button2_Click(object sender, EventArgs e) { Restoran res = new Restoran(); String nazivRes; nazivRes = comboBox1.SelectedItem.ToString(); List <Restoran> rests = new List <Restoran>(); rests = DataProvider.GetSviRestorani(); //rests.Find((r) => r.Naziv == nazivRes); foreach (Restoran restoran in rests) { if (restoran.Naziv == nazivRes) { res = restoran; } } DataProvider.CreateNarudzbina(DateTimeOffset.Now, textBoxAdresa.Text, proizvodi, Singleton.Instance.Korisnik.UserId, res.RestoranId); }
//AZURIRAJ public ActionResult AzurirajRestoran(int?id) { Restoran r; if (id == null) { r = new Restoran(); ViewBag.Title = "Unos novog restorana"; } else { r = ListaRestorani.VratiRestoran().Find(rt => rt.id_restoran == id); if (r == null) { return(HttpNotFound()); } ViewBag.Title = "Ažuriranje podataka o restoranu"; } return(View(r)); }
public async void AddToFavourite(Restoran r) { int id = PocetnaFormaViewModel.KORISNIK_ID; Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient(); var headers = httpClient.DefaultRequestHeaders; string header = "ie"; if (!headers.UserAgent.TryParseAdd(header)) { throw new Exception("Invalid header value: " + header); } header = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"; if (!headers.UserAgent.TryParseAdd(header)) { throw new Exception("Invalid header value: " + header); } // Uri requestUri = new Uri("http://localhost:6796/RegistrovaniKorisniks/AddRestoraunt/" + id + "?name=" + r.Name + "&description=" + r.Description + "&phone=" + r.SlikaURL); Uri requestUri = new Uri("https://vicinor.azurewebsites.net/RegistrovaniKorisniks/AddRestoraunt/" + id + "?name=" + r.Name + "&description=" + r.Description + "&phone=" + r.SlikaURL); Windows.Web.Http.HttpResponseMessage httpResponse = new Windows.Web.Http.HttpResponseMessage(); string httpResponseBody = ""; try { httpResponse = await httpClient.PutAsync(requestUri, null); httpResponse.EnsureSuccessStatusCode(); httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); string json = httpResponseBody; } catch (Exception ex) { httpResponseBody = "Error: " + ex.HResult.ToString("X") + " Message: " + ex.Message; } }
public static async Task <İcraSonuç> YeniRestoranEkle(Restoran yeniRestoran) { try { yeniRestoran.SistemDurum = VarlıkSistemDurum.Aktif; yeniRestoran.ÖzelSektörMü = true; yeniRestoran.OluşturuKimsiId = Yardımcılar.GüvenlikYardımcı.ŞimdikiKullanıcıId; yeniRestoran.Oluşturulduğunda = DateTime.Now; yeniRestoran.OnayDurum = OnayDurum.Beklemede; //await HazırlaWebYardımcı.GünlükKaydetme(OlaySeviye.Uyarı, "Saving restaurant..."); //await GünlükKaydetme(OlaySeviye.Uyarı, "JSON restaurant: " + JsonİçerikOluşturWithStr(yeniRestoran).Item2); using (var istemci = new System.Net.Http.HttpClient()) { var msj = await istemci.PostAsync(RestoranlarUrl + "/YeniRestoranEkle", HazırlaWebYardımcı.JsonİçerikOluştur(yeniRestoran)); if (msj.Content != null) { //var rslt = Newtonsoft.Json.JsonConvert.DeserializeObject<İcraSonuç>(await msj.Content.ReadAsStringAsync()); //var cntTp = msj.Content.Headers.ContentType.ToString(); //await HazırlaWebYardımcı.GünlükKaydetme(OlaySeviye.Uyarı, $"Back from saving restaurant. Rslt: {cntTp} || {rslt}"); return(Newtonsoft.Json.JsonConvert.DeserializeObject <İcraSonuç>(await msj.Content.ReadAsStringAsync())); } else { //await GünlükKaydetme(OlaySeviye.Uyarı, "Back from saving restaurant. Null content"); return(null); } } } catch (Exception ex) { await HazırlaWebYardımcı.HataKaydet(ex); throw ex; } }
public async Task OnGet() { try { await BisiparişWebYardımcı.GünlükKaydet(OlaySeviye.Ayıklama, "Into..."); //İşlemKod = $"{GüvenlikYardımcı.ŞuAnkiKullanıcıId}_{Sunucuİşlem.YeniRestoranKaydetmek}"; KökDizin = BisiparişWebYardımcı.KökDizin; MevcutHizmetler = "0"; MevcutMutfaklar = "0"; Restoran = new Restoran() { AktifMi = true, OnayDurum = OnayDurum.Beklemede, İletişim = new İşyeriİletişim() { Adres = new YerAdres() }, OluşturuKimsiId = GüvenlikYardımcı.ŞimdikiKullanıcıId }; //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Going to prepare..."); await Yardımcılar.RestoranlarYardımcı.RestoranGerekSinimlerYükle(); //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Going to populate..."); await GerekliListelerDoldur(); KaydetmekSonuç = ""; //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Get done"); } catch (Exception ex) { await BisiparişWebYardımcı.GünlükKaydet(OlaySeviye.Hata, ex); //throw ex; } }
public static Restoran GetRestoranPoMailu(String mail) { ISession session = SessionManager.GetSession(); Restoran res = new Restoran(); if (session == null) { return(null); } Row resData = session.Execute("select * from restoranpomailu where email = '" + mail + "'").FirstOrDefault(); if (resData == null) { return(null); } else { res = GetRestoran(Guid.Parse(resData["restoran_id"].ToString())); } return(res); }
//nema potrebe za kreiranjem funkcije obrisi jer se nemoze obrisati postavka restorana o kojoj sve ostalo zavisi jer postoji samo jedna /*public ActionResult Obrisi(int restoranId) * { * Restoran x = ctx.Restorani.Find(restoranId); * ctx.Restorani.Remove(x); * ctx.SaveChanges(); * * return RedirectToAction("Prikazi"); * }*/ public ActionResult Spremi(RestoranDEViewModel restoran) { if (!ModelState.IsValid) { return(View("Uredi", restoran)); } Restoran restoranDB; if (restoran.Id == 0) { restoranDB = new Restoran(); ctx.Restorani.Add(restoranDB); } else { restoranDB = ctx.Restorani.Where(x => x.Id == restoran.Id).FirstOrDefault(); } restoranDB.Id = restoran.Id; restoranDB.Naziv = restoran.Naziv; restoranDB.Adresa = restoran.Adresa; restoranDB.BrTelefona = restoran.BrTelefona; restoranDB.BannerSlika = restoran.BannerSlika; restoranDB.BrPdv = restoran.BrPDV; restoranDB.BrStolova = restoran.BrStolova; restoranDB.InfoEmail = restoran.InfoEmail; restoranDB.MaxRezervacija = restoran.MaxRezervacija; restoranDB.OpisRestorana = restoran.OpisRestorana; restoranDB.VrijemeOtvaranja = restoran.VrijemeOtvaranja; restoranDB.VrijemeZatvaranja = restoran.VrijemeZatvaranja; restoranDB.VrijemeOtvaranjaKuhinje = restoran.VrijemeOtvaranjaKuhinje; restoranDB.VrijemeZatvaranjaKuhinje = restoran.VrijemeZatvaranjaKuhinje; restoranDB.VrijednostPdv = restoran.VrijednostPDV; restoranDB.ImaDostavu = restoran.ImaDostavu; ctx.SaveChanges(); return(RedirectToAction("Prikazi")); }
public IHttpActionResult PutRestoran(int id, Restoran restoran) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != restoran.ID) { return(BadRequest()); } bool ret = _manager.Update(restoran); if (ret) { return(Ok()); } else { return(BadRequest()); } }
public static Restoran GetRestoran(Guid restId) { ISession session = SessionManager.GetSession(); if (session == null) { return(null); } Restoran res = new Restoran(); Row rest = session.Execute("select * from restoran where restoran_id=" + restId).FirstOrDefault(); if (rest != null) { res.RestoranId = restId; res.Adresa = rest["adresa"] != null ? rest["adresa"].ToString() : String.Empty; res.Email = rest["email"] != null ? rest["email"].ToString() : String.Empty; res.Grad = rest["grad"] != null ? rest["grad"].ToString() : String.Empty; res.Naziv = rest["naziv"] != null ? rest["naziv"].ToString() : String.Empty; res.Opstina = rest["opstina"] != null ? rest["opstina"].ToString() : String.Empty; } return(res); }
public static List <Restoran> GetSviRestorani() { ISession session = SessionManager.GetSession(); List <Restoran> restorani = new List <Restoran>(); if (session == null) { return(null); } RowSet listaRestorana = session.Execute("select * from restoran"); foreach (var res in listaRestorana) { Restoran rest = new Restoran(); rest.RestoranId = res["restoran_id"] != null?Guid.Parse(res["restoran_id"].ToString()) : Guid.Empty; rest = GetRestoran(rest.RestoranId); restorani.Add(rest); } return(restorani); }
public async Task <IdentityResult> NewRestaurant(NewRestaurantDto model) { IdentityResult result = new IdentityResult(); var user = new Restoran { Email = model.Email, UserName = model.UserName }; result = await _userManager.CreateAsync(user, model.Password); var temp = await _userManager.FindByNameAsync(user.UserName); RestoranAdres adres = new RestoranAdres { Restoran = temp, RestoranId = user.Id }; _context.Set <RestoranAdres>().Add(adres); await _context.SaveChangesAsync(); return(result); }
public static async Task <İcraSonuç> RestoranDeğiştir(Restoran restoran) { try { using (var istemci = new System.Net.Http.HttpClient()) { var msj = await istemci.PutAsync(RestoranlarUrl + "/RestoranDeğiştir", JsonİçerikOluştur(restoran)); if (msj.Content != null) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <İcraSonuç>(await msj.Content.ReadAsStringAsync())); } else { return(null); } } } catch (Exception ex) { throw ex; } }
public async Task OnGet() { try { await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Into..."); KökDizin = BisiparişWebYardımcı.KökDizin; MevcutHizmetler = "0"; Restoran = new Restoran() { AktifMi = true, OnayDurum = OnayDurum.Bekleyen, İletişim = new İşyeriİletişim() { Adres = new YerAdres() }, OluşturuKimsiId = BisiparişWebYardımcı.ŞuAnkiKullanıcıId }; //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Going to prepare..."); await BisiparişWebYardımcı.RestoranGerekSinimlerYükle(); //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Going to populate..."); await GerekliListelerDoldur(); KaydetmekSonuç = ""; //await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Ayıklama, "Get done"); } catch (Exception ex) { await BisiparişWebYardımcı.GünlükKaydetme(OlaySeviye.Hata, ex.Message); //throw ex; } }
public async Task <ActionResult <İcraSonuç> > Post(Restoran yeniRestoran) { try { //await BisiparişVeriAltYapı.BisiparişVeriYardımcı.GünlükKaydetme(new BisiparişÇekirdek.Valıklar.VeriGünlüğü.Günlük() //{ // Seviye = BisiparişÇekirdek.Valıklar.VeriGünlüğü.OlaySeviye.Uyarı, // Kaynak = "RestoranlarController.Post", // Mesaj = "DB Saving new restaurant...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); var sonuç = await BisiparişVeriAltYapı.RestoranlarVeriYardımcı.YeniRestoranEkle(yeniRestoran); //await BisiparişVeriAltYapı.BisiparişVeriYardımcı.GünlükKaydetme(new BisiparişÇekirdek.Valıklar.VeriGünlüğü.Günlük() //{ // Seviye = BisiparişÇekirdek.Valıklar.VeriGünlüğü.OlaySeviye.Uyarı, // Kaynak = "RestoranlarController.Post", // Mesaj = sonuç != null ? "Result is there" : "(NULL result)", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); return(sonuç); //if (sonuç.BaşarılıMı) // return Ok(sonuç);//CreatedAtAction(nameof(Post), new { id = yeniRestoran.Id }, yeniRestoran); //else // return BadRequest(sonuç); } catch (Exception ex) { throw ex; } }
public static async Task <İcraSonuç> RestoranDeğiştir(Restoran restoran) { try { using (var vtBğlm = new BisiparişVeriBağlam() { BağlantıDizesi = BisiparişVeriYardımcı.BağlantıDizesi }) { var öncekiRstr = await vtBğlm.Restoranlar.FirstAsync(kf => kf.Id == restoran.Id); //öncekiRstr.ÇalışmaSaatleri öncekiRstr.AktifMi = restoran.AktifMi; await vtBğlm.SaveChangesAsync(); return(İcraSonuç.Başarılı); } } catch (Exception ex) { throw ex; } }
public static async Task <İcraSonuç> YeniRestoranEkle(Restoran yeniRestoran) { try { //await BisiparişVeriYardımcı.GünlükKaydetme(OlaySeviye.Uyarı, "Into..."); using (var vtBğlm = new BisiparişVeriBağlam() { BağlantıDizesi = BisiparişVeriYardımcı.BağlantıDizesi }) { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Checking...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); var aynaRstrn = await vtBğlm.Restoranlar.FirstOrDefaultAsync( rst => rst.İsim.Equals(yeniRestoran.İsim, StringComparison.OrdinalIgnoreCase)); if (aynaRstrn == null) { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Restaurant name is new", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); yeniRestoran.İletişimId = await BisiparişVeriYardımcı.İletişimKaydet(vtBğlm, yeniRestoran.İletişim); //await BisiparişVeriYardımcı.GünlükKaydetme(OlaySeviye.Uyarı, "Actual restaurant save..."); var rstEkledi = await vtBğlm.Restoranlar.AddAsync(yeniRestoran); await vtBğlm.SaveChangesAsync(); if (rstEkledi != null && rstEkledi.Entity.Id > 0) { //await BisiparişVeriYardımcı.GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.İletişimKaydetme", // Mesaj = "Checking restaurant menus...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); //await MenülerVeriYardımcı.MenülerKaydetme(vtBğlm, yeniRestoran.Id, yeniRestoran.Menüler); var nPics = yeniRestoran.Fotoğraflar != null ? $"Found: {yeniRestoran.Fotoğraflar.Count} pics" : "No pics"; //await BisiparişVeriYardımcı.GünlükKaydetme(OlaySeviye.Uyarı, $"Checking restaurant photos ({nPics})"); if (yeniRestoran.ÇalışmaZamanlamalar != null && yeniRestoran.ÇalışmaZamanlamalar.Any()) { foreach (var çlzmn in yeniRestoran.ÇalışmaZamanlamalar) { vtBğlm.ÇalışmaZamanlamalar.Add(new ÇalışmaZamanlama() { İşletmeId = yeniRestoran.Id, HaftaGün = çlzmn.HaftaGün, Saatten = çlzmn.Saatten, Saate = çlzmn.Saate, AktifMi = true, OluşturuKimsiId = yeniRestoran.OluşturuKimsiId, Oluşturulduğunda = DateTime.Now }); } await vtBğlm.SaveChangesAsync(); } if (yeniRestoran.Fotoğraflar != null && yeniRestoran.Fotoğraflar.Any()) { foreach (var ftf in yeniRestoran.Fotoğraflar) { vtBğlm.Fotoğraflar.Add(new VarlıkFotoğraf() { VarlıkId = yeniRestoran.Id, VarlıkTip = FotoğrafVarlıkTip.Restoran, Fotoğraf = ftf, AktifMi = true, OluşturuKimsiId = yeniRestoran.OluşturuKimsiId, Oluşturulduğunda = DateTime.Now }); } await vtBğlm.SaveChangesAsync(); } await BisiparişVeriYardımcı.GünlükKaydet(OlaySeviye.Uyarı, "Saved successsfully"); return(new İcraSonuç() { BaşarılıMı = true, YeniEklediId = yeniRestoran.Id }); } else { return(İcraSonuç.BaşarıSız); } } else { return new İcraSonuç() { BaşarılıMı = false, Mesaj = "Bu restoran zaten var." } }; } } catch (Exception ex) { throw ex; } }
private async void startSearchButton_Click(object sender, RoutedEventArgs e) { //Otvaranje forme za pretragu, dobivanje rezultata sa api-ja // liste Restorana listaDobavljenih = new List <Restoran>(); bool b = await getLocationByGeolocatorAsync(); if (radiusTextBox.Text == "") { radiusTextBox.Text = "UNESITE RADIUS U BROJEVIMA"; return; } if (radiusTextBox.Text == "UNESITE RADIUS U BROJEVIMA") { radiusTextBox.Text = "1000"; return; } var client = new HttpClient(); string LONGITUDINALA = "0.0", LANGITUDINALA = "0.0"; if (position != null) { LONGITUDINALA = position.Coordinate.Point.Position.Longitude.ToString(); LANGITUDINALA = position.Coordinate.Point.Position.Latitude.ToString(); } //HttpResponseMessage response = await client.GetAsync(new Uri("https://maps.googleapis.com/maps/api/place/search/json?types=restaurant" // + "&location=" + LONGITUDINALA + "%2C" + LANGITUDINALA + "&radius=" + radiusTextBox.Text.ToString() // + "&sensor=false&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s")); HttpResponseMessage response = await client.GetAsync(new Uri("https://maps.googleapis.com/maps/api/place/search/json?types=restaurant&" + "location=" + LANGITUDINALA + "%2C" + LONGITUDINALA + "&radius=" + radiusTextBox.Text.ToString() + "&sensor=false&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s")); var jsonString = await response.Content.ReadAsStringAsync(); JsonObject root = JsonValue.Parse(jsonString).GetObject(); JsonArray REzultati = root.GetNamedArray("results"); for (uint i = 0; i < REzultati.Count; ++i) { JsonObject restoran = REzultati.GetObjectAt(i); Restoran novi = new Restoran(); Recenzija r = new Recenzija(); string name_ime_restorana = restoran.GetNamedString("name"); string place_id_kao_deskripcija = restoran.GetNamedString("vicinity"); double rating; try { rating = restoran.GetNamedNumber("rating"); r.StarRating = (Int32)rating; novi.ListRezension.Add(r); } catch (Exception k) { rating = -1; } string place_id = null; novi.Name = name_ime_restorana; // novi.PhoneNumber = "+38733225 883"; novi.RestoranId = (int)i; novi.Description = place_id_kao_deskripcija; novi.Place_id = restoran.GetNamedString("place_id"); JsonArray objekatPhotosM = null; try { place_id = restoran.GetNamedString("place_id"); } catch (Exception) { } if (place_id != null) { HttpResponseMessage response2 = await client.GetAsync(new Uri("https://maps.googleapis.com/maps/api/place/details/json?placeid=" + novi.Place_id + "&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s")); var jsonString2 = await response2.Content.ReadAsStringAsync(); JsonObject root2 = JsonValue.Parse(jsonString2).GetObject(); JsonObject podaci = root2.GetNamedObject("result"); try { String phonenumber = podaci.GetNamedString("international_phone_number"); novi.PhoneNumber = phonenumber; } catch (Exception ex) { novi.PhoneNumber = ""; } } try { objekatPhotosM = restoran.GetNamedArray("photos"); }catch (Exception) { } if (objekatPhotosM != null && objekatPhotosM.Count > 0) { JsonObject objekatPhotos = objekatPhotosM.GetObjectAt(0); string slikaReferenca = objekatPhotos.GetNamedString("photo_reference"); double MAX_HEIGHT = objekatPhotos.GetNamedNumber("height"); double MAX_WIDTH = objekatPhotos.GetNamedNumber("width"); novi.SlikaURL = objekatPhotos.GetNamedString("photo_reference"); novi.Slika = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("https://maps.googleapis.com/maps/api/place/photo?photoreference=" + slikaReferenca + "&sensor=false&maxheight=" + MAX_HEIGHT.ToString() + "&maxwidth=" + MAX_WIDTH.ToString() + "&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s", UriKind.Absolute)); } else { novi.SlikaURL = ""; } // dobavljanje lokacije JsonObject lokacija = null; try { lokacija = restoran.GetNamedObject("geometry"); JsonObject lokacijav2 = lokacija.GetNamedObject("location"); double longitude = lokacijav2.GetNamedNumber("lng"); // x double latitude = lokacijav2.GetNamedNumber("lat"); // y novaLokacija = new Tuple <double, double>(latitude, longitude); novi.Location = novaLokacija; } catch (Exception) { } listaDobavljenih.Add(novi); } this.Frame.Navigate(typeof(StartSearch1)); }
public static async Task <İcraSonuç> YeniRestoranEkle(Restoran yeniRestoran) { try { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Into...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); using (var vtBğlm = new BisiparişVeriBağlam() { BağlantıDizesi = BağlantıDizesi }) { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Checking...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); var aynaRstrn = await vtBğlm.Restoranlar.FirstOrDefaultAsync( rst => rst.İsim.Equals(yeniRestoran.İsim, StringComparison.OrdinalIgnoreCase)); if (aynaRstrn == null) { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Restaurant name is new", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); yeniRestoran.İletişimId = await İletişimKaydetme(vtBğlm, yeniRestoran.İletişim); //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.İletişimKaydetme", // Mesaj = "Actual restaurant save...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); var rstEkledi = await vtBğlm.Restoranlar.AddAsync(yeniRestoran); await vtBğlm.SaveChangesAsync(); if (rstEkledi != null && rstEkledi.Entity.Id > 0) { //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.İletişimKaydetme", // Mesaj = "Checking restaurant menus...", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); await MenülerKaydetme(vtBğlm, yeniRestoran.Id, yeniRestoran.Menüler); //var nPics = yeniRestoran.Fotoğraflar != null ? $"Found: {yeniRestoran.Fotoğraflar.Count} pics" : "No pics"; //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.İletişimKaydetme", // Mesaj = $"Checking restaurant photos ({nPics})", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); if (yeniRestoran.Fotoğraflar != null && yeniRestoran.Fotoğraflar.Any()) { foreach (var ftf in yeniRestoran.Fotoğraflar) { vtBğlm.Fotoğraflar.Add(new ElemanFotoğraf() { ElemanId = yeniRestoran.Id, ElemanTip = FotoğrafElemanTip.Restoran, Fotoğraf = ftf }); } await vtBğlm.SaveChangesAsync(); } //await GünlükKaydetme(new Günlük() //{ // Seviye = OlaySeviye.Uyarı, // Kaynak = "VeriYardımcı.YeniRestoranEkle", // Mesaj = "Saved successsfully", // Tarih = DateTime.Now.ToString("dd-MM-yyyy"), // Zaman = DateTime.Now.ToString("HH:mm:ss.fffff"), //}); return(İcraSonuç.Başarılı); } else { return(İcraSonuç.BaşarıSız); } } else { return new İcraSonuç() { BaşarılıMı = false, Mesaj = "Bu restoran zaten var." } }; } } catch (Exception ex) { throw ex; } }
public void Insert(Restoran entity) { _provider.Insert(entity); }
public async Task <IActionResult> CreateRestoran([FromBody] Restoran restoran) { var createdRestoran = await _restoranService.CreateRestoran(restoran); return(CreatedAtAction("GetById", new { id = createdRestoran.Id }, createdRestoran)); }
public ActionResult SearchRestorans(Restoran r) { return(View(r)); }
public async Task <bool> Initial() { //Otvaranje forme za pretragu, dobivanje rezultata sa api-ja // liste Restorana listaRecommended = new List <Restoran>(); var client = new HttpClient(); HttpResponseMessage response = await client.GetAsync(new Uri("https://maps.googleapis.com/maps/api/place/search/json?types=restaurant&location=43.84301249454391,18.34612836298834&radius=5000&sensor=false&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s")); var jsonString = await response.Content.ReadAsStringAsync(); JsonObject root = JsonValue.Parse(jsonString).GetObject(); JsonArray REzultati = root.GetNamedArray("results"); for (uint i = 0; i < REzultati.Count; ++i) { JsonObject restoran = REzultati.GetObjectAt(i); Restoran novi = new Restoran(); string name_ime_restorana = restoran.GetNamedString("name"); string place_id_kao_deskripcija = restoran.GetNamedString("vicinity"); string adresa_kao_phone_number; try { adresa_kao_phone_number = restoran.GetNamedValue("rating").ToString(); } catch (Exception k) { adresa_kao_phone_number = ""; } string place_id = null; novi.Name = name_ime_restorana; novi.PhoneNumber = "+38733225 883"; novi.RestoranId = (int)i; novi.Description = place_id_kao_deskripcija; JsonArray objekatPhotosM = null; try { place_id = restoran.GetNamedString("place_id"); } catch (Exception) { } if (place_id != null) { //Postaviti phone number // https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJS51qkj_KWEcRLePQI32zgn0&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s //link } try { objekatPhotosM = restoran.GetNamedArray("photos"); } catch (Exception) { } if (objekatPhotosM != null && objekatPhotosM.Count > 0) { JsonObject objekatPhotos = objekatPhotosM.GetObjectAt(0); string slikaReferenca = objekatPhotos.GetNamedString("photo_reference"); double MAX_HEIGHT = objekatPhotos.GetNamedNumber("height"); double MAX_WIDTH = objekatPhotos.GetNamedNumber("width"); novi.SlikaURL = "https://maps.googleapis.com/maps/api/place/photo?photoreference=" + slikaReferenca + "&sensor=false&maxheight=" + MAX_HEIGHT.ToString() + "&maxwidth=" + MAX_WIDTH.ToString() + "&key=AIzaSyBIl5KmMwk5NiP69tCPnhGZJ3CAr-ml65s"; novi.Slika = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(novi.SlikaURL, UriKind.Absolute)); } else { novi.SlikaURL = ""; } // dobavljanje lokacije JsonObject lokacija = null; try { lokacija = restoran.GetNamedObject("geometry"); JsonObject lokacijav2 = lokacija.GetNamedObject("location"); double longitude = lokacijav2.GetNamedNumber("lng"); // x double latitude = lokacijav2.GetNamedNumber("lat"); // y Tuple <double, double> novaLokacija = new Tuple <double, double>(0, 0); novaLokacija = new Tuple <double, double>(latitude, longitude); novi.Location = novaLokacija; } catch (Exception) { } listaRecommended.Add(novi); } return(true); }
public async Task UpisiRestoran([FromBody] Restoran restoran) { Context.Restorani.Add(restoran); await Context.SaveChangesAsync(); }
private void btnDodaj_Click_1(object sender, EventArgs e) { if (prostorija == 1) { Soba soba = this.kreirajSobu(); string id = maxId(); try { int mId = Int32.Parse(id); soba.idProstorije = (mId++).ToString(); } catch (Exception exception) { soba.idProstorije = ""; } Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("brojProstorije", soba.brojProstorije); queryDict.Add("brojKreveta", soba.brojKreveta); queryDict.Add("sprat", soba.sprat); queryDict.Add("klima", soba.klima); queryDict.Add("tv", soba.tv); queryDict.Add("terasa", soba.terasa); queryDict.Add("opis", soba.opis); queryDict.Add("cena", soba.cena); queryDict.Add("idProstorije", soba.idProstorije); var query1 = new Neo4jClient.Cypher.CypherQuery("CREATE (n:Prostorija:Soba {brojProstorije:'" + soba.brojProstorije + "',brojKreveta:'" + soba.brojKreveta + "',sprat:'" + soba.sprat + "', klima:'" + soba.klima + "', tv:'" + soba.tv + "', terasa:'" + soba.terasa + "', cena:'" + soba.cena.ToString() + "', opis:'" + soba.opis + "'}) return n", queryDict, CypherResultMode.Set); List <Soba> sobe = ((IRawGraphClient)client).ExecuteGetCypherResults <Soba>(query1).ToList(); //this.DialogResult = DialogResult.OK; //this.Close(); } else if (this.prostorija == 2) { Sala sala = this.kreirajSalu(); string id = maxId(); try { int mId = Int32.Parse(id); sala.idProstorije = (mId++).ToString(); } catch (Exception exception) { sala.idProstorije = ""; } Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("brojProstorije", sala.brojProstorije); queryDict.Add("kapacitetSale", sala.kapacitetSale.ToString()); queryDict.Add("cena", sala.cena.ToString()); queryDict.Add("idProstorije", sala.idProstorije); var query1 = new Neo4jClient.Cypher.CypherQuery("CREATE (n:Prostorija:Sala {brojProstorije:'" + sala.brojProstorije + "',kapacitetSale:'" + sala.kapacitetSale.ToString() + "', cena:'" + sala.cena.ToString() + "'}) return n", queryDict, CypherResultMode.Set); List <Sala> sale = ((IRawGraphClient)client).ExecuteGetCypherResults <Sala>(query1).ToList(); //this.DialogResult = DialogResult.OK; //this.Close(); } else if (this.prostorija == 3) { Restoran restoran = this.kreirajRestoran(); string id = maxId(); try { int mId = Int32.Parse(id); restoran.idProstorije = (mId++).ToString(); } catch (Exception exception) { restoran.idProstorije = ""; } Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("brojProstorije", restoran.brojProstorije); queryDict.Add("kapacitetRestorana", restoran.kapacitetRestorana.ToString()); queryDict.Add("cena", restoran.cena.ToString()); queryDict.Add("idProstorije", restoran.idProstorije); var query1 = new Neo4jClient.Cypher.CypherQuery("CREATE (n:Prostorija:Restoran {brojProstorije:'" + restoran.brojProstorije + "',kapacitetRestorana:'" + restoran.kapacitetRestorana.ToString() + "', cena:'" + restoran.cena.ToString() + "'}) return n", queryDict, CypherResultMode.Set); List <Restoran> restorani = ((IRawGraphClient)client).ExecuteGetCypherResults <Restoran>(query1).ToList(); //this.DialogResult = DialogResult.OK; //this.Close(); } else if (this.prostorija == 4) { Bazen bazen = this.kreirajBazen(); string id = maxId(); try { int mId = Int32.Parse(id); bazen.idProstorije = (mId++).ToString(); } catch (Exception exception) { bazen.idProstorije = ""; } Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("brojProstorije", bazen.brojProstorije); queryDict.Add("tip", bazen.tip.ToString()); queryDict.Add("cena", bazen.cena.ToString()); queryDict.Add("idProstorije", bazen.idProstorije); var query1 = new Neo4jClient.Cypher.CypherQuery("CREATE (n:Prostorija:Bazen {brojProstorije:'" + bazen.brojProstorije + "',tip:'" + bazen.tip.ToString() + "', cena:'" + bazen.cena.ToString() + "'}) return n", queryDict, CypherResultMode.Set); List <Bazen> bazeni = ((IRawGraphClient)client).ExecuteGetCypherResults <Bazen>(query1).ToList(); //this.DialogResult = DialogResult.OK; //this.Close(); } this.DialogResult = DialogResult.OK; this.Close(); }
public async Task IzmeniRestoran([FromBody] Restoran restoran) { Context.Update <Restoran>(restoran); await Context.SaveChangesAsync(); }
public IzmeniSobu(Restoran s) { this.restoran = s; this.prostorija = 3; InitializeComponent(); }