Ejemplo n.º 1
0
Archivo: Helpers.cs Proyecto: joyoon/mb
 public static IList<ReferenceEntity> GetAllReferences(string content, int reportId)
 {
     IList<ReferenceEntity> results = new List<ReferenceEntity>();
     if (content == null)
     {
         return results;
     }
     string pattern = "{(?!IMG-[0-9]*)[^}]+}";
     MatchCollection matches;
     Regex referenceRegex = new Regex(pattern);
     matches = referenceRegex.Matches(content);
     ARTService service = new ARTService();
     foreach (Match match in matches)
     {
         ReferenceEntity reference = service.GetReferenceByShortName(reportId, match.Value.Substring(1, match.Value.Length - 2));
         ReferenceComparer comparer = new ReferenceComparer();
         if (reference != null && reference.ReferenceId != 0 && !results.Contains(reference, comparer))
         {
             results.Add(reference);
         }
     }
     return results;
 }
Ejemplo n.º 2
0
 public ControllerBase()
 {
     Service = new ARTService();
     PublicService = new PublicBL();
 }
Ejemplo n.º 3
0
        public Dictionary<string, Object> FullReport(int reportId)
        {
            ARTService service = new ARTService();
            Dictionary<string, Object> dataSources = new Dictionary<string, Object>();

            dataSources.Add("TextBlockExecSummary", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.ExecSummary));
            dataSources.Add("TextBlockScope", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.Scope));
            dataSources.Add("TextBlockSpeciesOverview", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.SpeciesOverview));
            dataSources.Add("TextBlockProductionStatistics", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.ProductionStatistics));
            dataSources.Add("TextBlockImportance", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.ImportanceToMarket));
            dataSources.Add("TextBlockMarketNames", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.CommonMarketNames));

            dataSources.Add("OverallRec", OverallRec(reportId));

            dataSources.Add("Criteria1Grid", service.Criteria1ReportData(reportId));
            dataSources.Add("Criteria1Synthesis", service.SynthesisGet(reportId, 1));
            dataSources.Add("Criteria1", Criteria1All(reportId));

            dataSources.Add("Criteria2Grid", service.Criteria2ReportData(reportId));
            dataSources.Add("Criteria2Synthesis", service.SynthesisGet(reportId, 2));
            dataSources.Add("Criteria2", Criteria2All(reportId));

            dataSources.Add("Criteria3Grid", service.Criteria3ReportData(reportId));
            dataSources.Add("Criteria31Grid", service.Criteria31ReportData(reportId));
            dataSources.Add("Criteria32Grid", service.Criteria32ReportData(reportId));
            dataSources.Add("Criteria3Synthesis", service.SynthesisGet(reportId, 3));
            dataSources.Add("Criteria31Synthesis", service.SynthesisGet(reportId, 5));
            dataSources.Add("Criteria32Synthesis", service.SynthesisGet(reportId, 6));
            dataSources.Add("Criteria31", Criteria31All(reportId));
            dataSources.Add("Criteria32", Criteria32All(reportId));

            dataSources.Add("Criteria4Grid", service.Criteria4ReportData(reportId));
            dataSources.Add("Criteria4Synthesis", service.SynthesisGet(reportId, 4));
            dataSources.Add("Criteria4", Criteria4All(reportId));

            dataSources.Add("TextBlockAck", service.TextBlockGetDataTable(reportId, ARTService.TextBlock.Acknowledgements));
            dataSources.Add("References", References(reportId));

            dataSources.Add("AppendixAGrid", service.AppendixAReportData(reportId));

            List<int> reportAppendixIds = DB.GetList<int>(new SQLBuilder("select Id from ReportAppendix where ReportId = @0 order by Id", reportId.ToString()));

            for (int i = 0; i < reportAppendixIds.Count; i++)
            {
                //Add Appendix1 to AppendixN (currently capped at 7)
                dataSources.Add("Appendix" + (i+1).ToString(), service.AppendixGetDataTable(reportAppendixIds[i]));
            }

            return dataSources;
        }
Ejemplo n.º 4
0
Archivo: Helpers.cs Proyecto: joyoon/mb
        public static string ParseWithImages(string content, int reportId)
        {
            if (content == null)
            {
                return "";
            }
            string pattern = "{(IMG-[0-9]*)[^}]+}";
            MatchCollection matches;
            Regex referenceRegex = new Regex(pattern);
            matches = referenceRegex.Matches(content);
            string idPattern = "(?<=IMG-)[0-9]+";
            Regex idRegex = new Regex(idPattern);
            ARTService service = new ARTService();
            foreach (Match match in matches)
            {
                Match imageIdString = idRegex.Match(match.Value);
                int imageId = Convert.ToInt16(imageIdString.Value);
                ImageEntity image = service.ImageGet(reportId, imageId);
                string imageHtml = "<div class='image-container'><img src='/ConstrainImage.ashx?imgUrl=" + image.Path + "&mw=780&mh=500'/><p>" + image.Description + "</p></div>";

                content = content.Replace(match.Value, imageHtml);
            }
            return content;
        }
