示例#1
0
        public DomainModelMetadata()
        {
            MetadataEntityList     = new List <MetadataEntity>();
            metadataEntityForGuid_ = new Dictionary <string, MetadataEntity>();

            //No warnings
            if (metadataEntity_ == null)
            {
                metadataEntity_ = null;
            }
            if (neededMetadataEntity_ == null)
            {
                neededMetadataEntity_ = null;
            }
            if (needingMetadataEntity_ == null)
            {
                needingMetadataEntity_ = null;
            }
            if (metadataField_ == null)
            {
                metadataField_ = null;
            }
            if (metadataNavigationProperty_ == null)
            {
                metadataNavigationProperty_ = null;
            }

            //Pass1 : find entities

            //Pass2 : add entity usages
        }
示例#2
0
        public IField GetDefinition(FieldDefinitionHandle handle)
        {
            if (handle.IsNil)
            {
                return(null);
            }
            if (fieldDefs == null)
            {
                return(new MetadataField(this, handle));
            }
            int row = MetadataTokens.GetRowNumber(handle);

            if (row >= fieldDefs.Length)
            {
                HandleOutOfRange(handle);
            }
            var field = LazyInit.VolatileRead(ref fieldDefs[row]);

            if (field != null)
            {
                return(field);
            }
            field = new MetadataField(this, handle);
            return(LazyInit.GetOrSet(ref fieldDefs[row], field));
        }
