Esempio n. 1
0
        /// <summary>
        /// Obtem a configuração do totem caso não encontre adiciona.
        /// </summary>
        /// <param name="serial"></param>
        /// <returns></returns>
        public async Task <TotemConfig> Obter(string serial)
        {
            var totemConfig = _totemRepository.Obter(serial).Result;

            if (totemConfig == null)
            {
                /* Padrão para novos totem */
                var obj = new TotemConfig()
                {
                    Nome              = "Detran",
                    Codigo            = "99999",
                    EmpresaId         = 1,
                    FusoHorario       = 1,
                    Versao            = "0.2 Beta",
                    Contratante       = "Detran",
                    Estabelecimento   = "Detran",
                    Serial            = serial.Trim().ToUpper(),
                    InformativoH1     = "Consulte os débitos a pagar para a retirada do seu veículo",
                    InformativoH2     = "em até 10 vezes",
                    InformativoH3     = "",
                    LimiteInatividade = 10,
                    ChaveAcessoSinPag = "CHAVECDXEXPRESS2018",
                    Logotipo          = "logo-detran.png",
                    Logado            = false
                };

                var objTotemConfig = _totemRepository.Adicionar(obj);

                return(objTotemConfig);
            }

            return(totemConfig);
        }
Esempio n. 2
0
        public TotemConfig Adicionar(TotemConfig totemConfig)
        {
            _db.TotemConfig.Add(totemConfig);
            _db.SaveChanges();

            return(totemConfig);
        }
Esempio n. 3
0
        public TotemConfigDto(string hostingEnvironment, TotemConfig totem)
        {
            if (totem == null)
            {
                return;
            }


            Id                 = totem.Id;
            UsuarioId          = totem.UsuarioId;
            DataCadastro       = totem.DataCadastro;
            DataAlteracao      = totem.DataAlteracao;
            Nome               = totem.Nome;
            Codigo             = totem.Codigo;
            FusoHorario        = totem.FusoHorario;
            Versao             = totem.Versao;
            Contratante        = totem.Contratante;
            Estabelecimento    = totem.Estabelecimento;
            Serial             = totem.Serial;
            InformativoH1      = totem.InformativoH1;
            InformativoH2      = totem.InformativoH2;
            InformativoH3      = totem.InformativoH3;
            ProgressBarTextoH1 = totem.ProgressBarTextoH1;
            ProgressBarTextoH2 = totem.ProgressBarTextoH2;
            LimiteInatividade  = totem.LimiteInatividade;
            ChaveAcessoSinPag  = totem.ChaveAcessoSinPag;
            AtendeDetran       = totem.AtendeDetran;
            AtendePatios       = totem.AtendePatios;

            if (!string.IsNullOrEmpty(totem.Logotipo))
            {
                Logotipo = hostingEnvironment + "/resources/" + totem.Logotipo;
            }
            else
            {
                Logotipo = hostingEnvironment + "/resources/logo-detran.png";
            }

            Logado   = totem.Logado;
            Situacao = totem.Situacao;
            Retorno  = new Output()
            {
                Status = true
            };
        }
        public async Task <OkObjectResult> Get(string serial)
        {
            var resultado = new Retorno <TotemConfig>()
            {
                Status = ResultadoOperacao.Sucesso
            };

            string webRootPath     = _hostingEnvironment.WebRootPath;
            string contentRootPath = _hostingEnvironment.ContentRootPath;
            var    totem           = new TotemConfig();

            try
            {
                totem = _totemService.Obter(serial).Result;
                return(Ok(new TotemConfigDto(_hostingEnvironment.ContentRootPath, totem)));
            }
            catch (Exception)
            {
                return(Ok(totem));
            }
        }