コード例 #1
0
ファイル: OptionDate.cs プロジェクト: mmassari/MagicConsole
 public OptionDate(string name, string description, DateTime?defaultValue, DateInputFormat format, DateTime?max, DateTime?min, params string[] aliases) :
     base(name, description, OptionType.Date, aliases)
 {
     DefaultValue       = defaultValue;
     Format             = format;
     ValidationMaxValue = max;
     ValidationMinValue = min;
 }
コード例 #2
0
        public static IHtmlString ToDateInput(string name,
                                              DateTime?value,
                                              string label  = null,
                                              bool required = false,
                                              DateInputFormat inputFormat = DateInputFormat.Date,
                                              FormStyle formStyle         = FormStyle.Horizontal)
        {
            var       date      = value.ToInputDate();
            InputType inputType = InputType.date;

            if (inputFormat == DateInputFormat.Month)
            {
                inputType = InputType.month;
                date      = value.Value.ToString("yyyy-MM");
            }
            var html = ToInput(name: name, value: date, type: inputType, label: label, required: required,
                               formStyle: formStyle);

            var retVal = MvcHtmlString.Create(value: html);

            return(retVal);
        }
コード例 #3
0
        protected OptionDate AddOptionDate(TOption type, string name, string description, DateTime defaultValue, DateInputFormat format, DateTime?max, DateTime?min, params string[] alias)
        {
            var opt = new OptionDate(name, description, defaultValue, format, max, min, alias);

            Options.Add(type, opt);
            return(opt);
        }
コード例 #4
0
 //public static IHtmlString ToInput(this DateTime value, string name, string label = null, bool required = false, FormStyle formStyle = FormStyle.Horizontal)
 //{
 //    return ViewUtils.ToInput(name: name, value: value, label: label, required: required, formStyle: formStyle);
 //}
 public static IHtmlString ToInput(this DateTime?value, string name, string label = null, DateInputFormat dateInputFormat = DateInputFormat.Date, bool required = false, FormStyle formStyle = FormStyle.Horizontal)
 {
     return(ViewUtils.ToDateInput(name: name, value: value, label: label, required: required, inputFormat: dateInputFormat, formStyle: formStyle));
 }