Exemple #1
0
        public ActionResult PostJob(JobOffer joboffer)
        {
            if (ModelState.IsValid)
            {
                db.JobOffers.Add(joboffer);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            return(View(joboffer));
        }
 public ActionResult Edit([Bind(Include = "JobOfferID,NameJobOffer,Description,StartDate,ExpirationDate,PointGet,RecuterID")] JobOffer jobOffer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobOffer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RecuterID = new SelectList(db.Recruters, "Id", "FirstName", jobOffer.RecuterID);
     return(View(jobOffer));
 }
Exemple #3
0
        public IHttpActionResult GetJobOffer(int id)
        {
            JobOffer jobOffer = db.JobOffers.Find(id);

            if (jobOffer == null)
            {
                return(NotFound());
            }

            return(Ok(jobOffer));
        }
        public ActionResult Create([Bind(Include = "Id,Title,Description,Diploma,Experience,Salary,Profil,Type")] JobOffer jobOffer)
        {
            if (ModelState.IsValid)
            {
                db.JobOffers.Add(jobOffer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jobOffer));
        }
Exemple #5
0
        public IHttpActionResult PostJobOffer(JobOffer jobOffer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            service.CreateJoboffer(jobOffer);

            return(CreatedAtRoute("DefaultApi", new { id = jobOffer.JobOfferID }, jobOffer));
        }
Exemple #6
0
        ////////////////////////////////////////////

        public ActionResult DeleteRADMIN(int id)
        {
            JobRequest j  = JOR.GetById(id);
            JobOffer   jb = Svo.GetById(j.JobOfferId);

            JOR.Delete(JOR.GetById(id));
            JOR.Commit();


            return(RedirectToAction("GetAllAppAdmin"));
        }
        public async Task <IActionResult> Create([Bind("Id,CompanyBranchId,JobId,HeadHunterId,JobExchangeId,ApplicationnId,SalaryOffered,IsActive,Releasedate,JobOfferUrl")] JobOffer jobOffer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobOffer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobOffer));
        }
