Пример #1
0
        public ActionResult ReportClientRequest(ClientReportRequestViewModel reportRequest)
        {
            if (ModelState.IsValid)
            {
                var job = _jobBLL.CreateJob(reportRequest);

                if (reportRequest.Files != null)
                {
                    foreach (var file in reportRequest.Files)
                    {
                        if (file != null)
                        {
                            var fileName      = _fileBLL.GetFileName(file.FileName);
                            var jobFolderPath = _fileBLL.GetFolderPath(job.JobId);

                            if (!(Directory.Exists(jobFolderPath)))
                            {
                                Directory.CreateDirectory(jobFolderPath);
                            }

                            file.SaveAs(Path.Combine(string.Format("{0}\\{1}", jobFolderPath, fileName)));
                            ViewBag.UploadStatus = reportRequest.Files.Count().ToString() + "Files Uploaded Successfully";
                        }
                    }
                }
                return(RedirectToAction("StaffInformation", "Staff"));
            }
            else
            {
                ModelState.AddModelError("", "Fill in all the fields");
            }
            return(View(reportRequest));
        }
Пример #2
0
        public Job CreateJob(ClientReportRequestViewModel requestViewModel)
        {
            var staff  = _staffRepository.GetStaffById(requestViewModel.StaffId);
            var user   = _userRepository.GetAllUsers().SingleOrDefault(d => d.UserType == UserType.Staff && d.TargetUserID == requestViewModel.StaffId);
            var client = _clientRepository.GetClientById(requestViewModel.StakeholderClientId);
            var job    = new Job
            {
                JobTitle          = requestViewModel.JobTitle,
                JobDescription    = requestViewModel.JobDescription,
                JobCategory       = requestViewModel.JobType,
                CreatedOn         = DateTime.Now,
                UpdatedOn         = DateTime.Now,
                ReportedById      = requestViewModel.StakeholderClientId,
                CreatedById       = user.UserId,
                JobPriority       = requestViewModel.JobPriority,
                EstimatedTimeHour = requestViewModel.EstimatedTimeInHours,
                ReleaseVersion    = requestViewModel.ReleaseVersion
            };

            if (requestViewModel.JobTakerId != 0)
            {
                job.AssignedToId = requestViewModel.JobTakerId;
                job.Status       = JobStatus.Assigned;
            }
            else
            {
                job.Status = JobStatus.New;
            }

            return(_jobRepository.Create(job));
        }
Пример #3
0
        public ActionResult ReportClientRequest()
        {
            var model = new ClientReportRequestViewModel()
            {
                StaffId   = (int)Session[Constants.StaffId],
                JobStatus = Req.Enums.JobStatus.New
            };

            ViewBag.Clients = _clientBLL.GetClients().ToList();
            ViewBag.Takers  = _takerBLL.GetTakers();
            return(View(model));
        }