コード例 #1
0
 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.");
     }
 }
コード例 #2
0
 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);
 }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        public ActionResult InsertSirket(Sirket sirket)
        {
            dbContext.Sirketler.Add(sirket);

            dbContext.SaveChanges();
            return(View());
        }
コード例 #6
0
        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"));
            }
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sirket sirket = db.Sirket.Find(id);

            db.Sirket.Remove(sirket);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #10
0
        public async Task <Sirket> CreateSirket(Sirket newSirket)
        {
            await _unitOfWork.Sirkets.AddAsync(newSirket);

            await _unitOfWork.CommitAsync();

            return(newSirket);
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "SirketID,SirketAd,Sehir,SirketAdres,AracSayisi")] Sirket sirket)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Index"));
     }
     return(View());
 }
コード例 #12
0
 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;
 }
コード例 #13
0
 // PUT: api/Sirket/5
 public IHttpActionResult Put(Sirket sirket)
 {
     using (var SirketBusiness = new SirketBusiness())
     {
         SirketBusiness.UpdateSirket(sirket);
         return(null);
     }
 }
コード例 #14
0
 public Sirket UpdateSirket(Sirket sirket)
 {
     using (var SirketDbContext = new ApplicationDbContext())
     {
         SirketDbContext.managers.Update(sirket);
         SirketDbContext.SaveChanges();
         return(sirket);
     }
 }
コード例 #15
0
 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));
 }
コード例 #16
0
        public ActionResult UpdateSirket(int?id)
        {
            Sirket sirket = null;

            if (id != null)
            {
                sirket = dbContext.Sirketler.Where(x => x.Id == id).FirstOrDefault();
            }
            return(View(sirket));
        }
コード例 #17
0
        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();
        }
コード例 #18
0
        // 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);
            }
        }
コード例 #19
0
        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));
        }
コード例 #20
0
        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"));
        }
コード例 #21
0
        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();
        }
コード例 #22
0
        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));
        }
コード例 #23
0
 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);
     }
 }
コード例 #24
0
        // 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));
        }
コード例 #25
0
        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);
            }
        }
コード例 #26
0
 public bool AracIdSil(int id, Sirket sirket)
 {
     try
     {
         using (var business = new AraclarBusiness())
         {
             business.AracIdSil(id, sirket);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #27
0
 public bool AracEkle(Araclar arac, Sirket sirket)
 {
     try
     {
         using (var business = new AraclarBusiness())
         {
             business.AracEkle(arac, sirket);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #28
0
 public bool EkleSirket(Sirket entity)
 {
     try
     {
         using (SirketBusiness sirketBusiness = new SirketBusiness())
         {
             sirketBusiness.Ekle(entity);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #29
0
 public bool InsertSirket(Sirket entity)
 {
     try
     {
         using (var business = new SirketBusiness())
         {
             business.InsertSirket(entity);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #30
0
        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);
        }