Exemplo n.º 1
0
        public WorkflowContext(WorkflowContextData data, IDataContext dataContext)
        {
            if (data == null)
            {
                throw new ArgumentNullException(@"data");
            }
            if (dataContext == null)
            {
                throw new ArgumentNullException(@"dataContext");
            }

            _dataContext = dataContext;
            Data         = data;
            var factory = AppServiceProviderFactoryProvider.GetFactory();

            Provider = factory.Create();

            /*_docRepo = new DocRepository(DataContext, UserId);
             * _userRepo = new UserRepository(DataContext);
             * _defRepo = new DocDefRepository(DataContext, UserId);
             * _orgRepo = new OrgRepository(DataContext/*, Data.UserId#1#);
             * _enumRepo = new EnumRepository(DataContext);*/

            _docRepo  = Provider.Get <IDocRepository>();
            _userRepo = Provider.Get <IUserRepository>();
            _defRepo  = Provider.Get <IDocDefRepository>();
            _orgRepo  = Provider.Get <IOrgRepository>();
            _enumRepo = Provider.Get <IEnumRepository>();

            _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>();
            _sqlQueryReaderFactory  = Provider.Get <ISqlQueryReaderFactory>();
        }
Exemplo n.º 2
0
 public UnitRepository(IUnitOfWork unitOfWork, IDocRepository docRepository, IDomainValidator validator)
 {
     this.unitOfWork = unitOfWork;
     this.docRepository = docRepository;
     this.validator = validator;
     unitsInContext = unitOfWork.DbContext.Set<Unit>();
 }
Exemplo n.º 3
0
        public WorkflowContext(WorkflowContextData data, IAppServiceProvider provider)
        {
            if (data == null)
            {
                throw new ArgumentNullException(@"data");
            }
            if (provider == null)
            {
                throw new ArgumentNullException(@"provider");
            }

            Provider = provider;

            _dataContext = Provider.Find <IMultiDataContext>() ?? Provider.Get <IDataContext>();
            Data         = data;

            _docRepo  = Provider.Get <IDocRepository>();
            _userRepo = Provider.Get <IUserRepository>();
            _defRepo  = Provider.Get <IDocDefRepository>();
            _orgRepo  = Provider.Get <IOrgRepository>();
            _enumRepo = Provider.Get <IEnumRepository>();

            _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>();
            _sqlQueryReaderFactory  = Provider.Get <ISqlQueryReaderFactory>();
        }
Exemplo n.º 4
0
        public DynaDoc(Guid docId, Guid userId, IDataContext dataContext)
        {
            var factory = AppServiceProviderFactoryProvider.GetFactory();

            Provider     = factory.Create();
            _ownProvider = true;

            if (dataContext == null)
            {
                DataContext = Provider.Get <IDataContext>(); //new DataContext();
                // _ownDataContext = true;
            }
            else
            {
                DataContext = dataContext;
            }

            UserId = userId;

            _docRepo      = Provider.Get <IDocRepository>();
            _docStateRepo = Provider.Get <IDocStateRepository>();
            _userRepo     = Provider.Get <IUserRepository>();

            Doc = _docRepo.LoadById(docId);
        }
Exemplo n.º 5
0
        public DynaDoc(Doc doc, Guid userId, IAppServiceProvider provider)
        {
            if (doc == null)
            {
                throw new ApplicationException("Не могу создать динамический документ. Документ не передан!");
            }
            Doc = doc;

            Provider    = provider;
            DataContext = provider.Get <IDataContext>();

            if (userId == Guid.Empty)
            {
                //var userData = Provider.Get<IUserDataProvider>();
                UserId = Provider.GetCurrentUserId();
            }
            else
            {
                UserId = userId;
            }

            _docRepo      = Provider.Get <IDocRepository>();
            _docStateRepo = Provider.Get <IDocStateRepository>();
            _userRepo     = Provider.Get <IUserRepository>();
        }
