Esempio n. 1
0
        private void DataGridScreen_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //datagridde bakiyeler görüntüleniyor ise ilgili değerler ilgili nesnelere gönderilir.
            if (DataGridScreen.DataSource == _bakiyeler)
            {
                int secilen = DataGridScreen.SelectedCells[0].RowIndex;
                _bakiye.KullaniciId     = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[0].Value);
                _bakiye.MevcutBakiye    = Convert.ToDecimal(DataGridScreen.Rows[secilen].Cells[1].Value);
                _bakiye.EklenecekBakiye = Convert.ToDecimal(DataGridScreen.Rows[secilen].Cells[2].Value);
                _bakiye.DovizId         = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[3].Value);
                _bakiye.BakiyeOnay      = Convert.ToBoolean(DataGridScreen.Rows[secilen].Cells[4].Value);
                lblEklenecekBakiye.Text = _bakiye.EklenecekBakiye.ToString();
                _kullanici.KullaniciId  = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[0].Value);
                _kullanici           = kullaniciManager.GetAll().FirstOrDefault(p => p.KullaniciId == _kullanici.KullaniciId);
                lblKullaniciAdi.Text = _kullanici.Ad + " " + _kullanici.Soyad;
            }

            //datagridde stoklar görüntüleniyor ise ilgili değerler ilgili nesnelere gönderilir.
            else if (DataGridScreen.DataSource == _stoklar)
            {
                int secilen = DataGridScreen.SelectedCells[0].RowIndex;
                _stok.KullaniciId = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[1].Value);
                _stok.UrunId      = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[2].Value);


                lblEklenecekStok.Text = _stok.UrunMiktar.ToString();

                _kullanici.KullaniciId = Convert.ToInt16(DataGridScreen.Rows[secilen].Cells[1].Value);
                _kullanici             = kullaniciManager.GetAll().FirstOrDefault(p => p.KullaniciId == _kullanici.KullaniciId);
                lblKullaniciAdi2.Text  = _kullanici.Ad + " " + _kullanici.Soyad;

                _stok = stokManager.GetAll()
                        .FirstOrDefault(p => p.KullaniciId == _stok.KullaniciId && p.UrunId == _stok.UrunId);
            }
        }
Esempio n. 2
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!");
     }
 }
        private static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Hello World!");
                Console.ReadKey();

                Console.WriteLine("------Select Operation--------");
                KullaniciManager kullaniciManager = new KullaniciManager();
                foreach (DAL.Models.Kullanici VARIABLE in kullaniciManager.GetAll().ToList())
                {
                    Console.WriteLine(VARIABLE.ad);
                }

                Console.ReadKey();
                Console.WriteLine("------Insert Operation--------");
                Kullanici k = new Kullanici()
                {
                    ad                   = "Kübra",
                    email                = "*****@*****.**",
                    adminMi              = false,
                    aktifMi              = true,
                    onayKodu             = "12586",
                    sifre                = "7854123985",
                    soyad                = "KAPLAN",
                    telefon              = "547856965",
                    universitePersonelMi = false
                };
                var PkId = kullaniciManager.Insert(k);
                k.KullaniciId = Convert.ToInt32(PkId);

                Console.ReadKey();
                Console.WriteLine("------Get By ID Operation--------");
                var user = kullaniciManager.GetById(PkId);
                Console.WriteLine($"ID={user.KullaniciId}\tAD={user.ad}\tSOYAD={user.soyad}");

                Console.ReadKey();
                Console.WriteLine("------Delete Operation--------");
                kullaniciManager.Delete(PkId);


                Console.ReadKey();
                Console.WriteLine("------ Again Select Operation--------");
                kullaniciManager = new KullaniciManager();
                foreach (DAL.Models.Kullanici VARIABLE in kullaniciManager.GetAll().ToList())
                {
                    Console.WriteLine(VARIABLE.ad);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n" + e.InnerException?.Message);
                throw;
            }

            Console.ReadKey();
        }
Esempio n. 4
0
        private void frmAdmin_Load(object sender, EventArgs e)
        {
            lblAdminKullaniciAd.Text = _admin.KullaniciAd;
            lblAdminBakiye.Text      = Math.Round(Convert.ToDecimal(_admin.Bakiye), 2) + " TL";
            grpBakiyeOnay.Visible    = false;
            grpStokOnay.Visible      = false;
            KullaniciManager kullaniciManager = new KullaniciManager(new EfKullaniciDal());
            BakiyeManager    bakiyeManager    = new BakiyeManager(new EfBakiyeDal());

            _kullanicilar = kullaniciManager.GetAll();
        }
Esempio n. 5
0
 // GET: Admin/Kullanici
 public ActionResult Index()
 {
     return(View(db.GetAll()));
 }