Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public bool ContainsDate(BrowserDate date)
 {
     if (Dates.Any(x => x.DateInt == date.DateInt))
     {
         return(true);
     }
     return(false);
 }
 private void OnSelectedDate()
 {
     if (Dates.Any())
     {
         var date = Dates.LastOrDefault();
         SelectDate = date != null?date.ToPersianDate("/") : string.Empty;
     }
 }
Beispiel #3
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (!Dates.Any())
            {
                yield return(new ValidationResult("The event must specify at least one date!"));
            }
            if (Prices.Select(p => p.CurrencyCode).Distinct().Count() > 1)
            {
                yield return(new ValidationResult("All event prices must use the same currency!"));
            }

            if (RegistrationBeginDate >= RegistrationEndDate)
            {
                yield return(new ValidationResult("The date must be greater than registration begin date!", new [] { nameof(RegistrationEndDate) }));
            }

            for (var i = 0; i < Dates.Count; i++)
            {
                if (Dates[i].BeginDate < RegistrationEndDate)
                {
                    yield return(new ValidationResult("The date must be greater than the registration end date!", new[] { nameof(Dates) + "[" + i + "]." + nameof(EventDateDTO.BeginDate) }));
                }
                if (Dates[i].BeginDate >= Dates[i].EndDate)
                {
                    yield return(new ValidationResult("The date must be greater than begin date!", new[] { nameof(Dates) + "[" + i + "]." + nameof(EventDateDTO.EndDate) }));
                }
            }

            for (var i = 0; i < Prices.Count; i++)
            {
                if (Prices[i].BeginDate < RegistrationBeginDate)
                {
                    yield return(new ValidationResult("The date is out of range of the registration dates!", new[] { nameof(Prices) + "[" + i + "]." + nameof(EventPriceDTO.BeginDate) }));
                }
                if (Prices[i].EndDate > RegistrationEndDate)
                {
                    yield return(new ValidationResult("The date is out of range of the registration dates!", new[] { nameof(Prices) + "[" + i + "]." + nameof(EventPriceDTO.EndDate) }));
                }
                if (Prices[i].BeginDate >= Prices[i].EndDate)
                {
                    yield return(new ValidationResult("The date must be greater than begin date!", new[] { nameof(Prices) + "[" + i + "]." + nameof(EventPriceDTO.EndDate) }));
                }
            }

            for (var i = 0; i < CancellationPolicies.Count; i++)
            {
                if (CancellationPolicies[i].BeginDate < RegistrationBeginDate)
                {
                    yield return(new ValidationResult("The date is out of range of the registration dates!", new[] { nameof(CancellationPolicies) + "[" + i + "]." + nameof(EventCancellationPolicyDTO.BeginDate) }));
                }
                if (CancellationPolicies[i].EndDate > RegistrationEndDate)
                {
                    yield return(new ValidationResult("The date is out of range of the registration dates!", new[] { nameof(CancellationPolicies) + "[" + i + "]." + nameof(EventCancellationPolicyDTO.EndDate) }));
                }
            }
        }
        private void ReloadData()
        {
            IsMultiple      = Dates.Count() > 1;
            IsNotMultiple   = Dates.Count() == 1;
            IsVisibleFooter = Dates.Count() == 0;

            if (Dates.Any())
            {
            }
        }
Beispiel #5
0
        public override void OnNavigatedTo(NavigationParameters parameters)
        {
            IsMultiple      = Dates.Count() > 1;
            IsNotMultiple   = Dates.Count() == 1;
            IsVisibleFooter = Dates.Count() == 0;

            if (Dates.Any())
            {
            }
        }
        private void SelectedDate(object date)
        {
            if (date == null)
            {
                return;
            }

            if (Dates.Any())
            {
                From          = Dates.OrderBy(d => d.Day).FirstOrDefault();
                Until         = Dates.OrderBy(d => d.Day).LastOrDefault();
                IsNextEnabled = Dates.Any() ? true : false;
            }
        }
