Ejemplo n.º 1
0
 private void BorrowedBooks_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateGrid();
         var          foundBorroweds = borrowedRepo.GetAllBorroweds();
         List <Guid>  codeBooks      = new List <Guid>();
         List <Books> foundBooks     = new List <Books>();
         foreach (var item in foundBorroweds)
         {
             codeBooks.Add(item.BookCode);
         }
         codeBooks = codeBooks.Distinct().ToList();
         foreach (var item in codeBooks)
         {
             foundBooks.Add(booksRepo.FindBookByCode(item));
         }
         var results = (from a in foundBooks where a.BookState == 0
                        select new
         {
             نام = a.AuthorName + "  " + a.AuthorFName,
             موضوع = a.Subject,
             سال = a.PublishYear,
             عنوان = a.Title,
             قیمت = a.Price,
             خریدکتاب = a.PurchasedTime,
             کدکتاب = a.Code
         }).ToList();
         dataGridStorageOfBooks.DataSource = results;
     }
     catch (Exception)
     {
         UpdateGrid();
     }
 }
Ejemplo n.º 2
0
 private void Fines_Click(object sender, EventArgs e)
 {
     try
     {
         List <Borrowed> borroweds = borrowedRepo.GetAllBorroweds();
         DateTime        now       = DateTime.Now;
         long            value     = 10000;
         foreach (var item in borroweds)
         {
             //item.fines =
             borrowedRepo.EvalFine(now, value);
         }
         List <Members> members = new List <Members>();
         members.Add(membersRepo.FindUserByUserName(lblUser.Text));
         var results = (from book in borroweds
                        join member in members on book.MemberId equals member.MemberId
                        select new
         {
             کدملی = member.NationalCode,
             جریمه = book.fines
         }).ToList();
         dataGridOfBooks.DataSource = results;
     }
     catch (Exception)
     {
     }
 }