private void MoveClientFiles(RegisterModel model) { FileRequestModel FileRequestModel = (FileRequestModel)Session["FileRequestModel"]; int GID = FileRequestModel.GID; //CreateRootFolder FileSystemBL fBL = new FileSystemBL(); string RootFolderName = AppConstants.ROOT_FOLDER_NAME; MessageBL mBL = new MessageBL(); var GetAttachmentLog = mBL.GetAttachmentLog(GID); ELTFileSystemItem RootFolderItem = new ELTFileSystemItem() { Owner_Email = model.UserName, IsFolder = true, Name = RootFolderName, ParentID = -1 }; fBL.InsertFile(RootFolderItem); string SenderEmailFolder = GetAttachmentLog[0].SenderEmail; ELTFileSystemItem SenderEmailFolderItem = new ELTFileSystemItem() { Owner_Email = model.UserName, IsFolder = true, Name = SenderEmailFolder, ParentID = RootFolderItem.ID }; fBL.InsertFile(SenderEmailFolderItem); string DocFolder = GetAttachmentLog[0].ReferenceNo; ELTFileSystemItem DocFolderItem = new ELTFileSystemItem() { Owner_Email = model.UserName, IsFolder = true, Name = DocFolder, ParentID = SenderEmailFolderItem.ID }; fBL.InsertFile(DocFolderItem); //mBL.CopyAttachment(GID, model.UserName, DocFolderItem.ID); Session["FileFolderToBeSet"] = DocFolderItem.Name; }
protected void GeneratePDFFiles(EmailAttachment attachment, List<EmailAttachment> ListWithID) { FileSystemBL FSBL = new FileSystemBL(); if (attachment.IsSelected) { var count = (from c in ListWithID where c.FileName == attachment.FileName select c).Count(); if (count == 0) { Stream receiveStream = null; ELT.COMMON.Util.ReadFileStream(Url.Content(attachment.GeneratorPath), ref receiveStream); if (receiveStream != null) { using (var memoryStream = new MemoryStream()) { receiveStream.CopyTo(memoryStream); Byte[] array = memoryStream.ToArray(); ELTFileSystemItem item = new ELTFileSystemItem() { Data = new Binary(array), Name = attachment.FileName + ".pdf", ParentID = -1, Owner_Email = "*****@*****.**" }; FSBL.InsertFile(item); attachment.FileID = item.ID; ListWithID.Add(attachment); } } } } }
public ActionResult ViewFile() { if (string.IsNullOrEmpty(Request.QueryString["FileID"]) || string.IsNullOrEmpty(Request.QueryString["Token"]) || string.IsNullOrEmpty(Request.QueryString["UserEmail"])) { return(RedirectToAction("ErrorView", new ELTError() { Type = ELTErrorType.Input_format_is_not_correct, Description = ELTErrorType.Input_format_is_not_correct.ToString(), ReferenceID = ErrorConstant.ERROR_REF10000 })); } //Check if Cookie is Expired. TokenBL tBL = new TokenBL(); FileSystemBL fBL = new FileSystemBL(); ELTToken token = tBL.GetToken(Request.QueryString["Token"]); //If so return a view that the file is no longer availabe and you need to get the file from the sender. if (token.Expired) { return(RedirectToAction("ErrorView", new ELTError() { Type = ELTErrorType.Token_has_been_expired, Description = ELTErrorType.Token_has_been_expired.ToString(), ReferenceID = ErrorConstant.ERROR_REF10002 })); } if (Request.Cookies["TempUser"] != null) { if (Request.Cookies["TempUser"]["ReadFileAllowedToken"] == Request.QueryString["Token"]) { return(ReturnELTFile(Convert.ToInt32(Request.QueryString["FileID"]))); } } if (!User.Identity.IsAuthenticated) { Session["NewUserFromFileAccess"] = Request.Url.Query; //NameValueCollection qscoll= HttpUtility.ParseQueryString(Request.Url.Query); return(RedirectToAction("Index", "Home")); } else { int FileID = fBL.GetFileIDforParentID(User.Identity.Name, Convert.ToInt32(Request.QueryString["FileID"])); if (FileID == 0) { return(RedirectToAction("ErrorView", new ELTError() { Type = ELTErrorType.File_does_not_exist, Description = ELTErrorType.File_does_not_exist.ToString(), ReferenceID = ErrorConstant.ERROR_REF10001 })); } return(ReturnELTFile(FileID)); } }
protected ActionResult ReturnELTFile(int FileID) { FileSystemBL fBL = new FileSystemBL(); ELTFileSystemItem file = fBL.GetFileByID(FileID); Stream receiveStream = new MemoryStream(file.Data.ToArray()); return(File(receiveStream, COMMON.Util.GetOutputFileExtension(file.Name), file.Name)); }
public ActionResult DocumentManager(string param) { string RootFolder = string.Empty; ELTFileSystemProvider provider = new ELTFileSystemProvider(RootFolder); FileSystemBL bl = new FileSystemBL(); int id = bl.GetRootFileItemID(User.Identity.Name); var rootfolder = bl.GetFileByID(id); ViewBag.InitialFolder = rootfolder.Name; if (Session["FileFolderToBeSet"] != null) { ViewBag.InitialFolder = (string)Session["FileFolderToBeSet"]; Session["FileFolderToBeSet"] = null; } if (param != null) { param = "?" + param; } ViewBag.Params = param; return(View(provider)); }
public ActionResult FileAttacher() { string ItemID = Request.QueryString["itemid"]; string EmailType = Request.QueryString["EmailType"]; ViewBag.ItemID = ItemID; ViewBag.EmailType = EmailType; //these two will be viewbag item to the client ! string RootFolder = string.Empty; ELTFileSystemProvider provider = new ELTFileSystemProvider(RootFolder); FileSystemBL bl = new FileSystemBL(); int id = bl.GetRootFileItemID(User.Identity.Name); var rootfolder = bl.GetFileByID(id); ViewBag.InitialFolder = rootfolder.Name; if (Session["FileFolderToBeSet"] != null) { ViewBag.InitialFolder = (string)Session["FileFolderToBeSet"]; Session["FileFolderToBeSet"] = null; } return(View("FileAttacher", provider)); }
public ActionResult ViewFileTester() { FileSystemBL fBL = new FileSystemBL(); return(ReturnELTFile(int.Parse(Request.QueryString["FileID"]))); }