Beispiel #1
0
        static void CheckCompletedDrawingWork(CompletedSubChunkDrawingWork cscdw)
        {
            AssignedWorkContainer awc;

            AssignedWork.TryGetValue(cscdw.ChunkPos, out awc);
            AssignedJob aj = awc.TryGetAssignedJob(JobType.Draw);

            aj.CompletedCount += 1;
            Chunk c;

            ChunkHandler.TryGetChunk(aj.OwnerChunkPos, out c);

            if (aj.IsCompleted)
            {
                awc.RemoveAssignedJob(JobType.Draw);
                ChunkGameObjectHandler.UpdateMesh(c.ChunkPos, c.GetMesh()).transform.position = c.ChunkPos * Chunk.CHUNKSIZE;
            }
        }
        /// <summary>
        /// Check if a job is assigned to an employee.
        /// </summary>
        /// <param name="jobTitle"></param>
        /// <param name="employee"></param>
        /// <returns>True if job is assigned to an employee.</returns>
        public bool IsJobAssignedToEmployee(string jobTitle, Employee employee)
        {
            using (var connection = new SQLiteConnection(ConnectionString))
            {
                var jobId = Jobs.GetId(jobTitle);

                var query = "select * from AssignedJobs where EmployeeId = @EmployeeId and JobId = @JobId;";

                AssignedJob result = connection.QueryFirstOrDefault <AssignedJob>(query,
                                                                                  new
                {
                    EmployeeId = employee.Id,
                    JobId      = jobId
                });

                return(result != null);
            }
        }