public void Exception_While_No_Inventory_Available() { InventoryManagement inventoryManagement = new InventoryManagement(); inventoryManagement.Inventories = null; Assert.Throws <IndexOutOfRangeException>(inventoryManagement.Adjust); }
// Use this for initialization void Start() { inv = GameObject.Find("Player").GetComponent <InventoryManagement>(); moneyMng = GameObject.Find("Player").GetComponent <MoneyManagement>(); }
private void Start() { inv = new InventoryManagement(ConstantVariables.INVENTORYSLOTS); shootScript = GetComponent <Shooter>(); movementScript = GetComponent <PlayerMovement>(); state = CharacterState.HEALTHY; }
/// <summary> /// Removes inventory parts, refunds funds, marks it as tracked /// </summary> /// <param name="parts">The vessel as a List of Parts</param> /// <returns>True if processed, false otherwise</returns> public bool ProcessVessel_Nodes(IEnumerable <ConfigNode> partNodes) { if (!ScrapYard.Instance.Settings.EnabledForSave) { return(true); } //try to get the ID out of the list uint ID = 0; if (partNodes.FirstOrDefault()?.TryGetValue("persistentId", ref ID) != true) { return(false); //for now we can't process this vessel. Sorry. Maybe later we'll be able to add the module } //check that it isn't already processed if (ScrapYard.Instance.ProcessedTracker.IsProcessed(ID)) { return(false); } //remove parts InventoryManagement.RemovePartsFromInventory(partNodes); //Mark as processed ScrapYard.Instance.ProcessedTracker.TrackVessel(ID, true); return(true); }
public void Button_SetShopBuy() { // hide the sell buy option panel sellBuyOptionPanel.SetActive(false); // make the shop panel visible shopPanel.SetActive(true); // make the buy button visible buyButton.SetActive(true); if (shopText != null) { shopText.text = "BUY"; } currInv = shop.inv; // set the hud icons to show the current inventory's items for (int i = 0; i < itemIcons.Length; i++) { if (currInv.GetItemFromIndex(i) != null) { itemIcons[i].sprite = currInv.GetItemFromIndex(i).Image; } else { itemIcons[i].gameObject.SetActive(false); inputs[i].gameObject.SetActive(false); } } }
private void Start() { inventoryManagement = this; currentAll.onClick.AddListener(delegate { currentCategory = ItemCategory.all; showCurrent(); }); currentUpgrade.onClick.AddListener(delegate { currentCategory = ItemCategory.upgrade; showCurrent(); }); currentLuxury.onClick.AddListener(delegate { currentCategory = ItemCategory.luxury; showCurrent(); }); currentIndustry.onClick.AddListener(delegate { currentCategory = ItemCategory.industry; showCurrent(); }); currentCommon.onClick.AddListener(delegate { currentCategory = ItemCategory.common; showCurrent(); }); currentFood.onClick.AddListener(delegate { currentCategory = ItemCategory.food; showCurrent(); }); currentSupplies.onClick.AddListener(delegate { currentCategory = ItemCategory.supplies; showCurrent(); }); currentAlpha.onClick.AddListener(delegate { currentSortingMode = SortingMode.alphabet; showCurrent(); }); currentWeightSingle.onClick.AddListener(delegate { currentSortingMode = SortingMode.weightSingle; showCurrent(); }); currentWeightTotal.onClick.AddListener(delegate { currentSortingMode = SortingMode.weightTotal; showCurrent(); }); currentValueSingle.onClick.AddListener(delegate { currentSortingMode = SortingMode.valueSingle; showCurrent(); }); currentValueTotal.onClick.AddListener(delegate { currentSortingMode = SortingMode.valueTotal; showCurrent(); }); currentAmountTotal.onClick.AddListener(delegate { currentSortingMode = SortingMode.amount; showCurrent(); }); selectingAll.onClick.AddListener(delegate { selectingCategory = ItemCategory.all; showSelecting(); }); selectingUpgrade.onClick.AddListener(delegate { selectingCategory = ItemCategory.upgrade; showSelecting(); }); selectingLuxury.onClick.AddListener(delegate { selectingCategory = ItemCategory.luxury; showSelecting(); }); selectingIndustry.onClick.AddListener(delegate { selectingCategory = ItemCategory.industry; showSelecting(); }); selectingCommon.onClick.AddListener(delegate { selectingCategory = ItemCategory.common; showSelecting(); }); selectingFood.onClick.AddListener(delegate { selectingCategory = ItemCategory.food; showSelecting(); }); selectingSupplies.onClick.AddListener(delegate { selectingCategory = ItemCategory.supplies; showSelecting(); }); selectingAlpha.onClick.AddListener(delegate { selectingSortingMode = SortingMode.alphabet; showSelecting(); }); selectingWeightSingle.onClick.AddListener(delegate { selectingSortingMode = SortingMode.weightSingle; showSelecting(); }); selectingWeightTotal.onClick.AddListener(delegate { selectingSortingMode = SortingMode.weightTotal; showSelecting(); }); selectingValueSingle.onClick.AddListener(delegate { selectingSortingMode = SortingMode.valueSingle; showSelecting(); }); selectingValueTotal.onClick.AddListener(delegate { selectingSortingMode = SortingMode.valueTotal; showSelecting(); }); selectingAmountTotal.onClick.AddListener(delegate { selectingSortingMode = SortingMode.amount; showSelecting(); }); }
public void ApplyInventoryToEditorVessel() { if (EditorLogic.fetch != null && EditorLogic.fetch.ship != null && EditorLogic.fetch.ship.Parts.Any()) { InventoryManagement.ApplyInventoryToVessel(EditorLogic.fetch.ship.Parts); } }
public async void CanCreateProductAndSaveToDatabase() { DbContextOptions <StoreDbContext> options = new DbContextOptionsBuilder <StoreDbContext>() .UseInMemoryDatabase("CanCreateGameAndSaveToDatabase") .Options; using StoreDbContext context = new StoreDbContext(options); InventoryManagement service = new InventoryManagement(context, _image, _config); Product dog = new Product() { Name = "Rampage2", Age = 20, Breed = "American Bull Dog", Color = "Brindle", Description = "Absolutely is an attention hog. He will chill and hang out with you all day and love life. He enjoys the outdoors " + "from sunbathing in the backyard to going for long walks. Is very obedient and will let you clean his ears, brush ", Price = 200000, SuperPower = "Super Speed", }; Assert.Equal(0, context.Products.CountAsync().Result); var result = await service.CreateProduct(dog); var actual = context.Products.FindAsync(result.Id).Result; Assert.Equal(1, context.Products.CountAsync().Result); // Assert.IsType<Games>(actual); Assert.Equal(1, actual.Id); Assert.Equal("Rampage2", actual.Name); }
public ActionResult DeleteConfirmed(int id) { InventoryManagement inventoryManagement = db.InventoryManagements.Find(id); db.InventoryManagements.Remove(inventoryManagement); db.SaveChanges(); return(RedirectToAction("Index")); }
private void OnEnable() { if (inventoryManagement == null) { inventoryManagement = gameObject.GetComponent <InventoryManagement>(); } initialized = false; inspectItemList(null); }
/// <summary> /// Sells/Discards the list of parts out of the inventory /// </summary> /// <param name="parts">The parts to sell</param> /// <returns>The total value of the sale</returns> public double SellParts_Nodes(IEnumerable <ConfigNode> parts) { if (!ScrapYard.Instance.TheInventory.InventoryEnabled) { return(0); } return(InventoryManagement.SellParts(parts.Select(p => new InventoryPart(p)))); }
// Use this for initialization void Start() { invMng = GetComponent <InventoryManagement>(); plyCam = plyCamObj.GetComponent <Camera>(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
public PurchaseController(IPurchaseOrderRepository purchaseOrderRepository, EmployeeLogin employeeLogin, ISupplierRepository supplierRepository, IProductRepository productRepository, InventoryManagement inventoryManagement) { _purchaseOrderRepository = purchaseOrderRepository; _employeeLogin = employeeLogin; _supplierRepository = supplierRepository; _productRepository = productRepository; _inventoryManagement = inventoryManagement; }
static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .AddEnvironmentVariables(); Configuration = builder.Build(); var loggerFactory = new LoggerFactory() .AddConsole() .AddDebug(); ILogger logger = loggerFactory.CreateLogger <Program>(); var rpcLogger = loggerFactory.CreateLogger <InventoryManagementImpl>(); var port = int.Parse(Configuration["service:port"]); var brokerList = Configuration["kafkaclient:brokerlist"]; const string ReservedTopic = "inventoryreserved"; const string ReleasedTopic = "inventoryreleased"; var config = new Dictionary <string, object> { { "group.id", "inventory-server" }, { "enable.auto.commit", false }, { "bootstrap.servers", brokerList } }; //var context = new InventoryContext(Configuration["postgres:connectionstring"]); var context = new InventoryContext(); var repo = new InventoryRepository(context); var reservedEventProcessor = new InventoryReservedEventProcessor(repo); var kafkaConsumer = new KafkaReservedConsumer(ReservedTopic, config, reservedEventProcessor); kafkaConsumer.Consume(); var releasedEventProcessor = new InventoryReleasedEventProcessor(repo); var releasedConsumer = new KafkaReleasedConsumer(ReleasedTopic, config, releasedEventProcessor); releasedConsumer.Consume(); var refImpl = new ReflectionServiceImpl( ServerReflection.Descriptor, InventoryManagement.Descriptor); var inventoryManagement = new InventoryManagementImpl(repo, rpcLogger); var server = new Server { Services = { InventoryManagement.BindService(inventoryManagement), ServerReflection.BindService(refImpl) }, Ports = { new ServerPort("localhost", port, ServerCredentials.Insecure) } }; server.Start(); logger.LogInformation("Inventory gRPC Service Listening on Port " + port); mre.WaitOne(); }
// Use this for initialization void Start() { invMng = GetComponent<InventoryManagement>(); plyCam = plyCamObj.GetComponent<Camera>(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void Start() { cameraPos = camPos; playerPos = plPos; gNotice = gatherNotice; resPopup = resourcePopup; resGatherTool = resourceGatherToolUI; startHint = startHintText; }
public ActionResult Edit([Bind(Include = "ID,Name,Quantity,Description")] InventoryManagement inventoryManagement) { if (ModelState.IsValid) { db.Entry(inventoryManagement).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inventoryManagement)); }
protected override void AwakeActor() { m_Inventory = new InventoryManagement(GetComponent <Player>()); m_PlayerAnimation = new PlayerAnimation(); mBehaviorsList.Add(m_PlayerAnimation); mBehaviorsList.Add(m_Inventory); m_MaxHp = 2; m_CurrentHp = 2; }
public ActionResult Create([Bind(Include = "ID,Name,Quantity,Description")] InventoryManagement inventoryManagement) { if (ModelState.IsValid) { db.InventoryManagements.Add(inventoryManagement); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inventoryManagement)); }
public SalesController(ISalesOrderRepository salesOrderRepository, ISaleBoxRepository saleBoxRepository, InventoryManagement inventoryManagement, IClientRepository clientRepository, OpenBox openBox, EmployeeLogin employeeLogin, RagnarokContext context) { _salesOrderRepository = salesOrderRepository; _saleBoxRepository = saleBoxRepository; _clientRepository = clientRepository; _inventoryManagement = inventoryManagement; _openBox = openBox; _employeeLogin = employeeLogin; _context = context; }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryManagement inventoryManagement = db.InventoryManagements.Find(id); if (inventoryManagement == null) { return(HttpNotFound()); } return(View(inventoryManagement)); }
static void Main(string[] args) { Console.WriteLine("****************************"); Console.WriteLine("Inventory Management System"); Console.WriteLine("****************************"); InventoryManagement inventoryManagement = new InventoryManagement(); Console.WriteLine("Inventory List"); EmptyLine(); Columns(); //Console.WriteLine(string.Format("{0,-20}{1,5}{2,10}", "Item", "SellIn", "Quality")); foreach (var inventory in inventoryManagement.Inventories.Value) { Console.WriteLine(string.Format("{0,-20}{1,5}{2,10}", inventory.Item.Name, inventory.SellIn, inventory.Quality)); } EndListLine(); bool valid = false; string value = ""; string exit = ""; do { Console.WriteLine(@"Enter 'DayEnd' to view end of the day results"); value = Console.ReadLine()?.ToLower(); valid = value == "dayend"; while (valid && exit != "exit") { inventoryManagement.Adjust(); EmptyLine(); Console.WriteLine("Updated Inventory List"); EmptyLine(); Columns();//Console.WriteLine(string.Format("{0,-20}{1,5}{2,10}", "Item", "SellIn", "Value")); foreach (var inventory in inventoryManagement.Inventories.Value) { Console.WriteLine(string.Format("{0,-20}{1,5}{2,10}", (!string.IsNullOrEmpty(inventory.Item.Error) && !string.IsNullOrWhiteSpace(inventory.Item.Error)) ? inventory.Item.Error : inventory.Item.Name, inventory.SellIn, inventory.Quality)); } EndListLine(); Console.WriteLine(@"Enter 'Exit' to close application"); exit = Console.ReadLine()?.ToLower(); } } while (!valid); }
public void CreateInvMgmt(string itemId, int updateQty, int empId) { InventoryItem item = GetItemById(itemId); int currQty = item.QtyInStock; InventoryManagement invMgmt = new InventoryManagement(); invMgmt.EmployeeId = empId; invMgmt.Date = DateTime.Now; invMgmt.InventoryItemId = itemId; invMgmt.addQty = updateQty; adProjContext.Add(invMgmt); item.QtyInStock = currQty + updateQty; adProjContext.SaveChanges(); }
public void VesselRolloutEvent(ShipConstruct vessel) { if (!ScrapYard.Instance.Settings.EnabledForSave) { return; } Logging.DebugLog("Vessel Rollout!"); //If vessel not processed, then take parts //If already processed, just return if (ScrapYard.Instance.ProcessedTracker.Remove(vessel.Parts[0].persistentId)) { return; } InventoryManagement.RemovePartsFromInventory(vessel.Parts); ScrapYard.Instance.PartTracker.AddBuild(vessel.Parts); }
public void Legendary_Item_Before_SellIn_Date() { InventoryManagement inventoryManagement = new InventoryManagement(); inventoryManagement.Inventories = new Lazy <IEnumerable <IInventory> >(() => { return(new List <IInventory>() { new Inventory() { Item = Repos.Items.FirstOrDefault(i => i.GetType() == typeof(Sulfuras)), SellIn = 2, Quality = 5 } }); }); inventoryManagement.Adjust(); var inventory = inventoryManagement.Inventories.Value.ElementAt(0); Assert.AreEqual(inventory.Quality, 5); Assert.AreEqual(inventory.SellIn, 2); }
// Use this for initialization void Start() { invMng = GameObject.Find("Player").GetComponent <InventoryManagement>(); slotNames = new string[parts.Length]; partPositions = new Vector3[parts.Length]; partRotations = new Quaternion[parts.Length]; partScales = new Vector3[parts.Length]; for (int i = 0; i < parts.Length; i++) { var thePartPos = parts[i].transform.position; var thePartRot = parts[i].transform.rotation; var thePartScale = parts[i].transform.localScale; partPositions[i] = new Vector3(thePartPos.x, thePartPos.y, thePartPos.z); partRotations[i] = new Quaternion(thePartRot.x, thePartRot.y, thePartRot.z, thePartRot.w); partScales[i] = new Vector3(thePartScale.x, thePartScale.y, thePartScale.z); slotNames[i] = parts[i].GetComponent <TVPartScript>().Name; } }
public void Sulfuras_Item_After_SellIn_Date_Over_50() { InventoryManagement inventoryManagement = new InventoryManagement(); inventoryManagement.Inventories = new Lazy <IEnumerable <IInventory> >(() => { return(new List <IInventory>() { new Inventory() { Item = Repos.Items.FirstOrDefault(i => i.GetType() == typeof(Sulfuras)), SellIn = -4, Quality = 55 } }); }); inventoryManagement.Adjust(); var inventory = inventoryManagement.Inventories.Value.ElementAt(0); Assert.AreEqual(inventory.Quality, 50); Assert.AreEqual(inventory.SellIn, -4); }
public void BackStagePass_Item_Before_SellIn_Date_Greater_10() { InventoryManagement inventoryManagement = new InventoryManagement(); inventoryManagement.Inventories = new Lazy <IEnumerable <IInventory> >(() => { return(new List <IInventory>() { new Inventory() { Item = Repos.Items.FirstOrDefault(i => i.GetType() == typeof(BackstagePass)), SellIn = 12, Quality = 5 } }); }); inventoryManagement.Adjust(); var inventory = inventoryManagement.Inventories.Value.ElementAt(0); Assert.AreEqual(inventory.Quality, 6); Assert.AreEqual(inventory.SellIn, 11); }
// Use this for initialization void Start() { invMng = GameObject.Find("Player").GetComponent<InventoryManagement>(); slotNames = new string[parts.Length]; partPositions = new Vector3[parts.Length]; partRotations = new Quaternion[parts.Length]; partScales = new Vector3[parts.Length]; for (int i = 0; i < parts.Length; i++) { var thePartPos = parts[i].transform.position; var thePartRot = parts[i].transform.rotation; var thePartScale = parts[i].transform.localScale; partPositions[i] = new Vector3(thePartPos.x, thePartPos.y, thePartPos.z); partRotations[i] = new Quaternion(thePartRot.x, thePartRot.y, thePartRot.z, thePartRot.w); partScales[i] = new Vector3(thePartScale.x, thePartScale.y, thePartScale.z); slotNames[i] = parts[i].GetComponent<TVPartScript>().Name; } }
public void Normal_Item_After_SellIn_Date_While_Negative_Quality() { InventoryManagement inventoryManagement = new InventoryManagement(); inventoryManagement.Inventories = new Lazy <IEnumerable <IInventory> >(() => { return(new List <IInventory>() { new Inventory() { Item = Repos.Items.FirstOrDefault(i => i.GetType() == typeof(Normal)), SellIn = -1, Quality = -4 } }); }); inventoryManagement.Adjust(); var inventory = inventoryManagement.Inventories.Value.ElementAt(0); Assert.AreEqual(inventory.Quality, 0); Assert.AreEqual(inventory.SellIn, -2); }
public PlayerData(Player player, int playerId, string username, string motto, string look, int homeRoom, int rank, int achievementScore, string clientVolume, bool chatPreference, bool allowMessengerInvites, bool focusPreference, int vipRank) { _player = player; _playerId = playerId; _username = username; _motto = motto; _look = look; _homeRoom = homeRoom; _rank = rank; _achievementScore = achievementScore; _clientVolumes = new List <int>(); _chatPreference = chatPreference; _allowMessengerInvites = allowMessengerInvites; _focusPreference = focusPreference; _vipRank = vipRank; _permissionManagement = new PermissionManagement(_player); _playerAchievements = new ConcurrentDictionary <string, PlayerAchievement>(); _favouriteRoomIds = new List <int>(); _mutedUsers = new List <int>(); _badgeManagement = new BadgeManagement(_player); _inventoryManagement = new InventoryManagement(_player); _playerQuests = new Dictionary <int, int>(); _playerBuddies = new Dictionary <int, MessengerBuddy>(); _playersRooms = new List <RoomInformation>(); _playerRelationships = new Dictionary <int, PlayerRelationship>(); _effectManagement = new EffectManagement(_player); _clothingManagement = new ClothingManagement(_player); _logManager = Sahara.GetServer().GetLogManager(); _processor = new PlayerProcessor(_player); foreach (var volumeString in clientVolume.Split(',')) { if (string.IsNullOrEmpty(volumeString)) { continue; } var volumeValue = 0; _clientVolumes.Add(int.TryParse(volumeString, out volumeValue) ? int.Parse(volumeString) : 100); } }
static void Main(string[] args) { string brokerList = "localhost:9092"; const string reservedTopic = "inventoryreserved"; const string releasedTopic = "inventoryreleased"; var config = new Dictionary <string, object> { { "group.id", "inventory-server" }, { "enable.auto.commit", false }, { "bootstrap.servers", brokerList } }; var context = new InventoryContext(); var repo = new InventoryRepository(context); var reservedEventProcessor = new InventoryReservedEventProcessor(repo); var kafkaConsumer = new KafkaReservedConsumer(reservedTopic, config, reservedEventProcessor); kafkaConsumer.Consume(); var releasedEventProcessor = new InventoryReleasedEventProcessor(repo); var releasedConsumer = new KafkaReleasedConsumer(releasedTopic, config, releasedEventProcessor); releasedConsumer.Consume(); const int Port = 3002; Server server = new Server { Services = { InventoryManagement.BindService(new InventoryManagementImpl(repo)) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine($"Inventory management listening on port {Port}. Press any key to stop"); Console.ReadKey(); }
// Use this for initialization void Start() { inv = GameObject.Find("Player").GetComponent<InventoryManagement>(); moneyMng = GameObject.Find("Player").GetComponent<MoneyManagement>(); }
// Use this for initialization void Start() { objInt = GameObject.Find("Player").GetComponent<ObjectInteraction>(); invMng = objInt.gameObject.GetComponent<InventoryManagement>(); }