Exemplo n.º 6
0
 public ApplicationsController(
     IUnitOfWork unitOfWork,
     ILotRepository lotRepository,
     IPersonRepository personRepository,
     IOrganizationRepository organizationRepository,
     IAircraftRepository aircraftRepository,
     IAirportRepository airportRepository,
     IEquipmentRepository equipmentRepository,
     IDocRepository docRepository,
     IApplicationRepository applicationRepository,
     INomRepository nomRepository,
     IFileRepository fileRepository,
     IExaminationSystemRepository examinationSystemRepository,
     ILotEventDispatcher lotEventDispatcher,
     UserContext userContext)
 {
     this.unitOfWork = unitOfWork;
     this.lotRepository = lotRepository;
     this.personRepository = personRepository;
     this.organizationRepository = organizationRepository;
     this.aircraftRepository = aircraftRepository;
     this.airportRepository = airportRepository;
     this.equipmentRepository = equipmentRepository;
     this.docRepository = docRepository;
     this.applicationRepository = applicationRepository;
     this.nomRepository = nomRepository;
     this.examinationSystemRepository = examinationSystemRepository;
     this.fileRepository = fileRepository;
     this.lotEventDispatcher = lotEventDispatcher;
     this.userContext = userContext;
 }
Exemplo n.º 7
0
        public DynaDoc(Doc doc, Guid userId, IDataContext dataContext)
        {
            if (doc == null)
            {
                throw new ApplicationException("Не могу создать динамический документ. Документ не передан!");
            }
            Doc = doc;

            var factory = AppServiceProviderFactoryProvider.GetFactory();

            Provider     = factory.Create();
            _ownProvider = true;

            if (dataContext == null)
            {
                DataContext = Provider.Get <IDataContext>();  //new DataContext();
                // _ownDataContext = true;
            }
            else
            {
                DataContext = dataContext;
            }

            UserId = userId;

            _docRepo      = Provider.Get <IDocRepository>();      // new DocRepository(DataContext, UserId);
            _docStateRepo = Provider.Get <IDocStateRepository>(); // new DocStateRepository(DataContext);
            _userRepo     = Provider.Get <IUserRepository>();     // new UserRepository(DataContext);
        }
Exemplo n.º 8
0
 public DocsController(AppDbContext context, ILogger <DocsController> logger, IConfiguration configuration, IDocRepository docrepo)
 {
     _context       = context;
     _logger        = logger;
     _configuration = configuration;
     _docrepo       = docrepo;
     int.TryParse(_configuration["SQL:PageRecords"], out pageRecords);
 }
Exemplo n.º 9
0
 public DocService(IHttpContextAccessor httpContextAccessor, IDocRepository repository,
                   IMapper mapper, ILogger <DocController> logger)
 {
     _httpContextAccessor = httpContextAccessor;
     _repository          = repository;
     _mapper = mapper;
     _logger = logger;
 }
Exemplo n.º 10
0
 public DocDataSet(IAppServiceProvider provider, IDataContext dataContext, IEnumerable <Guid> docs, Guid userId)
 {
     Provider     = provider;
     _ownProvider = false;
     DataContext  = dataContext;
     DocList      = new List <Guid>(docs);
     DocRepo      = Provider.Get <IDocRepository>(); // new DocRepository(DataContext, userId);
 }
