Ejemplo n.º 1
0
        public HttpResponseMessage Delete(int id)
        {
            UserTicket ticket = TicketManager.getTicketFromContext(this.ControllerContext);
            Section section = repo.GetById(id);

            if (!ticket.user.affiliations.Any(o => o.company.id==section.document.ownerCompany.id && !o.role.name.Equals("Basis")))
            {
                return Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Not sufficient rights to delete.");
            }

            int? docId = section.document.id;

            repo.Delete(section);

            //Rearrange document indices
            if (docId!=null)
            {
                DocumentRepository dRepo = new DocumentRepository();
                Document document = dRepo.GetById(docId);

                int index = 1;

                foreach (Section item in document.sections.OrderBy(o => o.documentIndex).ToList())
                {
                    item.documentIndex = index;
                    index++;
                }

                dRepo.Update(document);
            }

            var response = Request.CreateResponse(HttpStatusCode.NoContent);
            return response;
        }
        public ActionResult AddDocuments(PatientDocumentViewModel patientDocumentViewModel)
        {
            if (!ModelState.IsValid)
            {
                patientDocumentViewModel.PatientDocumentViewEntity.Patients = GetPatients();
                return View(patientDocumentViewModel);
            }

            if (patientDocumentViewModel.PatientDocumentViewEntity.Patients.SelectedItemId == "-1")
            {
                ModelState.AddModelError("", "Please select patient");
                patientDocumentViewModel.PatientDocumentViewEntity.Patients = GetPatients();
                return View(patientDocumentViewModel);
            }

            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
            patientDocumentViewModel.PatientDocumentViewEntity.DocumentToUpload.InputStream.CopyTo(memoryStream);
            byte[] documentInByteArray = memoryStream.ToArray();

            Document document = new Document();
            DocumentRepository documentRepository = new DocumentRepository();

            document.ProviderId = int.Parse(Session["ProviderId"].ToString());
            document.PatientId = int.Parse(patientDocumentViewModel.PatientDocumentViewEntity.Patients.SelectedItemId);
            document.DocumentType = patientDocumentViewModel.PatientDocumentViewEntity.DocumentType;
            document.Document1 = documentInByteArray;
            document.CreationTime = DateTime.Now;
            documentRepository.AddDocuments(document);

            return RedirectToAction("AddDocuments", new { patientId = document.PatientId });
        }
Ejemplo n.º 3
0
 public void BeforeEachTest()
 {
     mockConfiguration = new Mock<IProvideCouchConfiguration>();
     mockCouchUriBuilder = new Mock<CouchUriBuilder>(new object[] {mockConfiguration.Object});
     documentRepository = new DocumentRepository<TestDocument>(mockCouchUriBuilder.Object, mockJsonClient.Object);
     documentUri = new Uri("http://somecouchserver:1433/db/someid");
     mockCouchUriBuilder.Setup(s => s.DocumentUri(It.IsAny<string>())).Returns(documentUri);
 }
Ejemplo n.º 4
0
 public ActionResult Edit(string Id)
 {
     if (string.IsNullOrEmpty(Id)) return RedirectToAction("Create");
     ViewBag.CurrentActionName = "Edit";
     var documentRepository = new DocumentRepository();
     var merchant = documentRepository.Load<Merchant>(Id);
     return View("Edit", merchant);
 }
Ejemplo n.º 5
0
 public ActionResult List(string catalogueId)
 {
     var documentRepository = new DocumentRepository();
     var catalogue = documentRepository.Load<Catalogue>(catalogueId);
     var products = catalogue.GetProducts(new ProductsFilter(1000, 1));
     var productsList = new ProductsList { Products = products };
     return PartialView(productsList);
 }
 public void PASS_IndexDocument_Id()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document, _Id);
     IndexResponse response = tweetRepo.Index(request);
     Assert.IsNotNull(response);
     Assert.AreEqual(_Id, response.DocumentId);
 }
Ejemplo n.º 7
0
        public EventStorePublisher(IEventStore store, IEventPublisher publisher, IDocumentStoreFactory documentStoreFactory)
        {
            Condition.Requires(store, "store").IsNotNull();
              Condition.Requires(publisher, "publisher").IsNotNull();

              EventStore = store;
              EventPublisher = publisher;
              LastPublishedIdRepository = new DocumentRepository(documentStoreFactory);
        }
Ejemplo n.º 8
0
 public ActionResult Create(Catalogue catalogue)
 {
     var documentRepository = new DocumentRepository();
     catalogue.Created = DateTime.Now;
     catalogue.Updated = DateTime.Now;
     catalogue.Status = CatalogStatus.DRAFT;
     catalogue.Id = string.Empty;
     documentRepository.Save(catalogue);
     return RedirectToAction("Detail", "Merchant", new { Id = catalogue.MerchantId });
 }
Ejemplo n.º 9
0
 public ActionResult Detail(string Id)
 {
     var documentRepository = new DocumentRepository();
     var merchantDetail = new MerchantDetail();
     merchantDetail.Merchant = documentRepository.Load<Merchant>(Id);
     var catalogues = MerchantService.GetCatalogues(Id);
     merchantDetail.Stats.CataloguesNumber = catalogues.Count();
     merchantDetail.Stats.ProductsNumber = catalogues.Sum(c => c.GetProductsNumber());
     return View(merchantDetail);
 }
 public void PASS_IndexDocument_TimeOut_1m()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document)
     {
         OperationTimeOut = new TimeSpan(0, 1, 0)
     };
     IndexResponse response = tweetRepo.Index(request);
     Assert.IsNotNull(response);
 }
        public void Init()
        {
            tweetRepo = new DocumentRepository<Tweet>(clusterUri, new HttpLayer());
            IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, new Tweet() { Author = "tester", Text = "my test tweet" }, _Id)
            {
                Refresh = true
            };

            tweetRepo.Index(request);
            Thread.Sleep(1000);
        }
