Ejemplo n.º 1
0
		public virtual void Init()
		{
			WorkspaceService = new WorkspaceService(Constants.ApiToken);
			var workspaces = WorkspaceService.List();

			ClientService = new ClientService(Constants.ApiToken);
			TaskService = new TaskService(Constants.ApiToken);
			TagService = new TagService(Constants.ApiToken);
			ProjectService = new ProjectService(Constants.ApiToken);
			UserService = new UserService(Constants.ApiToken);
			TimeEntryService = new TimeEntryService(Constants.ApiToken);
			ReportService = new ReportService(Constants.ApiToken);

			foreach (var workspace in workspaces)
			{
				var projects = WorkspaceService.Projects(workspace.Id.Value);
				var tasks = WorkspaceService.Tasks(workspace.Id.Value);
				var tags = WorkspaceService.Tags(workspace.Id.Value); // TODO
				var users = WorkspaceService.Users(workspace.Id.Value); // TODO
				var clients = WorkspaceService.Clients(workspace.Id.Value);
				var rte = new TimeEntryParams { StartDate = DateTime.Now.AddYears(-1)};
				var timeEntries = TimeEntryService.List(rte);

				Assert.IsTrue(TimeEntryService.DeleteIfAny(timeEntries.Select(te => te.Id.Value).ToArray()));
				Assert.IsTrue(ProjectService.DeleteIfAny(projects.Select(p => p.Id.Value).ToArray()));				
				Assert.IsTrue(TaskService.DeleteIfAny(tasks.Select(t => t.Id.Value).ToArray()));
				Assert.IsTrue(ClientService.DeleteIfAny(clients.Select(c => c.Id.Value).ToArray()));

				Assert.IsFalse(WorkspaceService.Projects(workspace.Id.Value).Any());
				Assert.IsFalse(WorkspaceService.Tasks(workspace.Id.Value).Any());
				Assert.IsFalse(WorkspaceService.Clients(workspace.Id.Value).Any());
				Assert.IsFalse(TimeEntryService.List(rte).Any());
			}

			DefaultWorkspaceId = workspaces.First().Id.Value;
		}
Ejemplo n.º 2
0
        public void ProjectChanged(Workspace project)
        {
            _designerViewModel = null;

            _workspaceService = null;

            DiagramDrawer = null;

            if (project.CurrentGraph != null)
            {
                LoadDiagram(project.CurrentGraph);
            }
            else
            {

            }
        }
Ejemplo n.º 3
0
        public void Test_Bulk_Import_With_Sequence_X_Table()
        {
            //arrange - prepare bulk destination table
            var directoryService = new DirectoryService();
            var fileService      = new FileService();
            var workspaceService = new WorkspaceService(_traceService, directoryService, fileService);

            workspaceService.Init(_testConfiguration.WorkspacePath);

            workspaceService.IncrementMajorVersion(_testConfiguration.WorkspacePath, null);
            string v100Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.00");

            _testDataService.CreateScriptFile(Path.Combine(v100Directory, $"TestCsv.sql"), _testDataService.GetSqlForCreateBulkTable(TEST_DBOBJECTS.TestCsv));

            //act
            var configuration = _testConfiguration.GetFreshConfiguration();

            configuration.TargetVersion = "v1.00";

            var migrationService = _migrationServiceFactory.Create(configuration.Platform);

            migrationService.Run();

            //assert
            _testDataService.CheckIfDbObjectExist(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsv).ShouldBeTrue();

            //arrange - add new minor version with csv files
            workspaceService.IncrementMinorVersion(_testConfiguration.WorkspacePath, null);
            string v101Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.01");

            //deliverately create csv files out of order
            File.Copy(Path.Combine(Path.Combine(Environment.CurrentDirectory, "Data"), "TestCsv.csv"), Path.Combine(v101Directory, "2.TestCsv.csv"));
            File.Copy(Path.Combine(Path.Combine(Environment.CurrentDirectory, "Data"), "TestCsv.csv"), Path.Combine(v101Directory, "1.TestCsv.csv"));
            File.Copy(Path.Combine(Path.Combine(Environment.CurrentDirectory, "Data"), "TestCsv.csv"), Path.Combine(v101Directory, "3.TestCsv.csv"));

            //act
            configuration.TargetVersion = "v1.01";
            migrationService.Run();

            //assert
            _testDataService.CheckIfDbObjectExist(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsv).ShouldBeTrue();

            var results      = _testDataService.GetBulkTestData(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsv);
            var testDataRows = new List <BulkTestDataRow>
            {
                new BulkTestDataRow {
                    FirstName = "Jack", LastName = "Poole", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Diana", LastName = "Churchill", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Rebecca", LastName = "Lyman", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Sam", LastName = "Macdonald", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Matt", LastName = "Paige", BirthDate = "1980-01-01"
                },
            };

            results.Count.ShouldBe(15);
            testDataRows.All(t => results.Exists(r =>
                                                 t.FirstName == r.FirstName &&
                                                 t.LastName == r.LastName &&
                                                 t.BirthDate == r.BirthDate
                                                 )).ShouldBeTrue();
        }
