Example #1
0
        public async Task <IActionResult> Index()
        {
            var keys       = (await Scheduler.GetJobKeys(GroupMatcher <JobKey> .AnyGroup())).OrderBy(x => x.ToString());
            var list       = new List <JobListItem>();
            var knownTypes = new List <string>();

            foreach (var key in keys)
            {
                var detail = await GetJobDetail(key);

                var item = new JobListItem()
                {
                    Concurrent  = !detail.ConcurrentExecutionDisallowed,
                    Persist     = detail.PersistJobDataAfterExecution,
                    Recovery    = detail.RequestsRecovery,
                    JobName     = key.Name,
                    Group       = key.Group,
                    Type        = detail.JobType.FullName,
                    History     = Histogram.Empty,
                    Description = detail.Description,
                };
                knownTypes.Add(detail.JobType.RemoveAssemblyDetails());
                list.Add(item);
            }

            Services.Cache.UpdateJobTypes(knownTypes);

            ViewBag.Groups = (await Scheduler.GetJobGroupNames()).GroupArray();

            return(View(list));
        }
    public override void ShowDialog()
    {
        base.ShowDialog();

        // Localization
        string[] formatValues;
        formatValues = new string[0];
        int i = 0;

        foreach (Character character in World.Current.CharacterManager)
        {
            GameObject go             = Instantiate(JobListItemPrefab, JobList);
            string     jobDescription = LocalizationTable.GetLocalization(character.GetJobDescription(), formatValues);
            go.GetComponentInChildren <Text>().text = string.Format("<b>{0}</b> - {1}", character.GetName(), jobDescription);

            JobListItem listItem = go.GetComponent <JobListItem>();
            listItem.character    = character;
            listItem.currentColor = i % 2 == 0 ? ListPrimaryColor : ListSecondaryColor;

            go.GetComponent <Image>().color = listItem.currentColor;
            i++;
        }

        JobList.GetComponentInParent <ScrollRect>().scrollSensitivity = JobList.childCount / 2;

        JobList.GetComponent <AutomaticVerticalSize>().AdjustSize();
    }
Example #3
0
    public void RefreshSearchList()
    {
        SearchListItems = new List <JobListItem>();
        foreach (Transform child in SearchListTransform)
        {
            Destroy(child.gameObject);
        }

        Job[] generated_jobs = Job.GenerateJobs(50);
        foreach (Job job in generated_jobs)
        {
            JobListItem new_list_item = Instantiate(JobListItemPrefab);
            new_list_item.transform.SetParent(SearchListTransform, false);

            new_list_item.PopulateListItem(job);
            new_list_item.SetupActionButton(Color.green, "Apply", () =>
            {
                CreateJobApplication(new_list_item.ListItemJob);
                SearchListItems.Remove(new_list_item);
                Destroy(new_list_item.gameObject);
            });

            SearchListItems.Add(new_list_item);
        }
    }
Example #4
0
        public IEnumerable <JobListItem> GetJobs()
        {
            var jobs = _context.Jobs;
            List <JobListItem> jobListItems = new List <JobListItem>();

            foreach (var job in jobs)
            {
                TimeSpan span;
                if (job.Service.DurationUnit == DurationUnit.Minutes)
                {
                    span = new TimeSpan(0, job.Service.Duration, 0);
                }
                else
                {
                    span = new TimeSpan(job.Service.Duration, 0, 0);
                }
                var jobListItem = new JobListItem
                {
                    JobId     = job.JobId,
                    Service   = job.Service.Name,
                    StartDate = job.StartDate.ToString("d"),
                    StartTime = job.StartTime.ToString("t"),
                    Start     = job.End - span,
                    End       = job.End
                };
                jobListItems.Add(jobListItem);
            }

            return(jobListItems);
        }
        public static List <JobListItem> JobList()
        {
            List <JobListItem> Result = new List <JobListItem>();
            JobListItem        listItem;

            foreach (var item in unitOfWork.jobTitles.Get())
            {
                listItem         = new JobListItem();
                listItem.JobId   = item.JobId;
                listItem.JobName = item.jobtitlename;
                Result.Add(listItem);
            }
            return(Result);
        }
Example #6
0
    public void RefreshApplicationList()
    {
        foreach (Transform child in ApplicationListTransform)
        {
            Destroy(child.gameObject);
        }

        foreach (JobApplication application in ActiveApplications)
        {
            JobApplication current = application;

            JobListItem new_list_item = Instantiate(JobListItemPrefab);
            new_list_item.transform.SetParent(ApplicationListTransform, false);

            new_list_item.PopulateListItem(current.AppliedJob);
            if (current.Accepted)
            {
                new_list_item.SetupActionButton(Color.green, "Accepted", () =>
                {
                    DialogueBox.Instance.CreateYesNoDialogue("Start this job?",
                                                             () =>
                    {
                        new_list_item.ListItemJob.HirePlayer();
                        CloseJobSearch();
                        DialogueBox.Instance.Cleanup();
                        Destroy(new_list_item.gameObject);
                        ActiveApplications.Remove(current);
                    },
                                                             () =>
                    {
                        DialogueBox.Instance.Cleanup();
                        Destroy(new_list_item.gameObject);
                    });
                });
            }
            else if (current.Waiting)
            {
                new_list_item.SetupActionButton(Color.yellow, "Waiting...", () => { });
            }
            else
            {
                new_list_item.SetupActionButton(Color.red, "Rejected", () =>
                {
                    Destroy(new_list_item.gameObject);
                    ActiveApplications.Remove(current);
                });
            }
        }
    }
