Ejemplo n.º 1
0
        private void BtnGiveBook_Click(object sender, EventArgs e)
        {
            // Burada öğrencinin okuduğu kitaplar nesnesini üretiyoruz
            StudentReadInfo studentread = new StudentReadInfo();

            // Üretilen nesnenin hangi öğrenci olduğunu Comboboxtan gelen veriyi StudentList içinde bulup seçtirilir
            studentread.StudentId = DALStudent.StudentList().FirstOrDefault(n => n.StudentName == comboBox1.SelectedItem.ToString());
            // Üretilen nesnenin hangi kitap olduğunu Comboboxtan gelen veriyi BookList içinde bulup seçtirilir
            studentread.BookId = DALBook.BookList().FirstOrDefault(n => n.bookName == comboBox2.SelectedItem.ToString());
            // Öğrencinin okuduğu kitaplar nesnesi üzerinde bulunan kitapın alınma tarihine DateTimePickerdan gelen değeri atanır
            studentread.TakenDate = dateTimePicker1.Value.Date.ToString();
            // Entity katmanında TakenDate String olarak tutulduğu için gerekli tip dönüşüm işlemleri yapılır
            DateTime DueDate = Convert.ToDateTime(studentread.TakenDate);

            // DueDate kitabın teslim edilme tarihini teslim eder bunu DatetimePickerden gelen tarihe 15gün ekleyerek elde edilir.
            DueDate = DueDate.AddDays(15);
            // Entity'miz String olduğu için tekrar tip dönüşümü yapılır
            studentread.GivenDate = DueDate.ToString();
            // Entitymizin Kitabın verilip verilmediğini isGiven değişkeni üzerinde saklanır
            // Kitap verildiği taktirde isGiven true olur.
            studentread.isGiven = true;
            // Gerekli mantıksal işlemler yapılması için LLStudentBookSave methoduna gönderilir.
            LogicStudentRead.LLStudentBookSave(studentread);
            MessageBox.Show("Kitap Verildi");
            // Verilen kitapın alınıp alınmadığını tutan isBookAvailable özelliği ->Busy olarak değiştirilir.
            studentread.BookId.isBookAvailable = "Busy";
            // Kitabın durumunu güncellemek için LLStudentBookUpdate methoduna gönderilir
            LogicStudentRead.LLStudentBookUpdate(studentread.BookId);
            MessageBox.Show("Kitap Durumu Güncellendi");
        }
        private void BtnReleaseBook_Click(object sender, EventArgs e)
        {
            StudentReadInfo readInfo = new StudentReadInfo();

            readInfo.StudentId = this.student;
            readInfo.BookId    = DALBook.BookList().FirstOrDefault(n => n.bookName == cmbBookName.SelectedItem.ToString());
            readInfo.TakenDate = dateTimePicker1.Value.Date.ToString();
            DateTime d2 = Convert.ToDateTime(readInfo.TakenDate);

            d2 = d2.AddDays(15);
            readInfo.GivenDate = d2.ToString();
            readInfo.BookId.isBookAvailable = "Available";
            LogicStudentRead.LLStudentBookUpdate(readInfo.BookId);
            MessageBox.Show("Kitap Teslim Edildi Güncellendi");
        }
Ejemplo n.º 3
0
        //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BURAYA SON KEZ BAK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        private void BtnTakeBook_Click(object sender, EventArgs e)
        {
            // Burada öğrencinin okuduğu kitaplar nesnesini üretiyoruz
            StudentReadInfo studentread = new StudentReadInfo();

            // Üretilen nesnenin hangi öğrenci olduğunu Comboboxtan gelen veriyi StudentList içinde bulup seçtirilir
            studentread.StudentId = DALStudent.StudentList().FirstOrDefault(n => n.StudentName == comboBox1.SelectedItem.ToString());
            // Üretilen nesnenin hangi kitap olduğunu Comboboxtan gelen veriyi BookList içinde bulup seçtirilir
            studentread.BookId = DALBook.BookList().FirstOrDefault(n => n.bookName == comboBox2.SelectedItem.ToString());
            DateTime date      = DateTime.Now;
            var      shortDate = date.ToString("yyyy-MM-dd");

            studentread.GivenDate = shortDate.ToString();
            studentread.BookId.isBookAvailable = "Available";
            LogicStudentRead.LLStudentBookUpdate(studentread.BookId);
            MessageBox.Show("Kitap Durumu Güncellendi");
        }