public void setStatuses(List <ErrandStatus> list, string selectedId = null)
 {
     {
         List <SelectListItem> r = new List <SelectListItem>();
         for (int i = 0; i < list.Count; i++)
         {
             ErrandStatus d = (ErrandStatus)list[i];
             r.Add(new SelectListItem {
                 Text = d.StatusName, Value = d.StatusId, Selected = selectedId == d.StatusId ? true : false
             });
         }
         this.ErrandStatuses = r;
     }
 }
        public async Task <IActionResult> UpdateStatus(ErrandStatus errandStatus, int errandID, string events, string information, IFormFile loadSample, IFormFile loadImage)
        {
            repository.UpdateStatus(errandID, errandStatus.StatusId, events, information);

            var tempPath = Path.GetTempFileName();

            if (loadSample != null && loadSample.Length > 0)
            {
                using (var stream = new FileStream(tempPath, FileMode.Create))
                {
                    await loadSample.CopyToAsync(stream);
                }

                string uniqueFileName = Guid.NewGuid().ToString() + "_" + loadSample.FileName;

                var path = Path.Combine(environment.WebRootPath, "SampleFIles", uniqueFileName);

                System.IO.File.Move(tempPath, path);

                repository.AddSampleFile(uniqueFileName, errandID);
            }

            if (loadImage != null && loadImage.Length > 0)
            {
                using (var stream = new FileStream(tempPath, FileMode.Create))
                {
                    await loadImage.CopyToAsync(stream);
                }

                string uniqueFileName = Guid.NewGuid().ToString() + "_" + loadImage.FileName;

                var path = Path.Combine(environment.WebRootPath, "ImageFiles", uniqueFileName);

                System.IO.File.Move(tempPath, path);

                repository.AddImageFile(uniqueFileName, errandID);
            }

            return(View("StartInvestigator", repository));
        }
Ejemplo n.º 3
0
        public async Task <ViewResult> StartInvestigator(ErrandStatus errandStatus, string casenumber, bool isCasenumber)
        {
            Employee currentEmployee = await GetEmployeeData();

            ViewBag.employeeID = currentEmployee.EmployeeId;
            ViewBag.Statuses   = repository.ErrandStatuses;

            StartViewErrandInputData startViewErrandInputData = new StartViewErrandInputData
            {
                filterUsed         = !isCasenumber,
                caseNumberSearched = isCasenumber,
                employeeId         = currentEmployee.EmployeeId,
                departmentId       = null,
                caseNumber         = isCasenumber ? casenumber : null,
                statusId           = !isCasenumber ? errandStatus.StatusId : null,
                investigatorId     = null
            };

            ViewBag.startViewErrandInputData = startViewErrandInputData;

            return(View());
        }
Ejemplo n.º 4
0
        private void ErrandStatus_CLICK(object sender, RoutedEventArgs e)
        {
            var errandStatus = new ErrandStatus();

            this.NavigationService.Navigate(errandStatus);
        }