Ejemplo n.º 1
0
        private Dictionary <string, object> GetReportDataInternal(IssueDetailsPostModel postModel)
        {
            var request = new GetIssueReportDataRequest
            {
                CurrentUser = Core.AppContext.CurrentUser,
                IssueId     = postModel.IssueId,
                StartDate   = DateTime.UtcNow.AddDays(-30).Date,
                EndDate     = DateTime.UtcNow.Date
            };

            if (postModel.DateRange.IsNotNullOrEmpty())
            {
                string[] dates = postModel.DateRange.Split('|');

                DateTime startDate;
                DateTime endDate;

                if (DateTime.TryParse(dates[0], out startDate) && DateTime.TryParse(dates[1], out endDate))
                {
                    request.StartDate = startDate;
                    request.EndDate   = endDate;
                }
            }

            return(_getIssueReportDataQuery.Invoke(request).Data);
        }
Ejemplo n.º 2
0
        public ActionResult GetReportData(IssueDetailsPostModel postModel)
        {
            Dictionary <string, object> data;

            if (postModel.Token.IsNotNullOrEmpty())
            {
                string[] parts;
                var      organisation = GetOrganisationForPublicAccess(postModel.Token, out parts);

                if (organisation == null)
                {
                    ErrorNotification("Failed to resolve organisarion for public access");
                    return(new JsonErrorResult(redirect: Url.Home()));
                }

                using (Core.Session.SwitchOrg(organisation))
                {
                    data = GetReportDataInternal(postModel);
                }
            }
            else
            {
                data = GetReportDataInternal(postModel);
            }

            return(new PlainJsonNetResult(data, true));
        }