コード例 #1
0
        public JobOpening GetJobById(int id)
        {
            List <JobOpening> AllJobOpenings = new List <JobOpening>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Shared.ServerConfig.GetBaseUrl());
                var responseTask = client.GetAsync("NucesJob/GetOpeningsById/" + id.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <JobOpening[]>();
                    readTask.Wait();

                    var allopenings = readTask.Result;

                    foreach (var item in allopenings)
                    {
                        AllJobOpenings.Add(item);
                    }
                }
            }
            JobOpening SingleJob = AllJobOpenings[0];

            return(SingleJob);
        }
コード例 #2
0
        public int UpdateJob(JobOpening job)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["JobID"]          = job.JobID;
            data["MinExperience"]  = job.MinExperience;
            data["JobDescription"] = job.JobDescription;
            //data["DatePosted"] = DateTime.Now.ToString("yyyy-MM-dd");
            data["ExpectedStartDate"] = job.ExpectedStartDate;
            data["DesignationID"]     = GetDesignationIdbyTitle(job.Designation);
            data["DepartmentID"]      = GetDepartmentIdbyTitle(job.Department);


            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Shared.ServerConfig.GetBaseUrl());
                var responseTask = client.PostAsJsonAsync("NucesJob/UpdateJobOpening", data);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.StatusCode == HttpStatusCode.OK)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
コード例 #3
0
        public void JobOpeningonstructor_CreatesInstanceOfJobOpening_JobOpening()
        {
            Contact    newContact = new Contact("name", "email", "phoneNumber");
            JobOpening newPosting = new JobOpening("title", "description", newContact);

            Assert.AreEqual(typeof(JobOpening), newPosting.GetType());
        }
コード例 #4
0
        public HomeModule()
        {
            Get["/"] = _ => View["home.cshtml"];

            Get["/add_job"] = _ => View["add_job.cshtml"];

            Post["/post_job"] = _ => {
                JobOpening newJobOpening = new JobOpening(
                    Request.Form["title"],
                    Request.Form["description"],
                    Request.Form["salary"],
                    Request.Form["name"],
                    Request.Form["phone"],
                    Request.Form["email"]
                    );
                newJobOpening.Save();
                return(View["view_job.cshtml", newJobOpening]);
            };
            Get["/view_all"] = _ => {
                List <JobOpening> allJobs = JobOpening.GetJobs();
                return(View["job_board.cshtml", allJobs]);
            };

            Get["/search_form"] = _ => View["search_form.cshtml"];

            Post["/search_jobs"] = _ => {
                List <JobOpening> searchedJobs = JobOpening.SearchJobs(Request.Form["search-keyword"], Request.Form["min-salary"]);
                return(View["job_board.cshtml", searchedJobs]);
            };
        }
コード例 #5
0
ファイル: JobOpeningDb.cs プロジェクト: sohail9987/IPTProject
        public int AddJob(JobOpening job)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["MinExperience"]     = job.MinExperience;
            data["JobDescription"]    = job.JobDescription;
            data["DatePosted"]        = DateTime.Now.ToString("yyyy-MM-dd");
            data["ExpectedStartDate"] = job.ExpectedStartDate;
            data["DesignationID"]     = GetDesignationIdbyTitle(job.Designation);
            data["DepartmentID"]      = GetDepartmentIdbyTitle(job.Department);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://localhost:44380/api/");
                var responseTask = client.PostAsJsonAsync("NucesJob/AddJobOpening", data);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.StatusCode == HttpStatusCode.Created)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
コード例 #6
0
        public ActionResult Create(string title, string description, string name, string email, string phoneNumber)
        {
            Contact    myContact    = new Contact(name, email, phoneNumber);
            JobOpening myJobOpening = new JobOpening(title, description, myContact);

            return(View("Index", myJobOpening));
        }
コード例 #7
0
        public ActionResult Create(string title, string description, string name, string email, string phoneNumber)
        {
            Contact    newContact = new Contact(name, email, phoneNumber);
            JobOpening newPosting = new JobOpening(title, description, newContact);

            return(RedirectToAction("Index"));
        }
コード例 #8
0
        public ActionResult Jobs(string title, string salary, string description, string name, string email, string phoneNumber)
        {
            Contact    myContact    = new Contact(name, email, phoneNumber);
            JobOpening myJobOpening = new JobOpening(title, salary, description, myContact);

            return(View());
        }
