コード例 #1
0
        public async Task TesteImportacaoSpoolEJunta()
        {
            var application = new Application(false);
            IObjectSpaceProvider objectSpaceProvider = application.serverApplication.ObjectSpaceProvider;
            var          objectSpace = objectSpaceProvider.CreateObjectSpace();
            var          parametros  = objectSpace.CreateObject <ParametrosImportSpoolJuntaExcel>();
            MemoryStream stream      = new MemoryStream();

            stream.Seek(0, SeekOrigin.Begin);
            var arquivo = parametros.Padrao;

            arquivo.SaveToStream(stream);
            stream.Seek(0, SeekOrigin.Begin);

            using (var excelReader = new Module.ExcelDataReaderHelper.Excel.Reader(stream))
            {
                var dtcollectionImport = excelReader.CreateDataTableCollection(false);

                var itba     = new ImportSpoolEJunta(objectSpace, parametros);
                var progress = new Progress <ImportProgressReport>(itba.LogTrace);

                await Observable.Start(() => itba.ImportarSpools(dtcollectionImport["SGS"], progress));

                await Observable.Start(() => itba.ImportarJuntas(dtcollectionImport["SGJ"], progress));

                objectSpace.CommitChanges();
            }
        }
コード例 #2
0
ファイル: XafHelper.cs プロジェクト: ewin66/XpandBlog
        public XafHelper(IUnityContainer unityContainer, string connectionString = null)
        {
            if (connectionString == null)
            {
                connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }

            foreach (var type in Types)
            {
                XafTypesInfo.Instance.RegisterEntity(type);
            }

            var typesInfoSource = new XpoTypeInfoSource(XafTypesInfo.Instance as TypesInfo);

            foreach (var type in Types)
            {
                typesInfoSource.RegisterEntity(type);
            }

            _ObjectSpaceProvider = new UnityXPObjectSpaceProvider(new ConnectionStringDataStoreProvider(connectionString), XafTypesInfo.Instance, typesInfoSource, unityContainer, true);

            using (var objectSpace = _ObjectSpaceProvider.CreateUpdatingObjectSpace(false))
            {
                var xpObjectSpace = objectSpace as XPObjectSpace;
                if (xpObjectSpace != null)
                {
                    xpObjectSpace.Session.CreateObjectTypeRecords();
                }
            }
        }
コード例 #3
0
        public async Task TesteImportacaoPieceAndJoints()
        {
            var application = new Application(false);
            IObjectSpaceProvider objectSpaceProvider = application.serverApplication.ObjectSpaceProvider;
            var          objectSpace = objectSpaceProvider.CreateObjectSpace();
            var          parametros  = objectSpace.CreateObject <ParametrosImportComponentEJunta>();
            MemoryStream stream      = new MemoryStream();

            stream.Seek(0, SeekOrigin.Begin);
            var arquivo = parametros.Padrao;

            arquivo.SaveToStream(stream);
            stream.Seek(0, SeekOrigin.Begin);

            using (var excelReader = new Module.ExcelDataReaderHelper.Excel.Reader(stream))
            {
                var dtcollectionImport = excelReader.CreateDataTableCollection(false);

                var piecejoints = new ImportComponentEJunta(objectSpaceProvider, parametros);
                var progress    = new Progress <ImportProgressReport>(piecejoints.LogTrace);

                await Task.Run(() => piecejoints.ImportarComponente(dtcollectionImport["Piece"], progress));

                //await Observable.Start(() => piecejoints.ImportarJuntas(dtcollectionImport["Joints"], progress));

                objectSpace.CommitChanges();
            }
        }
コード例 #4
0
ファイル: XafHelper.cs プロジェクト: genesissupsup/XpandBlog
        public XafHelper(IUnityContainer unityContainer, string connectionString = null)
        {
            if (connectionString == null)
            {
                connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }

            foreach (var type in Types)
            {
                XafTypesInfo.Instance.RegisterEntity(type);
            }

            var typesInfoSource = new XpoTypeInfoSource(XafTypesInfo.Instance as TypesInfo);

            foreach (var type in Types)
            {
                typesInfoSource.RegisterEntity(type);
            }

            _ObjectSpaceProvider = new UnityXPObjectSpaceProvider(new ConnectionStringDataStoreProvider(connectionString), XafTypesInfo.Instance, typesInfoSource, unityContainer, true);

            using (var objectSpace = _ObjectSpaceProvider.CreateUpdatingObjectSpace(false))
            {
                var xpObjectSpace = objectSpace as XPObjectSpace;
                if (xpObjectSpace != null)
                    xpObjectSpace.Session.CreateObjectTypeRecords();
            }
        }
