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 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 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; }