コード例 #1
0
        /// <summary>
        /// Устанавливает настройки по-умолчанию для редактора даты.
        /// </summary>
        /// <param name="settings">Настройки.</param>
        /// <param name="token">Токен безорпасности.</param>
        /// <param name="useTime">Параметр использования времени.</param>
        public static void SetDefaultSettings(this DateEditSettings settings, SecurityToken token, bool useTime = false)
        {
            settings.Width = Unit.Percentage(100);
            settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithTooltip;
            settings.ShowModelErrors = true;

            SetDefaultProperties(settings.Properties, token, useTime);
        }
コード例 #2
0
ファイル: BaseClasses.cs プロジェクト: dolmaza/MyBook
        public DateEditSettings GenerateDateEditDefaultSettings(DateEditSettings settings)
        {
            settings.Properties.UseMaskBehavior  = true;
            settings.Properties.EditFormat       = EditFormat.Custom;
            settings.Properties.EditFormatString = Resources.FormatDate;
            settings.Properties.TimeSectionProperties.Visible = true;
            settings.Properties.TimeSectionProperties.TimeEditProperties.EditFormatString = Resources.FormatTime;
            settings.Date  = DateTime.Now;
            settings.Width = Unit.Percentage(100);

            return(settings);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="controlSetting"></param>
        /// <returns></returns>
        public static MvcHtmlString IvsDateTime(this HtmlHelper helper, ControlSetting controlSetting)
        {
            settings = new DateEditSettings();
            settings.ControlStyle.HorizontalAlign = controlSetting.HAlignment;
            settings.ControlStyle.VerticalAlign   = controlSetting.VAlignment;
            settings.Enabled = controlSetting.Enabled;
            settings.Name    = controlSetting.Name;
            settings.Properties.DisplayFormatString = controlSetting.FormatString;
            settings.Properties.EditFormatString    = controlSetting.FormatString;
            if (controlSetting.MaxLength > 0)
            {
                settings.Properties.MaxLength = controlSetting.MaxLength;
            }
            settings.Properties.NullText            = controlSetting.NullText;
            settings.Properties.EnableClientSideAPI = true;
            settings.Properties.AllowNull           = controlSetting.AllowNull;
            settings.Properties.AllowUserInput      = controlSetting.AllowInput;

            //generate regular input without table


            switch (controlSetting.DateTimeFormat)
            {
            case DateTimeFormat.Date:
                settings.Properties.EditFormat = EditFormat.Date;
                break;

            case DateTimeFormat.DateTime:
                settings.Properties.EditFormat = EditFormat.DateTime;
                break;

            case DateTimeFormat.Time:
                settings.Properties.EditFormat = EditFormat.Time;
                break;

            case DateTimeFormat.Custom:
                settings.Properties.EditFormat = EditFormat.Custom;
                break;

            default:
                settings.Properties.EditFormat = EditFormat.Date;
                break;
            }

            settings.ReadOnly = controlSetting.ReadOnly;
            settings.TabIndex = controlSetting.TabIndex;
            settings.ToolTip  = controlSetting.ToolTip;
            settings.Width    = controlSetting.Width;

            new DateEditExtension(settings, helper.ViewContext).Bind(controlSetting.Value).Render();
            return(MvcHtmlString.Empty);
        }
コード例 #4
0
        private static BaseEditSettings CreateEditorSettings(DataField field)
        {
            var flag     = field.FieldType.IsNullable();
            var trueType = field.FieldType.GetNonNullableType();

            BaseEditSettings settings;

            if (!string.IsNullOrEmpty(field.LookupCode))
            {
                settings = new CustomLookUpEditSettings {
                    LookUpCodeEditor = field.LookupCode, ImmediatePopup = true
                };
            }
            else if (trueType == typeof(DateTime))
            {
                settings = new DateEditSettings
                {
                    MaskUseAsDisplayFormat = true,
                    AllowNullInput         = flag,
                    Mask = field.DisplayFormat
                }
            }
            ;
            else if (trueType == typeof(Boolean))
            {
                settings = new CheckEditSettings {
                    IsThreeState = flag
                }
            }
            ;
            else
            {
                IValueConverter valueConverter;
                settings = DataField.TryGetFieldProperties(field, ValueDataFieldConstants.BindingIValueConverter, false, out valueConverter)
                    ? new CustomTextEditSettings()
                {
                    Converter = valueConverter, ValidateOnTextInput = false
                }
                    : new TextEditSettings();
            }

            settings.DisplayFormat        = field.DisplayFormat;
            settings.DisplayTextConverter = field.DisplayTextConverter;
            return(settings);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static MvcHtmlString IvsDateTime(this HtmlHelper helper, string name, object value)
        {
            settings = new DateEditSettings();
            settings.ControlStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            settings.ControlStyle.VerticalAlign   = System.Web.UI.WebControls.VerticalAlign.Middle;
            settings.Enabled  = true;
            settings.Name     = name;
            settings.ReadOnly = false;
            settings.Width    = Data.DefaultWidth;
            settings.Properties.EnableClientSideAPI = true;
            settings.Properties.AllowNull           = true;
            settings.Properties.AllowUserInput      = true;
            settings.Properties.EditFormat          = EditFormat.Date;

            //generate regular input without table

            new DateEditExtension(settings, helper.ViewContext).Bind(value).Render();
            return(MvcHtmlString.Empty);
        }
コード例 #6
0
ファイル: GridBrowser.cs プロジェクト: schifflee/bcephal2
        protected virtual void setColumnEditSettings(GridColumn column, GrilleColumn grilleColumn, bool readOnly = false)
        {
            if (grilleColumn.type.Equals(ParameterType.MEASURE.ToString()))
            {
                TextEditSettings settings = new TextEditSettings();
                settings.DisplayFormat       = "N2";
                settings.ValidateOnTextInput = true;
                settings.AllowNullInput      = true;
                column.EditSettings          = settings;
            }

            if (!this.Grille.report && grilleColumn.type.Equals(ParameterType.SCOPE.ToString()))
            {
                try
                {
                    grilleColumn.values = Service.ModelService.getLeafAttributeValues(grilleColumn.valueOid.Value);
                }
                catch (Exception) { }
                ComboBoxEditSettings combo = new ComboBoxEditSettings();
                combo.ItemsSource         = grilleColumn.Items;
                combo.IsTextEditable      = true;
                combo.ShowText            = true;
                combo.ValidateOnTextInput = true;
                combo.AllowNullInput      = true;
                column.EditSettings       = combo;
            }
            else if (!this.Grille.report && grilleColumn.type.Equals(ParameterType.PERIOD.ToString()))
            {
                DateEditSettings dateSetting = new DateEditSettings();
                dateSetting.IsTextEditable      = true;
                dateSetting.ShowText            = true;
                dateSetting.ValidateOnTextInput = true;
                dateSetting.AllowNullInput      = true;
                column.EditSettings             = dateSetting;
            }
        }
コード例 #7
0
 public FmDateGridColumn()
 {
     EditSettings = new DateEditSettings();
 }
コード例 #8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            var column = (GridColumnVm)value;

            object editor = null;

            switch (column.GridColumnType)
            {
            case GridColumnType.String:
                var editorTextEdit = new TextEditSettings();
                editorTextEdit.TextWrapping = System.Windows.TextWrapping.WrapWithOverflow;
                ReflectionUtils.SetProperty(editorTextEdit, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Center);
                editor = editorTextEdit;
                break;

            case GridColumnType.Int:
            case GridColumnType.Decimal:
                var columnSetting = column.ColumnSetting as SpinColumnSetting;
                var editor1       = new SpinEditSettings();
                ReflectionUtils.SetProperty(editor1, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Right);
                if (columnSetting != null)
                {
                    editor1.Mask = columnSetting.Mask;
                }
                NumericMaskOptions.SetAlwaysShowDecimalSeparator(editor1, false);
                editor1.MaskUseAsDisplayFormat = true;
                editor = editor1;
                break;

            case GridColumnType.Date:
                break;

            case GridColumnType.DateTime:
                var dateColumnSetting = column.ColumnSetting as DateColumnSetting;
                var dateEditor        = new DateEditSettings();
                if (dateColumnSetting == null)
                {
                    dateColumnSetting = new DateColumnSetting();
                    if (column.GridColumnType == GridColumnType.Date)
                    {
                        dateColumnSetting.Mask = "yyyy-MM-dd";
                    }
                    else
                    {
                        dateColumnSetting.Mask = "yyyy-MM-dd HH:mm:ss";
                    }
                }
                dateEditor.Mask = dateColumnSetting.Mask;
                dateEditor.MaskUseAsDisplayFormat = true;
                ReflectionUtils.SetProperty(dateEditor, "HorizontalContentAlignment", EditSettingsHorizontalAlignment.Left);
                editor = dateEditor;
                break;

            case GridColumnType.Enum:
            case GridColumnType.Combo:
                var comboColumnSetting = column.ColumnSetting as ComboBoxColumnSetting;
                if (comboColumnSetting == null)
                {
                    editor = new TextEditSettings();
                    break;
                }
                var enumEditor           = new ComboBoxEditSettings();
                var comboBoxEditSettings = new ComboBoxEditSettings();
                comboBoxEditSettings.ItemsSource = comboColumnSetting.ItemsSource;
                comboBoxEditSettings.HorizontalContentAlignment = EditSettingsHorizontalAlignment.Center;
                if (!string.IsNullOrWhiteSpace(comboBoxEditSettings.ValueMember))
                {
                    comboBoxEditSettings.ValueMember = comboColumnSetting.ValueMember;
                }
                if (!string.IsNullOrWhiteSpace(comboBoxEditSettings.DisplayMember))
                {
                    comboBoxEditSettings.DisplayMember = comboColumnSetting.DisplayMember;
                }
                editor = comboBoxEditSettings;
                break;

            case GridColumnType.Bool:
                editor = new CheckEditSettings {
                    IsThreeState = false, NullValue = false
                };
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(editor);
        }