protected override void CollectArguments(ref DAE.Runtime.DataParams paramsValue) { if ((Source != null) && (Source.DataView != null) && Source.DataView.Active) { string[] paramNames; DAE.Schema.Column[] columns; GetParams(out paramNames, out columns); for (int i = 0; i < columns.Length; i++) { // Create the collection when we find the first item to add to it if (paramsValue == null) { paramsValue = new DAE.Runtime.DataParams(); } DAE.Schema.Column column = columns[i]; DataField field = Source.DataView.Fields[column.Name]; paramsValue.Add ( new DAE.Runtime.DataParam ( paramNames[i], column.DataType, Modifier, Source.IsEmpty ? null : (field.HasValue() ? field.AsNative : null) ) ); } } }
private void SaveAsClicked(object sender, EventArgs args) { if ((DataField != null) && DataField.HasValue()) { DBFileForm.SaveToFile(); } }
/// <summary> Updates data values for this node from the current row of the DataView. </summary> /// <param name="AView"></param> protected internal virtual void Update(DataSet dataSet) { DataField field = dataSet.Fields[DBTreeView.ColumnName]; Text = field.HasValue() ? field.AsDisplayString : DBTreeView.NoValueText; Text = Text.Trim(); using (IRow key = DBTreeView.Source.DataSet.GetKey()) { _key.ClearValues(); key.CopyTo(_key); } }
private void OpenClicked(object sender, EventArgs args) { if ((DataField != null) && DataField.HasValue()) { if (_dBFileForm != null) { _dBFileForm.Dispose(); _dBFileForm = null; } DBFileForm.OpenFile(); } }
private void GetImage(HttpContext AContext, string AID, Stream AStream) { if (IsFieldActive() && DataField.HasValue()) { Stream LStream = DataField.Value.OpenStream(); try { StreamUtility.CopyStream(LStream, AStream); } finally { LStream.Close(); } } }
/// <summary> Returns the CheckState based on the field value. </summary> private CheckState GetCheckState() { if ((DataField != null) && DataField.HasValue()) { if (Convert.ToBoolean(DataField)) { return(CheckState.Checked); } else { return(CheckState.Unchecked); } } else { return(CheckState.Indeterminate); } }
private void FieldChanged(DataLink dataLink, DataSet dataSet, DataField field) { InternalSetText(FieldValue); SetHasValue((DataField != null) && DataField.HasValue()); }
protected void FormAccepted(IFormInterface form) { if ( _sourceLinkRefresh && (_sourceLink != null) && (_sourceLink.Source != null) && (_sourceLink.Source.DataView.State == DataSetState.Browse) && (form.MainSource != null) //&& //!Object.ReferenceEquals(FSourceLink.Source.DataView, AForm.MainSource.DataView) // Do not refresh if this is a surrogate ) { switch (Mode) { case FormMode.Delete: form.MainSource.DataView.Close(); // Close the data view first to prevent the following refresh from causing an unnecessary requery _sourceLink.Source.DataView.Refresh(); break; case FormMode.Insert: case FormMode.Edit: // Find the nearest row in current set DataView sourceView = _sourceLink.Source.DataView; DataView targetView = form.MainSource.DataView; if (sourceView != targetView) { // Determine RefreshSourceKey // Determine RefreshKey // if SourceLinkRefreshKeyNames and RefreshKeyNames are specified, use them, otherwise // if the current order of the source link data view is a subset of the columns in the detail view, use it, otherwise // find the minimum key in the source link data view that is a subset of the columns in the detail view and use it Schema.Order sourceKey = null; Schema.Order targetKey = null; if ((SourceLinkRefreshKeyNames != "") && (RefreshKeyNames != "")) { string[] sourceKeyNames = SourceLinkRefreshKeyNames.Split(new char[] { ';', ',' }); string[] targetKeyNames = RefreshKeyNames.Split(new char[] { ';', ',' }); if (sourceKeyNames.Length == targetKeyNames.Length) { sourceKey = new Schema.Order(); targetKey = new Schema.Order(); for (int index = 0; index < sourceKeyNames.Length; index++) { sourceKey.Columns.Add(new Schema.OrderColumn(sourceView.TableVar.Columns[sourceKeyNames[index]], true)); targetKey.Columns.Add(new Schema.OrderColumn(targetView.TableVar.Columns[targetKeyNames[index]], true)); } } } if (sourceKey == null) { if ((sourceView.Order != null) && sourceView.Order.Columns.IsSubsetOf(targetView.TableVar.Columns)) { sourceKey = sourceView.Order; targetKey = sourceView.Order; } else { Schema.Key minimumKey = sourceView.TableVar.Keys.MinimumSubsetKey(targetView.TableVar.Columns); if (minimumKey != null) { sourceKey = new Schema.Order(minimumKey); targetKey = sourceKey; } } } if (sourceKey != null) { using (Row row = new Row(sourceView.Process.ValueManager, new Schema.RowType(sourceKey.Columns))) { for (int index = 0; index < sourceKey.Columns.Count; index++) { DataField targetField = targetView[targetKey.Columns[index].Column.Name]; if (targetField.HasValue()) { row[index] = targetField.Value; } else { row.ClearValue(index); } } targetView.Close(); // to prevent unnecessary requery string saveOrder = String.Empty; if (!sourceView.Order.Equals(sourceKey)) { saveOrder = sourceView.OrderString; try { sourceView.Order = sourceKey; } catch (Exception exception) { if (sourceView.OrderString != saveOrder) { sourceView.OrderString = saveOrder; } else { sourceView.Refresh(); } throw new ClientException(ClientException.Codes.UnableToFindModifiedRow, exception); } } try { sourceView.Refresh(row); } finally { if ((saveOrder != String.Empty) && (sourceView.OrderString != saveOrder)) { sourceView.OrderString = saveOrder; } } } } else { targetView.Close(); sourceView.Refresh(); } } break; } } if ((Mode == FormMode.Insert) && _autoAcceptAfterInsertOnQuery) { IFormInterface localForm = (IFormInterface)FindParent(typeof(IFormInterface)); if (localForm.Mode == FormMode.Query) { localForm.Close(CloseBehavior.AcceptOrClose); } } if (_onFormAccepted != null) { _onFormAccepted.Execute(this, new EventParams("AForm", form)); } if (OnFormAcceptedEvent != null) { OnFormAcceptedEvent(form); } }
private void ContentChanged(DataLink dataLink, DataSet dataSet, DataField field) { SetHasValue((DataField != null) && DataField.HasValue()); }
private void FieldChanged(DataLink link, DataSet dataSet, DataField field) { SetHasValue((DataField != null) && DataField.HasValue()); SetText(HasValue ? DataField.AsString : ""); }
/// <summary> Loads the image from the view's data field. </summary> public virtual void LoadImage() { base.Image = FieldValue; SetHaveValue((DataField != null) && DataField.HasValue()); }