Exemplo n.º 11
0
        public AppCommunicatorService()
        {
            List<IDbConfiguration> configurations = new List<IDbConfiguration>();
            configurations.Add(new DocsDbConfiguration());
            configurations.Add(new CommonDbConfiguration());

            this.unitOfWork = new UnitOfWork(configurations, Enumerable.Empty<IDbContextInitializer>());
            this.docRepository = new DocRepository(unitOfWork);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Controller for addresses
 /// </summary>
 public DocController(IHttpContextAccessor httpContextAccessor, IDocRepository repository,
                      IMapper mapper, ILogger <DocController> logger, IDocService docService)
 {
     _httpContextAccessor = httpContextAccessor;
     _repository          = repository;
     _logger     = logger;
     _docService = docService;
     Directory.CreateDirectory(DocStore);
 }
Exemplo n.º 13
0
        public DocDataSet(IDataContext dataContext, IEnumerable <Guid> docs, Guid userId)
        {
            DataContext = dataContext;
            DocList     = new List <Guid>(docs);
            var factory = AppServiceProviderFactoryProvider.GetFactory();

            Provider     = factory.Create();
            _ownProvider = true;
            DocRepo      = Provider.Get <IDocRepository>(); // new DocRepository(DataContext, userId);
        }
Exemplo n.º 14
0
        public SqlQueryXmlBuilder(IAppServiceProvider provider, IDataContext dataContext, SqlQuery query)
        {
            Provider    = provider;
            DataContext = dataContext;
            Query       = query;

            _docRepo       = Provider.Get <IDocRepository>();
            _enumRepo      = Provider.Get <IEnumRepository>();
            _readerFactory = Provider.Get <ISqlQueryReaderFactory>(DataContext);
        }
        public MultiContextFormRepository(IAppServiceProvider provider)
        {
            DataContext = provider.Get <IMultiDataContext>();

            foreach (var context in DataContext.Contexts)
            {
                if (context.DataType.HasFlag(DataContextType.Meta))
                {
                    _repositories.Add(new FormRepository(provider, context));
                }
            }
            _docRepo = provider.Get <IDocRepository>();
        }
Exemplo n.º 16
0
        private IDocRepository TryGetDocRepo(Doc document)
        {
            if (document == null || String.IsNullOrEmpty(document.DataContextName))
            {
                return(null);
            }

            IDocRepository repo = null;
            var            dc   = DataContext.Contexts.FirstOrDefault(c => String.Equals(c.Name, document.DataContextName, StringComparison.Ordinal));

            if (dc != null)
            {
                _repositories.TryGetValue(dc, out repo);
            }
            return(repo);
        }
Exemplo n.º 17
0
 public AppController(IUnitOfWork unitOfWork,
     IAppRepository appRepository,
     IDocRepository docRepository,
     IUserRepository userRepository,
     IClassificationRepository classificationRepository,
     INomRepository nomRepository,
     IDataGenerator dataGenerator)
 {
     this.unitOfWork = unitOfWork;
     this.appRepository = appRepository;
     this.docRepository = docRepository;
     this.userRepository = userRepository;
     this.classificationRepository = classificationRepository;
     this.nomRepository = nomRepository;
     this.dataGenerator = dataGenerator;
 }
Exemplo n.º 18
0
        public DynaDoc(Guid docId, Guid userId, IAppServiceProvider provider)
        {
            Provider = provider;
            if (userId == Guid.Empty)
            {
                // var userData = Provider.Get<IUserDataProvider>();
                UserId = provider.GetCurrentUserId();
            }
            else
            {
                UserId = userId;
            }

            _docRepo      = Provider.Get <IDocRepository>();
            _docStateRepo = Provider.Get <IDocStateRepository>();
            _userRepo     = Provider.Get <IUserRepository>();

            Doc = _docRepo.LoadById(docId);
        }
Exemplo n.º 19
0
 public AplicationsCaseController(
     IUnitOfWork unitOfWork,
     ILotRepository lotRepository,
     IDocRepository docRepository,
     IApplicationRepository applicationRepository,
     IFileRepository fileRepository,
     ICaseTypeRepository caseTypeRepository,
     ILotEventDispatcher lotEventDispatcher,
     UserContext userContext)
 {
     this.unitOfWork = unitOfWork;
     this.lotRepository = lotRepository;
     this.docRepository = docRepository;
     this.applicationRepository = applicationRepository;
     this.lotEventDispatcher = lotEventDispatcher;
     this.fileRepository = fileRepository;
     this.caseTypeRepository = caseTypeRepository;
     this.userContext = userContext;
 }
Exemplo n.º 20
0
 public IncomingDocProcessor(
     Func<Owned<IUnitOfWork>> unitOfWorkFactory,
     IUnitOfWork unitOfWork,
     IDocRepository docRepository,
     IEmailRepository emailRepository,
     ICorrespondentRepository correspondentRepository,
     IRioObjectExtractor rioObjectExtractor,
     IRioDocumentParser rioDocumentParser,
     IRioValidator rioValidator)
 {
     this.unitOfWorkFactory = unitOfWorkFactory;
     this.unitOfWork = unitOfWork;
     this.docRepository = docRepository;
     this.emailRepository = emailRepository;
     this.correspondentRepository = correspondentRepository;
     this.rioObjectExtractor = rioObjectExtractor;
     this.rioDocumentParser = rioDocumentParser;
     this.rioValidator = rioValidator;
 }
Exemplo n.º 21
0
        public Doc GetDoc(IDocRepository docRepo)
        {
            //using (var docRepo = new DocRepository(Guid.Empty))

            var doc = docRepo.CreateDoc(Query.Source.GetDocDef());

            var i = 0;

            foreach (var attr in Query.Attributes)
            {
                if (attr.Source == Query.Source)
                {
                    if (attr.Def == null)
                    {
                        switch (attr.Attribute.Ident)
                        {
                        case SystemIdent.Id:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.Id = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.Created:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.CreationTime = Reader.GetDateTime(i);
                            }
                            break;

                        case SystemIdent.UserId:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.UserId = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.OrgId:
                            if (!Reader.IsDBNull(i))
                            {
                                doc.OrganizationId = Reader.GetGuid(i);
                            }
                            break;

                        case SystemIdent.State:
                            if (!Reader.IsDBNull(i))
                            {
                                if (doc.State == null)
                                {
                                    doc.State = new DocState {
                                        Type = new DocStateType {
                                            Id = Reader.GetGuid(i)
                                        }
                                    }
                                }
                            }
                            ;
                            else
                            {
                                doc.State.Type = new DocStateType {
                                    Id = Reader.GetGuid(i)
                                }
                            };
                            break;
Exemplo n.º 22
0
 public BizService(IDocRepository docRepository, string currentUserName)
 {
     CurrentUserName = currentUserName;
     DocRepo         = docRepository;
 }
Exemplo n.º 23
0
 public DocBusiness(IDocRepository docRepository, ICauHoiRepository cauHoiRepository)
 {
     _docRepository    = docRepository;
     _cauHoiRepository = cauHoiRepository;
 }
Exemplo n.º 24
0
 public DocService(IDocRepository docRepository, IUnitOfWork unitOfWork, IMemoryCache cache)
 {
     _docRepository = docRepository;
     _unitOfWork    = unitOfWork;
     _cache         = cache;
 }
Exemplo n.º 25
0
 public IntegrationController(
     IDocRepository docRepository,
     IUnitOfWork unitOfWork,
     ILotRepository lotRepository,
     IPersonRepository personRepository,
     IApplicationRepository applicationRepository,
     ICaseTypeRepository caseTypeRepository,
     IIntegrationRepository integrationRepository,
     INomRepository nomRepository,
     ICorrespondentRepository correspondentRepository,
     IRioDocumentParser rioDocumentParser,
     UserContext userContext)
 {
     this.docRepository = docRepository;
     this.unitOfWork = unitOfWork;
     this.lotRepository = lotRepository;
     this.personRepository = personRepository;
     this.applicationRepository = applicationRepository;
     this.integrationRepository = integrationRepository;
     this.caseTypeRepository = caseTypeRepository;
     this.nomRepository = nomRepository;
     this.correspondentRepository = correspondentRepository;
     this.rioDocumentParser = rioDocumentParser;
     this.userContext = userContext;
 }
Exemplo n.º 26
0
 public DocListEnumerator(DocList docList)
 {
     _docList = docList;
     _docRepo = docList.Provider.Get <IDocRepository>();
     //new DocRepository(docList.DataContext, docList.UserId);
 }
Exemplo n.º 27
0
 public DocumentsController()
 {
     db = new DocumentRepository();
 }
Exemplo n.º 28
0
 public DocService(IDocRepository repository, IValidator <Doc> validator)
 {
     this.repository = repository;
     this.validator  = validator;
 }
Exemplo n.º 29
0
 public DocsController(IDocRepository _docs)
 {
     this.docs = _docs;
 }
Exemplo n.º 30
0
 public DocumentsController(IDocRepository repository)
 {
     db = repository;
 }
Exemplo n.º 31
0
        private void FillDoc(DocumentBuilder builder, string prefix, DynaDoc doc)
        {
            var pref = String.IsNullOrEmpty(prefix) ? "" : prefix + ".";

            //foreach (var attr in doc.Doc.Attributes)
            //{
            //    var fn = Logger.GetLogFileName("ReportManagerError");
            //    Logger.OutputLog(fn, "ERROR BLOB: " + attr.AttrDef.Name + " ----- " + attr.GetType() + " ----- " + attr.ObjectValue.ToString().Length + " ----- " + (attr is BlobAttribute));
            //}

            foreach (var attr in doc.Doc.Attributes)
            {
                var value = attr.ObjectValue;

                try
                {
                    if (attr is BlobAttribute)
                    {
                        //var fn = Logger.GetLogFileName("ReportManagerError");
                        //Logger.OutputLog(fn, "ERROR BLOB: " + attr.AttrDef.Name + " ----- " + attr.GetType());

                        IDocRepository _docRepo = Provider.Get <IDocRepository>();

                        BlobData img = _docRepo.GetBlobAttrData(doc.Doc.Id, attr.AttrDef);

                        //Logger.OutputLog(fn, "ERROR BLOB: " + img.FileName);

                        // We assume only Image types blobs are used in reports
                        builder.SetBlobField(pref + attr.AttrDef.Name, img.Data);

                        continue;
                    }
                }
                catch (Exception e)
                {
                    var fn = Logger.GetLogFileName("ReportManagerError");
                    Logger.OutputLog(fn, e, e.Message);
                }

                if (value == null)
                {
                    continue;
                }

                if (attr is DocAttribute)
                {
                    var attrDoc = doc.GetAttrDoc((DocAttribute)attr);

                    if (attrDoc != null)
                    {
                        using (var dynaDoc = new DynaDoc(attrDoc, UserId, Provider))
                            FillDoc(builder, pref + attr.AttrDef.Name, dynaDoc);
                    }
                }
                else if (attr is DocListAttribute)
                {
                    var index = 0;
                    foreach (var docItem in doc.GetAttrDocList((DocListAttribute)attr))
                    {
                        using (var dynaDoc = new DynaDoc(docItem, UserId, Provider))
                            FillDoc(builder, string.Format("{0}{1}.{2}", pref, attr.AttrDef.Name, index), dynaDoc);
                        index++;
                    }
                }
                else if (attr is EnumAttribute)
                {
                    var enumValue = doc.GetAttrEnum((EnumAttribute)attr);

                    if (enumValue != null)
                    {
                        builder.SetField(pref + attr.AttrDef.Name, enumValue.Value);
                    }
                }
                else if (attr is DateTimeAttribute)
                {
                    builder.SetField(pref + attr.AttrDef.Name, String.Format("{0:d}", value));
                }
                else if (attr is CurrencyAttribute || attr is FloatAttribute)
                {
                    builder.SetField(pref + attr.AttrDef.Name, String.Format("{0:F2}", value));
                }
                else
                {
                    builder.SetField(pref + attr.AttrDef.Name, value);
                }
            }
        }
Exemplo n.º 32
0
 public DocumentationService(IDocRepository repository)
 {
     _repo = repository;
 }
Exemplo n.º 33
0
 public DocService(IDocRepository repository)
 {
     this.Repository = repository;
     this.AddDisposableObjects(repository);
 }
Exemplo n.º 34
0
 public UserController(IDocRepository repository)
 {
     db = repository;
 }
Exemplo n.º 35
0
 public UserController()
 {
     db = new DocumentRepository();
 }
Exemplo n.º 36
0
 public DocController(IDocRepository repo)
 {
     this.repo = repo;
 }