Beispiel #7
0
 private void ControlAndInsertBody(DayOfWeek expectedDay)
 {
     // The expected day contains in the week for that month.
     if (Dates.Any(d => d.DayOfWeek == expectedDay))
     {
         var date = Dates.First(d => d.DayOfWeek == expectedDay);
         DateInWeek(date);
     }
     // The expected day don't exist in the week for that month.
     // Insert an "empty" day in the week.
     else
     {
         NoneDateInMonth();
     }
 }
Beispiel #8
0
        protected void SelectedDate(object date)
        {
            if (date == null)
            {
                return;
            }

            IsMultiple      = Dates.Count() > 1;
            IsNotMultiple   = Dates.Count() == 1;
            IsVisibleFooter = Dates.Count() == 0;

            if (Dates.Any())
            {
            }
        }
Beispiel #9
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary <string, object>(Events);

            var animation = Animation.ToJson();

            if (animation.Keys.Any())
            {
                options["animation"] = animation["animation"];
            }

            if (!string.IsNullOrEmpty(Culture))
            {
                options["culture"] = Culture;
            }

            if (!string.IsNullOrEmpty(Format))
            {
                options["format"] = Format;
            }

            if (ParseFormats.Any())
            {
                options["parseFormats"] = ParseFormats;
            }

            options["min"]      = Min;
            options["max"]      = Max;
            options["interval"] = Interval;

            if (Dates.Any())
            {
                options["dates"] = Dates;
            }

            writer.Write(Initializer.Initialize(Selector, "TimePicker", options));

            base.WriteInitializationScript(writer);
        }
Beispiel #10
0
        private void InsertFooter(DayOfWeek expectedDay)
        {
            // The day of the week don't exist in the month. Insert an empty day in the caledar.
            // For instance: If the first day of February is on a tuesday. The monday belongs to January.
            if (!Dates.Any(d => d.DayOfWeek == expectedDay))
            {
                EmptyDay();
                return;
            }

            var dateInWeek = Dates.First(d => d.DayOfWeek == expectedDay);  // The date of the week for this day of the week.

            if (CellInformation.ContainsKey(dateInWeek))
            {
                var c = CellInformation[dateInWeek];
                AddAnyContent(c.Text.ToString());
            }
            else
            {
                EmptyDay();
            }
        }
Beispiel #11
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary <string, object>(Events);

            var idPrefix = "#";

            if (IsInClientTemplate)
            {
                idPrefix = "\\" + idPrefix;
            }

            var animation = Animation.ToJson();

            if (animation.Keys.Any())
            {
                options["animation"] = animation["animation"];
            }

            if (ARIATemplate.HasValue())
            {
                options["ARIATemplate"] = ARIATemplate;
            }

            if (Culture.HasValue())
            {
                options["culture"] = Culture;
            }

            options["format"] = Format;

            if (ParseFormats.Any())
            {
                options["parseFormats"] = ParseFormats;
            }

            options["min"] = Min;
            options["max"] = Max;

            if (EnableFooter)
            {
                if (FooterId.HasValue())
                {
                    options["footer"] = new ClientHandlerDescriptor {
                        HandlerName = string.Format("$('{0}{1}').html()", idPrefix, FooterId)
                    };
                }
                else if (Footer.HasValue())
                {
                    options["footer"] = Footer;
                }
            }
            else
            {
                options["footer"] = EnableFooter;
            }

            if (Depth.HasValue())
            {
                options["depth"] = Depth;
            }

            if (Start.HasValue())
            {
                options["start"] = Start;
            }

            MonthTemplate.IdPrefix = idPrefix;

            var month = MonthTemplate.ToJson();

            if (month.Keys.Any())
            {
                options["month"] = month;
            }

            if (Dates.Any())
            {
                options["dates"] = Dates;
            }

            writer.Write(Initializer.Initialize(Selector, "DatePicker", options));

            base.WriteInitializationScript(writer);
        }
 public bool HasCandles()
 {
     return(Dates.Any());
 }
Beispiel #13
0
 public bool HasCandles() => Dates.Any( );