예제 #1
0
        public HttpResponseMessage <TestResult> UpdateReportColumnOrder([FromBody] TestRequest batch)
        {
            int     columnOrder         = -1;
            int     originalColumnOrder = -1;
            IEntity entity = EntityNugget.DecodeEntity(batch.MyEntityData);

            try
            {
                var reportEntity         = ReadiNow.Model.Entity.As <Report>(entity);
                var originalReportEntity = ReadiNow.Model.Entity.Get <Report>(reportEntity.Id);
                originalColumnOrder = (originalReportEntity.ReportColumns != null && originalReportEntity.ReportColumns.Count > 0) ? originalReportEntity.ReportColumns.Last( ).ColumnDisplayOrder ?? -1 : -1;
                columnOrder         = (originalReportEntity.ReportColumns != null && originalReportEntity.ReportColumns.Count > 0) ? reportEntity.ReportColumns.Last( ).ColumnDisplayOrder ?? -1 : -1;
            }
            catch (Exception exc)
            {
                EventLog.Application.WriteError("Failed to update report column order. " + exc.Message);
            }

            var result = new TestResult
            {
                MyOtherData = batch.MyOtherData,
                Success     = columnOrder != originalColumnOrder
            };

            return(new HttpResponseMessage <TestResult>(result));
        }
예제 #2
0
        public HttpResponseMessage <TestResult> SummariseReportRootNode([FromBody] TestRequest batch)
        {
            string  rootNodeTypeAlias         = string.Empty;
            string  originalRootNodeTypeAlias = string.Empty;
            IEntity entity = EntityNugget.DecodeEntity(batch.MyEntityData);

            try
            {
                var reportEntity         = ReadiNow.Model.Entity.As <Report>(entity);
                var originalReportEntity = ReadiNow.Model.Entity.Get <Report>(reportEntity.Id);
                rootNodeTypeAlias         = reportEntity.RootNode.IsOfType[0].Alias;
                originalRootNodeTypeAlias = originalReportEntity.RootNode.IsOfType[0].Alias;
            }
            catch (Exception exc)
            {
                EventLog.Application.WriteError("Failed to Summarise Report Root Node. " + exc.Message);
            }

            var result = new TestResult
            {
                MyOtherData = batch.MyOtherData,
                Success     = rootNodeTypeAlias != originalRootNodeTypeAlias
            };

            return(new HttpResponseMessage <TestResult>(result));
        }
예제 #3
0
        public HttpResponseMessage <TestResult> UpdateReportRelatedNode([FromBody] TestRequest batch)
        {
            int     relatedReportCount         = -1;
            int     originalRelatedReportCount = -1;
            IEntity entity = EntityNugget.DecodeEntity(batch.MyEntityData);

            try
            {
                var reportEntity         = ReadiNow.Model.Entity.As <Report>(entity);
                var originalReportEntity = ReadiNow.Model.Entity.Get <Report>(reportEntity.Id);
                relatedReportCount         = (reportEntity.RootNode != null && reportEntity.RootNode.RelatedReportNodes != null) ? reportEntity.RootNode.RelatedReportNodes.Count : 0;
                originalRelatedReportCount = (originalReportEntity.RootNode != null && originalReportEntity.RootNode.RelatedReportNodes != null) ? originalReportEntity.RootNode.RelatedReportNodes.Count : 0;
            }
            catch (Exception exc)
            {
                EventLog.Application.WriteError("Failed to Update Report Related Node. " + exc.Message);
            }
            var result = new TestResult
            {
                MyOtherData = batch.MyOtherData,
                Success     = relatedReportCount != originalRelatedReportCount
            };

            return(new HttpResponseMessage <TestResult>(result));
        }
예제 #4
0
        public IHttpActionResult EvaluateExpressions([FromBody] CalcEngineEvalRequest request)
        {
            if (request == null)
            {
                throw new WebArgumentNullException(nameof(request), "Request is null");
            }

            if (request.ContextEntity == null)
            {
                throw new WebArgumentNullException(nameof(request), "ContextEntity is not specified.");
            }

            if (request.Expressions == null)
            {
                throw new WebArgumentNullException(nameof(request), "Expressions are not specified");
            }

            if (request.Expressions.Count == 0)
            {
                throw new WebArgumentException("Expressions are not specified", nameof(request));
            }

            using (Profiler.Measure("CalcEngineController.EvaluateExpressions"))
            {
                var contextEntity = EntityNugget.DecodeEntity(request.ContextEntity);
                if (contextEntity == null)
                {
                    throw new ArgumentNullException(nameof(request), @"ContextEntity does not exist.");
                }

                var response = _requestHandler.EvaluateExpressions(contextEntity, request.Expressions);

                return(Ok(response));
            }
        }
예제 #5
0
        public HttpResponseMessage <TestResult> Query([FromBody] TestRequest batch)
        {
            IEntity entity = EntityNugget.DecodeEntity(batch.MyEntityData);

            var result = new TestResult
            {
                MyOtherData = batch.MyOtherData,
                Success     = entity != null
            };

            return(new HttpResponseMessage <TestResult>(result));
        }
예제 #6
0
        public HttpResponseMessage <TestResult> ReportEntity([FromBody] TestRequest batch)
        {
            Report  reportEntity;
            IEntity entity = EntityNugget.DecodeEntity(batch.MyEntityData);

            try
            {
                reportEntity = ReadiNow.Model.Entity.As <Report>(entity);
            }
            catch
            {
                reportEntity = null;
            }
            var result = new TestResult
            {
                MyOtherData = batch.MyOtherData,
                Success     = reportEntity != null
            };

            return(new HttpResponseMessage <TestResult>(result));
        }