Exemple #1
0
        private void btnKitapVer_Click(object sender, EventArgs e)
        {
            position(btnKitapVer);
            active(btnKitapVer);
            var SECİLEN = (from item in db.TBLKİTAPLAR
                           where item.BookName == KitapAd &&
                           item.WriterName == Yazar &&
                           item.Publisher == YayinEv &&
                           item.İsActivite == false
                           select item).FirstOrDefault();

            if (SECİLEN == null)
            {
                MessageBox.Show("Kitap Seçmediniz!");
            }
            else
            {
                TBLSECİLEN_KİTAPLAR sclnktp = new TBLSECİLEN_KİTAPLAR();
                var NameAndSurname          = (from item in db.TBLUSER
                                               where item.UserName == TumFormlar.Username &&
                                               item.UserPassword == TumFormlar.Password
                                               select item).FirstOrDefault();
                sclnktp = (from item in db.TBLSECİLEN_KİTAPLAR
                           where item.BookID == SECİLEN.ID &&
                           item.UserID == NameAndSurname.UserID
                           select item).FirstOrDefault();
                SECİLEN.İsActivite = true;
                db.TBLSECİLEN_KİTAPLAR.Remove(sclnktp);
                db.SaveChanges();
                AlinanListele();
            }
        }
Exemple #2
0
        private void btnKitapAl_Click(object sender, EventArgs e)
        {
            var SECİLEN = (from item in db.TBLKİTAPLAR
                           where item.BookName == KitapAd &&
                           item.WriterName == Yazar &&
                           item.Publisher == YayinEv
                           select item).FirstOrDefault();

            var ALİNAN_SECİLEN = (from item in db.TBLSECİLEN_KİTAPLAR
                                  where item.BookID == SECİLEN.ID
                                  select item).FirstOrDefault();



            if (SECİLEN == null)
            {
                MessageBox.Show("Kitap Seçmediniz!");
            }
            else if (ALİNAN_SECİLEN != null)
            {
                MessageBox.Show("Bu Kitabı Zaten Almışsınız!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                DialogResult secenek = MessageBox.Show(SECİLEN.BookName + " Kitabını Almak İstiyor musunuz?", "Onay Penceresi", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (secenek == DialogResult.Yes)
                {
                    TBLSECİLEN_KİTAPLAR sclnktp = new TBLSECİLEN_KİTAPLAR();
                    var NameAndSurname          = (from item in db.TBLUSER
                                                   where item.UserName == TumFormlar.Username &&
                                                   item.UserPassword == TumFormlar.Password
                                                   select item).FirstOrDefault();
                    sclnktp.BookID     = SECİLEN.ID;
                    sclnktp.UserID     = NameAndSurname.UserID;
                    SECİLEN.İsActivite = false;
                    db.TBLSECİLEN_KİTAPLAR.Add(sclnktp);
                    db.SaveChanges();
                    AllListele();
                }
            }
        }