当前位置: 首页>>代码示例>>C#>>正文


C# DataType.GetLocalization方法代码示例

本文整理汇总了C#中DataType.GetLocalization方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.GetLocalization方法的具体用法?C# DataType.GetLocalization怎么用?C# DataType.GetLocalization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataType的用法示例。


在下文中一共展示了DataType.GetLocalization方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowOrHideSettingsByType

        void ShowOrHideSettingsByType(DataType selectedType)
        {
            cboFieldType.Visible = selectedType.IsUserDefinedField;
            lblType.Visible = !selectedType.IsUserDefinedField;
            chkRequired.Visible = selectedType.IsUserDefinedField;
            imgRequired.Visible = !selectedType.IsUserDefinedField;
            chkSearchable.Visible = selectedType.SupportsSearch;
            lblSearchable.Visible = selectedType.SupportsSearch;
           

            if (selectedType.SupportsDefaultValue)
            {
                panDefault.Visible = true;
                DefaultLabel.Text = selectedType.GetLocalization("DefaultValue").AsString(DefaultLabel.Text);
                DefaultLabel.HelpText = selectedType.GetLocalization("DefaultValue.Help").AsString(DefaultLabel.HelpText);
            }
            else
            {
                panDefault.Visible = false;
            }

            if (selectedType.SupportsInputSettings)
            {
                panInputSettings.Visible = true;
                var selectionSource = selectedType.InputSettingsList;
                if (selectionSource == null)
                {
                    txtInputSettings.Visible = true;
                    cboInputSettings.Visible = false;
                }
                else
                {
                    cboInputSettings.DataSource = selectionSource;
                    var currValue = cboInputSettings.SelectedValue;
                    cboInputSettings.DataBind();
                    if (currValue != "" && cboInputSettings.Items.FindByValue(currValue) != null)
                    {
                        cboInputSettings.SelectedValue = currValue;
                    }
                    else
                    {
                        cboInputSettings.SelectedValue = selectedType.InputSettingDefault;
                    }
                    txtInputSettings.Visible = false;
                    cboInputSettings.Visible = true;
                }
                InputSettingsLabel.Text = selectedType.GetLocalization("InputSetting").AsString(InputSettingsLabel.Text);
                InputSettingsLabel.HelpText =
                    selectedType.GetLocalization("InputSetting.Help").AsString(InputSettingsLabel.HelpText);
                rblListType.Visible = selectedType.InputSettingsIsValueList;
            }
            else
            {
                panInputSettings.Visible = false;
            }

            if (selectedType.SupportsOutputSettings)
            {
                panOutputSettings.Visible = true;
                OutputSettingsLabel.Text = selectedType.GetLocalization("OutputSetting").AsString(OutputSettingsLabel.Text);
                OutputSettingsLabel.HelpText =
                    selectedType.GetLocalization("OutputSetting.Help").AsString(OutputSettingsLabel.HelpText);
            }
            else
            {
                panOutputSettings.Visible = false;
            }

            if (selectedType.SupportsNormalizeFlag)
            {
                panNormalizeFlag.Visible = true;
                NormalizeFlagLabel.Text = selectedType.GetLocalization("NormalizeFlag").AsString(NormalizeFlagLabel.Text);
                NormalizeFlagLabel.HelpText =
                    selectedType.GetLocalization("NormalizeFlag.Help").AsString(NormalizeFlagLabel.HelpText);
            }
            else
            {
                panNormalizeFlag.Visible = false;
            }

            if (selectedType.SupportsMultipleValues)
            {
                panMultipleValues.Visible = true;
                MultipleValuesLabel.Text = selectedType.GetLocalization("MultipleValues").AsString(MultipleValuesLabel.Text);
                MultipleValuesLabel.HelpText =
                    selectedType.GetLocalization("MultipleValues.Help").AsString(MultipleValuesLabel.HelpText);
            }
            else
            {
                panMultipleValues.Visible = false;
            }
            panShowOnEdit.Visible = selectedType.SupportsHideOnEdit;
            if (selectedType.SupportsHideOnEdit )
            {
                ShowOnEditLabel.Text = selectedType.GetLocalization("HideOnEdit").AsString(ShowOnEditLabel.Text);
                ShowOnEditLabel.HelpText  = selectedType.GetLocalization("HideOnEdit.Help").AsString(ShowOnEditLabel.HelpText);
            }
            panEditStyle.Visible = selectedType.SupportsEditStyle;
            panValidationRule.Visible = selectedType.SupportsValidation;
            panValidationMessage.Visible = selectedType.SupportsValidation;
//.........这里部分代码省略.........
开发者ID:DNNCommunity,项目名称:DNN.FormAndList,代码行数:101,代码来源:Field.ascx.cs

示例2: CheckCast

        void CheckCast(DataType newType)
        {
            var formerType = DataType.ByName(DataSource[FieldsTableColumn.Type].AsString("String"));
           
                var allowedCasts = formerType.SupportedCasts.Split("|".ToCharArray());
                if (allowedCasts.Any(n => newType.Name  == n))
                {
                    return;
                }
            // Cast is not allowed, now we need to check whether data already exists for that column
            var fieldId = DataSource[FieldsTableColumn.Id].AsInt();
            if (new UserDefinedTableController(ModuleContext).FieldHasData(fieldId))
                {
                    var message = LocalizeString("UnsupportedCast.ErrorMessage")
                            .AsString("You have changed the fieldtype for {2} from {0} to {1}. Note that this may cause an error");

                    var title = new PortalSecurity().InputFilter(txtFieldTitle.Text.Trim(), PortalSecurity.FilterFlag.NoScripting);
                    message = string.Format(message, formerType.GetLocalization(),
                                           newType.GetLocalization(), title);
                    ShowWarning(message);
                }
        }
开发者ID:DNNCommunity,项目名称:DNN.FormAndList,代码行数:22,代码来源:Field.ascx.cs


注:本文中的DataType.GetLocalization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。