Пример #1
0
 public Usuario AutenticarUsuario(Usuario usuario = null)
 {
     try
     {
         objeto = new LISTAOBJETOS();
         if (usuario == null)
         {
             return(objeto.RetornaObjeto(Procedure.SP_AUTENTICAR_USUARIO, new Usuario()
             {
                 Login = view.login.UserName, Senha = view.login.PassWordUser
             }));
         }
         else
         {
             return(objeto.RetornaObjeto(Procedure.SP_AUTENTICAR_USUARIO, new Usuario()
             {
                 Login = usuario.Login, Cpf = usuario.Cpf
             }));
         }
     }
     catch (Exception exAut)
     {
         throw new Exception("Erro ao tentar autenticar usuario\n" + exAut.Message);
     }
 }
Пример #2
0
        public int?Excluir(int _id)
        {
            int?ret = 0;

            try
            {
                objeto = new LISTAOBJETOS();
                crud   = new CRUD();
                ret    = crud.Executar(new Quarto()
                {
                    Id = _id
                }, Procedure.SP_DEL_QUARTO, Acao.Excluir);
                view.QuartoLeitos = objeto.ListaGenerica(Procedure.SP_GET_QUARTOS, new Quarto());

                if (ret.HasValue)
                {
                    ret = 2; // 2 é Codigo de exclusão de registro
                }
            }
            catch (SqlException exSqEx)
            {
                throw exSqEx;
            }
            catch (Exception exEx)
            {
                throw exEx;
            }

            return(ret);
        }
Пример #3
0
        public int?Salvar()
        {
            int?ret = null;

            try
            {
                crud   = new CRUD();
                objeto = new LISTAOBJETOS();

                if (quarto.Id == 0)
                {
                    ret = crud.Executar(new Quarto()
                    {
                        NomeQuarto = quarto.NomeQuarto
                    }, Procedure.SP_VALIDA_QUANRTO, Acao.Verificar);
                }

                if (!ret.HasValue)
                {
                    ret = crud.Executar(quarto, Procedure.SP_ADD_UPD_QUARTO, Acao.Inserir);
                    List <Quarto> quartos = objeto.ListaGenerica(Procedure.SP_GET_QUARTOS, new Quarto());

                    view.QuartoLeitos = quartos;
                }
                return(ret);
            }
            catch (Exception exSal)
            {
                throw exSal;
            }
        }
Пример #4
0
 public void Iniciar()
 {
     try
     {
         objeto    = new LISTAOBJETOS();
         view.Main = objeto.RetornaObjeto(Procedure.SP_VALIDA_CLIENTE, view.Main);
     }
     catch (Exception ExI)
     {
         throw ExI;
     }
 }
Пример #5
0
        public void Carregar(Quarto objetoQuarto = null)
        {
            try
            {
                if (null == objetoQuarto)
                {
                    objetoQuarto = new Quarto();
                }

                objeto            = new LISTAOBJETOS();
                view.Setores      = objeto.ListaGenerica(Procedure.SP_GET_SETOR, new Setor());
                view.QuartoLeitos = objeto.ListaGenerica(Procedure.SP_GET_QUARTOS_BYNAME, objetoQuarto);
            }
            catch (Exception exC)
            {
                throw exC;
            }
        }
Пример #6
0
        public void Carregar(Leito Obj = null)
        {
            try
            {
                if (null == Obj)
                {
                    Obj = new Leito();
                }

                objeto      = new LISTAOBJETOS();
                view.leitos = objeto.ListaGenerica(Procedure.SP_GET_LEITO, Obj);
                List <Quarto> lst = objeto.ListaGenerica(Procedure.SP_GET_QUARTOS, new Quarto());
                view.Quartos = lst;
            }
            catch (Exception exC)
            {
                throw exC;
            }
        }