コード例 #1
0
ファイル: LogicPL.cs プロジェクト: JuliaVolokhina/ADO.NET
        public static void AddListOfWorkers()
        {
            Console.WriteLine("Введите ID работника");
            var idEmployee = Console.ReadLine();

            Console.WriteLine("Введите ID должности");
            var idPosition = Console.ReadLine();

            var currentinfo = new ListOfWorkers()
            {
                IDEmployee = Int32.Parse(idEmployee),
                IDPosition = Int32.Parse(idPosition)
            };

            listOfWorkersLogic.AddListOfWorkers(currentinfo);
        }
コード例 #2
0
        //private string connnectionString = "Data Source=DESKTOP-EMEUIMH\\SQLEXPRESS; Initial Catalog = Company; Integrated Security = True";

        public int AddListOfWorkers(ListOfWorkers value)
        {
            const string sqlExpression =
                "INSERT INTO ListOfWorkers (IDEmployee, IDPosition) VALUES (@IDEmployee, @IDPosition)";

            using (var connection = MSSQLdb.GetConnection())
            {
                connection.Open();
                var command = new SqlCommand(sqlExpression, connection);
                var param   = new SqlParameter("@IDEmployee", value.IDEmployee);
                command.Parameters.Add(param);
                var param2 = new SqlParameter("@IDPosition", value.IDPosition);
                command.Parameters.Add(param2);
                var number = command.ExecuteNonQuery();
                return(number);
            }
        }
コード例 #3
0
 public int AddListOfWorkers(ListOfWorkers value)
 {
     return(this.listOfWorkersDao.AddListOfWorkers(value));
 }
コード例 #4
0
ファイル: Fire.cs プロジェクト: Natsirtt/ggj-2019
    // Update is called once per frame
    void Update()
    {
        if (!shouldUpdate)
        {
            return;
        }

        if (!spawnedInitialWorkers && GridTile.TileType == World.Tile.Type.Hearth)
        {
            spawnedInitialWorkers = true;
            for (int i = 0; i < World.Get().GenerationParameters.resources.startingWorkers; i++)
            {
                GameObject worker = World.Get().SpawnWorker(this, false);
                ListOfWorkers.Add(worker);
            }
        }
        if (needsToActivate)
        {
            Activate();
            needsToActivate = false;
        }
        if (nextHouseSpawnTick <= Time.time)
        {
            World.Tile tile = influence.OrderBy(t => Random.value).ToList().Find(t => t.TileType == World.Tile.Type.Grass && !world.GetTilesInRadius(t.Coordinates, world.GenerationParameters.infrastructures.minimumManhattanDistanceBetweenHouses).Any(neighbour => neighbour.TileType == World.Tile.Type.House));
            if (tile != null)
            {
                world.SetTileType(tile.Coordinates, World.Tile.Type.House);
            }
            nextHouseSpawnTick = Time.time + Random.Range(world.GenerationParameters.infrastructures.houseSpawnPerSecondInterval.x, world.GenerationParameters.infrastructures.houseSpawnPerSecondInterval.y);
        }

        burnProgress += Time.deltaTime * currentBurnRatePerSecond;
        if (burnProgress >= 1f)
        {
            int woodBurnt = Mathf.FloorToInt(burnProgress);
            if (globalInventory.CurrentWood < woodBurnt)
            {
                // Warn the player, dim down the fire?
                Shrink();
                burnProgress = 0f;
                return;
            }
            globalInventory.RemoveWood(woodBurnt);
            burnProgress -= (float)woodBurnt;
        }
        spawnProgress += Time.deltaTime * currentWorkerSpawnRate;
        if (spawnProgress >= 1f)
        {
            int spawning = Mathf.FloorToInt(spawnProgress);
            spawnProgress = spawnProgress - spawning;
            while (spawning > 0)
            {
                // TODO randomize this position
                GameObject worker = world.SpawnWorker(this);
                listOfAssociatedWorkers.Add(worker);
                spawning -= 1;
            }
        }
        foreach (JobDispatcher.Job job in Jobs.chopJobs())
        {
            Debug.DrawLine(transform.position, world.GetWorldLocation(job.Coordinates));
        }
    }