public ActionResult DeleteConfirmed(int id) { Babysitter babysitter = db.Babysitters.Find(id); db.Babysitters.Remove(babysitter); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Email,Name,Age,Photo,City,PricePerHour")] Babysitter babysitter) { if (ModelState.IsValid) { db.Entry(babysitter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(babysitter)); }
public ActionResult Create([Bind(Include = "Id,Email,Name,Age,Photo,City,PricePerHour")] Babysitter babysitter) { if (ModelState.IsValid) { db.Babysitters.Add(babysitter); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(babysitter)); }
public void TestInitialize() { Babysitter = new Babysitter { MinimumStartTime = new TimeSpan(17, 0, 0), // 5:00:00PM MaximumEndTime = new TimeSpan(3, 0, 0) // 3:00:00AM }; Job = new Job { StartDateTime = new DateTime(2019, 6, 20, 17, 0, 0), // 6/20/2019 - 5:00:00PM EndDateTime = new DateTime(2019, 6, 21, 3, 0, 0) // 6/21/2019 - 3:00:00AM }; }
// GET: Babysitters/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Babysitter babysitter = db.Babysitters.Find(id); if (babysitter == null) { return(HttpNotFound()); } return(View(babysitter)); }
public void TestInitialize() { Family = new Family(); Babysitter = new Babysitter { MinimumStartTime = new TimeSpan(17, 0, 0), // 5:00:00PM MaximumEndTime = new TimeSpan(4, 0, 0) // 4:00:00AM }; Job = new Job { StartDateTime = new DateTime(2019, 6, 20, 17, 0, 0), // 6/20/2019 - 5:00:00PM EndDateTime = new DateTime(2019, 6, 21, 4, 0, 0), // 6/21/2019 - 4:00:00AM Family = Family }; }
public static void InitiateCaregiving(Household house) { bool babySitter = true; if (GoHere.Settings.mUseDayCareSims) { List <Sim> choices = GetDayCareChoices(); if (choices.Count > 0) { Sim choice = RandomUtil.GetRandomObjectFromList(choices); Caregivers caregiver; if (!GoHere.Settings.mCaregivers.TryGetValue(house.LotHome.LotId, out caregiver)) { caregiver = new Caregivers(house.LotHome); GoHere.Settings.mCaregivers.Add(house.LotHome.LotId, caregiver); } bool fail = false; foreach (Sim child in house.Sims) { if ((child.SimDescription.ToddlerOrBelow) && (child.LotCurrent == child.LotHome)) { if (!caregiver.AddChild(child, choice)) { fail = true; } } } if (!fail) { babySitter = false; } } } if (babySitter) { Babysitter instance = Babysitter.Instance; if (instance != null) { instance.MakeServiceRequest(house.LotHome, true, ObjectGuid.InvalidObjectGuid, true); } } }
public Babysitter GetBabysitterWorkingShift(BabysitterRequestData babysitterRequest) { if (_dBContext.Babysitters.Count() > 0) { RemoveExistingBabysitter(); } var babysitter = new Babysitter(babysitterRequest) { PayForShift = WorkShift(babysitterRequest.FamilyId, babysitterRequest.StartTime, babysitterRequest.EndTime) }; _dBContext.Babysitters.Add(babysitter); _dBContext.SaveChanges(); return(_dBContext.Babysitters.Where(b => babysitter.Id == b.Id).Single()); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false); switch (result) { case SignInStatus.Success: Admin admin = _context.Admins.SingleOrDefault(a => a.Email == model.Email); if (admin != null) { return(RedirectToAction("Index", "Admin")); } Babysitter babysitter = _context.Babysitters.SingleOrDefault(b => b.Email == model.Email); if (babysitter != null) { return(RedirectToAction("Index", "Babysitter")); } Requisitador requisitador = _context.Requisitadors.SingleOrDefault(r => r.Email == model.Email); if (requisitador != null) { return(RedirectToAction("Index", "Requisitador")); } return(RedirectToLocal(returnUrl)); case SignInStatus.LockedOut: return(View("Lockout")); case SignInStatus.RequiresVerification: return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe })); case SignInStatus.Failure: default: ModelState.AddModelError("", "Invalid login attempt."); return(View(model)); } }
public void Job_CalculatePay_ReturnsCorrectPay() { // Arrange. var familyHourlyRate = new FamilyHourlyRate { StartTime = new TimeSpan(23, 0, 0), // 11:00PM HourlyRate = 20 }; var family = new Family { DefaultHourlyRate = 15 }; family.AddFamilyHourlyRate(familyHourlyRate); var job = new Job { StartDateTime = new DateTime(2019, 6, 20, 17, 0, 0), // 6/20/2019 5:00PM EndDateTime = new DateTime(2019, 6, 21, 4, 0, 0), // 6/21/2019 4:00AM Family = family }; var babySitter = new Babysitter { MinimumStartTime = new TimeSpan(17, 0, 0), // 5:00PM MaximumEndTime = new TimeSpan(4, 0, 0) // 4:00AM }; babySitter.AddJob(job); // Act. var totalPay = babySitter.CalculatePayForJob(job); // Assert. var expectedTotalPay = 190; Assert.AreEqual(expectedTotalPay, totalPay); }
public static void SetVacationWorld(bool ignoreHousehold, bool updateSims) { Common.StringBuilder msg = new Common.StringBuilder("SetVacationWorld" + Common.NewLine); try { ResetWorldType(); WorldType originalType = GameUtils.GetCurrentWorldType(); string worldFile = World.GetWorldFileName(); msg += worldFile + Common.NewLine; WorldName currentWorld = WorldName.Undefined; msg += "A"; foreach (KeyValuePair <WorldName, WorldNameData> data in sData) { // Do not alter the future world if (data.Key == WorldName.FutureWorld) { continue; } if (data.Value.mWorldFile == worldFile) { currentWorld = data.Key; } else { if (originalType != WorldType.Future) { // Make all other worlds vacation worlds to allow the Core to age the sims while playing home-town GameUtils.WorldNameToType[data.Key] = WorldType.Vacation; } else { // Alter all worlds to *not* allow aging GameUtils.WorldNameToType[data.Key] = WorldType.Base; } } } if (originalType != WorldType.Future) { // handle custom and pre sunlit tides snafu's if (GameUtils.WorldNameToType.ContainsKey(WorldName.UserCreated)) { GameUtils.WorldNameToType[WorldName.UserCreated] = WorldType.Vacation; } else { GameUtils.WorldNameToType.Add(WorldName.UserCreated, WorldType.Vacation); } } msg += "B"; msg += Common.NewLine + "CurrentWorld: " + currentWorld + Common.NewLine; bool adjustBaseBooks = false; // Change the books so the base world books can be seen in Traveler worlds or while "Treat As Vacation" is false switch (currentWorld) { case WorldName.China: case WorldName.Egypt: case WorldName.France: if (!Traveler.Settings.mTreatAsVacation) { adjustBaseBooks = true; } break; default: adjustBaseBooks = true; break; } if ((GameStates.HasTravelData) && (Traveler.Settings.mTreatAsVacation) && ((ignoreHousehold) || (GameStates.TravelHousehold == Household.ActiveHousehold))) { switch (currentWorld) { case WorldName.University: GameUtils.WorldNameToType[currentWorld] = WorldType.University; break; case WorldName.FutureWorld: GameUtils.WorldNameToType[currentWorld] = WorldType.Future; break; default: GameUtils.WorldNameToType[currentWorld] = WorldType.Vacation; break; } GameUtils.CheatOverrideCurrentWorld = currentWorld; } else { switch (GameUtils.GetCurrentWorldType()) { case WorldType.Vacation: case WorldType.University: case WorldType.Future: GameUtils.WorldNameToType[currentWorld] = WorldType.Base; GameUtils.CheatOverrideCurrentWorld = currentWorld; break; } } msg += Common.NewLine + "CurrentWorldType: " + GameUtils.GetCurrentWorldType() + Common.NewLine; if (sAdjustedStoreItems == null) { sAdjustedStoreItems = new List <BookBaseStoreItem>(); foreach (List <StoreItem> list in Bookstore.mItemDictionary.Values) { foreach (StoreItem item in list) { BookBaseStoreItem baseItem = item as BookBaseStoreItem; if (baseItem == null) { continue; } if (baseItem.mAllowedWorldTypes == null) { continue; } if (!baseItem.mAllowedWorldTypes.Contains(WorldType.Base)) { continue; } if (baseItem.mAllowedWorldTypes.Contains(WorldType.Vacation)) { continue; } sAdjustedStoreItems.Add(baseItem); } } } foreach (BookBaseStoreItem item in sAdjustedStoreItems) { if (adjustBaseBooks) { if (!item.mAllowedWorldTypes.Contains(WorldType.Vacation)) { item.mAllowedWorldTypes.Add(WorldType.Vacation); } } else { item.mAllowedWorldTypes.Remove(WorldType.Vacation); } } msg += "C"; if (PetPoolManager.sPetConfigManager != null) { foreach (PetPoolConfig config in PetPoolManager.sPetConfigManager.Values) { if (config == null) { continue; } if (config.mAllowedWorldTypes == null) { config.mAllowedWorldTypes = new List <string>(); } config.mAllowedWorldTypes.Remove(WorldType.Vacation.ToString()); config.mAllowedWorldTypes.Remove(WorldType.University.ToString()); config.mAllowedWorldTypes.Remove(WorldType.Future.ToString()); if (!config.mAllowedWorldTypes.Contains(WorldType.Downtown.ToString())) { if (originalType != WorldType.Downtown) { config.mAllowedWorldTypes.Add(WorldType.Vacation.ToString()); config.mAllowedWorldTypes.Add(WorldType.University.ToString()); config.mAllowedWorldTypes.Add(WorldType.Future.ToString()); } } else { config.mAllowedWorldTypes.Add(WorldType.Vacation.ToString()); config.mAllowedWorldTypes.Add(WorldType.University.ToString()); config.mAllowedWorldTypes.Add(WorldType.Future.ToString()); } config.mDisallowedWorldNames = null; } } msg += "D"; Navigation navigation = Navigation.Instance; if ((navigation != null) && (navigation.mInfoStateButtons.Length >= 2) && (navigation.mInfoStateButtons[1] != null)) { /*if (GameUtils.IsOnVacation()) * { * navigation.mInfoStateButtons[1].TooltipText = Common.LocalizeEAString("Ui/Caption/Hud/Navigation:OnVacationNoWork"); * navigation.mInfoStateButtons[1].Enabled = false; * } * else*/ { navigation.mInfoStateButtons[1].TooltipText = null; navigation.mInfoStateButtons[1].Enabled = true; } } msg += "E"; if (updateSims) { currentWorld = GameUtils.GetCurrentWorld(); foreach (SimDescription sim in Household.EverySimDescription()) { if (sim.Household == null) { continue; } if (sim.Household.IsTravelHousehold) { continue; } if (sim.Household.IsTouristHousehold) { continue; } sim.mHomeWorld = currentWorld; } } msg += "F"; // Startup the service manually if (SocialWorkerPetPutUp.Instance == null) { SocialWorkerPetPutUp.Create(); } if (SocialWorkerPetAdoption.Instance == null) { SocialWorkerPetAdoption.Create(); } if (SocialWorkerAdoption.Instance == null) { SocialWorkerAdoption.Create(); } if (Babysitter.Instance == null) { Babysitter.Create(); } if (Repoman.Instance == null) { Repoman.Create(); } if (NewspaperDelivery.Instance == null) { NewspaperDelivery.Create(); } } catch (Exception e) { Common.Exception(msg, e); } finally { //Common.StackLog(msg); } }
public void setupUnitTest() { sitter = new Babysitter(); todaysDate = DateTime.Now; tomorrowsDate = DateTime.Now.AddDays(1); }
public PayInvalidFamily() { this.family = Family.GetTestFamily(); this.sitter = new Babysitter(Babysitter.DefaultStartTime, Babysitter.DefaultEndTime); }
public void TestInitialize() { Babysitter = new Babysitter(); }
private Card RandomCard(Vector2 position, bool front, int playerID) { Card c = null; if (Globals.r.Next(4) == 0) { int cardsCount = 31; int rn = Globals.r.Next(cardsCount); switch (rn) { case 0: c = new Actor(position, front, playerID); break; case 1: c = new Artist(position, front, playerID); break; case 2: c = new Astrophysicist(position, front, playerID); break; case 3: c = new Babysitter(position, front, playerID); break; case 4: c = new BabysitterU(position, front, playerID); break; case 5: c = new BusDriver(position, front, playerID); break; case 6: c = new Conman(position, front, playerID); break; case 7: c = new DeliveryPerson(position, front, playerID); break; case 8: c = new DrugDealer(position, front, playerID); break; case 9: c = new FastFoodEmployee(position, front, playerID); break; case 10: c = new Hacker(position, front, playerID); break; case 11: c = new Hitman(position, front, playerID); break; case 12: c = new HumanTrafficker(position, front, playerID); break; case 13: c = new IndieGameDev(position, front, playerID); break; case 14: c = new Influencer(position, front, playerID); break; case 15: c = new InstaModel(position, front, playerID); break; case 16: c = new InternDev(position, front, playerID); break; case 17: c = new JuniorDev(position, front, playerID); break; case 18: c = new Musician(position, front, playerID); break; case 19: c = new OnlyFans(position, front, playerID); break; case 20: c = new Referee(position, front, playerID); break; case 21: c = new RiceFarmer(position, front, playerID); break; case 22: c = new Santa(position, front, playerID); break; case 23: c = new Shelfstacker(position, front, playerID); break; case 24: c = new Shoplifter(position, front, playerID); break; case 25: c = new Sporter(position, front, playerID); break; case 27: c = new Streamer(position, front, playerID); break; case 28: c = new SugarDaddy(position, front, playerID); break; case 29: c = new TaxiDriver(position, front, playerID); break; case 30: c = new Writer(position, front, playerID); break; case 26: c = new YogaInstructor(position, front, playerID); break; } } else { int cardsCount = 12; int rn = Globals.r.Next(cardsCount); switch (rn) { case 0: c = new Alcohol(position, front, playerID); break; case 1: c = new Drugs(position, front, playerID); break; case 2: c = new EatingOut(position, front, playerID); break; case 3: c = new FastFood(position, front, playerID); break; case 4: c = new Gambling(position, front, playerID); break; case 5: c = new Gaming(position, front, playerID); break; case 6: c = new Joint(position, front, playerID); break; case 7: c = new PomXML(position, front, playerID); break; case 8: c = new Shopping(position, front, playerID); break; case 9: c = new Smoking(position, front, playerID); break; case 10: c = new SocialMedia(position, front, playerID); break; case 11: c = new Streaming(position, front, playerID); break; } } return(c); }
public BabysitterKataTest() { BabysitterUnderTest = new Babysitter(); }
public OutOfRangeHours() { this.family = Family.GetTestFamily(); this.sitter = new Babysitter(Babysitter.DefaultStartTime, Babysitter.DefaultEndTime); }