Exemple #1
0
 ILayoutCellEditor ListParamsRetriveCellEditor(object listItem, object value, ILayoutCell cell)
 {
     if (cell.Name == nameof(QParam.Value))
     {
         QParam            param  = (QParam)listItem;
         ILayoutCellEditor editor = null;
         if (param != null && param.Column != null && !editors.TryGetValue(param, out editor))
         {
             if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In)
             {
                 if (!(param.Value is QQuery) && param.Column.IsReference && param.Value == null)
                 {
                     var sub = new QQuery(string.Empty, param.Column.ReferenceTable);
                     sub.BuildColumn(param.Column.ReferenceTable.PrimaryKey);
                     param.ValueRight = sub;
                 }
                 editor = new CellEditorQuery();
             }
             else
             {
                 editor = TableLayoutList.InitCellEditor(param.Column);
                 if (param.Column.DataType == typeof(DateTime) && param.Comparer.Equals(CompareType.Between))
                 {
                     ((CellEditorDate)editor).TwoDate = true;
                 }
             }
             editors[param] = editor;
         }
         return(editor);
     }
     return(null);
 }
Exemple #2
0
 public void BindData(DBItem dataSource, DBColumn column, DBTable refer = null)
 {
     if (Column != column && dataSource?.GetType() != DataSource.GetType())
     {
         Binding?.Dispose();
         if (column != null)
         {
             CellEditor = TableLayoutList.InitCellEditor(column);
             if (CellEditor is CellEditorTable && refer != null)
             {
                 ((CellEditorTable)CellEditor).Table = refer;
             }
             Binding = new InvokeBinder <DBItem, FieldEditor>(dataSource, column, this, EmitInvoker.Initialize <FieldEditor>(nameof(Value)));
         }
     }
     DataSource = dataSource;
 }
Exemple #3
0
        protected override ILayoutCellEditor GetCellEditor(object listItem, object itemValue, ILayoutCell cell)
        {
            if (cell.Name == "Column" && cell.GetEditor(listItem) == null)
            {
                if (query.Table == null)
                {
                    return(null);
                }

                return(new CellEditorList {
                    DataSource = query.Table.Columns
                });
            }
            if (cell == colValue)
            {
                QParam            param  = (QParam)listItem;
                ILayoutCellEditor editor = null;
                if (param.Column != null)
                {
                    if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In)
                    {
                        if (param.Column.IsReference && param.Value == null)
                        {
                            param.ValueRight = new QQuery(string.Empty, param.Column.ReferenceTable);
                        }
                        editor = new CellEditorQuery();
                    }
                    else
                    {
                        editor = TableLayoutList.InitCellEditor(param.Column);
                    }
                    return(editor);
                }
            }
            return(base.GetCellEditor(listItem, itemValue, cell));
        }