Exemplo n.º 1
0
        public void UpdateDatasource(object table)
        {
            //At first it will load from Json and Json will be serialized into DataColumns as DataColumn item, not UIColumn item as expected. That is why we need
            //DataColumns2, to store its UIColumn list, and copy it to DataColumns
            if (table.GetType() != typeof(DataSourceUITable))
            {
                string json = Utility.Serializer.Json.Serialize(table);
                json = json.Replace("DataColumns", "DataColumns2");
                json = json.Replace("DataColumns22", "DataColumns2");
                DataSourceUITable tbl = Utility.Serializer.Json.Deserialize <DataSourceUITable>(json);
                foreach (UIColumn col in tbl.DataColumns2)
                {
                    if (col.ConfigContent == null)
                    {
                        SetDefaultConfigContent(col);
                    }

                    tbl.DataColumns.Add(col);
                }
                CurrentTable = tbl;
            }
            else
            {
                CurrentTable = (DataSourceUITable)table;
            }

            gridColumns.AutoGenerateColumns = false;
            //gridColumns.DataSource = tbl.DataColumns;
            gridColumns.DataSource = CurrentTable.DataColumns.ConvertAll(c => c as UIColumn);
        }
Exemplo n.º 2
0
        public void InitFromDatasource(DataSourceTable table)
        {
            gridColumns.AutoGenerateColumns = false;
            DataSourceUITable newTable = Copy(table);

            gridColumns.DataSource = newTable.DataColumns.ConvertAll(c => c as UIColumn);
            CurrentTable           = newTable;
        }
Exemplo n.º 3
0
        void DisplayGrid(DataSourceUITable uiTable)
        {
            TableRow row = this.elementLayoutDesigner1.AddRow();

            row.AddTableCells(1);
            this.elementLayoutDesigner1.SelectCell(0, 0);

            PropertyPage ctrl = CreateGridPropertyPage(uiTable);

            this.elementLayoutDesigner1.AddElement(ctrl);
        }
Exemplo n.º 4
0
        void DisplayUITable(DataSourceUITable uitable)
        {
            int  rowIdx      = 0;
            int  colIdx      = 0;
            bool skipThisCol = false;

            foreach (UIColumn col in uitable.DataColumns)
            {
                if (skipThisCol)
                {
                    skipThisCol = false;
                    colIdx++;
                    continue;
                }

                TableRow row = this.elementLayoutDesigner1.AddRow();
                if (colIdx + 1 < uitable.DataColumns.Count - 1)
                {
                    UIColumn nextCol = (UIColumn)uiTable.DataColumns[colIdx + 1];
                    if (col.CtrlType != ControlType.Hidden && nextCol.CtrlType != ControlType.Hidden && col.CtrlType != ControlType.Textarea && nextCol.CtrlType != ControlType.Textarea)
                    {
                        row.AddTableCells(2);

                        this.elementLayoutDesigner1.SelectCell(rowIdx, 0);
                        PropertyPage ctrl = CreatePropertyPageFromUIColumn(col);
                        this.elementLayoutDesigner1.AddElement(ctrl);

                        this.elementLayoutDesigner1.SelectCell(rowIdx, 1);
                        PropertyPage nextCtrl = CreatePropertyPageFromUIColumn(nextCol);
                        this.elementLayoutDesigner1.AddElement(nextCtrl);

                        skipThisCol = true;
                    }
                    else
                    {
                        row.AddTableCells(1);
                        this.elementLayoutDesigner1.SelectCell(rowIdx, 0);
                        PropertyPage ctrl = CreatePropertyPageFromUIColumn(col);
                        this.elementLayoutDesigner1.AddElement(ctrl);
                    }
                }
                else
                {
                    row.AddTableCells(1);
                    this.elementLayoutDesigner1.SelectCell(rowIdx, 0);
                    PropertyPage ctrl = CreatePropertyPageFromUIColumn(col);
                    this.elementLayoutDesigner1.AddElement(ctrl);
                }
                colIdx++;
                rowIdx++;
            }
        }
        void OpenVisualDesigner(DataSourceUITable uiTable)
        {
            FormGenerateUIType frmType = new FormGenerateUIType();

            frmType.ShowDialog();

            GenerateUIType uiType = frmType.UIType;

            //DataSourceUITable newTable = (DataSourceUITable)gridColumns.DataSource;
            FormVisualDesigner frm = new FormVisualDesigner();

            frm.UIType         = uiType;
            frm.CurrentProject = this.CurrentProject;
            frm.CurrentModule  = this.CurrentModule;
            frm.ShowDialog();
        }
Exemplo n.º 6
0
        PropertyPage CreateGridPropertyPage(DataSourceUITable uiTable)
        {
            PropertyPage ctrl = new GridPropertyPage();


            List <GridColumn> columns = new List <GridColumn>();

            foreach (UIColumn col in uiTable.DataColumns)
            {
                GridColumn column = CreateGridColumn(col);
                column.PropertyPage = new TextboxPropertyPage();
                columns.Add(column);
            }

            ctrl.Properties["GridColumns"] = columns;
            if (this.currentModule != null)
            {
                ctrl.Properties["ID"]    = "grid" + this.currentModule.ModuleName;
                ctrl.Properties["Label"] = "List of " + this.currentModule.ModuleName;
            }
            return(ctrl);
        }
Exemplo n.º 7
0
        protected DataSourceUITable Copy(DataSourceTable table)
        {
            DataSourceUITable newTable = new DataSourceUITable();

            newTable.TableName   = table.TableName;
            newTable.TableSchema = table.TableSchema;

            foreach (Model.DataColumn col in table.DataColumns)
            {
                Model.UIColumn uiColumn = new Model.UIColumn();
                uiColumn.DataType   = col.DataType;
                uiColumn.ColumnName = col.ColumnName;
                uiColumn.ColumnText = col.ColumnText;
                uiColumn.Key        = col.Key;
                uiColumn.Use        = true;
                uiColumn.Size       = col.Size;
                uiColumn.View       = true;
                uiColumn.Detail     = true;
                uiColumn.Add        = true;
                uiColumn.Edit       = true;
                uiColumn.Delete     = true;
                uiColumn.Label      = col.ColumnText;
                if (col.ConfigContent == null)
                {
                    uiColumn = SetDefaultConfigContent(uiColumn);
                }
                else
                {
                    uiColumn.ConfigContent = col.ConfigContent;
                    uiColumn.ConfigContent.InitConfiguration(uiColumn);
                }
                newTable.DataColumns.Add(uiColumn);
            }

            return(newTable);
        }
 private void Configurator_OnVisualDesignerButtonClick(DataSourceUITable uiTable)
 {
     OpenVisualDesigner(uiTable);
 }