Exemplo n.º 1
0
        public ActionResult ViewAttach(int id, string Number)
        {
            var item = new FASTrack.ViewModel.AttachmentViewModel();
            item.Id = id;
            item.InitalReasons = ReasonINI.GetAll();// ReasonRes.GetAll();
            item.FinalReasons = ReasonFIN.GetAll();// item.InitalReasons;
            item.FANumber = Number;

            string folderINT = Path.Combine(Server.MapPath("~/Upload"), id.ToString().PadLeft(10, '0'), "INT");
            string folderFIN = Path.Combine(Server.MapPath("~/Upload"), id.ToString().PadLeft(10, '0'), "FIN");
            if (Directory.Exists(folderINT))
            {
                string[] files = Directory.GetFiles(folderINT);
                item.InitialReport = new List<string>();
                foreach (var file in files)
                {
                    item.InitialReport.Add(Path.GetFileName(file));
                }
            }
            if (Directory.Exists(folderFIN))
            {
                string[] files = Directory.GetFiles(folderFIN);
                item.FinalReport = new List<string>();
                foreach (var file in files)
                {
                    item.FinalReport.Add(Path.GetFileName(file));
                }
            }
            return View(item);
        }
Exemplo n.º 2
0
        public ActionResult AnaAttach(int id, string Number)//idMaster
        {
            var master = MasterRep.Single(id);
            if (master == null)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return View();
            }
           
            var item = new FASTrack.ViewModel.AttachmentViewModel();
            item.Id = id;
            item.InitalReasons = ReasonINI.GetAll();// ReasonRes.GetAll();
            item.FinalReasons = ReasonFIN.GetAll();// item.InitalReasons;
            item.FANumber = Number;
            item.FinalDate = master.FinalReportTargetDate;
            item.InitialDate = master.InitialReportTargetDate;

            string folderINT = Path.Combine(Server.MapPath("~/Upload"), id.ToString().PadLeft(10, '0'), "INT");
            string folderFIN = Path.Combine(Server.MapPath("~/Upload"), id.ToString().PadLeft(10, '0'), "FIN");
            if (Directory.Exists(folderINT))
            {
                string[] files = Directory.GetFiles(folderINT);
                item.InitialReport = new List<string>();
                foreach (var file in files)
                {
                    item.InitialReport.Add(Path.GetFileName(file));
                }
            }
            if (Directory.Exists(folderFIN))
            {
                string[] files = Directory.GetFiles(folderFIN);
                item.FinalReport = new List<string>();
                foreach (var file in files)
                {
                    item.FinalReport.Add(Path.GetFileName(file));
                }
            }
            //ViewBag.ShowButtonReportUploaded = 0;
            //bool checkFilled = ProcessHistoryRep.CheckProcessFlowFilled(id);
            //if (item.InitialReport == null || item.FinalReport == null)
            //    ViewBag.ShowButtonReportUploaded = 0;
            //else if (checkFilled && item.InitialReport.Count > 0 && item.FinalReport.Count > 0)
            //    ViewBag.ShowButtonReportUploaded = 1;

            var final = ReportRepository.GetBy(master.OriginId, ReportType.FINAL);
            ViewBag.EnableFinal = final.Required;

            var initial = ReportRepository.GetBy(master.OriginId, ReportType.INITIAL);
            ViewBag.EnableInitial = initial.Required;

            return View(item);
        }