public ActionResult guncelle(musteriler p1) { var musteri = db.musteriler.Find(p1.musteriid); musteri.musteriad = p1.musteriad; musteri.musterisoyad = p1.musterisoyad; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(musteriler newCustomer) { if (ModelState.IsValid) { dbstokEntities.musteriler.Add(newCustomer); dbstokEntities.SaveChanges(); return(RedirectToAction("Index")); } return(View(newCustomer)); }
public static musteriler ConvertMusteri(MusteriModel mm) { musteriler m = new musteriler(); m.musteriID = mm.musteriID; m.musteriAdi = mm.musteriAdi; m.musteriSoyadi = mm.musteriSoyadi; m.Adres = mm.Adres; m.Telefon = mm.Telefon; return(m); }
public ActionResult Update(musteriler customer) { if (ModelState.IsValid) { var updateCustomer = dbstokEntities.musteriler.Find(customer.MusteriId); updateCustomer.MusterAd = customer.MusterAd; updateCustomer.MusteriSoyad = customer.MusteriSoyad; dbstokEntities.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Register(musteriler musteri) { if (ModelState.IsValid) { using (ElEmegi2Context db = new ElEmegi2Context()) { db.musterilers.Add(musteri); db.SaveChanges(); } ModelState.Clear(); ViewBag.Message = musteri.kullanici_adi + "" + musteri + "kayıt başarılı"; } return(View()); }
public static bool UpdateMusteri(MusteriModel mm) { using (SuDBEntities s = new SuDBEntities()) { musteriler m = ConvertMusteri(mm); s.Entry(m).State = EntityState.Modified; if (s.SaveChanges() > 0) { return(true); } else { return(false); } } }
public static bool AddMusteri(MusteriModel mm) { using (SuDBEntities s = new SuDBEntities()) { musteriler m = ConvertMusteri(mm); s.musteriler.Add(m); if (s.SaveChanges() > 0) { return(true); } else { return(false); } } }
public JsonResult silMusteri(string id) { try { musteriler mstr = db.musteriler.Where(e => e.url.Equals(id)).FirstOrDefault(); if (mstr == null) { return(Json(JsonSonuc.sonucUret(false, "Müşteri/Mükellef bulunamadı."), JsonRequestBehavior.AllowGet)); } mstr.flag = durumlar.silindi; db.Entry(mstr).State = EntityState.Modified; db.SaveChanges(); } catch (Exception) { return(Json(JsonSonuc.sonucUret(false, "İşlem sırasında bir hata oluştu. Lütfen tekrar deneyiniz."), JsonRequestBehavior.AllowGet)); } return(Json(JsonSonuc.sonucUret(true, "Müşteri/Mükellef silindi."), JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Musteri(string id) { List <object> nesneler = new List <object>(); var m = db.musteriler.Where(e => e.flag != durumlar.silindi && e.url.Equals(id)).FirstOrDefaultAsync(); var fm = db.firma_musavir.Where(e => e.flag != durumlar.silindi).ToListAsync(); await Task.WhenAll(m, fm); musteriler mstr = m.Result; if (mstr == null) { mstr = new musteriler(); } List <firma_musavir> firmaList = fm.Result; nesneler.Add(mstr); nesneler.Add(firmaList); return(View(nesneler)); }
public ActionResult Login(musteriler objUser) { if (ModelState.IsValid) { using (ElEmegi2Context db = new ElEmegi2Context()) { var obj = db.musterilers.Where(a => a.kullanici_adi.Equals(objUser.kullanici_adi) && a.sifre.Equals(objUser.sifre)).FirstOrDefault(); if (obj != null) { Session["UserID"] = obj.kullanici_adi.ToString(); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "kullanıcı adı veya şifre yanlış"); } } } return(View()); }
public JsonSonuc yenimusteriKullanicisi(HttpRequestBase Request) { try { vrlfgysdbEntities db = new vrlfgysdbEntities(); LoggedUserModel lgm = GetCurrentUser.GetUser(); int vid = 1; if (db.kullanici_proje.Count() != 0) { vid = db.kullanici_proje.Max(e => e.vid) + 1; } int sort = 1; if (db.kullanici_proje.Count() != 0) { sort = db.kullanici_proje.Max(e => e.sort) + 1; } kullanici_musteri km = new kullanici_musteri(); foreach (var property in km.GetType().GetProperties()) { try { var response = Request[property.Name]; if (response == null && property.PropertyType != typeof(int)) { if (response == null) { continue; } } else { PropertyInfo propertyS = km.GetType().GetProperty(property.Name); if (property.PropertyType == typeof(decimal)) { propertyS.SetValue(km, Convert.ChangeType(Decimal.Parse(response.Replace('.', ',')), property.PropertyType), null); } else if (property.PropertyType == typeof(int)) { if (response == null) { propertyS.SetValue(km, Convert.ChangeType(0, property.PropertyType), null); } else { propertyS.SetValue(km, Convert.ChangeType(Decimal.Parse(response.Replace('.', ',')), property.PropertyType), null); } } else { propertyS.SetValue(km, Convert.ChangeType(response, property.PropertyType), null); } } } catch (Exception) { } } km.flag = durumlar.aktif; km.date = DateTime.Now; km.vid = vid; km.sort = sort; km.ekleyen = lgm.id; kullanici_musteri dbKm = db.kullanici_musteri.Where(e => e.flag == durumlar.aktif && e.musteri_id == km.musteri_id && e.kullanici_id == km.kullanici_id).FirstOrDefault(); if (dbKm != null) { return(JsonSonuc.sonucUret(true, "Kullanıcı Eklendi.")); } db.kullanici_musteri.Add(km); db.SaveChanges(); musteriler mstr = db.musteriler.Where(e => e.id == km.musteri_id).FirstOrDefault(); if (mstr != null) { bildirimIslemleri.yeniBildirim(km.kullanici_id, BildirimTurleri.musteri, km.musteri_id, mstr.url, mstr.firma_adi + " firma isimli müşteri ilgilenmeniz için size yönlendirildi. Yönlendiren yetkili " + lgm.ad + " " + lgm.soyad + "."); } return(JsonSonuc.sonucUret(true, "Kullanıcı Eklendi.")); } catch (Exception e) { return(JsonSonuc.sonucUret(false, "İşlem sırasında bir hata oluştu. Lütfen tekrar deneyiniz.")); } }
public ActionResult KullaniciEkle(musteriler kisi) { veri.kisiEkle(kisi.musteriad, kisi.musterisoyad, kisi.musterisehir, kisi.musteritc, kisi.musteritelefon); return(RedirectToAction("TumListe")); }
void griddoldur() { musteriler ms = ctx.musterilers.SingleOrDefault(musteri => musteri.tckimlikno == label3.Text); }
public string yeniMusteri(int firma_id, HttpRequestBase Request) { try { vrlfgysdbEntities db = new vrlfgysdbEntities(); int vid = 1; if (db.musteriler.Count() != 0) { vid = db.musteriler.Max(e => e.vid) + 1; } int sort = 1; if (db.musteriler.Count() != 0) { sort = db.musteriler.Max(e => e.sort) + 1; } musteriler mstr = new musteriler(); foreach (var property in mstr.GetType().GetProperties()) { try { var response = Request[property.Name]; if (response == null && property.PropertyType != typeof(int)) { if (response == null) { continue; } } else { PropertyInfo propertyS = mstr.GetType().GetProperty(property.Name); if (property.PropertyType == typeof(decimal)) { propertyS.SetValue(mstr, Convert.ChangeType(Decimal.Parse(response.Replace('.', ',')), property.PropertyType), null); } else if (property.PropertyType == typeof(int)) { if (response == null) { propertyS.SetValue(mstr, Convert.ChangeType(0, property.PropertyType), null); } else { propertyS.SetValue(mstr, Convert.ChangeType(Decimal.Parse(response.Replace('.', ',')), property.PropertyType), null); } } else { propertyS.SetValue(mstr, Convert.ChangeType(response, property.PropertyType), null); } } } catch (Exception) { } } string strImageName = StringFormatter.OnlyEnglishChar(mstr.ad + " " + mstr.soyad); string createdUrl = strImageName; string tempUrl = createdUrl; bool bulundu = false; int i = 0; musteriler pg = new musteriler(); do { pg = db.musteriler.Where(e => e.url.Equals(tempUrl)).FirstOrDefault(); if (pg != null) { tempUrl = tempUrl + i.ToString(); } else { createdUrl = tempUrl; bulundu = true; } i++; } while (!bulundu); mstr.url = createdUrl; mstr.firma_id = firma_id; mstr.flag = durumlar.aktif; mstr.date = DateTime.Now; mstr.vid = vid; mstr.ekleyen = GetCurrentUser.GetUser().id; mstr.sort = sort; mstr.firma = ""; bool kullaniciKontrol = firmaMusteriKontrol(mstr.firma_id, mstr.id).Result; if (!kullaniciKontrol) { return("musteri_sayisi_hatasi"); } db.musteriler.Add(mstr); db.SaveChanges(); return(mstr.url); } catch (Exception e) { return(""); } }
public string musteriDuzenle(string url, int firma_id, HttpRequestBase Request) { try { vrlfgysdbEntities db = new vrlfgysdbEntities(); musteriler dbMstr = db.musteriler.Where(e => e.url.Equals(url) && e.flag != durumlar.silindi).FirstOrDefault(); if (dbMstr == null || url == null || url.Equals("")) { return(yeniMusteri(firma_id, Request)); } else if (!(dbMstr.flag != durumlar.silindi)) { return(""); } string urlTemp = dbMstr.url; foreach (var property in dbMstr.GetType().GetProperties()) { try { var response = Request[property.Name]; if (response == null) { if (response == null) { continue; } } else { PropertyInfo propertyS = dbMstr.GetType().GetProperty(property.Name); if (property.PropertyType == typeof(decimal)) { propertyS.SetValue(dbMstr, Convert.ChangeType(Decimal.Parse(response.Replace('.', ',')), property.PropertyType), null); } else { propertyS.SetValue(dbMstr, Convert.ChangeType(response, property.PropertyType), null); } } } catch (Exception) { } } dbMstr.url = urlTemp; bool kullaniciKontrol = firmaMusteriKontrol(dbMstr.firma_id, dbMstr.id).Result; if (!kullaniciKontrol) { return("musteri_sayisi_hatasi"); } db.Entry(dbMstr).State = EntityState.Modified; db.SaveChanges(); if (dbMstr.id == GetCurrentUser.GetUser().id) { kullaniciIslemleri ki = new kullaniciIslemleri(); ki.resetLoginInfo(); } return(dbMstr.url); } catch (Exception e) { return(""); } }
public ActionResult yenimusteri(musteriler p1) { db.musteriler.Add(p1); db.SaveChanges(); return(RedirectToAction("index")); }