コード例 #1
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Guardars the rol.
        /// </summary>
        public void GuardarRol()
        {
            try
            {
                DASeguridad dataAccess = new DASeguridad();
                // si Data.Rol.RoleId = string.Empty, es un rol nuevo, sino, existe y debo actualizar la descripción
                if (string.IsNullOrEmpty(Data.Rol.RoleId))
                {
                    if (!Roles.RoleExists(Data.Rol.Nombre))
                    {
                        Roles.CreateRole(Data.Rol.Nombre);

                        Data.Rol = dataAccess.GetRol(Data.Rol);
                    }
                    else
                    {
                        throw new CustomizedException(string.Format("El rol {1} ya existe.", Data.Rol.Nombre), null,
                                                     enuExceptionType.ValidationException);
                    }
                }
                dataAccess.UpdateRol(Data.Rol);
            }
            catch (CustomizedException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - GuardarRol", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }
コード例 #2
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
 /// <summary>
 /// Metodo que obtiene usuarios.
 /// </summary>
 public void GetUsuarios()
 {
     try
     {
         DASeguridad dataAcces = new DASeguridad();
         Data = dataAcces.GetUsuarios(Data, true);
     }
     catch (CustomizedException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new CustomizedException(string.Format("Fallo en {0} - GetUsuarios", ClassName), ex,
                                       enuExceptionType.BusinessLogicException);
     }
 }
コード例 #3
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// 
        /// </summary>
        public void GetUsuarioByEmail()
        {
            try
            {
                DASeguridad dataAcces = new DASeguridad();
                DTUsuario usuario = dataAcces.GetUsuarioByEmail(Data.Usuario.Email);
                if (usuario == null)
                    throw new CustomizedException(string.Format("El email {0} no se encuentra registrado.", Data.Usuario.Email), null,
                                                         enuExceptionType.ValidationException);
                Data.Usuario = usuario;

                ObtenerRolesUsuario();
            }
            catch (CustomizedException ex)
            { throw ex; }
            catch (Exception ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - GetUsuarioByEmail", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }
コード例 #4
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Método que crea los usuarios en forma masiva. 
        /// </summary>
        public void CrearUsuarios(DTSeguridad objDTSeguridad)
        {
            DASeguridad dataAcces = new DASeguridad();
            try
            {

                //Abre la transaccion que se va a utilizar
                //dataAcces.transaction.OpenTransaction();
                dataAcces.CrearUsuarios(objDTSeguridad);
                //Se da el OK para la transaccion.
                //dataAcces.transaction.CommitTransaction();
            }
            catch (CustomizedException ex)
            {
                //dataAcces.transaction.RollbackTransaction();
                throw ex;
            }
            catch (Exception ex)
            {
                //dataAcces.transaction.RollbackTransaction();
                throw new CustomizedException(string.Format("Fallo en {0} - CrearUsuarios()", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }
コード例 #5
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Método que crea un rol. 
        /// </summary>
        public void CrearRol()
        {
            try
            {
                //Inicia la transaccion.
                using (TransactionScope txScope = new TransactionScope())
                {
                    DASeguridad dataAcces = new DASeguridad();
                    if (Data.Rol.ID == 0)
                        dataAcces.CrearRol(Data);
                    //else
                    //    dataAcces.Update(Data);

                    //Completa la transaccion.
                    txScope.Complete();
                }
            }
            catch (CustomizedException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - CrearRol()", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }
コード例 #6
0
ファイル: BLSeguridad.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Validars the respuesta.
        /// </summary>
        public void ValidarRespuesta()
        {
            try
            {
                DASeguridad dataAcces = new DASeguridad();
                DTUsuario usuario = dataAcces.GetUsuarioByEmail(Data.Usuario.Email);

                if (!usuario.PaswordRespuesta.Equals(Data.Usuario.PaswordRespuesta))
                {
                    throw new MembershipPasswordException();
                }

            }
            catch (MembershipPasswordException ex)
            {
                throw new CustomizedException(string.Format("La respuesta proporcionada no es válida.", ClassName), ex,
                                              enuExceptionType.SecurityException);
            }
            catch (Exception ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - CambiarPassword", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }