コード例 #1
0
        public async Task<ActionResult> RegSend(RegSendViewModels dataRequestViewModel, string expertType, IEnumerable<HttpPostedFileBase> files)
        {
            ViewBag.LeftMenu = Global.ExpertService;

            if (ModelState.IsValid)
            {
                var scReqDoc = Mapper.Map<ScReqDoc>(dataRequestViewModel);

                //회원정보 추가 정보 설정
                scReqDoc.ChkYn = "N";
                scReqDoc.ReqDt = DateTime.Now;
                scReqDoc.SenderId = Session[Global.LoginID].ToString();
                scReqDoc.Status = "N";

                //신규파일정보저장 및 파일업로드
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        var fileHelper = new FileHelper();

                        var savedFileName = fileHelper.GetUploadFileName(file);

                        var subDirectoryPath = Path.Combine(FileType.Document.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString());

                        var savedFilePath = Path.Combine(subDirectoryPath, savedFileName);

                        var scFileInfo = new ScFileInfo { FileNm = Path.GetFileName(file.FileName), FilePath = savedFilePath, Status = "N", RegId = Session[Global.LoginID].ToString(), RegDt = DateTime.Now };

                        var scReqDocFile = new ScReqDocFile { ScFileInfo = scFileInfo };
                        scReqDocFile.RegType = "S";

                        scReqDoc.ScReqDocFiles.Add(scReqDocFile);

                        await fileHelper.UploadFile(file, subDirectoryPath, savedFileName);
                    }
                }

                //저장
                int result = await _scReqDocService.AddReqDocAsync(scReqDoc);

                if (result != -1)
                    return RedirectToAction("SendList", "ExpertService", new {expertType = expertType });
                else
                {
                    ModelState.AddModelError("", "자료요청 등록 실패.");
                    return View(dataRequestViewModel);
                }
            }
            ModelState.AddModelError("", "입력값 검증 실패.");
            return View(dataRequestViewModel);
        }
コード例 #2
0
        public async Task<ActionResult> RegSend(string expertType)
        {
            ViewBag.LeftMenu = Global.ExpertService;
            string senderId = Session[Global.LoginID].ToString();
            string compSn = Session[Global.CompSN].ToString();

            var scCompMapping = await _scCompMappingService.GetCompMappingAsync(int.Parse(compSn), "A");

            var scExpertMapping =  await _scExpertMappingService.GetExpertAsync(scCompMapping.BizWorkSn, expertType);

            var dataRequest = new RegSendViewModels
            {
                 ReceiverName = scExpertMapping.ScUsr.Name,
                  ReceiverId = scExpertMapping.ScUsr.LoginId
            };
                 
            //전문가 타입 리턴
            ViewBag.ExpertType = expertType;

            return View(dataRequest);
        }