Пример #1
0
        /// <summary>
        ///  save's the userquery using userId and companyId
        /// </summary>
        /// <param name="queryBuilderRequest"></param>
        /// <param name="context"></param>
        /// <returns>QueryResponse</returns>
        public QueryResponse SaveQuery(QueryBuilderRequest queryBuilderRequest, ILambdaContext context = null)
        {
            QueryRepository queryRepository = new QueryRepository();
            QueryResponse   queryResponse   = new QueryResponse();
            Authorizer      authorizer      = new Authorizer();

            try
            {
                if (authorizer.ValidateUser(queryBuilderRequest.UserId, queryBuilderRequest.CompanyId))
                {
                    return(queryRepository.SaveQuery(queryBuilderRequest));
                }
                else
                {
                    queryResponse.Error = ResponseBuilder.Forbidden();
                    return(queryResponse);
                }
            }
            catch (Exception saveQueryException)
            {
                LambdaLogger.Log(saveQueryException.ToString());
                queryResponse.Error = ResponseBuilder.InternalError();
                return(queryResponse);
            }
        }
Пример #2
0
        public void SaveQuery(string queryId, string sql)
        {
            var queryRepository = new QueryRepository(_dbConnectionString);

            queryRepository.SaveQuery(queryId, sql);
        }
Пример #3
0
        public void SaveQuery(O2CV1QueryDto queryDto)
        {
            var queryRepository = new QueryRepository(_dbConnectionString);

            queryRepository.SaveQuery(queryDto);
        }