private void GetValuesFromDateString(string dateString, PoolSchedule poolSchedule, DateType dateType)
        {
            Type   type           = poolSchedule.GetType();
            string dateTypeString = dateType.ToString();
            string year           = $"Year{dateTypeString}";
            string month          = $"Month{dateTypeString}";
            string day            = $"Day{dateTypeString}";
            int    iteration      = 1;

            foreach (var item in dateString.Split(null))
            {
                switch (iteration)
                {
                case 1:     //day
                    type.GetProperty(day).SetValue(poolSchedule, int.Parse(item));
                    break;

                case 2:     //month
                    if (monthHelper.CheckIfMonth(item))
                    {
                        type.GetProperty(month).SetValue(poolSchedule, monthHelper.GetMonthNumber(item));
                    }
                    break;

                case 3:     //year
                    type.GetProperty(year).SetValue(poolSchedule, int.Parse(item)); int.Parse(item);
                    break;
                }
                iteration++;
            }
        }
Exemple #2
0
        public static String formalizer(DateType X)
        {
            if (X == null)
            {
                return("Prvek nenalezen");
            }

            return(X.ToString());
        }
        protected override void OnParametersSet()
        {
            if (_oldType != DateType)
            {
                UpdateSetting("mode", DateType.ToString().ToLower());
                _oldType = DateType;
            }

            base.OnParametersSet();
        }
        protected override void OnAfterRender(bool firstRender)
        {
            if (firstRender)
            {
                js.SetupPicker(DotNetObjectReference.Create(this), _inputRef, DateType.ToString().ToLower(), EnableTime,
                               MakeStatic, IsInline);
            }

            base.OnAfterRender(firstRender);
        }
 public CsvFieldSchema Build()
 {
     return(new CsvFieldSchema()
     {
         Name = _fieldName,
         Number = _fieldNumber,
         DataType = _fieldDataType.ToString(),
         Nullable = _fieldNullable
     });
 }
Exemple #6
0
        protected override void InitOption(TagHelperContext context, TagHelperOutput output)
        {
            Options.AddIf(DateType.HasValue, "type", DateType.ToString().ToLower());
            Options.AddIf(Format.IsNotNullOrWhiteSpace(), "format", Format);
            Options.AddIf(IsRange, "range", true);

            Options.AddIf(Max.IsNotNullOrWhiteSpace(), "max", Max);
            Options.AddIf(Max.IsNotNullOrWhiteSpace(), "min", Min);
            Options.AddIf(Value.IsNotNullOrWhiteSpace(), "value", Value);

            base.InitOption(context, output);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DateObjectModel"/> class.
        /// </summary>
        /// <param name="aDateType">
        /// Type of Date
        /// </param>
        /// <param name="aCFormat">
        /// a c format.
        /// </param>
        /// <param name="aDualDated">
        /// if set to <c>true</c> [a dual dated].
        /// </param>
        /// <param name="aNewYear">
        /// a new year.
        /// </param>
        /// <param name="aQuality">
        /// a quality.
        /// </param>
        /// <param name="aStart">
        /// a start.
        /// </param>
        /// <param name="aStop">
        /// a stop.
        /// </param>
        /// <param name="aVal">
        /// a value.
        /// </param>
        /// <param name="aValType">
        /// Type of Val date.
        /// </param>
        public DateObjectModel(DateType aDateType, string aCFormat, bool aDualDated, string aNewYear, string aQuality, string aStart, string aStop, string aVal, string aValType)
        {
            // Setup defaults
            GCformat   = aCFormat;
            GDualdated = aDualDated;
            GNewYear   = aNewYear;
            GQuality   = aQuality;
            GStart     = aStart;
            GStop      = aStop;
            GVal       = aVal;
            GType      = aDateType;
            GValType   = aValType;

            // Setup specifics
            switch (aDateType)
            {
            case DateType.Range:
            {
                DateObjectModelRange(aCFormat, aDualDated, aNewYear, aQuality, aStart, aStop, aVal);
                break;
            }

            case DateType.Span:
            {
                DateObjectModelSpan(aCFormat, aDualDated, aNewYear, aQuality, aStart, aStop, aVal);
                break;
            }

            case DateType.Str:
            {
                DateObjectModelStr(aVal);
                break;
            }

            case DateType.Val:
            {
                DateObjectModelVal(aValType);
                break;
            }

            default:
            {
                DataStore.CN.NotifyError("Bad DateEnum: " + aDateType.ToString());
                break;
            }
            }
        }
        public async Task <IEnumerable <USHolidaysAndTradingDatesResponse> > USHolidaysAndTradingDatesAsync(DateType type, DirectionType direction = DirectionType.Next, int last = 1, DateTime?startDate = null)
        {
            const string urlPattern = "ref-data/us/dates/[type]/[direction]/[last]/[startDate]";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _pk);

            var pathNvc = new NameValueCollection
            {
                { "type", type.ToString().ToLower() },
                { "direction", direction.ToString().ToLower() },
                { "last", last.ToString() },
                { "startDate", startDate == null?DateTime.Now.ToString("yyyyMMdd") : ((DateTime)startDate).ToString("yyyyMMdd") }
            };

            return(await _executor.ExecuteAsyncLegacy <IEnumerable <USHolidaysAndTradingDatesResponse> >(urlPattern, pathNvc, qsb));
        }
 internal static string GetFormattedDateFrom(DateType dateTypeFormat)
 => DateTime.Now.ApplyFormat(dateTypeFormat.ToString().ToLower());
 private void AssertDateType(DateType date, string expectedValue, string message)
 {
     Assert.IsNotNull(date, message);
     Assert.AreEqual(expectedValue, date.ToString(), message);
 }
Exemple #11
0
 public bool Find(string toFind)
 {
     return(DateType.ToString() == toFind ||
            Date1.ToString() == toFind);
 }
 public static XElement Serialize(this DateType value, string name)
 {
     return(value != null ? new XElement(UblNames.Cbc + name, value.ToString()) : null);
 }