public async Task <IActionResult> Edit(int id, [Bind("AmmoId,DocNumber,Dodic,Nomenclature,LotNumber,InitialQty,CurrentQty,Location")] LocalInventory localInventory)
        {
            if (id != localInventory.AmmoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(localInventory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocalInventoryExists(localInventory.AmmoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(localInventory));
        }
Esempio n. 2
0
 public IActionResult AddInventory(LocalInventory local)
 {
     if (ModelState.IsValid)
     {
         local.CurrentStock = 0;
         db.LocalInventory.Add(local);
         db.SaveChanges();
         return(RedirectToAction("InventoryCatalogue", local));
     }
     return(RedirectToAction("InventoryCatalogue", local));
 }
        public async Task <IActionResult> Create([Bind("AmmoId,DocNumber,Dodic,Nomenclature,LotNumber,InitialQty,CurrentQty,Location")] LocalInventory localInventory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(localInventory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(localInventory));
        }
Esempio n. 4
0
        private static void Migrate()
        {
            Console.WriteLine($"Migrating old Librarian data from \"{Settings.MigrateOldLibrarianData}\" to \"{Settings.LibraryRoot}\"");

            LocalInventory localInventory = new LocalInventory(Settings.LibraryRoot, new List <Game.AppType>());

            foreach (Game.BuildType buildType in Enum.GetValues(typeof(Game.BuildType)).Cast <Game.BuildType>())
            {
                string buildRoot = Path.Combine(Settings.MigrateOldLibrarianData, Game.BuildTypeToString(buildType));

                if (!Directory.Exists(buildRoot))
                {
                    continue;
                }

                foreach (string versions in Directory.EnumerateDirectories(buildRoot))
                {
                    string gameFolder = Directory.EnumerateDirectories(versions).FirstOrDefault();
                    if (gameFolder is null)
                    {
                        continue;
                    }

                    string fileName = Path.GetFileName(versions);

                    string meta = File.ReadAllText(Path.Combine(gameFolder, fileName + ".json"));

                    Game game = new Game(meta);

                    Dictionary <Game.AppType, IResource> files = new Dictionary <Game.AppType, IResource>();

                    if (File.Exists(Path.Combine(gameFolder, "client.jar")))
                    {
                        files[Game.AppType.Client] = LocalResource.Load(Path.Combine(gameFolder, "client.jar"));
                    }

                    if (File.Exists(Path.Combine(gameFolder, "server.jar")))
                    {
                        files[Game.AppType.Server] = LocalResource.Load(Path.Combine(gameFolder, "server.jar"));
                    }

                    localInventory.AddGame(game, files);

                    foreach (IResource resource in files.Values)
                    {
                        resource.Data.Dispose();
                    }
                }
            }

            Console.WriteLine("Migration complete");
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject     player = GameObject.Find(StaticInfo.playerName);
        LocalInventory li     = new LocalInventory();

        li.Load();
        float y = 0;

        foreach (string s in StaticInfo.myCustom)
        {
            GameObject instParts = PhotonNetwork.Instantiate(s, new Vector3(player.transform.position.x, player.transform.position.y + y, 0), Quaternion.Euler(player.transform.forward));
            instParts.transform.parent = player.transform.Find("CustomParts").transform;
            y++;
        }
    }
Esempio n. 6
0
 public PlaceOrder()
 {
     Product    = new LocalInventory();
     IsSelected = false;
     Quantity   = Product.ReorderLevel + 1;
 }