Ejemplo n.º 1
0
 public ActionResult Index([FromForm] Job job)
 {
     if (ModelState.IsValid)
     {
         jobRepository.AddJob(job);
     }
     return(RedirectToAction("AllJobs"));
 }
Ejemplo n.º 2
0
        public void NewJob(Job job)
        {
            var repo = new JobRepository(_connectionString);

            job.JobStatus = JobStatus.Open;
            repo.AddJob(job);

            Clients.All.SendAsync("NewJob", job);
        }
        public static void Main()
        {
            var jobs      = new JobRepository();
            var employees = new EmployeeRopository();

            var input = Console.ReadLine()
                        .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            while (!input[0].Equals("End"))
            {
                switch (input[0])
                {
                case "Job":
                {
                    var jobName          = input[1];
                    var jobHoursRequired = int.Parse(input[2]);
                    var employee         = employees.GetEmployee(input[3]);

                    var job = new Job(jobName, jobHoursRequired, employee);
                    job.JobDone += jobs.FinishedJob;
                    jobs.AddJob(job);
                }

                break;

                case "StandartEmployee":
                {
                    var employeeName = input[1];
                    var employee     = new StandartEmployee(employeeName);
                    employees.AddEmployee(employee);
                }

                break;

                case "PartTimeEmployee":
                {
                    var employeeName = input[1];
                    var employee     = new PartTimeEmployee(employeeName);
                    employees.AddEmployee(employee);
                }

                break;

                case "Pass":
                    jobs.Update();
                    break;

                case "Status":
                    jobs.Status();
                    break;
                }

                input = Console.ReadLine()
                        .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            }
        }
Ejemplo n.º 4
0
        public void AppendJobToTheEndOfList()
        {
            var name = "Watch Pluralsight courses";
            var job  = new Job {
                Name = name
            };

            sut.AddJob(job);
            Assert.AreEqual(name, sut.GetJobs().Last().Name);
        }
Ejemplo n.º 5
0
        public void AddJob(string title)
        {
            Job j = new Job {
                Title = title
            };
            JobRepository repo = new JobRepository(_connectionString);

            repo.AddJob(j);
            Clients.All.SendAsync("NewJob", j);
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> AddJob(JobModel jobModel)
        {
            int id = await _jobRepository.AddJob(jobModel);

            if (id > 0)
            {
                return(RedirectToAction(nameof(ModifyList), new { isSucceess = true }));
            }

            return(View());
        }
Ejemplo n.º 7
0
        public void AddJob(string name)
        {
            var job = new Job
            {
                Name   = name,
                Status = Status.Incomplete
            };

            job.Id = _db.AddJob(job);

            Clients.All.SendAsync("NewJob", job);
        }
        public async Task <IActionResult> AddJob(JobModel jobModel)
        {
            ViewBag.Rcount = _leaveRepository.leaveRecomCount();
            ViewBag.Acount = _leaveRepository.leaveAppCount();
            int id = await _jobRepository.AddJob(jobModel);

            if (id > 0)
            {
                return(RedirectToAction(nameof(HRLeaveTableSee), new { isSucceess = true }));
            }

            return(View());
        }
Ejemplo n.º 9
0
        public void AddJobAsEmployer(string userName, string title, string description)
        {
            var user     = _userRepo.EmployerByUserName(userName);
            var jobToAdd = new Job()
            {
                Title       = title,
                Description = description,
                Employer    = user,
                Active      = true,
                Complete    = false
            };

            user.JobRequests.Add(jobToAdd);
            _jobRepo.AddJob(jobToAdd);
        }
    public static void Main()
    {
        Handler       handler       = new Handler();
        JobRepository jobRepository = new JobRepository(handler);
        Dictionary <string, IEmployee> employeeByName = new Dictionary <string, IEmployee>();

        string input = null;

        while ((input = Console.ReadLine()) != "End")
        {
            string[] inputParams = input.Split();

            switch (inputParams[0])
            {
            case "Job":
                IJob job = CreateJob(inputParams.Skip(1).ToArray(), employeeByName);

                jobRepository.AddJob(job);
                break;

            case "StandardEmployee":
                StandardEmployee standardEmployee = new StandardEmployee(inputParams[1]);

                employeeByName[standardEmployee.Name] = standardEmployee;
                break;

            case "PartTimeEmployee":
                PartTimeEmployee partTimeEmployee = new PartTimeEmployee(inputParams[1]);

                employeeByName[partTimeEmployee.Name] = partTimeEmployee;
                break;

            case "Pass":
                jobRepository.PassWeek();
                break;

            case "Status":
                jobRepository.PrintJobsStatus();
                break;

            case "End":
                return;
            }
        }
    }