예제 #1
0
        public FormHelper(IAppServiceProvider provider, BizForm form)
        {
            Form = form;

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

            _userRepo = provider.Get <IUserRepository>();
            _orgRepo  = provider.Get <IOrgRepository>();
        }
예제 #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);
        }
예제 #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>();
        }
예제 #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);
        }
예제 #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>();
 }
예제 #7
0
        public QueryRepository(IAppServiceProvider provider, IDataContext dataContext)
        {
            DataContext = dataContext;

            _userId = provider.GetCurrentUserId();

            _docDefRepo     = provider.Get <IDocDefRepository>();
            _permissionRepo = provider.Get <IPermissionRepository>();
        }
예제 #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);
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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)));
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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>();
        }
예제 #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)));
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
 }
예제 #24
0
 public QueryCsvWriter(IAppServiceProvider provider, IDataContext dataContext, SqlQuery query, StreamWriter writer)
 {
     Provider         = provider;
     DataContext      = dataContext;
     Query            = query;
     Writer           = writer;
     _sqlQueryBuilder = provider.Get <ISqlQueryBuilder>();
 }
예제 #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>();
 }
예제 #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));
         }
     }
 }
예제 #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));
                }
            }
        }
예제 #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;
        }