Ejemplo n.º 4
0
        public void Test_Bulk_Import_With_Utf8_Encoded_File()
        {
            //arrange - pre-create destination bulk tables
            var directoryService = new DirectoryService();
            var fileService      = new FileService();
            var workspaceService = new WorkspaceService(_traceService, directoryService, fileService);

            workspaceService.Init(_testConfiguration.WorkspacePath);

            workspaceService.IncrementMajorVersion(_testConfiguration.WorkspacePath, null);
            string v100Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.00");

            _testDataService.CreateScriptFile(Path.Combine(v100Directory, $"TestCsvUtf8.sql"), _testDataService.GetSqlForCreateBulkTable(TEST_DBOBJECTS.TestCsvUtf8));

            //act
            var configuration = _testConfiguration.GetFreshConfiguration();

            configuration.TargetVersion = "v1.00";

            var migrationService = _migrationServiceFactory.Create(configuration.Platform);

            migrationService.Run();

            //assert
            _testDataService.CheckIfDbObjectExist(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsvUtf8).ShouldBeTrue();

            //arrange - add new version with csv files
            workspaceService.IncrementMinorVersion(_testConfiguration.WorkspacePath, null);
            string v101Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.01");

            File.Copy(Path.Combine(Path.Combine(Environment.CurrentDirectory, "Data"), "TestCsvUtf8.csv"), Path.Combine(v101Directory, "TestCsvUtf8.csv"));

            //act - bulk load csv files
            configuration.TargetVersion        = "v1.01";
            configuration.IsAutoCreateDatabase = true;
            migrationService.Run();

            //assert
            var results      = _testDataService.GetBulkTestData(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsvUtf8);
            var testDataRows = new List <BulkTestDataRow>
            {
                new BulkTestDataRow {
                    FirstName = "Allan", LastName = "Søgaard", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Martin", LastName = "Bæk", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Gitte", LastName = "Jürgensen", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Maria", LastName = "Østergård", BirthDate = "1980-01-01"
                },
                new BulkTestDataRow {
                    FirstName = "Peter", LastName = "Langkjær", BirthDate = "1980-01-01"
                },
            };

            results.Count.ShouldBe(5);
            testDataRows.All(t => results.Exists(r =>
                                                 t.FirstName == r.FirstName &&
                                                 t.LastName == r.LastName &&
                                                 t.BirthDate == r.BirthDate
                                                 )).ShouldBeTrue();
        }
