Ejemplo n.º 1
0
 private void RemoveMatchingExpiredItems(Variant item)
 {
     if (ExpiredItems.Any(x => x.VariantId == item.VariantId))
     {
         ApplyChange(new ExpiredItemDeletedEvent(Id, item.VariantId));
     }
 }
Ejemplo n.º 2
0
 private void ExpiredItems_OnLoaded(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable dt   = new DataTable();
         string    date = DateTime.Today.AddDays(7).ToString("yyyy-MM-dd");
         con = new SqlConnection(ConString);
         con.Open();
         cmd = new SqlCommand("select inv.ingredient,CONCAT(inv.quantity,' ',inv.unit) as quantity,convert(varchar, inv.e_date, 3) as e_date,CASE WHEN supplier_id IS NULL THEN '' ELSE (SELECT CONCAT(sup.supplier_name,' ',sup.supplier_mobile) FROM dbo.suppliers as sup where supplier_id= inv.supplier_id) END AS supplier_details from dbo.inventory as inv where inv.e_date <= @date", con);
         cmd.Parameters.AddWithValue("@date", date.ToString());
         adapter = new SqlDataAdapter(cmd);
         adapter.Fill(dt);
         ExpiredItems.SetBinding(ItemsControl.ItemsSourceProperty, new Binding {
             Source = dt
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         con.Close();
     }
 }
Ejemplo n.º 3
0
 internal void Apply(ExpiredItemDeletedEvent @event)
 {
     ExpiredItems.Remove(ExpiredItems.FirstOrDefault(i => i.VariantId == @event.VariantId));
 }