コード例 #1
0
 public bool TryTakeOrderedJob(CaravanJob job, JobTag tag = JobTag.Misc)
 {
     DebugLogEvent("TakeOrderedJob " + job);
     job.playerForced = true;
     if (curJob != null && curJob.JobIsSameAs(job))
     {
         return(true);
     }
     caravan.pather.StopDead();
     //caravan.Map.CaravanDestinationManager.UnreserveAllFor(caravan);
     //if (job.def == CaravanJobDefOf.Goto)
     //{
     //    //caravan.Map.CaravanDestinationManager.ReserveDestinationFor(caravan, job.targetA.Cell);
     //}
     DebugLogEvent("    Queueing job");
     jobQueue.Clear();
     jobQueue.EnqueueFirst(job, tag);
     if (IsCurrentJobPlayerInterruptible())
     {
         if (curJob != null)
         {
             curDriver.EndJobWith(JobCondition.InterruptForced);
         }
         else
         {
             CheckForJobOverride();
         }
     }
     return(true);
 }
コード例 #2
0
ファイル: Create.cshtml.cs プロジェクト: avjgit/job_matching
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(
            string[] selectedTags)
        {
            var newJob = new Job();

            if (selectedTags != null)
            {
                newJob.JobTags = new List <JobTag>();
                foreach (var tag in selectedTags)
                {
                    var tagtoAdd = new JobTag
                    {
                        TagID = int.Parse(tag)
                    };
                    newJob.JobTags.Add(tagtoAdd);
                }
            }

            if (await TryUpdateModelAsync <Job>(
                    newJob,
                    "job",
                    s => s.ID, s => s.CompanyID, s => s.Title, s => s.CareerLevel, s => s.City,
                    s => s.Description))
            {
                _context.Jobs.Add(newJob);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            UpdateJobTags(_context, selectedTags, newJob);
            PopulateJobTags(_context, newJob);
            PopulateCompaniesDropDownList(_context, newJob.CompanyID);
            return(Page());
        }
コード例 #3
0
        public List <JobPosting> SelectAll()
        {
            List <JobPosting> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobPosting_SelectAll",
                                    inputParamMapper : null,
                                    map : delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    JobPosting jobPosting = MapJobPosting(reader);
                    if (list == null)
                    {
                        list = new List <JobPosting>();
                    }
                    list.Add(jobPosting);
                    break;

                case 1:
                    int jobPostingId = 0;
                    JobTag jobTag    = MapJobTagList(reader, out jobPostingId);
                    JobPosting jp    = list.Find(item => item.Id == jobPostingId);
                    if (jp.JobTags == null)
                    {
                        jp.JobTags = new List <JobTag>();
                    }
                    jp.JobTags.Add(jobTag);
                    break;
                }
            }
                                    );

            return(list);
        }
コード例 #4
0
        public async Task <IActionResult> Edit(Guid id, [Bind("TagName,ID")] JobTag jobTag)
        {
            if (id != jobTag.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobTag);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobTagExists(jobTag.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobTag));
        }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            JobTag jobTag = db.JobTags.Find(id);

            db.JobTags.Remove(jobTag);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
        public JobPosting SelectById(int id)
        {
            JobPosting    jobPosting = new JobPosting();
            List <JobTag> jtList     = null;
            List <JobApplicationEmployer> jpaList = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobPosting_SelectById",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", id);
            }
                                    , map : (Action <IDataReader, short>) delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    jobPosting = MapJobPosting(reader);
                    break;

                case 1:
                    int jobPostingId = 0;
                    JobTag jobTag    = MapJobTagList(reader, out jobPostingId);
                    if (jtList == null)
                    {
                        jtList = new List <JobTag>();
                    }
                    jtList.Add(jobTag);
                    break;

                case 2:
                    JobApplicationEmployer jpa = new JobApplicationEmployer();

                    int ord = 0;

                    jpa.Id                = reader.GetSafeInt32(ord++);
                    jpa.PersonId          = reader.GetSafeInt32(ord++);
                    jpa.FirstName         = reader.GetSafeString(ord++);
                    jpa.LastName          = reader.GetSafeString(ord++);
                    jpa.JobTitle          = reader.GetSafeString(ord++);
                    jpa.Resume            = reader.GetSafeString(ord++);
                    jpa.CoverLetter       = reader.GetSafeString(ord++);
                    jpa.ApplicationStatus = reader.GetSafeString(ord++);
                    jpa.Notes             = reader.GetSafeString(ord++);
                    jpa.DateCreated       = reader.GetSafeDateTime(ord++);

                    if (jpaList == null)
                    {
                        jpaList = new List <JobApplicationEmployer>();
                    }
                    jpaList.Add(jpa);
                    break;
                }
            }
                                    );
            jobPosting.JobTags      = jtList;
            jobPosting.Applications = jpaList;
            return(jobPosting);
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "Id,Tag")] JobTag jobTag)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobTag).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobTag));
 }
コード例 #8
0
        private static JobTag MapJobTag(IDataReader reader)
        {
            JobTag jobTag = new JobTag();
            int    ord    = 0;

            jobTag.Id           = reader.GetSafeInt32(ord++);
            jobTag.Keyword      = reader.GetSafeString(ord++);
            jobTag.DisplayOrder = reader.GetSafeInt32(ord++);
            return(jobTag);
        }
コード例 #9
0
        private static JobTag MapJobTagList(IDataReader reader, out int jobPostingId)
        {
            JobTag jt  = new JobTag();
            int    ord = 0;

            jobPostingId    = reader.GetSafeInt32(ord++);
            jt.Id           = reader.GetSafeInt32(ord++);
            jt.Keyword      = reader.GetSafeString(ord++);
            jt.DisplayOrder = reader.GetSafeInt32(ord++);
            return(jt);
        }
コード例 #10
0
        public ActionResult Create([Bind(Include = "Id,Tag")] JobTag jobTag)
        {
            if (ModelState.IsValid)
            {
                db.JobTags.Add(jobTag);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jobTag));
        }
コード例 #11
0
        public async Task <IActionResult> Create([Bind("TagName,ID")] JobTag jobTag)
        {
            if (ModelState.IsValid)
            {
                jobTag.ID = Guid.NewGuid();
                _context.Add(jobTag);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobTag));
        }
コード例 #12
0
        public bool Delete(JobTag model)
        {
            bool status = false;

            if (datacontext.JobTags.Where(w => w.JobId == model.JobId && w.TagId == model.TagId).Any())
            {
                datacontext.JobTags.Remove(model);
                datacontext.SaveChanges();
                status = true;
            }
            return(status);
        }
コード例 #13
0
        public bool Delete(int jobId, int tagId)
        {
            bool   status = false;
            JobTag jobTag = datacontext.JobTags.Where(w => w.JobId == jobId && w.TagId == tagId).FirstOrDefault();

            if (jobTag != null)
            {
                datacontext.JobTags.Remove(jobTag);
                datacontext.SaveChanges();
                status = true;
            }
            return(status);
        }
コード例 #14
0
        // GET: JobTag/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobTag jobTag = db.JobTags.Find(id);

            if (jobTag == null)
            {
                return(HttpNotFound());
            }
            return(View(jobTag));
        }
コード例 #15
0
 public bool Equals(ThinkResult other)
 {
     if (this.jobInt == other.jobInt && this.sourceNodeInt == other.sourceNodeInt)
     {
         JobTag?jobTag         = this.tag;
         JobTag valueOrDefault = jobTag.GetValueOrDefault();
         JobTag?jobTag2        = other.tag;
         if (valueOrDefault == jobTag2.GetValueOrDefault() && jobTag != null == (jobTag2 != null))
         {
             return(this.fromQueue == other.fromQueue);
         }
     }
     return(false);
 }
