예제 #1
0
        public Tabela GetADUserInfo(string filtro, string txt_valor, string[] retorno)

        {
            Tabela tabela = new Tabela();


            try
            {
                // This is a generic LDAP call, it would do a DNS lookup to find a DC in your AD site, scales better

                DirectoryEntry enTry = new DirectoryEntry("LDAP://192.168.92.200/DC=contoso,DC=local", "contoso\\administrator", "Br@sil01"); //como a maquina nao esta no dominio é preciso passar o user e senha

                DirectorySearcher mySearcher = new DirectorySearcher(enTry);

                mySearcher.Filter = "(" + filtro + "=" + txt_valor + ")";//var com uma função filter
                mySearcher.PropertiesToLoad.AddRange(retorno);

                SearchResultCollection resEnt = mySearcher.FindAll(); //busca apenas 1 usuario



                foreach (SearchResult searchresult in resEnt)
                {
                    Linha linha = new Linha();


                    for (int i = 0; i < retorno.Length; i++)
                    {
                        Coluna colunaobj = new Coluna();
                        colunaobj.Nome = retorno[i];


                        if (searchresult.Properties.Contains(retorno[i]))
                        {
                            colunaobj.Valor = searchresult.Properties[retorno[i]][0].ToString();
                        }

                        linha.Add(colunaobj);
                    }

                    tabela.Add(linha);
                }
            }

            catch (Exception f)
            {
                //  divnome.InnerText = "erro:" + f.Message;
            }

            return(tabela);
        }
예제 #2
0
        private void InicializaTabela()
        {
            Token t;

            Tabela.Add(".", (int)TokenId.Ponto);
            Tabela.Add("var", 2);
            Tabela.Add(",", 3);
            Tabela.Add(";", 4);
            Tabela.Add("begin", 5);
            Tabela.Add("end", 6);
            Tabela.Add("print", 7);
            Tabela.Add("read", 8);
            Tabela.Add("if", 9);
            Tabela.Add("then", 10);
            Tabela.Add("for", 11);
            Tabela.Add("to", 12);
            Tabela.Add("do", 13);
            Tabela.Add("else", 14);
            Tabela.Add(":=", 15);
            Tabela.Add("+", 16);
            Tabela.Add("-", 17);
            Tabela.Add("*", 18);
            Tabela.Add("/", 19);
            Tabela.Add("(", 20);
            Tabela.Add(")", 21);
            Tabela.Add("=", 22);
            Tabela.Add("<>", 23);
            Tabela.Add(">", 24);
            Tabela.Add("<", 25);
            Tabela.Add(">=", 26);
            Tabela.Add("<=", 27);
            Tabela.Add("variavel", 28);
            Tabela.Add("numint", 29);
            Tabela.Add("numfloat", 30);
            Tabela.Add("real", 31);
            Tabela.Add("integer", 32);
            Tabela.Add(":", 33);
            Tabela.Add("const", 34);
            Tabela.Add("EOF", 35);
            Console.WriteLine("Tabela Inicializada");
        }