Esempio n. 1
0
        protected virtual string GetNewFile(View view, Dictionary <string, object> values)
        {
            string id = values[Proposal.Id.ToString()].ToString();

            string subject = values[Proposal.Subject.ToString()].ToString();

            Durados.Web.Mvc.ColumnField wordDocumentField = (Durados.Web.Mvc.ColumnField)view.Fields[Proposal.WordDocument.ToString()];

            return(GetNewFile(id, subject, wordDocumentField));
        }
Esempio n. 2
0
        protected virtual string GetNewFile(string id, string subject, Durados.Web.Mvc.ColumnField documentField)
        {
            string newFileVirtualPath = documentField.Upload.UploadVirtualPath;
            string path        = HttpContext.Server.MapPath(newFileVirtualPath);
            string dot         = ".";
            string newFileName = subject + dot + DateTime.Now.Date.ToString("dd.MM.yyyy") + string.Format("-{0}", id) + ".docx";
            string newFile     = path + newFileName;

            return(newFile);
        }
Esempio n. 3
0
        public static IUpload GetUpload(Durados.Web.Mvc.ColumnField field)
        {
            if (field.IsFtpUpload)
            {
                if (field.FtpUpload.StorageType == StorageType.Ftp)
                {
                    return(field.FtpUpload);
                }
                else if (field.FtpUpload.StorageType == StorageType.Azure)
                {
                    return(null);
                }
                //return new FtpAzure();
            }
            else if (field.IsUpload)
            {
                return(field.Upload);
            }

            return(null);
        }
Esempio n. 4
0
        public static string GetUploadPath(this Durados.Web.Mvc.ColumnField field)
        {
            string uploadPath = string.Empty;

            if (field.IsFtpUpload)
            {
                string fileName = string.Empty;
                uploadPath = field.FtpUpload.GetFtpBasePath(fileName);
            }
            else if (field.IsUpload)
            {
                if (string.IsNullOrEmpty(field.Upload.UploadPhysicalPath))
                {
                    uploadPath = field.Upload.UploadVirtualPath.Replace("/", "\\");

                    if (!field.Upload.UploadVirtualPath.StartsWith(@"~\"))
                    {
                        if (!uploadPath.StartsWith(@"\"))
                        {
                            uploadPath = @"\" + uploadPath;
                        }
                        uploadPath = "~" + uploadPath;
                    }
                    uploadPath = HttpContext.Current.Server.MapPath(uploadPath);
                }
                else
                {
                    uploadPath = field.Upload.UploadPhysicalPath;
                }

                if (!uploadPath.EndsWith(@"\"))
                {
                    uploadPath = uploadPath + @"\";
                }
            }
            return(uploadPath);
        }