Ejemplo n.º 12
0
 public ProjectController(IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     _projectRepository = new ProjectRepository(unitOfWork);
     _categoryRepostitory =new CategoryRepostitory(unitOfWork);
     _tasklogRepository = new TasklogRepository(unitOfWork);
     _documentRepository = new DocumentRepository(unitOfWork);
     _fileStore = new DiskFileStore();
     _feeRepository = new PaidFeeRepository(unitOfWork);
     _userRepository = new UserRepository(unitOfWork);
 }
Ejemplo n.º 13
0
        public ActionResult Admin(string Id)
        {
            var documentRepository = new DocumentRepository();
            var catalogue = documentRepository.Load<Catalogue>(Id);
            var merchant = documentRepository.Load<Merchant>(catalogue.MerchantId);

            var catalogAdmin = new CatalogInfo 
            { 
                Catalogue = catalogue,
                Merchant = merchant,
                ProductsNumber = catalogue.GetProductsNumber()
            };
            return View(catalogAdmin);
        }
Ejemplo n.º 14
0
        public async Task Queryable_MinAsync_With_Select_Should_Return_Min()
        {
            // Arrange
            var repository = new DocumentRepository <Book>(_collection);

            // Act
            var result = await repository
                         .Queryable()
                         .Where(b => b.Category == _books[0].Category)
                         .Select(b => b.Price)
                         .MinAsync();

            // Assert
            Assert.Equal(_books[1].Price, result);
        }
        private int GetCreationsPerUser(User user, DateTime startingDate, DateTime latestDate)
        {
            List <Document> documentsToComputeWith = DocumentRepository.GetAllByUser(user.Email).ToList();
            int             creationCount          = 0;

            foreach (Document document in documentsToComputeWith)
            {
                if (IsBetween(startingDate, latestDate, document))
                {
                    creationCount++;
                }
            }

            return(creationCount);
        }
Ejemplo n.º 16
0
        /// <summary>Process the specified input.</summary>
        /// <param name="command">The input to process.</param>
        public override void ProcessInput(string command)
        {
            if (command != string.Empty)
            {
                var authenticatedUser = Authenticate(command);
                if (authenticatedUser != null)
                {
                    isLoggingIn  = true;
                    Session.User = authenticatedUser;
                    if (!AppConfigInfo.Instance.UserAccountIsPlayerCharacter)
                    {
                        throw new NotImplementedException("Need to build a ChooseCharacterState!");
                    }
                    else
                    {
                        var characterId = Session.User.PlayerCharacterIds[0];
                        Session.Thing = DocumentRepository <Thing> .Load(characterId);

                        // TODO: https://github.com/DavidRieman/WheelMUD/pull/66 - Clean up previous session properly (this won't always work).
                        Session.Thing.Parent?.Children.RemoveAll(t => t.Id == this.Session.Thing.Id);
                        Session.Thing.Behaviors.SetParent(Session.Thing);
                        var playerBehavior = Session.Thing.FindBehavior <PlayerBehavior>();
                        if (playerBehavior != null)
                        {
                            Session.Thing.FindBehavior <UserControlledBehavior>().Session = Session;
                            playerBehavior.LogIn(Session);
                            Session.AuthenticateSession();
                            Session.SetState(new PlayingState(Session));
                        }
                        else
                        {
                            Session.WriteLine("This character player state is broken. You may need to contact an admin for a possible recovery attempt.");
                            Session.InformSubscribedSystem(Session.ID + " failed to load due to missing player behavior.");
                            Session.SetState(new ConnectedState(Session));
                            Session.WritePrompt();
                        }
                    }
                    isLoggingIn = false;
                }
                else
                {
                    Session.WriteLine("Incorrect user name or password.", false);
                    Session.InformSubscribedSystem(Session.ID + " failed to log in");
                    Session.SetState(new ConnectedState(Session));
                    Session.WritePrompt();
                }
            }
        }
Ejemplo n.º 17
0
        public DocumentModel GetModel()
        {
            var id = RouteData.Values["id"] != null ? new Guid(RouteData.Values["id"].ToString()) : Guid.Empty;

            DocumentModel model = null;

            if (id != Guid.Empty)
            {
                var d = DocumentRepository.Get(id);
                if (d != null)
                {
                    CreateWorkflowIfNotExists(id);

                    var h = DocumentRepository.GetHistory(id);
                    model = new DocumentModel()
                    {
                        Id               = d.Id,
                        AuthorId         = d.AuthorId,
                        AuthorName       = d.Author.Name,
                        Comment          = d.Comment,
                        ManagerId        = d.ManagerId,
                        ManagerName      = d.ManagerId.HasValue ? d.Manager.Name : string.Empty,
                        Name             = d.Name,
                        Number           = d.Number,
                        StateName        = d.StateName,
                        Sum              = d.Sum,
                        Commands         = GetCommands(id),
                        AvailiableStates = GetStates(id),
                        HistoryModel     = new DocumentHistoryModel {
                            Items = h
                        }
                    };
                    model.StateNameToSet = model.AvailiableStates.Keys.FirstOrDefault();
                }
            }
            else
            {
                Guid userId = CurrentUserSettings.GetCurrentUser();
                model = new DocumentModel()
                {
                    AuthorId   = userId,
                    AuthorName = EmployeeRepository.GetNameById(userId),
                    StateName  = "Vacation request created"
                };
            }

            return(model);
        }
Ejemplo n.º 18
0
 public UnitOfWork(AladonContext context)
 {
     Context         = context;
     Users           = new UsersRepository(context);
     Roles           = new RolesRepository(context);
     UserRoles       = new UserRolesRepository(context);
     Permissions     = new PermissionsRepository(context);
     Modules         = new ModulesRepository(context);
     LocationTypes   = new LocationTypesRepository(context);
     AssetStructures = new AssetStructureRepository(context);
     AssetPartInfors = new AssetPartInforRepository(context);
     AssetTypes      = new AssetTypeRepository(context);
     Documents       = new DocumentRepository(context);
     Parts           = new PartRepository(context);
     AssetTags       = new AssetTagRepository(context);
 }
