Ejemplo n.º 1
0
        public IReportBase GetIReportBaseMgr(string reportTemplateFolder, string template, IList <object> list)
        {
            IReportBase reportMgr = this.GetImplService(template);

            if (reportMgr != null)
            {
                reportMgr.FillValues(reportTemplateFolder, template, list);
            }

            return(reportMgr);
        }
Ejemplo n.º 2
0
        public IReportBase GetReport(ReportConditionData reportFilterData)
        {
            IReportBase report = null;

            switch (reportFilterData.ReportCode)
            {
            case ReportCodes.ReceivedRequestReport:
                report = new ReceivedRequestReport(reportFilterData);
                break;

            case ReportCodes.IssuedProtectionDocumentsReport:
                report = new IssuedProtectionDocumentsReport(reportFilterData);
                break;

            default:
                break;
            }

            return(report);
        }
Ejemplo n.º 3
0
        public virtual async Task <IResponseReport> GetListExportPdf(DynamicDictionary data_param, string reportType, string reportName, string sort_by, IReportBase report = null)
        {
            ReponseReport resp = new ReponseReport(false, string.Empty);

            try
            {
                IEnumerable <dynamic> items = null;
                int total = 0;
                DynamicDictionary           copy = (DynamicDictionary)data_param.Clone();
                Dictionary <string, object> officeInfo;
                string JsonData, JsonOfficeInfo;

                officeInfo = report.GetOfficeInfo();
                officeInfo.Add("current_user", SessionData.user_name);
                foreach (KeyValuePair <string, object> item in data_param)
                {
                    string k = item.Key;
                    object v = item.Value;
                    officeInfo.Add(k, v);
                }

                using (DbConnect con = new DbConnect())
                {
                    total = SearchRepo.GetSearchItemsCount(con, copy, -1, 1);

                    if (total > 0)
                    {
                        items = SearchRepo.GetSearchItems(con, data_param, -1, 1, sort_by);
                        IList <dynamic> list = (IList <dynamic>)items;
                        if (list == null)
                        {
                            resp.isData = false;
                        }
                    }
                }
                if (Errors.Count > 0)
                {
                    resp.message = "Grid filter data load failed.";
                    resp.PushErrors(Errors);
                }
                else
                {
                    resp.success = true;
                    if (total > 0 && items != null && items.Count() > 0)
                    {
                        JsonData = Newtonsoft.Json.JsonConvert.SerializeObject(items);
                        if (report == null)
                        {
                            report = GetReportObject();
                        }

                        JsonOfficeInfo = Newtonsoft.Json.JsonConvert.SerializeObject(officeInfo);

                        string reportTitle = data_param.GetValueAsString("reportTitle");
                        report.ReportData = "{\"items\":" + JsonData + ",\"info\":" + JsonOfficeInfo + ",\"title\":" + "\"" + reportTitle + "\"" + "}";

                        bool status = await report.GenerateReport(reportType, reportName);

                        if (status)
                        {
                            resp.success     = true;
                            resp.report_url  = report.GeneratedFileUrl;
                            resp.report_name = report.GeneratedFileName;
                        }
                        else
                        {
                            resp.message = report.Error;
                        }
                    }
                    else
                    {
                        resp.message = "Grid filter data not found as per search condition";
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(resp);
        }
Ejemplo n.º 4
0
        public void WriteToClient(string reportTemplateFolder, string template, IList <object> list, String fileName)
        {
            IReportBase iReportMgr = GetIReportBaseMgr(reportTemplateFolder, template, list);

            this.WriteToClient(fileName, iReportMgr.GetWorkbook());
        }