private string DecideColor(RentalState state, DateTime endsAt) { string color = string.Empty; switch (state) { case RentalState.Lended: if (endsAt < DateTime.Now) { color = "red"; } else { color = "blue"; } break; case RentalState.NotLended: color = "orange"; break; case RentalState.Returned: color = "green"; break; } return(color); }
private string DecideTitle(RentalState state, DateTime endsAt) { string text = string.Empty; switch (state) { case RentalState.Lended: if (endsAt < DateTime.Now) { text = Localization.Admin.Calendar_NotReturned; } else { text = Localization.Admin.Calendar_Lended; } break; case RentalState.NotLended: text = text = Localization.Admin.Calendar_NotLended; break; case RentalState.Returned: text = Localization.Admin.Calendar_Returned; break; } return(text); }
public void DispenseKeys() { if( rentalState == RentalState.ApartmentRented ) { Output( "Here are your keys." ); rentalState = RentalState.Waiting; return; } BadStateResponse(); }
public void DispenseKeys() { if (rentalState == RentalState.ApartmentRented) { Output("Here are your keys."); rentalState = RentalState.Waiting; return; } BadStateResponse(); }
public void SubmitApplication() { switch( rentalState ) { case RentalState.GotApplication : Output( "We already have your application" ); return; case RentalState.Waiting : rentalState = RentalState.GotApplication; Output( "Thanks for the Application." ); return; } BadStateResponse(); }
public void SubmitApplication() { switch (rentalState) { case RentalState.GotApplication: Output("We already have your application"); return; case RentalState.Waiting: rentalState = RentalState.GotApplication; Output("Thanks for the Application."); return; } BadStateResponse(); }
public void CheckApplication() { if( rentalState == RentalState.GotApplication ) { bool isApproved = ( new Random( DateTime.Now.Millisecond ).Next() % 10 ) > 4; if( isApproved && numberOfApartments > 0 ) { Output( "Congratulation, you were approved." ); rentalState = RentalState.ApartmentRented; RentAppartment(); } else { Output( "Sorry, you were not approved" ); rentalState = RentalState.Waiting; } return; } BadStateResponse(); }
public void CheckApplication() { if (rentalState == RentalState.GotApplication) { bool isApproved = (new Random(DateTime.Now.Millisecond).Next() % 10) > 4; if (isApproved && numberOfApartments > 0) { Output("Congratulation, you were approved."); rentalState = RentalState.ApartmentRented; RentAppartment(); } else { Output("Sorry, you were not approved"); rentalState = RentalState.Waiting; } return; } BadStateResponse(); }
public RentalMethods( int numberOfApartments ) { rentalState = RentalState.Waiting; this.numberOfApartments = numberOfApartments; }
public TypeRentalState(RentalState value) : base(DataType.BookNo, (int)value) { }
public RentalMethods(int numberOfApartments) { rentalState = RentalState.Waiting; this.numberOfApartments = numberOfApartments; }
/// <summary> /// Vytvoří entitu, vnitřně nic nekontroluje, je potřeba zkontrolovat předem. /// </summary> public static Renting Create(int customerId, DateTime startsAt, DateTime endsAt, RentalState state, string note, int[] items) { var renting = new Renting() { UserId = customerId, StartsAt = startsAt, EndsAt = endsAt, State = state, Note = note, CancelationCode = StringExtensions.GetRandomString(25) }; // Přidám do výpůjčky předměty. foreach (var i in items) { renting.RentingToItems.Add(new RentingToItem() { ItemId = i }); } return(renting); }
public static Renting Create(int customerId, DateTime startsAt, DateTime endsAt, RentalState state, string note, IEnumerable <Item> items) { return(Create(customerId, startsAt, endsAt, state, note, items.Select(i => i.Id).ToArray())); }