Ejemplo n.º 19
0
        public virtual async Task <PagedResultDto <DocumentDto> > GetListAsync(GetDocumentsInput input)
        {
            var count = await DocumentRepository.GetCountAsync();

            var list = await DocumentRepository.GetPagedListAsync(
                (input.Page - 1) *input.Size,
                input.Size,
                "CreationTime desc",
                true
                );

            return(new PagedResultDto <DocumentDto>(
                       count,
                       ObjectMapper.Map <List <Document>, List <DocumentDto> >(list)
                       ));
        }
Ejemplo n.º 20
0
 public UnitOfWork(ELearningDBContext context)
 {
     _context = context;
     Account  = new AccountRepository(_context);
     Comments = new CommentRepository(_context);
     Courses  = new CourseRepository(_context);
     // CourseSubject = new CourseSubjectRepository(_context);
     Documents       = new DocumentRepository(_context);
     Lectures        = new LectureRepository(_context);
     Rating          = new RatingRepository(_context);
     Role            = new RoleRepository(_context);
     StudentSubjects = new StudentSubjectRepository(_context);
     StudentTests    = new StudentTestRepository(_context);
     Subjects        = new SubjectRepository(_context);
     TeacherSubjects = new TeacherSubjectRepository(_context);
 }
Ejemplo n.º 21
0
        // GET: BlogPosts/Details/5
        public async Task <ActionResult> Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BlogPost blogPost = await DocumentRepository <BlogPost> .GetItemAsync(id);

            if (blogPost == null)
            {
                return(HttpNotFound());
            }

            return(View(blogPost));
        }
Ejemplo n.º 22
0
        public UnitOfWork(
            IDataMapper mapper,
            ClinicDb context)
        {
            _mapper  = mapper;
            _context = context;

            UserRepository            = new UserRepository(mapper, context);
            BookingRepository         = new BookingRepository(mapper, context);
            RefreshTokenRepository    = new RefreshTokenRepository(mapper, context);
            ClinicClinicianRepository = new ClinicClinicianRepository(context);
            DocumentRepository        = new DocumentRepository(context);
            ClinicRepository          = new ClinicRepository(mapper, context);
            ClinicianRepository       = new ClinicianRepository(mapper, context);
            PatientRepository         = new PatientRepository(context);
        }
