Ejemplo n.º 1
0
 public async void FindCommandClick(object sender)
 {
     try
     {
         FindHandler find = new FindHandler();
         rs = new Model.RentalShopEntities();
         List <int> tmp = new List <int>();
         FreeCassetes.Clear();
         foreach (var item in find.FindTitle(FindHandler.FieldType.Title, FindArg))
         {
             foreach (var copyItem in rs.Cassete_Copies)
             {
                 if (item != null && copyItem.Catalog_Id == item.Catalog_Id && copyItem.Status != "busy" && !tmp.Contains(copyItem.Catalog_Id))
                 {
                     tmp.Add(copyItem.Catalog_Id);
                     p.Dispatcher.Invoke(() =>
                     {
                         FreeCassetes.Add(new CasseteShortInfo
                         {
                             Cover = API.Image.ByteArrayToImage(item.Cover),
                             Id    = item.Catalog_Id,
                             Name  = item.Title
                         });
                     });
                 }
             }
         }
         tmp.Clear();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Ejemplo n.º 2
0
 public void GetFreeCassetes()
 {
     try
     {
         rs = new Model.RentalShopEntities();
         List <int>     tmp = new List <int>();
         Model.Cassetes cassete;
         FreeCassetes.Clear();
         foreach (var item in rs.Cassete_Copies)
         {
             cassete = rs.Cassetes.Find(item.Catalog_Id);
             if (cassete != null && item.Status != "busy" && !tmp.Contains(item.Catalog_Id))
             {
                 tmp.Add(item.Catalog_Id);
                 p.Dispatcher.Invoke(() =>
                 {
                     FreeCassetes.Add(new CasseteShortInfo
                     {
                         Name   = cassete.Title,
                         Copies = item.Copy_Id,
                         Cover  = API.Image.ByteArrayToImage(cassete.Cover),
                         Id     = item.Catalog_Id,
                         CopyId = item.Copy_Id
                     });
                 });
             }
         }
         tmp.Clear();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }