public void OnExitBuildBuy(Lot lot) { foreach(ComboRabbitHole comboRH in lot.GetObjects<ComboRabbitHole>()) { AddContainedRabbitHolesToLot (comboRH); } }
public static void SetupLotTag(Lot lot) { Sim active = Sims3.Gameplay.Actors.Sim.ActiveActor; if (active == null) return; MapTagManager mtm = active.MapTagManager; if (mtm == null) return; try { MapTag tag = mtm.GetTag(lot); if (Tagger.Settings.Filters.Matches(lot.Household.AllSimDescriptions) && Tagger.Settings.mEnableLotTags) { if ((tag != null) && (!(tag is TrackedLot)) && (!(tag is HomeLotMapTag))) { mtm.RemoveTag(tag); } if (!mtm.HasTag(lot)) { mtm.AddTag(new TrackedLot(lot, mtm.Actor)); } } else if (tag is TrackedLot) { mtm.RemoveTag(tag); } } catch (Exception exception) { Common.DebugException(lot, exception); } }
public static void PayForCoffee(Sim sim, Lot lot) { //Pay for the coffee if we don't own the lot Household lotOwner = ReturnLotOwner(lot); if (lot.IsCommunityLot) { //If we don't own the lot int price = ReturnPrice(); if (lotOwner != null && lotOwner != sim.Household) { lotOwner.ModifyFamilyFunds(price); //Can the customer pay, if (sim.Household.FamilyFunds >= price) { sim.Household.ModifyFamilyFunds(-price); } else { //Add to next bill sim.Household.UnpaidBills += price; } } else { //if the lot has no owner if (lotOwner == null) { sim.Household.ModifyFamilyFunds(-price); } } } }
public static Household ReturnLotOwner(Lot lot) { Household lotOwner = null; if (lot != null) { List<Household> hList = new List<Household>(Sims3.Gameplay.Queries.GetObjects<Household>()); Sims3.Gameplay.RealEstate.PropertyData pd = null; if (hList != null && hList.Count > 0) { foreach (Household h in hList) { pd = h.RealEstateManager.FindProperty(lot); if (pd != null && pd.Owner != null) { lotOwner = pd.Owner.OwningHousehold; break; } } } } return lotOwner; }
public void OnExitBuildBuy(Lot lot) { foreach (ISprinkler sprinkler in lot.GetObjects<ISprinkler>()) { this.SetSprinklerAlarm(sprinkler); } }
public static void PayForWorkOut(Sim sim, Lot lot, int fee) { if (lot.IsCommunityLot) { //Pay if we don't own the lot Household lotOwner = ReturnLotOwner(lot); //If we don't own the lot if (lotOwner != null && lotOwner != sim.Household) { lotOwner.ModifyFamilyFunds(fee); //pay if we have the money, if not add to next bill if (sim.FamilyFunds >= fee) { sim.Household.ModifyFamilyFunds(-fee); } else { sim.Household.UnpaidBills += fee; } } else { //if the lot has no owner, or we don't own the lot if (lotOwner == null || (lotOwner != null && lotOwner != sim.Household)) { sim.Household.ModifyFamilyFunds(-fee); } } } }
public override void Reset() { base.Reset(); if (SimTypes.IsDead(Sim)) return; mHouse = Sim.Household; mNetWorth = 0; if (mHouse != null) { if (mHouse.LotHome != null) { if (mHouse.LotHome != mLot) { mLot = mHouse.LotHome; mLotHomeCost = StoryProgression.Main.Lots.GetLotCost(mLot); } mNetWorth = mHouse.FamilyFunds + mLotHomeCost; } else { mNetWorth = mHouse.NetWorth(); mLot = null; mLotHomeCost = 0; } } }
public static bool EnsureInstantiate(SimDescription sim, Lot lot) { if (sim.CreatedSim == null) { if (sim.Household == null) { if (!sim.IsValidDescription) { sim.Fixup(); } Urnstone urnstone = Urnstones.CreateGrave(sim, SimDescription.DeathType.OldAge, false, true); if (urnstone != null) { Common.Sleep(); if (!Urnstones.GhostSpawn(urnstone, lot)) { return false; } } } else { Instantiation.Perform(sim, null); } } return (sim.CreatedSim != null); }
public static string IsValidResidentialLot(Lot lot) { if (lot.Household != null) { return "Occupied"; } else if (lot.IsCommunityLot) { return "Community lot"; } else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable) { return "Vacation Home"; } else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP10_PrivateLot) { return "Private Lot"; } else if (lot.IsWorldLot) { return "World lot"; } return null; }
protected override OptionResult Run(Lot lot, Household me) { if (lot != null) { List<Item> allOptions = new List<Item>(); foreach (Household house in Household.sHouseholdList) { if (house.RealEstateManager == null) continue; PropertyData data = house.RealEstateManager.FindProperty(lot); if (data == null) continue; allOptions.Add(new Item(house, lot, RealEstate.OwnerType.Full, data.TotalValue)); } if (allOptions.Count == 0) { SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Failure")); return OptionResult.Failure; } CommonSelection<Item>.Results choices = new CommonSelection<Item>(Name, allOptions).SelectMultiple(); if ((choices == null) || (choices.Count == 0)) return OptionResult.Failure; foreach (Item item in choices) { item.Perform(); } } return OptionResult.SuccessClose; }
public void OnExitBuildBuy(Lot lot) { foreach (ShowStage stage in lot.GetObjects<ShowStage>()) { ShowStageEx.StoreChanges(stage, Overwatch.Log); } }
public bool Satisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting) { if (!inspecting) { Occupation career = CareerManager.GetStaticOccupation(mCareer); if (career == null) return false; if ((GameUtils.IsFutureWorld()) && (!career.AvailableInFutureWorld)) return false; if (sim.IsEP11Bot) { if (!sim.HasTrait(TraitNames.ProfessionalChip)) { return false; } } if (sim.CreatedSim != null) { if ((sim.Occupation == null) || (sim.Occupation.Guid != mCareer)) { GreyedOutTooltipCallback greyedOutTooltipCallback = null; if (!career.CanAcceptCareer(sim.CreatedSim.ObjectId, ref greyedOutTooltipCallback)) return false; } } } return PrivateSatisfies(manager, sim, newLot, inspecting); }
public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { // Stops the dead from leaving the cemetery if ((actor.SimDescription.IsDead) && (!actor.SimDescription.IsPlayableGhost)) return false; return base.Test(actor, target, isAutonomous, ref greyedOutTooltipCallback); }
public static void AddLot(Lot lot, AuctionEntities au) { if (lot.IdLot == 0) { au.Lots.Add(lot); } else { Lot dbLot = au.Lots.Find(lot.IdLot); if (dbLot != null) { dbLot.IdSection = lot.IdSection; dbLot.Name = lot.Name; dbLot.Description = lot.Description; dbLot.StartDate = lot.StartDate; dbLot.EndDate = lot.EndDate; dbLot.StartPrice = lot.StartPrice; dbLot.Tick = lot.Tick; dbLot.CurrentPrice = lot.CurrentPrice; dbLot.Status = lot.Status; dbLot.Img = lot.Img; } } }
protected override OptionResult Run(Lot lot, Household me) { if (me == null) return OptionResult.Failure; string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt"), me.Name); if (string.IsNullOrEmpty(text)) return OptionResult.Failure; if (AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":SimsPrompt", false, new object[] { me.Name, text }))) { foreach (SimDescription sim in CommonSpace.Helpers.Households.All(me)) { if (sim.LastName.Trim().ToLower() == me.Name.Trim().ToLower()) { sim.LastName = text; if (me == Household.ActiveHousehold) { HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel; if (sim.CreatedSim != null) { Household.AddDirtyNameSimID(sim.SimDescriptionId); hudModel.NotifyNameChanged(sim.CreatedSim.ObjectId); } } } } } me.Name = text; return OptionResult.SuccessClose; }
public static OptionResult Perform(Lot lot) { if (lot == null) return OptionResult.Failure; World.RegenImposter(lot.LotId); return OptionResult.SuccessClose; }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (lot == null) return false; return (true); }
protected override bool Allow(Lot lot, Household house) { if (!base.Allow(lot, house)) return false; if (lot is WorldLot) return false; return (lot != null); }
protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting) { if (inspecting) return true; if (sim.Occupation is Retired) return false; return (Sims3.Gameplay.Queries.CountObjects<AdminstrationCenter>() > 0); }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (lot.IsCommunityLot) return false; return (new HomeInspection(lot).Satisfies(me).Count > 0); }
public CustomTagNRaas(Lot targetLot, Sim owner) : base(targetLot, owner) { if (targetLot != null) { LotType = (uint)targetLot.CommercialLotSubType; } }
public static Household ReturnLotOwner(Lot lot) { Household lotOwner = null; if (lot != null) { //Check first is the lot a rabbit hole lot. List<Theatre> rList = new List<Theatre>(Sims3.Gameplay.Queries.GetObjects<Theatre>()); Theatre rhOnThisLot = null; foreach (Theatre r in rList) { if (r.LotCurrent == lot) { rhOnThisLot = r; break; } } //Is there a rabbit hole on this lot if (rhOnThisLot != null) { List<Household> hList = new List<Household>(Sims3.Gameplay.Queries.GetObjects<Household>()); Sims3.Gameplay.RealEstate.PropertyData pd = null; if (hList != null && hList.Count > 0) { foreach (Household h in hList) { pd = h.RealEstateManager.FindProperty(rhOnThisLot); if (pd != null && pd.Owner != null) { lotOwner = pd.Owner.OwningHousehold; break; } } } } //If the lot is not a RH lot, check for venues if (lotOwner == null) { List<Household> hList = new List<Household>(Sims3.Gameplay.Queries.GetObjects<Household>()); Sims3.Gameplay.RealEstate.PropertyData pd = null; if (hList != null && hList.Count > 0) { foreach (Household h in hList) { pd = h.RealEstateManager.FindProperty(lot); if (pd != null && pd.Owner != null) { lotOwner = pd.Owner.OwningHousehold; break; } } } } } return lotOwner; }
protected override OptionResult PrivatePerform(Lot lot, Household me, List<IMiniSimDescription> sims) { OptionResult result = base.PrivatePerform(lot, me, sims); if (result == OptionResult.Failure) return OptionResult.Failure; SetRoommate(lot, me, sims); return result; }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (me == null) return false; if (me.RealEstateManager == null) return false; return true; }
protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting) { if (inspecting) return true; if (sim.Occupation is Retired) return false; if (sim.Elder) return false; return (ManagerSituation.FindLotType(CommercialLotSubType.kEP2_FireStation) != null); }
public void OnExitBuildBuy(Lot lot) { foreach (AncientPortal portal in lot.GetObjects<AncientPortal>()) { if (portal.PortalComponent == null) { ObjectComponents.AddComponent<AncientPortalComponent>(portal, new object[0]); } } }
protected override ManagerLot.CheckResult OnLotPriceCheck(Common.IStatGenerator stats, Lot lot, int currentLotCost, int availableFunds) { if (availableFunds < Lots.GetLotCost(lot)) { stats.IncStat("Find Lot: Too expensive"); return ManagerLot.CheckResult.Failure; } return ManagerLot.CheckResult.Success; }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (lot is WorldLot) return false; if (lot == null) return false; return MasterController.Settings.IsExcludedLot(lot); }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (lot == null) return false; if (lot.IsPurchaseableVenue) return true; return lot.IsResidentialLot; }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) return false; if (lot == null) return false; if (me == Household.ActiveHousehold) return false; return (me != null); }
public void Can_Add_New_Lines() { // Arrange - create some test products Lot p1 = new Lot { LotID = 1, Name = "P1" }; Lot p2 = new Lot { LotID = 2, Name = "P2" }; // Arrange - create a new cart Cart target = new Cart(); // Act target.AddItem(p1, 1); target.AddItem(p2, 1); CartLine[] results = target.Lines.ToArray(); // Assert Assert.AreEqual(results.Length, 2); Assert.AreEqual(results[0].Lot, p1); Assert.AreEqual(results[1].Lot, p2); }
public LotOptions GetLotOptions(Lot lot) { if (lot == null) { return(null); } else { LotOptions options; if (!Lots.TryGetValue(lot.LotId, out options)) { options = new LotOptions(lot); mLotOptions.Add(options); Lots.Add(lot.LotId, options); } return(options); } }
public override string ToString() { Common.StringBuilder text = new Common.StringBuilder("<LotOptions>"); Lot lot = Lot; if (lot != null) { text.AddXML("Lot", lot.Name); } else { text.AddXML("Lot", "Null"); } text += base.ToString(); text += Common.NewLine + "</LotOptions>"; return(text.ToString()); }
public static FoodTruckBase GetTruck(Lot lot) { FoodTruckBase truck; if (!sLotTrucks.TryGetValue(lot.LotId, out truck)) { return(null); } if (!truck.HasBeenDestroyed) { return(truck); } else { sTruckLots.Remove(truck); sLotTrucks.Remove(lot.LotId); return(null); } }
public static BLLLot ToBllLot(this Lot lot) { return(new BLLLot { Id = lot.Id, Photos = lot.Photos, Author = lot.Author, UserOwnerId = lot.UserId.GetValueOrDefault(), ArtworkFormat = lot.ArtworkFormat, CurrentBuyerId = lot.CurrentBuyerId, CurrentPrice = lot.CurrentPrice, DateOfAuction = lot.DateOfAuction, Description = lot.Description, MinimalStepRate = lot.MinimalStepRate, RatesCount = lot.RatesCount, StartingPrice = lot.StartingPrice, YearOfCreation = lot.YearOfCreation, ArtworkName = lot.ArtworkName, UsersLotsRates = lot.UsersLotsRates.ToList() }); }
protected HousePartySituation(Lot lot, Sim host, List <SimDescription> guests, OutfitCategories clothingStyle, DateAndTime startTime, HouseParty.PartyInvitationKeys invitationKeys) : base(lot, host, guests, clothingStyle, startTime) { if (lot == host.LotHome) { EventTracker.SendEvent(EventTypeId.kHousePartySoon, host); } else { EventTracker.SendEvent(EventTypeId.kOffLotPartySoon, host); } mPulse = AddPulseAlarm(host, Pulse, GetParams().MinutesPerLeavingCheck, "Party Pulse"); if (invitationKeys != null) { SetState(new DeliverInvitations(this, invitationKeys)); } else { SetState(new WaitForPreparations(this)); } }
protected static void OnLotChanged(Event e) { Lot lot = e.TargetObject as Lot; if (lot == null) { return; } if (Sim.ActiveActor == null) { return; } if (lot.Household != Sim.ActiveActor.Household) { return; } UpdateListener(); }
public Lot CreateNewLot(string serialNumber, int packagesCount, decimal packagesWeight, string productName) { var productCode = productName.Split(" - ").Last(); var selectedProduct = _context.Products .Include(x => x.Lots) .FirstOrDefault(x => x.ProductCode == productCode); var lot = new Lot { SerialNumber = serialNumber, PackagesCount = packagesCount, PackagesWeight = packagesWeight, Product = selectedProduct, Density = packagesWeight / (packagesCount * selectedProduct.PackageCapacity), }; _context.Lots.Add(lot); _context.SaveChanges(); return(lot); }
public void Cannot_Save_Invalid_Changes() { // Arrange - create mock repository Mock <ILotRepository> mock = new Mock <ILotRepository>(); // Arrange - create the controller AdminController target = new AdminController(mock.Object); // Arrange - create a lot Lot lot = new Lot { Name = "Test" }; // Arrange - add an error to the model state target.ModelState.AddModelError("error", "error"); // Act - try to save the lot ActionResult result = null; // Assert - check that the repository was not called mock.Verify(m => m.SaveLot(It.IsAny <Lot>()), Times.Never()); // Assert - check the method result type Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public static void ManualHold(string lotID, string userID, string holdReason, string commentID) { NotificationService.ClearNotificationsByRoleAndLotID(UserRoles.OSAT, lotID, NotificationTypes.Confirm); NotificationService.ClearNotificationsByRoleAndLotID(UserRoles.QA, lotID, NotificationTypes.LotDispose); NotificationService.ClearNotificationsByRoleAndLotID(UserRoles.PE, lotID, NotificationTypes.LotDispose); Lot lotByLotID = lotGateway.GetLotByLotID(lotID); lotByLotID.ManualHold = true; lotByLotID.LastOperator = userID; lotByLotID.OperateType = "ManualHold"; lotByLotID.HoldReason = holdReason; lotByLotID.Status = "WAIT QA & PE"; lotByLotID.LastDecision = 0xfd; lotByLotID.UpdateTime = DateTime.Now; UpdateLot(lotByLotID); NotificationService.CreateSPRDDisposeNotificationByUserRoleWhileNewLotArrived(lotByLotID, UserRoles.QA, "Manual Hold a Lot, pending your disposition."); NotificationService.CreateSPRDDisposeNotificationByUserRoleWhileNewLotArrived(lotByLotID, UserRoles.PE, "Manual Hold a Lot, pending your disposition."); User userByID = UserService.GetUserByID(userID); AddDisposeComment(GenerateComment(lotID, 0xfd, commentID, holdReason, false, userByID)); }
public void Execute_Throws_If_No_Such_Instrument_Found() { //arrange. var updateLotCommand = new UpdateLotInstrumentPriceCommand(Guid.NewGuid()); var lot = new Lot(Guid.NewGuid(), new InstrumentInfo("GL1", "Goldish", 1.23m), new DateTime(2017, 12, 24), 1.23m); _lotRepository.Setup(r => r.GetById(updateLotCommand.LotId)) .Returns(lot) .Verifiable(); _instrumentRepository.Setup(r => r.GetById(lot.InstrumentInfo.Symbol)) .Returns(() => null) .Verifiable(); //act / assert. new Action(() => _sut.Execute(updateLotCommand)).ShouldThrowExactly <InvalidOperationException>(); _lotRepository.Verify(); _instrumentRepository.Verify(); }
public static DalLot ToDalLot(this Lot lot) { return(new DalLot() { Id = lot.LotId, IsBlocked = lot.IsBlocked, CategoryName = lot.Category.CategoryName, CategoryRefId = lot.CategoryRefId, IsConfirm = lot.IsConfirm, Discription = lot.Discription, BlockReason = lot.BlockReason, LotName = lot.LotName, SellerRefId = lot.SellerRefId, EndDate = lot.EndDate, IsSold = lot.IsSold, SellerEmail = lot.Seller.Email, SellerLogin = lot.Seller.Login, StartDate = lot.StartDate, StartingBid = lot.StartingBid }); }
/// <summary> /// Adjust the provided Lot instance using any existing work items. /// </summary> /// <param name="salesOrderWorkItemRepository">An ISalesOrderWorkItemRepository instance.</param> /// <param name="salesOrderNumber">The sales order number.</param> /// <param name="lot">The lot.</param> /// <returns>An asynchronous Task that returns an adjusted Lot on completion.</returns> private static async Task <Lot> AdjustLot( ISalesOrderWorkItemRepository salesOrderWorkItemRepository, string salesOrderNumber, Lot lot ) { if (lot == null) { return(null); } var salesOrderWorkItems = (await salesOrderWorkItemRepository.TryGetSalesOrderWorkItems( salesOrderNumber, lot.ItemNumber )).Where(i => i.LotNumber == lot.LotNumber); // Adjust the lot quantity by subtracting the sum of sales order work item quantities. lot.Quantity -= salesOrderWorkItems.Sum(i => i.PickedQuantity); return(lot); }
public void LotRepository_Delete_DeletesLot() { var mockDbSet = UnitTestHelper.GetMockDbSet <Lot>(GetTestLots()); var mockContext = GetMockContext(mockDbSet); var lotRepo = new LotRepository(mockContext.Object); var lot = new Lot { Id = 1, TurnkeyPrice = 5000, CarId = 1 }; lotRepo.Delete(lot); mockDbSet.Verify( m => m.Remove(It.Is <Lot>( l => l.Id == lot.Id && l.TurnkeyPrice == lot.TurnkeyPrice && l.CarId == lot.CarId)), Times.Once); }
public void Calculate_Cart_Total() { // Arrange - create some test lots Lot p1 = new Lot { LotID = 1, Name = "P1", CurrentPrice = 1 }; Lot p2 = new Lot { LotID = 2, Name = "P2", CurrentPrice = 1 }; // Arrange - create a new cart Cart target = new Cart(); // Act target.AddItem(p1, 1); target.AddItem(p2, 1); target.AddItem(p1, 3); decimal result = target.ComputeTotalValue(); // Assert Assert.AreEqual(result, 450M); }
public void SetsTestDateFromMaxDateOfAttributes() { // arrange var lot = new tblLot(); var minDate = DateTime.Now.AddDays(-5).Date; var expectedDate = DateTime.Now.Date; var asta = BuildLotAttribute(StaticAttributeNames.Asta, 1.0, minDate); var scoville = BuildLotAttribute(StaticAttributeNames.Scoville, 2.0f, minDate); var scan = BuildLotAttribute(StaticAttributeNames.Scan, 3.0, expectedDate); var newLot = new Lot { Attributes = new[] { asta, scoville, scan } }; // act LotSyncHelper.SetTestData(lot, newLot); // assert Assert.True(lot.TestDate.HasValue); Assert.AreEqual(expectedDate, lot.TestDate); }
protected override bool Allow(Lot lot, Household me) { if (!base.Allow(lot, me)) { return(false); } if (lot == null) { return(false); } if (me == Household.ActiveHousehold) { return(false); } if (lot.IsCommunityLot) { if (Camera.sActiveLotOverride == lot) { return(false); } } else { Household active = Household.ActiveHousehold; if (active == null) { return(false); } if (active.mGreetedLots.Contains(lot)) { return(false); } } return(true); }
public void Include_And_Remove_Product_To_Order_Works_Correctly() { string errorMessagePrefix = "ProductsService Include() or Remove() methods does not work properly."; var context = OilsProDbContextInMemoryFactory.InitializeContext(); Order order = new Order(); Product product = new Product { Name = "Product1", ProductCode = "01010101", }; Lot lot = new Lot { SerialNumber = "12/56" }; context.Add(order); context.Add(product); context.Add(lot); context.SaveChanges(); this.productsService = new ProductsService(context); var result = this.productsService.Include(order.Id, product.ProductCode, product.Name, "10", "1800", lot.SerialNumber); var expectedResult = context.Orders.First().Products.Count > 0; Assert.True(expectedResult, errorMessagePrefix); var innerResult = context.Orders.First().Products.First(); Assert.AreEqual(innerResult, result, errorMessagePrefix); var removeProduct = productsService.Remove(result.OrderId + result.ProductId); Assert.True(order.Products.Count == 0, errorMessagePrefix); }
static LotDB() { var wafer1 = new Wafer { Id = 1, Name = "W01", Defects = new List <Defect> { new Defect { Id = 1, X = 10, Y = 10, Classcode = 1, Roughcode = 2 }, new Defect { Id = 2, X = 10, Y = 10, Classcode = 1, Roughcode = 2 } } }; var wafer2 = new Wafer { Id = 2, Name = "W02", Defects = new List <Defect>() }; for (var i = 0; i < 1000000; i++) { wafer2.Defects.Add(new Defect { Id = i }); } Lot = new Lot { Id = 1, Name = "LotusLot", Wafers = new List <Wafer> { wafer1, wafer2 } }; }
public BLLMethodResult CreateLot(LotDTO lotFromView, int userId) { BLLMethodResult result = new BLLMethodResult(); try { if (TimeCondition(lotFromView.LotTime)) { Lot lot = new Lot(); lot.Name = lotFromView.Name; lot.Description = lotFromView.Description; lot.InitialPrice = lotFromView.InitialPrice; lot.ExpirationTime = DateTime.Now.AddMinutes(lotFromView.LotTime); lot.CreatedBy = userId; lot.CreatedDateTime = DateTime.Now; lot.ModifiedBy = userId; lot.ModifiedDateTime = DateTime.Now; lot.Status = (int)Enum.LotStatus.Created; efu.Lots.Create(lot); result.Result = 0; result.Message = "Your lot has been added."; } else { result.Result = 2; result.Message = "Time is outside the allowable limits."; } } catch (ValidationException ex) { result.Result = 1; result.Message = ex.Message; } return(result); }
protected virtual void computeLatestTimestamp( Lot <LogEntry> entries) { if (entries.Count < 1) { this.LatestTimestamp = default; return; } var latest = new DateTime( 1, 1, 1, 0, 0, 0); var latestChanged = false; foreach (var entry in entries) { if (entry == null) { continue; } var ts = entry.Timestamp; if (ts.TimeOfDay >= latest.TimeOfDay) { latest = ts; latestChanged = true; } } if (!latestChanged) { latest = default; } this.LatestTimestamp = latest; }
public static async Task <BehaviorTree> FromLotAsync(Lot lot) { var tree = new BehaviorTree(); await using var cdClient = new CdClientContext(); var objectSkills = cdClient.ObjectSkillsTable.Where(i => i.ObjectTemplate == lot ).ToArray(); tree.BehaviorIds = new BehaviorInfo[objectSkills.Length]; for (var index = 0; index < objectSkills.Length; index++) { var objectSkill = objectSkills[index]; var behavior = cdClient.SkillBehaviorTable.FirstOrDefault(b => b.SkillID == objectSkill.SkillID); if (behavior == default) { Logger.Error($"Could not find behavior for skill: {objectSkill.SkillID}"); continue; } Logger.Information($"[{lot}] SKILL: {objectSkill.SkillID} -> {behavior.BehaviorID}"); tree.BehaviorIds[index] = new BehaviorInfo { BaseBehavior = behavior.BehaviorID ?? 0, CastType = objectSkill.CastOnType.HasValue ? (SkillCastType)objectSkill.CastOnType : SkillCastType.OnUse, SkillId = objectSkill.SkillID ?? 0, ImaginationCost = behavior.Imaginationcost ?? 0 }; } await tree.BuildAsync(); return(tree); }
private void AddLotAttributeDefects(Lot newLot, ChileProduct chileProduct, DefectTypeEnum defectType, ref List <LotAttributeDefect> lotAttributeDefects) { var defectAttributes = LotMother.AttributeNames.Values.Where(a => a.DefectType == defectType); var chileProductSpecs = chileProduct.ProductAttributeRanges.Join(defectAttributes, r => r.AttributeShortName, a => a.ShortName, (r, a) => new { Range = r, Attribute = a }).ToList(); foreach (var productSpec in chileProductSpecs) { var attributeRange = productSpec.Range; var attribute = productSpec.Attribute; var lotAttribute = newLot.Attributes.FirstOrDefault(a => a.AttributeShortName == attributeRange.AttributeShortName); if (lotAttribute != null) { if (attributeRange.ValueOutOfRange(lotAttribute.AttributeValue)) { LotMother.AddRead(EntityTypes.LotDefect); LotMother.AddRead(EntityTypes.LotAttributeDefect); var lotDefect = newLot.AddNewDefect(defectType, attribute.Name); var lotAttributeDefect = new LotAttributeDefect { LotDateCreated = lotDefect.LotDateCreated, LotDateSequence = lotDefect.LotDateSequence, LotTypeId = lotDefect.LotTypeId, DefectId = lotDefect.DefectId, AttributeShortName = attribute.ShortName, LotDefect = lotDefect, OriginalAttributeValue = lotAttribute.AttributeValue, OriginalAttributeMinLimit = attributeRange.RangeMin, OriginalAttributeMaxLimit = attributeRange.RangeMax }; lotAttributeDefects.Add(lotAttributeDefect); } } } }
private void editDocumentRowBtn_Click(object sender, EventArgs e) { var id = documentId; double quantity; double.TryParse(editDocumentRowQuantityTE.Text, out quantity); originalLot.Quantity = originalLot.Quantity + originalQuantity; using (var db = new WereDesktopEntities()) { db.Lot.AddOrUpdate(originalLot); db.SaveChanges(); } selectedRow.ProductID = editDocumentRowProductTreeListLookUpEdit.EditValue.ToString(); selectedRow.LotID = editDocumentRowLotTreeListLookUpEdit.EditValue.ToString(); selectedRow.Quantity = quantity; using (var db = new WereDesktopEntities()) { var lotToUpdate = new Lot(); var lots = db.Lot.Where(l => l.ID == selectedRow.LotID).ToList(); foreach (Lot lot in lots) { lotToUpdate = lot; } lotToUpdate.Quantity = lotToUpdate.Quantity - selectedRow.Quantity; selectedRow.Sum = Convert.ToDecimal(selectedRow.Quantity) * lotToUpdate.Product.Price; db.DocumentRow.AddOrUpdate(selectedRow); db.SaveChanges(); } }
// Dispatch first eligible lot in queue public override Lot Dispatch(Machine machine) { //Lot peekLot = null; Lot dispatchedLot = null; // Loop through queue till eligible lot is found for (int i = 0; i < Queue.Length; i++) { // Peek next lot in queue Lot peekLot = Queue.PeekAt(i); // Get needed recipe for the lot string recipe = GetRecipe(peekLot, machine); string recipeKey = machine.Name + "__" + recipe; // Check if needed recipe is eligible on machine Boolean recipeEligible = CheckMachineEligibility(recipeKey); // Check if reticle is available Boolean resourceAvailable = CheckResourceAvailability(peekLot); // Check if processingTime is known Boolean processingTimeKnown = CheckProcessingTimeKnown(peekLot, machine, recipe); // Dispatch if lot is eligible if (resourceAvailable && recipeEligible && processingTimeKnown) { // Dequeue earliestDueDateLot dispatchedLot = HandleDeparture(peekLot, machine); break; } } if (dispatchedLot == null) { //Console.WriteLine("Error: No lot in queue which can be dispatched"); } return(dispatchedLot); }
public static void CreateNewCommentNotification(Lot lot, UserRoles recipientRole, Comment comment) { //int recordCount = 0; //var decision=""; //if(comment.OperatorRole.ToLower().Contains("pe")) //{ // decision = "Decision: " + lot.PEDisposeText; //} //else if (comment.OperatorRole.ToLower().Contains("qa")) //{ // decision = "Decision: " + lot.QADisposeText; //} //foreach (User user in UserService.GetUsersByRole(recipientRole, 0, 0x270f, out recordCount)) //{ // if (user.UserID != comment.Operator) // { // Notification newNotification = new Notification { // CreateTime = DateTime.Now, // EmailID = Guid.NewGuid().ToString(), // LotID = lot.LotID, // Message = string.Format("Lot has new Comment", new object[0]), // MessageID = Guid.NewGuid().ToString(), // NotificationType = NotificationTypes.Comment, // Opened = false, // ReadTime = Convert.ToDateTime("1999-12-31"), // RecipientID = user.UserID, // RecordState = 0, // UpdateTime = DateTime.Now // }; // notificationGateway.AddNew(newNotification); // string message = emailGateway.GetEmailByID("CommentNotification").Body.Replace("InsertFullNameHere", user.FullName).Replace("insertLotNoHere", lot.LotNO).Replace("InsertUrlHere", string.Format("https://lhd.spreadtrum.com/Lots/Details?LotID={0}", lot.LotID)).Replace("InsertTimeHere", DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss")).Replace("InsertCommentOperator", comment.OperatorName).Replace("InsertComments", "Comments: "+ comment.CommentText).Replace("InsertDecisionHear", decision); // object[] args = new object[] { lot.VenderID, lot.DeviceCode, lot.DeviceName, lot.LotNO, lot.LotType, lot.Stage }; // string subject = string.Format("[LHD] {0}/{1}/{2}/{3}/{4}/{5} has new comment.", args); // CreateEmail(newNotification.EmailID, newNotification.RecipientID, user.Email, subject, message, lot.LotNO); // } //} notificationGateway.NewCommentNotification(recipientRole.ToString(), lot.ID, comment.CommentID); }
public static void OnLotChanged(Sim sim, Lot oldLot, Lot newLot) { try { if (sim == null) { return; } if (sim.LotHome == null) { return; } if (sim.LotHome == newLot) { Caregivers caregiver; if (GoHere.Settings.mCaregivers.TryGetValue(newLot.LotId, out caregiver)) { if ((sim.SimDescription.TeenOrAbove) && (sim.IsHuman)) { caregiver.ReturnChildren(); } } } if ((sim.LotHome == oldLot) && (sim.SimDescription.TeenOrAbove) && (sim.IsHuman)) { TestHomeTask.Perform(sim.Household); } else if ((sim.LotHome == newLot) && (sim.SimDescription.ToddlerOrBelow)) { TestHomeTask.Perform(sim.Household); } } catch (Exception e) { Common.Exception(sim, e); } }
public void BuyNow(int id) { using (Database) { Lot lot = Database.Lots.Get(id); if (lot == null) { throw new ItemNotFoundException($"Item {id} not found"); } if (lot.IsAllowed && lot.IsOpen) { lot.IsOpen = false; lot.CurrPrice = lot.BuyNowPrice; Database.Lots.Update(lot); Database.Save(); } else { throw new ValidationException("Лот закрыт или неподтвержден..."); } } }
public async Task <IActionResult> Create([Bind("lotId,lotno,ItemTotal,lotDescription,Attachment,ActivityID,ContractorID,ExpiryDate")] Lot lot) { if (ModelState.IsValid) { lot.ContractorID = 62; _context.Add(lot); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Create), new { lot.ActivityID })); } var query = _context.Activity.Where(a => a.ActivityID == lot.ActivityID); ViewBag.ActivityID = new SelectList(query, "ActivityID", "Name"); int LotTotal = query.Select(a => a.LotTotal).FirstOrDefault(); int CurrentLot = _context.Lot.Count(a => a.ActivityID == lot.ActivityID); ViewBag.LotTotal = LotTotal; ViewBag.CurrentLot = CurrentLot; ViewBag.NextLot = CurrentLot + 1; ViewBag.RemainingLot = LotTotal - CurrentLot; return(View(lot)); }
public ActionResult Edit(int?lotId) { if (lotId == null) { return(RedirectToAction("Index", "Home")); } Lot prod = lotsRepository.Lots.FirstOrDefault(p => p.LotID == lotId); if (prod != null) { return(View(new EditModel { Categories = categoriesRepository.Categories.Select(x => new Categories { Id = x.CategoryId, Name = x.CategoryName }).ToList(), Description = prod.Description, LotID = prod.LotID, Name = prod.Name })); } return(RedirectToAction("Index", "Home")); }