示例#1
0
        private ResultBM DeleteProfile(string code)
        {
            try
            {
                ProfileDAL profileDal = new ProfileDAL();

                log.AddLogInfo("Eliminando perfil", "Eliminando perfil " + code + ".", this);

                if (profileDal.CanDeleteProfile(code))
                {
                    profileDal.DeleteProfile(code);
                    log.AddLogInfo("Eliminando perfil", "Perfil elimnado exitosamente.", this);
                    return(new ResultBM(ResultBM.Type.OK, "Perfil eliminado"));
                }
                else
                {
                    log.AddLogWarn("Borrando perfil", "No se puede eliminar el permiso " + code + " porque está asignado a al menos un usuario.", this);
                    return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("PERMISSION_UNDELETEABLE_ERROR")));
                }
            }
            catch (Exception exception)
            {
                log.AddLogCritical("Recuperando perfil", exception.Message, this);
                return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception));
            }
        }