Ejemplo n.º 1
0
        public FormHelper(IAppServiceProvider provider, BizForm form)
        {
            Form = form;

            _docDefRepo = provider.Get <IDocDefRepository>();
            _formRepo   = provider.Get <IFormRepository>();
        }
Ejemplo n.º 2
0
        public PermissionRepository(IAppServiceProvider provider, IDataContext dataContext)
        {
            DataContext = dataContext; //provider.Get<IDataContext>();

            _userRepo = provider.Get <IUserRepository>();
            _orgRepo  = provider.Get <IOrgRepository>();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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>();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public DocDefRepository(IAppServiceProvider provider, IDataContext dataContext)
 {
     Provider              = provider;
     DataContext           = dataContext ?? Provider.Get <IDataContext>();
     UserId                = Provider.GetCurrentUserId();
     _enumRepo             = Provider.Get <IEnumRepository>();
     _permissionRepository = Provider.Get <IPermissionRepository>();
 }
Ejemplo n.º 7
0
        public QueryRepository(IAppServiceProvider provider, IDataContext dataContext)
        {
            DataContext = dataContext;

            _userId = provider.GetCurrentUserId();

            _docDefRepo     = provider.Get <IDocDefRepository>();
            _permissionRepo = provider.Get <IPermissionRepository>();
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public WorkflowEngine(IAppServiceProvider provider, IDataContext dataContext)
        {
            Provider    = provider;
            DataContext = dataContext; //provider.Get<IDataContext>();

            var userData = provider.Get <IUserDataProvider>();

            UserId = userData.UserId;

            Repository = provider.Get <IWorkflowRepository>();
        }
Ejemplo n.º 10
0
        public SqlQueryDocSource(IAppServiceProvider provider, /*IDataContext dataContext, */ DocDef docDef, string alias)
            : base(alias)
        {
            Source   = docDef;
            Provider = provider;
            // DataContext = dataContext;

            _docDefRepo = Provider.Get <IDocDefRepository>();
            _mapper     = Provider.Get <IDocumentTableMapRepository>();
            _userRepo   = Provider.Get <IUserRepository>();
        }
Ejemplo n.º 11
0
        public ControlFactory(IAppServiceProvider provider, IDataContext dataContext)
        {
            _dataContext = dataContext; //provider.Get<IDataContext>();

            // UserId = provider.GetCurrentUserId(); //userDataProvider.UserId;

            // _enumRepo = provider.Get<IEnumRepository>();
            _docDefRepo     = provider.Get <IDocDefRepository>();
            _permissionRepo = provider.Get <IPermissionRepository>();
            // _comboBoxEnumProv = provider.Get<IComboBoxEnumProvider>();
            _queryRepo = provider.Get <IQueryRepository>();
        }
Ejemplo n.º 12
0
        public SqlQueryDocSource(IAppServiceProvider provider, /*IDataContext dataContext,*/ Guid docDefId, string alias)
            : base(alias)
        {
            Provider = provider;
            //DataContext = dataContext;
            //using (var docDefRepo = new DocDefRepository(DataContext))

            _docDefRepo = Provider.Get <IDocDefRepository>();
            _mapper     = Provider.Get <IDocumentTableMapRepository>();
            _userRepo   = Provider.Get <IUserRepository>();

            Source = _docDefRepo.DocDefById(docDefId);
        }
        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>();
        }
Ejemplo n.º 14
0
        public bool CanExecute(BackupPlan plan)
        {
            var placeholders = new Placeholders();

            systemOperations.LoadSystemPlaceholders(placeholders);

            var stepTypes = new HashSet <string>(plan.Steps.Select(step => step.StepType));

            return
                (!stepTypes.Select(type => serviceProvider.Get <IStepExecution>(s => s.Type == type)
                                   ?.CanExecuteSupportedSteps(plan.Steps, placeholders))
                 .Any(result => !(result ?? true)));
        }
Ejemplo n.º 15
0
        public XlsFormDefBuilder(IAppServiceProvider provider, BizForm form)
        {
            Provider    = provider;
            DataContext = provider.Get <IDataContext>();
            Form        = form;
            //var userData = provider.Get<IUserDataProvider>();
            UserId = provider.GetCurrentUserId(); //userData.UserId;

            _formRepo = Provider.Get <IFormRepository>();
            _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>();
            _sqlQueryReaderFactory  = Provider.Get <ISqlQueryReaderFactory>();
            _comboBoxValueProvider  = Provider.Get <IComboBoxEnumProvider>();
        }
Ejemplo n.º 16
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>();
        }
Ejemplo n.º 17
0
        public XlsFormDefBuilder(IDataContext dataContext, BizForm form, Guid userId)
        {
            DataContext = dataContext;
            Form        = form;
            UserId      = userId;

            var providerFactory = AppServiceProviderFactoryProvider.GetFactory();

            Provider = providerFactory.Create(dataContext, new UserDataProvider(UserId, ""));

            _formRepo = Provider.Get <IFormRepository>();
            _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>();
            _sqlQueryReaderFactory  = Provider.Get <ISqlQueryReaderFactory>();
            _comboBoxValueProvider  = Provider.Get <IComboBoxEnumProvider>();
        }
