private List <Sirket> ListAllCustomers() { try { using (var sirketSoapClient = new SirketWebServiceSoapClient()) { List <Sirket> sirkets = new List <Sirket>(); foreach (var responsedSirket in sirketSoapClient.SelectAllSirkets().OrderBy(x => x.sirketId).ToList()) { Sirket castedSirket = new Sirket() { sirketAdi = responsedSirket.sirketAdi, sirketId = responsedSirket.sirketId, sehir = responsedSirket.sehir, adres = responsedSirket.adres, aracSayisi = responsedSirket.aracSayisi, sirketPuani = responsedSirket.sirketPuani }; sirkets.Add(castedSirket); } return(sirkets); } } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Customer doesn't exists."); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Function.GecmisiYukle(); if (Data._Sirket == null) { SirketButton.Source = new BitmapImage(new Uri("/Assets/ApplicationIcon.png", UriKind.Relative)); } else { SirketButton.Source = new BitmapImage(new Uri(Data._Sirket.Resim, UriKind.Relative)); } if (Data._TakipKodu != null) { TakipKodu.Text = Data._TakipKodu; } if (Data._TakipDetay != null) { TakipDetay.Visibility = Visibility.Visible; TakipDetay.DataContext = Data._TakipDetay; } if (NavigationContext.QueryString.ContainsKey("SirketAdi") && NavigationContext.QueryString.ContainsKey("Kod")) { string SirketAdi = NavigationContext.QueryString["SirketAdi"]; Sirket sirket = Data.Sirketler.SingleOrDefault(x => x.Adi == SirketAdi); string Kod = NavigationContext.QueryString["Kod"]; SirketButton.Source = new BitmapImage(new Uri(sirket.Resim, UriKind.Relative)); Data._Sirket = sirket; Data._TakipKodu = Kod; TakipKodu.Text = Kod; GirisYap(); } base.OnNavigatedTo(e); }
public ActionResult SirketKayit(Sirket model) { try { bool success; using (var sirketBusiness = new SirketBusiness()) { success = sirketBusiness.InsertSirket(new Sirket() { SirketAdi = model.SirketAdi, Sehir = model.Sehir, Adres = model.Adres, AracSayisi = model.AracSayisi, SirketKullaniciAdi = model.SirketKullaniciAdi, SirketSifre = model.SirketSifre, }); } var message = success ? "done" : "failed"; Console.WriteLine("Operation " + message); } catch (Exception ex) { Console.WriteLine("Error happened: " + ex.Message); } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult UpdateSirket(Sirket model) { Sirket sirket = dbContext.Sirketler.Where(x => x.Id == model.Id).FirstOrDefault(); modell.sehir = dbContext.Sehirler.ToList(); if (sirket != null) { sirket.Ad = model.Ad; sirket.FotografId = model.FotografId; //Burası önemli buradaki ID durumunu çöz sirket.Unvan = model.Unvan; sirket.IsVerenId = model.IsVerenId; int sonuc = dbContext.SaveChanges(); if (sonuc > 0) { ViewBag.Result = "Güncelleme işlemi başarılı."; ViewBag.Status = "success"; } else { ViewBag.Result = "Güncelleme işlemi başarısız."; ViewBag.Status = "danger"; } } return(View(sirket)); }
public ActionResult InsertSirket(Sirket sirket) { dbContext.Sirketler.Add(sirket); dbContext.SaveChanges(); return(View()); }
public ActionResult SirketGiris(Sirket model) { try { Sirket sirket = null; using (var sirketBusiness = new SirketBusiness()) { sirket = sirketBusiness.SirketLogin(model.SirketKullaniciAdi, model.SirketSifre); } if (sirket != null) { Session.Add("Sirket", sirket); } List <Arac> arac = null; using (var aracBusiness = new AracBusiness()) { arac = aracBusiness.SelectAllSirketArac(sirket.Id); Session.Add("Arac", arac); } List <Arac> rezervasyon = null; using (var aracBusiness = new AracBusiness()) { rezervasyon = aracBusiness.SelectAllRezervasyonArac(sirket.Id); Session.Add("Razervasyon", rezervasyon); } return(RedirectToAction("SirketSayfasi", "Sirket")); } catch (Exception) { return(View("SirketGiris")); } }
public async Task <IActionResult> PutSirket([FromRoute] int id, [FromBody] Sirket sirket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sirket.Id) { return(BadRequest()); } _context.Entry(sirket).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SirketExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void SirketlerLLS_SelectionChanged(object sender, SelectionChangedEventArgs e) { Sirket sirket = SirketlerLLS.SelectedItem as Sirket; Data._Sirket = sirket; Sirketler.Visibility = Visibility.Collapsed; SirketButton.Source = new BitmapImage(new Uri("" + sirket.Resim, UriKind.RelativeOrAbsolute)); }
public ActionResult DeleteConfirmed(int id) { Sirket sirket = db.Sirket.Find(id); db.Sirket.Remove(sirket); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <Sirket> CreateSirket(Sirket newSirket) { await _unitOfWork.Sirkets.AddAsync(newSirket); await _unitOfWork.CommitAsync(); return(newSirket); }
public ActionResult Edit([Bind(Include = "SirketID,SirketAd,Sehir,SirketAdres,AracSayisi")] Sirket sirket) { if (ModelState.IsValid) { return(RedirectToAction("Index")); } return(View()); }
public HashChainEntry(int anahtar, object deger, string durum, Sirket sirket) { this.anahtar = anahtar; this.durum = durum; this.deger = deger; this.next = null; this.sirket = sirket; }
// PUT: api/Sirket/5 public IHttpActionResult Put(Sirket sirket) { using (var SirketBusiness = new SirketBusiness()) { SirketBusiness.UpdateSirket(sirket); return(null); } }
public Sirket UpdateSirket(Sirket sirket) { using (var SirketDbContext = new ApplicationDbContext()) { SirketDbContext.managers.Update(sirket); SirketDbContext.SaveChanges(); return(sirket); } }
public ActionResult Edit([Bind(Include = "SirketID,SirketAd,Sehir,SirketAdres,AracSayisi")] Sirket sirket) { if (ModelState.IsValid) { db.Entry(sirket).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sirket)); }
public ActionResult UpdateSirket(int?id) { Sirket sirket = null; if (id != null) { sirket = dbContext.Sirketler.Where(x => x.Id == id).FirstOrDefault(); } return(View(sirket)); }
public async Task UpdateSirket(Sirket sirketToBeUpdated, Sirket sirket) { sirketToBeUpdated.Sirketadi = sirket.Sirketadi ?? sirketToBeUpdated.Sirketadi; sirketToBeUpdated.Logo = sirket.Logo ?? sirketToBeUpdated.Logo; sirketToBeUpdated.Unvan = sirket.Unvan ?? sirketToBeUpdated.Unvan; sirketToBeUpdated.Adres = sirket.Adres ?? sirketToBeUpdated.Adres; sirketToBeUpdated.Email = sirket.Email ?? sirketToBeUpdated.Email; await _unitOfWork.CommitAsync(); }
// GET: Sirket/Duzenle/41 public async Task <ActionResult> Duzenle(int id) { if (Session["kull"] == null) { return(RedirectToAction("Index", "Home")); } Kullanici gelenK = (Kullanici)Session["kull"]; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); Sirket sirket = null; IList <Arac> aracListesi = null; using (var result = await client.GetAsync("api/Arac")) { if (result.IsSuccessStatusCode) { var value = result.Content.ReadAsStringAsync().Result; aracListesi = JsonConvert.DeserializeObject <ResponseContent <Arac> >(value).Data.ToList(); } } ViewBag.aracList = aracListesi; using (var result = await client.GetAsync("api/Sirket/" + id)) { if (result.IsSuccessStatusCode) { var value = result.Content.ReadAsStringAsync().Result; sirket = JsonConvert.DeserializeObject <ResponseContent <Sirket> >(value).Data.ToList().First(); return(View(sirket)); } } } return(RedirectToAction("Index")); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Hata Oluştu", ex); } }
public ActionResult Create([Bind(Include = "SirketID,SirketAd,Sehir,SirketAdres,AracSayisi")] Sirket sirket) { if (ModelState.IsValid) { db.Sirket.Add(sirket); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sirket)); }
public ActionResult DeleteSirkett(int?id) { if (id != null) { Sirket sirket = dbContext.Sirketler.Where(x => x.Id == id).FirstOrDefault(); dbContext.Sirketler.Remove(sirket); dbContext.SaveChanges(); } return(RedirectToAction("ListSirket", "SirketController")); }
public override void Sil(IArayuz arayuz) { Sirket sirket = (Sirket)arayuz; Baglan(); komut = new System.Data.SqlClient.SqlCommand("usp_SirketSil", baglanti); komut.CommandType = CommandType.StoredProcedure; komut.Parameters.AddWithValue("@Id", sirket.Id); komut.ExecuteNonQuery(); baglanti.Close(); baglanti.Dispose(); }
public async Task <IActionResult> PostSirket([FromBody] Sirket sirket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Sirket.Add(sirket); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSirket", new { id = sirket.Id }, sirket)); }
public bool Ekle(Sirket entity) { try { Context.Set <Sirket>().Add(entity); Context.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception("Business:AraclarBusiness::AracEkle::Error occured.", ex); } }
// GET: Sirkets/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sirket sirket = db.Sirket.Find(id); if (sirket == null) { return(HttpNotFound()); } return(View(sirket)); }
private async void btnSirketKaydet_ClickAsync(object sender, EventArgs e) { Sirket sirket = new Sirket { sehir = txtSirketSehir.Text, adres = txtSirketAdres.Text, sirketAdi = txtSirketAdi.Text, sirketPuani = 0 }; try { bool success = false; // Create a HttpClient using (var client = new HttpClient()) { // Setup basics client.BaseAddress = new Uri("http://localhost:49774/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); // Create post body object // Serialize C# object to Json Object var serializedProduct = JsonConvert.SerializeObject(sirket); // Json object to System.Net.Http content type var content = new StringContent(serializedProduct, Encoding.UTF8, "application/json"); // Post Request to the URI var result = await client.PostAsync("api/Sirket", content); // Check for result if (result.IsSuccessStatusCode) { MessageBox.Show("Eklendi"); success = true; } } // Set message depend on success info var message = success ? "done" : "failed"; // Inform user MessageBox.Show("Operation " + message); } catch (Exception ex) { // Inform user MessageBox.Show("Error happened: " + ex.Message); } }
public bool AracIdSil(int id, Sirket sirket) { try { using (var business = new AraclarBusiness()) { business.AracIdSil(id, sirket); } return(true); } catch (Exception) { return(false); } }
public bool AracEkle(Araclar arac, Sirket sirket) { try { using (var business = new AraclarBusiness()) { business.AracEkle(arac, sirket); } return(true); } catch (Exception) { return(false); } }
public bool EkleSirket(Sirket entity) { try { using (SirketBusiness sirketBusiness = new SirketBusiness()) { sirketBusiness.Ekle(entity); } return(true); } catch (Exception) { return(false); } }
public bool InsertSirket(Sirket entity) { try { using (var business = new SirketBusiness()) { business.InsertSirket(entity); } return(true); } catch (Exception) { return(false); } }
public override DataTable Listele(IArayuz arayuz) { Sirket sirket = (Sirket)arayuz; string sorgu = "SELECT * FROM tbl_Sirket "; Baglan(); komut = new System.Data.SqlClient.SqlCommand(sorgu, baglanti); komut.ExecuteNonQuery(); tablo = new DataTable(); adaptor = new System.Data.SqlClient.SqlDataAdapter(komut); adaptor.Fill(tablo); baglanti.Close(); baglanti.Dispose(); return(tablo); }