internal static void CreateUnBoundGrid(this IBoundGrid grid)
        {
            try
            {
                grid.BeginInit();

                grid.Columns.Clear();
                foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                {
                    // 有些列是要设置值但不可见的,例如Id
                    //if (!Authority.AuthorizeByRule(info.ColumnVisible))
                    //    continue;

                    switch (info.GridColumnType)
                    {
                        case GridColumnType.NoColumn:
                            break;
                        case GridColumnType.CheckColumn:
                            {
                                CheckColumn column = grid.AddCheckColumn(info.GridColumnName);
                                SetColumnProperties(column, info, grid);
                            }
                            break;
                        case GridColumnType.Normal:
                            {
                                Xceed.Grid.Column column;
                                if (grid.Columns[info.GridColumnName] != null)
                                {
                                    //throw new ArgumentException("there have already exist column " + info.GridColumnName);
                                    continue;
                                }
                                else
                                {
                                    column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                                }

                                SetColumnProperties(column, info, grid);

                                GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                                bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                                if (readOnly)
                                {
                                    column.ReadOnly = readOnly;
                                }
                                else
                                {
                                    GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                                }

                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.WarningColumn:
                            {
                                Columns.WarningColumn column = new Columns.WarningColumn(info.GridColumnName, info.PropertyName);
                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.StatColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                                SetColumnProperties(column, info, grid);
                                GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                                column.ReadOnly = true;
                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.ExpressionColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                                SetColumnProperties(column, info, grid);
                                GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                                bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                                if (readOnly)
                                {
                                    column.ReadOnly = readOnly;
                                }
                                else
                                {
                                    GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                                }
                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.ImageColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(System.Drawing.Image));
                                SetColumnProperties(column, info, grid);
                                column.ReadOnly = true;
                                column.MaxWidth = 72;
                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.SplitColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(string));
                                SetColumnProperties(column, info, grid);
                                column.ReadOnly = true;
                                column.BackColor = System.Drawing.Color.LightGray;
                                column.Title = " ";
                                column.MaxWidth = 5;
                                column.Width = 5;
                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.UnboundColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                                SetColumnProperties(column, info, grid);

                                GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                                bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                                if (readOnly)
                                {
                                    column.ReadOnly = readOnly;
                                }
                                else
                                {
                                    GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                                }

                                grid.Columns.Add(column);
                            }
                            break;
                        case GridColumnType.IndexColumn:
                            {
                                Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(int));
                                SetColumnProperties(column, info, grid);
                                column.ReadOnly = true;

                                grid.Columns.Add(column);
                            }
                            break;
                        default:
                            throw new NotSupportedException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                grid.EndInit();
            }

            grid.CreateSumRow();
            grid.CreateGroups();
            grid.CreateEvents();

            grid.BoundGridHelper.CreateColumnManageRowEvent();
            grid.SetColumnManagerRowHorizontalAlignment();
            grid.CreateMultiColumnHeaderColumnManagerRow();
        }
        /// <summary>
        /// 创建绑定Grid
        /// </summary>
        /// <param name="grid"></param>
        internal static void CreateBoundGrid(this IBoundGrid grid)
        {
            grid.DisplayManager.SetDataBinding(grid.DisplayManager.SearchManager.GetSchema(), string.Empty);

            if (ADInfoBll.Instance.GetGridColumnInfos(grid.GridName).Count > 0)
            {
                try
                {
                    grid.BeginInit();

                    foreach (Xceed.Grid.Column column in grid.Columns)
                    {
                        column.Visible = false;
                    }

                    foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                    {
                        switch (info.GridColumnType)
                        {
                            case GridColumnType.NoColumn:
                            case GridColumnType.StatColumn:
                            case GridColumnType.WarningColumn:
                            case GridColumnType.CheckColumn:
                                break;
                            case GridColumnType.Normal:
                                Xceed.Grid.Column column = grid.Columns[info.GridColumnName];
                                if (column == null)
                                {
                                    throw new ArgumentException("Invalid GridColumnInfo of " + info.GridColumnName);
                                }

                                column.Visible = Authority.AuthorizeByRule(info.ColumnVisible);
                                if (!column.Visible)
                                {
                                    // only for column custom visible.
                                    // 当重置配置的时候,不会使他显示出来
                                    column.MaxWidth = 0;
                                }

                                column.VisibleIndex = info.SeqNo;
                                column.Title = (string.IsNullOrEmpty(info.Caption) ? info.PropertyName : info.Caption);

                                if (!string.IsNullOrEmpty(info.BackColor))
                                {
                                    column.BackColor = System.Drawing.Color.FromName(info.BackColor);
                                }
                                if (!string.IsNullOrEmpty(info.ForeColor))
                                {
                                    column.ForeColor = System.Drawing.Color.FromName(info.ForeColor);
                                }
                                if (!string.IsNullOrEmpty(info.FontName) && info.FontSize.HasValue)
                                {
                                    column.Font = new System.Drawing.Font(info.FontName, info.FontSize.Value);
                                }

                                column.Tag = info;

                                GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);

                                bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                                if (readOnly)
                                {
                                    column.ReadOnly = readOnly;
                                }
                                else
                                {
                                    GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                                }
                                break;
                            default:
                                throw new NotSupportedException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                        }
                    }

                    grid.CreateSumRow();
                    grid.CreateGroups();
                    grid.CreateEvents();
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                }
                finally
                {
                    grid.EndInit();
                }
            }

            grid.BoundGridHelper.CreateColumnManageRowEvent();
            grid.SetColumnManagerRowHorizontalAlignment();
        }