Ejemplo n.º 1
0
 private void OWLConfigurationForm_Load(object sender, EventArgs e)
 {
     BL.DatabaseMap databaseMap = new BL.DatabaseMap();
     for (int i = 0; i < databaseMap.DatabaseMaps.Count; i++)
     {
         cmbMappings.Items.Add(databaseMap.DatabaseMaps[i].Attribute(XName.Get("name")).Value);
     }
 }
Ejemplo n.º 2
0
 private void btnManualTransfer_Click(object sender, EventArgs e)
 {
     BL.DatabaseMap databaseMap = new BL.DatabaseMap();
     for (int i = 0; i < databaseMap.DatabaseMaps.Count; i++)
     {
         BL.DataTransfer dtransfer = new BL.DataTransfer();
         dtransfer.StartTransfer(databaseMap.DatabaseMaps[i]);
     }
 }
Ejemplo n.º 3
0
        private void cmbExistingMap_SelectedIndexChanged(object sender, EventArgs e)
        {
            //cleare nodes
            treeListViewMap.Nodes.Clear();
            //load selected definition to the map tree

            BL.DatabaseMap databaseMap = new BL.DatabaseMap();

            XElement xElement = databaseMap.DatabaseMaps.Find(x => x.FirstAttribute.Value == XName.Get(cmbExistingMap.Text));

            if (xElement != null)
            {
                loadTree(treeListViewMap, xElement);
            }
        }
Ejemplo n.º 4
0
        public DatabaseMappingForm()
        {
            InitializeComponent();

            this.treeListViewDatabase.Columns.Add(new CommonTools.TreeListColumn("name", "Name", 250));
            this.treeListViewDatabase.Columns.Add(new CommonTools.TreeListColumn("type", "Type", 75));
            this.treeListViewDatabase.Columns.Add(new CommonTools.TreeListColumn("size", "Size", 75));
            this.treeListViewDatabase.Images = new ImageList();
            this.treeListViewDatabase.Images.Images.AddStrip(Resources.DataTable);
            this.treeListViewDatabase.Images.Images.AddStrip(Resources.DataRow);

            this.treeListViewStagingDatabase.Columns.Add(new CommonTools.TreeListColumn("name", "Name", 250));
            this.treeListViewStagingDatabase.Columns.Add(new CommonTools.TreeListColumn("type", "Type", 75));
            this.treeListViewStagingDatabase.Columns.Add(new CommonTools.TreeListColumn("size", "Size", 75));
            this.treeListViewStagingDatabase.Images = new ImageList();
            this.treeListViewStagingDatabase.Images.Images.AddStrip(Resources.DataTable);
            this.treeListViewStagingDatabase.Images.Images.AddStrip(Resources.DataRow);

            this.treeListViewMap.Columns.Add(new CommonTools.TreeListColumn("nameFrom", "Name From", 250));
            this.treeListViewMap.Columns.Add(new CommonTools.TreeListColumn("typeFrom", "Type From", 75));
            this.treeListViewMap.Columns.Add(new CommonTools.TreeListColumn("nameTo", "Name To", 250));
            this.treeListViewMap.Columns.Add(new CommonTools.TreeListColumn("typeTo", "Type To", 75));
            this.treeListViewMap.Images = new ImageList();
            this.treeListViewMap.Images.Images.AddStrip(Resources.rdf_icon);
            this.treeListViewMap.Images.Images.AddStrip(Resources.rdf_foldr);

            this.openFileDialog1.AddExtension    = true;
            this.openFileDialog1.CheckFileExists = true;
            this.openFileDialog1.CheckPathExists = true;
            this.openFileDialog1.DefaultExt      = "*.owl";
            this.openFileDialog1.Multiselect     = false;
            this.openFileDialog1.Title           = "Select Resoruce Description File";
            this.openFileDialog1.AddExtension    = true;
            this.openFileDialog1.Filter          = "Web Ontology Language (*.owl)|*.owl|All files (*.*)|*.*";
            this.openFileDialog1.FileName        = "Select a file ...";
            this.openFileDialog1.ValidateNames   = true;

            BL.DatabaseMap databaseMap = new BL.DatabaseMap();
            for (int i = 0; i < databaseMap.DatabaseMaps.Count; i++)
            {
                cmbExistingMap.Items.Add(databaseMap.DatabaseMaps[i].Attribute(XName.Get("name")).Value);
            }
        }
