Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 982077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:38:24+00:00 2026-05-16T04:38:24+00:00

I’ve been trying to figure out the best way to model this entity, and

  • 0

I’ve been trying to figure out the best way to model this entity, and I’m getting stuck. Here’s the basic use case/story:

We have equipment arriving on site. We won’t know what the equipment is until it arrives. Once the equipment arrives on site it must be recorded as having arrived and whether it was idle or active. If it is active the user must make note of the work the equipment performed. When the equipment leaves the site, this must be noted.

I should be able to easily query whether there is any equipment on the site, what equipment was previously on site, etc.

I’m getting stuck on the date aspect. I’m trying to avoid relying on a cron job to run through and mark equipment as idle if it hasn’t been marked idle on a paticular date. It feels like there should be a way to do this. Here’s what I’ve come up with:

public class Equipment {
    public int Id { get; set; }
    public Site Site { get; set; }
    public DateTime Arrival { get; set; }
    public DateTime Departure { get; set; }
    public IList<EquipmentUtilization> EquipmentUtilizations { get; set; }
}

public class EquipmentUtilization {
    public int Id { get; set; }
    public Equipment Equipment { get; set; }
    public DateTime ReportDate { get; set; }
    public string WorkPerformed { get; set; }
}

The idea being that I could run a query like Site.Equipment.Where(x=>x.Departure == null) to see which equipment is still on site. If there’s no EquipmentUtilization for a particular date, it is assume do be idle. I could then setup a DateTimeEnumerator:

public class DateTimeEnumerator : System.Collections.IEnumerable
{
    private DateTime begin;
    private DateTime end;

    public DateTimeEnumerator ( DateTime begin , DateTime end ) 
    {            
        this.begin = begin;
        this.end = end;
    }
    public System.Collections.IEnumerator GetEnumerator()
    {
        for(DateTime date = begin; date < end; date = date.AddDays(1))
        {
            yield return date;
        }
    }
}

Build a list of dates from the arrival date until DateTime.Now or DepatureDate if that is not null. For some reason this seems ugly. Should I put the DateTime enumerator inside by Equipment object? It feels like this should all be together or done in some different manner, though this does work if I run it. Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:38:25+00:00Added an answer on May 16, 2026 at 4:38 am

    If I understand you correctly, you seek a way to determine what equipment is idle at a given site on a given date based on the captured equipmentutilization objects associated with your Equipment (perhaps EquipmentResidency is a better name?) collection.

    As you want to avoid creating equipmentutilization objects for idle days (I agree that could be significant maintenance), how about adding a isIdleOn(Date) method to the equipmentutilization class that returns true if the passed Date matches the captured ReportDate and false if it does not?

    The associated query would be something along the lines of Site.Equipment.Where(x=>x.equipmentutilization.isIdleOn(date) == true)

    Not sure if I have the syntax right, but just a suggestion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.