Ejemplo n.º 23
0
        //Удаление файла из БД и с сервера из /Files
        public ActionResult Delete(long id)
        {
            var document = DocumentRepository.Get(id);

            if (document == null)
            {
                return(RedirectToAction("Documents"));
            }

            DocumentRepository.Delete(id);

            System.IO.File.Delete(Server.MapPath($"~/Files/{document.Name}{document.FileType}"));


            return(RedirectToAction("Documents"));
        }
 int IDocumentRepository.SaveDocument(CreateDocumentDto document)
 {
     try
     {
         document.DocumentId = 0;
         var documentEntity = DocumentRepository.MapToDbEntity(document, _dbContext);
         _dbContext.Add(documentEntity);
         var result = _dbContext.SaveChanges();
         AddToHistory(documentEntity);
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 25
0
 public ApplicantsController(
     BiodataRepository biodataRepository,
     EducationalDetailsRepository educationalDetailsRepository,
     DocumentRepository documentRepository,
     WorkExperienceRepository workExperienceRepository,
     ApplicantRepository applicantRepository,
     IConfiguration configuration
     )
 {
     this._biodataRepository            = biodataRepository;
     this._educationalDetailsRepository = educationalDetailsRepository;
     this._documentRepository           = documentRepository;
     this._workExperienceRepository     = workExperienceRepository;
     this._applicantRepository          = applicantRepository;
     this._configuration = configuration;
 }
Ejemplo n.º 26
0
        public ActionResult ViewDocuments()
        {
            var model =
                DocumentRepository.GetDocuments()
                .Select(
                    x =>
                    new DocumentViewModel
            {
                Name         = x.Name,
                DisplayName  = x.Name.Length > ConfigHelper.DocumentDisplayNameSize ? x.Name.Substring(0, ConfigHelper.DocumentDisplayNameSize) + "..." : x.Name,
                Author       = x.Author.UserName,
                CreationDate = x.CreationDate
            }).ToList();

            return(this.View("ViewDocuments", model));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Sets background color of annotation
        /// </summary>
        public static void SetBackgroundColorResult()
        {
            try
            {
                //ExStart:SetBackgroundColorResult
                // Create path finder
                IRepositoryPathFinder pathFinder = new RepositoryPathFinder();
                var documentRepository           = new DocumentRepository(pathFinder);

                // Create instance of annotator
                IAnnotator annotator = new Annotator(
                    new UserRepository(pathFinder),
                    new DocumentRepository(pathFinder),
                    new AnnotationRepository(pathFinder),
                    new AnnotationReplyRepository(pathFinder),
                    new AnnotationCollaboratorRepository(pathFinder));

                // Create document data object in storage.
                var  document   = documentRepository.GetDocument("Document.pdf");
                long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf");

                // Create annotation object
                AnnotationInfo textFieldAnnotation = new AnnotationInfo
                {
                    AnnotationPosition = new Point(852.0, 201.0),
                    FieldText          = "text in the box",
                    FontFamily         = "Arial",
                    FontSize           = 10,
                    Box          = new Rectangle(66f, 201f, 64f, 37f),
                    PageNumber   = 0,
                    Type         = AnnotationType.TextField,
                    CreatorName  = "Anonym",
                    DocumentGuid = documentId
                };

                //Add annotation to storage
                CreateAnnotationResult createTextFieldAnnotationResult = annotator.CreateAnnotation(textFieldAnnotation);

                // Set background color of annotation
                SaveAnnotationTextResult setBackgroundColorResult = annotator.SetAnnotationBackgroundColor(createTextFieldAnnotationResult.Id, 16711680);
                //ExEnd:SetBackgroundColorResult
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Moves annotation marker
        /// </summary>
        public static void MoveAnnotationResult()
        {
            try
            {
                //ExStart:MoveAnnotationResult
                // Create path finder
                IRepositoryPathFinder pathFinder = new RepositoryPathFinder();
                var documentRepository           = new DocumentRepository(pathFinder);

                // Create instance of annotator
                IAnnotator annotator = new Annotator(
                    new UserRepository(pathFinder),
                    new DocumentRepository(pathFinder),
                    new AnnotationRepository(pathFinder),
                    new AnnotationReplyRepository(pathFinder),
                    new AnnotationCollaboratorRepository(pathFinder));

                // Create document data object in storage.
                var  document   = documentRepository.GetDocument("Document.pdf");
                long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf");

                // Create annotation object
                AnnotationInfo areaAnnotation = new AnnotationInfo
                {
                    AnnotationPosition = new Point(852.0, 271.7),
                    BackgroundColor    = 3355443,
                    Box          = new Rectangle(466f, 271f, 69f, 62f),
                    PageNumber   = 0,
                    PenColor     = 3355443,
                    Type         = AnnotationType.Area,
                    CreatorName  = "Anonym",
                    DocumentGuid = documentId
                };

                //Add annotation to storage
                CreateAnnotationResult createAreaAnnotationResult = annotator.CreateAnnotation(areaAnnotation);

                //Move annotation marker
                MoveAnnotationResult moveAnnotationResult = annotator.MoveAnnotationMarker(createAreaAnnotationResult.Id,
                                                                                           new Point(200, 200), /*NewPageNumber*/ 1);
                //ExEnd:MoveAnnotationResult
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Ejemplo n.º 29
0
 DocumentDetails IDocumentRepository.SaveDocument(CreateDocumentDto document)
 {
     try
     {
         document.DocumentId = 0;
         var documentEntity = DocumentRepository.MapToDbEntity(document, _dbContext);
         _dbContext.Add(documentEntity);
         _dbContext.SaveChanges();
         AddToHistory(documentEntity);
         return(DocumentRepository.MapToDbEntity(documentEntity));
     }
     catch (Exception ex)
     {
         Logger.Logger.LogError(ex.Message);
         throw new NSIException(ex.Message, DC.Exceptions.Enums.Level.Error, DC.Exceptions.Enums.ErrorType.InvalidParameter);
     }
 }
        private DocumentRepository CreateDocumentRepository(IScopeProvider provider)
        {
            var accessor               = (IScopeAccessor)provider;
            var tRepository            = new TemplateRepository(accessor, AppCaches.Disabled, Logger, TestObjects.GetFileSystemsMock());
            var tagRepo                = new TagRepository(accessor, AppCaches.Disabled, Logger);
            var commonRepository       = new ContentTypeCommonRepository(accessor, tRepository, AppCaches);
            var languageRepository     = new LanguageRepository(accessor, AppCaches.Disabled, Logger);
            var ctRepository           = new ContentTypeRepository(accessor, AppCaches.Disabled, Logger, commonRepository, languageRepository);
            var relationTypeRepository = new RelationTypeRepository(accessor, AppCaches.Disabled, Logger);
            var entityRepository       = new EntityRepository(accessor);
            var relationRepository     = new RelationRepository(accessor, Logger, relationTypeRepository, entityRepository);
            var propertyEditors        = new Lazy <PropertyEditorCollection>(() => new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <IDataEditor>())));
            var dataValueReferences    = new DataValueReferenceFactoryCollection(Enumerable.Empty <IDataValueReferenceFactory>());
            var repository             = new DocumentRepository(accessor, AppCaches.Disabled, Logger, ctRepository, tRepository, tagRepo, languageRepository, relationRepository, relationTypeRepository, propertyEditors, dataValueReferences);

            return(repository);
        }
Ejemplo n.º 31
0
        public void RunDefferedActions()
        {
            if (this.isDeffered == true)
            {
                if (this.ChangesetBuffer.Tables.Count() > 0)
                {
                    DocumentRepository execRepo = new DocumentRepository(unitOfWork, this.eagerExecution);
                    //using (this.unitOfWork.ConnectionManager.SynchronizeConnection())
                    //{

                    //}
                    execRepo.ExecuteOperations(this.ChangesetBuffer);
                }

                this.CommandBuffer.ForEach(cmd => cmd.Invoke());
            }
        }
Ejemplo n.º 32
0
        public void CreateProduct(NewProductViewModel product, int CurrentUserID)
        {
            GenericRepository <Product> ProductRepository;
            GenericRepository <DAL.AppData.ProductType> ProductTypeRepository;
            GenericRepository <Document>     DocumentRepository;
            GenericRepository <DocumentType> DocumentTypeRepository;
            GenericRepository <User>         UserRepository;

            try
            {
                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    DocumentRepository     = unitOfWork.GetRepoInstance <Document>();
                    ProductRepository      = unitOfWork.GetRepoInstance <Product>();
                    ProductTypeRepository  = unitOfWork.GetRepoInstance <DAL.AppData.ProductType>();
                    DocumentTypeRepository = unitOfWork.GetRepoInstance <DocumentType>();
                    UserRepository         = unitOfWork.GetRepoInstance <User>();
                    Product prdct = new Product();

                    prdct.ProductName = product.ProductName;
                    prdct.Code        = "";//need to generate
                    prdct.Description = product.Description;
                    prdct.Price       = Convert.ToDecimal(product.Price);
                    //owner
                    //prdct.Owner = UserRepository.GetByID(CurrentUserID);
                    //803 taking input from User not hard corded one
                    prdct.ProductType = ProductTypeRepository.GetByID((long)EProductType.Inventatory);
                    prdct.Quanity     = Convert.ToInt32(product.Quantity);
                    ProductRepository.Insert(prdct);
                    foreach (DocumentViewModel Dviewmodel in product.Documents)
                    {
                        Document dcment = new Document();
                        dcment.ServerPath    = Dviewmodel.DocumentPath;
                        dcment.FileExtension = Dviewmodel.MIMEType;
                        dcment.DocumentType  = DocumentTypeRepository.GetByID((long)EDocumentType.ProfilePhoto);
                        dcment.Products.Add(prdct);
                        DocumentRepository.Insert(dcment);
                    }
                    unitOfWork.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog(ex);
            }
        }
        public async Task updateStagesBackupMetadata()
        {
            /*     public void updateStagesBackupMetadata() {
             * String docId = TestUtils.docId(collection, 0);
             * JsonObject initial = JsonObject.create().put(Strings.CONTENT_NAME, INITIAL_CONTENT_VALUE);
             * JsonObject after = JsonObject.create().put(Strings.CONTENT_NAME, UPDATED_CONTENT_VALUE);
             * collection.insert(docId, initial);
             *
             * TransactionBuilder.create(shared)
             * .failHard(HookPoint.BEFORE_ATR_COMMIT)
             * .replace(docId,after)
             * .sendToPerformer();
             *
             * DocValidator.assertReplacedDocIsStagedAndContentEquals(collection,docId,initial);
             * }
             */
            (var defaultCollection, var docId, var sampleDoc) = await TestUtil.PrepSampleDoc(_fixture, _outputHelper);

            var durability = await TestUtil.InsertAndVerifyDurability(defaultCollection, docId, sampleDoc);

            await using var txn = TestUtil.CreateTransaction(_fixture.Cluster, durability, _outputHelper);
            txn.TestHooks       = new DelegateTestHooks()
            {
                BeforeAtrCommitImpl = (ctx) => throw ErrorClass.FailHard.Throwable()
            };

            var runTask = txn.RunAsync(async ctx =>
            {
                var getResult = await ctx.GetAsync(defaultCollection, docId);
                Assert.NotNull(getResult);
                var jobj         = getResult.ContentAs <JObject>();
                jobj["newfield"] = "newval";
                await ctx.ReplaceAsync(getResult !, jobj);
            });

            var err = await Assert.ThrowsAsync <TransactionFailedException>(async() =>
            {
                await runTask;
            });

            var docLookup = await DocumentRepository.LookupDocumentAsync(defaultCollection, docId, null, true);

            Assert.NotNull(docLookup?.TransactionXattrs?.RestoreMetadata);
            Assert.Equal("replace", docLookup?.TransactionXattrs?.Operation?.Type);
            Assert.NotNull(docLookup?.TransactionXattrs?.Operation?.StagedDocument);
        }
        public void AddComment(string userEmail, string documentId, Comment comment)
        {
            Guid docId = Guid.Parse(documentId);

            ValidateUser(userEmail);
            ValidateDocument(docId);
            ValidateRating(comment.Rating);

            User     user     = UserRepository.GetByEmail(userEmail);
            Document document = DocumentRepository.GetById(docId);

            comment.Id        = Guid.NewGuid();
            comment.Commenter = user;
            comment.Document  = document;

            CommentRepository.AddComment(comment);
        }
Ejemplo n.º 35
0
        private void InitViewModel(StockUnit stockUnit)
        {
            _itemsToDelete         = new List <Unit>();
            _addedFiles            = new List <string>();
            _deletedFiles          = new List <string>();
            _deletedStockUnitFiles = new List <StockUnitFile>();

            StockUnit = stockUnit;
            if (StockUnit.IsNew && StockUnit.UnitList == null)
            {
                StockUnit.UnitList = new List <Unit>();
            }

            InitLists();
            UnitList = new ObservableCollection <Unit>(StockUnit.UnitList);
            UnitList.CollectionChanged += UnitList_CollectionChanged;

            var documentRepository = new DocumentRepository();

            DocumnetsList = new ObservableCollection <Document>(documentRepository.GetByStockUnit(StockUnit));
            var repairRepository = new RepairRepository();

            RepairList = new ObservableCollection <Repair>(repairRepository.GetAllByStockUnit(StockUnit));
            var filesRepository = new StockUnitFileRepository();

            StockUnitFiles = new ObservableCollection <StockUnitFile>(filesRepository.GetByStockUnitId(StockUnit));

            StockUnitNoteList = !StockUnit.IsNew ?
                                new ObservableCollection <StockUnitNote>(_stockUnitNoteRepository.GetByStockUnitId(StockUnit))
                : new ObservableCollection <StockUnitNote>();

            var repository = new UnitRepository();

            ManufactureList = repository.GetManufactureList();
            ModelList       = repository.GetModelList();

            AddUnitCommand    = new RelayCommand(x => UnitList.Add(new Unit()));
            RemoveUnitCommand = new RelayCommand(x => RemoveMethod());
            ReportsCommand    = new RelayCommand(x => ReportsMethod());
            SaveCommand       = new RelayCommand(x => SaveMethod());
            CloseCommand      = new RelayCommand(x => CloseMethod());
            AddFileCommand    = new RelayCommand(x => AddFileMethod());
            RemoveFileCommand = new RelayCommand(x => RemoveFileMethod());
            OpenFileCommand   = new RelayCommand(x => OpenFileMethod());
            OpenFolderCommand = new RelayCommand(x => OpenFolderMethod());
        }
Ejemplo n.º 36
0
        private AssignmentInfoModel GetAssignmentInfoModel(Assignment assignment, bool forCreate)
        {
            var document  = DocumentRepository.Get(assignment.ProcessId);
            var employees = EmployeeRepository.GetAll();

            var am = new AssignmentInfoModel
            {
                AssignmentId       = assignment.AssignmentId,
                Name               = assignment.Name,
                StatusState        = assignment.StatusState,
                ProcessId          = assignment.ProcessId,
                DateCreation       = assignment.DateCreation,
                DateStart          = assignment.DateStart,
                DateFinish         = assignment.DateFinish,
                DeadlineToComplete = assignment.DeadlineToComplete?.ToString("yyyy-MM-ddTHH:mm"),
                DeadlineToStart    = assignment.DeadlineToStart?.ToString("yyyy-MM-ddTHH:mm"),
                Tags               = assignment.Tags ?? new List <string>(),
                IsDeleted          = assignment.IsDeleted,
                Description        = assignment.Description,
                AssignmentCode     = assignment.AssignmentCode,
                DocumentNumber     = document?.Number,
            };

            if (forCreate)
            {
                am.Observers    = new Dictionary <Guid, string>();
                am.ExecutorName = null;
                am.Executor     = null;
                am.IsActive     = true;
                am.FormAction   = "Create";
            }
            else
            {
                var ids       = assignment.Observers?.Select(Guid.Parse).Distinct().ToList();
                var observers = employees.Where(e => ids.Contains(e.Id)).Distinct()
                                .ToDictionary(e => e.Id, e => e.Name);

                am.Observers    = observers;
                am.Executor     = Guid.Parse(assignment.Executor);
                am.ExecutorName = employees.FirstOrDefault(e => e.Id == Guid.Parse(assignment.Executor))?.Name;
                am.IsActive     = assignment.IsActive;
                am.FormAction   = "Update";
            }

            return(am);
        }
Ejemplo n.º 37
0
        static async Task MainAsync()
        {
            var configuration = CreateConfiguration();
            var repository = new DocumentRepository(configuration);
            
            await CreateDatabase(configuration);

            await CreatePeople(repository);

            FindPersonCalledTom(repository);
            FindPeopleWithSurnameBar(repository);
            DeletePersonCalledJess(repository);
            FindPeopleWithSurnameBar(repository);

            System.Console.WriteLine("All done!");
            System.Console.ReadKey();
        }
Ejemplo n.º 38
0
        /// <summary>Process the specified input.</summary>
        /// <param name="command">The input to process.</param>
        public override void ProcessInput(string command)
        {
            Session.AtPrompt = false;
            if (command != string.Empty)
            {
                var authenticatedUser = Authenticate(command);
                if (authenticatedUser != null)
                {
                    Session.User = authenticatedUser;
                    if (!AppConfigInfo.Instance.UserAccountIsPlayerCharacter)
                    {
                        throw new NotImplementedException("Need to build a ChooseCharacterState!");
                    }
                    else
                    {
                        var characterId = Session.User.PlayerCharacterIds[0];
                        Session.Thing = DocumentRepository <Thing> .Load(characterId);

                        Session.Thing.Behaviors.SetParent(Session.Thing);
                        var playerBehavior = Session.Thing.FindBehavior <PlayerBehavior>();
                        if (playerBehavior != null)
                        {
                            Session.Thing.Behaviors.FindFirst <UserControlledBehavior>().Controller = Session;
                            playerBehavior.LogIn(Session);
                            Session.AuthenticateSession();
                            Session.State = new PlayingState(Session);
                        }
                        else
                        {
                            Session.Write("This character player state is broken. You may need to contact an admin for a possible recovery attempt.");
                            Session.InformSubscribedSystem(Session.ID + " failed to load due to missing player behavior.");
                            Session.State = new ConnectedState(Session);
                            Session.WritePrompt();
                        }
                    }
                }
                else
                {
                    Session.Write("Incorrect user name or password.\r\n\r\n", false);
                    Session.InformSubscribedSystem(Session.ID + " failed to log in");
                    Session.State = new ConnectedState(Session);
                    Session.WritePrompt();
                }
            }
        }
Ejemplo n.º 39
0
        public ActionResult DocumentList(string sortOrder, string searchString)
        {
            var model = DocumentRepository.Find(null);

            ViewBag.NameSortParm   = sortOrder == "name" ? "name_desc" : "name";
            ViewBag.DateSortParm   = sortOrder == "date" ? "date_desc" : "date";
            ViewBag.AuthorSortParm = sortOrder == "author" ? "author_desc" : "author";

            if (!String.IsNullOrEmpty(searchString))
            {
                model = model.Where(s => s.Name.ToLower().Contains(searchString.ToLower()));
            }

            switch (sortOrder)
            {
            case "name":
                model = model.OrderByDescending(s => s.Name);
                break;

            case "name_desc":
                model = model.OrderByDescending(s => s.Name);
                break;

            case "date":
                model = model.OrderBy(s => s.CreationDate);
                break;

            case "date_desc":
                model = model.OrderByDescending(s => s.CreationDate);
                break;

            case "author":
                model = model.OrderBy(s => s.CreationAuthor.Name);
                break;

            case "author_desc":
                model = model.OrderByDescending(s => s.CreationAuthor.Name);
                break;

            default:
                model = model.OrderBy(s => s.Name);
                break;
            }
            return(View(model));
        }
Ejemplo n.º 40
0
        void ctrl_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            try
            {

                //validate file
                e.IsValid = true;

                Document document = ObjectCopier.Clone<Document>(Me.Document);
                
                document.FileName = e.File.FileName;
                document.ContentType = e.File.ContentType;
                document.Size = Convert.ToInt32(e.File.ContentLength);
                document.Stream = e.File.InputStream;
                document.EntityID = ((BasePage)this.Page).GetEntityIDValue(this.Screen, document.EntityID, Me.EntityInputType);
                

                
                
                DocumentService documentService = DocumentService.GetInstance();
                DocumentRepository repo = DocumentRepository.GetByName(Me.DocumentRepository);

                IDocumentProvider documentProvider = documentService.GetProvider(repo);
                document.ID = documentProvider.Upload(document);




                AppendDocumentID(document.ID);

            }
            catch (Exception ex)
            {
                string ErrorMessageFormat = "ERROR - {0} - Control {1} ({2} - {3})";
                string ErrorMessages = String.Format(ErrorMessageFormat, ex.Message, this.ControlID,  Me.Type, this.ID);

                System.Web.UI.WebControls.Label errorLabel = new System.Web.UI.WebControls.Label();
                errorLabel.Text = ErrorMessages;
                errorLabel.ForeColor = Color.Red;
                this.Controls.Add(errorLabel);

                ((BasePage)this.Page).DisplayErrorAlert(ex);

            }
        }
        public void FAIL_IndexDocument_TimeOut_1ms()
        {
            tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
            IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document)
            {
                OperationTimeOut = new TimeSpan(0, 0, 0, 0, 1)
            };

            try
            {
                IndexResponse response = tweetRepo.Index(request);
            }
            catch (Exception ex)
            {
                //TODO: learn more about this response.
                Assert.Fail();
            }
        }
Ejemplo n.º 42
0
 public Footer GetByDocument(Guid documentId)
 {
     if (DocumentRepository.Exists(documentId))
     {
         if (FooterRepository.ExistsForDocument(documentId))
         {
             return(FooterRepository.GetByDocument(documentId));
         }
         else
         {
             throw new MissingFooterException("This footer is not in the database");
         }
     }
     else
     {
         throw new MissingDocumentException("This document is not on the database.");
     }
 }
Ejemplo n.º 43
0
        public async Task DocumentRepositoryTestsCreateDocumentMatchesTheInput()
        {
            var signature = new Signature {
                Id = Guid.NewGuid(), IsSigned = false
            };
            var inputDocument = new Document {
                DocumentType = "Test", Signatures = new List <Signature> {
                    signature
                }, OwnerId = "10112"
            };
            var      documentRepository = new DocumentRepository();
            Document?createdDocument    = await documentRepository.CreateDocument(inputDocument);

            Assert.IsNotNull(createdDocument.Id);
            Assert.AreEqual(inputDocument.DocumentType, createdDocument.DocumentType);
            Assert.AreEqual(inputDocument.Signatures, createdDocument.Signatures);
            Assert.AreEqual(inputDocument.OwnerId, createdDocument.OwnerId);
        }
Ejemplo n.º 44
0
        public ActionResult AddDocument(Document model, HttpPostedFileBase file)
        {
            model.CreationAuthor = UserRepository.LoadByLogin(User.Identity.Name);
            model.CreationDate   = DateTime.Now;
            model.BinaryFile     = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);

            var path = ConfigurationManager.AppSettings["FilePath"];

            if (file != null && file.ContentLength > 0)
            {
                string fname = Path.GetFileName(file.FileName);
                file.SaveAs(Server.MapPath(Path.Combine(path, model.BinaryFile)));
            }

            DocumentRepository.Save(model);

            return(RedirectToAction("DocumentList"));
        }
        public void PASS_GetDocument_ClusterNotFound()
        {
            tweetRepo = new DocumentRepository<Tweet>(new ElasticUriProvider("http://notelastic:9200/"), new HttpLayer());
            GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id);
            try
            {
                GetResponse<Tweet> response = tweetRepo.Get(request);
                Assert.Fail();
            }
            catch (ElasticRequestException ex)
            {
                Assert.AreEqual(500, (int)ex.Response.StatusCode);
            }
            catch (Exception)
            {
                Assert.Fail();
            }

            tweetRepo = new DocumentRepository<Tweet>(clusterUri, new HttpLayer());
        }
Ejemplo n.º 46
0
		public ChunkingUnitOfWork(ITransactionalCollection transactionalCollection)
			: base(transactionalCollection)
		{
			DocumentRepository = new DocumentRepository(Repository<Document>());
			DocumentRequestRepository = new DocumentRequestRepository(Repository<DocumentRequest>());
		}
 public void Init()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     tweetRepo.DeleteByQuery(new DeleteByQuery.DeleteByQueryDocumentRequest(_Index, "{\"query\":{\"match_all\":{}}}"));
 }
 public void PASS_IndexDocument_Consistency_Quorum()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document, _Id)
     {
         WriteConsistency = WriteConsistencyEnum.QuorumOfShards
     };
     IndexResponse response = tweetRepo.Index(request);
     Assert.IsNotNull(response);
     Assert.AreEqual(_Id, response.DocumentId);
 }
        public ActionResult Index()
        {
            if (Session["PatientId"] == null || Session["PatientId"].ToString() == "")
            {
                return RedirectToAction("Login", "Account");
            }

            var documentRepository = new DocumentRepository();
            var documentModel = new List<PatientDocumentsModel>();
            documentModel = documentRepository.GetDocuments(int.Parse(Session["PatientId"].ToString()));

            var ccrXslPath = Server.MapPath("~/ccr.xsl");
            var ccdXslPath = Server.MapPath("~/ccd.xsl");
            foreach (var doc in documentModel)
            {
                if(doc.DocumentText.Contains("ContinuityOfCareRecord"))
                    doc.DocumentText = HtmlHelperExtensions.RenderXslt(ccrXslPath, doc.DocumentText).ToHtmlString();
                else if(doc.DocumentText.Contains("ClinicalDocument"))
                    doc.DocumentText = HtmlHelperExtensions.RenderXslt(ccdXslPath, doc.DocumentText).ToHtmlString();
            }

            ViewBag.TitleMessage = "Welcome to HealthReunion Patient Portal";
            return View(documentModel);
        }
 public void PASS_IndexDocument_Parent_Fail()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document, _Id)
     {
         ParentId = "2525"
     };
     try
     {
         IndexResponse response = tweetRepo.Index(request);
         Assert.Fail();
     }
     catch (ElasticRequestException ex)
     {
         Assert.AreEqual(HttpStatusCode.BadRequest, ex.Response.StatusCode);
     }   
 }