Ejemplo n.º 5
0
Archivo: Form1.cs Proyecto: joyoon/mb
        private void DoStuff()
        {
            //int? score;
            //score = null;
            //189 = Fisheries Training report
            //180 = Striped bass test report
            //227 = Santi Test 2
            int reportId = 208;

            //new ARTService().RecalcAllReports();
            new ARTService().RecalcSingleReport(reportId);

            ARTService service = new ARTService();

            Generator x = new Generator();
            //string str = x.CreateStream(reportId);
            x.CreateDoc(@"c:\temp\test.docx", reportId);
            this.Close();

            //service.ReferenceUpdate(189, -1, "Short Name", "", "", "", "", false);

            /*
            service.Criteria2Overview(reportId);

            IList<Criteria31Entity> a = new List<Criteria31Entity>();
            a = service.Criteria31Overview(reportId);

            IList<Criteria32Entity> b = new List<Criteria32Entity>();
            b = service.Criteria32Overview(reportId);

            IList<Criteria3Entity> c = new List<Criteria3Entity>();
            c = service.Criteria3Overview(reportId);

            IList<Criteria1Entity> w = new List<Criteria1Entity>();
            w = service.Criteria1Overview(reportId);

            IList<Criteria2Entity> x = new List<Criteria2Entity>();
            x = service.Criteria2Overview(reportId);

            IList<Criteria21Entity> y = new List<Criteria21Entity>();
            y = service.Criteria21Overview(reportId);

            IList<Criteria24Entity> z = new List<Criteria24Entity>();
            z = service.Criteria24Overview(reportId);
            */

            //ART.Reporting.OverallRec rpt = new Reporting.OverallRec();
            //rpt.DataSource = new ART.ReportSource().OverallRec(1);

            //ART.Reporting.Criteria1 rpt = new Reporting.Criteria1();
            //rpt.DataSource = new ReportSource().Criteria1(reportId)[2];

            //ART.Reporting.Criteria2 rpt = new Reporting.Criteria2();
            //rpt.DataSource = new ReportSource().Criteria2(reportId)[2];

            //ART.Reporting.Criteria2 rpt = new Reporting.Criteria2();
            //rpt.DataSource = new ReportSource().Criteria2All(reportId);

            //ART.Reporting.Criteria34 rpt = new Reporting.Criteria34();
            //rpt.DataSource = new ReportSource().Criteria31All(reportId);

            //ART.Reporting.Criteria1Grid rpt = new Reporting.Criteria1Grid();
            //rpt.DataSource = service.Criteria1ReportData(1);
            //rpt.Criteria1Synthesis = service.SynthesisGet(1, 1);

            //ART.Reporting.Criteria2Grid rpt = new Reporting.Criteria2Grid();
            //rpt.DataSource = service.Criteria2ReportData(reportId);
            //rpt.Criteria2Synthesis = service.SynthesisGet(reportId, 2);

            //ART.Reporting.Criteria3Grid rpt = new Reporting.Criteria3Grid();
            //rpt.DataSource = service.Criteria3ReportData(reportId);
            //rpt.DataSource31 = service.Criteria31ReportData(reportId);
            //rpt.DataSource32 = service.Criteria32ReportData(reportId);
            //rpt.Criteria3Synthesis = service.SynthesisGet(reportId, 3);

            //ART.Reporting.Criteria4Grid rpt = new Reporting.Criteria4Grid();
            //rpt.DataSource = service.Criteria4ReportData(180);
            //rpt.Criteria4Synthesis = service.SynthesisGet(180, 4);

            //ART.Reporting.AppendixAGrid rpt = new Reporting.AppendixAGrid();
            //rpt.DataSource = service.AppendixAReportData(1);

            //ART.Reporting.AppendixN rpt = new Reporting.AppendixN();
            //rpt.DataSource = service.AppendixGetDataTable(1, "B");

            //ART.Reporting.OverallRec rpt = new Reporting.OverallRec();
            //ART.Reporting.FinalRecGrid rpt = new Reporting.FinalRecGrid();
            //rpt.DataSource = new ART.ReportSource().OverallRec(reportId);

            //ART.Reporting.TextBlock rpt = new Reporting.TextBlock();
            //rpt.DataSource = service.TextBlockGetDataTable(reportId, ARTService.TextBlock.Scope);

            //ART.Reporting.References rpt = new Reporting.References();
            //rpt.DataSource = new ART.ReportSource().References(reportId);

            //ART.Reporting.FullReport rpt = new Reporting.FullReport();
            //rpt.DataSources = new ReportSource().FullReport(reportId);

            //rpt.Run();
            //this.viewer1.Document = rpt.Document;
        }