public override IEnumerable <string> Get(string collection, string column, StoreDictionary where, int limit) { StoreList records = new StoreList(); JSON names = GetRecords(collection); for (int i = 0; i < names.length; i++) { if (limit == 0) { break; } string name = names[i].stringValue; if (IsRecordIncluded(collection, name, where)) { string value = Get("collections." + collection + "." + name + "." + column); records.Add(value); limit--; } } return(records); }
public void AddEvents(IEnumerable <AbstractEvent> abstactEvents) { var newEvents = new List <AbstractEvent>(); foreach (var abstactEvent in abstactEvents) { switch (abstactEvent) { case LogEvent evt: { if (evt.ProcessInvocationUID != null && !ProcessList.ContainsKey(evt.ProcessInvocationUID.Value)) { continue; } } break; case IoCommandStartEvent evt: { if (!ProcessList.ContainsKey(evt.ProcessInvocationUid)) { continue; } } break; case ProcessInvocationStartEvent evt: { if (!ProcessList.ContainsKey(evt.InvocationUID)) { TrackedProcessInvocation invoker = null; if (evt.CallerInvocationUID != null && !ProcessList.TryGetValue(evt.CallerInvocationUID.Value, out invoker)) { continue; } var process = new TrackedProcessInvocation(evt.InvocationUID, evt.InstanceUID, evt.InvocationCounter, invoker, evt.Type, evt.Kind, evt.Name, evt.Topic); ProcessList.Add(process.InvocationUid, process); OnProcessInvoked?.Invoke(this, process); } } break; case ProcessInvocationEndEvent evt: { if (!ProcessList.TryGetValue(evt.InvocationUID, out var process)) { continue; } process.ElapsedMillisecondsAfterFinished = TimeSpan.FromMilliseconds(evt.ElapsedMilliseconds); if (evt.NetTimeMilliseconds != null) { process.NetTimeAfterFinished = TimeSpan.FromMilliseconds(evt.NetTimeMilliseconds.Value); } } break; case RowCreatedEvent evt: { if (!ProcessList.TryGetValue(evt.ProcessInvocationUid, out var process)) { continue; } process.CreateRow(); } break; case RowOwnerChangedEvent evt: { if (!ProcessList.TryGetValue(evt.PreviousProcessInvocationUid, out var previousProcess)) { continue; } TrackedProcessInvocation newProcess = null; if (evt.NewProcessInvocationUid != null && !ProcessList.TryGetValue(evt.NewProcessInvocationUid.Value, out newProcess)) { continue; } if (newProcess != null) { previousProcess.PassedRow(evt.RowUid); newProcess.InputRow(evt.RowUid, previousProcess); } else { previousProcess.DropRow(evt.RowUid); } } break; case RowValueChangedEvent evt: continue; case RowStoreStartedEvent evt: { var store = new TrackedStore(evt.UID, evt.Location, evt.Path); StoreList.Add(evt.UID, store); OnRowStoreStarted?.Invoke(this, store); } break; case RowStoredEvent evt: { if (!ProcessList.TryGetValue(evt.ProcessInvocationUID, out var process)) { continue; } if (!StoreList.TryGetValue(evt.StoreUid, out var store)) { continue; } process.StoreRow(evt.RowUid); OnRowStored?.Invoke(this, store, process, evt.RowUid, evt.Values); store.RowCount++; } break; } newEvents.Add(abstactEvent); } if (newEvents.Count == 0) { return; } OnEventsAdded?.Invoke(this, newEvents); }
public void AddStore(Store store) { StoreList.Add(store); }
/// <summary> /// Load column vào GridPanel /// </summary> private void AddColumn() { if (ColumnList == null) { ColumnList = GridController.GetInstance().GetColumnInfo(this.ID, TableName, 1); } Datatable = DataController.DataHandler.GetInstance().ExecuteDataTable("select top 1 * from " + TableName); if (ColumnList.FirstOrDefault() == null) { foreach (DataColumn item in Datatable.Columns) { Column column = new Column(); column.DataIndex = item.ColumnName; column.Header = item.ColumnName; GridPanel1.ColumnModel.Columns.Add(column); if (item.DataType.ToString().Equals("System.DateTime")) { column.Renderer.Fn = "GetDateFormat"; } if (column.Editor.Count == 0) { switch (GetColumnDataType(Datatable, item.ColumnName)) { case "System.Decimal": case "System.Int32": Ext.Net.SpinnerField spin = new SpinnerField(); spin.ID = item.ColumnName + "spin"; column.Editor.Add(spin); break; case "System.DateTime": Ext.Net.DateField df = new Ext.Net.DateField(); df.ID = item.ColumnName + "datefield"; column.Editor.Add(df); break; case "System.String": Ext.Net.TextField text = new Ext.Net.TextField(); text.ID = item.ColumnName + "string"; column.Editor.Add(text); break; case "System.Boolean": Ext.Net.Checkbox chk = new Checkbox(); chk.ID = item.ColumnName + "chk"; column.Editor.Add(chk); break; } } } } else { string listener = ""; bool hasComboBox = false; foreach (GridPanelColumnInfo columnInfo in ColumnList) { Column column = new Column(); column.DataIndex = columnInfo.ColumnName; column.Header = columnInfo.ColumnHeader; if (columnInfo.Width.HasValue && columnInfo.Width != 0) { column.Width = columnInfo.Width.Value; } GridPanel1.ColumnModel.Columns.Add(column); if (string.IsNullOrEmpty(columnInfo.RenderJS) == false) { column.Renderer.Fn = columnInfo.RenderJS; } if (columnInfo.AllowComboBoxOnGrid && string.IsNullOrEmpty(columnInfo.TableName) == false) { hasComboBox = true; Ext.Net.ComboBox cbBox = new ComboBox(); cbBox.LoadingText = "Đang tải..."; cbBox.ID = "combo" + columnInfo.ColumnName; cbBox.DisplayField = "displayField"; cbBox.ValueField = "valueField"; cbBox.EnableViewState = false; column.Editor.Add(cbBox); Store store = CreateStore(cbBox.ID); cbBox.Store.Add(store); StoreList.Add(new StoreDaTa(store, columnInfo.ComboBoxTable, columnInfo.DisplayFieldComboBox, columnInfo.ValueFieldComboBox, columnInfo.WhereFilterComboBox, columnInfo.ColumnName, columnInfo.MasterColumnComboID.Value, columnInfo.ID)); if (columnInfo.MasterColumnComboID.HasValue && columnInfo.MasterColumnComboID.Value != 0) { GridPanelColumnInfo col = ColumnList .Where(p => p.ID == columnInfo.MasterColumnComboID.Value).FirstOrDefault(); if (col != null) { listener += string.Format( "case \"{0}\": this.getColumnModel().getCellEditor(e.column, e.row).field.allQuery = e.record.get('{1}');break;", columnInfo.ColumnName, col.ColumnName); } } } if (column.Editor.Count == 0) { switch (columnInfo.DataType) { case "System.Decimal": case "System.Int32": Ext.Net.SpinnerField spin = new SpinnerField(); spin.ID = columnInfo.ColumnName + "spin"; column.Editor.Add(spin); break; case "System.DateTime": Ext.Net.DateField df = new Ext.Net.DateField(); df.ID = columnInfo.ColumnName + "datefield"; column.Editor.Add(df); break; case "System.String": Ext.Net.TextField text = new Ext.Net.TextField(); text.ID = columnInfo.ColumnName + "string"; column.Editor.Add(text); break; case "System.Boolean": Ext.Net.Checkbox chk = new Checkbox(); chk.ID = columnInfo.ColumnName + "chk"; column.Editor.Add(chk); break; } } } if (!string.IsNullOrEmpty(listener)) { GridPanel1.Listeners.BeforeEdit.Handler = "switch (e.field) {" + listener + "}"; } if (hasComboBox) { GridPanel1.Listeners.AfterEdit.Handler = Store1.ClientID + ".commitChanges();"; GridPanel1.DirectEvents.AfterEdit.Event += new ComponentDirectEvent.DirectEventHandler(AfterEdit_Event); GridPanel1.DirectEvents.AfterEdit.ExtraParams.Add(new Ext.Net.Parameter("id", "e.record.id", ParameterMode.Raw)); GridPanel1.DirectEvents.AfterEdit.ExtraParams.Add(new Ext.Net.Parameter("field", "e.field", ParameterMode.Raw)); GridPanel1.DirectEvents.AfterEdit.ExtraParams.Add(new Ext.Net.Parameter("record", "e.record.data", ParameterMode.Raw, true)); GridPanel1.DirectEvents.AfterEdit.ExtraParams.Add(new Ext.Net.Parameter("value", "e.value", ParameterMode.Raw)); } } }
protected virtual void AllocateColumns() { columns.Add(nameColumn); }