Beispiel #1
0
        protected override void LoadChildren()
        {
            GenericDataAccessLayer <FizickoLice> dal = new GenericDataAccessLayer <FizickoLice>();

            _childFirst = CurrRecursiveType == "ChildParent" ? true : false;

            if (_childFirst)
            {
                FizickoLice fll = dal.GetEntity(f => f.Id == Fl.Id, f => f.Otac, f => f.Majka);

                if (fll.Majka != null)
                {
                    base.Children.Add(new ChildsViewModel(fll.Majka, CurrRecursiveType));
                }

                if (fll.Otac != null)
                {
                    base.Children.Add(new ChildsViewModel(fll.Otac, CurrRecursiveType));
                }
            }
            else
            {
                List <FizickoLice> fllColl = dal.GetList(f => f.OtacId == Fl.Id || f.MajkaId == Fl.Id, null).ToList();

                if (fllColl != null && fllColl.Count() > 0)
                {
                    foreach (FizickoLice item in fllColl)
                    {
                        base.Children.Add(new ChildsViewModel(item, CurrRecursiveType));
                    }
                }
            }
        }
        internal void RefreshMajkeCollection()
        {
            GenericDataAccessLayer <FizickoLice> dal = new GenericDataAccessLayer <FizickoLice>();
            List <FizickoLice> collFl = dal.GetList(fl => fl.Pol == "Z" && fl.Id != (ObjectToPersist as FizickoLice).Id).ToList();

            ZenskaFizickaLica = new ObservableCollection <FizickoLice>(collFl);
            SetMajka();
        }