示例#1
0
        static void Main(string[] args)
        {
            List <Politician> politicians;
            List <Proposal>   proposals;

            provideProposals(); // cadastra as propostas

            using (var cli = new ContributorServiceClient())
            {
                cli.Open();
                politicians = cli.ListPoliticians().ToList();
                proposals   = cli.ListProposals().ToList();
                cli.Close();
            }

            using (var cli = new ContributorServiceClient())
            {
                cli.Open();


                politicians = cli.ListPoliticians().ToList();



                //proposals = cli.ListProposals().ToList();
                cli.Close();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            string userName = "******";
            string passWord = "******";


            List <Politician> politicians;
            List <Proposal>   proposals;

            provideProposals(); // cadastra as propostas

            using (var cli = new ContributorServiceClient())
            {
                cli.Open();
                politicians = cli.ListPoliticians().ToList();
                proposals   = cli.ListProposals().ToList();
                cli.Close();
            }

            providePoliticianData();

            using (var cli = new ContributorServiceClient())
            {
                cli.Open();
                politicians = cli.ListPoliticians().ToList();
                //proposals = cli.ListProposals().ToList();
                cli.Close();
            }

            Console.WriteLine("Persistir as informacoes ? (S)im / (N)ao");
            string voto = Console.ReadKey().Key.ToString().ToUpper();

            if (voto == "S")
            {
                using (var cli = new ContributorServiceClient())
                {
                    cli.Open();
                    bool saveOk = false;
                    int  itry   = 0;
                    while (!saveOk && itry < 10)
                    {
                        saveOk = cli.VerifyAndPersist(userName, passWord);
                        System.Threading.Thread.Sleep(2500);
                        if (itry >= 1)
                        {
                            Console.WriteLine($"Falha na autenticacao. Aguardando... Tentativa {itry} de 10");
                        }
                        itry++;
                    }

                    Console.WriteLine("Dados foram persistidos");
                    //proposals = cli.ListProposals().ToList();
                    cli.Close();
                }
            }
            else
            {
                //
            }

            Console.WriteLine("Finalizada inclusao de informacoes");
            Console.ReadKey();
        }