Ejemplo n.º 1
0
        public void RefreshDisplayTree( )
        {
            DisplayTreeListCtrl.TableName = this.TableName;
            DisplayTreeListCtrl.InnerTreeList.Columns.Clear();
            DisplayTreeListCtrl.ColumnConfigs      = this.ColumnList;
            DisplayTreeListCtrl.Manager.ConfigList = this.Manager.ConfigList;//new
            DisplayTreeListCtrl.InitColumns();

            #region Script
            if (String.IsNullOrWhiteSpace(this.TableName))
            {
                if (String.IsNullOrWhiteSpace(Script) == false)
                {
                    DataSet ds = DataQueryProvider.RunQuery(Script);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        Manager.Invalidate(ds);
                        DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization();
                    }
                }
                return;
            }
            #endregion

            if (DataCachingProvider.LookupTables.ContainsKey(this.TableName))
            {
                Manager.Invalidate(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.DisplayTreeListCtrl.InnerTreeList.DataSource = ds.Tables[0];
                    }
                }
                catch (Exception ex)
                {
                }
            }

            this.DisplayTreeListCtrl.InnerTreeList.RefreshDataSource();
            DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization();
        }
        public void RefreshDisplayGrid( )
        {
            DisplayGridCtrl.TableName = this.TableName;
            DisplayGridCtrl.Grid.Fields.Clear();
            DisplayGridCtrl.FieldConfigs = this.FieldsList;
            DisplayGridCtrl.InitFields();
            DisplayGridCtrl.Grid.OptionsView.RowTreeWidth = RowTreeWidth;
            DisplayGridCtrl.UseChartControl = UseChartControl;
            DisplayGridCtrl.Script          = Script;

            if (String.IsNullOrWhiteSpace(this.TableName))
            {
                DisplayGridCtrl.LoadDataSourceFromScript();
                return;
            }
            if (DataCachingProvider.LookupTables.ContainsKey(this.TableName))
            {
                this.DisplayGridCtrl.GridDataSource = 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.GridDataSource = ds.Tables[0];
                    }
                }
                catch (Exception ex)
                {
                }
            }

            this.DisplayGridCtrl.RefreshDataSource();
            DisplayGridCtrl.Grid.FieldsCustomization(splitContainerControl2.Panel2);
        }
Ejemplo n.º 3
0
        public BusinessObject GetFirstObject( )
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.Append(String.Format("Select Top(1) * From [{0}] ", TableName));

            if (DataStructureProvider.IsExistABCStatus(TableName))
            {
                strBuilder.Append(" WHERE ");
                strBuilder.Append(String.Format("[{0}]='{1}'", ABCCommon.ABCConstString.colABCStatus, ABCCommon.ABCConstString.ABCStatusAlive));
            }

            String strQuery = strBuilder.ToString();

            if (DatabaseHelper.IsSQLConnection() == false)
            {
                strQuery = SQLiteDatabaseHelper.RepairSelectSQLite(strQuery);
            }

            DataSet ds = DatabaseHelper.RunQuery(strQuery);

            return(BusinessObjectHelper.GetBusinessObject(ds, TableName));
        }
Ejemplo n.º 4
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();
            }
        }