コード例 #16
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JobTag = await _context.JobTag.SingleOrDefaultAsync(m => m.ID == id);

            if (JobTag == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #17
0
ファイル: Pawn_MindState.cs プロジェクト: potsh/RimWorld
 public void Reset(bool clearInspiration = false)
 {
     mentalStateHandler.Reset();
     mentalBreaker.Reset();
     if (clearInspiration)
     {
         inspirationHandler.Reset();
     }
     activeInt               = true;
     lastJobTag              = JobTag.Misc;
     lastIngestTick          = -99999;
     nextApparelOptimizeTick = -99999;
     lastJobGiver            = null;
     lastJobGiverThinkTree   = null;
     lastGivenWorkType       = null;
     canFleeIndividual       = true;
     exitMapAfterTick        = -99999;
     lastDisturbanceTick     = -99999;
     forcedGotoPosition      = IntVec3.Invalid;
     knownExploder           = null;
     wantsToTradeWithColony  = false;
     lastMannedThing         = null;
     canLovinTick            = -99999;
     canSleepTick            = -99999;
     meleeThreat             = null;
     lastMeleeThreatHarmTick = -99999;
     lastEngageTargetTick    = -99999;
     lastAttackTargetTick    = -99999;
     lastAttackedTarget      = LocalTargetInfo.Invalid;
     enemyTarget             = null;
     duty = null;
     thinkData.Clear();
     lastAssignedInteractTime    = -99999;
     interactionsToday           = 0;
     lastInventoryRawFoodUseTick = 0;
     priorityWork.Clear();
     nextMoveOrderIsWait             = true;
     lastTakeCombatEnhancingDrugTick = -99999;
     lastHarmTick                              = -99999;
     anyCloseHostilesRecently                  = false;
     WillJoinColonyIfRescued                   = false;
     WildManEverReachedOutside                 = false;
     timesGuestTendedToByPlayer                = 0;
     lastSelfTendTick                          = -99999;
     spawnedByInfestationThingComp             = false;
     lastPredatorHuntingPlayerNotificationTick = -99999;
 }
コード例 #18
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JobTag = await _context.JobTag.FindAsync(id);

            if (JobTag != null)
            {
                _context.JobTag.Remove(JobTag);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #19
0
        public bool Equals(ThinkResult other)
        {
            int arg_6D_0;

            if (this.jobInt == other.jobInt && this.sourceNodeInt == other.sourceNodeInt)
            {
                JobTag?jobTag   = this.tag;
                JobTag arg_41_0 = jobTag.GetValueOrDefault();
                JobTag?jobTag2  = other.tag;
                if (arg_41_0 == jobTag2.GetValueOrDefault() && jobTag.HasValue == jobTag2.HasValue)
                {
                    arg_6D_0 = ((this.fromQueue == other.fromQueue) ? 1 : 0);
                    return(arg_6D_0 != 0);
                }
            }
            arg_6D_0 = 0;
            return(arg_6D_0 != 0);
        }
コード例 #20
0
        public List <JobTag> SelectAll()
        {
            List <JobTag> list = new List <JobTag>();

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobTag_SelectAll",
                                    inputParamMapper : null,
                                    map : (Action <IDataReader, short>) delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    JobTag jobTag = MapJobTag(reader);
                    list.Add(jobTag);
                    break;
                }
            }
                                    );
            return(list);
        }
コード例 #21
0
 public void Reset()
 {
     this.mentalStateHandler.Reset();
     this.mentalBreaker.Reset();
     this.inspirationHandler.Reset();
     this.activeInt               = true;
     this.lastJobTag              = JobTag.Misc;
     this.lastIngestTick          = -99999;
     this.nextApparelOptimizeTick = -99999;
     this.lastJobGiver            = null;
     this.lastJobGiverThinkTree   = null;
     this.lastGivenWorkType       = null;
     this.canFleeIndividual       = true;
     this.exitMapAfterTick        = -99999;
     this.lastDisturbanceTick     = -99999;
     this.forcedGotoPosition      = IntVec3.Invalid;
     this.knownExploder           = null;
     this.wantsToTradeWithColony  = false;
     this.lastMannedThing         = null;
     this.canLovinTick            = -99999;
     this.canSleepTick            = -99999;
     this.meleeThreat             = null;
     this.lastMeleeThreatHarmTick = -99999;
     this.lastEngageTargetTick    = -99999;
     this.lastAttackTargetTick    = -99999;
     this.lastAttackedTarget      = LocalTargetInfo.Invalid;
     this.enemyTarget             = null;
     this.duty = null;
     this.thinkData.Clear();
     this.lastAssignedInteractTime    = -99999;
     this.lastInventoryRawFoodUseTick = 0;
     this.priorityWork.Clear();
     this.nextMoveOrderIsWait             = true;
     this.lastTakeCombatEnhancingDrugTick = -99999;
     this.lastHarmTick                  = -99999;
     this.anyCloseHostilesRecently      = false;
     this.willJoinColonyIfRescued       = false;
     this.wildManEverReachedOutside     = false;
     this.timesGuestTendedToByPlayer    = 0;
     this.lastSelfTendTick              = -99999;
     this.spawnedByInfestationThingComp = false;
 }
