Esempio n. 1
0
        private ActionResult SaveDoc(IEnumerable<HttpPostedFileBase> zxdocs, string prjid, string doctag)
        {
            foreach (var uploadfile in zxdocs)
            {
                string mimeType = uploadfile.ContentType;
                var newdoc = new LayoutFile
                                 {
                                     DgProjectId = Convert.ToInt32(prjid),
                                     UploadBy = User.Identity.Name.Trim(),
                                     UploadDate = DateTime.Now,
                                     DocName = Path.GetFileNameWithoutExtension(uploadfile.FileName),
                                     FileUrL = _fileStore.SaveUploadedFile(uploadfile),
                                     FileType = mimeType,
                                     DocTag = doctag
                                 };

                _entities.AddToLayoutFiles(newdoc);
                _entities.SaveChanges();
            }
            return Content(""); // return an empty string to signify success
        }
Esempio n. 2
0
        public virtual ActionResult SaveAuthorizeFile(IEnumerable<HttpPostedFileBase> authorizedfiles, string projectid)
        {
            foreach (var uploadfile in authorizedfiles)
            {
                string mimeType = uploadfile.ContentType;
                var newdoc = new LayoutFile
                {
                    DgProjectId = Convert.ToInt32(projectid),
                    UploadBy = User.Identity.Name.Trim(),
                    UploadDate = DateTime.Now,
                    DocName = Path.GetFileNameWithoutExtension(uploadfile.FileName),
                    FileUrL = _fileStore.SaveUploadedFile(uploadfile),
                    FileType = mimeType,
                    DocGroup = "法人授权书",
                    DocTag = "法人授权书"
                };

                _entities.AddToLayoutFiles(newdoc);
                _entities.SaveChanges();
            }
            return Content(""); // return an empty string to signify success
        }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the LayoutFiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLayoutFiles(LayoutFile layoutFile)
 {
     base.AddObject("LayoutFiles", layoutFile);
 }
 private ActionResult SaveDoc(IEnumerable<HttpPostedFileBase> attachments, string layoutid, string doctag, string docgroup)
 {
     var id = Convert.ToInt32(layoutid);
     foreach (var uploadfile in attachments)
     {
         var newdoc = new LayoutFile();
         var layout = _entities.Layouts.SingleOrDefault(x => x.LayoutID == id);
         newdoc.LayoutID = Convert.ToInt32(layoutid);
         newdoc.UploadBy = User.Identity.Name.Trim();
         newdoc.UploadDate = DateTime.Now;
         string mimeType = uploadfile.ContentType;
         newdoc.DocName = Path.GetFileNameWithoutExtension(uploadfile.FileName);
         newdoc.FileUrL = _fileStore.SaveUploadedFile(uploadfile, layout);
         newdoc.FileType = mimeType;
         newdoc.DocGroup = GetGroupname(docgroup);
         newdoc.DocTag = doctag;
         _entities.AddToLayoutFiles(newdoc);
         _entities.SaveChanges();
     }
     return Content(""); // return an empty string to signify success
 }
Esempio n. 5
0
 /// <summary>
 /// Create a new LayoutFile object.
 /// </summary>
 /// <param name="docID">Initial value of the DocID property.</param>
 public static LayoutFile CreateLayoutFile(global::System.Int32 docID)
 {
     LayoutFile layoutFile = new LayoutFile();
     layoutFile.DocID = docID;
     return layoutFile;
 }