コード例 #9
0
        // GET: Jobs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobOpening job = db.Job(id.Value);

            if (job == null)
            {
                return(HttpNotFound());
            }
            //When editing, select only departments that user manages or the current department
            List <Department> departments = new List <Department>();

            departments.AddRange(db.GetManagedDepartmentsByUserName(User.Identity.Name));
            if (!departments.Contains(job.Department))
            {
                departments.Add(job.Department);
            }
            //Convert list of departents to a list of selectitem
            ViewBag.Departments = departments.Select(d => new SelectListItem()
            {
                Text = d.Name, Value = d.ID.ToString()
            });
            JobOpeningViewModel jobVM = MapJobOpening(job);

            return(View(jobVM));
        }
コード例 #10
0
        public JsonResult Edit(JobOpening model, List <string> reqSkill, string minExp, string maxExp)
        {
            var currUser = CurrentUser;

            if (reqSkill == null || !reqSkill.Any())
            {
                ModelState.AddModelError("", "Add atleast one desired skill");
            }
            if (!model.UpdateExperience(minExp, maxExp))
            {
                ModelState.AddModelError("", "Maximum experience should not be less than minimum experience");
            }
            if (model.JobPostId != 0 && model.UserId != currUser.UserId)
            {
                LogUnAuth();
                ModelState.AddModelError("", Strings.UnAuthAccess);
            }
            if (ModelState.IsValid)
            {
                model.UserName = currUser.FullName;
                model.UserId   = currUser.UserId;
                model.UpdateSkills(reqSkill);
                if (model.JobPostId == 0)
                {
                    _db.JobOpenings.Add(model);
                }
                else
                {
                    _db.Entry(model).State = System.Data.EntityState.Modified;
                }
                model.UpdatedOn = DateTime.UtcNow;
                _db.SaveChanges();
            }
            return(GetErrorMsgJSON());
        }
コード例 #11
0
        public ActionResult Index()
        {
            //use GetList() to show existing list of cars
            List <JobOpening> allJobs = JobOpening.GetList();

            return(View(allJobs));
        }
コード例 #12
0
        public ActionResult addJob(string title, string description, string name, string phoneNumber, string emailAddress)
        {
            Contact    newContact = new Contact(name, phoneNumber, emailAddress);
            JobOpening newJob     = new JobOpening(title, description, newContact);

            return(RedirectToAction("Listings"));
        }
コード例 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("JobOpeningID,CompanyID,JobOpeningTitle,JobOpeningRecorded,JobOpeningSource,JobOpeningUrl,JobOpeningDescription,JobOpeningNotes,JobOpeningActive")] JobOpening jobOpening)
        {
            if (id != jobOpening.JobOpeningID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobOpening);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobOpeningExists(jobOpening.JobOpeningID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(jobOpening));
        }
コード例 #14
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobOpening job = db.Job(id.Value);

            if (job == null)
            {
                return(HttpNotFound());
            }
            JobOpeningViewModel jobVM = MapJobOpening(job);

            //Moved here in order to prevent multiple concurrent read actions
            jobVM.Applicants = job.GetAllApplicants().Select(a => new ApplicantViewModel()
            {
                Email          = a.Email,
                DepartmentName = a.GetDepartmentName(),
                CVID           = a.GetMostRecentCVID()
            });
            jobVM.Messages = job.Messages
                             .Where(m => m.IsFirstMessage)
                             .Select(m => new MessageViewModel()
            {
                SenderName = m.Sender.UserName, RecipientName = m.Recipient.UserName, SendTime = m.SendTime, BodyContent = m.BodyContent
            });
            return(View(jobVM));
        }
コード例 #15
0
        public ActionResult DeleteConfirmed(int id)
        {
            JobOpening job = db.Job(id);

            db.Remove(job);
            return(RedirectToAction("Index"));
        }
コード例 #16
0
ファイル: JobsRepo.cs プロジェクト: pratiktumul/IJPWebAPI
 //this method returns boolean value true if a new job is successfully added else false
 public bool AddNewJob(JobOpening job)
 {
     try
     {
         JobOpening jobOpening = new JobOpening()
         {
             JobTitle       = job.JobTitle,
             CompanyName    = job.CompanyName,
             Location       = job.Location,
             JobType        = job.JobType,
             CreateDate     = DateTime.Now,
             JobDescription = job.JobDescription,
             IsExpired      = false, // IsExpired Column will be ByDefault set to false: Admin can change the value explicitly later on
             LastApplyDate  = job.LastApplyDate,
             Vacancy        = job.Vacancy,
             Salary         = job.Salary
         };
         db.JobOpenings.Add(jobOpening);
         db.SaveChanges();
         return(true);
     }catch (Exception)
     {
         return(false);
     }
 }
