Esempio n. 1
0
        public CollectPackage CreateCollectPackageFromDTO(IDocumentSession session, Package collectPackageDTO)
        {
            CollectPackage collectPackage = new CollectPackage();
            collectPackage.Date = collectPackageDTO.Date;
            collectPackage.ScheduleInformation = new CollectScheduleInformation() { ExecutionDate = collectPackageDTO.ScheduleInformation.ScheduleDate };

            session.Store(collectPackage);
            session.SaveChanges();                
            
            return collectPackage;
        }
 private CollectPackage CreateFakeCollectPackage(IDocumentSession session)
 {
     var newCollectPackage = new CollectPackage()
     {
         Date = DateTime.UtcNow,
         ScheduleInformation = new CollectScheduleInformation() { ExecutionDate = DateTime.UtcNow.AddMinutes(2) }
     };
     session.Store(newCollectPackage);
     return newCollectPackage;
 }
Esempio n. 3
0
        private Dictionary<string, string> SaveListOfCollectRequest(IDocumentSession session, CollectPackage collectPackage, Request[] collectRequests, DefinitionInfo[] definitions, string clientId)
        {
            var identifiers = new Dictionary<string, string>();
            foreach (var req in collectRequests)
            {
                var definitionDocument = Repository.GetDefinitionByOriginalId(session, req.DefinitionId);
                if (definitionDocument == null)
                {
                    definitionDocument = DefinitionFactory.CreateDefinitionDocumentFromInfo(session, definitions.First(x => x.Id == req.DefinitionId));
                }
                CollectRequest request = this.CollectAssembler.CreateCollectRequestFromDTO(req, definitionDocument.Oid);
                request.ClientId = clientId;
                session.Store(request);
                request.CollectPackageId = collectPackage.Oid;
                session.SaveChanges();

                identifiers.Add(req.RequestId, request.Oid.ToString());
            }

            return identifiers;
        }
Esempio n. 4
0
 private static Tuple<CollectPackage, CollectRequest> GEtCollectRequest(IDocumentSession session)
 {
     CollectRequest collectRequest = new CollectRequest();
     collectRequest.ReceivedOn = DateTime.Now;
     CollectPackage collectPackage = new CollectPackage();
     collectPackage.ScheduleInformation = new CollectScheduleInformation() { ExecutionDate = DateTime.Now };
     session.Store(collectPackage);
     collectRequest.CollectPackageId = collectPackage.Oid;
     return new Tuple<CollectPackage,CollectRequest>(collectPackage, collectRequest);
 }