public string ViewSelectedReport(string reportId) { Report.Report lSelectedReport = _manager["Report"].Retrieve(reportId) as Report.Report; if (lSelectedReport == null) { return("Please select a report."); } return(lSelectedReport.View); }
private void OnCommencing(object sender, EventArgs e) { // determine any herd filtering herdFilters = new List <RuminantFilterGroup>(); IModel current = this; while (current.GetType() != typeof(ZoneCLEM)) { var filtergroup = current.Children.OfType <RuminantFilterGroup>().Cast <RuminantFilterGroup>(); if (filtergroup.Count() > 1) { Summary.WriteWarning(this, "Multiple ruminant filter groups have been supplied for [" + current.Name + "]" + Environment.NewLine + "Only the first filter group will be used."); } if (filtergroup.FirstOrDefault() != null) { herdFilters.Insert(0, filtergroup.FirstOrDefault()); } current = current.Parent as IModel; } // get full name for reporting current = this; string name = this.Name; while (current.GetType() != typeof(ZoneCLEM)) { string quoteName = (current.GetType() == typeof(ActivitiesHolder)) ? "[" + current.Name + "]":current.Name; name = quoteName + "." + name; current = current.Parent as IModel; } hSReport = new Report.Report(); hSReport.Name = this.Name + "Report"; hSReport.VariableNames = new string[] { "[Clock].Today as Date", name + ".ReportDetails" + ".Breed as Breed", name + ".ReportDetails" + ".Herd as Herd", name + ".ReportDetails" + ".Age as AgeGroup", name + ".ReportDetails" + ".Sex as Sex", name + ".ReportDetails" + ".Number as Num", name + ".ReportDetails" + ".AverageWeight as AvgWt", name + ".ReportDetails" + ".AverageWeightGain as AvgWtGn", name + ".ReportDetails" + ".AverageIntake as AvgIntake", name + ".ReportDetails" + ".AdultEquivalents as AE", name + ".ReportDetails" + ".NumberPregnant as NoPregnant", name + ".ReportDetails" + ".NumberOfBirths as Births" }; hSReport.EventNames = new string[] { name + ".OnReportItemGenerated" }; }
public override string Add(DbObject item) { Report.Report r = item as Report.Report; if (r == null) { throw new NullReferenceException("Not of type Report"); } if (_db.Create(item)) { return("Successfully added report."); } return("Duplication! Report already exists. ID:" + item.Id); }
public string CreateReport(string reportName, string periodStart, string periodEnd, ReportType rType) { ReportBuilder rBuild = new ReportBuilder(_manager); rBuild.Name = reportName; rBuild.Period(periodStart, periodEnd); rBuild.Type = rType; string lOutputMsg = rBuild.Prepare(); if (lOutputMsg == "Success") { Report.Report lReport = rBuild.Report; if (lReport != null) { lOutputMsg = _manager["Report"].Add(lReport); } } return(lOutputMsg); }
public void EnumResolver_Test(string type, ReportType expectedMapped) { var mapConfig = new MapperConfiguration(cfg => cfg.CreateMap <Report.Report, IReportConfiguration>(MemberList.Source) .ForMember(dest => dest.PrinterName, opt => opt.MapFrom(x => x.PrinterName)) .ForMember(dest => dest.Type, opt => opt.MapFrom <EnumResolver>()) .ForSourceMember(src => src.Configuration, opt => opt.DoNotValidate()) ); mapConfig.AssertConfigurationIsValid(); var mapper = new Mapper(mapConfig); var deserializedReport = new Report.Report { Id = new System.Guid(), Type = type, Name = "name", PrinterName = "printername" }; var mappedReportConfiguration = mapper.Map <Report.Report, IReportConfiguration>(deserializedReport); Assert.Equal(expectedMapped, mappedReportConfiguration.Type); }