Exemplo n.º 1
0
		private void Test_CodeGeneratorCommand() {
			try {
				Trace.WriteLine("Create a new project and generate using OREntity...");
				Trace.Indent();
				Project p = new Project();
				p.Save(".\\test\\output\\test_ncodegencommandproject_01.ch3");
				p.MetadataBaseDir = "..\\";
				p.TemplatePackageBaseDir = "..\\";
				p.OutputBaseDir = "..\\Output";
				MetadataFile mf = new MetadataFile(p, "UsuarioInformatica.xml");
				p.MetadataFiles.Add(mf);
				CodeGeneratorCommand gc = new CodeGeneratorCommand();
				p.GeneratorCommands.Add(gc);
				gc.IndividualMetadataFiles.Add(p.MetadataFiles[0]);
				gc.Package = "TEST_NCODEGEN_PACKAGE";
				gc.Template = "SPs_CRUD_Object";
				p.GeneratorCommands.Add(gc);
				gc.InputParameters.Add("FileNamePartial", "NCodeGen_Output_01");
				gc.OutputPath = "test_${FileNamePartial}.sql";
				p.Save();
				gc.Execute();
				// UNDONE: need to test whether files were outputted correctly

				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}

		}
Exemplo n.º 2
0
		private void NewProject() {
			if (!CloseDocuments()) {
				return;
			}
			if (!DoSaveConfirmation()) {
				return;
			}
			VerifyOpenProject();


//			// TEMP
//			(new ProjectNew()).ShowDialog();
//			return;
//			// END TEMP


			SaveFileDialog dlg = new SaveFileDialog();
			dlg.Title = "New Project...";
			dlg.Filter = "CH3ETAH Project Files (.CH3)|*.ch3|All Files (*.*)|*.*";
			if (dlg.ShowDialog(this) == DialogResult.OK) {
				_project = new Project();
				_project.Save(dlg.FileName);
				Directory.SetCurrentDirectory(Path.GetDirectoryName(dlg.FileName));
			}
			else {
				return;
			}
			RefreshUI();
		}
Exemplo n.º 3
0
//		private void Test_MetadataFiles() {
//			try {
//				Trace.WriteLine("Create a new, non-branded metadata file and save...");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile();
//				f.MetadataEntities.Add(new XmlMetadataEntity());
//				XmlMetadataEntity en = (XmlMetadataEntity) f.MetadataEntities[0];
//				en.XmlNode = (new XmlDocument()).CreateElement("Books");
//				en.XmlNode.InnerXml = "<book price=\"100.00\"/>";
//				f.Save(".\\test\\output\\test_create.xml");
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//			try {
//				Trace.WriteLine("Load a non-branded metadata file and save as...");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile(null, ".\\test\\output\\test_create.xml");
//				f.Save(".\\test\\output\\test_loadsaveas.xml");
//
//				// UNDONE: need to test whether files are identical
//
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//			try {
//				Trace.WriteLine("Load plain XML file and save as....");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile(null, ".\\test\\raw.xml");
//				f.Save(".\\test\\output\\test_rawsaveas.xml");
//
//				// UNDONE: need to test whether files are identical
//				// this can be a seperate method which takes source and dest file names
//
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//
//			// Create branded metadata file and save
//
//			// Load a branded metadata file and save as
//
//			// Create mixed (branded/not branded) metadata file and save
//
//			// Load a mixed (branded/not branded) metadata file and save as
//
//		}
//

		#endregion Metadata Files

		#region Project

		private void Test_Project() {
			try {
				Trace.WriteLine("Create a new project and save...");
				Trace.Indent();
				Project p = new Project();
				p.Save(".\\test\\output\\test_projectcreate.ch3");
				p.MetadataBaseDir = "..\\";
				MetadataFile mf = new MetadataFile(p, "raw.xml");
				p.MetadataFiles.Add(mf);
				CodeGeneratorCommand gc = new CodeGeneratorCommand();
				p.GeneratorCommands.Add(gc);
				gc.IndividualMetadataFiles.Add(p.MetadataFiles[0]);
// 				gc.GroupedMetadataFiles.Add(p.MetadataFiles[0]);
				gc.Package = "CSLA";
				gc.Template = "SP_S_Object_By_Index";
				p.Save();
				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}

			try {
				Trace.WriteLine("Load project file and save as...");
				Trace.Indent();
				Project p = Project.Load(".\\test\\output\\test_projectcreate.ch3");
				p.Save(".\\test\\output\\test_projectsaveas.ch3");

				// UNDONE: need to test whether files are identical

				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}
		}