Ejemplo n.º 1
0
        // GET: Servico
        public ActionResult Index(string tipo)
        {
            List <ServicoModel>     listModel = sv.List(UsuarioLogado.IdEmpresa).ToList();
            List <ServicoViewModel> listView  = new List <ServicoViewModel>();

            switch (tipo)
            {
            case "Ativos":
                listModel      = listModel.Where(i => i.Deletado == false).ToList();
                ViewBag.Filtro = "Ativos";

                break;

            case "Inativos":
                listModel      = listModel.Where(i => i.Deletado == true).ToList();
                ViewBag.Filtro = "Inativos";

                break;

            case "Todos":
                listModel      = listModel.ToList();
                ViewBag.Filtro = "Todos";

                break;

            default:
                listModel      = listModel.Where(i => i.Deletado == false).ToList();
                ViewBag.Filtro = "Ativos";

                break;
            }

            listModel.ForEach(x => listView.Add(_mapp.Map <ServicoViewModel>(x)));

            return(View(listView));
        }
        public void Funcionario_CadastroQuandoFuncionarioValido()
        {
            //-- Arrange
            ServicoModel s = svServico.List(_empresa.Id).FirstOrDefault();

            //-- Action
            Guid guid = Guid.NewGuid();

            sv.Cadastrar(_empresa.Id, "Leonardo", new DateTime(1994, 5, 7), "(11) 4555-1463", "(11) 97164-5267", "*****@*****.**", "M", new long[] { s.Id });

            //-- Asserts
            FuncionarioModel f = sv.Find(_empresa.Id, "Leonardo");

            Assert.IsNotNull(f);
            Assert.AreEqual("Leonardo", f.Nome);
            Assert.AreEqual("(11) 4555-1463", f.Telefone);
            Assert.AreEqual("(11) 97164-5267", f.Celular);
            Assert.AreEqual("*****@*****.**", f.Email);
            Assert.AreEqual("M", f.Sexo);
            //Assert.IsNotNull(f.Servicos);
            //Assert.IsNotNull(f.Servicos.Where(x => x.Id == s.Id).FirstOrDefault());
        }
Ejemplo n.º 3
0
 public void Servico_ListarTodos_Success()
 {
     //-- Assert
     Assert.IsNotNull(sv.List(_empresa.Id));
 }
        public void CleanUp()
        {
            if (AtendimentosCadastrados.IsNotNull())
            {
                foreach (AtendimentoModel at in AtendimentosCadastrados)
                {
                    AtendimentoModel a = sv.Find(at.IdCliente, at.IdServico, at.IdFuncionario, at.DataHora);
                    if (a.IsNotNull())
                    {
                        repoAtendimento.Delete(a.Id);
                    }
                }

                IEnumerable <FuncionarioModel> funcs = svFuncionario.List(_empresa.Id);
                if (funcs.IsNotNull())
                {
                    foreach (FuncionarioModel f in funcs)
                    {
                        if (f.IsNotNull())
                        {
                            repoFuncionario.Delete(f.Id);
                        }
                    }
                }

                IEnumerable <ClienteModel> clis = svCliente.List(_empresa.Id);
                if (clis.IsNotNull())
                {
                    foreach (ClienteModel c in clis)
                    {
                        if (c.IsNotNull())
                        {
                            repoCliente.Delete(c.Id);
                        }
                    }
                }

                IEnumerable <OrigemModel> oris = svOrigem.List(_empresa.Id);
                if (oris.IsNotNull())
                {
                    foreach (OrigemModel o in oris)
                    {
                        if (o.IsNotNull())
                        {
                            repoOrigem.Delete(o.Id);
                        }
                    }
                }

                IEnumerable <ServicoModel> servs = svServico.List(_empresa.Id);
                if (servs.IsNotNull())
                {
                    foreach (ServicoModel s in servs)
                    {
                        if (s.IsNotNull())
                        {
                            repoServico.Delete(s.Id);
                        }
                    }
                }
            }

            DeleteEmpresa();
        }
Ejemplo n.º 5
0
        public void SetupInicial(long idEmpresa)
        {
            try
            {
                try
                {
                    // Origem
                    _origemDomainServices.Cadastrar(idEmpresa, "Panfletagem");
                    _origemDomainServices.Cadastrar(idEmpresa, "Outdoors");
                }
                catch (DomainException dEx)
                {
                    Logger.Log.Warn(dEx);
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex);
                    throw;
                }

                try
                {
                    // Serviço
                    _servicoDomainServices.Cadastrar(idEmpresa, "Corte Feminino", 30, false);
                }
                catch (DomainException dEx)
                {
                    Logger.Log.Warn(dEx);
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex);
                    throw;
                }

                try
                {
                    // Produto
                    _produtoDomainServices.Cadastrar(idEmpresa, "Creme hidratante", 20);
                }
                catch (DomainException dEx)
                {
                    Logger.Log.Warn(dEx);
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex);
                    throw;
                }

                try
                {
                    // Cliente
                    long idOrigem = 0;
                    IEnumerable <OrigemModel> origens = _origemDomainServices.List(idEmpresa);
                    if (origens.IsNotNull() && origens.Count() > 0)
                    {
                        idOrigem = origens.FirstOrDefault().Id;
                    }

                    _clienteDomainServices.Cadastrar(idEmpresa, "Renata (Exemplo)", new DateTime(1991, 02, 05), null, "(11) 97164-5264", "*****@*****.**", "F", idOrigem);
                }
                catch (DomainException dEx)
                {
                    Logger.Log.Warn(dEx);
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex);
                    throw;
                }

                try
                {
                    // Funcionário
                    long idServico = 0;
                    IEnumerable <ServicoModel> origens = _servicoDomainServices.List(idEmpresa);
                    if (origens.IsNotNull() && origens.Count() > 0)
                    {
                        idServico = origens.FirstOrDefault().Id;
                    }

                    _funcionarioDomainServices.Cadastrar(idEmpresa, "Gustavo (Exemplo)", new DateTime(1985, 02, 05), "(11) 4665-5849", null, "*****@*****.**", "F", new long[] { idServico });
                }
                catch (DomainException dEx)
                {
                    Logger.Log.Warn(dEx);
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex);
                    throw;
                }
            }
            catch (DomainException)
            {
                //Logger.Log.Warn(dEx);
            }
            catch (Exception)
            {
                //Logger.Log.Error(ex);
            }
        }