public IActionResult GetReport()
        {
            var report = Helpers.Dashboard.CreateTemplate();

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
 public IActionResult ViewerEvent()
 {
     return(StiNetCoreViewer.ViewerEventResult(this));
 }
        public async Task <IActionResult> GetReport()
        {
            CurrentUser cUser  = new CurrentUser(HttpContext, _configuration);
            var         report = new StiReport();
            ApplicationConfigurationViewModel appConfig = null;

            appConfig = await appConfigRepo.GetAppConfigByName("MRXPassword", "Y");

            // This is to load Admin Dashboard
            if (customAuthService.CheckPermission(cUser.UserId, "PRG53", "P1"))
            {
                if (appConfig != null && appConfig.AppConfigValue != null)
                {
                    var path = Path.Combine(_hostingEnvironment.WebRootPath, "reports/EmaintAnalystDashboard.mrx");
                    report.LoadEncryptedReport(path, appConfig.AppConfigValue);
                }
                else
                {
                    throw new CustomException("Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.", "Error", true, "Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.");
                }
            }
            // This is to load Client Dashboard
            else if (customAuthService.CheckPermission(cUser.UserId, "PRG54", "P1"))
            {
                if (appConfig != null && appConfig.AppConfigValue != null)
                {
                    var path = Path.Combine(_hostingEnvironment.WebRootPath, "reports/EmaintClientDashboard.mrx");
                    report.LoadEncryptedReport(path, appConfig.AppConfigValue);
                }
                else
                {
                    throw new CustomException("Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.", "Error", true, "Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.");
                }
            }
            // This is to load Warning MRX states, "Insufficient Privilege Please contact your Administrator"
            else
            {
                if (appConfig != null && appConfig.AppConfigValue != null)
                {
                    var path = Path.Combine(_hostingEnvironment.WebRootPath, "reports/UnauthorizedDashboard.mrt");
                    report.Load(path);
                    return(StiNetCoreViewer.GetReportResult(this, report));
                }
                else
                {
                    throw new CustomException("Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.", "Error", true, "Unable to Load Data, Please Contact Support!!!, Please provide a valid password to read the Report Template.");
                }
            }

            string newConnectionString = _configuration.GetConnectionString("SKF.Master");

            report.Dictionary.Databases.Clear();
            report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("C2Maintenance", newConnectionString));
            Stimulsoft.Report.Dashboard.StiCacheCleaner.Clean(report.Key);
            report.Key = StiKeyHelper.GenerateKey();
            //report.Dictionary.Variables["@ClientSiteId"].ValueObject = TempData["csId"];
            report.Dictionary.Variables["@UserId"].ValueObject     = cUser.UserId;
            report.Dictionary.Variables["@LanguageId"].ValueObject = TempData["lId"];

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        /// <summary>
        /// get affiliate sell for report
        /// </summary>
        /// <returns></returns>
        public ActionResult AffiliateSell()
        {
            try
            {
                var model = new SellReportDto();

                if (TempData["StartDate"] != null)
                {
                    model.StartDate = DateTime.Parse(TempData["StartDate"].ToString());
                }
                if (TempData["EndDate"] != null)
                {
                    model.EndDate = DateTime.Parse(TempData["EndDate"].ToString());
                }
                if (TempData["FilterType"] != null)
                {
                    model.FilterType = (FilterType)(TempData["FilterType"]);
                }
                if (TempData["SkipDate"] != null)
                {
                    model.SkipDate = (bool)(TempData["SkipDate"]);
                }

                StiReport stiReport = new StiReport();

                stiReport.Load(StiNetCoreHelper.MapPath(this, "wwwroot/Reports/AffiliateSellReport.mrt"));

                var affiliates = _uow.AffiliateRepo.Get(d => d.Email == UserExtention.GetUserMail(User)).FirstOrDefault();

                IEnumerable <Tb_Sell> sellRepo = null;
                switch (model.FilterType)
                {
                case FilterType.All:
                    sellRepo = !model.SkipDate ? _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code && d.CreateAt >= model.StartDate && d.CreateAt <= model.EndDate) : _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code);
                    break;

                case FilterType.OnlyRegister:
                    sellRepo = !model.SkipDate ? _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code && d.PayStatus == PayStatus.Registered && d.CreateAt >= model.StartDate && d.CreateAt <= model.EndDate) : _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code && d.PayStatus == PayStatus.Registered);
                    break;

                case FilterType.Sells:
                    sellRepo = !model.SkipDate ? _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code && d.PayStatus != PayStatus.Registered && d.CreateAt >= model.StartDate && d.CreateAt <= model.EndDate) : _uow.SellRepo.Get(d => d.AffiliateCode == affiliates.Code && d.PayStatus != PayStatus.Registered);
                    break;

                default:

                    break;
                }

                var sumSell = sellRepo.Sum(d => d.Price);

                stiReport["SumSell"] = sumSell.ToString("N0");

                stiReport.RegData("affiliateDT", sellRepo);

                return(StiNetCoreViewer.GetReportResult(this, stiReport));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Пример #5
0
        public IActionResult ExpRep()

        {
            return(StiNetCoreViewer.ExportReportResult(this));;
        }
Пример #6
0
        /* // сериалнизует вложенные объекты ReturnObject неполно
         * var json = Newtonsoft.Json.JsonConvert.SerializeObject(this.Data, new JsonSerializerSettings
         * {
         * DateFormatString = "dd.MM.yyyy HH:mm"
         * });
         * response.Write(json);
         */
        ///   var serializer = new JavaScriptSerializer();

        /*   var customConverters = new List<JavaScriptConverter>
         * {
         * new ExtendedJavaScriptConverter<DateTime>(),
         * new ExtendedJavaScriptConverter<DateTime?>()
         * };
         */

        public IActionResult Interaction()
        {
            return(StiNetCoreViewer.InteractionResult(this));
        }
Пример #7
0
        public IActionResult GetReport()
        {
            var reportPath = _hostingEnviroment.WebRootPath + "\\Reports\\SimpleList.mrt";

            return(StiNetCoreViewer.GetReportResult(this, reportPath));
        }