private OptionChoiceEntity(string description, string imageFullName, OptionChoice option, bool taken = false) { _pcs = new PropertyChangeSupport(this); _optionChoice = option; _imageFullPath = imageFullName; _taken = taken; }
public OptionChoiceEntity(OptionChoice optionChoice) { _pcs = new PropertyChangeSupport(this); _optionChoice = optionChoice; string cleanedLabel; cleanedLabel = _cleanLabel(optionChoice.Option.Label); _imageFullPath = string.Format("/Resources/{0}.png", cleanedLabel); _taken = false; }
private void _computeOptionDiscount() { List <OptionChoice> sortedOptionChoices = new List <OptionChoice>(OptionChoices); sortedOptionChoices.Sort((firstOptChoice, secondOptChoice) => secondOptChoice.DiscountedAmmount.CompareTo(firstOptChoice.DiscountedAmmount) ); if (sortedOptionChoices.Count > 0) { _optionDiscount = sortedOptionChoices[0].Option.CurrentDiscount; _discountedOptionChoice = sortedOptionChoices[0]; } }
public OptionChoiceEntity(Booking booking, OptionChoice optionChoice) { _pcs = new PropertyChangeSupport(this); _optionChoice = optionChoice; _booking = booking; string cleanedLabel; if (optionChoice != null) { cleanedLabel = _cleanLabel(optionChoice.Option.Label); _imageFullPath = string.Format("/Resources/{0}.png", cleanedLabel); // restauration if(optionChoice.PeopleCount == 0 && optionChoice.Option.Id == 8) { PeopleCount = 1; } } _taken = false; }
private static void _setAvailableOptionChoiceEntities(Booking booking, DateRange dates, OptionsViewModel newInstance, List<Option> availableOptions) { foreach (Option opt in availableOptions) { OptionChoice optChoice = new OptionChoice { Option = opt, TakenDates = (DateRange)((ICloneable)dates).Clone() }; optChoice.TakenDates.Start = optChoice.TakenDates.Start.Date; if (optChoice.Option.Id == 8) { optChoice.TakenDates.Start = optChoice.TakenDates.Start.AddDays(1.0d); } OptionChoiceEntity optChoiceEntity = new OptionChoiceEntity(booking, optChoice); newInstance._availableOptionChoiceEntities.Add(optChoiceEntity); } }
private void _computeOptionDiscount() { List<OptionChoice> sortedOptionChoices = new List<OptionChoice>(OptionChoices); sortedOptionChoices.Sort((firstOptChoice, secondOptChoice) => secondOptChoice.DiscountedAmmount.CompareTo(firstOptChoice.DiscountedAmmount) ); if (sortedOptionChoices.Count > 0) { _optionDiscount = sortedOptionChoices[0].Option.CurrentDiscount; _discountedOptionChoice = sortedOptionChoices[0]; } }
private static async Task<DateRange> _getTrackedOptionDates(OptionChoice optChoice, ResotelContext ctx) { DateRange trackedOptDates = await ctx.Set<DateRange>().FirstOrDefaultAsync(dr => dr.Id == optChoice.TakenDates.Id); if (trackedOptDates == null) { trackedOptDates = ctx.Set<DateRange>().Add(optChoice.TakenDates); } return trackedOptDates; }
private static async Task _getTrackedOption(OptionChoice optChoice, ResotelContext ctx) { Option trackedOpt = await ctx.Options.FirstOrDefaultAsync(opt => opt.Id == optChoice.Id); }
private static async Task<OptionChoice> _getTrackedOptionChoice(OptionChoice optChoice, ResotelContext ctx) { OptionChoice trackedOptChoice = await ctx.Set<OptionChoice>() .Include(optC => optC.Option) .Include(optC => optC.Option.Discounts) .Include(optC => optC.Option.Rooms) .Include(optC => optC.TakenDates) .FirstOrDefaultAsync(optC => optC.Id == optChoice.Id); if (trackedOptChoice == null) { trackedOptChoice = ctx.Set<OptionChoice>().Add(optChoice); } return trackedOptChoice; }
private static void _updateTrackedOptionChoice(OptionChoice trackedOptChoice, OptionChoice newOptChoice, ResotelContext ctx) { ctx.Entry(trackedOptChoice).CurrentValues.SetValues(newOptChoice); }