Ejemplo n.º 5
0
        public void Test_Bulk_Import_Mismatch_Columns_But_Nullable()
        {
            //arrange - pre-create destination bulk tables
            var directoryService = new DirectoryService();
            var fileService      = new FileService();
            var workspaceService = new WorkspaceService(_traceService, directoryService, fileService);

            workspaceService.Init(_testConfiguration.WorkspacePath);

            workspaceService.IncrementMajorVersion(_testConfiguration.WorkspacePath, null);
            string v100Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.00");

            _testDataService.CreateScriptFile(Path.Combine(v100Directory, $"TestCsvMismatchColumn.sql"), _testDataService.GetSqlForCreateBulkTable(TEST_DBOBJECTS.TestCsvMismatchColumn));

            //act
            var configuration = _testConfiguration.GetFreshConfiguration();

            configuration.TargetVersion = "v1.00";

            var migrationService = _migrationServiceFactory.Create(configuration.Platform);

            migrationService.Run();

            //assert
            _testDataService.CheckIfDbObjectExist(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsvMismatchColumn).ShouldBeTrue();

            //arrange - add new version with csv files
            workspaceService.IncrementMinorVersion(_testConfiguration.WorkspacePath, null);
            string v101Directory = Path.Combine(_testConfiguration.WorkspacePath, "v1.01");

            File.Copy(Path.Combine(Path.Combine(Environment.CurrentDirectory, "Data"), "TestCsvMismatchColumn.csv"), Path.Combine(v101Directory, "TestCsvMismatchColumn.csv"));

            //act - bulk load csv files
            configuration.TargetVersion = "v1.01";
            migrationService.Run();

            var results      = _testDataService.GetBulkTestData(_testConfiguration.ConnectionString, TEST_DBOBJECTS.TestCsvMismatchColumn);
            var testDataRows = new List <BulkTestDataRow>
            {
                new BulkTestDataRow {
                    FirstName = "Jack", LastName = "Poole"
                },
                new BulkTestDataRow {
                    FirstName = "Diana", LastName = "Churchill"
                },
                new BulkTestDataRow {
                    FirstName = "Rebecca", LastName = "Lyman"
                },
                new BulkTestDataRow {
                    FirstName = "Sam", LastName = "Macdonald"
                },
                new BulkTestDataRow {
                    FirstName = "Matt", LastName = "Paige"
                },
            };

            results.Count.ShouldBe(5);
            testDataRows.All(t => results.Exists(r =>
                                                 t.FirstName == r.FirstName &&
                                                 t.LastName == r.LastName &&
                                                 string.IsNullOrEmpty(r.BirthDate)
                                                 )).ShouldBeTrue();
        }
 public CodeActionHandler(ILoggerFactory factory, AnalysisService analysisService, WorkspaceService workspaceService)
 {
     _logger              = factory.CreateLogger <TextDocumentHandler>();
     _analysisService     = analysisService;
     _workspaceService    = workspaceService;
     _registrationOptions = new CodeActionRegistrationOptions
     {
         DocumentSelector = LspUtils.PowerShellDocumentSelector,
         CodeActionKinds  = s_supportedCodeActions
     };
 }
 internal QueryExecutionService(ConnectionService connService, WorkspaceService <SqlToolsSettings> workspaceService)
 {
     ConnectionService = connService;
     WorkspaceService  = workspaceService;
     Settings          = new SqlToolsSettings();
 }