Ejemplo n.º 5
0
 private void cmbMappings_SelectedIndexChanged(object sender, EventArgs e)
 {
     BL.DatabaseMap         databaseMap  = new BL.DatabaseMap();
     BL.ResourceDescription ResourceDesc = new BL.ResourceDescription(databaseMap.DatabaseMaps[cmbMappings.SelectedIndex]);
     txtRDFPath.Text = ResourceDesc.OWLResource.Path;
 }
Ejemplo n.º 6
0
        private void btnGenerateMapFile_Click(object sender, EventArgs e)
        {
            bool isExistingMapSelected = false;

            if (cmbExistingMap.Text == String.Empty)
            {
                MessageBox.Show("Select map name from list or type name for new map...");
                return;
            }

            if (!DatabaseMappingForm.isValid.HasValue)
            {
                MessageBox.Show("Mapping has not check for validation!, Please click Validate button to check", "Validation requires");
                return;
            }

            if (!DatabaseMappingForm.isValid.Value)
            {
                MessageBox.Show("Mapping is not valid!, Please click Validate button to display invalid parts", "is not Valid");
                return;
            }

            if (cmbExistingMap.SelectedIndex != -1)
            {
                if (MessageBox.Show("Existing map will destroy,are you sure?", "Existing Map Confirmation", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                isExistingMapSelected = true;
            }

            BL.DatabaseMap databaseMap = new BL.DatabaseMap();


            if (isExistingMapSelected)
            {
                //delete map from DatabaseMap.xml
                XElement _deleteElement = databaseMap.DatabaseMaps.Find(x => x.Attribute(XName.Get("name")).Value.Contains(cmbExistingMap.Text));
                databaseMap.DatabaseMaps.Remove(_deleteElement);
                databaseMap.Save();
            }

            //insert DatabaseMap object
            XElement _newElement = new XElement("DatabaseMap", new XAttribute("name", cmbExistingMap.Text));

            //Source
            _newElement.Add(new XElement("Database", new XAttribute("type", "source"), new XAttribute("connectionString", txtSourceConnectionString.Text)));
            //Staging
            _newElement.Add(new XElement("Database", new XAttribute("type", "staging"), new XAttribute("connectionString", txtStagingDatabaseConnectionString.Text)));
            //OWL File Path
            _newElement.Add(new XElement("OWL", new XAttribute("type", "file"), new XAttribute("path", txtOWLFilePath.Text)));
            //Tables
            foreach (Node table in treeListViewMap.Nodes)
            {
                XElement _newTableElement = new XElement("Table", new XAttribute("name", table[0]));
                foreach (Node map in table.Nodes)
                {
                    _newTableElement.Add(new XElement("Map", new XAttribute("from", map[0]), new XAttribute("fromtype", map[1]), new XAttribute("to", map[2]), new XAttribute("totype", map[3])));
                }

                _newElement.Add(_newTableElement);
            }

            databaseMap.DatabaseMaps.Add(_newElement);
            databaseMap.Save();

            BL.OWLConfiguration owlConfiguration = new BL.OWLConfiguration();

            //insert OWLConfiguration object
            _newElement = new XElement("OWLConfiguration");
            //Staging
            _newElement.Add(new XElement("Database", new XAttribute("type", "staging"), new XAttribute("connectionString", txtStagingDatabaseConnectionString.Text)));
            //OWL Item
            _newElement.Add(new XElement("OWLItem", new XAttribute("type", "Accurate"), new XAttribute("low", "-1"), new XAttribute("medium", "-1"), new XAttribute("high", "-1"), new XAttribute("businessrequired", "-1"), new XAttribute("businessrecommend", "-1"), new XAttribute("noconstraint", "-1")));

            owlConfiguration.OWLConfigurations.RemoveRange(0, owlConfiguration.OWLConfigurations.Count);
            owlConfiguration.OWLConfigurations.Add(_newElement);
            owlConfiguration.Save();

            MessageBox.Show(cmbExistingMap.Text + " is generated.");
        }