public ActionResult uploadNotificationDoc(RFAReferralFile _rfaReferralFile)
        {
            StorageModel _storageModel = new StorageModel();

            _storageModel            = Mapper.Map <StorageModel>(_iCommonService.GetStorageStuctureByID(_rfaReferralFile.RFAReferralID, GlobalConst.ConstantChar.Char_R));
            _storageModel.path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings[GlobalConst.VirtualDirectoryPath.VirtualPath].ToString());
            _storageModel.FolderName = GlobalConst.FolderName.LegalDocs;

            string filename     = Guid.NewGuid().ToString() + Path.GetExtension(_rfaReferralFile.rfaReferralFile.FileName);
            string path         = _storageService.GeneateStorage(_storageModel);
            string fileToDelete = _rfaReferralFile.RFAReferralFileName;

            _rfaReferralFile.rfaReferralFile.SaveAs(path + GlobalConst.ConstantChar.DoubleBackSlash + filename);

            _rfaReferralFile.RFAReferralFileName = filename;
            _rfaReferralFile.RFAFileTypeID       = GlobalConst.FileType.UploadInitialNotifications;
            _rfaReferralFile.RFAFileCreationDate = DateTime.Now;
            _rfaReferralFile.RFAFileUserID       = MMCUser.UserId;
            if (_rfaReferralFile.RFAReferralFileID == 0)
            {
                _rfaReferralFile.RFAReferralFileID = _intakeService.addReferralFile(Mapper.Map <serviceModel.IntakeService.RFAReferralFile>(_rfaReferralFile));
            }
            else
            {
                System.IO.File.Delete(path + GlobalConst.ConstantChar.DoubleBackSlash + fileToDelete);
                _intakeService.updateReferralFile(Mapper.Map <serviceModel.IntakeService.RFAReferralFile>(_rfaReferralFile));
            }
            _rfaReferralFile.rfaReferralFile = null;
            return(Json(_rfaReferralFile, GlobalConst.ContentTypes.TextHtml));
        }
Beispiel #2
0
        public JsonResult UploadIMRDecisionDoc(int id, int id2)
        {
            HttpPostedFileBase fileContent   = Request.Files[0];
            string             filename      = Guid.NewGuid().ToString() + Path.GetExtension(fileContent.FileName);
            StorageModel       _storageModel = Mapper.Map <StorageModel>(_iCommonService.GetStorageStuctureByID(id, GlobalConst.ConstantChar.Char_R));

            _storageModel.path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings[GlobalConst.VirtualDirectoryPath.VirtualPath].ToString());
            _storageModel.FolderName = GlobalConst.FolderName.MedicalRecords;
            string path = _storageService.GeneateStorage(_storageModel) + GlobalConst.ConstantChar.DoubleBackSlash + filename;

            RFAReferralFile _rfaFile = new RFAReferralFile();

            _rfaFile.RFAReferralID       = id;
            _rfaFile.RFAReferralFileName = filename;
            _rfaFile.RFAFileTypeID       = GlobalConst.FileType.IMRDecisionUpload;
            _rfaFile.RFAFileCreationDate = DateTime.Now;
            _rfaFile.RFAFileUserID       = MMCUser.UserId;

            if (id2 != 0)
            {
                System.IO.File.Delete(path);
                fileContent.SaveAs(path);
                _rfaFile.RFAReferralFileID = id2;
                _intakeService.updateReferralFile(Mapper.Map <MMC.MMCService.IntakeService.RFAReferralFile>(_rfaFile));
            }
            else
            {
                fileContent.SaveAs(path);
                id2 = _intakeService.addReferralFile(Mapper.Map <MMC.MMCService.IntakeService.RFAReferralFile>(_rfaFile));
            }
            return(Json(id2));
        }