コード例 #1
0
        public static string GenerateName(NameConventions forcedType)
        {
            while (forcedType == NameConventions.UNKNOWN)
            {
                forcedType = EnumUtility.GetRandomEnumValue <NameConventions>();
            }

            switch (forcedType)
            {
            case NameConventions.COMPOUND:
                return(GetCompoundName());

            case NameConventions.GROUP:
                return(GetGroupName());

            case NameConventions.POINT_OF_INTEREST:
                return(GetPointOfInterestName());

            case NameConventions.TERRITORY:
                return(GetTerritoryName());

            default:
                return("ERROR");
            }
        }
コード例 #2
0
        private void InitializeBehaviour()
        {
            var entityTitle = NameConventions.MakeTitle(entity.Title, "Formulário");
            var actionTitle = NameConventions.MakeTitle(action.Title, action.Name);

            Icon = Resources.FormEdit.ToIcon();
            Text = $"{entityTitle} - {actionTitle}";

            foreach (Field field in action.Fields)
            {
                var title = NameConventions.MakeTitle(field.Title, field.Name);
                var value = field.Value;

                var widget = WidgetFactory.CreateWidget(field.Type);

                widget._CopyFrom(field);

                widget.Title         = title;
                widget.Control.Tag   = field;
                widget.Control.Width = 200;

                if (widget is SubmitWidget button)
                {
                    button.Click += async(o, e) =>
                    {
                        pnContent.Enabled = false;
                        try
                        {
                            await SubmitAsync();
                        }
                        finally
                        {
                            pnContent.Enabled = true;
                        }
                    };
                }
                if (field.ReadOnly == true)
                {
                    widget.Control.TabStop = false;
                }

                pnContent.Controls.Add(widget.Control);
            }
        }
コード例 #3
0
ファイル: DataPaper.cs プロジェクト: keepingcode/paper
        private void InitializeBehaviour()
        {
            Icon = Resources.FormData.ToIcon();
            Text = NameConventions.MakeTitle(entity.Title, "Formulário");

            var properties =
                from property in entity.Properties
                where !property.Name.StartsWith("_") &&
                !(property.Value is PropertyCollection)
                select property;

            foreach (Property property in properties)
            {
                var header      = entity.FindHeader(property.Name, Rel.Data);
                var headerTitle = header.Properties["title"]?.Value?.ToString();

                IWidget widget = new InfoWidget();
                widget.Title         = headerTitle ?? property.Name.ChangeCase(TextCase.ProperCase);
                widget.Value         = property.Value;
                widget.Control.Width = 200;
                pnContent.Controls.Add(widget.Control);
            }
        }
コード例 #4
0
 public override string GetComponentColumnPrefix(Member member)
 {
     return(string.Format("{0}_", NameConventions.GetTableName(member.PropertyType)));
 }
コード例 #5
0
        public void TableNameTest()
        {
            string tableName = NameConventions.GetTableName(typeof(ChainSelection));

            Assert.Equal("CHAIN_SELECTION", tableName);
        }
コード例 #6
0
        public void PrimaryKeyColumnNameTest()
        {
            string primaryKeyColumnName = NameConventions.GetPrimaryKeyColumnName(typeof(ChainSelection));

            Assert.Equal("CHAIN_SELECTION_ID", primaryKeyColumnName);
        }
コード例 #7
0
        public void SequenceNameTest()
        {
            string sequenceName = NameConventions.GetSequenceName(typeof(ChainSelection));

            Assert.Equal("CHAIN_SELECTION_SEQ", sequenceName);
        }