Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need advice- Automatic Scheduling App.

Status
Not open for further replies.

joshbula

Technical User
Nov 19, 2004
45
0
0
US
Hello,
I just need some general advice on where to start with this, and the general approach to take.

I'm using Asp.Net with Visual Basic & Sql Server.

I have Rooms and Performances. Each performance needs to be automatically scheduled into a Room. Each Room can only handle a performance of certain categories. Each room also has its own availability schedule. Each performance has several people, and each person could be in several performances so it needs to check that no person is scheduled more than once at the same time. Each performance could be anywhere between 5 and 20 minutes in length.

I'm just looking for general concepts on how this should be done... any advice on where to start in the planning process and a general description of the workflow for this automatic scheduler would be greatly appreciated. Or, if you know any 3rd-party controls that would do this, that might work as well.

Thanks!
...Josh
 
This would not be a job for ASP.NET. For this, I would create a windows service that calles stored proceudres. This way, you can schedule the job to run at any interval you want.
 
as for building out the code. I would recommend the book Domain Driven Design. This book details how to model your code after key concepts.

Scheduler
Room
Performance
People
Type of Performance

These (and other) concepts become objects within your code and they interact with one another. So you may end up with code in your service which looks like this
Code:
class Scheduler
{
   public void BookPerformance(Room room, Performance preformance)
   {
       if(room.IsAvailable(performance))
       {
           Schedule(room).For(performance);
       }
   }
}
you also mention a variety of different rules. i would build a rules engine. something like this
Code:
class ValidationResult
{
   public string ErrorMessage {get;set;}
   public bool IsValid {get;set;}
}

interface IValidator<T>
{
   ValidationResult validate(T item);
}

class RoomIsAvailableForDateValidator : IValidator<Room>
{
   public RoomIsAvailableForDateValidator(DateTime date)
   {
      this.date = date;
   }

   public ValidationResult validate(Room item)
   {
       var valid = room.IsAvailableOn(date);
       return new ValidationResult 
                {
                    IsValid = valid;
                    ErrorMessage = "...";
                };
   }
}


class RoomCanAccomodateTypeOfPerformaceValidator : IValidator<Room>
{
   public RoomCanAccomodateTypeOfPerformaceValidator (PreformanceType type)
   {
      this.type = type;
   }

   public ValidationResult validate(Room item)
   {
       var valid = room.CanAccommodate(type);
       return new ValidationResult 
                {
                    IsValid = valid;
                    ErrorMessage = "...";
                };
   }
}
now each rule is in a separate class and you can aggregate the rules together any way you want. This makes it easy to add/change rules.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks Jason, this gives me a lot of good ideas. Thanks for the book recommendation also, I'll check it out.
...Josh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top