Exemple #1
0
        public List <TemplateReport> GetTemplateReportList(int ProductModuleID)
        {
            List <TemplateReport>     TemplateReports = new List <TemplateReport>();
            IEnumerable <IDataRecord> records         = _dbWrapper.QueryDataRecord(cmd =>
            {
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = SqlConstants.READ_REPORT_TEMPLATE_LIST;
                DatabaseWrapperHelper.AddInStringParameter(cmd, "INSTITUTION_ID", _context.Identity.InstitutionId);
                DatabaseWrapperHelper.AddInIntParameter(cmd, "PRODUCTMODULE_ID", ProductModuleID.ToString());
            }, _context.Identity.InstitutionId);

            foreach (var row in records)
            {
                TemplateReport TemplateReport = new TemplateReport();

                //SELECT WRT.REPORT_TEMPLATE_ID,WRTR.REPORT_ID ,WRTR.REPORT_TYPE_ID, WRTR.INCLUDE_YN,WRTR.DISPLAY_OPTION



                TemplateReport.ReportId      = row["REPORT_ID"] is DBNull ? 0 : Convert.ToInt32(row["REPORT_ID"]);
                TemplateReport.TemplateId    = row["REPORT_TEMPLATE_ID"] is DBNull ? 0 : Convert.ToInt32(row["REPORT_TEMPLATE_ID"]);
                TemplateReport.TypeId        = row["REPORT_TYPE_ID"] is DBNull ? 0 : Convert.ToInt32(row["REPORT_TYPE_ID"]);
                TemplateReport.IncludedYN    = row["INCLUDE_YN"].ToString();
                TemplateReport.DisplayOption = row["DISPLAY_OPTION"].ToString();
                TemplateReports.Add(TemplateReport);
            }

            return(TemplateReports);
        }
        public override void Setup(CommandLineApplication command)
        {
            base.Setup(command);

            var optionReportJsonPath = command.Option <string>(
                "-rp|--jsonReportPath",
                "path to where the json report should be written",
                CommandOptionType.SingleValue);

            var optionCacheFolderPath = command.Option <string>(
                "-cf|--cacheFolderPath",
                $"directory path to where the local cache will be. Default path: '{_remoteFile.CacheFolderpath}'",
                CommandOptionType.SingleValue);

            //default: 'template','templates', 'ServiceStack.Core.Templates', 'BlackFox.DotnetNew.FSharpTemplates','libyear','libyear',
            //'angular-cli.dotnet','Carna.ProjectTemplates','SerialSeb.Templates.ClassLibrary','Pioneer.Console.Boilerplate'
            var optionSearchTerms = command.Option <string>(
                "-st|--searchTerm",
                "term to search on nuget. This option may be provided multiple times. If not provided the default set of values will be used.",
                CommandOptionType.MultipleValue);

            // optionSearchTerms.IsRequired(allowEmptyStrings: false, errorMessage: "you must specify a search term with -st|--searchTerm");

            OnExecute = () => {
                EnableVerboseOption = OptionVerbose.HasValue();

                var report = new TemplateReport(_nugetHelper, _httpClient, _nugetPkgDownloader, _remoteFile);

                var searchTerms = GetDefaultSearchTerms();
                if (optionSearchTerms.HasValue())
                {
                    searchTerms = optionSearchTerms.Values.ToArray();
                }

                var templateReportPath = Path.Combine(Directory.GetCurrentDirectory(), "template-report.json");
                if (optionReportJsonPath.HasValue())
                {
                    templateReportPath = optionReportJsonPath.Value();
                }

                report.GenerateTemplateJsonReportAsync(searchTerms, templateReportPath).Wait();

                return(1);
            };
        }
        public override void Setup(CommandLineApplication command)
        {
            base.Setup(command);

            DateTime startTime = DateTime.Now;

            Console.WriteLine("Starting at {0}", startTime.ToString("MM.dd.yy-H.m.s.ffff"));
            var optionReportJsonPath = command.Option <string>(
                "-rp|--jsonReportPath",
                "path to where the json report should be written",
                CommandOptionType.SingleValue);

            var optionCacheFolderPath = command.Option <string>(
                "-cf|--cacheFolderPath",
                $"directory path to where the local cache will be. Default path: '{_remoteFile.CacheFolderpath}'",
                CommandOptionType.SingleValue);

            //default: 'template','templates', 'ServiceStack.Core.Templates', 'BlackFox.DotnetNew.FSharpTemplates','libyear','libyear',
            //'angular-cli.dotnet','Carna.ProjectTemplates','SerialSeb.Templates.ClassLibrary','Pioneer.Console.Boilerplate'
            var optionSearchTerms = command.Option <string>(
                "-st|--searchTerm",
                "term to search on nuget. This option may be provided multiple times. If not provided the default set of values will be used.",
                CommandOptionType.MultipleValue);

            var optionPreviousReportPath = command.Option <string>(
                "-lr|--lastReport",
                "path to the last template-report.json file",
                CommandOptionType.SingleValue);

            var optionSpecificPackagesToInclude = command.Option <string>(
                "-p|--packageToInclude",
                "list of specific packages that should be included.",
                CommandOptionType.MultipleValue);

            OnExecute = () => {
                EnableVerboseOption = OptionVerbose.HasValue();

                var report = new TemplateReport(_nugetHelper, _httpClient, _nugetPkgDownloader, _remoteFile, _reporter);

                var searchTerms = optionSearchTerms.HasValue() ? optionSearchTerms.Values.ToArray() : GetDefaultSearchTerms();

                var templateReportPath = optionReportJsonPath.HasValue() ?
                                         optionReportJsonPath.Value() :
                                         Path.Combine(Directory.GetCurrentDirectory(), "template-report.json");

                var specificPackages = new List <string>();
                if (optionSpecificPackagesToInclude.HasValue())
                {
                    specificPackages.AddRange(optionSpecificPackagesToInclude.Values.ToArray());
                }

                string previousReportPath = optionPreviousReportPath.HasValue() ? optionPreviousReportPath.Value() : null;

                report.GenerateTemplateJsonReportAsync(searchTerms, templateReportPath, specificPackages, previousReportPath).Wait();

                DateTime finishTime = DateTime.Now;
                TimeSpan timespent  = finishTime.Subtract(startTime);
                Console.WriteLine("Finished at {0}\nTime taken (sec):{1}", finishTime.ToString("MM.dd.yy-H.m.s.ffff"), timespent.TotalSeconds);

                return(1);
            };
        }