コード例 #17
0
        public ActionResult Update(JobOpening jobOpening)
        {
            ApiResult <JobOpening> apiResult;

            if (ModelState.IsValid)
            {
                if (jobOpening.Id > 0)
                {
                    apiResult = TryExecute(() =>
                    {
                        _jobOpeningRepository.Update(jobOpening);
                        _unitOfWork.Commit();
                        return(jobOpening);
                    }, "Job Opening updated sucessfully");
                }
                else
                {
                    apiResult = TryExecute(() =>
                    {
                        _jobOpeningRepository.Create(jobOpening);
                        _unitOfWork.Commit();
                        return(jobOpening);
                    }, "Job Opening created sucessfully");
                }
            }
            else
            {
                apiResult = ApiResultFromModelErrors <JobOpening>();
            }

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
        public ActionResult Create(string title, string description, string name, string email, string phone)
        {
            Contact contactinfo = new Contact(name, email, phone);

            JobOpening myJobOpening = new JobOpening(title, description, contactinfo);

            return(RedirectToAction("Index"));
        }
コード例 #19
0
        public ActionResult CreateJob()
        {
            Contact    jobContact = new Contact(Request.Form["contact-name"], Request.Form["contact-email"], Request.Form["contact-phone"]);
            JobOpening newJob     = new JobOpening(Request.Form["job-title"], Request.Form["job-description"], int.Parse(Request.Form["experience"]), Request.Form["job-location"], jobContact);

            newJob.Save();
            return(View(newJob));
        }
コード例 #20
0
 public JobOpeningModel(JobOpening jobOpening)
 {
     Id        = jobOpening.Id;
     Title     = jobOpening.Title;
     Vacancies = jobOpening.NoOfVacancies;
     Status    = GetEnumDescription(jobOpening.OpeningStatus);
     CreatedOn = jobOpening.CreatedOn;
 }
コード例 #21
0
 public IHttpActionResult PostJob(JobOpening job)
 {
     if (ModelState.IsValid)                   // checking the modelstate to make sure the data added in the table is correct
     {
         bool isSuccess = jobs.AddNewJob(job); // AddNewJob of Jobs class will add new job in Job Opening table in DB
         return(isSuccess ? (IHttpActionResult)Ok() : BadRequest("Internal Server Error"));
     }
     return(BadRequest("Check the model state"));
 }
コード例 #22
0
        public ActionResult JobList()
        {
            List <JobOpening> allJobs = JobOpening.GetAll();

            return(View(allJobs));
            // List<JobOpening> salesJobs = JobOpening.GetSales();
            // List<JobOpening> softwareJobs = JobOpening.GetSoftware();
            // List<JobOpening> marketingJobs = JobOpening.GetMarketing();
        }
コード例 #23
0
        public ActionResult Create()
        {
            JobOpening allJobs = new JobOpening(Request.Form["new-title"], Request.Form["new-description"], Request.Form["new-contactInfo"]);

            allJobs.Save();
            List <JobOpening> allJobss = JobOpening.GetAll();

            return(View("Index", allJobss));
        }
コード例 #24
0
        public bool SendEmail(UserModel userModel, JobApplicationStatusModel model, JobOpening jobOpening)
        {
            if (model.Status == "3")
            {
                string subject = "Job Application Approved";
                string body    = "Dear " + userModel.Fullname + ",<br/><br/>Your Job Application for " + jobOpening.JobTitle + ", " + jobOpening.CompanyName + " has been approved. Your interview has been scheduled on " + model.InterviewDate.ToString("MM/dd/yyyy") + ". Further details will be communicated to your by the HR soon.<br/><br/>Regards,<br/>GyanSys";
                string to      = userModel.UserEmail;

                MailMessage mm = new MailMessage
                {
                    From = new MailAddress("*****@*****.**")
                };
                mm.To.Add(to);
                mm.Subject    = subject;
                mm.Body       = body;
                mm.IsBodyHtml = true;

                SmtpClient client = new SmtpClient("smtp.gmail.com")
                {
                    UseDefaultCredentials = false,
                    Port        = 587,
                    EnableSsl   = true,
                    Credentials = new NetworkCredential("*****@*****.**", "s/HD123gs")
                };
                client.Send(mm);

                return(true);
            }
            else
            {
                string subject = "Job Application Rejected";
                string body    = "Dear " + userModel.Fullname + ",<br/><br/>Your Job Application for " + jobOpening.JobTitle + ", " + jobOpening.CompanyName + " has been rejected. Please contact HR for help.<br/><br/>Regards,<br/>GyanSys";
                string to      = userModel.UserEmail;

                MailMessage mm = new MailMessage
                {
                    From = new MailAddress("*****@*****.**")
                };
                mm.To.Add(to);
                mm.Subject    = subject;
                mm.Body       = body;
                mm.IsBodyHtml = true;

                SmtpClient client = new SmtpClient("smtp.gmail.com")
                {
                    UseDefaultCredentials = false,
                    Port        = 587,
                    EnableSsl   = true,
                    Credentials = new NetworkCredential("*****@*****.**", "s/HD123gs")
                };
                client.Send(mm);

                return(true);
            }
        }
コード例 #25
0
        public ActionResult Create()
        {
            JobOpening newJob = new JobOpening(Request.Form["new-title"], Request.Form["new-description"], Request.Form["new-name"], Request.Form["new-phoneNumber"], Request.Form["new-email"]);

            // Dictonary newContact = new Dictionary();
            newJob.Save();
            // newContact.Save();
            List <JobOpening> allJobs = JobOpening.GetList();

            return(View("Index", allJobs));
        }
コード例 #26
0
        public ActionResult Create(string formTitle, string formDescription, string contactName, string contactEmail, string contactPhoneNumber)
        {
            Contact formContactInfo = new Contact();

            formContactInfo.ContactInfo["name"]        = contactName;
            formContactInfo.ContactInfo["email"]       = contactEmail;
            formContactInfo.ContactInfo["phoneNumber"] = contactPhoneNumber;
            JobOpening inputJob = new JobOpening(formTitle, formDescription, formContactInfo);

            return(RedirectToAction("Index"));
        }
コード例 #27
0
        public ActionResult EditJobOpenings(JobOpening job)
        {
            if (ModelState.IsValid)
            {
                int result = dbhelper.UpdateJob(job);
                if (result > 0)
                {
                    //ModelState.Clear();
                    ViewBag.Issuccess = "Data Updated Successfully";
                    return(RedirectToAction("JobOpeningDetails"));
                }
                else
                {
                    //ModelState.Clear();
                    var List = new List <string>();
                    List <Designation> alldata = dbhelper.GetAllDesignations();
                    foreach (Designation item in alldata)
                    {
                        List.Add(item.DesignationTitle);
                    }
                    var List1 = new List <string>();
                    List <Department> alldata1 = dbhelper.GetAllDepartments();
                    foreach (Department item in alldata1)
                    {
                        List1.Add(item.DepartmentName);
                    }
                    ViewBag.list      = List;
                    ViewBag.list1     = List1;
                    ViewBag.Issuccess = "Some problem updating the data";
                    return(View(dbhelper.GetJobById(job.JobID)));
                }
            }
            else
            {
                ModelState.AddModelError("", "Invalid Data");
                var List = new List <string>();
                List <Designation> alldata = dbhelper.GetAllDesignations();
                foreach (Designation item in alldata)
                {
                    List.Add(item.DesignationTitle);
                }
                var List1 = new List <string>();
                List <Department> alldata1 = dbhelper.GetAllDepartments();
                foreach (Department item in alldata1)
                {
                    List1.Add(item.DepartmentName);
                }
                ViewBag.list  = List;
                ViewBag.list1 = List1;

                return(View());
            }
        }
コード例 #28
0
        // GET: Message/Create: Reacting to a job opening
        public ActionResult Create(int jobOpeningID)
        {
            MessageViewModel messageViewModel = new MessageViewModel()
            {
                JobOpeningID = jobOpeningID
            };
            JobOpening job = repo.GetJobopeningByID(jobOpeningID);

            messageViewModel.Title = job.Title;

            return(View(messageViewModel));
        }
コード例 #29
0
        public ActionResult Create()
        {
            string newJobTitle       = Request.Form["title"];
            string newJobDescription = Request.Form["description"];
            string newJobContact     = Request.Form["contact"];

            JobOpening newJobOpening = new JobOpening(newJobTitle, newJobDescription, newJobContact);

            newJobOpening.Save();
            List <JobOpening> allJobs = JobOpening.GetAll();

            return(View("Index", allJobs));
        }
コード例 #30
0
        public ActionResult AddListing(int contactId, string title, string description)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Contact    foundContact           = Contact.FindContact(contactId);
            JobOpening job = new JobOpening(title, description, foundContact);

            foundContact.AddJobOpening(job);
            List <JobOpening> contactJobListings = foundContact.GetJobListings();

            model.Add("contact", foundContact);
            model.Add("joblistings", contactJobListings);
            return(View("Index", model));
        }