Esempio n. 1
0
 private void btnKaydet_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(txtKullaniciAdi.Text) && !string.IsNullOrWhiteSpace(txtSifre.Text))
         {
             kullaniciManager.Add(
                 new Kullanici
             {
                 Adi            = txtAdi.Text,
                 Aktif          = chbAktif.Checked,
                 Email          = txtEmail.Text,
                 KullaniciAdi   = txtKullaniciAdi.Text,
                 KullaniciSifre = txtSifre.Text,
                 Soyadi         = txtSoyadi.Text
             }
                 );
             dgvKullanicilar.DataSource = kullaniciManager.GetAll();
             MessageBox.Show("Kayıt Eklendi!");
         }
         else
         {
             MessageBox.Show("Kullanıcı Adı ve Şifre Boş Geçilemez!");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Hata Oluştu!");
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            // ilgili nesneler oluşturuluyor
            Kullanici   kullanici = new Kullanici();
            Bakiye      bakiye    = new Bakiye();
            List <Urun> uruns     = new List <Urun>();

            // ilgili manager nesneleri oluşturuluyor
            KullaniciManager kullaniciManager = new KullaniciManager(new EfKullaniciDal());
            BakiyeManager    bakiyeManager    = new BakiyeManager(new EfBakiyeDal());
            UrunManager      urunManager      = new UrunManager(new EfUrunDal());
            StokManager      stokManager      = new StokManager(new EfStokDal());

            // girilen bilgiler kullanıcı nesnesine aktarılıyor
            kullanici.Ad             = txtAd.Text;
            kullanici.Soyad          = txtSoyad.Text;
            kullanici.TelNo          = txtTel.Text;
            kullanici.KullaniciAd    = txtKullaniciAd.Text;
            kullanici.KullaniciSifre = txtSifre.Text;
            kullanici.TcNo           = txtTcNo.Text;
            kullanici.eMail          = txtEmail.Text;
            kullanici.Adres          = rchAdres.Text;

            var result = kullaniciManager.Add(kullanici);

            bakiye.KullaniciId     = kullaniciManager.Get(kullanici).KullaniciId;
            bakiye.MevcutBakiye    = 0;
            bakiye.EklenecekBakiye = 0;
            bakiye.DovizId         = 1;
            bakiye.BakiyeOnay      = true;
            var result2 = bakiyeManager.Add(bakiye);

            kullanici = kullaniciManager.Get(kullanici);
            uruns     = urunManager.GetAll();

            // ürün tablosuna kullanıcının boş stokları ekleniyor
            foreach (var urun in uruns)
            {
                Stok stok = new Stok();
                stok.KullaniciId = kullanici.KullaniciId;
                stok.UrunId      = urun.UrunId;
                stok.UrunMiktar  = 0;
                stok.UrunOnay    = false;
                stokManager.Add(stok);
            }


            if (result)
            {
                MessageBox.Show("Kayıt Tamamlandı");
            }
            else
            {
                MessageBox.Show("Kullanıcı eklenemedi.");
            }
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "Id,KullaniciAdi,KullaniciSifre,Email,Adi,Soyadi,Aktif")] Kullanici kullanici)
        {
            if (ModelState.IsValid)
            {
                db.Add(kullanici);

                return(RedirectToAction("Index"));
            }

            return(View(kullanici));
        }
 protected void btnKaydet_Click(object sender, EventArgs e)
 {
     try
     {
         kullaniciManager.Add(
             new Kullanici
         {
             Adi            = txtAdi.Text,
             Soyadi         = txtSoyadi.Text,
             Aktif          = cbAktif.Checked,
             Email          = txtEmail.Text,
             KullaniciAdi   = txtKullaniciAdi.Text,
             KullaniciSifre = txtSifre.Text
         }
             );
         Response.Redirect("KullaniciYonetimi.aspx");
     }
     catch (Exception)
     {
         Response.Write("Hata Oluştu!");
     }
 }