コード例 #5
0
 public static IObservable <GraphServiceClient> NewGraphServiceClient(this IObjectSpaceProvider objectSpaceProvider)
 {
     return(ServiceProvider.ClientAppBuilder.Authorize(cache => {
         var newMicrosoftAuthentication = objectSpaceProvider.NewMicrosoftAuthentication();
         return cache.SynchStorage(objectSpaceProvider.CreateObjectSpace, newMicrosoftAuthentication);
     }));
 }
コード例 #6
0
 public LoginForm(SecurityStrategyComplex security, IObjectSpaceProvider objectSpaceProvider, string userName)
 {
     InitializeComponent();
     this.security            = security;
     this.objectSpaceProvider = objectSpaceProvider;
     userNameEdit.Text        = userName;
 }
コード例 #7
0
 protected DBUpdaterBase(string keyPropertyName)
 {
     RegisterEntitiesCore();
     updatingObjectSpaceProvider = CreateUpdatingObjectSpaceProvider();
     updatingObjectSpaceProvider.UpdateSchema();
     this.keyPropertyName = keyPropertyName;
 }
コード例 #8
0
        public static string GetConnectionString(this IObjectSpaceProvider objectSpaceProvider)
        {
            var connection = objectSpaceProvider.GetPropertyValue("DataLayer")?.GetPropertyValue("Connection");

            return((string)(connection != null ? connection.GetPropertyValue("ConnectionString")
                : (objectSpaceProvider.GetPropertyValue("DataStoreProvider")).GetPropertyValue("ConnectionString")));
        }
コード例 #9
0
 public async Task TesteGeradoresDeLotes()
 {
     var application = new Application(false);
     IObjectSpaceProvider objectSpaceProvider = application.serverApplication.ObjectSpaceProvider;
     var progress = new Progress <string>();
     var gerador  = new Module.Calculator.ProcessoLoteLPPM.GerarLoteLPPM(objectSpaceProvider);
     await gerador.GerarLoteLPPMAsync(progress);
 }
コード例 #10
0
 private void EmployeeListForm_Load(object sender, EventArgs e)
 {
     security            = ((MainForm)MdiParent).Security;
     objectSpaceProvider = ((MainForm)MdiParent).ObjectSpaceProvider;
     securedObjectSpace  = objectSpaceProvider.CreateObjectSpace();
     employeeBindingSource.DataSource = securedObjectSpace.GetObjects <Employee>();
     newBarButtonItem.Enabled         = security.IsGranted(new PermissionRequest(securedObjectSpace, typeof(Employee), SecurityOperations.Create));
 }
コード例 #11
0
ファイル: Extensions.cs プロジェクト: okuldev/DevExpress.XAF
        public static string GetConnectionString(this IObjectSpaceProvider spaceProvider)
        {
            Guard.TypeArgumentIs(typeof(XPObjectSpaceProvider), spaceProvider.GetType(), nameof(spaceProvider));
            var objectSpaceProvider = ((XPObjectSpaceProvider)spaceProvider);

            return(objectSpaceProvider.DataLayer?.Connection != null ? objectSpaceProvider.DataLayer.Connection.ConnectionString
                : ((IXpoDataStoreProvider)objectSpaceProvider.GetPropertyValue("DataStoreProvider")).ConnectionString);
        }
コード例 #12
0
 static IObjectSpaceProvider GetObjectSpaceProvider()
 {
     if (ObjectSpaceProvider == null)
     {
         ObjectSpaceProvider = new SecuredObjectSpaceProvider(Security, ConnectionString, null);
     }
     return(ObjectSpaceProvider);
 }
コード例 #13
0
        protected void Init()
        {
            Security = ConnectionHelper.GetSecurity(typeof(IdentityAuthenticationProvider).Name, HttpContext?.User?.Identity);
            string connectionString = Config.GetConnectionString("XafApplication");
            IObjectSpaceProvider objectSpaceProvider = ConnectionHelper.GetObjectSpaceProvider(Security, XpoDataStoreProviderService, connectionString);

            ConnectionHelper.Login(Security, objectSpaceProvider);
            ObjectSpace = objectSpaceProvider.CreateObjectSpace();
        }
