Exemple #1
0
        public void RefreshDisplayGrid( )
        {
            DisplayGridView.TableName = this.TableName;
            DisplayGridView.Columns.Clear();
            DisplayGridView.ColumnConfigs = this.ColumnList;
            DisplayGridView.InitColumns();

            #region Script
            if (String.IsNullOrWhiteSpace(this.TableName))
            {
                if (String.IsNullOrWhiteSpace(Script) == false)
                {
                    DataSet ds = ConnectionManager.DatabaseHelper.RunQuery(Script);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        this.DisplayGridCtrl.DataSource = ds.Tables[0];
                        this.DisplayGridCtrl.RefreshDataSource();
                        DisplayGridView.ShowCustomization();
                    }
                }
                return;
            }
            #endregion

            if (ABCDataLib.Tables.CachingProvider.LookupTables.ContainsKey(this.TableName))
            {
                this.DisplayGridCtrl.DataSource = ABCDataLib.Tables.CachingProvider.LookupTables[this.TableName];
            }
            else
            {
                ConditionBuilder strBuilder = new ConditionBuilder();
                strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0} ", this.TableName));
                if (ABCDataLib.Tables.StructureProvider.IsExistABCStatus(this.TableName))
                {
                    strBuilder.AddCondition(ABCDataLib.Generation.QueryGenerator.GenerateCondition(this.TableName, DataDefine.ColumnType.ABCStatus));
                }
                strBuilder.Append(String.Format(@" ORDER BY {0} DESC", ABCDataLib.Tables.StructureProvider.GetPrimaryKeyColumn(this.TableName)));

                try
                {
                    DataSet ds = ConnectionManager.DatabaseHelper.RunQuery(strBuilder.ToString());
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        this.DisplayGridCtrl.DataSource = ds.Tables[0];
                    }
                }
                catch (Exception ex)
                {
                }
            }

            this.DisplayGridCtrl.RefreshDataSource();
            DisplayGridView.ShowCustomization();
        }
Exemple #2
0
        public void RefreshDisplayGrid( )
        {
            DisplayGridView.TableName = this.TableName;
            DisplayGridView.Columns.Clear();
            DisplayGridView.Bands.Clear();

            DisplayGridView.BandConfigs   = this.BandsList;
            DisplayGridView.ColumnConfigs = this.ColumnList;
            DisplayGridView.LoadBands();

            #region Script
            if (String.IsNullOrWhiteSpace(this.TableName))
            {
                if (String.IsNullOrWhiteSpace(Script) == false)
                {
                    DataSet ds = DataQueryProvider.RunQuery(Script);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        this.DisplayGridCtrl.DataSource = ds.Tables[0];
                        this.DisplayGridCtrl.RefreshDataSource();
                        DisplayGridView.ShowCustomization();
                    }
                }
                return;
            }
            #endregion


            if (DataCachingProvider.LookupTables.ContainsKey(this.TableName))
            {
                this.DisplayGridCtrl.DataSource = DataCachingProvider.LookupTables[this.TableName];
            }
            else
            {
                ABCHelper.ConditionBuilder strBuilder = new ABCHelper.ConditionBuilder();
                strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0}", this.TableName));
                if (DataStructureProvider.IsExistABCStatus(this.TableName))
                {
                    strBuilder.AddCondition(QueryGenerator.GenerateCondition(this.TableName, ABCCommon.ABCColumnType.ABCStatus));
                }

                strBuilder.Append(String.Format(@" ORDER BY {0} DESC", DataStructureProvider.GetPrimaryKeyColumn(this.TableName)));

                try
                {
                    DataSet ds = DataQueryProvider.RunQuery(strBuilder.ToString());
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        this.DisplayGridCtrl.DataSource = ds.Tables[0];
                    }
                }
                catch (Exception ex)
                {
                }
            }

            this.DisplayGridCtrl.RefreshDataSource();
            if (DisplayGridView.CustomizationForm == null || DisplayGridView.CustomizationForm.Visible == false)
            {
                DisplayGridView.ShowCustomization();
            }
        }