Beispiel #1
0
        private DragAndDropResult AddInProject(HttpPostedFile file, bool addNavigation)
        {
            string            docNumber = string.Empty;
            DragAndDropResult response  = null;
            String            error;
            List <NttDataWA.Navigation.NavigationObject> navigationList = null;
            NavigationObject page = null;

            if (addNavigation)
            {
                navigationList = NavigationUtils.GetNavigationList();
                page           = navigationList.Last();
                page           = (NavigationObject)page.Clone();
                navigationList.Add(page);
                NavigationUtils.SetNavigationList(navigationList);
            }

            SchedaDocumento schedaDocumento = DocumentManager.NewSchedaDocumento();

            schedaDocumento.oggetto.descrizione = Path.GetFileNameWithoutExtension(file.FileName);
            schedaDocumento = DocumentManager.creaDocumentoGrigio(null, schedaDocumento);
            FileManager.uploadFileFromSchedaDocumento(null, file, schedaDocumento);
            docNumber = schedaDocumento.docNumber;
            Fascicolo fascicolo = NttDataWA.UIManager.ProjectManager.getProjectInSession();

            if (!DocumentManager.fascicolaRapida(null, schedaDocumento.systemId, schedaDocumento.docNumber, string.Empty, fascicolo, out error))
            {
                if (string.IsNullOrEmpty(error))
                {
                    string language = NttDataWA.UIManager.UserManager.GetUserLanguage();
                    error = NttDataWA.Utils.Languages.GetMessageFromCode("WarningDocumentNoClassificated", language);
                }
                throw new Exception(error);
            }

            response = new DragAndDropResult(true, file.FileName, file.ContentLength, docNumber, string.Empty);

            return(response);
        }