Example #7
0
        private static async void GetHtmlAsync()
        {
            var url = "https://id.indeed.com/lowongan-kerja?q=web+developer&l=Semarang";

            var httpClient = new HttpClient();
            var html       = await httpClient.GetStringAsync(url);

            var salary = "";

            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);

            var JobsHtml = htmlDocument.DocumentNode.Descendants("td")
                           .Where(node => node.GetAttributeValue("id", "")
                                  .Equals("resultsCol")).ToList();
            var JobListItems = JobsHtml[0].Descendants("div")
                               .Where(node => node.GetAttributeValue("id", "")
                                      .Contains("p_")).ToList();

            foreach (var JobListItem in JobListItems)
            {
                Console.ForegroundColor = (ConsoleColor)10;

                var jobId = JobListItem.GetAttributeValue("id", "");

                var jobTitle = JobListItem.Descendants("a")
                               .Where(node => node.GetAttributeValue("data-tn-element", "")
                                      .Equals("jobTitle")).FirstOrDefault().InnerText;

                var companyName = JobListItem.Descendants("span")
                                  .Where(node => node.GetAttributeValue("class", "")
                                         .Equals("company")).FirstOrDefault().InnerText;

                var location = JobListItem.Descendants("span")
                               .Where(node => node.GetAttributeValue("class", "")
                                      .Contains("location")).FirstOrDefault().InnerText;

                var linkDetail = JobListItem.Descendants("a")
                                 .FirstOrDefault().GetAttributeValue("href", "");


                var urlDetail = "https://id.indeed.com" + linkDetail;

                var html2 = await httpClient.GetStringAsync(urlDetail);

                var htmlDocument2 = new HtmlDocument();
                htmlDocument2.LoadHtml(html2);

                var jobDesc = htmlDocument2.DocumentNode.Descendants("div")
                              .Where(node => node.GetAttributeValue("id", "")
                                     .Equals("jobDescriptionText")).FirstOrDefault().InnerText;

                try
                {
                    salary = JobListItem.Descendants("span")
                             .Where(node => node.GetAttributeValue("class", "")
                                    .Equals("salaryText")).FirstOrDefault().InnerText;
                }
                catch (Exception e)
                {
                }

                var date = JobListItem.Descendants("span")
                           .Where(node => node.GetAttributeValue("class", "")
                                  .Contains("date")).FirstOrDefault().InnerText;
                try
                {
                    Console.WriteLine(jobId + "\n" + jobTitle + "\n" + companyName + " - " + location + "\n" + linkDetail + "\n" + salary + "\n" + date + "\n" + jobDesc);
                }
                catch (Exception e)
                {
                    Console.WriteLine(jobId + "\n" + jobTitle + "\n" + companyName + " - " + location + "\n" + linkDetail + "\n" + date + "\n" + jobDesc);
                }
            }
        }
        // GET api/values/5
        public async System.Threading.Tasks.Task <IEnumerable <JobModels> > GetAsync(string name)
        {
            JobModels jobModels = new JobModels();
            var       listJob   = new List <JobModels>();

            var url = "https://id.indeed.com/lowongan-kerja?q=" + name;

            var httpClient = new HttpClient();
            var html       = await httpClient.GetStringAsync(url);

            var salary = "";

            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);

            var JobsHtml = htmlDocument.DocumentNode.Descendants("td")
                           .Where(node => node.GetAttributeValue("id", "")
                                  .Equals("resultsCol")).ToList();
            var JobListItems = JobsHtml[0].Descendants("div")
                               .Where(node => node.GetAttributeValue("id", "")
                                      .Contains("p_")).ToList();

            foreach (var JobListItem in JobListItems)
            {
                Console.ForegroundColor = (ConsoleColor)10;

                var jobId = JobListItem.GetAttributeValue("id", "");

                var jobTitle = JobListItem.Descendants("a")
                               .Where(node => node.GetAttributeValue("data-tn-element", "")
                                      .Equals("jobTitle")).FirstOrDefault().InnerText;

                var companyName = JobListItem.Descendants("span")
                                  .Where(node => node.GetAttributeValue("class", "")
                                         .Equals("company")).FirstOrDefault().InnerText;

                var location = JobListItem.Descendants("span")
                               .Where(node => node.GetAttributeValue("class", "")
                                      .Contains("location")).FirstOrDefault().InnerText;

                var linkDetail = JobListItem.Descendants("a")
                                 .FirstOrDefault().GetAttributeValue("href", "");


                var urlDetail = "https://id.indeed.com" + linkDetail;

                var html2 = await httpClient.GetStringAsync(urlDetail);

                var htmlDocument2 = new HtmlDocument();
                htmlDocument2.LoadHtml(html2);

                var jobDesc = htmlDocument2.DocumentNode.Descendants("div")
                              .Where(node => node.GetAttributeValue("id", "")
                                     .Equals("jobDescriptionText")).FirstOrDefault().InnerText;

                try
                {
                    salary = JobListItem.Descendants("span")
                             .Where(node => node.GetAttributeValue("class", "")
                                    .Equals("salaryText")).FirstOrDefault().InnerText;
                }
                catch (Exception e)
                {
                }

                var date = JobListItem.Descendants("span")
                           .Where(node => node.GetAttributeValue("class", "")
                                  .Contains("date")).FirstOrDefault().InnerText;


                listJob.Add(new JobModels {
                    JobName     = jobTitle,
                    JobSalary   = salary,
                    JobDate     = date,
                    JobLink     = urlDetail,
                    JobCompany  = companyName,
                    JobLocation = location,
                    JobDesc     = jobDesc,
                });
            }
            return(listJob);
        }