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); }
public DocumentWorkView() { actualParam = new QParam(LogicType.And, DocumentWork.DBTable.ParseProperty(nameof(DocumentWork.DateComplete)), CompareType.Is, null); view.ApplySortInternal(new DBComparer <DocumentWork, long?>(DocumentWork.DBTable.PrimaryKey)); view.Query.Parameters.Add(actualParam); list.AllowSort = false; Name = nameof(DocumentWorkView); Text = "Works"; toolActual = new ToolItem(ToolActualClick) { Name = "Actual", Checked = true, CheckOnClick = true, GlyphColor = Colors.Green, Glyph = GlyphType.CheckCircleO }; Bar.Add(toolActual); //list.ListInfo = new LayoutListInfo( // new LayoutColumn() { Name = "ToString", FillWidth = true }, // new LayoutColumn() { Name = "Date", Width = 115 }, // new LayoutColumn() { Name = "IsComplete", Width = 20 }) //{ // ColumnsVisible = false, // HeaderVisible = false //}; }
public override void InitializeEditor(LayoutEditor editor, object value, object dataSource) { QParam param = dataSource as QParam; listSource = param.Query.Parameters; base.InitializeEditor(editor, value, dataSource); }
public DocumentFilter() : base() { QDoc = new QQuery(string.Empty, Document.DBTable); QWork = new QQuery(string.Empty, DocumentWork.DBTable); QWork.Columns.Add(new QColumn(DocumentWork.DBTable.ParseProperty(nameof(DocumentWork.DocumentId)))); paramWork = QQuery.CreateParam(Document.DBTable.PrimaryKey, CompareType.In, QWork); paramWorkId = QQuery.CreateParam(Document.DBTable.ParseProperty(nameof(Document.CurrentWorkId)), CompareType.IsNot, null); }
private void ToolDeleteClick(object sender, EventArgs e) { if (listParams.SelectedItem == null) { return; } QParam param = (QParam)listParams.SelectedItem; param.List.Delete(param); }
private bool CheckP(SortedList <LayoutField, object> val, QParam p) { foreach (LayoutField f in val.Keys) { if (f.Invoker.Equals(p.Column)) { return(true); } } return(false); }
private void ToolAddGroupClick(object sender, EventArgs e) { var list = listParams.Selection.GetItems <QParam>(); if (list.Count > 0) { QParam group = Query.Parameters.Add(); foreach (var s in list) { group.Parameters.Add(s); } } }
public static QParam CreateRefsParam(object id) { var qrefing = new QQuery(string.Format("select {0} from {1} where {2} = {3}", DocumentReference.DBTable.ParseProperty(nameof(DocumentReference.DocumentId)).Name, DocumentReference.DBTable.Name, DocumentReference.DBTable.ParseProperty(nameof(DocumentReference.ReferenceId)).Name, id)); var qrefed = new QQuery(string.Format("select {2} from {1} where {0} = {3}", DocumentReference.DBTable.ParseProperty(nameof(DocumentReference.DocumentId)).Name, DocumentReference.DBTable.Name, DocumentReference.DBTable.ParseProperty(nameof(DocumentReference.ReferenceId)).Name, id)); var param = new QParam(); param.Parameters.Add(new QParam(LogicType.And, DBTable.PrimaryKey, CompareType.In, qrefed)); param.Parameters.Add(new QParam(LogicType.Or, DBTable.PrimaryKey, CompareType.In, qrefing)); return(param); }
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)); }
public void FilterByDocument(Document document) { DefaultParam = new QParam(LogicType.And, DocumentData.DocumentKey, CompareType.Equal, document.PrimaryId); }
public void Initialize(SearchState state, QQuery expression, QParam owner, IDockMain mainForm) { //this.mainForm = mainForm; SetQuery(state, expression, owner); //IntDBSchema(); }
protected void SetQuery(SearchState state, QQuery query, QParam owner) { this.state = state; this.owner = owner; Query = query; }