示例#1
0
 public int CreateDocument(DocumentModel document)
 {
     using (geekinsidekmsEntities context = new geekinsidekmsEntities())
     {
         Document dbDocument = new Document
         {
             CheckerName = "",
             Description = document.Description,
             FileDiskName = document.FileDiskName,
             FileDisplayName = document.FileDisplayName,
             Size = document.Size,
             PubTime = document.PubTime,
             PublisherName = document.PublisherName,
             PublisherNumber = document.PublisherNumber,
             FileTypeId = document.FileTypeId,
             FolderId = document.FolderId,
             AuthLevel = document.AuthLevel
         };
         try
         {
             context.AddToDocuments(dbDocument);
             context.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
         }
         catch(Exception e){
             System.Diagnostics.Debug.WriteLine(e.InnerException.Message);
         }
         return dbDocument.Id;
     }
 }
示例#2
0
 public ActionResult doEdit()
 {
     //标签暂时还不能改
     DocumentModel docModel = new DocumentModel();
     docModel.Id = Convert.ToInt32(Request.Form["id"]);
     docModel.FileDisplayName = Request.Form["filedisplayname"];
     docModel.Description = Request.Form["description"];
     docModel.AuthLevel = Convert.ToInt32(Request.Form["auth_"]);
     if (bllDocument.updateDocument(docModel))
     {
         TempData["successMsg"] = "更新成功。";
     }
     else
     {
         TempData["errorMsg"] = "更新失败。";
     }
     return RedirectToAction("Index", "Document");
 }
示例#3
0
 public JsonResult FileDetail(DocumentModel document,  string tags)
 {
     string[] tagArr = null;
     if (tags != "")
     {
         tagArr = tags.Split(new string[] { " ", " " }, StringSplitOptions.RemoveEmptyEntries);
     }
     BLLDocument bllDoc = new BLLDocument();
     if (User.Identity.Name != null)
     {
         return Json(bllDoc.AddDocument(document, tagArr, Convert.ToInt32(User.Identity.Name)));
     }
     return Json(false);
 }
示例#4
0
 public ActionResult doEdit()
 {
     //标签暂时还不能改
     DocumentModel docModel = new DocumentModel();
     docModel.Id = Convert.ToInt32(Request.Form["id"]);
     docModel.FileDisplayName = Request.Form["filedisplayname"];
     docModel.Description = Request.Form["description"];
     //改完后需重新审核
     docModel.IsChecked = false;
     if (new BLLDocument().updateDocument(docModel))
     {
         TempData["successMsg"] = "更新成功。";
     }
     else
     {
         TempData["errorMsg"] = "更新失败。";
     }
     return RedirectToAction("Workshop", "User");
 }
示例#5
0
        //更新单个文档
        public Boolean updateDocument(DocumentModel docModel)
        {
            geekinsidekmsEntities context = new geekinsidekmsEntities();

            DAL.Document dbDoc = (from doc in context.Documents
                                  where doc.Id.Equals(docModel.Id)
                                  select doc).FirstOrDefault();
            dbDoc.FileDisplayName = docModel.FileDisplayName;
            dbDoc.Description = docModel.Description;
            dbDoc.IsChecked = docModel.IsChecked;
            dbDoc.AuthLevel = docModel.AuthLevel;
            context.SaveChanges();
            return true;
        }