コード例 #22
0
        public bool Equals(ThinkResult other)
        {
            int result;

            if (this.jobInt == other.jobInt && this.sourceNodeInt == other.sourceNodeInt)
            {
                JobTag?nullable       = this.tag;
                JobTag valueOrDefault = nullable.GetValueOrDefault();
                JobTag?nullable2      = other.tag;
                if (valueOrDefault == nullable2.GetValueOrDefault() && nullable.HasValue == nullable2.HasValue)
                {
                    result = ((this.fromQueue == other.fromQueue) ? 1 : 0);
                    goto IL_006d;
                }
            }
            result = 0;
            goto IL_006d;
IL_006d:
            return((byte)result != 0);
        }
コード例 #23
0
ファイル: ThinkResult.cs プロジェクト: potsh/RimWorld
        public bool Equals(ThinkResult other)
        {
            int result;

            if (jobInt == other.jobInt && sourceNodeInt == other.sourceNodeInt)
            {
                JobTag?jobTag         = tag;
                JobTag valueOrDefault = jobTag.GetValueOrDefault();
                JobTag?jobTag2        = other.tag;
                if (valueOrDefault == jobTag2.GetValueOrDefault() && jobTag.HasValue == jobTag2.HasValue)
                {
                    result = ((fromQueue == other.fromQueue) ? 1 : 0);
                    goto IL_006d;
                }
            }
            result = 0;
            goto IL_006d;
IL_006d:
            return((byte)result != 0);
        }
コード例 #24
0
        public JobTag SelectById(int id)
        {
            JobTag jobTag = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobTag_SelectById",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", id);
            }
                                    , map : delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    jobTag = MapJobTag(reader);
                    break;
                }
            }
                                    );
            return(jobTag);
        }
コード例 #25
0
        public List <JobTag> SelectJobTags(int id)
        {
            List <JobTag> list = new List <JobTag>();

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobPostingJobTag_SelectByJobPostingId",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@JobPostingId", id);
            },
                                    map : (Action <IDataReader, short>) delegate(IDataReader reader, short set)
            {
                JobTag jobTag     = new JobTag();
                int startingIndex = 0;    //startingOrdinal

                jobTag.Id      = reader.GetInt32(startingIndex++);
                jobTag.Keyword = reader.GetString(startingIndex++);

                list.Add(jobTag);
            }
                                    );

            return(list);
        }
コード例 #26
0
 public void Insert(JobPost jobPost, JobTag jobTag)
 {
     jobPostTagRepository.InsertWithoutData(jobPost, jobTag, navigationProperty);
     // Insert(jobPost);
 }
コード例 #27
0
 public void Insert(JobTag jobTag, JobPost jobPost)
 {
     jobTagPostRepository.InsertWithoutData(jobTag, jobPost, navigationProperty);
     jobTagRepository.Insert(jobTag);
 }