Ejemplo n.º 51
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new DocumentRepository(ctx);
 }
Ejemplo n.º 52
0
 public DocumentsController()
 {
     _documentRepository = new DocumentRepository(SessionUser);
     _documentRepository.OnChange += SyncManager.OnChange;
 }
Ejemplo n.º 53
0
        public DTO.ImportResult DraftImport(Stream originalFile, Catalogue catalogue)
        {
            var documentRepository = new DocumentRepository();
            var merchant = documentRepository.Load<Merchant>(catalogue.MerchantId);
            var XmlDoc = XDocument.Load(new StreamReader(originalFile));
            var importResult = new DTO.ImportResult();
            XNamespace g = "http://base.google.com/ns/1.0";
            foreach (var item in XmlDoc.Element("rss").Element("channel").Elements("item"))
            {
                try
                {
                    var productItem = new ProductItem()
                    {
                        Age = TranslateAge(item.Element(g + "age_group").Value),
                        Availability = item.Element(g + "availability").Value,
                        Brand = item.Element(g + "brand").Value,
                        CatalogueId = catalogue.Id,
                        Color = item.Element(g + "color").Value,
                        Condition = item.Element(g + "condition").Value,
                        Created = DateTime.Now,
                        Description = item.Element("description").Value,                        
                        Gender = TranslateGender(item.Element(g + "gender").Value),
                        GoogleProductCategory = item.Element(g + "google_product_category").Value,
                        GoogleTaxonomy = GoogleTaxonomy.GetTaxonomy(int.Parse(item.Element(g + "google_product_category").Value), catalogue.CountryCode),
                        AdditionalImageLinks = item.Elements(g + "additional_image_link").Select(el => el.Value).ToList(),
                        Id = string.Format("{0}__{1}", catalogue.Id, item.Element(g + "id").Value),
                        MainImageLink = item.Element(g + "image_link").Value,
                        Material = item.Element(g + "material").Value,
                        Merchant = merchant,
                        Pricing = new PricingInfo
                        {
                            Price = ExtractPriceValue(item.Element(g + "price").Value),
                            SalePrice = ExtractPriceValue(item.Element(g + "sale_price").Value)
                        },
                        ProductGroup = item.Element(g + "item_group_id").Value,
                        ProductLink = item.Element("link").Value,
                        MobileProductLink = item.Element("mobile_link").Value,
                        Shipping = new ShippingInfo()
                        {
                            Price = item.Element(g + "shipping").Element(g + "price").Value,
                            Service = item.Element(g + "shipping").Element(g + "service").Value
                        },
                        SizeInfo = new SizeInfo
                        {
                            Size = item.Element(g + "size").Value,
                            SizeSystem = item.Element(g + "size_system").Value,
                            SizeType = item.Element(g + "size_type").Value
                        },
                        SKU = item.Element(g + "mpn").Value,
                        Title = item.Element("title").Value,
                        Updated = DateTime.Now
                    };

                    var stagingDocumentRepository = new StagingDocumentRepository();
                    stagingDocumentRepository.Save(productItem);
                    importResult.Success++;
                }
                catch (Exception ex)
                {
                    importResult.Failure++;
                    importResult.FailureDetails.Add(ex.Message);
                }
            }
            //TODO: salvare l'importResult anche sul documento del catalogo in staging
            return importResult;
        }       
 public void PASS_IndexDocument_TimeToLive()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document, _Id)
     {
         TimeToLive = new Time.TimeValue(new TimeSpan(0, 10, 0))
     };
     IndexResponse response = tweetRepo.Index(request);
     Assert.IsNotNull(response);
     Assert.AreEqual(_Id, response.DocumentId);
 }
 public void PASS_IndexDocument_CreateOnly()
 {
     tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
     IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document)
     {
         UseCreateOperationType = true
     };
     IndexResponse response = tweetRepo.Index(request);
     Assert.IsNotNull(response);
 }
        public void FAIL_IndexDocument_Consistency_All_Timeout()
        {
            tweetRepo = new DocumentRepository<Tweet>(_ClusterUri, new HttpLayer());
            IndexDocumentRequest<Tweet> request = new IndexDocumentRequest<Tweet>(_Index, _DocumentType, _Document, _Id)
            {
                WriteConsistency = WriteConsistencyEnum.AllShards,
                OperationTimeOut = new TimeSpan(0, 0, 5)
            };

            try
            {
                IndexResponse response = tweetRepo.Index(request);
                Assert.Fail();
            }
            catch (ElasticRequestException ex)
            {
                Assert.AreEqual(HttpStatusCode.ServiceUnavailable, ex.Response.StatusCode);
            }
        }
