public ActionResult AddFile(HttpPostedFileBase file, Document _doc)
        {
            if (file != null)
            {
                if (file.ContentLength >= 0)
                {
                    DocumentModified _docm    = new DocumentModified();
                    Members          _members = members.Find(new Guid(Request.Cookies["MemberGUID"].Value));
                    int lastDocID             = 0;
                    var _lastDocID            = Doc.GetCollections().Where(n => n.DocumentCategory == _doc.DocumentCategory);
                    if (_lastDocID.Count() != 0)
                    {
                        lastDocID = _lastDocID.Select(n => n.DocumentID).Max();
                    }
                    _doc.DocumentID    = lastDocID + 1;
                    _doc.DocumentGUID  = Guid.NewGuid();
                    _doc.CreateEmpGUID = _members.EmployeeGUID;
                    _doc.CreateDate    = DateTime.Now;
                    Doc.Add(_doc);
                    _docm.DocumentGUID    = _doc.DocumentGUID;
                    _docm.Description     = _doc.Description;
                    _docm.IsChecked       = false;
                    _docm.ModifiedEmpGUID = _members.EmployeeGUID;
                    _docm.ModifiedDate    = DateTime.Now;
                    _docm.Version         = 1;
                    var fileExtension = System.IO.Path.GetExtension(file.FileName);
                    _docm.FileName     = _doc.DocumentName + "_" + _docm.Version + fileExtension;
                    _docm.ModifiedGUID = Guid.NewGuid();
                    DocModified.Add(_docm);
                    var    fileName = _docm.FileName;
                    string path     = Server.MapPath("~/Document/" + _doc.DocumentCategory);
                    string filePath = Path.Combine(path, fileName);
                    if (!Directory.Exists(path))
                    {
                        try
                        {
                            Directory.CreateDirectory(path);
                        }
                        catch (Exception e)
                        {
                            return(Json(e, JsonRequestBehavior.AllowGet));
                        }
                    }

                    file.SaveAs(filePath);
                }
            }
            return(RedirectToAction("/Index"));
        }
示例#2
0
        public void RefreshModifiedDocument(IDsDocument document)
        {
            var documentsHash = GetModifiedDocuments(document);

            decompilationCache.Clear(documentsHash);

            var tabs = new List <IDocumentTab>();

            foreach (var tab in VisibleFirstTabs)
            {
                if (MustRefresh(tab, documentsHash))
                {
                    tabs.Add(tab);
                }
            }
            if (tabs.Count > 0)
            {
                Refresh(tabs);
            }

            DocumentModified?.Invoke(this, new DocumentModifiedEventArgs(documentsHash.ToArray()));
        }
示例#3
0
 internal void RaiseDocumentModified(GedcomDocument document)
 {
     // Inform caller
     DocumentModified?.Invoke(document);
 }
示例#4
0
 void OnTextContentsChanged(object sender, TextModificationEventArgs e)
 {
     IterateTreeOnContentChange(RootView, e);
     DocumentModified?.Invoke(this, e);
 }
 private void RichTextEditor_TextChanged(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     DocumentModified?.Invoke(this, EventArgs.Empty);
 }