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(); } }
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(); } } }
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(); } }
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(); } }
public static IObservable <GraphServiceClient> NewGraphServiceClient(this IObjectSpaceProvider objectSpaceProvider) { return(ServiceProvider.ClientAppBuilder.Authorize(cache => { var newMicrosoftAuthentication = objectSpaceProvider.NewMicrosoftAuthentication(); return cache.SynchStorage(objectSpaceProvider.CreateObjectSpace, newMicrosoftAuthentication); })); }
public LoginForm(SecurityStrategyComplex security, IObjectSpaceProvider objectSpaceProvider, string userName) { InitializeComponent(); this.security = security; this.objectSpaceProvider = objectSpaceProvider; userNameEdit.Text = userName; }
protected DBUpdaterBase(string keyPropertyName) { RegisterEntitiesCore(); updatingObjectSpaceProvider = CreateUpdatingObjectSpaceProvider(); updatingObjectSpaceProvider.UpdateSchema(); this.keyPropertyName = keyPropertyName; }
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"))); }
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); }
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)); }
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); }
static IObjectSpaceProvider GetObjectSpaceProvider() { if (ObjectSpaceProvider == null) { ObjectSpaceProvider = new SecuredObjectSpaceProvider(Security, ConnectionString, null); } return(ObjectSpaceProvider); }
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(); }
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"); }
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(); }
public EcmUseCaseBaseTests() { ObjectSpaceProvider = new XPObjectSpaceProvider(new MemoryDataStoreProvider()); Application = new TestApplication(); IagXafExtEcmModule module = new IagXafExtEcmModule(); Application.Modules.Add(module); Application.Setup("TestApplication", ObjectSpaceProvider); }
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)); }
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(); }
private void Login(SecurityStrategyComplex security, IObjectSpaceProvider objectSpaceProvider) { try { IObjectSpace objectSpace = objectSpaceProvider.CreateObjectSpace(); security.Logon(objectSpace); } catch (Exception ex) { } }
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()); }
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(); }
public static UnitOfWork CreateUnitOfWork(this IObjectSpaceProvider objectSpaceProvider) { var os = objectSpaceProvider.CreateObjectSpace(); if (os is XPObjectSpace) { return((os as XPObjectSpace).Session as UnitOfWork); } return(null); }
private WorldCreatorApplication GetWorldCreatorApplication(IObjectSpaceProvider provider, ModuleList list) { var customWorldCreatorApplicationArgs = new CustomWorldCreatorApplicationArgs { ObjectSpaceProvider = provider, Modules = list }; OnCustomWorldCreatorApplication(customWorldCreatorApplicationArgs); return(customWorldCreatorApplicationArgs.WorldCreatorApplication ?? new WorldCreatorApplication(provider, list)); }
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:" } }; }
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); } } }
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); }
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()); }
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(); } }
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); } }
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(); } }
public ScheduledWorkflowDefinitionProvider(Type workflowDefinitionType, IObjectSpaceProvider objectSpaceProvider) : base(workflowDefinitionType, objectSpaceProvider) { }
public StartWorkflowOnObjectChangeService(TimeSpan requestsDetectionPeriod, IObjectSpaceProvider objectSpaceProvider) : base(requestsDetectionPeriod, objectSpaceProvider) { }
public UserController(IObjectSpaceProvider osProvider) { _OsProvider = osProvider; }
public XpandWorkflowServer(string baseUri, IObjectSpaceProvider servicesObjectSpaceProvider, IObjectSpaceProvider activitiesObjectSpaceProvider) : base(baseUri, servicesObjectSpaceProvider, activitiesObjectSpaceProvider) { CreateServices(); }