예제 #1
0
    public static string melhorTempo()
    {
        if (cronometro.horas >= melhor.horas)
        {
            if (cronometro.horas == melhor.horas)
            {
                if (cronometro.minutos >= melhor.minutos)
                {
                    if (cronometro.minutos == melhor.minutos)
                    {
                        if (cronometro.segundos >= melhor.segundos)
                        {
                            melhor = cronometro;
                        }
                    }
                    else
                    {
                        melhor = cronometro;
                    }
                }
            }
            else
            {
                melhor = cronometro;
            }
        }

        return(melhor.horas.ToString("00") + ":" + melhor.minutos.ToString("00") + ":" + melhor.segundos.ToString("00"));
    }
 public GeradorDePagamento(LeilaoDaoFalso leilaoDao, Avaliador avaliador, PagamentoDao pagamentoDao)  
 {
     this.LeilaoDao = leilaoDao;
     this.Avaliador = avaliador;
     this.PagamentoDao = pagamentoDao;
     this.RelogioSystema = new RelogioDoSistema();
 }
예제 #3
0
    //funcao de start chamada depois de achar relogio
    public void comeco(Relogio rel, float ciclo)
    {
        relogio = rel;

        trans     = GetComponent <Transform>();
        cicloHora = ciclo;
    }
예제 #4
0
 public GeradorDePagamento(LeilaoDaoFalso leilaoDao, Avaliador avaliador, PagamentoDao pagamentoDao, Relogio relogio)
 {
     this.leilaoDao    = leilaoDao;
     this.avalidaor    = avaliador;
     this.pagamentoDao = pagamentoDao;
     this.relogio      = relogio;
 }
예제 #5
0
 //Referencias
 private void _Referencias()
 {
     _jogador = GetNode <Jogador>("Principal/Jogador");
     if (_jogador == null)
     {
         _Erro("Jogador não encontrado", "_Referencias");
     }
     _memLocal = GetNode <Memoria>("/root/MemLocal");
     if (_memLocal == null)
     {
         _Erro("MemLocal não encontrado", "_Referencias");
     }
     _memGlobal = GetNode <Memoria>("/root/MemGlobal");
     if (_memGlobal == null)
     {
         _Erro("MemGlobal não encontrado", "_Referencias");
     }
     _placar = GetNode <Placar>("Interface/Placar");
     if (_placar == null)
     {
         _Erro("Placar não encontrado", "_Referencias");
     }
     _relogio = GetNode <Relogio>("Relogio");
     if (_relogio == null)
     {
         _Erro("Relogio não encontrado", "_Referencias");
     }
     _msgTela = GetNode <MsgTela>("Interface/Tela/MsgTela");
     if (_msgTela == null)
     {
         _Erro("MsgTela não encontrado", "_Referencias");
     }
 }
예제 #6
0
        static void Main()
        {
            // Cria o relógio r1
            Relogio r1 = new Relogio();

            // Acerta o relógio com o horário 3:30:50
            r1.AcertarRelogio(3, 30, 50);

            // Mostra as posições dos ponteiros do relógio
            Console.WriteLine("Posição da hora: " + r1.ponteiroHora.posicao);
            Console.WriteLine("Posição do minuto: " + r1.ponteiroMinuto.posicao);
            Console.WriteLine("Posição do segundo: " + r1.ponteiroSegundo.posicao);

            // Mostra a hora, minuto e segundo do relógio, que devem ser 3, 30 e 50.
            int hora    = r1.LerHora();
            int minuto  = r1.LerMinuto();
            int segundo = r1.LerSegundo();

            Console.WriteLine("Hora: " + hora);
            Console.WriteLine("Minuto: " + minuto);
            Console.WriteLine("Segundo: " + segundo);

            // Cria o relógio r2
            Relogio r2 = new Relogio();

            // Acerta o relógio com o horário 22:00:00. O código transformará automaticamente para 10h
            r2.AcertarRelogio(22, 0, 0);

            // Lê a hora do relógio, que deve ser 10.
            Console.WriteLine("Hora do segundo relógio: " + r2.LerHora());
        }
예제 #7
0
 public GeradorDePagamento(LeilaoDaoFalso leilaoDao, Avaliador avaliador, PagamentoDao pagamentoDao, Relogio relogioSystema)
 {
     this.LeilaoDao      = leilaoDao;
     this.Avaliador      = avaliador;
     this.PagamentoDao   = pagamentoDao;
     this.RelogioSystema = relogioSystema;
 }