Ejemplo n.º 8
0
 public ResourceGridRowViewModel(WorkspaceService workspace, ResourceId resourceId)
 {
     Workspace  = workspace;
     ResourceId = resourceId;
 }
        public MonoreportsDesignerControl()
        {
            Build();
            dpi = Gdk.Screen.Default.Resolution;

            Report startReport = new Report()
            {
                DataScript = @"
datasource = new [] {
     new { Name=""Alfred"", Surname = ""Tarski"", Age = ""82"" },
     new { Name=""Saul"", Surname = ""Kripke"", Age = ""70"" },
     new { Name=""Gotlob"", Surname = ""Frege"", Age = ""85"" },
     new { Name=""Kurt"", Surname = ""Gödel"", Age = ""72"" }, 
};

parameters.Add(""Title"",new { Title = ""The Logicans"", SubTitle = ""...and philosophers...""});

"
            };


            string template = @"
using System;
using System.Collections.Generic;
{0}

public sealed class GenerateDataSource {{
    public object Generate()
    {{ 
		object datasource = null;
		Dictionary<string,object> parameters = new Dictionary<string,object>();
		 {1}
        return new object[] {{datasource,parameters}};
    }}
}}

";



            compilerService  = new CompilerService(template);
            workspaceService = new WorkspaceService(this, maindesignview1.DesignDrawingArea, maindesignview1.PreviewDrawingArea, mainPropertygrid, StatusBarLabel);

            designService  = new DesignService(workspaceService, compilerService, startReport);
            toolBoxService = new ToolBoxService();
            designService.ToolBoxService     = toolBoxService;
            maindesignview1.DesignService    = designService;
            maindesignview1.WorkSpaceService = workspaceService;
            maindesignview1.Compiler         = compilerService;

            var reportRenderer = new ReportRenderer();

            reportRenderer.RegisterRenderer(typeof(Controls.TextBlock), new TextBlockRenderer()
            {
                DPI = dpi
            });
            reportRenderer.RegisterRenderer(typeof(Controls.Line), new LineRenderer()
            {
                DPI = dpi
            });
            reportRenderer.RegisterRenderer(typeof(MonoReports.Model.Controls.Image), new ImageRenderer()
            {
                PixbufRepository = designService.PixbufRepository, DPI = dpi
            });
            SectionRenderer sr = new SectionRenderer()
            {
                DPI = dpi
            };

            reportRenderer.RegisterRenderer(typeof(Controls.ReportHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.ReportFooterSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.DetailSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageFooterSection), sr);

            maindesignview1.ReportRenderer = reportRenderer;
            workspaceService.InvalidateDesignArea();
            reportExplorer.DesignService = designService;
            reportExplorer.Workspace     = workspaceService;
            toolBoxService.AddTool(new ZoomTool(designService));
            toolBoxService.AddTool(new LineTool(designService));
            toolBoxService.AddTool(new LineToolV(designService));
            toolBoxService.AddTool(new LineToolH(designService));

            toolBoxService.AddTool(new TextBlockTool(designService));
            toolBoxService.AddTool(new SubreportTool(designService));
            toolBoxService.AddTool(new SectionTool(designService));
            toolBoxService.AddTool(new ImageTool(designService));
            toolBoxService.AddTool(new RectTool(designService));
            toolBoxService.BuildToolBar(mainToolbar);


            ToolBarButton exportPdfToolButton = new ToolBarButton("pdf.png", "exportPdf", "export to pdf");

            exportPdfToolButton.Clicked += delegate(object sender, EventArgs e) {
                designService.ExportToPdf();
            };


            mainToolbar.Insert(exportPdfToolButton, 7);

            mainPropertygrid.LoadMonoreportsExtensions();
        }
 public ReferencesHandler(ILoggerFactory factory, SymbolsService symbolsService, WorkspaceService workspaceService)
 {
     _logger           = factory.CreateLogger <ReferencesHandler>();
     _symbolsService   = symbolsService;
     _workspaceService = workspaceService;
 }
Ejemplo n.º 11
0
 public NavbarViewComponent(IRepository <Workspace> workspaceRepository)
 {
     this._workspaceRepository = workspaceRepository;
     _workspaceService         = new WorkspaceService(_workspaceRepository);
 }
Ejemplo n.º 12
0
 public DocumentRangeFormattingHandler(ILoggerFactory factory, AnalysisService analysisService, ConfigurationService configurationService, WorkspaceService workspaceService)
 {
     _logger               = factory.CreateLogger <DocumentRangeFormattingHandler>();
     _analysisService      = analysisService;
     _configurationService = configurationService;
     _workspaceService     = workspaceService;
 }