private void LoadReportQueriesCompleted(LoadOperation <ReportCategory> lo) { var ReportCategories = new ObservableCollection <ReportCategory>(lo.Entities); var dialog = SimpleServiceLocator.Instance.Get <IModalWindow>("PublishToUcbDialog"); this.modalDialogService = SimpleServiceLocator.Instance.Get <IModalDialogService>(); this.modalDialogService.ShowDialog(dialog, new PublishToUcbViewModel(ReportCategories, SelectedReport != null ? SelectedReport.Name : null, SelectedReport != null ? SelectedReport.Description : null), returnedViewModelInstance => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { StandardReport spToPublish = new StandardReport(); spToPublish.IsExportable = returnedViewModelInstance.IsExportAllowed; spToPublish.IsPrintable = returnedViewModelInstance.IsPrintAllowed; spToPublish.ReportCategoryCode = returnedViewModelInstance.SelectedCategory.Code; spToPublish.ReportToPublishCode = selectedReport.Code; spToPublish.ReportName = returnedViewModelInstance.Name; spToPublish.ReportDescription = returnedViewModelInstance.Description; spToPublish.Code = Guid.NewGuid(); IsPublishing = true; IsSubmittingContext = true; myContext.StandardReports.Add(spToPublish); myContext.SubmitChanges(ReportPublishedCallback, spToPublish); } }); }
/// <summary> /// Gets the report by id. /// </summary> /// <param name="id">The id.</param> /// <param name="parameter">The parameter.</param> /// <returns></returns> public BaseReport GetReportById(int reportId, ReportParameter parameter) { if (reportId > 0) { var standardReport = new StandardReport(reportId) { ResultDataTable = StandardReportRepository.GetReportById(reportId, parameter), Columns = StandardReportRepository.GetReportColumns(reportId).ToList(), ExtraHeaderCollection = StandardReportRepository.GetExtraHeaderById(reportId).ToList() }; if (parameter.Unit != null && parameter.Unit != ConstValues.Unit_100M) { foreach (var c in standardReport.Columns) { if (c.ColumnType == null || !c.ColumnType.Equals("decimal")) { continue; } foreach (var r in standardReport.ResultDataTable.AsEnumerable()) { if (r[c.ColumnName] != null && r[c.ColumnName].GetType() != typeof(DBNull)) { r[c.ColumnName] = Convert.ToDecimal(SwitchAmountUnit(parameter.Unit, Convert.ToDouble(r[c.ColumnName]))); } } } } return(standardReport); } return(new StandardReport(reportId)); }
public static void _Main() { Simulation simulation = new Simulation(new TheModel()); StandardReport.PrintReport(simulation); Console.WriteLine(); }
private void ReportPublishedCallback(SubmitOperation so) { StandardReport spToPublish = so.UserState as StandardReport; //DeleteFolderCommand.UpdateCanExecuteCommand(); IsPublishing = false; IsSubmittingContext = false; }
public void GenerateAndShow() { var reportModel = DataSource.GetReport(); var report = new StandardReport(reportModel); var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.pdf"); using var stream = new FileStream(path, FileMode.Create); report.GeneratePdf(stream); Process.Start("explorer.exe", path); }
public StatisticalReportViewModel(int id, StandardReport sumStandardReport, StandardReport detailStandardReport) : base(id, detailStandardReport) { TopChart = new ChartViewModel { ChartName = "Top Chart" + id }; BottomChart = new ChartViewModel { ChartName = "Bottom Chart" + id }; SumGrid = sumStandardReport; DetailGrid = detailStandardReport; }
public BaseReport GetStructureReportById(int reportId, ReportParameter parameter) { if (reportId > 0) { var standardReport = new StandardReport(reportId) { ResultDataTable = StandardReportRepository.GetStructureReportById(reportId, parameter), Columns = StandardReportRepository.GetReportColumns(reportId).ToList(), ExtraHeaderCollection = StandardReportRepository.GetExtraHeaderById(reportId).ToList() }; return(standardReport); } return(new StandardReport(reportId)); }
public void SetUp() { var model = DataSource.GetReport(); Report = new StandardReport(model); }
/// <summary> /// Create a StandardReport /// </summary> /// <param name="currentUser"></param> /// <param name="user"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="dc"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> public StandardReportVMDC CreateStandardReport(string currentUser, string user, string appID, string overrideID, StandardReportDC dc, IRepository <StandardReport> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService) { try { #region Parameter validation // Validate parameters if (string.IsNullOrEmpty(currentUser)) { throw new ArgumentOutOfRangeException("currentUser"); } if (string.IsNullOrEmpty(user)) { throw new ArgumentOutOfRangeException("user"); } if (string.IsNullOrEmpty(appID)) { throw new ArgumentOutOfRangeException("appID"); } if (null == dc) { throw new ArgumentOutOfRangeException("dc"); } if (null == dataRepository) { throw new ArgumentOutOfRangeException("dataRepository"); } if (null == uow) { throw new ArgumentOutOfRangeException("uow"); } if (null == exceptionManager) { throw new ArgumentOutOfRangeException("exceptionManager"); } if (null == mappingService) { throw new ArgumentOutOfRangeException("mappingService"); } #endregion using (uow) { // Create a new ID for the StandardReport item dc.Code = Guid.NewGuid(); // Map data contract to model StandardReport destination = mappingService.Map <StandardReportDC, StandardReport>(dc); // Add the new item dataRepository.Add(destination); // Commit unit of work uow.Commit(); // Map model back to data contract to return new row id. dc = mappingService.Map <StandardReport, StandardReportDC>(destination); } // Create aggregate data contract StandardReportVMDC returnObject = new StandardReportVMDC(); // Add new item to aggregate returnObject.StandardReportItem = dc; return(returnObject); } catch (Exception e) { //Prevent exception from propogating across the service interface exceptionManager.ShieldException(e); return(null); } }
/// <summary> /// Retrieve a StandardReport with associated lookups /// </summary> /// <param name="currentUser"></param> /// <param name="user"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="code"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> /// <returns></returns> public StandardReportVMDC GetStandardReport(string currentUser, string user, string appID, string overrideID, string code, IUnitOfWork uow, IRepository <StandardReport> dataRepository , IRepository <ReportCategory> reportCategoryRepository , IExceptionManager exceptionManager, IMappingService mappingService) { try { #region Parameter validation // Validate parameters if (string.IsNullOrEmpty(currentUser)) { throw new ArgumentOutOfRangeException("currentUser"); } if (string.IsNullOrEmpty(user)) { throw new ArgumentOutOfRangeException("user"); } if (string.IsNullOrEmpty(appID)) { throw new ArgumentOutOfRangeException("appID"); } if (null == dataRepository) { throw new ArgumentOutOfRangeException("dataRepository"); } if (null == uow) { throw new ArgumentOutOfRangeException("uow"); } if (null == exceptionManager) { throw new ArgumentOutOfRangeException("exceptionManager"); } if (null == mappingService) { throw new ArgumentOutOfRangeException("mappingService"); } #endregion using (uow) { StandardReportDC destination = null; // If code is null then just return supporting lists if (!string.IsNullOrEmpty(code)) { // Convert code to Guid Guid codeGuid = Guid.Parse(code); // Retrieve specific StandardReport StandardReport dataEntity = dataRepository.Single(x => x.Code == codeGuid); // Convert to data contract for passing through service interface destination = mappingService.Map <StandardReport, StandardReportDC>(dataEntity); } IEnumerable <ReportCategory> reportCategoryList = reportCategoryRepository.GetAll(x => new { x.Description }); List <ReportCategoryDC> reportCategoryDestinationList = mappingService.Map <List <ReportCategoryDC> >(reportCategoryList); // Create aggregate contract StandardReportVMDC returnObject = new StandardReportVMDC(); returnObject.StandardReportItem = destination; returnObject.ReportCategoryList = reportCategoryDestinationList; return(returnObject); } } catch (Exception e) { //Prevent exception from propogating across the service interface exceptionManager.ShieldException(e); return(null); } }
/// <summary> /// Update a StandardReport /// </summary> /// <param name="currentUser"></param> /// <param name="user"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="code"></param> /// <param name="lockID"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> public void DeleteStandardReport(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <StandardReport> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService) { try { #region Parameter validation // Validate parameters if (string.IsNullOrEmpty(currentUser)) { throw new ArgumentOutOfRangeException("currentUser"); } if (string.IsNullOrEmpty(user)) { throw new ArgumentOutOfRangeException("user"); } if (string.IsNullOrEmpty(appID)) { throw new ArgumentOutOfRangeException("appID"); } if (string.IsNullOrEmpty(code)) { throw new ArgumentOutOfRangeException("code"); } if (string.IsNullOrEmpty(lockID)) { throw new ArgumentOutOfRangeException("lockID"); } if (null == dataRepository) { throw new ArgumentOutOfRangeException("dataRepository"); } if (null == uow) { throw new ArgumentOutOfRangeException("uow"); } if (null == exceptionManager) { throw new ArgumentOutOfRangeException("exceptionManager"); } if (null == mappingService) { throw new ArgumentOutOfRangeException("mappingService"); } #endregion using (uow) { // Convert string to guid Guid codeGuid = Guid.Parse(code); // Find item based on ID StandardReport dataEntity = dataRepository.Single(x => x.Code == codeGuid); // Delete the item dataRepository.Delete(dataEntity); // Commit unit of work uow.Commit(); } } catch (Exception e) { //Prevent exception from propogating across the service interface exceptionManager.ShieldException(e); } }
/// <summary> /// Initializes a new instance of the <see cref="BasicReportViewModel"/> class. /// </summary> /// <param name="id">The id.</param> public BasicReportViewModel(int id, StandardReport report) : base(id) { this.standardReport = report; this.standardReport.IsStatisticalReport = false; }
public ActionResult IndexStandardReport(int? page, int? pagesize, string name,string first) { dynamic data = new System.Dynamic.ExpandoObject(); if (name == null) name = ""; var list = _StandardReportRepos.GetAllStandardReport(name); int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 12; var vs = list.ToPagedList(_page, _pagesize); var firstone = new StandardReport(); if (first != null && first != "") { firstone = list.FirstOrDefault(p => p.StandardReportCode == first); var firspage = vs.IndexOf(firstone); if (firspage == -1) { vs.Insert(0, firstone); } else if (firspage > 0) { vs.Remove(firstone); vs.Insert(0, firstone); } } data.name = name; data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; string otherparam = ""; if (name != "") otherparam += "&name=" + name; data.otherParam = otherparam; return PartialView(data); }
protected override void onCorrespondenceTemplateMerge(NameValueCollection colMergeFields, string szCorrespondenceTemplate, ref bool bCancelMerge) { DailyGroupActivitiesDTO dailyGroupActivitiesDTO = (DailyGroupActivitiesDTO)(this.Parameters[0]); int childId = int.Parse(this.Parameters[1].ToString()); string centerName = this.Parameters[2].ToString(); string groupName = this.Parameters[3].ToString().ToUpper(); string websiteAddress = this.Parameters[4].ToString(); StringBuilder sbReport = new StringBuilder(); var child = (from gc in dailyGroupActivitiesDTO.GroupChildren where gc.Id == childId select gc).FirstOrDefault(); colMergeFields.Set("[WEBSITE]", websiteAddress); colMergeFields.Set("[CHILD_FIRSTNAME]", child.FirstName + " " + child.LastName.Substring(0, 1) + "."); colMergeFields.Set("[PARENT_FIRSTNAME]", child.ParentFirstName); colMergeFields.Set("[CENTER]", centerName); colMergeFields.Set("[GROUP_NAME]", groupName); //Added to track and set what child email was last processed in order to check if same email as before and to AOL //We want to inject a wait time before sending out the email in those cases. colMergeFields.Set("[LAST_EMAIL]", child.Email); colMergeFields.Set("[TODAY]", string.Format("{0:dddd, MM/dd/yyyy}", dailyGroupActivitiesDTO.DailyGroup.ClassDate)); sbReport.Length = 0; sbReport.AppendLine("<table id='tblGroupActivity' border='1' style='border-spacing: 8px 2px; padding: 6px;'>"); sbReport.AppendLine("<tr class='HeaderGrid'>"); StandardReport.BuildTableCell(sbReport, "Child Name", "white-space: nowrap; text-align: left; text-decoration: underline; font-weight: bold;"); foreach (var activityName in dailyGroupActivitiesDTO.ChildActivityValues.Select(cav => cav.ActivityName).Distinct()) { StandardReport.BuildTableCell(sbReport, activityName, "text-align: left; text-decoration: underline; font-weight: bold;"); } sbReport.AppendLine("</tr>"); sbReport.AppendLine("<tr class='Grid'>"); StandardReport.BuildTableCell(sbReport, colMergeFields.Get("[CHILD_FIRSTNAME]"), "text-align: left;"); foreach (var activityName in dailyGroupActivitiesDTO.ChildDailyGroupActivities.Select(cav => cav.ActivityName).Distinct()) { var selectedItem = (from ca in dailyGroupActivitiesDTO.ChildDailyGroupActivities where ca.ActivityName == activityName && ca.ChildId == childId select ca.ActivityValue).FirstOrDefault(); StandardReport.BuildTableCell(sbReport, selectedItem, "text-align: left;"); } sbReport.AppendLine("</tr>"); sbReport.AppendLine("</table>"); colMergeFields.Set("[REPORT]", sbReport.ToString()); base.onCorrespondenceTemplateMerge(colMergeFields, szCorrespondenceTemplate, ref bCancelMerge); }