Пример #1
0
 /// <summary>
 /// Adds the specified name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 public void Add(string name, DateRange?value)
 {
     if (value.HasValue)
     {
         Add(name, value.Value);
     }
 }
Пример #2
0
    static FileName Build(FileName UndatedName, Date?CreatedDate, DateRange?ContentDate)
    {
        if (not(CreatedDate.HasValue) && not(ContentDate.HasValue))
        {
            return(UndatedName);
        }

        if (CreatedDate.HasValue)
        {
            if (not(ContentDate.HasValue))
            {
                return(new FileName($"{CreatedDate.Value.ToIsoString()}.{UndatedName}"));
            }

            Date min = ContentDate.Value.Min;
            Date max = ContentDate.Value.Max;
            if (min == max)
            {
                return(new FileName($"{CreatedDate.Value.ToIsoString()}.{UndatedName.RemoveExtension()}.{min.ToIsoString()}", UndatedName.Extension));
            }
            return(new FileName($"{CreatedDate.Value.ToIsoString()}.{UndatedName.RemoveExtension()}.{min.ToIsoString()}.{max.ToIsoString()}", UndatedName.Extension));
        }
        else
        {
            Date min = ContentDate.Value.Min;
            Date max = ContentDate.Value.Max;
            if (min == max)
            {
                return(new FileName($"{UndatedName.RemoveExtension()}.{min.ToIsoString()}", UndatedName.Extension));
            }
            return(new FileName($"{UndatedName.RemoveExtension()}.{min.ToIsoString()}.{max.ToIsoString()}", UndatedName.Extension));
        }
    }
Пример #3
0
    public int CompareTo(DateRange?other)
    {
        int result = Start.CompareTo(other?.Start ?? DateTimeOffset.MaxValue);

        if (result != 0)
        {
            result = End.CompareTo(other?.End ?? DateTimeOffset.MaxValue);
        }
        return(result);
    }
        public PaginatedResult <FlatOffer> Get(
            FlatType?flatType,
            int?minFlatSize,
            int?numberOfRooms,
            decimal?maxPrice,
            DateRange?dateAdded,
            DateRange?dateRemoved,
            QueryPagination pagination)
        {
            var query = _dbContext.FlatOffers.AsQueryable();

            if (flatType.HasValue)
            {
                query = query.Where(x => x.FlatType == flatType.Value);
            }

            if (minFlatSize.HasValue)
            {
                query = query.Where(x => x.FlatSize >= minFlatSize.Value);
            }

            if (numberOfRooms.HasValue)
            {
                query = query.Where(x => x.NumberOfRooms == numberOfRooms.Value);
            }

            if (maxPrice.HasValue)
            {
                query = query.Where(x => x.Price <= maxPrice.Value);
            }

            if (dateAdded.HasValue)
            {
                query = query.WhereDateWithinRange(x => x.DateAdded, dateAdded.Value);
            }

            if (dateRemoved.HasValue)
            {
                query = query.WhereDateWithinRange(x => x.DateRemoved, dateRemoved.Value);
            }

            return(query
                   .Include(x => x.Links)
                   .Include(x => x.Notifications)
                   .Where(x => x.DateRemoved == null || x.Notifications.Any(y => !y.Viewed))
                   .ToPaginated(pagination));
        }
Пример #5
0
 public void Update(DateRange?other)
 {
     if (other is null)
     {
         return;
     }
     if (Start != other.Start)
     {
         Start = other.Start;
         OnPropertyChanged(nameof(Start));
     }
     if (End != other.End)
     {
         End = other.End;
         OnPropertyChanged(nameof(End));
     }
 }
Пример #6
0
 /// <summary>
 /// Gets the value.
 /// </summary>
 /// <param name="range">The range.</param>
 /// <returns></returns>
 public static DateRange GetValue(DateRange?range)
 {
     return((range.HasValue) ? range.Value : Empty);
 }
Пример #7
0
 public bool DeepEquals(DateRange?other)
 {
     return(other is not null &&
            Start == other.Start &&
            End == other.End);
 }
 public void Apply(MeetingScheduled @event)
 {
     Occurs = @event.Occurs;
 }
