Example #1
0
        public void Alterar(ModeloUsuario obj)
        {
            if (obj.UsuNome.Trim().Length == 0)
            {
                throw new Exception("O nome do usuário é obrigatório");
            }

            if (obj.UsuCpf.Trim().Length == 0)
            {
                throw new Exception("O CPF do usuário é obrigatório");
            }

            if (obj.UsuTipo.Trim().Length <= 0)
            {
                throw new Exception("O tipo de usuário é obrigatório");
            }

            if (obj.UsuStatus.Trim().Length <= 0)
            {
                throw new Exception("O status do usuário é obrigatório");
            }

            if (obj.UsuLogin.Trim().Length <= 0)
            {
                throw new Exception("O login do usuário é obrigatório");
            }

            if (obj.UsuSenha.Trim().Length <= 0)
            {
                throw new Exception("A senha do usuário é obrigatório");
            }

            DALUsuario DALobj = new DALUsuario(conexao);
            DALobj.Alterar(obj);
        }
Example #2
0
        //*********************
        private Correo correoOfertante(string tenant, Subasta subasta, Oferta oferta)
        {
            Correo correo = new Correo();

            try
            {
                System.Diagnostics.Debug.WriteLine("Entro correo ofertante DAL");

                _idal = new DALUsuario();
                Usuario vendedor  = _idal.GetUsuario(tenant, subasta.id_Vendedor);
                Usuario comprador = _idal.GetUsuario(tenant, (int)oferta.id_Usuario);

                correo.destinatario = comprador.email;
                correo.asunto       = "Felicidades " + comprador.nick + ". Has ofertado el articulo " + subasta.titulo;
                correo.mensaje      = "Articulo : " + subasta.titulo + "Valor oferta " + oferta.Monto.ToString() + " Fecha : " + DateTime.Now.ToString() + System.Environment.NewLine + " Sitio " + tenant + "chebay.com";

                System.Diagnostics.Debug.WriteLine("Salgo correoComprador DAL");
            }
            catch (Exception)
            {
                throw;
            }

            return(correo);
        }
Example #3
0
        private Correo correoUltimoOfertante(string tenant, Subasta subasta, Oferta oferta, int id_ultimo)
        {
            Correo correo = new Correo();

            try
            {
                System.Diagnostics.Debug.WriteLine("Entro correo ultimo ofertante DAL");

                _idal = new DALUsuario();
                Usuario vendedor  = _idal.GetUsuario(tenant, id_ultimo);
                Usuario comprador = _idal.GetUsuario(tenant, (int)oferta.id_Usuario);

                correo.destinatario = comprador.email;
                correo.asunto       = "Lo siento  " + comprador.nick + ". Tu oferta en el articulo " + subasta.titulo + " ha sido superada.";
                correo.mensaje      = "Articulo : " + subasta.titulo + "Nueva oferta " + oferta.Monto.ToString() + " Fecha : " + DateTime.Now.ToString() + System.Environment.NewLine + " Sitio " + tenant + "chebay.com";

                System.Diagnostics.Debug.WriteLine("Salgo ultimo ofertante DAL");
            }
            catch (Exception)
            {
                throw;
            }

            return(correo);
        }
Example #4
0
        public ClsCliente obtenerClientePorUsuario(string pUsuario)
        {
            ClsCliente oCliente    = new ClsCliente();
            ClsUsuario oUsuario    = new ClsUsuario();
            DALUsuario oDalUsuario = new DALUsuario();

            try
            {
                oUsuario = oDalUsuario.obtenerUsuarioPorNombreUsuario(pUsuario);

                var items = from d in contexto.Cliente
                            where d.idUsuario == oUsuario.idUsuario
                            select d;

                IEnumerator <Cliente> enu = items.GetEnumerator();
                while (enu.MoveNext())
                {
                    oCliente.idCliente = enu.Current.Id_Cliente;
                    oCliente.nombre    = oCliente.nombre;
                    oCliente.telefono  = oCliente.telefono;
                    oCliente.direccion = oCliente.direccion;
                    oCliente.mail      = oCliente.mail;
                    oCliente.idUsuario = oCliente.idUsuario;


                    //var items2 = from d in contexto.OpcionDePago
                    //            where d.idOpcionDePago == enu.Current.opcionDePago
                    //            select d;

                    //IEnumerator<OpcionDePago> enu2 = items2.GetEnumerator();
                    //while (enu2.MoveNext())
                    //{
                    //    OpcionDePago oOpcionDePago = new OpcionDePago();
                    //    oOpcionDePago = new OpcionDePago();
                    //    oOpcionDePago.idOpcionDePago = enu2.Current.idOpcionDePago;
                    //    oOpcionDePago.nombre = enu2.Current.nombre;
                    //    oCliente.opcionDePago = oOpcionDePago;
                    //}
                }
            }
            catch (Exception ex)
            {
                DalExcepcion oDExcepcion = new DalExcepcion(ex.InnerException.Message);
                throw oDExcepcion;
            }

            return(oCliente);
        }
Example #5
0
        public List <Bitacora> GetAll()
        {
            conexion.Open();
            List <Bitacora> bitacora = new List <Bitacora>();

            query = new SqlCommand("Select * From Bitacora", conexion);
            using (SqlDataReader reader = query.ExecuteReader())
            {
                DALUsuario dalUsuario = new DALUsuario();
                while (reader.Read())
                {
                    if (reader.HasRows)
                    {
                        bitacora.Add(new Bitacora(reader.GetDateTime(0), reader.GetString(1), (TipoMensaje)Enum.Parse(typeof(TipoMensaje), reader.GetString(2).ToString()), dalUsuario.Get(new Usuario(reader.GetString(3)))));
                    }
                }
            }
            conexion.Close();
            return(bitacora);
        }
Example #6
0
        public List <Bitacora> BuscarFecha(string filtro)
        {
            conexion.Open();
            List <Bitacora> bitacora = new List <Bitacora>();

            filtro += "%";
            query   = new SqlCommand($"SELECT * FROM Bitacora WHERE CONVERT(VARCHAR(25), Fecha, 121) LIKE @filtro", conexion);
            query.Parameters.AddWithValue("filtro", filtro);
            using (SqlDataReader reader = query.ExecuteReader())
            {
                DALUsuario dalUsuario = new DALUsuario();
                while (reader.Read())
                {
                    if (reader.HasRows)
                    {
                        bitacora.Add(new Bitacora(reader.GetDateTime(0), reader.GetString(1), (TipoMensaje)Enum.Parse(typeof(TipoMensaje), reader.GetString(2).ToString()), dalUsuario.Get(new Usuario(reader.GetString(3)))));
                    }
                }
            }
            conexion.Close();
            return(bitacora);
        }
Example #7
0
        public List <Bitacora> BuscarNombreUsuario(string filtro)
        {
            conexion.Open();
            List <Bitacora> bitacora = new List <Bitacora>();

            filtro += "%";
            query   = new SqlCommand($"Select * From Bitacora where NombreUsuario like @filtro", conexion);
            query.Parameters.AddWithValue("filtro", filtro);
            using (SqlDataReader reader = query.ExecuteReader())
            {
                DALUsuario dalUsuario = new DALUsuario();
                while (reader.Read())
                {
                    if (reader.HasRows)
                    {
                        bitacora.Add(new Bitacora(reader.GetDateTime(0), reader.GetString(1), (TipoMensaje)Enum.Parse(typeof(TipoMensaje), reader.GetString(2).ToString()), dalUsuario.Get(new Usuario(reader.GetString(3)))));
                    }
                }
            }
            conexion.Close();
            return(bitacora);
        }
Example #8
0
 public void Excluir(int codigo)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
     DALobj.Excluir(codigo);
 }
Example #9
0
 public ModeloUsuario CarregaModeloUsuario(int codigo)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
     return DALobj.CarregaModeloUsuario(codigo);
 }
Example #10
0
 public Boolean AutenticarUsuario(ModeloUsuario obj)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
        return DALobj.AutenticarUsuario(obj);
 }
Example #11
0
 public Boolean AlterarSenha(ModeloUsuario obj)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
     return DALobj.AlterarSenha(obj);
 }
Example #12
0
 public Boolean VerificarCPFLogin(ModeloUsuario obj)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
     return DALobj.VerificarCPFLogin(obj);
 }
Example #13
0
 public DataTable Localizar(String valor)
 {
     DALUsuario DALobj = new DALUsuario(conexao);
     return DALobj.Localizar(valor);
 }
Example #14
0
 public BLLUsuario()
 {
     dal = new DALUsuario();
 }
 public BLLInstituicao()
 {
     dal = new DALUsuario();
 }
Example #16
0
 public BLLVoluntario()
 {
     dal = new DALUsuario();
 }