コード例 #14
0
 public static void AddObjectSpaceProvider(this XafApplication application, IObjectSpaceProvider objectSpaceprovider)
 {
     application.WhenCreateCustomObjectSpaceProvider()
     .Select(_ => {
         _.e.ObjectSpaceProviders.Add(objectSpaceprovider);
         return(_);
     })
     .Subscribe();
 }
        private static void ExportReport(IReportDataV2 reportData, IObjectSpaceProvider objectSpaceProvider)
        {
            XtraReport report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            MyReportDataSourceHelper reportDataSourceHelper = new MyReportDataSourceHelper(objectSpaceProvider);

            ReportDataProvider.ReportObjectSpaceProvider = new MyReportObjectSpaceProvider(objectSpaceProvider);
            reportDataSourceHelper.SetupBeforePrint(report);
            report.ExportToPdf("test.pdf");
        }
コード例 #16
0
 private void EmployeeListForm_Load(object sender, EventArgs e)
 {
     security            = ((MainForm)MdiParent).Security;
     objectSpaceProvider = ((MainForm)MdiParent).ObjectSpaceProvider;
     securedObjectSpace  = objectSpaceProvider.CreateObjectSpace();
     employeeBindingSource.DataSource = securedObjectSpace.GetObjects <Employee>();
     newBarButtonItem.Enabled         = security.CanCreate <Employee>();
     protectedContentTextEdit         = new RepositoryItemProtectedContentTextEdit();
 }
コード例 #17
0
        public EcmUseCaseBaseTests()
        {
            ObjectSpaceProvider = new XPObjectSpaceProvider(new MemoryDataStoreProvider());
            Application         = new TestApplication();
            IagXafExtEcmModule module = new IagXafExtEcmModule();

            Application.Modules.Add(module);
            Application.Setup("TestApplication", ObjectSpaceProvider);
        }
コード例 #18
0
        public override DatabaseUpdaterBase CreateDatabaseUpdater(IObjectSpaceProvider objectSpaceProvider)
        {
            var databaseUpdaterBase = base.CreateDatabaseUpdater(objectSpaceProvider);

            if (databaseUpdaterBase is DatabaseSchemaUpdater)
            {
                return(new WorldCreatorSchemaDatabaseUpdater(objectSpaceProvider, Modules));
            }
            return(new WorldCreatorDatabaseUpdater(objectSpaceProvider, ApplicationName, Modules));
        }
コード例 #19
0
        public SecuredController(XpoDataStoreProviderService xpoDataStoreProviderService, IConfiguration config, SecurityProvider securityHelper, IHttpContextAccessor contextAccessor)
            : base(xpoDataStoreProviderService, config, securityHelper)
        {
            Security = SecurityProvider.GetSecurity(typeof(IdentityAuthenticationProvider).Name, contextAccessor.HttpContext.User.Identity);
            string connectionString = Config.GetConnectionString("XafApplication");
            IObjectSpaceProvider objectSpaceProvider = SecurityProvider.GetObjectSpaceProvider(Security, XpoDataStoreProviderService, connectionString);

            SecurityProvider.Login(Security, objectSpaceProvider);
            ObjectSpace = objectSpaceProvider.CreateObjectSpace();
        }
コード例 #20
0
 private void Login(SecurityStrategyComplex security, IObjectSpaceProvider objectSpaceProvider)
 {
     try
     {
         IObjectSpace objectSpace = objectSpaceProvider.CreateObjectSpace();
         security.Logon(objectSpace);
     }
     catch (Exception ex)
     {
     }
 }