Пример #9
0
        public static void AddParameter(this Dictionary <string, string> dictionary, string key, DateRange?value)
        {
            if (!value.HasValue)
            {
                return;
            }

            dictionary.Add(key, string.Join(ParameterListSeparator, value.Value.StartDate, value.Value.EndDate));
        }
Пример #10
0
 public bool Equals(DateRange?other) => TimeRange.Equals(other?.TimeRange);
Пример #11
0
 public bool Equals(DateRange?other) => other?.Equals(this) == true;
 protected virtual void OnDateRangeChanged(DateRange?e)
 {
     DateRangeChanged?.Invoke(this, e);
 }
 public TimeSheetCompletedEventArgs(TimeSpan workContract, DateRange?dateRange = null)
 {
     WorkContract = workContract;
     DateRange    = dateRange;
 }
        //search method for description of transaction
        public ActionResult SearchResults(string SearchString, int?SelectedTransaction, string Description, decimal?Amount, decimal?Amount1, decimal?Amount2, int?TransactionNumber, DateTime?Date, DateTime?CustomDateRange1, DateTime?CustomDateRange2, AmountRange?SelectedAmountRange, DateRange?SelectedDateRange)
        {
            DateTime TimeStamp     = DateTime.Now;
            DateTime DateForPast15 = DateTime.Now.AddDays(-15);
            DateTime DateForPast30 = DateTime.Now.AddDays(-30);
            DateTime DateForPast60 = DateTime.Now.AddDays(-60);
            //create variable
            var query = from t in db.TransactionsDbSet select t;

            //code for searching descriiption
            if (SearchString == null || SearchString == "")
            {
            }
            else
            {
                ViewBag.SearchString = "Search string is " + SearchString;
                query = query.Where(t => t.Description.Contains(SearchString));
            }

            //transaction type search criteria
            if (SelectedTransaction != 0)
            {
                query = query.Where(t => t.TransactionID == SelectedTransaction);
            }
            else
            {
            }

            //amount search criteria
            if ((Amount == null || Amount.ToString() == ""))
            {
            }
            else if (SelectedAmountRange == AmountRange.A)
            {
                query = query.Where(t => t.Amount >= 0 && t.Amount <= 100);
            }
            else if (SelectedAmountRange == AmountRange.B)
            {
                query = query.Where(t => t.Amount > 100 && t.Amount <= 200);
            }
            else if (SelectedAmountRange == AmountRange.C)
            {
                query = query.Where(t => t.Amount > 200 && t.Amount <= 300);
            }
            else if (SelectedAmountRange == AmountRange.D)
            {
                query = query.Where(t => t.Amount > 300);
            }
            else
            {
                query = query.Where(t => t.AmountStart >= Amount1);
                query = query.Where(t => t.AmountEnd <= Amount2);
            }
            //TO DO: connect enum and custom amount entry
            query = query.OrderBy(t => t.TransactionNumber).ThenBy(t => t.Amount);

            //date search criteria
            //if ((Date == null || Date.ToString() == ""))
            //{
            //}
            //else if (SelectedDateRange == DateRange.last15days)
            //{
            //    query = query.Where(t => t.TimeStamp <= t.DateForPast15);
            //}
            //else if (SelectedDateRange == DateRange.last30days)
            //{
            //    query = query.Where(t => t.TimeStamp <= t.DateForPast30);
            //}
            //else if (SelectedDateRange == DateRange.last60days)
            //{
            //    query = query.Where(t => t.TimeStamp <= t.DateForPast60);
            //}
            //else
            //{
            //    query = query.Where(t => t.CustomDateRangeStart >= CustomDateRange1);
            //    query = query.Where(t => t.CustomDateRangeEnd <= CustomDateRange2);
            //}

            query = query.OrderBy(t => t.TransactionNumber).ThenBy(t => t.Amount);

            List <Transaction> SelectedTransactions = query.ToList();

            ViewBag.All      = db.TransactionsDbSet.ToList().Count;
            ViewBag.Returned = SelectedTransactions.Count;

            return(View("Index", SelectedTransactions));
        }