예제 #1
0
        public ActionResult Insert(DocumentManagement entity)
        {
            if (ModelState.IsValid)
            {
                entity.CreatedBy   = GetCurrentUserName();
                entity.CreatedDate = DateTime.Now;

                _docService.AddDocument(entity);
                _docService.Save();

                this.GetCmp <Window>("windowDocumentManagement").Hide();
                this.GetCmp <Store>("storeDocumentManagement").Reload();

                return(this.Direct());
            }
            return(this.Direct());
        }
예제 #2
0
        public ActionResult Update(DocumentManagement entity)
        {
            if (ModelState.IsValid)
            {
                entity.LastModifiedBy   = GetCurrentUserName();
                entity.LastModifiedDate = DateTime.Now;

                _docService.UpdateDocument(entity);
                _docService.Save();

                var window = this.GetCmp <Window>("windowDocumentManagement");
                window.Hide();
                this.GetCmp <Store>("storeDocumentManagement").Reload();
                return(this.Direct());
            }

            return(this.Direct());
        }
예제 #3
0
        private void SaveDocumentFilePathToDbstring(string title, string shi, string uploadFileName,
                                                    string contentType, string documentType, string releaseDate, string physicalPath, string url, string areaPath)
        {
            string keyVal = string.Format("/{0}/{1}/{2}", shi, documentType, uploadFileName);

            var documentService = new DocumentService();
            var doc             = new DocumentManagement
            {
                Title        = title,
                FileName     = uploadFileName,
                ContentType  = contentType,
                DocumentType = documentType,
                ReleaseDate  = Convert.ToDateTime(releaseDate),
                CreatedBy    = GetCurrentUserName(),
                CreatedDate  = DateTime.Now,
                OrgNamePath  = GetOrganizationNamePath(),
                AreaPath     = areaPath,
                KeyValue     = keyVal,
                FilePath     = physicalPath,
                Url          = url,
            };

            documentService.SaveToDb(doc);
        }
예제 #4
0
파일: Program.cs 프로젝트: radtek/Cobox
        private static void TestDocumentAcl()
        {
            Exception         exception               = null;
            List <Document>   documentsRaheel         = null;
            List <Document>   documentsJunaid         = null;
            TenantUserSession tenantUserSessionRaheel = null;
            TenantUserSession tenantUserSessionJunaid = null;

            ContextMaster.Initialize();
            using (var context = new ContextMaster())
            {
                context.Tenants.ToList();
            }

            AuthenticationManagement.SignIn(SessionType.Mvc, "kloud-soft.com", "raheel.khan", Sha.GenerateHash("audience", GlobalConstants.EncodingCryptography, GlobalConstants.AlgorithmHashShaKind), IPAddress.Loopback.ToString(), "User Agent", 0, "Session Id", out tenantUserSessionRaheel, out exception);
            AuthenticationManagement.SignIn(SessionType.Mvc, "kloud-soft.com", "junaid.sayed", Sha.GenerateHash("audience", GlobalConstants.EncodingCryptography, GlobalConstants.AlgorithmHashShaKind), IPAddress.Loopback.ToString(), "User Agent", 0, "Session Id", out tenantUserSessionJunaid, out exception);

            documentsRaheel = DocumentManagement.GetDocuments
                              (
                tenantUserSession: tenantUserSessionRaheel,
                documentId: 23,
                documentIdType: DocumentIdType.Id,
                folderId: 3,
                documentResultVersionType: DocumentResultVersionType.All,
                includeDiscourse: false,
                includeDocumentElements: false,
                includeDocumentFragments: false,
                includeCreatorUser: false,
                includeCheckedOutUser: false,
                includeDocumentUsers: false,
                includeDocumentIndexes: false,
                includeDocumentTags: false,
                includeDocumentTagUsers: false,
                includeDocumentTemplates: false,
                includeDocumentCorrectiveIndexValues: false,
                isFinalized: null,
                skipRows: null,
                takeRows: null
                              );

            documentsJunaid = DocumentManagement.GetDocuments
                              (
                tenantUserSession: tenantUserSessionJunaid,
                documentId: 23,
                documentIdType: DocumentIdType.Id,
                folderId: 3,
                documentResultVersionType: DocumentResultVersionType.All,
                includeDiscourse: false,
                includeDocumentElements: false,
                includeDocumentFragments: false,
                includeCreatorUser: false,
                includeCheckedOutUser: false,
                includeDocumentUsers: false,
                includeDocumentIndexes: false,
                includeDocumentTags: false,
                includeDocumentTagUsers: false,
                includeDocumentTemplates: false,
                includeDocumentCorrectiveIndexValues: false,
                isFinalized: null,
                skipRows: null,
                takeRows: null
                              );

            Console.Write($"User: {tenantUserSessionRaheel.User.NameFull}:");
            foreach (var document in documentsRaheel)
            {
                Console.WriteLine();
                Console.Write($" - Name: {document.Name}");
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.Write($"User: {tenantUserSessionJunaid.User.NameFull}:");
            foreach (var document in documentsJunaid)
            {
                Console.WriteLine();
                Console.Write($" - Name: {document.Name}");
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.Write("Press any key to continue...");
            Console.ReadKey(true);
        }