コード例 #1
0
        /// <summary>
        /// Process raya report
        /// </summary>
        /// <param name="reportParams"></param>
        /// <returns></returns>
        public async Task <ReportResult> ProcessAsync(IReportParams reportParams)
        {
            //result
            var reportResult = new ReportResult();

            reportResult.ReportResultDetails = new List <ReportResultDetail>();

            //convert to RayaParams from Interface
            var localReportParams = reportParams as FonacotReportParams;

            try
            {
                //Process Raya Report
                var parameters = new Dictionary <string, object>
                {
                    { "@company", localReportParams.company },
                    { "@InstanceId", localReportParams.InstanceID },
                    { "@user", localReportParams.user },
                    { "@InitialYear", localReportParams.InitialFiscalYear },
                    { "@InitialMonth", localReportParams.InitialMonth },
                    { "@FinalYear", localReportParams.FinalFiscalYear },
                    { "@FinalMonth", localReportParams.FinalMonth },
                    { "@CreditStatus", localReportParams.CreditStatus },
                    { "@EmployeeStatus", localReportParams.EmployeeStatus },
                    { "@EmployeeFilter", localReportParams.EmployeeFilter }
                };


                //Execute SP
                DataSet ds = await base.ExecuteSPAsync(REPORT_SP_NAME, parameters);

                //Fill json results
                dynamic expando = new ExpandoObject();
                expando.Header    = base.GetObjectFromDataTable(ds, PAYROLLCONFIGURATION_POSITIONTABLE);
                expando.Employees = base.GetObjectFromDataTable(ds, FONACOT_EMPLOYEE_POSITIONTABLE);
                expando.Credits   = base.GetObjectFromDataTable(ds, FONACOT_CREDITS_POSITIONTABLE);

                //Expando
                var jResult = JsonConvert.SerializeObject(expando);
                reportResult.ReportResultDetails.Add(new ReportResultDetail(REPORT_SP_NAME, jResult));

                //Limpiamos el Dataset
                ds.Clear();
            }
            catch (Exception ex)
            {
                throw new CotorraException(201, "201", $"Ocurrió un error al generar el reporte de raya: {ex.Message}", ex);
            }


            return(await Task.FromResult(reportResult));
        }
コード例 #2
0
        private async Task <String> GetDataReport(IReportParams parameters, string typename)
        {
            ReportManager rportManager = new ReportManager();

            _dictionaryReportCatalog.TryGetValue(typename, out ReportCatalog reportCatalog);
            return((await rportManager.ProcessAsync(
                        new ReportManagerParams()
            {
                ReportCatalog = reportCatalog,
                ReportParams = parameters
            }))
                   .ReportResultDetails.FirstOrDefault().JsonResult);
        }
コード例 #3
0
ファイル: RayaReport.cs プロジェクト: CotorraProject/Cotorra
        /// <summary>
        /// Process raya report
        /// </summary>
        /// <param name="reportParams"></param>
        /// <returns></returns>
        public async Task <ReportResult> ProcessAsync(IReportParams reportParams)
        {
            //result
            var reportResult = new ReportResult();

            //convert to RayaParams from Interface
            var rayaReportParams = reportParams as RayaReportParams;

            try
            {
                //Process Raya Report
                var parameters = new Dictionary <string, object>();
                parameters.Add("@company", rayaReportParams.company);
                parameters.Add("@InstanceId", rayaReportParams.InstanceID);
                parameters.Add("@user", rayaReportParams.user);
                parameters.Add("@EmployerRegistrationID", rayaReportParams.EmployerRegistrationID);
                parameters.Add("@PeriodDetailID", rayaReportParams.PeriodDetailID);

                //Execute SP
                DataSet ds = await base.ExecuteSPAsync(REPORT_SP_NAME, parameters);

                //Fill json results
                dynamic expando = new ExpandoObject();
                expando.Header           = base.GetObjectFromDataTable(ds, PAYROLLCONFIGURATION_POSITIONTABLE);
                expando.Employees        = base.GetObjectFromDataTable(ds, RAYA_EMPLOYEE_POSITIONTABLE);
                expando.OverdraftDetails = base.GetObjectFromDataTable(ds, RAYA_DETAILS_OVERDRAFT_POSITIONTABLE);
                expando.ConceptGlobals   = base.GetObjectFromDataTable(ds, RAYA_DETAILS_CONCEPTGLOBALS_POSITIONTABLE);
                expando.IMSSDetails      = base.GetObjectFromDataTable(ds, RAYA_DETAILS_IMSS_POSITIONTABLE);

                //Expando
                var jResult = JsonConvert.SerializeObject(expando);
                reportResult.ReportResultDetails.Add(new ReportResultDetail(REPORT_SP_NAME, jResult));

                //Limpiamos el Dataset
                ds.Clear();
            }
            catch (Exception ex)
            {
                throw new CotorraException(201, "201", $"Ocurrió un error al generar el reporte de raya: {ex.Message}", ex);
            }

            return(reportResult);
        }