private void OnNewDocumentCreated(NewDocumentEventArgs e)
 {
     if (NewDocumentCreated != null)
     {
         NewDocumentCreated(this, e);
     }
 }
Exemple #2
0
 void controller_NewDocumentCreated(object sender, NewDocumentEventArgs e)
 {
     if (NewDocumentCreated != null)
     {
         NewDocumentCreated(this, e);
     }
 }
        private string ProcessNewDocument(FileManagerItemInfo destDir, NewDocumentTemplate template)
        {
            NewDocumentCancelEventArgs cancelArg = new NewDocumentCancelEventArgs();
            cancelArg.DestinationDirectory = destDir;
            cancelArg.Template = template;
            OnNewDocumentCreating(cancelArg);

            if (cancelArg.Cancel)
            {
                return ClientMessageEventReference(cancelArg.ClientMessage);
            }

            if (template.MasterFileUrl.Length == 0)
                return "";

            FileInfo masterFile = new FileInfo(Page.MapPath(template.MasterFileUrl));
            if (!masterFile.Exists)
                return "";

            string newFileName = template.NewFileName;
            if (newFileName.Length == 0)
                newFileName = template.Name;

            int i = 1;
            string originNewFileName = newFileName;
            while (File.Exists(Path.Combine(destDir.PhysicalPath, newFileName + masterFile.Extension)))
            {
                newFileName = originNewFileName + "(" + i + ")";
                i++;
            }
            newFileName = newFileName + masterFile.Extension;
            FileManagerItemInfo itemInfo = ResolveFileManagerItemInfo(VirtualPathUtility.AppendTrailingSlash(destDir.FileManagerPath) + newFileName);
            FileInfo newDocument = masterFile.CopyTo(itemInfo.PhysicalPath);

            NewDocumentEventArgs arg = new NewDocumentEventArgs();
            arg.Template = template;
            arg.NewDocument = itemInfo;
            OnNewDocumentCreated(arg);

            return ClientRefreshEventReference;
        }
 private void OnNewDocumentCreated(NewDocumentEventArgs e)
 {
     if (NewDocumentCreated != null)
         NewDocumentCreated (this, e);
 }
 void controller_NewDocumentCreated(object sender, NewDocumentEventArgs e)
 {
     if (NewDocumentCreated != null)
         NewDocumentCreated(this, e);
 }