public ActionResult Ekle(DepoModel eklenecekEsya) { if (ModelState.IsValid) { var sonuc = depoBAL.DepoyaEsyaEkle(eklenecekEsya, KullaniciBilgileriDondur.KullaniciId()); if (sonuc.TamamlandiMi == true) { KullaniciBilgileriDondur.LogKaydet(1, "Depoya eşya eklendi. Eşya Id=>" + eklenecekEsya.EsyaId + " Adet=>" + eklenecekEsya.Adet); TempData["uyari"] = "Depoya eşya başarı ile eklendi."; return(RedirectToAction("Liste")); } else { Tanimla(); String hatalar = KullaniciBilgileriDondur.HataMesajlariniOku(sonuc.HataMesajlari); TempData["hata"] = hatalar; return(View(eklenecekEsya)); } } else { Tanimla(); return(View(eklenecekEsya)); } }
public DepoModel DepoEsyaGetir(int?esyaDepoId, int?kullaniciId) { var depoEsya = depoDAL.DepoEsyaGetir(esyaDepoId); if (depoEsya != null) { if (depoDAL.KullaniciEklemeYapabilirMi(kullaniciId, depoEsya.SehirTablo_SehirId)) { DepoModel rtrnModel = new DepoModel(); rtrnModel.EsyaId = depoEsya.EsyaTablo_EsyaId; rtrnModel.Adet = depoEsya.Adet; rtrnModel.DepoEsyaId = depoEsya.DepoEsyaId; rtrnModel.Sehir.SehirId = depoEsya.SehirTablo_SehirId; return(rtrnModel); } else { return(null); } } else { return(null); } }
public ActionResult Duzenle(DepoModel duzenlenmisModel) { if (ModelState.IsValid) { var sonuc = depoBAL.DepoEsyaGuncelle(duzenlenmisModel, KullaniciBilgileriDondur.KullaniciId()); if (sonuc.TamamlandiMi == true) { KullaniciBilgileriDondur.LogKaydet(3, "Depoya eşya güncellendi. Eşya Id=>" + duzenlenmisModel.EsyaId + " Adet=>" + duzenlenmisModel.Adet); TempData["uyari"] = "Deponuzdaki eşyayı güncelleme işlemi başarı ile tamamlandı."; return(RedirectToAction("Liste")); } else { String hatalar = KullaniciBilgileriDondur.HataMesajlariniOku(sonuc.HataMesajlari); TempData["hata"] = hatalar; Tanimla(); return(View(duzenlenmisModel)); } } else { Tanimla(); return(View(duzenlenmisModel)); } }
private void CbDepo_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { ComboBox cbİtem = (ComboBox)sender; DepoModel dm = (DepoModel)cbİtem.SelectedItem; KatDoldur(dm.Id); CreateKatDetay(_CurrentKatModel, _DepoOrtalama); _Timer = new Timer(10000); _Timer.Elapsed += new ElapsedEventHandler(StartRefreshData); _Timer.Start(); } catch (Exception ex) { MessageBox.Show("CbDepo_SelectionChanged\n" + ex.Message); } }
public IslemOnayModel DepoEsyaGuncelle(DepoModel gunModel, int?kullaniciId) { IslemOnayModel onay = new IslemOnayModel(); var depoEsya = depoDAL.DepoEsyaGetir(gunModel.DepoEsyaId); if (depoEsya != null) { if (depoDAL.KullaniciEklemeYapabilirMi(kullaniciId, depoEsya.SehirTablo_SehirId)) { depoEsya.SehirTablo_SehirId = gunModel.Sehir.SehirId; depoEsya.Adet = gunModel.Adet; depoEsya.DepoEsyaId = Convert.ToInt32(gunModel.DepoEsyaId); depoEsya.EsyaTablo_EsyaId = gunModel.EsyaId; if (!(depoDAL.AyniEsyaVarMi(depoEsya))) { if (depoDAL.DepoEsyaGuncelle(depoEsya)) { onay.TamamlandiMi = true; } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Güncelleme işlemi sırasında bir hata oluştu."); } } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Aynı isme sahip bir eşya zaten var."); } } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Sadece kendi deponuzda değişiklik yapabilirsiniz."); } } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Düzenlenmek istenen eşya bulunamadı."); } return(onay); }
public List <DepoModel> FiltreliDepoGetir(int?KullaniciId, int?esyaId, int?sehirId, String aranan) { List <DepoModel> depoListe = new List <DepoModel>(); var depoEsyalari = depoDAL.FiltreliDepoGetir(KullaniciId, esyaId, sehirId, aranan); for (int i = 0; i < depoEsyalari.Count; i++) { DepoModel gonderilecekDepo = new DepoModel(); gonderilecekDepo.Adet = depoEsyalari[i].Adet; gonderilecekDepo.DepoEsyaId = depoEsyalari[i].DepoEsyaId; gonderilecekDepo.EsyaId = depoEsyalari[i].EsyaTablo.EsyaId; gonderilecekDepo.EsyaAdi = depoEsyalari[i].EsyaTablo.EsyaAdi; gonderilecekDepo.Sehir = new SehirModel() { SehirAdi = depoEsyalari[i].SehirTablo.SehirAdi, SehirId = depoEsyalari[i].SehirTablo_SehirId }; depoListe.Add(gonderilecekDepo); } return(depoListe.OrderBy(p => p.Sehir.SehirId).ToList()); }
public IslemOnayModel DepoyaEsyaEkle(DepoModel eklenecekEsya, int?kullaniciId) { IslemOnayModel onay = new IslemOnayModel(); if (depoDAL.DepodaEsyaVarMi(eklenecekEsya.EsyaId, eklenecekEsya.Sehir.SehirId)) { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Eklemeye çalıştığınız eşya zaten deponuzda var. Güncelleme işlemlerini düzenleme sayfasında yapınız."); } else { DepoTablo esya = new DepoTablo() { Adet = eklenecekEsya.Adet, EsyaTablo_EsyaId = eklenecekEsya.EsyaId, SehirTablo_SehirId = eklenecekEsya.Sehir.SehirId }; if (depoDAL.KullaniciEklemeYapabilirMi(kullaniciId, eklenecekEsya.Sehir.SehirId)) { if (depoDAL.DepoyaEsyaEkle(esya)) { onay.TamamlandiMi = true; } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Ekleme sırasında hata oluştu."); } } else { onay.TamamlandiMi = false; onay.HataMesajlari.Add("Yalnızca kendi şehriniz için ekleme yapabilirsiniz."); } } return(onay); }
private void FillComboBoxex(ComboBox cb) { try { switch (cb.Name) { case "CbDepo": _DtDepo = _data.DepoGetir(); List <DepoModel> listDepo = new List <DepoModel>(); foreach (DataRow row in _DtDepo.Rows) { Guid depoId = new Guid(row["DepoId"].ToString()); byte[] arr = (byte[])row["Img"]; string name = row["DepoIsim"].ToString(); listDepo.Add(new DepoModel(arr, name, depoId)); } CbDepo.DisplayMemberPath = "Name"; CbDepo.SelectedValuePath = "Id"; CbDepo.ItemsSource = listDepo; CbDepo.SelectedIndex = 0; break; case "CbKat": DepoModel dm = (DepoModel)CbDepo.SelectedItem; KatDoldur(dm.Id); break; default: break; } } catch (Exception ex) { MessageBox.Show("FillComboBoxex\n" + ex.Message); } }