public ReservationDurations(IEnumerable <IReservation> reservations, IEnumerable <ICost> costs, DateTime sd, DateTime ed) { var dateRange = DateRange.ExpandRange(reservations, sd, ed); var items = ReservationDateRangeItem.GetReservationDateRangeItems(reservations, costs); var range = new ReservationDateRange(items, dateRange); CreateItems(range); }
public static ReservationDateRangeItem Create(int reservationId, int resourceId, string resourceName, int procTechId, string procTechName, int clientId, string username, string lname, string fname, int activityId, string activityName, int accountId, string accountName, string shortCode, int chargeTypeId, bool isActive, bool isStarted, DateTime beginDateTime, DateTime endDateTime, DateTime?actualBeginDateTime, DateTime?actualEndDateTime, DateTime lastModifiedOn, DateTime?cancelledDateTime, double chargeMultiplier, IEnumerable <ICost> costs) { // we need to truncate dates to remove milliseconds or else we end up with very small // transfer durations (the difference between charged and utilized durations) var truncatedCancelledDateTime = Utility.Truncate(cancelledDateTime); var truncatedBeginDateTime = Utility.Truncate(beginDateTime); var truncatedEndDateTime = Utility.Truncate(endDateTime); var truncatedActualBeginDateTime = Utility.Truncate(actualBeginDateTime); var truncatedActualEndDateTime = Utility.Truncate(actualEndDateTime); bool isCancelledBeforeCutoff = Reservations.GetIsCancelledBeforeCutoff(truncatedCancelledDateTime, truncatedBeginDateTime); IResourceCost cost = ResourceCost.CreateResourceCosts(costs.Where(c => (c.RecordID == resourceId || c.RecordID == 0) && c.ChargeTypeID == chargeTypeId)).FirstOrDefault(); var chargeBeginDateTime = (truncatedActualBeginDateTime.HasValue && truncatedActualBeginDateTime < truncatedBeginDateTime) ? truncatedActualBeginDateTime.Value : truncatedBeginDateTime; var chargeEndDateTime = (truncatedActualEndDateTime.HasValue && truncatedActualEndDateTime > truncatedEndDateTime) ? truncatedActualEndDateTime.Value : truncatedEndDateTime; var item = new ReservationDateRangeItem { ReservationID = reservationId, ResourceID = resourceId, ResourceName = resourceName, ProcessTechID = procTechId, ProcessTechName = procTechName, ClientID = clientId, UserName = username, LName = lname, FName = fname, ActivityID = activityId, ActivityName = activityName, AccountID = accountId, AccountName = accountName, ShortCode = shortCode, ChargeTypeID = chargeTypeId, IsActive = isActive, IsStarted = isStarted, BeginDateTime = truncatedBeginDateTime, EndDateTime = truncatedEndDateTime, ActualBeginDateTime = truncatedActualBeginDateTime, ActualEndDateTime = truncatedActualEndDateTime, ChargeBeginDateTime = chargeBeginDateTime, ChargeEndDateTime = chargeEndDateTime, LastModifiedOn = lastModifiedOn, IsCancelledBeforeCutoff = isCancelledBeforeCutoff, ChargeMultiplier = chargeMultiplier, Cost = cost }; return(item); }
public static DurationInfo Create(ReservationDateRangeItem rsv, IEnumerable <DurationPart> parts) { int repairActivityId = 14; return(new DurationInfo() { PriorityGroup = rsv.PriorityGroup, ReservationID = rsv.ReservationID, //DisplayName = rsv.DisplayName, IsStarted = rsv.IsStarted, IsActive = rsv.IsActive, IsRepair = rsv.ActivityID == repairActivityId, BeginDateTime = rsv.BeginDateTime, EndDateTime = rsv.EndDateTime, ActualBeginDateTime = rsv.ActualBeginDateTime, ActualEndDateTime = rsv.ActualEndDateTime, ChargeBeginDateTime = rsv.ChargeBeginDateTime, ChargeEndDateTime = rsv.ChargeEndDateTime, ChargeMultiplier = rsv.ChargeMultiplier, Parts = parts }); }
public ReservationDurationItem(ReservationDateRangeItem rsv, TimeSpan utilizedDuration) { Reservation = rsv; UtilizedDuration = utilizedDuration; }
public DurationInfo GetDurationInfo(ReservationDateRangeItem item) { return(_range.GetDurationInfo(item)); }