コード例 #21
0
        private static byte[] ExportReport(ReportDataV2 reportData, IObjectSpaceProvider objectSpaceProvider, string CriteriaString, IObjectSpace objectSpace)
        {
            MyReportDataSourceHelper reportDataSourceHelper = new MyReportDataSourceHelper(objectSpaceProvider);

            ReportDataProvider.ReportObjectSpaceProvider = new MyReportObjectSpaceProvider(objectSpaceProvider);
            CriteriaOperator ReportCriteria = CriteriaOperator.Parse(CriteriaString);


            //XtraReport report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            XtraReport report = new XtraReport();

            byte[] content = reportData.Content;
            if (content != null && content.Length != 0)
            {
                int num = content.Length;
                while (content[num - 1] == 0)
                {
                    num--;
                }
                MemoryStream memoryStream = new MemoryStream(content, 0, num);

                report.LoadLayoutFromXml(memoryStream);

                // report.LoadLayout(memoryStream);


                memoryStream.Close();
            }

            DataSourceBase dataSourceBase = report.DataSource as DataSourceBase;

            if (dataSourceBase != null && reportData is IReportDataV2Writable)
            {
                ((IReportDataV2Writable)reportData).SetDataType(dataSourceBase.DataType);
            }
            report.DisplayName = reportData.DisplayName;

            //XtraReport report = reportData.LoadReport(objectSpace);



            report.Extensions["DataSerializationExtension"] = "XtraReport";
            report.Extensions["DataEditorExtension"]        = "XtraReport";
            report.Extensions["ParameterEditorExtension"]   = "XtraReport";

            reportDataSourceHelper.SetupBeforePrint(report, null, ReportCriteria, true, null, false);



            MemoryStream ReportStream = new MemoryStream();

            report.ExportToPdf(ReportStream);
            return(ReportStream.ToArray());
        }
コード例 #22
0
        public static void DeleteAllData(this IObjectSpaceProvider objectSpaceProvider)
        {
            using var objectSpace = objectSpaceProvider.CreateUpdatingObjectSpace(true);
            var dbConnection =
                ((ConnectionProviderSql)((BaseDataLayer)((XPObjectSpace)objectSpace).Session.DataLayer)
                 .ConnectionProvider).Connection;

            DeleteAllData(dbConnection);

            objectSpaceProvider.UpdateSchema();
        }
コード例 #23
0
        public static UnitOfWork CreateUnitOfWork(this IObjectSpaceProvider objectSpaceProvider)
        {
            var os = objectSpaceProvider.CreateObjectSpace();

            if (os is XPObjectSpace)
            {
                return((os as XPObjectSpace).Session as UnitOfWork);
            }

            return(null);
        }
コード例 #24
0
ファイル: Module.cs プロジェクト: xyyhqq/eXpand
        private WorldCreatorApplication GetWorldCreatorApplication(IObjectSpaceProvider provider, ModuleList list)
        {
            var customWorldCreatorApplicationArgs =
                new CustomWorldCreatorApplicationArgs {
                ObjectSpaceProvider = provider,
                Modules             = list
            };

            OnCustomWorldCreatorApplication(customWorldCreatorApplicationArgs);
            return(customWorldCreatorApplicationArgs.WorldCreatorApplication ??
                   new WorldCreatorApplication(provider, list));
        }
コード例 #25
0
 public EmployeeDetailForm(Employee employee, SecurityStrategyComplex security, IObjectSpaceProvider objectSpaceProvider)
 {
     InitializeComponent();
     this.employee            = employee;
     this.security            = security;
     this.objectSpaceProvider = objectSpaceProvider;
     visibleMembers           = new Dictionary <string, string> {
         { nameof(Employee.FirstName), "First Name:" },
         { nameof(Employee.LastName), "Last Name:" },
         { nameof(Employee.Department), "Department:" }
     };
 }
コード例 #26
0
        public WorldCreatorApplication(IObjectSpaceProvider objectSpaceProvider, IEnumerable <ModuleBase> moduleList)
        {
            objectSpaceProviders.Add(objectSpaceProvider);
            var moduleBases = moduleList.Select(m => m.GetType().CreateInstance()).Cast <ModuleBase>().OrderBy(m => m.Name).Distinct().ToArray();

            foreach (var moduleBase in moduleBases)
            {
                if (Modules.FindModule(moduleBase.GetType()) == null)
                {
                    Modules.Add(moduleBase);
                }
            }
        }
コード例 #27
0
        public void Execute(IJobExecutionContext context)
        {
            log.Info("EXECUTING:ThresholdCalculationJob");
            var application = ((IXpandScheduler)context.Scheduler).Application;
            IObjectSpaceProvider objectSpaceProvider = application.ObjectSpaceProvider;
            var    jobDataMap = context.JobDetail.JobDataMap;
            var    typeInfo   = objectSpaceProvider.TypesInfo.FindTypeInfo((Type)jobDataMap.Get <ThresholdJobDetailDataMap>(map => map.DataType));
            object count;

            using (var unitOfWork = new UnitOfWork(((XpandObjectSpaceProvider)objectSpaceProvider).WorkingDataLayer)) {
                count = unitOfWork.GetCount(typeInfo.Type, CriteriaOperator.Parse(jobDataMap.GetString <ThresholdJobDetailDataMap>(map => map.Criteria)));
            }
            jobDataMap.Put <ThresholdJobDetailDataMap>(ThresholdCalcCount, count);
        }