Exemple #8
0
        public async Task <IActionResult> PostJobOffer([FromBody] JobOffer jobOffer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.JobOffers.Add(jobOffer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetJobOffer", new { id = jobOffer.Id }, jobOffer));
        }
Exemple #9
0
        // GET: JobApplications/Create
        public IActionResult Create(int offerId)
        {
            JobOffer offer = _context.JobOffers.First(m => m.Id == offerId);

            if (offer == null)
            {
                return(new StatusCodeResult((int)HttpStatusCode.BadRequest));
            }
            return(View(new JobApplicationCreateViewModel {
                Offer = offer, OfferId = offerId
            }));
        }
Exemple #10
0
 public ActionResult Edit(long?id)
 {
     if (id != null)
     {
         JobOffer model = dao.GetJobOfferByOfferNumber((long)id);
         if (model != null)
         {
             return(View(model));
         }
     }
     return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
 }
        public ActionResult GetMyOfferById(int id)
        {
            string   companyId = User.Claims.Where(x => x.Type == "UserId").FirstOrDefault().Value;
            JobOffer offer     = _offerService.GetOfferById(id);

            if (offer == null || offer.CompanyId != companyId)
            {
                return(NotFound("Offer not found!"));
            }

            return(Ok(offer));
        }
Exemple #12
0
        public offerComponent(JobOffer offer)
        {
            offerGlobal = offer;

            InitializeComponent();

            lblBusinessName.Text = offer.Business.Name;
            lblTitleJob.Text     = offer.Title;
            lblDescription.Text  = offer.Description;
            lblCategory.Text     = "Category: " + offer.Category.Name;
            lblAddress.Text      = offer.Address.City + " - " + offer.Address.Street + " -  No: " + offer.Address.PostalCode;
        }
Exemple #13
0
 public IActionResult EditSaveJobOffer(JobOffer offer)
 {
     if (ModelState.IsValid)
     {
         var company = context.Companies.FirstOrDefault(c => c.Id == offer.Company.Id);
         offer.Company = company;
         context.JobOffers.Update(offer);
         context.SaveChanges();
         return(View("/Views/JobOffer/Index.cshtml", context.JobOffers.Include(o => o.Company).Include(o => o.JobApplications).ToList()));
     }
     return(View("EditJobOffer"));
 }
Exemple #14
0
        public async Task <IActionResult> Create([Bind("Id,JobTitle,CompanyName,JobDescription,ApplicationDeadline,WorkStartDate,Location,SalaryFrom,SalaryTo,SalaryDescription,ContractLength")] JobOfferViewModel jobOfferCreate)
        {
            if (ModelState.IsValid)
            {
                JobOffer jobOffer = jobOfferCreate;
                _context.Add(jobOffer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobOfferCreate));
        }
        public void InformCompanyAboutOfferRemovedDueToMinimalWage_Singular_Test()
        {
            var offer = new JobOffer()
            {
                CompanyID = 666
            };

            companyService.InformCompanyAboutOfferRemovedDueToMinimalWage(offer, 1);

            warningService.Verify(x => x.AddWarning(It.Is <int>(i => offer.CompanyID == i),
                                                    It.Is <string>(msg => msg.Contains("was") || msg.Contains("offer "))), Times.Once);
        }
Exemple #16
0
        public static void SendJobOffer(HumanFF worker, JobOffer jobOffer, GameEntity company, GameContext gameContext)
        {
            var offer = new ExpiringJobOffer
            {
                JobOffer     = jobOffer,
                CompanyId    = company.company.Id,
                DecisionDate = ScheduleUtils.GetCurrentDate(gameContext) + 30,
                HumanId      = worker.HumanComponent.Id
            };

            AddOrReplaceOffer(company, worker, offer);
        }
Exemple #17
0
        public async Task hireEmployee([Summary("User you wish to hire.")] IUser user, [Summary("Company ticker.")] string ticker, [Summary("The ID of the position you want to hire the user to.")] string positionid, [Summary("Desired wage.")] int wage, [Summary("Desired salary.")] int salary)
        {
            Company company = await CompanyService.getCompany(ticker);


            if (!company.employee.ContainsKey(Context.User.Id.ToString()))
            {
                await ReplyAsync($"You are not an employee in {company.name}");

                return;
            }
            if (!r.Contains(company.employee[Context.User.Id.ToString()].position.manages))
            {
                await ReplyAsync("You do not have the permission to fire/hire positions.");

                return;
            }
            if (!company.positions.ContainsKey(positionid))
            {
                await ReplyAsync("The position id you specified is invalid.");

                return;
            }
            if (company.employee[Context.User.Id.ToString()].position.level < company.positions[positionid].level)
            {
                await ReplyAsync("You cannot give someone a higher role than you have.");

                return;
            }
            if (wage < 0 || salary < 0)
            {
                await ReplyAsync("Wage or salary cannot be less than 0");

                return;
            }
            JobOffer offer = new JobOffer();

            offer.user       = user.Id.ToString();
            offer.positionid = positionid;
            offer.wage       = wage;
            offer.salary     = salary;
            string inviteID = Guid.NewGuid().ToString();

            company.jobOffers.Add(inviteID, offer);
            await CompanyService.setCompany(company);

            IDMChannel dm = await user.GetOrCreateDMChannelAsync();

            await dm.SendMessageAsync($"You have been invited to work for {company.name} as {company.positions[positionid].name}. To accept, type &acceptjob {ticker} {inviteID}");

            await ReplyAsync($"{user.Username} has been invited to {company.name} to work as {company.positions[positionid].name}.");
        }
Exemple #18
0
        public ActionResult AddJobOffer(JobOffer model)
        {
            if (ModelState.IsValid)
            {
                dao.SaveJobOffer(model);

                return(RedirectToAction("Create", "Recruitment", new { id = model.OfferNumber }));
            }
            else
            {
                return(View(model));
            }
        }
        public async Task <IActionResult> Edit(int id)
        {
            try
            {
                JobOffer jo = await _context.JobOffers.FirstOrDefaultAsync(x => x.Id == id);

                return(View(jo));
            }
            catch (Exception e)
            {
                return(BadRequest("Offer with this id doesn't exist!"));
            }
        }
Exemple #20
0
 public JobOfferRes(JobOffer jobOffer, int?freeSpaces = null)
 {
     JobOfferId  = jobOffer.JobOfferId;
     Title       = jobOffer.Title;
     Description = jobOffer.Description;
     Wage        = jobOffer.Wage;
     Spaces      = jobOffer.Spaces;
     FreeSpaces  = freeSpaces;
     Start       = jobOffer.Start;
     End         = jobOffer.End;
     Group       = new GroupRes(jobOffer.Group);
     Address     = new AddressRes(jobOffer.Address);
 }
Exemple #21
0
        public ActionResult CreateVacancy(JobOffer offer)
        {
            offer.PublishDate = DateTime.Now;

            offer.UserId = GetCurrentUser().UserId;

            if (_jobOfferRepo.Create(offer))
            {
                _jobOfferRepo.Save();
            }

            return(Redirect("/Vacancy/vacancy/" + offer.Id));
        }
Exemple #22
0
    // tweak salary buttons
    void OnEnable()
    {
        var human = SelectedHuman;

        var role   = Humans.GetRole(human);
        var rating = Humans.GetRating(Q, human);

        var baseSalary = Teams.GetSalaryPerRating(rating);

        JobOffer = new JobOffer(baseSalary);

        Render(SelectedHuman);
    }
Exemple #23
0
        public ActionResult Edit(JobOffer model)
        {
            if (ModelState.IsValid)
            {
                bool test = dao.UpdatateJobOffer(model);

                return(RedirectToAction("Show", "Career", new { id = model.OfferNumber }));
            }
            else
            {
                return(View(model));
            }
        }
        /// <summary>
        /// This method do not save changes in DB
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        protected JobOffer CreateJobOffer(CreateJobOfferParams parameters)
        {
            var jobOffer = new JobOffer()
            {
                Amount    = parameters.Amount,
                CompanyID = parameters.CompanyID,
                TypeID    = (int)parameters.OfferType,
                MinSkill  = (decimal)parameters.MinimumSkill,
                CountryID = parameters.CountryID
            };

            return(jobOffer);
        }
Exemple #25
0
        public async Task <ActionResult> Details(int id)
        {
            JobOffer jobOffer = await dataContext.JobOffers.Where(j => j.Id == id).FirstOrDefaultAsync();

            if (jobOffer is null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            jobOffer.JobApplications = await dataContext.JobApplications.Where(ja => ja.JobOfferId == jobOffer.Id).ToListAsync();

            return(View(new JobOffer(jobOffer, await dataContext.Companies.FindAsync(jobOffer.CompanyId))));
        }
        public async Task <ActionResult> Edit(JobOffer model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            var offer = context.JobOffers.Include("Company").FirstOrDefault(j => j.Id == model.Id);

            offer.JobTitle    = model.JobTitle;
            offer.Description = model.Description;
            await context.SaveChangesAsync();

            return(RedirectToAction("Details", new { id = model.Id }));
        }
        public ActionResult Edit([Bind(Include = "advert_id,aspNetUsersId,offer_emp_num,offer_type_of_employment,offer_certificate,offer_specialization,offer_experience_years,offer_gender,offer_age,offer_address,offer_working_hours,offer_salary,offer_active,offer_publishDate")] JobOffer jobOffer)
        {
            if (ModelState.IsValid)
            {
                jobOffer.aspNetUsersId     = User.Identity.GetUserId();
                jobOffer.offer_publishDate = DateTime.Now;

                db.Entry(jobOffer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.aspNetUsersId = new SelectList(db.AspNetUsers, "Id", "Email", jobOffer.aspNetUsersId);
            return(View(jobOffer));
        }
        // GET: JobOffers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobOffer jobOffer = db.JobOffers.Find(id);

            if (jobOffer == null)
            {
                return(HttpNotFound());
            }
            return(View(jobOffer));
        }
Exemple #29
0
 public JobOfferWithJasRes(JobOffer jobOffer, ICollection <JobApplication> jobApplications, int freeSpaces)
 {
     JobOfferId      = jobOffer.JobOfferId;
     Title           = jobOffer.Title;
     Description     = jobOffer.Description;
     Wage            = jobOffer.Wage;
     Spaces          = jobOffer.Spaces;
     FreeSpaces      = freeSpaces;
     Start           = jobOffer.Start;
     End             = jobOffer.End;
     JobApplications = MapJobApplications(jobApplications);
     Address         = new AddressRes(jobOffer.Address);
     Group           = new GroupRes(jobOffer.Group);
 }
Exemple #30
0
        public async Task <ActionResult> Create()
        {
            Role role = await AuthorizationTools.GetRoleAsync(User, _context);

            ViewData.Add("role", role);
            ViewData.Add("id", AuthorizationTools.GetUserDbId(User, _context, role));
            if (role != Role.HR)
            {
                return(new UnauthorizedResult());
            }
            var model = new JobOffer();

            return(View(model));
        }
        public void SeedData(EmployerEmployeeHuntDbContext context)
        {
            var random = new Random();

            var allOrganiazations = context.Organizations.ToList();
            var headhunterRole = context.Roles.FirstOrDefault(r => r.Name == GlobalConstants.HeadhunterRoleName);

            var allHeadhunters = context.Users.Where(u => u.Roles.Any(r => r.RoleId == headhunterRole.Id)).ToList();

            var skills = context.Skills.ToList();

            for (int i = 0; i < allOrganiazations.Count; i++)
            {
                var organization = allOrganiazations[i];

                for (int j = 0; j < 5; j++)
                {
                    var user = allHeadhunters[i % allHeadhunters.Count];

                    var requiredSkills = this.GetRandomRequiredSkills(skills);

                    HeadhunterProfile headhunter = user.HeadhunterProfile;

                    if (headhunter == null)
                    {
                        headhunter = new HeadhunterProfile
                        {
                            User = user
                        };

                        context.HeadhunterProfiles.Add(headhunter);
                        context.SaveChanges();
                    }

                    var jobOffer = new JobOffer
                    {
                        Organization = organization,
                        Headhunter = headhunter,
                        RegistrationDate = DateTime.Now.AddDays(-100).AddDays(random.Next(0, 100)),
                        IsActive = j % 3 == 0 ? false : true,
                        RequiredSkills = requiredSkills
                    };

                    context.JobOffers.Add(jobOffer);
                }
            }

            context.SaveChanges();
        }
Exemple #32
0
    public JobOffer AddOffer(string title, string description, int? regionId, int? contactId)
    {
        DataClassesDataContext dbo = new DataClassesDataContext();

        JobOffer offer = new JobOffer();
        offer.Title = title;
        offer.Description = description;
        offer.AlternateRegionId = regionId;
        offer.ContactId = contactId;
        offer.CompanyId = this.ID;
        offer.Added = DateTime.Now;

        dbo.JobOffers.InsertOnSubmit(offer);

        dbo.SubmitChanges();

        return offer;
    }
        public JobOffer AddJobOffer(
            int organizationId,
            ICollection<int> requiredSkillsIds,
            int minimumCandidatesCount,
            DateTime registrationDate)
        {
            JobOffer jobOffer = new JobOffer();

            jobOffer.IsActive = true;
            jobOffer.MinimumCandidatesCount = minimumCandidatesCount;
            jobOffer.OrganizationId = organizationId;
            jobOffer.RegistrationDate = registrationDate;
            jobOffer.RequiredSkills = this.skills.All().Where(s => requiredSkillsIds.Contains(s.Id)).ToList();

            this.jobOffers.Add(jobOffer);
            this.jobOffers.Save();

            return jobOffer;
        }