private void ReportHeaderFooters_Loaded(object sender, RoutedEventArgs e) { try { ReportTablesRepository repo = new ReportTablesRepository(); if (this.selectedReportType == ReportTypeEnum.ReportContent) { this.HeadersAndFooters = new ReportMasterModel[] { }; foreach (ReportMasterModel report in this.HeadersAndFooters) { ReportConnectionModel connection = repo.GetProductionOrConnectionModel(report.MasterReport_Id); report.ProductionConnection = connection == null ? string.Empty : connection.ReportConnectionName; } } else { this.HeadersAndFooters = repo.GetReportMasterByReportTypeEnum((int)this.selectedReportType, General.ProjectModel.ModelName).ToArray(); } } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private void LoadCategoryTree() { ReportTablesRepository repo = new ReportTablesRepository(); List <ReportCategoryModel> categories = repo.GetActiveCategories(); foreach (ReportCategoryModel parent in categories.Where(pc => pc.ParentCategoryId == null)) { this.uxCategoryTree.Items.Add(this.BuildTree(parent.CategoryId, this.CreateTreeItem(parent), categories)); } }
public ReportFilterOptions(long masterReport_Id) : this() { this.MasterReport_Id = masterReport_Id; ReportTablesRepository repo = new ReportTablesRepository(); this.ReportXMLVersion = repo.GetReportXMLVersion(this.MasterReport_Id); this.ReportParameters = repo.GetPrintparameters(this.MasterReport_Id, this.ReportXMLVersion); this.LoadFIlters(); }
public void SetReportTypeCategory(long?category) { this.reportCategoryId = category; ReportTablesRepository repo = new ReportTablesRepository(); this.HeadersAndFooters = repo .GetReportMasterByReportTypeEnum( (int)this.selectedReportType, General.ProjectModel.ModelName, this.reportCategoryId.HasValue ? this.reportCategoryId.Value : 0) .ToArray(); }
private void DeleteCategory_Cliked(object sender, System.Windows.RoutedEventArgs e) { if (this.SelectedCategory == null) { MessageBox.Show("Please Select a Category."); return; } try { long categoryId = this.SelectedCategory.Tag.ToInt64(); ReportTablesRepository repo = new ReportTablesRepository(); if (repo.CategoryHaveReports(categoryId)) { throw new ApplicationException("Cannot delete Category while reports are attached."); } string message = $"Are you sure that you want to delete '{this.SelectedCategory.Header}'?"; MessageBoxResult boxResult = MessageBox.Show(message, "Delete", MessageBoxButton.YesNo); if (boxResult != MessageBoxResult.Yes) { return; } repo.DeleteCategory(categoryId); if (this.SelectedCategory.Parent.GetType() == typeof(TreeViewItemTool)) { TreeViewItemTool parent = this.SelectedCategory.Parent as TreeViewItemTool; parent.Items.Remove(this.SelectedCategory); } else { this.uxCategoryTree.Items.Remove(this.SelectedCategory); } } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private void AddCategory_Cliked(object sender, System.Windows.RoutedEventArgs e) { try { string caption = this.SelectedCategory == null ? "Parent Category" : $"Child Category for {this.SelectedCategory.Header}"; if (InputBox.ShowDialog(this.GetParentWindow(), true, "New Category", caption).IsFalse()) { return; } ReportTablesRepository repo = new ReportTablesRepository(); long?nullLong = null; ReportCategoryModel model = new ReportCategoryModel { CategoryName = InputBox.Result, IsActive = true, ParentCategoryId = this.SelectedCategory == null ? nullLong : this.SelectedCategory.Tag.ToInt64() }; repo.UpdateReportCategory(model); if (this.SelectedCategory == null) { this.uxCategoryTree.Items.Add(this.CreateTreeItem(model)); } else { this.SelectedCategory.Items.Add(this.CreateTreeItem(model)); } } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private void ChangeCategory_Click(object sender, RoutedEventArgs e) { try { if (this.SelectedHeaderAndFooter == null) { MessageBox.Show("Please select a Report."); return; } CategorySelector selector = new CategorySelector(); if (ControlDialog.ShowDialog("Report Categories", selector, string.Empty).IsFalse()) { return; } if (this.SelectedHeaderAndFooter.CategoryId == selector.SelectedCategoryId) { return; } this.SelectedHeaderAndFooter.CategoryId = selector.SelectedCategoryId; ReportTablesRepository repo = new ReportTablesRepository(); repo.UpdateReportMaster(this.SelectedHeaderAndFooter); this.HeadersAndFooters = this.HeadersAndFooters.Remove(this.SelectedHeaderAndFooter); } catch (Exception err) { MessageBox.Show(err.Message); } }
public void LoadCategoryReports() { ReportTablesRepository repo = new ReportTablesRepository(); this.view.ReportsList = repo.GetReportMasterByCategoryId(this.view.SelectedCategoryId); }
public void LoadReportCategories() { ReportTablesRepository repo = new ReportTablesRepository(); this.view.ReportCategories = repo.GetActiveCategories(); }
public void GetReportFilters() { ReportTablesRepository repo = new ReportTablesRepository(); this.view.ReportParameters = repo.GetPrintparameters(this.view.MasterReport_Id); }