Ejemplo n.º 1
0
        private void ModelFilterMethod(List <string> whatModelChecked)
        {
            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                List <Phone> allPhonesChecked = new List <Phone>();

                foreach (var t in whatModelChecked)
                {
                    var p = db.Phones.Where(c => c.Name == t).ToList();
                    foreach (var ph in p)
                    {
                        allPhonesChecked.Add(ph);
                    }
                }

                if (whatModelChecked.Count > 0)
                {
                    myList.Clear();
                }
                foreach (var n in allPhonesChecked)
                {
                    string path = Environment.CurrentDirectory + n.ImagePath;
                    n.ImagePath = path;
                    myList.Add(n);
                }
            }
        }
Ejemplo n.º 2
0
        private StackPanel UpdateModelCheckboxes(List <int> whatCompanyChecked)
        {
            StackPanel   expanderPanel = new StackPanel();
            List <Phone> list          = new List <Phone>();

            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                foreach (var item in whatCompanyChecked)
                {
                    var ph = db.Phones.Where(c => c.CompanyId == item).ToList();
                    foreach (var p in ph)
                    {
                        list.Add(p);
                    }
                }

                foreach (var item in list)
                {
                    CheckBox ch = new CheckBox();
                    ch.Content    = item.Name;
                    ch.Command    = Filter;
                    ch.Checked   += AddExpanders.Ch_CheckedModel;
                    ch.Unchecked += AddExpanders.Ch_UncheckedModel;
                    ch.Tag        = item.Name;
                    ch.Margin     = new Thickness(5);
                    expanderPanel.Children.Add(ch);
                }
            }
            return(expanderPanel);
        }
Ejemplo n.º 3
0
        private ObservableCollection <Phone> GetPhones()
        {
            phones = new ObservableCollection <Phone>();

            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                var list = db.Phones.ToList();

                foreach (Phone p in list)
                {
                    string path = Environment.CurrentDirectory + p.ImagePath;
                    p.ImagePath = path;
                    phones.Add(p);
                }
            }
            return(phones);
        }
Ejemplo n.º 4
0
        public static StackPanel CreateNameCheckBox()
        {
            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                var        ph            = db.Phones.ToList();
                StackPanel expanderPanel = new StackPanel();

                foreach (var c in ph)
                {
                    CheckBox ch = new CheckBox();
                    ch.Content    = c.Name;
                    ch.Command    = new MainWindowViewModel().Filter;
                    ch.IsChecked  = false;
                    ch.Checked   += Ch_CheckedModel;
                    ch.Unchecked += Ch_UncheckedModel;
                    ch.Tag        = c.Name;
                    ch.Margin     = new Thickness(5);
                    expanderPanel.Children.Add(ch);
                }

                return(expanderPanel);
            }
        }
Ejemplo n.º 5
0
        private void CompanyFilterMethod(List <int> whatCompanyChecked)
        {
            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                List <Phone> allPhonesChecked = new List <Phone>();

                foreach (var t in whatCompanyChecked)
                {
                    var p = db.Phones.Where(c => c.CompanyId == t).ToList();
                    foreach (var ph in p)
                    {
                        allPhonesChecked.Add(ph);
                    }
                }

                myList.Clear();
                foreach (var n in allPhonesChecked)
                {
                    string path = Environment.CurrentDirectory + n.ImagePath;
                    n.ImagePath = path;
                    myList.Add(n);
                }
            }
        }
Ejemplo n.º 6
0
        public static StackPanel CreateCompanyCheckBox()
        {
            using (ShopFilterEntity db = new ShopFilterEntity())
            {
                var phone   = db.Phones.Include(c => c.Company).ToList();
                var company = db.Companies.ToList();

                StackPanel expanderPanel = new StackPanel();

                foreach (var c in company)
                {
                    CheckBox ch = new CheckBox();
                    ch.Content    = c.Name;
                    ch.Command    = new MainWindowViewModel().Filter;
                    ch.Checked   += Ch_CheckedCompany;
                    ch.Unchecked += Ch_UncheckedCompany;
                    ch.Tag        = c.Id;
                    ch.Margin     = new Thickness(5);
                    expanderPanel.Children.Add(ch);
                }

                return(expanderPanel);
            }
        }