Ejemplo n.º 18
0
        public override void Execute(WorkflowContext context, IAppServiceProvider provider, IDataContext dataContext)
        {
            //using (var docRepo = new DocRepository(dataContext, context.UserId))
            var docRepo = provider.Get <IDocRepository>();
            {
                try
                {
                    var doc = context.CurrentDocument;
                    if (doc != null)
                    {
                        docRepo.SetDocState(doc, DocStateTypeId);
                    }
                    else if (context.CurrentDocumentId != null)
                    {
                        docRepo.SetDocState((Guid)context.CurrentDocumentId, DocStateTypeId);
                    }
                    else
                    {
                        context.ThrowException("Document Id not found", "Идентификатор документа не найден!");
                    }

                    base.Execute(context, provider, dataContext);
                }
                catch (Exception e)
                {
                    OnException(context, e);
                    context.ThrowException(e);
                }
            }
        }
        public MultiContextComboBoxEnumProvider(IAppServiceProvider provider)
        {
            Provider    = provider;
            DataContext = Provider.Get <IMultiDataContext>();

            foreach (var context in DataContext.Contexts)
            {
                if (context.DataType.HasFlag(DataContextType.Document))
                {
                    _repositories.Add(context, new ComboBoxEnumProvider(Provider, context));
                }
            }
            _enumRepo = Provider.Get <IEnumRepository>();
            _userRepo = Provider.Get <IUserRepository>();
            _orgRepo  = Provider.Get <IOrgRepository>();
        }
Ejemplo n.º 20
0
 public IEnumerable <DocStateType> Get(Guid docDefId)
 {
     return
         (_dataContext.Contexts.Where(context => context.DataType.HasFlag(DataContextType.Document))
          .Select(context => _provider.Get <IDocDefStateListProvider>(context))
          .SelectMany(prov => prov.Get(docDefId)));
 }
Ejemplo n.º 21
0
        public BizService(IAppServiceProvider provider, string currentUserName)
        {
            _monitor = new Monitor("BizService session");

            _dataContext    = provider.Get <IMultiDataContext>();
            CurrentUserName = currentUserName;

            Provider = provider;
            UserRepo = Provider.Get <IUserRepository>();

            var serviceRegistrator = Provider.Get <IAppServiceProviderRegistrator>();

            serviceRegistrator.AddService(new UserDataProvider(CurrentUserId, CurrentUserName));

            EnumRepo   = Provider.Get <IEnumRepository>();
            DocRepo    = Provider.Get <IDocRepository>();
            DocDefRepo = Provider.Get <IDocDefRepository>();
            FormRepo   = Provider.Get <IFormRepository>();
            var workflowRepo = Provider.Get <IWorkflowRepository>();

            WorkflowRepo   = workflowRepo;
            WorkflowEngine = Provider.Get <IWorkflowEngine>();

            ReportGeneratorProvider = Provider.Get <ITemplateReportGeneratorProvider>();
            LangRepo = Provider.Get <ILanguageRepository>();

            _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>();
            _sqlQueryReaderFactory  = Provider.Get <ISqlQueryReaderFactory>();
            _comboBoxValueProvider  = Provider.Get <IComboBoxEnumProvider>();

            _id = RegisterProcess(CurrentUserId, CurrentUserName);
        }
Ejemplo n.º 22
0
        public MultiContextSqlQueryReaderFactory(IAppServiceProvider provider)
        {
            var multiDC     = provider.Get <IMultiDataContext>();
            var dataContext = multiDC.Contexts.First(dc => dc.DataType.HasFlag(DataContextType.Document));

            Factory = new SqlQueryReaderFactory(provider, dataContext);
        }
Ejemplo n.º 23
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);
 }
Ejemplo n.º 24
0
 public QueryCsvWriter(IAppServiceProvider provider, IDataContext dataContext, SqlQuery query, StreamWriter writer)
 {
     Provider         = provider;
     DataContext      = dataContext;
     Query            = query;
     Writer           = writer;
     _sqlQueryBuilder = provider.Get <ISqlQueryBuilder>();
 }
Ejemplo n.º 25
0
 public QueryCsvWriter(IAppServiceProvider provider, IDataContext dataContext, QueryDef queryDef, StreamWriter writer, Guid userId)
 {
     Provider         = provider;
     DataContext      = dataContext;
     QueryDef         = queryDef;
     Writer           = writer;
     UserId           = userId;
     _sqlQueryBuilder = provider.Get <ISqlQueryBuilder>();
 }
Ejemplo n.º 26
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);
        }
        public MultiContextDocStateRepository(IAppServiceProvider provider)
        {
            DataContext = provider.Get <IMultiDataContext>();

            foreach (var context in DataContext.Contexts)
            {
                if (context.DataType.HasFlag(DataContextType.Meta))
                {
                    _repositories.Add(new DocStateRepository(context));
                }
            }
        }
 public MultiContextQueryRepository(IAppServiceProvider provider)
 {
     Provider    = provider;
     DataContext = provider.Get <IMultiDataContext>();
     foreach (var context in DataContext.Contexts)
     {
         if (context.DataType.HasFlag(DataContextType.Meta))
         {
             _repositories.Add(context, new QueryRepository(Provider, context));
         }
     }
 }
Ejemplo n.º 29
0
        public MultiContextPermissionRepository(IAppServiceProvider provider)
        {
            DataContext = provider.Get <IMultiDataContext>();

            foreach (var context in DataContext.Contexts)
            {
                if (context.DataType.HasFlag(DataContextType.Account))
                {
                    _repositories.Add(new PermissionRepository(provider, context));
                }
            }
        }
Ejemplo n.º 30
0
        public UserDataProvider(string userName, string password, IAppServiceProvider provider)
        {
            var userRepo = provider.Get <IUserRepository>();

            var userId = userRepo.FindUserId(userName, password);

            if (userId == null)
            {
                throw new ApplicationException(String.Format("Username \"{0}\" not found", userName));
            }

            UserId   = (Guid)userId;
            UserName = userName;
        }