コード例 #28
0
        private void SimpleActionImport_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            objectSpaceProvider             = Application.ObjectSpaceProvider;
            objectSpace                     = Application.CreateObjectSpace(typeof(ParametrosImportSpoolJuntaExcel));
            parametrosImportComponentEJunta = objectSpace.CreateObject <ParametrosImportComponentEJunta>();
            DetailView view = Application.CreateDetailView(objectSpace, parametrosImportComponentEJunta);

            view.ViewEditMode = ViewEditMode.Edit;

            e.ShowViewParameters.NewWindowTarget = NewWindowTarget.Separate;
            e.ShowViewParameters.CreatedView     = view;
            e.ShowViewParameters.TargetWindow    = TargetWindow.NewModalWindow;
            e.ShowViewParameters.Controllers.Add(dialogControllerAcceptingImportarPlanilha());
        }
コード例 #29
0
        public static void DeleteAllData(this IObjectSpaceProvider objectSpaceProvider)
        {
            using (var objectSpace = objectSpaceProvider.CreateUpdatingObjectSpace(true)){
                var dbConnection = ((ConnectionProviderSql)((BaseDataLayer)((XPObjectSpace)objectSpace).Session.DataLayer).ConnectionProvider).Connection;
                using (var dbCommand = dbConnection.CreateCommand()){
                    dbCommand.CommandText = @"
        EXEC sp_MSForEachTable ""ALTER TABLE ? NOCHECK CONSTRAINT all""
        EXEC sp_MSForEachTable ""DELETE FROM ?""
        exec sp_MSForEachTable ""ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all""
";
                    dbCommand.ExecuteNonQuery();
                }
                objectSpaceProvider.UpdateSchema();
            }
        }
コード例 #30
0
        public bool InitConnection(string userName, string password)
        {
            AuthenticationStandardLogonParameters parameters = new AuthenticationStandardLogonParameters(userName, password);
            SecurityStrategyComplex security            = GetSecurity(typeof(AuthenticationStandardProvider).Name, parameters);
            IObjectSpaceProvider    objectSpaceProvider = GetObjectSpaceProvider(security);

            try {
                Login(security, objectSpaceProvider);
                SignIn(contextAccessor.HttpContext, userName);
                return(true);
            }
            catch {
                return(false);
            }
        }
コード例 #31
0
        public static void NewAuthentication <TAuth>(this IObjectSpaceProvider objectSpaceProvider, Action <TAuth, byte[]> saveToken, string serviceName, Platform platform = Platform.Win) where TAuth : CloudOfficeBaseObject
        {
            using var manifestResourceStream = File.OpenRead($"{AppDomain.CurrentDomain.ApplicationPath()}\\{serviceName}AuthenticationData{platform}.json");
            var token = Encoding.UTF8.GetBytes(new StreamReader(manifestResourceStream).ReadToEnd());

            using var objectSpace = objectSpaceProvider.CreateObjectSpace();
            var authenticationOid = (Guid)objectSpace.GetKeyValue(SecuritySystem.CurrentUser);

            if (objectSpace.GetObjectByKey <TAuth>(authenticationOid) == null)
            {
                var authentication = objectSpace.CreateObject <TAuth>();
                authentication.Oid = authenticationOid;
                saveToken(authentication, token);
                objectSpace.CommitChanges();
            }
        }
コード例 #32
0
 public ScheduledWorkflowDefinitionProvider(Type workflowDefinitionType, IObjectSpaceProvider objectSpaceProvider) : base(workflowDefinitionType, objectSpaceProvider) { }
コード例 #33
0
        public StartWorkflowOnObjectChangeService(TimeSpan requestsDetectionPeriod, IObjectSpaceProvider objectSpaceProvider)
            : base(requestsDetectionPeriod, objectSpaceProvider) {

        }
コード例 #34
0
 public UserController(IObjectSpaceProvider osProvider)
 {
     _OsProvider = osProvider;
 }
コード例 #35
0
 public XpandWorkflowServer(string baseUri, IObjectSpaceProvider servicesObjectSpaceProvider, IObjectSpaceProvider activitiesObjectSpaceProvider)
     : base(baseUri, servicesObjectSpaceProvider, activitiesObjectSpaceProvider) {
     CreateServices();
 }