Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                RankBusiness   rankBusiness              = new RankBusiness();
                PilotoBusiness pilotoBusiness            = new PilotoBusiness();
                var            FORMATO_TEMPO_VOLTA       = "mm:ss.fff";
                var            FORMATO_VELOCIDADE_MEDIDA = "#.000";

                var arquivoRank = rankBusiness.Obter(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Rank.txt"));

                var pilotosDao = pilotoBusiness.Listar(arquivoRank);

                Console.WriteLine(string.Format("O campeão da corrida foi: {0}", pilotosDao.FirstOrDefault().Nome));
                Console.WriteLine("");

                int posicao = 1;
                foreach (var pilotoDao in pilotosDao)
                {
                    Console.WriteLine("Posição chegada: {0}, Código Piloto: {1}, Nome Piloto: {2}, Qtde Voltas Completadas: {3}, Tempo Total de Prova: {4}", posicao, pilotoDao.Codigo, pilotoDao.Nome, pilotoDao.Voltas, new DateTime(pilotoDao.TempoTotal).ToString(FORMATO_TEMPO_VOLTA));
                    Console.WriteLine(string.Format("Melhor volta do Piloto {0} foi: {1}", pilotoDao.Nome, new DateTime(pilotoDao.MelhorVolta.Ticks).ToString(FORMATO_TEMPO_VOLTA)));
                    Console.WriteLine(string.Format("Velocidade média do Piloto {0} foi: {1}", pilotoDao.Nome, pilotoDao.VelocidadeMedia.ToString(FORMATO_VELOCIDADE_MEDIDA)));
                    Console.WriteLine("");
                    posicao++;
                }

                Console.WriteLine("Melhor volta da corrida foi: {0}", new DateTime(pilotosDao.Min(x => x.MelhorVolta).Ticks).ToString(FORMATO_TEMPO_VOLTA));
                Console.Read();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public ActionResult Index()
        {
            var caminho = Server.MapPath("~") + "Arquivos\\rank.txt";
            var allLine = System.IO.File.ReadAllLines(caminho, System.Text.Encoding.Default);

            var result = RankBusiness.CalcularVoltas(allLine);

            ViewBag.MelhorVoltaCorrida = RankBusiness.Melhortempo(result);

            return(View(result));
        }
Exemple #3
0
 public BaseController() : base()
 {
     loginBusiness    = new LoginBusiness(this.GetContext());
     batchBusiness    = new BatchBusiness(this.GetContext());
     cardBusiness     = new CardBusiness(this.GetContext());
     requestBusiness  = new RequestBusiness(this.GetContext());
     newsBusiness     = new NewsBusiness(this.GetContext());
     cusBusiness      = new CustomerBusiness(this.GetContext());
     rankBusiness     = new RankBusiness(this.GetContext());
     configBusiness   = new ConfigBusiness(this.GetContext());
     pointBusiness    = new PointBusiness(this.GetContext());
     warrantyBusiness = new WarrantyBusiness(this.GetContext());
     statisticBus     = new StatisticBusiness(this.GetContext());
     orderBus         = new OrderBusiness(this.GetContext());
     userBusiness     = new UserBusiness(this.GetContext());
     itemBusiness     = new ItemBusiness(this.GetContext());
     productsBusiness = new ItemBusiness(this.GetContext());
     notifyBusiness   = new NotifyBusiness(this.GetContext());
     shopBusiness     = new ShopBusiness(this.GetContext());
     agentBusiness    = new AgentBusiness(this.GetContext());
     vnpay            = new VNPay(this.GetContext());
 }