示例#3
0
        /// <summary>
        /// Inserts MetadataFields for fields without metadata
        /// </summary>
        protected bool InsertMetadataFields()
        {
            bool newMetaFields  = false;
            bool refreshVirtual = false;

            foreach (RepeaterItem item in NonMetadataFields.Items)
            {
                CheckBox cb        = item.FindControl("MetaFieldCheckBox") as CheckBox;
                CheckBox isVirtual = item.FindControl("MetaFieldIsVirtual") as CheckBox;
                TextBox  fieldName = item.FindControl("MetaFieldName") as TextBox;
                if (cb.Checked && !string.IsNullOrEmpty(fieldName.Text))
                {
                    MetadataField field = new MetadataField();
                    field[MetadataField.TableId]        = tableId.Value;
                    field[MetadataField.FieldName]      = fieldName.Text;
                    field[MetadataField.FieldSuppress]  = true;
                    field[MetadataField.FieldIsVirtual] = isVirtual.Checked;
                    field.Save();

                    newMetaFields  = true;
                    refreshVirtual = isVirtual.Checked || refreshVirtual;
                }
            }
            // ensure metadata field rebuilt
            if (refreshVirtual)
            {
                BOL.BusinessObject.RebuildVirtualFields();
            }
            return(newMetaFields);
        }
        //
        // LinkCreating event allows to prevent link creation
        //
        private void QBuilder_LinkCreating(DataSource fromDataSource, MetadataField fromField, DataSource toDataSource, MetadataField toField,
                                           MetadataForeignKey correspondingMetadataForeignKey, ref bool abort)
        {
            if (!CbLinkCreating.Checked)
            {
                return;
            }

            var fromFieldText = fromField == null
                ? fromDataSource.NameInQuery + ".*"
                : fromDataSource.MetadataObject.Name + "." + fromField.Name;

            var toFieldText = fromField == null
                ? toDataSource.NameInQuery + ".*"
                : toDataSource.MetadataObject.Name + "." + toField.Name;

            var value =
                $"LinkCreating. Creating the link between {fromFieldText} and {toFieldText}";

            AddRowToReport(value);

            var msg =
                $"Do you want to create the link between {fromFieldText} and {toFieldText}?";

            if (MessageBox.Show(msg, "LinkCreating event handler", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                abort = true;
            }
        }
示例#5
0
        public void SaveValue(FieldType type, Guid referenceCode, IEnumerable <DTO.MetadataField> metadatas)
        {
            using (var transaction = Connection.BeginTransaction())
            {
                try
                {
                    var _metadatas = metadatas.Select(field =>
                    {
                        var _field = new MetadataField(field);

                        var metadata   = BaseMetadata.CreateInstance(_field, null, referenceCode);
                        metadata.Value = field.Value.AsString();

                        return(metadata);
                    }).ToList();

                    metadataService.SaveValue(_metadatas);
                }
                catch
                {
                    transaction.Rollback();

                    throw;
                }
            }
        }
示例#6
0
        private void DumpSelectedExpressionInfo(StringBuilder stringBuilder, QueryColumnListItem selectedExpression)
        {
            // write full sql fragment of selected expression
            stringBuilder.AppendLine(selectedExpression.ExpressionString + "<br />");

            // write alias
            if (!String.IsNullOrEmpty(selectedExpression.AliasString))
            {
                stringBuilder.AppendLine("&nbsp;&nbsp;alias: " + selectedExpression.AliasString + "<br />");
            }

            // write datasource reference (if any)
            if (selectedExpression.ExpressionDatasource != null)
            {
                stringBuilder.AppendLine("&nbsp;&nbsp;datasource: " + selectedExpression.ExpressionDatasource.GetResultSQL() + "<br />");
            }

            // write metadata information (if any)
            if (selectedExpression.ExpressionField != null)
            {
                MetadataField field = selectedExpression.ExpressionField;
                stringBuilder.AppendLine("&nbsp;&nbsp;field name: " + field.Name + "<br />");

                string s = Enum.GetName(typeof(DbType), field.FieldType);
                stringBuilder.AppendLine("&nbsp;&nbsp;field type: " + s + "<br />");
            }
        }
// Returns collection of non-fixed (variable) fields from Marc21 record
        private static IEnumerable <MetadataField> MarcGetVariableFields(MARC_Record record)
        {
            List <MetadataField> metadataFieldsList = new List <MetadataField>();

// Step through each field in the collection
            foreach (int thisTag in record.Fields.Keys)
            {
                List <MARC_Field> matchingFields = record.Fields[thisTag];
                foreach (MARC_Field thisField in matchingFields)
                {
                    if (thisField.Subfield_Count != 0)
                    {
                        MetadataField metadataField = new MetadataField();
                        metadataField.TagName    = thisField.Tag.ToString().PadLeft(3, '0');
                        metadataField.Indicator1 = thisField.Indicator1.ToString();
                        metadataField.Indicator2 = thisField.Indicator2.ToString();
                        List <KeyValuePair <string, string> > subfields = new List <KeyValuePair <string, string> >();
                        // Build the complete line
                        foreach (MARC_Subfield thisSubfield in thisField.Subfields)
                        {
                            subfields.Add(new KeyValuePair <string, string>
                                              (thisSubfield.Subfield_Code.ToString(), thisSubfield.Data));
                        }
                        metadataField.Subfields = subfields;
                        metadataFieldsList.Add(metadataField);
                    }
                }
            }
            return(metadataFieldsList);
        }
示例#8
0
        private StatisticsOutputColumn IsFieldSelected(MetadataObject metadata, MetadataField field)
        {
            var sqlContext = metadata.SQLContext;

            return(_outputColumns
                   .FirstOrDefault(column => column.MetadataObject == metadata && column.MetadataField != null && sqlContext.IsIdentifiersEqual(column.MetadataField.GetNameIdentifier(), field.GetNameIdentifier())));
        }
示例#9
0
        protected void DeleteMetadataField(object sender, GridViewDeleteEventArgs e)
        {
            int           fieldId = (int)MetadataGrid.DataKeys[e.RowIndex][MetadataField.FieldId];
            MetadataField biz     = new MetadataField();

            biz.Delete(fieldId);
            Response.Redirect("AdminEditFieldMetadata.aspx?diseaseId=" + QueryDiseaseId + "&tableId=" + QueryTableId);
        }
示例#10
0
        public virtual void CascadeRemove(MetadataField item)
        {
            Requires <InvalidKeyException> .GreaterThan(item.Id, 0);

            Log.Verbose("CascadeRemove({0})", item.ToString());
            //1==>X
            //1<==>X
            base.CascadeRemove(item);
        }
示例#11
0
        public void AddPropertyItem(PropertyItem propertyItem)
        {
            string name = Enum.GetName(typeof(ImagePropertyTags), propertyItem.Id);

            object value = ParsePropertyItemValue(propertyItem);

            MetadataField metadataField = new MetadataField(name, value);

            this.metadataFields.Add(metadataField);
        }
        private void QBuilder_DataSourceFieldAdded(DataSource dataSource, MetadataField field, QueryColumnListItem queryColumnListItem, bool focusCondition)
        {
            if (CbDataSourceFieldAdded.Checked != true)
            {
                return;
            }
            var text = field == null ? dataSource.NameInQuery + ".*" : field.Name;

            AddRowToReport("DataSourceFieldAdded \"" + text + "\"");
        }
        private void QBuilder_DatasourceFieldRemoved(DataSource dataSource, MetadataField field)
        {
            if (CbDatasourceFieldRemoved.Checked != true)
            {
                return;
            }

            var text = field == null ? dataSource.NameInQuery + ".*" : field.Name;

            AddRowToReport("DatasourceFieldRemoved \"" + text + "\"");
        }
示例#14
0
        private void QBuilder_OnDatasourceFieldRemoved(DataSource datasource, MetadataField field)
        {
            if (CbDatasourceFieldRemoved.IsChecked != true)
            {
                return;
            }
            var fieldText = field == null ? datasource.NameInQuery + ".*" : field.Name;

            BoxLogEvents.Text = $"DatasourceFieldRemoved {fieldText}" +
                                Environment.NewLine + BoxLogEvents.Text;
        }
示例#15
0
        private void cont_FieldListDrawItem(object drawingContext, CRectangle rect, CDrawItemState state,
                                            MetadataField field, ref bool handled)
        {
            var context = (Graphics)drawingContext;

            if (field == null || !field.PrimaryKey)
            {
                return;
            }

            handled = true;

            context.FillRectangle(Brushes.White,
                                  new Rectangle(new Point((int)rect.X, (int)rect.Y), new Size((int)rect.Width, (int)rect.Height)));

            if (((CDrawItemState.Selected & state)) != 0 && (CDrawItemState.Focus & state) != 0)
            {
                context.FillRectangle(Brushes.DodgerBlue,
                                      new Rectangle(new Point((int)rect.X, (int)rect.Y),
                                                    new Size((int)rect.Width, (int)rect.Height)));
                context.DrawRectangle(new Pen(Color.Black)
                {
                    DashStyle = DashStyle.Dot
                },
                                      new Rectangle(new Point((int)rect.X, (int)rect.Y),
                                                    new Size((int)rect.Width, (int)rect.Height - 1)));
            }
            else
            {
                if ((CDrawItemState.Selected & state) != 0 && (CDrawItemState.Focus & state) == 0)
                {
                    context.FillRectangle(Brushes.DodgerBlue,
                                          new Rectangle(new Point((int)rect.X, (int)rect.Y),
                                                        new Size((int)rect.Width, (int)rect.Height)));
                }
            }

            var imageKey = (Bitmap)QBuilder.DataSourceOptions.ColumnsOptions.MarkColumnOptions.PrimaryKeyIcon;

            context.DrawImage(imageKey, new Point((int)rect.X + 3, (int)rect.Y));

            const TextFormatFlags textFormatFlags =
                TextFormatFlags.NoClipping | TextFormatFlags.VerticalCenter | TextFormatFlags.NoPrefix;

            var colorText = (CDrawItemState.Selected & state) != 0 ? Color.White : Color.Gray;
            var font      = new Font(DefaultFont.FontFamily, DefaultFont.Size);
            var text      = "(" + field.FieldTypeName + ") " + field.Name;
            var textSize  = TextRenderer.MeasureText(text, font);

            TextRenderer.DrawText(context, text, font,
                                  new Rectangle(new Point((int)rect.X + imageKey.Width + 2, (int)rect.Y),
                                                new Size(textSize.Width, (int)rect.Height)), colorText, textFormatFlags);
        }
示例#16
0
        private void QBuilder_OnDataSourceFieldAdded(DataSource datasource, MetadataField field, QueryColumnListItem querycolumnlistitem, bool isFocused)
        {
            if (CbDataSourceFieldAdded.IsChecked != true)
            {
                return;
            }

            var fieldText = field == null ? datasource.NameInQuery + ".*" : field.Name;

            BoxLogEvents.Text = $"DataSourceFieldAdded {fieldText}" +
                                Environment.NewLine + BoxLogEvents.Text;
        }
        internal static MetadataField makeMetadataField(string description, string name, MetadataType type, int pos, string format, Guid guid)
        {
            MetadataField metadataField = new MetadataField();
            metadataField.Description = description;
            metadataField.Name = name;
            metadataField.Type = type;
            metadataField.Guid = guid;
            metadataField.DisplayPosition = pos;
            metadataField.DisplayFormat = format;

            return metadataField;
        }
示例#18
0
        static unsafe uint read(byte *row, MetadataField mdField)
        {
            switch (mdField.size)
            {
            case 1: return(*(row + mdField.offset));

            case 2: return(*(ushort *)(row + mdField.offset));

            case 4: return(*(uint *)(row + mdField.offset));

            default: throw new ApplicationException(string.Format("Unknown size: {0}", mdField.size));
            }
        }
示例#19
0
        public static string GetLabel(MetadataField metadataField)
        {
            MemberInfo memberInfo = typeof(MetadataField).GetMember(metadataField.ToString())
                                    .FirstOrDefault();

            if (memberInfo == null)
            {
                return(null);
            }

            DisplayAttribute attribute = (DisplayAttribute)
                                         memberInfo.GetCustomAttributes(typeof(DisplayAttribute), false)
                                         .Single();

            return(attribute.Name);
        }
示例#20
0
        // Displays a prompt on deleting a field from the SELECT list.
        private void QBuilder_OnDataSourceFieldRemoving(DataSource datasource, MetadataField field, ref bool abort)
        {
            if (CbDataSourceFieldRemoving.IsChecked != true)
            {
                return;
            }
            BoxLogEvents.Text = "DataSourceFieldRemoving removing field \"" + field.Name + "\" form \"" +
                                datasource.NameInQuery + "\"" +
                                Environment.NewLine + BoxLogEvents.Text;

            var msg = "Are you sure to remove \"" + "\".\"" + datasource.NameInQuery + "\"" + (field.Name ?? "*") + "\" from the query?";

            if (MessageBox.Show(msg, "DataSourceFieldRemoving event handler", MessageBoxButton.YesNo) == MessageBoxResult.No)
            {
                abort = true;
            }
        }
        //
        // DatasourceFieldAdding event allows to prevent selecting of a field.
        //
        private void QBuilder_DataSourceFieldAdding(DataSource dataSource, MetadataField field, ref bool abort)
        {
            if (!CbDataSourceFieldAdding.Checked)
            {
                return;
            }

            var text = field == null ? dataSource.NameInQuery + ".*" : field.Name;

            AddRowToReport("DataSourceFieldAdding. Field name \"" + text + "\"");
            var msg = "Do you want to add the field \"" + text + "\" to the query?";

            if (MessageBox.Show(msg, "DatasourceFieldAdding event handler", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                abort = true;
            }
        }
示例#22
0
        private static IEnumerable <MetadataField> ParseFields(XNamespace ns, IEnumerable <XElement> fieldElements)
        {
            var fields = new List <MetadataField>();

            foreach (var fieldElem in fieldElements)
            {
                var field = new MetadataField
                {
                    MetadataEntryId = fieldElem.Descendants(ns + "ClassName").FirstOrDefault()?.Value,
                    SystemName      = fieldElem.Descendants(ns + "SystemName").FirstOrDefault()?.Value,
                    StandardName    = fieldElem.Descendants(ns + "StandardName").FirstOrDefault()?.Value,
                    LongName        = fieldElem.Descendants(ns + "LongName").FirstOrDefault()?.Value,
                    DBName          = fieldElem.Descendants(ns + "DBName").FirstOrDefault()?.Value,
                    ShortName       = fieldElem.Descendants(ns + "ShortName").FirstOrDefault()?.Value,
                    MaximumLength   = fieldElem.Descendants(ns + "MaximumLength").FirstOrDefault()?.Value,
                    DataType        = fieldElem.Descendants(ns + "DataType").FirstOrDefault()?.Value,
                    Precision       = fieldElem.Descendants(ns + "Precision").FirstOrDefault()?.Value,
                    Searchable      = fieldElem.Descendants(ns + "Searchable").FirstOrDefault()?.Value,
                    Interpretation  = fieldElem.Descendants(ns + "Interpretation").FirstOrDefault()?.Value,
                    Alignment       = fieldElem.Descendants(ns + "Alignment").FirstOrDefault()?.Value,
                    UseSeparator    = fieldElem.Descendants(ns + "UseSeparator").FirstOrDefault()?.Value,
                    EditMaskId      = fieldElem.Descendants(ns + "EditMaskId").FirstOrDefault()?.Value,
                    LookupName      = fieldElem.Descendants(ns + "LookupName").FirstOrDefault()?.Value,
                    MaxSelect       = fieldElem.Descendants(ns + "MaxSelect").FirstOrDefault()?.Value,
                    Units           = fieldElem.Descendants(ns + "Units").FirstOrDefault()?.Value,
                    Index           = fieldElem.Descendants(ns + "Index").FirstOrDefault()?.Value,
                    Minimum         = fieldElem.Descendants(ns + "Minimum").FirstOrDefault()?.Value,
                    Maximum         = fieldElem.Descendants(ns + "Maximum").FirstOrDefault()?.Value,
                    Default         = fieldElem.Descendants(ns + "Default").FirstOrDefault()?.Value,
                    Required        = fieldElem.Descendants(ns + "Required").FirstOrDefault()?.Value,
                    SearchHelpId    = fieldElem.Descendants(ns + "SearchHelpId").FirstOrDefault()?.Value,
                    Unique          = fieldElem.Descendants(ns + "Unique").FirstOrDefault()?.Value,
                    ModTimeStamp    = fieldElem.Descendants(ns + "ModTimeStamp").FirstOrDefault()?.Value,
                    ForeignKeyName  = fieldElem.Descendants(ns + "ForeignKeyName").FirstOrDefault()?.Value,
                    ForeignField    = fieldElem.Descendants(ns + "ForeignField").FirstOrDefault()?.Value,
                    KeyQuery        = fieldElem.Descendants(ns + "KeyQuery").FirstOrDefault()?.Value,
                    KeySelect       = fieldElem.Descendants(ns + "KeySelect").FirstOrDefault()?.Value,
                    InKeyIndex      = fieldElem.Descendants(ns + "InKeyIndex").FirstOrDefault()?.Value,
                };

                fields.Add(field);
            }

            return(fields);
        }
示例#23
0
        public DTO.MetadataField Save(DTO.MetadataField field)
        {
            using (var transaction = Connection.BeginTransaction())
            {
                try
                {
                    var _field = new MetadataField(field);

                    _field = metadataService.SaveField(_field);

                    return(new DTO.MetadataField(_field));
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
示例#24
0
        /// <summary>
        /// Prompts the user if he/she really wants to add a field to the SELECT list.
        /// </summary>
        private void QBuilder_OnDataSourceFieldAdding(DataSource datasource, MetadataField field, ref bool abort)
        {
            if (CbDataSourceFieldAdding.IsChecked != true)
            {
                return;
            }

            var fieldText = field == null ? $"{datasource.NameInQuery}.*" : field.Name;

            BoxLogEvents.Text = "DatasourceFieldAdding adding field \"" + fieldText + "\"" +
                                Environment.NewLine + BoxLogEvents.Text;

            var msg = "Are you sure to add \"" + fieldText + "\" to the SELECT list?";

            if (MessageBox.Show(msg, "DatasourceFieldAdding event handler", MessageBoxButton.YesNo) == MessageBoxResult.No)
            {
                abort = true;
            }
        }
示例#25
0
        /// <summary>
        /// The handler checks if the dragged field is a part of the primary key and denies dragging if it's not the case.
        /// </summary>
        private void QBuilder_BeforeDatasourceFieldDrag(DataSource dataSource, MetadataField field, ref bool abort)
        {
            if (CheckBoxBeforeDsFieldDrag.Checked != true)
            {
                return;
            }

            // deny dragging if a field isn't a part of the primary key
            if (!field.PrimaryKey)
            {
                TextBoxReport.Text = "OnBeforeDatasourceFieldDrag for field \"" + field.Name + " \" deny" +
                                     Environment.NewLine + TextBoxReport.Text;
                abort = true;
                return;
            }

            TextBoxReport.Text = "OnBeforeDatasourceFieldDrag for field \"" + field.Name + " \" allow" +
                                 Environment.NewLine + TextBoxReport.Text;
        }
        private void QBuilder_DataSourceFieldRemoving(DataSource dataSource, MetadataField field, ref bool abort)
        {
            if (CbDataSourceFieldRemoving.Checked != true)
            {
                return;
            }

            var text = field == null ? dataSource.NameInQuery + ".*" : field.Name;

            AddRowToReport("DataSourceFieldRemoving removing field \"" + text + "\" form \"" +
                           dataSource.NameInQuery + "\"");

            var name = dataSource.NameInQuery;
            var msg  = "Do you want to uncheck field \"" + text + "\" in the object \"" + name +
                       "\"?";

            if (MessageBox.Show(msg, "DataSourceFieldRemoving event handler", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                abort = true;
            }
        }
示例#27
0
        private static MetadataField GetAttributeByIndex(IWMHeaderInfo3 header, int index)
        {
            StringBuilder     attributeName       = null;
            ushort            attributeNameLength = 0;
            WMT_ATTR_DATATYPE attributeDataType;
            ushort            langIndex = 0;

            byte[] attributeValue       = null;
            uint   attributeValueLength = 0;

            header.GetAttributeByIndexEx(
                StreamNumber,
                (ushort)index,
                attributeName,
                ref attributeNameLength,
                out attributeDataType,
                out langIndex,
                attributeValue,
                ref attributeValueLength);

            attributeName  = new StringBuilder(attributeNameLength, attributeNameLength);
            attributeValue = new byte[attributeValueLength];

            header.GetAttributeByIndexEx(
                StreamNumber,
                (ushort)index,
                attributeName,
                ref attributeNameLength,
                out attributeDataType,
                out langIndex,
                attributeValue,
                ref attributeValueLength);

            object value = ParseAttributeValue(attributeValue, attributeDataType);

            MetadataField field = new MetadataField(attributeName.ToString(), value);

            return(field);
        }
示例#28
0
        //
        // LinkCreating event allows to prevent link creation
        //
        private void QBuilder_OnLinkCreating(DataSource fromDatasource, MetadataField fromField, DataSource toDatasource, MetadataField toField, MetadataForeignKey correspondingmetadataforeignkey, ref bool abort)
        {
            if (CbLinkCreating.IsChecked != true)
            {
                return;
            }
            if (fromField == null || toField == null)
            {
                return;
            }

            BoxLogEvents.Text = "LinkCreating" +
                                Environment.NewLine + BoxLogEvents.Text;

            var msg = string.Format("Do you want to create the link between {0}.{1} and {2}.{3}?",
                                    fromDatasource.MetadataObject.Name, fromField.Name, toDatasource.MetadataObject.Name, toField.Name);

            if (MessageBox.Show(msg, "LinkCreating event handler", MessageBoxButton.YesNo) == MessageBoxResult.No)
            {
                abort = true;
            }
        }
    public SwaggerPrimitve(MetadataField metadataField)
    {
      switch (metadataField.DataType)
      {
        case "bool":
          this.Type = "boolean";
          break;
        case "decimal":
          this.Type = "number";
          this.Format = "double";
          break;
        case "short":
          this.Type = "integer";
          this.Format = "Signed 16-bit integer";
          break;
        case "int":
          this.Type = "integer";
          this.Format = "Signed 32-bit integer";
          break;
          // the Swagger spec at http://swagger.io/specification/ supports formats "full-date" and "date-time" 
          // as defined by date-time - RFC3339 http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
          // So, we are being rather informal here
        case "System.DateTime":
          this.Type = "string";
          this.Format = "full-date YYYY-MM-DD";
          break;
        default:
          this.Type = metadataField.DataType.ToLowerInvariant();
          break;
      }

      this.Description = metadataField.Nullable ? "This property is nullable." : "This property is not nullable.";

      if (metadataField.Deprecated)
      {
        this.Description += " This property is deprecated.";
      }
    }
示例#30
0
        /// <summary>
        /// Checking the feasibility of creating a link between the given fields.
        /// </summary>
        private void QBuilder_LinkDragOver(DataSource fromDataSource, MetadataField fromField, DataSource toDataSource, MetadataField toField,
                                           MetadataForeignKey correspondingMetadataForeignKey, ref bool abort)
        {
            if (CheckBoxLinkDragOver.Checked != true)
            {
                return;
            }

            // Allow creation of links between fields of the same data type.
            if (fromField.FieldType == toField.FieldType)
            {
                TextBoxReport.Text = "OnLinkDragOver from field \"" + fromField.Name + "\" to field \"" + toField.Name +
                                     "\" allow" +
                                     Environment.NewLine + TextBoxReport.Text;
                return;
            }

            TextBoxReport.Text = "OnLinkDragOver from field \"" + fromField.Name + "\" to field \"" + toField.Name +
                                 "\" deny" +
                                 Environment.NewLine + TextBoxReport.Text;

            abort = true;
        }
示例#31
0
        public MetadataField SaveField(MetadataField field)
        {
            field.IsValid();

            var exists = metadataFieldRepository.GetByJsonId(field);

            if (!exists.IsNull() && field.Code != exists.Code)
            {
                throw new ArgumentException("Ops, Já existe um campo com esse JSON ID");
            }

            if (!exists.IsNull())
            {
                exists.Name       = field.Name;
                exists.Validator  = field.Validator;
                exists.UpdateDate = DateTime.Now;

                field = exists;
            }

            field = metadataFieldRepository.Save(field);

            return(field);
        }
示例#32
0
        private ICriteriaBuilderCustomEditor CriteriaBuilderOnNeedEditorForValue(object sender, KindOfType kindTypeContent, MetadataField metadataField, CRectangle bounds)
        {
            if (CheckBoxEditor.IsChecked == false)
            {
                return(null);
            }

            var editor = new CustomEditor {
                Bounds = bounds, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left
            };

            return(editor);
        }
        private static EventDefinitionData makeEventDefinition()
        {
            EventDefinitionData accessEventDefinition = new EventDefinitionData();
            accessEventDefinition.Guid = _eventGuid;
            accessEventDefinition.Name = DefinitionName;
            accessEventDefinition.ShortName = ShortName;
            accessEventDefinition.HelpText = HelpText;

            MetadataField[] accessMetadataFields = new MetadataField[MetadataFieldCount];
            accessEventDefinition.MetadataFields = accessMetadataFields;

            //// Handle Enumeration Values for Type metadata
            //_typeField.EnumeratedData = new EnumeratedData();
            //_typeField.EnumeratedData.Name = "Type Values";
            //_typeField.EnumeratedData.Values = _typeValues;

            int idx = 0;
            accessMetadataFields[idx++] = _typeField;
            accessMetadataFields[idx++] = _locationField;
            accessMetadataFields[idx++] = _descriptionField;
            accessMetadataFields[idx++] = _userField;
            accessMetadataFields[idx++] = _cardField;

            return accessEventDefinition;
        }
    /// <summary>
    /// Gets the schema object property.
    /// http://swagger.io/specification/#schemaObject
    /// </summary>
    /// <param name="field">The field.</param>
    /// <returns>String representation of the schema object with indentation</returns>
    private static string GetSchemaObjectProperty(MetadataField field)
    {
      string schemaObjectProperty = @"
      " + field.FieldName.ToLowerInvariant() + ":";

      // http://swagger.io/specification/ -> "Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4."
      switch (field.DataType)
      {
        case "decimal":
          schemaObjectProperty += @"
          type: number
          format: double";
          break;
        case "short":
          schemaObjectProperty += @"
          type: integer
          format: short signed 16 bit integer";
          break;
        default:
          schemaObjectProperty += @"
          type: " + field.DataType.ToLowerInvariant();
          break;
      }

      string description = field.Nullable ? "This property is nullable." : "This property is not nullable.";

      if (field.Deprecated)
      {
        description += " This property is deprecated.";
      }

      schemaObjectProperty += @"
          description: " + description;

      return schemaObjectProperty;
    }
示例#35
0
 private string GetStringValue(Record row, MetadataField fieldType)
 {
     StringField field = (StringField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }
示例#36
0
        private int GetIntValue(Record row, MetadataField fieldType, int defaultValue)
        {
            int? val = GetIntValue(row, fieldType);
            if (val.HasValue)
                return val.Value;

            return defaultValue;
        }
示例#37
0
 private int? GetIntValue(Record row, MetadataField fieldType)
 {
     IntegerField field = (IntegerField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }
示例#38
0
 /// <summary>
 /// Gets the value for the specified metadata field
 /// </summary>
 /// <param name="field">
 /// A <see cref="MetadataField"/> specifying which metadata value to retrieve.
 /// </param>
 /// <returns>
 /// A <see cref="Field"/> containing the actual data.
 /// </returns>
 public Field GetFieldByType(MetadataField field)
 {
     if (fieldMapping.ContainsKey(field))
         return GetFieldById(fieldMapping[field]);
     return null;
 }
    private static string GetParameterText(MetadataField field)
    {
      string description = field.Nullable ? "This property is nullable." : "This property is not nullable.";

      if (field.Deprecated)
      {
        description += " This property is deprecated.";
      }

      return GetParameterText(field.FieldName, "query", description, field.Required, field.DataType);
    }
示例#40
0
        private double? SelectFieldValue(MetadataField field)
        {
            double? result = null;

            MetadataModule module = _manager.GetModuleById(field.ModuleId);

            using (DbCommand cmd = _connection.CreateCommand())
            {
                cmd.CommandText = "SELECT " + field.Name + " FROM " + module.ModuleName + " WHERE PlowMachineId = '" + _plowMachineId.ToString() + "'" ;

                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (!reader.IsDBNull(0))
                        {
                            result = reader.GetDouble(0);
                        }
                    }
                }
            }

            return result;
        }