Ejemplo n.º 1
0
 public void ShowReport()
 {
     var grid = new ReportGrid();
     grid.TableName = this.TableName;
     grid.DataSet = this.DataSet;
     this.winFormHost.Child = grid;
 }
Ejemplo n.º 2
0
        public void ShowReport()
        {
            var grid = new ReportGrid();

            grid.TableName         = this.TableName;
            grid.DataSet           = this.DataSet;
            this.winFormHost.Child = grid;
        }
        public void ShowReport()
        {
            var grid = new ReportGrid
            {
                TableName = TableName,
                DataSet   = DataSet
            };

            winFormHost.Child = grid;
        }
Ejemplo n.º 4
0
        public void SpawnReportViewerWindow(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                var menuItem = sender as MenuItem;
                if (menuItem == null)
                    return;
                var menuInfo = menuItem.CommandParameter as MenuCommandParameters;
                if (menuInfo == null)
                    return;

                WindowsFormsHost wh = new WindowsFormsHost();
                ReportGrid rg = new ReportGrid();

                var ds = new DataSet();

                using (IRepository repository = RepoHelper.CreateRepository(menuInfo.Connectionstring))
                {
                    var sqlText = string.Format(Environment.NewLine + "SELECT * FROM [{0}]", menuInfo.Name) 
                        + Environment.NewLine + "GO";
                    ds = repository.ExecuteSql(sqlText);                
                }
                rg.DataSet = ds;
                rg.TableName = menuInfo.Name;
                wh.Child = rg;

                string tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name + "-Report";
                bool alreadyThere = false;
                int i = -1;
                foreach (var item in _parent.FabTab.Items)
                {
                    i++;
                    if (item is FabTabItem)
                    {
                        FabTabItem ftItem = (FabTabItem)item;
                        if (ftItem.Header.ToString() == tabTitle)
                        {
                            alreadyThere = true;
                        }
                    }
                }
                if (alreadyThere)
                {
                    _parent.FabTab.SelectedIndex = i;
                    _parent.FabTab.Focus();
                }
                else
                {
                    FabTabItem tab = new FabTabItem();
                    tab.Content = wh;
                    tab.Header = tabTitle;
                    _parent.FabTab.Items.Add(tab);
                    _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
                    rg.Focus();
                }
                return;
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Microsoft Report Viewer 2010 not installed, please download and install to use this feature  http://www.microsoft.com/en-us/download/details.aspx?id=6442");
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex));
            }
        }