private void btnConnect_Click(object sender, RoutedEventArgs e) { if (System.IO.Directory.Exists(cmbDBPath.Text)) { if (!cmbDBPath.Items.Contains(cmbDBPath.Text)) { cmbDBPath.Items.Add(cmbDBPath.Text); SiaqodbConfigurator.EncryptedDatabase = false; Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory); siaqodbConfig.StoreObject(new ConnectionItem(cmbDBPath.Text)); siaqodbConfig.Close(); EncryptionSettings.SetEncryptionSettings();//set back settings } siaqodb = Sqo.Internal._bs._b(cmbDBPath.Text); siaqodbList = siaqodb.GetAllTypes(); treeView1.Items.Clear(); ContextMenu cm = new ContextMenu(); MenuItem mitem = new MenuItem(); mitem.Header = "Load objects"; cm.Items.Add(mitem); mitem.Click += new RoutedEventHandler(mitem_Click); foreach (Sqo.MetaType mt in siaqodbList) { Sqo.Internal._bs._sdbfn(siaqodb, mt, mt.FileName); ImageTreeViewItem nodeType = new ImageTreeViewItem(); nodeType.Tag = mt; nodeType.Text = mt.Name; nodeType.SelectedImage = ImageTreeViewItem.Createimage(@"pack://*****:*****@"pack://application:,,/Resources/pubclass.gif"); nodeType.ContextMenu = cm; treeView1.Items.Add(nodeType); foreach (Sqo.MetaField mf in mt.Fields) { ImageTreeViewItem nodeField = new ImageTreeViewItem(); //nodeField.Header = mf.Name + "(" + mf.FieldType.ToString() + ")"; if (mf.FieldType != null) { nodeField.Text = mf.Name + "(" + mf.FieldType.ToString() + ")"; } else { nodeField.Text = mf.Name + "(ComplexType)"; } nodeField.SelectedImage = ImageTreeViewItem.Createimage(@"pack://*****:*****@"pack://application:,,/Resources/pubfield.gif"); nodeField.ContextMenu = null; nodeType.Items.Add(nodeField); } } btnDBInfo.IsEnabled = true; } else { MessageBox.Show("Select a valid folder path!"); } }
private void toolStripButton1_Click(object sender, EventArgs e) { //GC.Collect(); if (System.IO.Directory.Exists(cmbDBPath.Text)) { if (!cmbDBPath.Items.Contains(cmbDBPath.Text)) { cmbDBPath.ComboBox.Items.Add(cmbDBPath.Text); SiaqodbConfigurator.EncryptedDatabase = false; Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(Application.StartupPath); siaqodbConfig.StoreObject(new ConnectionItem(cmbDBPath.Text)); siaqodbConfig.Close(); EncryptionSettings.SetEncryptionSettings();//set back settings } siaqodb = Sqo.Internal._bs._b(cmbDBPath.Text); siaqodbList = siaqodb.GetAllTypes(); treeView1.Nodes.Clear(); foreach (Sqo.MetaType mt in siaqodbList) { TreeNode nodeType = new TreeNode(mt.Name); nodeType.Tag = mt; nodeType.ImageIndex = 0; nodeType.SelectedImageIndex = 0; nodeType.ContextMenuStrip = this.contextMenuStrip1; treeView1.Nodes.Add(nodeType); foreach (Sqo.MetaField mf in mt.Fields) { TreeNode nodeField = new TreeNode(); if (mf.FieldType != null) { nodeField.Text = mf.Name + "(" + mf.FieldType.ToString() + ")"; } else { nodeField.Text = mf.Name + "(ComplexType)"; } nodeField.ImageIndex = 1; nodeField.SelectedImageIndex = 1; nodeType.Nodes.Add(nodeField); } } } else { MessageBox.Show("Select a valid folder path!"); } }
private void btnOK_Click(object sender, EventArgs e) { if (Directory.Exists(Application.StartupPath)) { assemblies.Clear(); namespaces.Clear(); Sqo.Siaqodb siaqodb = new Sqo.Siaqodb(Application.StartupPath); try { siaqodb.DropType <ReferenceItem>(); siaqodb.DropType <NamespaceItem>(); foreach (object o in listBox1.Items) { ReferenceItem refItem = o as ReferenceItem; if (refItem == null) { refItem = new ReferenceItem(o.ToString()); } assemblies.Add(refItem); siaqodb.StoreObject(refItem); if (File.Exists(refItem.Item)) { try { File.Copy(refItem.Item, Application.StartupPath + Path.DirectorySeparatorChar + Path.GetFileName(refItem.Item), true); } catch { } } } foreach (string s in textBox1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { NamespaceItem nobj = new NamespaceItem(s); namespaces.Add(nobj); siaqodb.StoreObject(nobj); } } finally { siaqodb.Close(); } } this.DialogResult = DialogResult.OK; }
private void btnOK_Click(object sender, RoutedEventArgs e) { try { SiaqodbConfigurator.SetLicense(this.textBox1.Text); Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory); siaqodbConfig.Close(); TrialLicense.LicenseKey = textBox1.Text; this.licenseKey = textBox1.Text; this.DialogResult = true; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnOK_Click(object sender, EventArgs e) { try { SiaqodbConfigurator.SetTrialLicense(this.textBox1.Text); Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(Application.StartupPath); siaqodbConfig.Close(); TrialLicense.LicenseKey = textBox1.Text; this.licenseKey = textBox1.Text; this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { //in the folder ..\..\database\ there it is saved Company objects with Siaqodb 4.X //Now we'll migrate those objects to Siaqodb 5.0 Sqo.Siaqodb siaqodb5 = new Sqo.Siaqodb(@"..\..\database\"); siaqodb5.DropType <Company>(); SiaqodbUtil.Migrate(siaqodb5); var all5 = siaqodb5.LoadAll <Company>(); if (all5.Count == 10) { Console.WriteLine("All objects are migrated to Siaqodb 5.0 database."); } else { Console.WriteLine("Something wrong with the migration process or you imported twice or more."); } siaqodb5.Close(); //you can still see Siaqodb 4.X objects by using Dotissi namespace //This is just for backward compatibility, it should not be used for other scopes Dotissi.Siaqodb siaqodb4 = new Dotissi.Siaqodb(@"..\..\database\"); var all4 = siaqodb4.LoadAll <Company>(); if (all4.Count == 10) { Console.WriteLine("All objects of Siaqodb 4.X are still here... "); } else { Console.WriteLine("Something wrong and Siaqodb4.X objects cannot be find anymore."); } Console.ReadLine(); }
private void AddReference_Load(object sender, EventArgs e) { if (Directory.Exists(Application.StartupPath)) { Sqo.Siaqodb siaqodb = new Sqo.Siaqodb(Application.StartupPath); try { Sqo.IObjectList <ReferenceItem> references = siaqodb.LoadAll <ReferenceItem>(); foreach (ReferenceItem refItem in references) { listBox1.Items.Add(refItem); } Sqo.IObjectList <NamespaceItem> namespacesItems = siaqodb.LoadAll <NamespaceItem>(); foreach (NamespaceItem nItem in namespacesItems) { textBox1.Text += nItem + Environment.NewLine; } } finally { siaqodb.Close(); } } }
private void Main_Shown(object sender, EventArgs e) { #if TRIAL string folder = Application.StartupPath; string trialFile = folder + System.IO.Path.DirectorySeparatorChar + "trial.lic"; if (System.IO.File.Exists(trialFile)) { string text = System.IO.File.ReadAllText(trialFile); try { SiaqodbConfigurator.SetTrialLicense(text); Sqo.Siaqodb siaqodbConfigTemp = new Sqo.Siaqodb(Application.StartupPath); siaqodbConfigTemp.Close(); TrialLicense.LicenseKey = text; } catch (Sqo.Exceptions.InvalidLicenseException ex) { MessageBox.Show(ex.Message); this.Close(); return; } catch (Exception ex) { MessageBox.Show(ex.Message); TrialLicenseFrm trialWnd = new TrialLicenseFrm(); if (trialWnd.ShowDialog() == DialogResult.OK) { string trialKey = trialWnd.GetLicenseKey(); System.IO.File.WriteAllText(trialFile, trialKey); } else { this.Close(); return; } } } else { TrialLicenseFrm trialWnd = new TrialLicenseFrm(); if (trialWnd.ShowDialog() == DialogResult.OK) { string trialKey = trialWnd.GetLicenseKey(); System.IO.File.WriteAllText(trialFile, trialKey); } else { this.Close(); return; } } #endif Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(Application.StartupPath); //siaqodbConfig.DropType<ConnectionItem>(); IObjectList <ConnectionItem> list = siaqodbConfig.LoadAll <ConnectionItem>(); foreach (ConnectionItem item in list) { cmbDBPath.ComboBox.Items.Add(item.Item); } siaqodbConfig.Close(); Sqo.Siaqodb siaqodbRef = new Sqo.Siaqodb(Application.StartupPath); Sqo.IObjectList <ReferenceItem> references = siaqodbRef.LoadAll <ReferenceItem>(); foreach (ReferenceItem refi in references) { if (File.Exists(refi.Item)) { try { File.Copy(refi.Item, Application.StartupPath + Path.DirectorySeparatorChar + Path.GetFileName(refi.Item), true); } catch { } } } siaqodbRef.Close(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (!System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config")) { try { System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config"); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } Sqo.SiaqodbConfigurator.SetLicense(@" qU3TtvA4T4L30VSlCCGUTfs6WUuPueit/9FCCI1GiibPxQvd8bEoB9DX1r6UtUUm"); #if TRIAL string folder = AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config"; string trialFile = folder + System.IO.Path.DirectorySeparatorChar + "trial.lic"; if (System.IO.File.Exists(trialFile)) { string text = System.IO.File.ReadAllText(trialFile); try { SiaqodbConfigurator.SetLicense(text); Sqo.Siaqodb siaqodbConfigTemp = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory); siaqodbConfigTemp.Close(); TrialLicense.LicenseKey = text; } catch (Sqo.Exceptions.InvalidLicenseException ex) { MessageBox.Show(ex.Message); this.Close(); return; } catch (Exception ex) { MessageBox.Show(ex.Message); SetTrialLicense trialWnd = new SetTrialLicense(); if (trialWnd.ShowDialog() == true) { string trialKey = trialWnd.GetLicenseKey(); System.IO.File.WriteAllText(trialFile, trialKey); } else { this.Close(); return; } } } else { SetTrialLicense trialWnd = new SetTrialLicense(); if (trialWnd.ShowDialog() == true) { string trialKey = trialWnd.GetLicenseKey(); System.IO.File.WriteAllText(trialFile, trialKey); } else { this.Close(); return; } } #endif Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory); IObjectList <ConnectionItem> list = siaqodbConfig.LoadAll <ConnectionItem>(); foreach (ConnectionItem item in list) { cmbDBPath.Items.Add(item.Item); } siaqodbConfig.Close(); if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config")) { Sqo.Siaqodb siaqodbRef = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory + "\\config"); Sqo.IObjectList <ReferenceItem> references = siaqodbRef.LoadAll <ReferenceItem>(); foreach (ReferenceItem refi in references) { if (File.Exists(refi.Item)) { try { File.Copy(refi.Item, AppDomain.CurrentDomain.BaseDirectory + "\\" + System.IO.Path.GetFileName(refi.Item), true); } catch { } } } siaqodbRef.Close(); } DefaultDocument uq = new DefaultDocument(); uq.Title = "Start"; SetDefaultSettings(uq); uq.Show(this.dockingManager1); uq.Activate(); dockingManager1.ActiveDocumentChanged += new EventHandler(dockingManager1_ActiveDocumentChanged); dockingManager1.DocumentClosed += new EventHandler(dockingManager1_DocumentClosed); dockingManager1.DocumentClosing += new EventHandler <System.ComponentModel.CancelEventArgs>(dockingManager1_DocumentClosing); btnExecute.IsEnabled = false; menuExecute.IsEnabled = false; btnSave.IsEnabled = false; menuSave.IsEnabled = false; menuSaveAs.IsEnabled = false; btnDBInfo.IsEnabled = false; }