private List <Kullanici> ListAllUsers() { try { using (var kullaniciSoapClient = new KullaniciWebServiceSoapClient()) { List <Kullanici> kullanicis = new List <Kullanici>(); foreach (var responsedKullanici in kullaniciSoapClient.SelectAllKullanicis().OrderBy(x => x.kullaniciId).ToList()) { Kullanici castedKullanici = new Kullanici() { kullaniciAd = responsedKullanici.kullaniciAd, kullaniciId = responsedKullanici.kullaniciId, kullaniciTuru = responsedKullanici.kullaniciTuru }; kullanicis.Add(castedKullanici); } return(kullanicis); } } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Customer doesn't exists."); } }
/*private bool UpdateCustomer(int id, string name, string surname, string passkey, decimal balance, byte balancetype, bool isActive = true) * { * try * { * * using (var customerSoapClient = new CustomerWebServiceSoapClient()) * { * return customerSoapClient.InsertCustomer(new CustomerService.Customers() * { * CustomerID = id, * CustomerName = name, * CustomerSurname = surname, * CustomerPasskey = passkey, * Balance = balance, * BalanceType = balancetype, * isActive = isActive * }); * } * } * catch (Exception ex) * { * LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); * throw new Exception("Customer doesn't exists."); * } * }*/ private bool DeleteKullanici(int ID) { try { using (var kullaniciSoapClient = new KullaniciWebServiceSoapClient()) { return(kullaniciSoapClient.DeleteKullanici(ID)); } } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Customer doesn't exists."); } }
private bool InsertKullanici(string kullaniciAdi, string parola, string kullaniciTuru) { try { using (var kullaniciSoapClient = new KullaniciWebServiceSoapClient()) { return(kullaniciSoapClient.InsertKullanici(new Kullanici() { kullaniciAd = kullaniciAdi, parola = parola, kullaniciTuru = kullaniciTuru })); } } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Customer doesn't exists."); } }
private void btnKaydet_Click(object sender, EventArgs e) { int kullaniciId; KullaniciService.Kullanici kullanici = new KullaniciService.Kullanici() { kullaniciAd = txtKullaniciAdi.Text, kullaniciTuru = "yetkili", parola = txtKullaniciSifre.Text }; using (var kullaniciSoapClient = new KullaniciWebServiceSoapClient()) { kullaniciSoapClient.InsertKullanici(kullanici); kullaniciId = kullaniciSoapClient.MaxKullaniciId(); } Calisan calisan = new Calisan() { ad = txtAd.Text, soyad = txtSoyad.Text, sirketId = 5 }; using (var calisanSoapClient = new CalisanWebServiceSoapClient()) { if (calisanSoapClient.InsertCalisan(calisan)) { MessageBox.Show("Personel Başarıyla Eklendi"); txtSoyad.Text = ""; txtAd.Text = ""; txtKullaniciAdi.Text = ""; txtKullaniciSifre.Text = ""; } else { MessageBox.Show("Kayıt Yapılırken bir hata oluştu!"); } } }
private void btnKaydet_Click(object sender, EventArgs e) { int kullaniciId; KullaniciService.Kullanici kullanici = new KullaniciService.Kullanici() { kullaniciAd = txtKullaniciAdi.Text, kullaniciTuru = "yetkili", parola = txtKullaniciSifre.Text }; using (var kullaniciSoapClient = new KullaniciWebServiceSoapClient()) { kullaniciSoapClient.InsertKullanici(kullanici); kullaniciId = kullaniciSoapClient.MaxKullaniciId(); } Musteri musteri = new Musteri() { ad = txtAd.Text, soyad = txtSoyad.Text }; using (var musteriSoapClient = new MusteriWebServiceSoapClient()) { if (musteriSoapClient.InsertMusteri(musteri)) { MessageBox.Show("Müşteri Başarıyla Eklendi"); txtSoyad.Text = ""; txtAd.Text = ""; txtKullaniciAdi.Text = ""; txtKullaniciSifre.Text = ""; } else { MessageBox.Show("Kayıt Yapılırken bir hata oluştu!"); } } }
private void btnGirisYap_Click(object sender, EventArgs e) { try { using (var kullSoapClient = new KullaniciWebServiceSoapClient()) { List <Kullanici> kullanicilar = new List <Kullanici>(); foreach (var responsedKullanici in kullSoapClient.SelectAllKullanici().OrderBy(x => x.kullaniciID).ToList()) { Kullanici kull = new Kullanici() { kullaniciID = responsedKullanici.kullaniciID, kullAdi = responsedKullanici.kullAdi, kullSifre = responsedKullanici.kullSifre, kullRolID = responsedKullanici.kullRolID, Ad = responsedKullanici.Ad, Soyad = responsedKullanici.Soyad, TelNo = responsedKullanici.TelNo, Adres = responsedKullanici.Adres }; kullanicilar.Add(kull); } bool girisYapildi = false; foreach (Kullanici kull in kullanicilar) { if (kull.kullAdi == txtKullAdi.Text && kull.kullSifre == txtSifre.Text) { girisYapildi = true; string kullRol = ""; switch (kull.kullRolID) { case 1: kullRol = "Admin"; break; case 2: kullRol = "Yönetici"; break; case 3: kullRol = "Çalışan"; break; case 4: kullRol = "Müşteri"; break; default: break; } if (kullRol == "Admin" || kullRol == "Yönetici" || kullRol == "Çalışan") { MessageBox.Show("Hoşgeldiniz, " + kull.Ad + " " + kull.Soyad + ". Rol: " + kullRol); this.Hide(); frmAna frmAna = new frmAna(); frmAna.ShowDialog(); this.Show(); txtKullAdi.Text = txtSifre.Text = ""; txtKullAdi.Focus(); } else { MessageBox.Show("Müşteriler yalnızca webten giriş yapabilir!"); } break; } } if (!girisYapildi) { MessageBox.Show("Hatalı Giriş Bilgisi."); } } } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } }