Exemple #1
0
        public ActionResult <string> Post([FromBody] PagamentoViewModel pagamento)
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory   = ServicoFactory.Create(isolationLevel);
            var            Pagamento = factory.getPagamento();

            IPagamentoDominio pagamentoDominio = new PagamentoViewModel();

            pagamentoDominio.Descricao      = pagamento.Descricao;
            pagamentoDominio.Email          = pagamento.Email;
            pagamentoDominio.FormaPagamento = pagamento.FormaPagamento;
            pagamentoDominio.Nome           = pagamento.Nome;
            pagamentoDominio.Status         = "AT";
            pagamentoDominio.Telefone       = pagamento.Telefone;

            foreach (var item in pagamento.PagamentoItemViewModels)
            {
                IPagamentoItemDominio pagamentoItem = new PagamentoItemViewModel();
                pagamentoItem.Quantidade       = item.Quantidade;
                pagamentoItem.Status           = "AT";
                pagamentoItem.ServicoDominioId = item.ServicoDominioId;
                pagamentoDominio.IPagamentoItemDominios.Add(pagamentoItem);
            }

            var pagamentoRetorno = Pagamento.Incluir(pagamentoDominio).Result;

            pagamentoRetorno.IPagamentoItemDominios = null;
            return(Ok(pagamentoRetorno));
        }
        public void TestMethod1()
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory   = ServicoFactory.Create(isolationLevel);
            var            Pagamento = factory.getPagamento();

            IPagamentoDominio pagamento = new PagamentoViewModel();

            pagamento.Descricao      = "Teste do celso segundo teste";
            pagamento.Email          = "*****@*****.**";
            pagamento.FormaPagamento = "CAT";
            pagamento.Nome           = "Celso Xavier Luz";
            pagamento.Status         = "AT";
            pagamento.Telefone       = "11951214906";

            IPagamentoItemDominio pagamentoItem = new PagamentoItemViewModel();

            pagamentoItem.Quantidade       = 4;
            pagamentoItem.Status           = "AT";
            pagamentoItem.ServicoDominioId = 1;
            pagamento.IPagamentoItemDominios.Add(pagamentoItem);
            pagamentoItem                  = new PagamentoItemViewModel();
            pagamentoItem.Quantidade       = 1;
            pagamentoItem.Status           = "AT";
            pagamentoItem.ServicoDominioId = 2;
            pagamento.IPagamentoItemDominios.Add(pagamentoItem);

            Pagamento.Incluir(pagamento);
        }
Exemple #3
0
        public async Task <ActionResult <IEnumerable <ITipoServicoDominio> > > Gets()
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract        tipoServico   = servicoFactory.getTipoServico();
            List <ITipoServicoDominio> tiposServicos = await tipoServico.GetsAsync();

            return(Json(tiposServicos.ToList()));
        }
Exemple #4
0
        public ActionResult <ITipoServicoDominio> Get(int Id)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract tipoServico   = servicoFactory.getTipoServico();
            ITipoServicoDominio tiposServicos = tipoServico.Get(Id);

            return(Ok(tiposServicos));
        }
Exemple #5
0
        public async Task <ActionResult <IEnumerable <ServicoViewModel> > > Gets(int tipoServicoId)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            ServicoAbstract        Servico  = servicoFactory.getServico();
            List <IServicoDominio> Servicos = await Servico.Gets(tipoServicoId);

            return(Json(Servicos.ToList().ConvertAll(new Converter <IServicoDominio, ServicoViewModel>(ServicoConfiguracao.converterIServicoDominioParaServicoViewModel))));
        }
Exemple #6
0
        public async Task <IActionResult> Create([FromBody] ServicoViewModel model)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            ServicoAbstract Servico        = servicoFactory.getServico();
            IServicoDominio servicoDominio = ServicoConfiguracao.converterServicoViewModelParaIServicoDominio(model);
            var             resultado      = await Servico.Incluir(servicoDominio);

            return(Json(resultado.Succeeded));
        }
        public void finalizarRotacao()
        {
            //Interlocked.Exchange(ref _cancellation, new CancellationTokenSource()).Cancel();
            var regraServico = ServicoFactory.create();

            if (regraServico is BannerServicoBLL)
            {
                ((BannerServicoBLL)regraServico).BannerAtual = null;
            }
            System.Diagnostics.Debug.WriteLine("Banner: Finalizando rotação...");
        }
Exemple #8
0
        public async Task <ActionResult <IEnumerable <ITipoServicoDominio> > > GetsAdmin()
        {
            string search   = Request.Form["search[value]"].ToString();
            string draw     = Request.Form["draw"].ToString();
            string order    = Request.Form["order[0][column]"].ToString();
            string orderDir = Request.Form["order[0][dir]"].ToString();
            int    startRec = Convert.ToInt32(Request.Form["start"].ToString());
            int    pageSize = Convert.ToInt32(Request.Form["length"].ToString());

            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract        tipoServico   = servicoFactory.getTipoServicoAdmin("ffffff");
            List <ITipoServicoDominio> tiposServicos = await tipoServico.Gets(startRec, search, pageSize);

            return(tiposServicos.ToList());
        }
        public void Incluir()
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory     = ServicoFactory.Create(isolationLevel);
            var            TipoServico = factory.getTipoServico();

            ITipoServicoDominio tipo = new TipoServicoViewModel();

            tipo.caminhoDaImage = "/teste/teste.jpg";
            tipo.Descricao      = "Teste do celso";
            tipo.Nome           = "Teste UNIT Inclusão";
            tipo.Status         = "AT";
            Task <TipoServicoAbstract> retorno = TipoServico.Incluir(tipo);
        }
Exemple #10
0
        /*
         * private async Task produtoAoCarregar(object sender, ProdutoListaEventArgs args)
         * {
         *  var regraProduto = ProdutoFactory.create();
         *  var produtos = new List<ProdutoInfo>();
         *  int i = 0;
         *  foreach (var produto in await regraProduto.listar(15)) {
         *      produtos.Add(produto);
         *      i++;
         *      if (i >= 10) {
         *          break;
         *      }
         *  }
         *  args.Produtos = produtos;
         *  return;
         * }
         */

        private static async void verificarSeguimento()
        {
            var seguimentoPage = await LojaUtils.gerarTelaInicial();

            //NavigationPage.SetHasNavigationBar(seguimentoPage, false);
            seguimentoPage.Appearing += (sender, e) => {
                PermissaoUtils.pedirPermissao();
                var regraServico = ServicoFactory.create();
                regraServico.inicializar();
            };
            App.Current.MainPage = gerarRootPage(seguimentoPage);

            /*
             * App.Current.MainPage = new IconNavigationPage(seguimentoPage)
             * {
             *  BarBackgroundColor = Estilo.Current.BarBackgroundColor,
             *  BarTextColor = Estilo.Current.BarTitleColor
             * };
             */
        }
        public void inicializarRotacao()
        {
            System.Diagnostics.Debug.WriteLine("Banner: Iniciando rotação...");
            var regraServico = ServicoFactory.create();

            if (regraServico is BannerServicoBLL)
            {
                ((BannerServicoBLL)regraServico).BannerAtual = this;
            }

            /**
             * //CancellationTokenSource cancelamento = _cancellation;
             * Device.StartTimer(TimeSpan.FromSeconds(3), () => {
             *  if (_cancellation.IsCancellationRequested) {
             *      return false;
             *  }
             *  if (ItemsSource == null || ItemsSource.GetCount() == 0) {
             *      return false;
             *  }
             *  var posicaoAtual = this.Position;
             *  posicaoAtual++;
             *  if (posicaoAtual >= ItemsSource.GetCount()) {
             *      posicaoAtual = 0;
             *  }
             *  Device.BeginInvokeOnMainThread(() => {
             *      this.Position = posicaoAtual;
             *      System.Diagnostics.Debug.WriteLine(
             *          string.Format(
             *              "Banner: {0}, Posição {1}",
             *              DateTime.Now.ToString("HH:mm:ss"),
             *              posicaoAtual
             *          )
             *      );
             *  });
             *  return true;
             * });
             */
        }