Ejemplo n.º 57
0
        public static int? createDocumentFromTemplate(int? templateId, int? userId)
        {
            try
            {
                if (templateId==null || userId == null)
                {
                    throw new InvalidTemplateException("Identifiers cannot be null");
                }

                DocumentTemplateRepository tRepo = new DocumentTemplateRepository();
                DocumentRepository dRepo = new DocumentRepository();

                DocumentTemplate dt = tRepo.GetById(templateId);

                if (dt == null)
                {
                    throw new InvalidTemplateException("A template with the chosen identifier does not exist");
                }

                //check company id
                User u = new UserRepository().GetById(userId);

                if (u==null)
                {
                    throw new InvalidCompanyException("A user with the chosen identifier does not exist");
                }
                if (u.affiliations.Where(x => x.isPrimary).Count() != 1)
                {
                    throw new InvalidCompanyException("The user does not have a set primary company");
                }

                Document newDoc = cloneDocumentFromTemplate(dt);

                newDoc.ownerCompany = u.affiliations.Where(x => x.isPrimary).FirstOrDefault().company;
                newDoc.ownerUser = u;
                newDoc.creation = DateTime.Now;
                dRepo.Update(newDoc);

                return newDoc.id;
            }
            catch (Exception e)
            {
                throw new InvalidTemplateException("A document could not be created", e);
            }
        }
        public ActionResult GetPatientDocuments(int patientId)
        {
            DocumentRepository documentRepository = new DocumentRepository();
            int providerId = int.Parse(Session["ProviderId"].ToString());

            var patientDocuments = documentRepository.GetDocuments(patientId, providerId);

            var ccrXslPath = Server.MapPath("~/ccr.xsl");
            var ccdXslPath = Server.MapPath("~/ccd.xsl");
            foreach (var doc in patientDocuments)
            {
                if (doc.DocumentText.Contains("ContinuityOfCareRecord"))
                    doc.DocumentText = HtmlHelperExtensions.RenderXslt(ccrXslPath, doc.DocumentText).ToHtmlString();
                else if (doc.DocumentText.Contains("ClinicalDocument"))
                    doc.DocumentText = HtmlHelperExtensions.RenderXslt(ccdXslPath, doc.DocumentText).ToHtmlString();
            }

            return PartialView("PatientDocumentsGrid", patientDocuments);
        }
Ejemplo n.º 59
0
        public Section GetNew(int documentId)
        {
            Document document = new DocumentRepository().GetById(documentId);
            if (document == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            Section newSection = new Section();

            newSection.document = document;

            if (document.sections!=null && document.sections.Count>0)
            {
                newSection.documentIndex = document.sections.Max(o => o.documentIndex) + 1;
            }
            else
            {
                newSection.documentIndex = 1;
            }

            repo.Create(newSection);

            return newSection;
        }
Ejemplo n.º 60
0
 public DocumentVerification(DocumentRepository documentRepository, string documentName)
 {
     _documentRepository = documentRepository;
     _documentName = documentName;
 }