예제 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,URL,Descricao,Nome,Usuario, Senha")] Relogio relogio)
        {
            if (id != relogio.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(relogio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RelogioExists(relogio.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(relogio));
        }
예제 #9
0
 public GeradorDePagamento(LeilaoDaoFalso leilaoDao, Avaliador avaliador, PagamentoDao pagamentoDao)
 {
     this.LeilaoDao      = leilaoDao;
     this.Avaliador      = avaliador;
     this.PagamentoDao   = pagamentoDao;
     this.RelogioSystema = new RelogioDoSistema();
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Relogio relogio = db.Relogios.Find(id);

            db.Relogios.Remove(relogio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public GeradorDePagamento( LeilaoDaoFalso leilaoDao,Avaliador avaliador,PagamentoDao pagamentoDao,Relogio relogioSystema)
        {
            this.LeilaoDao = leilaoDao;
            this.Avaliador = avaliador;
            this.PagamentoDao = pagamentoDao;
            this.RelogioSystema = relogioSystema;

        }
예제 #12
0
        public void LancarRegistros(Relogio relogio, ICollection <Registro> registros)
        {
            //Cria o serviço, usando Injeção de Dependência.
            MarcacaoFrequenciaService marcacaoFrequenciaService =
                (MarcacaoFrequenciaService)ActivatorUtilities.CreateInstance(_provider, typeof(MarcacaoFrequenciaService));

            //Lança registro no SRH2
            marcacaoFrequenciaService.LancarRegistros(registros);
        }
예제 #13
0
    IEnumerator Dormir()
    {
        yield return(new WaitForSeconds(2));

        isDormindo = true;
        Personagem.UpRetard();
        Energia.Recuperar();
        Relogio.MudarPeriodo();
        yield break;
    }
 public ActionResult Edit([Bind(Include = "Id,Nome,Descricao,StatusPapel,Login,Senha,Ip")] Relogio relogio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(relogio).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(relogio));
 }
예제 #15
0
        public async Task <IActionResult> Create([Bind("Id,URL,Nome,Descricao,UltimaLeitura,UltimoSucess,UltimaFalha,Usuario,Senha")] Relogio relogio)
        {
            if (ModelState.IsValid)
            {
                _context.Add(relogio);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(relogio));
        }
        public ActionResult Create([Bind(Include = "Id,Nome,Descricao,StatusPapel,Login,Senha,Ip")] Relogio relogio)
        {
            if (ModelState.IsValid)
            {
                db.Relogios.Add(relogio);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(relogio));
        }
예제 #17
0
        static void Main(string[] args)
        {
            double  entrada = System.Convert.ToDouble(Console.ReadLine());
            Relogio R       = new Relogio(entrada);

            double xx = R.Hora;

            System.Console.WriteLine(xx);

            System.Console.ReadKey();
        }
예제 #18
0
    void Start()
    {
        gm = this;

        // LINHA DE COMANDO QUE ATIVA E DESATIVA OS SPRITES
        if (selecionarRelogio == SelecionarRelogio.tempo || selecionarRelogio == SelecionarRelogio.bonus || selecionarRelogio == SelecionarRelogio.congelado)
        {
            Tempo.SetActive(true);
            Bonus.SetActive(false);
            Congelado.SetActive(false);
        }
    }
예제 #19
0
        public ActionResult Create([Bind(Include = "Id,Nome,Descricao,Status,Login,Senha,Ip")] Relogio relogio)
        {
            if (ModelState.IsValid)
            {
                db.Relogios.Add(relogio);
                db.SaveChanges();
                var    PathArquivo = Path.Combine(Server.MapPath("~/Scripts/Phantom"));
                string arq         = System.IO.File.ReadAllText(PathArquivo + "/relogio.js")

                                     .Replace("#ip#", relogio.Ip)
                                     .Replace("#usuario#", relogio.Login)
                                     .Replace("#senha#", relogio.Senha);


                System.IO.File.WriteAllText(PathArquivo + "/Relogio" + relogio.Id + ".js",
                                            arq);

                System.IO.File.WriteAllText(PathArquivo + "/TestePhantom.js", arq);



                try
                {
                    Process          exeProcess = new Process();
                    ProcessStartInfo startInfo  = new ProcessStartInfo();
                    startInfo.UseShellExecute        = false;
                    startInfo.RedirectStandardOutput = true;
                    string FileName = PathArquivo + "\\relogio.js ";
                    startInfo.FileName   = "Phantomjs ";
                    startInfo.Arguments  = FileName;
                    exeProcess.StartInfo = startInfo;
                    exeProcess.Start();
                    var a = exeProcess.StandardOutput.ReadToEnd();
                    exeProcess.WaitForExit();
                }
                catch (HttpException ex)
                {
                    /*if (startInfo.Arguments != arq)
                     * {
                     *      bool v = !VerificaPhantom();
                     *
                     * }*/
                    throw ex;
                }

                return(RedirectToAction("Index"));
            }

            return(View(relogio));
        }
        // GET: Relogios/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Relogio relogio = db.Relogios.Find(id);

            if (relogio == null)
            {
                return(HttpNotFound());
            }
            return(View(relogio));
        }
예제 #21
0
        public void LeituraTest()
        {
            Relogio relogio = new Relogio();

            relogio.Nome    = "ABC";
            relogio.URL     = "http://10.6.9.7";
            relogio.Usuario = "primmesf";
            relogio.Senha   = "121314";
            IRelogioService relogioService = new RelogioHenry(null, null, null, null);
            var             registros      = relogioService.ObterRegistros(relogio, DateTime.Now.AddDays(-1), DateTime.Now);

            foreach (var r in registros)
            {
                Console.WriteLine(r.Marcacao);
            }
        }
예제 #22
0
        private async Task <bool> Login(Relogio relogio)
        {
            try
            {
                HttpResponseMessage response = await HttpClient.GetAsync(relogio.URL.ToString() + LoginURL(relogio.Usuario, relogio.Senha));

                response.EnsureSuccessStatusCode();
                if (response.Content.ReadAsStringAsync().Result.ToString().ToLower().Contains("incorretos"))
                {
                    return(false);
                }
                _logger.LogInformation("Loggin Realizado com sucesso no relógio: " + relogio.Nome);
                return(true);
            }catch (Exception e)
            {
                _logger.LogError(e, "Erro ao realizar login no relógio: " + relogio.Nome);
                return(false);;
            }
        }
예제 #23
0
    public void trabalhar()
    {
        if (turnosTotal > 0 && progresso != 100 && Energia.ObterEstado() > 0)
        {
            turnosCorridos++;
            progresso = (100 / turnosTotal) * turnosCorridos;
            escreverDados();
            Energia.Diminuir();
            Relogio.MudarPeriodo();

            if (turnosTotal - turnosCorridos == 0)
            {
                Dinheiro.Receber(valor);
                Personagem.isPagamento = true;
                Navegador.GerarNoticias("ProjetoEntregado", idProjeto);
                Desempenho.AddProjeto(idProjeto, progresso, true);
            }
        }
    }
예제 #24
0
        private static ICollection <Registro> CriarRegistrosDeTexto(Relogio relogio, String texto)
        {
            List <Registro> registros = new List <Registro>();

            foreach (var linha in texto.Replace("\r", "").Split("\n"))
            {
                if (linha.Length > 1)
                {
                    Registro novo   = new Registro();
                    var      termos = linha.Split("[");
                    novo.idMarcacaoRelogio = termos[0];
                    novo.Matricula         = termos[2];
                    novo.Marcacao          = DateTime.Parse(termos[3], (new CultureInfo("pt-BR")).DateTimeFormat);
                    novo.Relogio           = relogio;
                    novo.IdRelogio         = relogio.Id;
                    registros.Add(novo);
                }
            }
            return(registros);
        }
예제 #25
0
        private void FrmPrincipal_Shown(object sender, EventArgs e)
        {
            frmLogin log = new frmLogin();

            log.ShowDialog();



            if (log.funcLogado == null || log.funcLogado.Codigo == 0)
            {
                this.Close();
                return;
            }



            this.MouseDown += new MouseEventHandler(panelCabecalho_MouseDown);
            this.MouseMove += new MouseEventHandler(panelCabecalho_MouseMove);

            lblNomeUsuario.Text = log.funcLogado.Nome;
            Relogio.Start();
        }
예제 #26
0
        public async Task LerRelogioELancarAsync(Relogio relogio, DateTime Inicio, DateTime Fim, bool lancar = false)
        {
            //Função obtem registros e salva no banco.
            await this.ObterRegistrosAsync(relogio, Inicio, Fim);

            //Recupera registro do banco.
            var registrosParaEnvio = _context.Registros.Include(r => r.Relogio).AsNoTracking().Where(
                reg => reg.MigradoFrequencia == "F" &&
                reg.IdRelogio == relogio.Id &&
                reg.Marcacao >= Inicio &&
                reg.Marcacao <= Fim)
                                     .Select(reg => reg).ToList();

            if (lancar)
            {
                //Cria o serviço, usando Injeção de Dependência.
                MarcacaoFrequenciaService marcacaoFrequenciaService =
                    (MarcacaoFrequenciaService)ActivatorUtilities.CreateInstance(_provider, typeof(MarcacaoFrequenciaService));
                //Lança registro no SRH2
                marcacaoFrequenciaService.LancarRegistros(registrosParaEnvio);
            }
        }
예제 #27
0
        public async Task <ICollection <Registro> > ObterRegistrosAsync(Relogio relogio, DateTime Inicio, DateTime Fim)
        {
            try
            {
                relogio = _context.Relogios.Find(relogio.Id);
                relogio.UltimaLeitura = DateTime.Now;

                if (!(await Login(relogio)))
                {
                    throw new Exception("Não foi possível realizar login no relógio");
                }
                String urlNow = relogio.URL.ToString() + DownloadURL(Inicio, Fim);
                HttpResponseMessage response = await HttpClient.GetAsync(urlNow);

                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();

                var registros = CriarRegistrosDeTexto(relogio, responseBody);

                _logger.LogInformation($"Lido {registros.Count} registros do relógio {relogio.Nome}");
                VerificarRegistrosEAtualizarBanco(registros);
                relogio.UltimoSucesso = relogio.UltimaLeitura;
                _logger.LogInformation($"Marcações do relógio {relogio.Nome} lançadas com sucesso.");
                return(registros);
            }
            catch (Exception e)
            {
                relogio.UltimaFalha = relogio.UltimaLeitura;
                _logger.LogError(e, $"Erro ao realizar leitura do relógio {relogio.Nome}.");
                throw e;
            }
            finally
            {
                _context.SaveChanges();
            }
        }
예제 #28
0
        public void Setup()
        {
            AutoFake = new AutoFake();

            var configurationParams = new Dictionary <string, string>
            {
                { "MarvelComicsAPI:BaseURL", "http://gateway.marvel.com/v1/public/" },
                { "MarvelComicsAPI:PublicKey", "f72ecc981b3848b2d7ae9973d0454131" },
                { "MarvelComicsAPI:PrivateKey", "8614298176bdfa2ecff7a712cfdcb6e73bf1d4f9" },
            };

            config = new ConfigurationBuilder()
                     .AddInMemoryCollection(configurationParams)
                     .Build();

            AutoFake.Provide(config);

            AutoFake.Provide(new Configuracao(new Uri(config.GetSection("MarvelComicsAPI:BaseURL").Value), config.GetSection("MarvelComicsAPI:PublicKey").Value, config.GetSection("MarvelComicsAPI:PrivateKey").Value));

            relogio = A.Fake <Relogio>();
            A.CallTo(() => relogio.DataAtual).Returns(DateTime.Now);
            A.CallTo(() => relogio.ObterStringTicks()).Returns(DateTime.Now.Ticks.ToString());

            AutoFake.Provide(relogio);

            // o GetAsync precisa de uma resposta mockada do persogame
            // pra isso preciso cirar uma url no teste e mandar ela pro controller
            string ts        = relogio.ObterStringTicks();
            string publicKey = config.GetSection("MarvelComicsAPI:PublicKey").Value;
            string hash      = GerarHash(ts, publicKey, config.GetSection("MarvelComicsAPI:PrivateKey").Value);

            nome = "Captain America";

            url = config.GetSection("MarvelComicsAPI:BaseURL").Value +
                  $"characters?ts={ts}&apikey={publicKey}&hash={hash}&" +
                  $"name={Uri.EscapeUriString(nome)}";

            // temos que saber o objeto de retorno da api pra poder mockar o retorno do objeto fake na implementacao concreta
            var conteudo = new StringContent(JsonSerializer.Serialize(
                                                 new
            {
                data = new
                {
                    results = new List <dynamic> {
                        new {
                            name        = nome,
                            description = Faker.Random.Words(20),
                            thumbnail   = new { path = Faker.Internet.Url(), extension = Faker.Random.String(3) },
                            urls        = new List <dynamic> {
                                new { url = Faker.Internet.Url() }, new { url = Faker.Internet.Url() }
                            }
                        }
                    }
                }
            }
                                                 ));

            // a resposta vem como um objeto serializado
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = conteudo
            };

            A.CallTo(() => AutoFake.Resolve <IHttpClient>().GetAsync(new Uri(url))).Returns(response);

            service = AutoFake.Resolve <PersonagemService>();
        }
예제 #29
0
 public AgendaDao(ISession session, Relogio relogio)
 {
     this.session = session;
     this.relogio = relogio;
 }
예제 #30
0
 private void Start()
 {
     tempoFill = tempoTotal;
     instance  = this;
 }
예제 #31
0
 void Start()
 {
     anguloSegundo = 360 / 60;
     relogioScript = GameObject.FindWithTag("Timer").GetComponent <Relogio>();
 }
예제 #32
0
 private void Form1_Load(object sender, EventArgs e)
 {
     obj = new Relogio();
 }
예제 #33
0
 public AgendaDao(ISession session, Relogio relogio)
 {
     this.session = session;
     this.relogio = relogio;
 }