/// <summary>
 /// 以分组排序方式显示
 /// </summary>
 private void ShowAsGroupSort()
 {
     if (CurrentGrid is SinoSZUC_GridControlEx)
     {
         SinoSZUC_GridControlEx _grid = (SinoSZUC_GridControlEx)CurrentGrid;
         _grid.ShowAsGroupSorting = !_grid.ShowAsGroupSorting;
         RaiseMenuChanged();
     }
 }
 /// <summary>
 /// 以图表方式展示
 /// </summary>
 private void ShowAsChart()
 {
     if (_currentGrid is SinoSZUC_GridControlEx)
     {
         SinoSZUC_GridControlEx _gridEx = _currentGrid as SinoSZUC_GridControlEx;
         DataTable _dt = _gridEx.CurrentData();
         Dictionary <string, string> _fieldsDict = _gridEx.CurrentFieldsDict();
         frmChartShow _f = new frmChartShow(_dt, _fieldsDict);
         _application.AddForm(Guid.NewGuid().ToString(), _f);
     }
 }
        /// <summary>
        /// 转存到个人分析空间
        /// </summary>
        private void SaveToPanalize()
        {
            BaseView _bv = null;

            if (_currentGrid is SinoSZUC_GridControlEx)
            {
                SinoSZUC_GridControlEx _gridEx = _currentGrid as SinoSZUC_GridControlEx;
                _bv = _gridEx.CurrentView;
            }
            if (_currentGrid is SinoSZUC_GridControlEx_FullRelation)
            {
                SinoSZUC_GridControlEx_FullRelation _gridFullEX = _currentGrid as SinoSZUC_GridControlEx_FullRelation;
                _bv = _gridFullEX.CurrentView;
            }

            if (_bv != null)
            {
                PAnalize_GridViewData.SaveToPAnalize(_bv);
            }
        }
        /// <summary>
        /// 导出
        /// </summary>
        private void ExportData()
        {
            BaseView _bv = null;

            if (_currentGrid is SinoSZUC_GridControlEx)
            {
                SinoSZUC_GridControlEx _gridEx = _currentGrid as SinoSZUC_GridControlEx;
                _bv = _gridEx.CurrentView;
            }
            if (_currentGrid is SinoSZUC_GridControlEx_FullRelation)
            {
                SinoSZUC_GridControlEx_FullRelation _gridFullEX = _currentGrid as SinoSZUC_GridControlEx_FullRelation;
                _bv = _gridFullEX.CurrentView;
            }

            if (_bv != null)
            {
                SinoSZExport_GridViewData.Export(_bv);
            }
        }
 public string GetFocusedMainKey()
 {
     try
     {
         if (_currentGrid is SinoSZUC_GridControlEx)
         {
             SinoSZUC_GridControlEx _gridEx = _currentGrid as SinoSZUC_GridControlEx;
             DataRow _dr = _gridEx.FocusedDataRow;
             if (_dr != null)
             {
                 string _mainKeyID = _dr["MAINID"].ToString();
                 return(_mainKeyID);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     return("");
 }
        /// <summary>
        /// 显示详细信息
        /// </summary>
        private void ShowDetail()
        {
            switch (this._queryType)
            {
            case "QueryModel":
                if (_currentGrid is SinoSZUC_GridControlEx)
                {
                    SinoSZUC_GridControlEx _gridEx = _currentGrid as SinoSZUC_GridControlEx;
                    DataRow _dr = _gridEx.FocusedDataRow;
                    if (_dr != null)
                    {
                        string _mainKeyID          = _dr["MAINID"].ToString();
                        frmSinoSZ_DataDetail _form = new frmSinoSZ_DataDetail(this.QueryModel, _mainKeyID);
                        _application.AddForm(Guid.NewGuid().ToString(), _form);
                    }
                }
                break;

            case "TaskResult":
                XtraMessageBox.Show("任务式查询的数据结果无法查看详细数据!");
                break;
            }
        }
        /// <summary>
        /// 取菜单组
        /// </summary>
        /// <param name="_pagename"></param>
        /// <returns></returns>
        private IList <FrmMenuGroup> GetMenuGroups(string _pagename)
        {
            IList <FrmMenuGroup> _ret = new List <FrmMenuGroup>();

            if (this.backgroundWorker1.IsBusy && !this.backgroundWorker1.CancellationPending)
            {
                FrmMenuGroup _thisGroup = new FrmMenuGroup("查询处理");

                _thisGroup.MenuItems = new List <FrmMenuItem>();
                FrmMenuItem _item = new FrmMenuItem("取消", "取消", global::SinoSZMetaDataQuery.Properties.Resources.x1, true);
                _thisGroup.MenuItems.Add(_item);
                _ret.Add(_thisGroup);
            }
            else
            {
                FrmMenuGroup _thisGroup = new FrmMenuGroup("数据分析");
                _thisGroup.MenuItems = new List <FrmMenuItem>();
                FrmMenuItem _item;

                if (QueryResultData != null)
                {
                    _item = new FrmMenuItem("展示方式", "展示方式", global::SinoSZMetaDataQuery.Properties.Resources.b11, true);
                    _thisGroup.MenuItems.Add(_item);

                    FrmMenuItem _citem = new FrmMenuItem("常规展示", "常规展示", global::SinoSZMetaDataQuery.Properties.Resources.b12, true);
                    _item.ChildMenus.Add(_citem);
                    foreach (DataTable _dt in QueryResultData.Tables)
                    {
                        if (_dt.TableName != this.QueryModel.MainTable.TableName)
                        {
                            MDModel_Table _mt = MC_QueryModel.GetTableDefine(this.QueryModel, _dt.TableName);
                            _citem = new FrmMenuItem(string.Format("关联展示[{0}]", _mt.TableDefine.DisplayTitle),
                                                     string.Format("关联展示,{0}", _dt.TableName),
                                                     global::SinoSZMetaDataQuery.Properties.Resources.b13, true);
                            _item.ChildMenus.Add(_citem);
                        }
                    }

                    _citem = new FrmMenuItem("关联展示[全部]", "全部平铺展示", global::SinoSZMetaDataQuery.Properties.Resources.b14, true);
                    _item.ChildMenus.Add(_citem);
                }
                bool   _canGroupSort    = false;
                bool   _canShowAsChart  = true;
                bool   _canShowDetail   = true;
                string _GSbuttonCaption = "分组排序";
                if (CurrentGrid is SinoSZUC_GridControlEx)
                {
                    SinoSZUC_GridControlEx _grid = (SinoSZUC_GridControlEx)CurrentGrid;
                    if (_grid.ShowAsGroupSorting)
                    {
                        _GSbuttonCaption = "取消分组";
                        _canShowDetail   = false;
                        _canGroupSort    = true;
                    }
                    else
                    {
                        if (_grid.Grouped)
                        {
                            _canGroupSort = true;
                        }
                    }
                }
                else
                {
                    _canShowAsChart = false;
                }

                if (_GSbuttonCaption == "分组排序")
                {
                    _item = new FrmMenuItem(_GSbuttonCaption, "分组排序", global::SinoSZMetaDataQuery.Properties.Resources.b15, _canGroupSort);
                    _thisGroup.MenuItems.Add(_item);
                }
                else
                {
                    _item = new FrmMenuItem(_GSbuttonCaption, "分组排序", global::SinoSZMetaDataQuery.Properties.Resources.b16, _canGroupSort);
                    _thisGroup.MenuItems.Add(_item);
                }


                //_item = new FrmMenuItem("数据透视", "数据透视", global::SinoSZMetaDataQuery.Properties.Resources.b17, _canShowAsChart);
                //_thisGroup.MenuItems.Add(_item);


                _item = new FrmMenuItem("图表展示", "图表展示", global::SinoSZMetaDataQuery.Properties.Resources.b18, _canShowAsChart);
                _thisGroup.MenuItems.Add(_item);

                //_item = new FrmMenuItem("数据筛选", "数据筛选", global::SinoSZMetaDataQuery.Properties.Resources.DataFilter2, true);
                //_thisGroup.MenuItems.Add(_item);

                _ret.Add(_thisGroup);


                _thisGroup           = new FrmMenuGroup("数据处理");
                _thisGroup.MenuItems = new List <FrmMenuItem>();
                if (!frmSinoSZ_QueryResult.DisableUsePAnalize)
                {
                    _item = new FrmMenuItem("数据转存", "数据转存", global::SinoSZMetaDataQuery.Properties.Resources.b26, true);
                    _thisGroup.MenuItems.Add(_item);
                }

                _item = new FrmMenuItem("导出", "导出", global::SinoSZMetaDataQuery.Properties.Resources.x3, true);
                _thisGroup.MenuItems.Add(_item);

                //_item = new FrmMenuItem("添加字段", "添加字段", global::SinoSZMetaDataQuery.Properties.Resources.b27, _canShowAsChart);
                //_thisGroup.MenuItems.Add(_item);


                _item = new FrmMenuItem("详细信息", "详细信息", global::SinoSZMetaDataQuery.Properties.Resources.x2, _canShowDetail && CanShowDetailButton);
                _thisGroup.MenuItems.Add(_item);


                _ret.Add(_thisGroup);

                foreach (FrmMenuGroup _extg in this.ExtendMenuGroups)
                {
                    _ret.Add(_extg);
                }
            }
            return(_ret);
        }