Exemple #1
0
        public JobDto( Job item )
        {
            Jid = item.Jid;

            Title = item.Title;

            Description = item.Description;

            Reference = item.Reference;

            SearchTitle = item.SearchTitle;

            DatePosted = item.DatePosted;

            DateUpdated = item.DateUpdated;

            IsNew = item.DatePosted.Date == DateTime.UtcNow.Date;

            Area = item.Classifications.Where( c => c.Name == "Area" ).Select( c => c.Content ).FirstOrDefault();

            Location = item.Classifications.Where( c => c.Name == "Location" ).Select( c => c.Content ).FirstOrDefault();

            Country = item.Classifications.Where( c => c.Name == "Country" ).Select( c => c.Content ).FirstOrDefault();

            Category = item.Classifications.Where( c => c.Name == "Job Category" ).Select( c => c.Content ).FirstOrDefault();

            SubCategory = item.Classifications.Where( c => c.Name == "Sub-Category" ).Select( c => c.Content ).FirstOrDefault();

            WorkType = item.Classifications.Where( c => c.Name == "Work Type" ).Select( c => c.Content ).FirstOrDefault();
        }
        public IEnumerable<Job> ReadFile()
        {
            var jobElements = doc.Root.Elements();
            List<Job> jobs = new List<Job>();

            foreach ( var jobElement in jobElements ) {
                var job = new Job();

                job.Jid = Convert.ToInt32( jobElement.Attribute( "jid" ).Value );
                job.Reference = jobElement.Attribute( "reference" ).Value;
                job.DatePosted = DateTime.Parse( jobElement.Attribute( "datePosted" ).Value );
                job.DateUpdated = DateTime.Parse( jobElement.Attribute( "dateUpdated" ).Value );

                job.Title = jobElement.Element( "Title" ).Value;
                job.Description = jobElement.Element( "Description" ).Value;
                job.SearchTitle = jobElement.Element( "SearchTitle" ).Value;

                job.Classifications = new List<Classification>();

                var classificationElements = jobElement.Element( "Classifications" ).Elements();

                foreach ( var classificationElement in classificationElements ) {

                    var classification = new Classification();

                    classification.Jid = Convert.ToInt32( classificationElement.Attribute( "jid" ).Value );
                    classification.Id = Convert.ToInt32( classificationElement.Attribute( "id" ).Value );
                    classification.Vid = Convert.ToInt32( classificationElement.Attribute( "vid" ).Value );
                    classification.Name = classificationElement.Attribute( "name" ).Value;

                    classification.Content = classificationElement.Value;

                    job.Classifications.Add( classification );
                }

                jobs.Add( job );
            }

            return jobs;
        }
        public ActionResult SaveExternalJob(string url, string title, string description)
        {
            if (!User.Identity.IsAuthenticated)
            {
                var login = new BookmarkletLogin();
                login.Description = description;
                login.Title = title;
                login.URL = url;
                return View("Login", login);
            }

            if (url == null || title == null)
            {
                return View("Error", null, "We were not able to locate a job on this page.");
            }

            // Check if job was already saved
            // Load the current account
            Account account = Account.GetAccount(User.Identity.Name, RavenSession);
            Job job = null;
            if (account != null)
            {
                var jobs = from j in account.Jobs
                           where j.URL == url
                           select j;

                if (jobs != null && jobs.Count() > 0)
                {
                    return View("Error", null, "You have already saved this job.");
                }

                // Check if the user has met their saved job limit
                if (account.HasMetSavedJobLimit())
                {
                    return View("Upgrade");
                }

                // Create the job
                job = new Job
                {
                    JobStatus = new JobStatus(),
                    ShortDescription = description,
                    Title = title,
                    URL = url
                };
                job.JobStatus.Status = "Lead";

                if (account != null)
                {
                    if (account.Jobs == null)
                        account.Jobs = new List<Job>();

                    account.Jobs.Add(job);
                    RavenSession.Store(account);
                }
            }

            return View("Details", job);
        }
 public ActionResult RedirectDisclaimerJob(Job job)
 {
     return View("RedirectDisclaimerJob", job);
 }
        public JsonResult SaveFavorite(Job jobClicked)
        {
            // Load the current account
            Account account = Account.GetAccount(User.Identity.Name, RavenSession);
            if (account != null)
            {
                var jobs = from j in account.Jobs
                           where j.URL == jobClicked.URL
                           select j;

                // Check if job was already saved
                if (jobs != null && jobs.Count() > 0)
                {
                    return Json("success", JsonRequestBehavior.AllowGet);
                }

                // Check if the user has met their saved job limit
                if (account.HasMetSavedJobLimit())
                {
                    return Json("error", JsonRequestBehavior.AllowGet);
                }

                // Create the job
                var job = new Job
                {
                    JobStatus = new JobStatus(),
                    ShortDescription = jobClicked.ShortDescription,
                    Title = jobClicked.Title,
                    URL = jobClicked.URL
                };
                job.JobStatus.Status = "Lead";

                if (account != null)
                {
                    if (account.Jobs == null)
                        account.Jobs = new List<Job>();

                    account.Jobs.Add(job);
                    RavenSession.Store(account);
                }
            }

            return Json("success", JsonRequestBehavior.AllowGet);
        }
        public PartialViewResult SaveBingJob(SearchResult jobClicked)
        {
            // Check if job was already saved
            // Load the current account
            Account account = Account.GetAccount(User.Identity.Name, RavenSession);
            if (account != null)
            {
                var jobs = from j in account.Jobs
                           where j.URL == jobClicked.Url
                           select j;

                if (jobs != null && jobs.Count() > 0)
                {
                    return PartialView("JobSaved", jobClicked);
                }

                // Create the job
                var job = new Job
                {
                    JobStatus = new JobStatus(),
                    ShortDescription = jobClicked.Description,
                    Title = jobClicked.Title,
                    URL = jobClicked.Url
                };
                job.JobStatus.Status = "Lead";

                if (account != null)
                {
                    if (account.Jobs == null)
                        account.Jobs = new List<Job>();

                    account.Jobs.Add(job);
                }
            }

            return PartialView("JobSaved", jobClicked);
        }