コード例 #28
0
        public List <JobPosting> SearchByKeyword(JobPostingSearchRequest searchRequest)
        {
            List <JobPosting> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.JobPosting_SearchByKeyword",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@SearchString", searchRequest.SearchString ?? String.Empty);
                paramCollection.AddWithValue("@CurrentPage", searchRequest.CurrentPage);
                paramCollection.AddWithValue("@ItemsPerPage", searchRequest.ItemsPerPage);
                paramCollection.AddWithValue("@Distance", searchRequest.Distance);
                paramCollection.AddWithValue("@Compensation", searchRequest.Compensation);
                paramCollection.AddWithValue("@FullPartId", searchRequest.FullPartId);
                paramCollection.AddWithValue("@ContractPermanentId", searchRequest.ContractPermanentId);
                paramCollection.AddWithValue("@ExperienceLevelId", searchRequest.ExperienceLevelId);
                paramCollection.AddWithValue("@Latitude", searchRequest.Latitude);
                paramCollection.AddWithValue("@Longitude", searchRequest.Longitude);
                paramCollection.AddWithValue("@IsDeploy", searchRequest.IsDeploy);

                DataTable JobTagIdArray = new DataTable();
                JobTagIdArray.Columns.Add("JobTagId", typeof(Int32));
                if (searchRequest.JobTagIds != null)
                {
                    for (int i = 0; i < searchRequest.JobTagIds.Count; i++)
                    {
                        JobTagIdArray.Rows.Add(searchRequest.JobTagIds[i]);
                    }
                }
                SqlParameter JobTagIdTable  = new SqlParameter();
                JobTagIdTable.ParameterName = "@JobTagIds";
                JobTagIdTable.SqlDbType     = System.Data.SqlDbType.Structured;
                JobTagIdTable.Value         = JobTagIdArray;
                paramCollection.Add(JobTagIdTable);
            },
                                    map : delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    JobPosting jobPosting = MapJobPosting(reader);
                    if (list == null)
                    {
                        list = new List <JobPosting>();
                    }
                    list.Add(jobPosting);
                    break;

                case 1:
                    int jobPostingId = 0;
                    JobTag jobTag    = MapJobTagList(reader, out jobPostingId);
                    JobPosting jp    = list.Find(item => item.Id == jobPostingId);
                    if (jp.JobTags == null)
                    {
                        jp.JobTags = new List <JobTag>();
                    }
                    jp.JobTags.Add(jobTag);
                    break;
                }
            }
                                    );
            return(list);
        }
コード例 #29
0
 public bool TryTakeOrderedJob(Job job, JobTag tag = JobTag.Misc)
 {
     return(TryTakeOrderedJob_NewTemp(job, tag));
 }
コード例 #30
0
        public bool TryTakeOrderedJob(Job job, JobTag tag = JobTag.Misc)
        {
            if (this.debugLog)
            {
                this.DebugLogEvent("TryTakeOrderedJob " + job);
            }
            job.playerForced = true;
            bool result;

            if (this.curJob != null && this.curJob.JobIsSameAs(job))
            {
                result = true;
            }
            else
            {
                bool flag        = this.pawn.jobs.IsCurrentJobPlayerInterruptible();
                bool flag2       = this.pawn.mindState.IsIdle || this.pawn.CurJob == null || this.pawn.CurJob.def.isIdle;
                bool isDownEvent = KeyBindingDefOf.QueueOrder.IsDownEvent;
                if (isDownEvent)
                {
                    PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.QueueOrders, KnowledgeAmount.NoteTaught);
                }
                if (flag && (!isDownEvent || flag2))
                {
                    this.pawn.stances.CancelBusyStanceSoft();
                    if (this.debugLog)
                    {
                        this.DebugLogEvent("    Queueing job");
                    }
                    this.ClearQueuedJobs();
                    if (job.TryMakePreToilReservations(this.pawn))
                    {
                        this.jobQueue.EnqueueFirst(job, new JobTag?(tag));
                        if (this.curJob != null)
                        {
                            this.curDriver.EndJobWith(JobCondition.InterruptForced);
                        }
                        else
                        {
                            this.CheckForJobOverride();
                        }
                        result = true;
                    }
                    else
                    {
                        Log.Warning("TryMakePreToilReservations() returned false right after TryTakeOrderedJob(). This should have been checked before. job=" + job.ToStringSafe <Job>(), false);
                        this.pawn.ClearReservationsForJob(job);
                        result = false;
                    }
                }
                else if (isDownEvent)
                {
                    if (job.TryMakePreToilReservations(this.pawn))
                    {
                        this.jobQueue.EnqueueLast(job, new JobTag?(tag));
                        result = true;
                    }
                    else
                    {
                        Log.Warning("TryMakePreToilReservations() returned false right after TryTakeOrderedJob(). This should have been checked before. job=" + job.ToStringSafe <Job>(), false);
                        this.pawn.ClearReservationsForJob(job);
                        result = false;
                    }
                }
                else
                {
                    this.ClearQueuedJobs();
                    if (job.TryMakePreToilReservations(this.pawn))
                    {
                        this.jobQueue.EnqueueLast(job, new JobTag?(tag));
                        result = true;
                    }
                    else
                    {
                        Log.Warning("TryMakePreToilReservations() returned false right after TryTakeOrderedJob(). This should have been checked before. job=" + job.ToStringSafe <Job>(), false);
                        this.pawn.ClearReservationsForJob(job);
                        result = false;
                    }
                }
            }
            return(result);
        }