private void submit_Click(object sender, RoutedEventArgs e)
 {
     if((code.Text == string.Empty) && (name.Text == string.Empty) && (brand.Text == string.Empty) && (price.Text == string.Empty) && (vat.Text == string.Empty) && (priceVat.Text == string.Empty) )
         System.Windows.MessageBox.Show("Musí byť vyplnený aspoň jeden údaj ");
     else {
         SearchEventArgs args = new SearchEventArgs();
         List<Interface.IOrder> ords = new List<Interface.IOrder>();
         List<Interface.IOrderItem> ordItems = Settings.Config.getOrderItems();
         if (!String.IsNullOrEmpty(code.Text.ToString()))
           ordItems =  ordItems.Where(x => x.code == code.Text.ToString()).ToList<Interface.IOrderItem>();
         if (!String.IsNullOrEmpty(brand.Text))
             ordItems = ordItems.Where(x => x.brand == brand.Text.ToString()).ToList<Interface.IOrderItem>();
         if (!String.IsNullOrEmpty(price.Text))
             ordItems = ordItems.Where(x => x.price.ToString() == price.Text.ToString()).ToList<Interface.IOrderItem>();
         if (!String.IsNullOrEmpty(vat.Text))
             ordItems = ordItems.Where(x => x.vat.ToString() == vat.Text.ToString()).ToList<Interface.IOrderItem>();
         if (!String.IsNullOrEmpty(priceVat.Text))
             ordItems = ordItems.Where(x => x.priceVat.ToString() == priceVat.Text.ToString()).ToList<Interface.IOrderItem>();
         foreach (var prod in ordItems)
         {
             MessageBox.Show(code.Text.ToString());
             Interface.IOrder ord = Settings.Config.getOrders().FirstOrDefault(x=> x.id == prod.orderId);
             if(ords.FirstOrDefault(x => x.id == ord.id) == null)
                 ords.Add(ord);
         }
         args.ords = ords;
         if (ords.Count == 0)
         {
             MessageBox.Show("Tento filter nenašiel žiadne výsledky.");
         }
         else
         {
             onSearched(args);
         }
     }
    
 }
 private void submit_Click(object sender, RoutedEventArgs e)
 {
     if ((customId.Text == string.Empty) && (titlePrefix.Text == string.Empty) && 
         (firstName.Text == string.Empty) && (lastName.Text == string.Empty) && 
         (titleSuffix.Text == string.Empty) && (street.Text == string.Empty) && 
         (city.Text == string.Empty) && (zip.Text == string.Empty) && (email.Text == string.Empty)
         && (mobile.Text == string.Empty) && (name.Text == string.Empty) && (ico.Text == string.Empty)
         && (dic.Text == string.Empty) && (icDph.Text == string.Empty) && this.oznacene && 
         (country.SelectedValue == null))
         System.Windows.MessageBox.Show("Musí byť vyplnený aspoň jeden údaj ");
     else
     {
         SearchEventArgs args = new SearchEventArgs();
         List<Interface.IOrder> ords = new List<Interface.IOrder>();
         List<Interface.IOrder> orders = Settings.Config.getOrders();
         if (!String.IsNullOrEmpty(customId.Text.ToString()))
             orders = orders.Where(x => x.company.custom_id == customId.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(titlePrefix.Text))
             orders = orders.Where(x => x.company.person.titlePrefix == titlePrefix.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(firstName.Text))
             orders = orders.Where(x => x.company.person.firstName == firstName.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(lastName.Text))
             orders = orders.Where(x => x.company.person.lastName == lastName.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(titleSuffix.Text))
             orders = orders.Where(x => x.company.person.titleSuffix == titleSuffix.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(street.Text))
             orders = orders.Where(x => x.company.address.street == street.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(city.Text))
             orders = orders.Where(x => x.company.address.city == city.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(zip.Text))
             orders = orders.Where(x => x.company.address.zip == zip.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(email.Text))
             orders = orders.Where(x => x.company.contact.email == email.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(mobile.Text))
             orders = orders.Where(x => x.company.contact.mobile == mobile.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(name.Text))
             orders = orders.Where(x => x.company.name == name.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(ico.Text))
             orders = orders.Where(x => x.company.ico == ico.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(dic.Text))
             orders = orders.Where(x => x.company.dic == dic.Text.ToString()).ToList<Interface.IOrder>();
         if (!String.IsNullOrEmpty(icDph.Text))
             orders = orders.Where(x => x.company.icDph == icDph.Text.ToString()).ToList<Interface.IOrder>();
         if (country.SelectedValue != null)
             orders = orders.Where(x => x.company.address.country == country.SelectedValue.ToString()).ToList<Interface.IOrder>();
         if (!oznacene)
             orders = orders.Where(x => x.company.corporatePerson.ToString() == this.c).ToList<Interface.IOrder>();
         foreach (var _ord in orders)
         {
             
             Interface.IOrder ord = Settings.Config.getOrders().FirstOrDefault(x => x.id == _ord.id);
             if (ords.FirstOrDefault(x => x.id == ord.id) == null)
                 ords.Add(ord);
         }
         args.ords = ords;
         if (ords.Count == 0)
         {
             MessageBox.Show("Tento filter nenašiel žiadne výsledky.");
         }
         else
         {
             onSearched(args);
         }
     }  
 }
 private void onSearched(SearchEventArgs args)
 {
     if (Searched != null)
         Searched(this, args);
 }
 private void controlSearched(object sender, SearchEventArgs e)
 {
     VypisControl control = new VypisControl(e.ords);
     control.Canceled += controlCanceled;
     control.Edit += controlEdit;
     this.contentControl.Content = control;
     this.Title = "Výpis";
 }