Exemplo n.º 1
0
        // FindInChildren kullan Eger BR den gidecekse.
        // Yetki deneme, OnyYtk UsrYtk'nin uyesi mi? OnyYtk'nin ustunde UsrYtk var mi? OK
        private static bool IsOnyYtkMemberOfUsrYtk(NNT UsrYtk, NNT OnyYtk, bool varmi)    // UsrYtk, OnyYtk/Constant
        {
            if (UsrYtk.GetObjectNo() == OnyYtk.GetObjectNo())
            {
                return(true);
            }

            if (!varmi)
            {
                foreach (var r in Db.SQL <NNR>("select r from NNR r where r.NP = ?", UsrYtk))
                {
                    var aaa = r.NP.Ad;
                    var bbb = r.NC.Ad;
                    if (r.NC.GetObjectNo() == OnyYtk.GetObjectNo())
                    {
                        varmi = true;
                        break;
                    }
                    else if (r.NC.HasKid && !varmi)
                    {
                        varmi = IsOnyYtkMemberOfUsrYtk(r.NC, OnyYtk, varmi);
                    }
                }
            }
            return(varmi);
        }
Exemplo n.º 2
0
        public static void DenemeYetki()  // UsrYtk'nin altinda OnyYtk var mi?
        {
            // Senay296 da Mehmet294 yok
            // Mehmet294 de Sener299 yok
            // Suzan295 de Ali301 var
            // Senay296 da Ali301 var
            NNT  UsrYtk = Db.FromId <NNT>(304);
            NNT  OnyYtk = Db.FromId <NNT>(301);
            bool rv     = IsOnyYtkMemberOfUsrYtk(UsrYtk, OnyYtk, false); // IsOnyYtkMemberOfUsrYtk

            UpToUsr(OnyYtk, UsrYtk);
            DownToOny(UsrYtk, OnyYtk);

            Dictionary <NNT, List <NNT> > mD = new Dictionary <NNT, List <NNT> >();

            foreach (var r in Db.SQL <NNT>("SELECT r FROM NNT r"))
            {
                var list = new List <NNT>();
                DownTo(r, list);
                mD[r] = list;
            }

            // find ony in node
            bool fnd = false;

            foreach (var f in mD[UsrYtk])
            {
                if (f.GetObjectNo() == OnyYtk.GetObjectNo())
                {
                    fnd = true;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public static void NodeMikInParents(ulong parent, DataTable table)
        {
            Dictionary <ulong, double> mikD = new Dictionary <ulong, double>(); // Gereken

            NodeMikInParent(parent, 1, mikD);                                   // Kid's Mik of parent.

            NNT p = Db.FromId <NNT>(parent);
            NNT n = null;

            Console.WriteLine($"Nodes @{p.Ad} ---------->");
            ulong  pNo = p.GetObjectNo();
            string nAd = "";
            string pAd = p.Ad;

            // ↑↓↕↔
            // ▲▼●
            if (!p.HasPrn)
            {
                pAd = "*" + pAd;  // root
            }
            else
            {
                pAd = "+" + pAd;
            }

            foreach (var r in mikD)
            {
                n   = Db.FromId <NNT>(r.Key);
                nAd = n.Ad;
                if (!n.HasKid)
                {
                    nAd = "-" + nAd;  // leaf
                }
                else
                {
                    nAd = "+" + nAd;
                }
                //Console.WriteLine($"{pAd}.{nAd} -> Mik: {r.Value}");
                table.Rows.Add(pNo, p.GetObjectNo(), pAd, nAd, r.Value);
            }
        }