From bab5febe081f28be4d4baadda6bc00eddb893573 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Jun 2016 02:24:18 +0200 Subject: [PATCH] moved from SVN to git --- BeWoAdmin.sln | 32 + BeWoAdmin/App.xaml | 8 + BeWoAdmin/App.xaml.cs | 16 + BeWoAdmin/CreateDatabase.xaml | 29 + BeWoAdmin/CreateDatabase.xaml.cs | 66 + BeWoAdmin/DBTool.csproj | 284 ++ BeWoAdmin/DatabaseCreation.cs | 115 + BeWoAdmin/DbCreationWnd.xaml | 21 + BeWoAdmin/DbCreationWnd.xaml.cs | 302 ++ BeWoAdmin/ExtndLicnsWnd.xaml | 23 + BeWoAdmin/ExtndLicnsWnd.xaml.cs | 157 + BeWoAdmin/GrayscaleEffect.dll | Bin 0 -> 6144 bytes BeWoAdmin/PasswordInput.xaml | 36 + BeWoAdmin/PasswordInput.xaml.cs | 80 + BeWoAdmin/Properties/AssemblyInfo.cs | 55 + BeWoAdmin/Properties/Resources.Designer.cs | 63 + BeWoAdmin/Properties/Resources.resx | 117 + BeWoAdmin/Properties/Settings.Designer.cs | 46 + BeWoAdmin/Properties/Settings.settings | 12 + BeWoAdmin/Server.cs | 136 + BeWoAdmin/ServerCollection.cs | 89 + BeWoAdmin/SqlInputWindow.xaml | 24 + BeWoAdmin/SqlInputWindow.xaml.cs | 60 + BeWoAdmin/SqlOutputWindow.xaml | 25 + BeWoAdmin/SqlOutputWindow.xaml.cs | 54 + BeWoAdmin/Tenant.cs | 246 ++ BeWoAdmin/WPF/BackgroundValueConverter.cs | 18 + .../WPF/CollapsedIfFalseValueConverter.cs | 19 + BeWoAdmin/WPF/CustomCommands.cs | 45 + BeWoAdmin/WPF/FontWeightValueConverter.cs | 18 + BeWoAdmin/WPF/ForegroundValueConverter.cs | 18 + BeWoAdmin/WPF/Resources.xaml | 196 ++ .../WPF/SuccessBackgroundValueConverter.cs | 21 + BeWoAdmin/WPF/VisibleIfFalseValueConverter.cs | 18 + BeWoAdmin/WPF/VisibleIfTrueValueConverter.cs | 18 + .../DBAdminServiceReturnValue1.datasource | 10 + .../DBAdminService/MySqlService.disco | 6 + .../DBAdminService/MySqlService.wsdl | 345 ++ .../DBAdminService/Reference.cs | 593 ++++ .../DBAdminService/Reference.map | 7 + BeWoAdmin/Window1.xaml | 334 ++ BeWoAdmin/Window1.xaml.cs | 637 ++++ BeWoAdmin/app.config | 18 + BeWoAdmin/icons/IconResources.xaml | 55 + BeWoAdmin/icons/cancel.png | Bin 0 -> 587 bytes BeWoAdmin/icons/database.png | Bin 0 -> 390 bytes BeWoAdmin/icons/database_add.png | Bin 0 -> 658 bytes BeWoAdmin/icons/database_connect.png | Bin 0 -> 763 bytes BeWoAdmin/icons/database_delete.png | Bin 0 -> 659 bytes BeWoAdmin/icons/database_lightning.png | Bin 0 -> 775 bytes BeWoAdmin/icons/database_table.png | Bin 0 -> 726 bytes BeWoAdmin/icons/disk.png | Bin 0 -> 620 bytes BeWoAdmin/icons/door_in.png | Bin 0 -> 693 bytes BeWoAdmin/icons/folder.png | Bin 0 -> 537 bytes BeWoAdmin/icons/license.png | Bin 0 -> 574 bytes BeWoAdmin/icons/page_copy.png | Bin 0 -> 663 bytes BeWoAdmin/icons/page_white.png | Bin 0 -> 294 bytes BeWoAdmin/icons/page_white_database.png | Bin 0 -> 579 bytes BeWoAdmin/icons/server.png | Bin 0 -> 530 bytes BeWoAdmin/icons/server_add.png | Bin 0 -> 676 bytes BeWoAdmin/icons/server_connect.png | Bin 0 -> 755 bytes BeWoAdmin/icons/server_delete.png | Bin 0 -> 668 bytes DBAdminService/DBAdminService.Publish.xml | 20 + DBAdminService/DBAdminService.csproj | 123 + DBAdminService/DBAdminService.csproj.user | 32 + DBAdminService/DBcnfTemplate.config | 21 + DBAdminService/MySql.Data.dll | Bin 0 -> 294912 bytes DBAdminService/MySqlService.asmx | 1 + DBAdminService/MySqlService.asmx.cs | 388 +++ DBAdminService/Properties/AssemblyInfo.cs | 35 + DBAdminService/Web.config | 108 + DBAdminService/WebService1.Publish.xml | 9 + DBAdminService/configuration.conf | 4 + DBAdminService/template.db2mail | 7 + DBToolControls/DBToolControls.csproj | 117 + DBToolControls/EncryptionHelper.cs | 91 + DBToolControls/HighlightingRichTextBox.cs | 141 + DBToolControls/Properties/AssemblyInfo.cs | 56 + .../Properties/Resources.Designer.cs | 63 + DBToolControls/Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 26 + DBToolControls/Properties/Settings.settings | 7 + DBToolControls/Syntax.cs | 33 + DBToolControls/SyntaxProvider.cs | 41 + DBToolControls/User.cs | 62 + DBToolControls/WordBreaker.cs | 80 + DBToolControls/WpfMsgBox.xaml | 19 + DBToolControls/WpfMsgBox.xaml.cs | 111 + SQL/Rechnungsliste.sql | 39 + SQL/create_Empty_MySQL.sql | 2973 +++++++++++++++++ SQL/inserts.sql | 670 ++++ SQL/insertsDefault.sql | 34 + bewo.xml | 1096 ++++++ 93 files changed, 10996 insertions(+) create mode 100644 BeWoAdmin.sln create mode 100644 BeWoAdmin/App.xaml create mode 100644 BeWoAdmin/App.xaml.cs create mode 100644 BeWoAdmin/CreateDatabase.xaml create mode 100644 BeWoAdmin/CreateDatabase.xaml.cs create mode 100644 BeWoAdmin/DBTool.csproj create mode 100644 BeWoAdmin/DatabaseCreation.cs create mode 100644 BeWoAdmin/DbCreationWnd.xaml create mode 100644 BeWoAdmin/DbCreationWnd.xaml.cs create mode 100644 BeWoAdmin/ExtndLicnsWnd.xaml create mode 100644 BeWoAdmin/ExtndLicnsWnd.xaml.cs create mode 100644 BeWoAdmin/GrayscaleEffect.dll create mode 100644 BeWoAdmin/PasswordInput.xaml create mode 100644 BeWoAdmin/PasswordInput.xaml.cs create mode 100644 BeWoAdmin/Properties/AssemblyInfo.cs create mode 100644 BeWoAdmin/Properties/Resources.Designer.cs create mode 100644 BeWoAdmin/Properties/Resources.resx create mode 100644 BeWoAdmin/Properties/Settings.Designer.cs create mode 100644 BeWoAdmin/Properties/Settings.settings create mode 100644 BeWoAdmin/Server.cs create mode 100644 BeWoAdmin/ServerCollection.cs create mode 100644 BeWoAdmin/SqlInputWindow.xaml create mode 100644 BeWoAdmin/SqlInputWindow.xaml.cs create mode 100644 BeWoAdmin/SqlOutputWindow.xaml create mode 100644 BeWoAdmin/SqlOutputWindow.xaml.cs create mode 100644 BeWoAdmin/Tenant.cs create mode 100644 BeWoAdmin/WPF/BackgroundValueConverter.cs create mode 100644 BeWoAdmin/WPF/CollapsedIfFalseValueConverter.cs create mode 100644 BeWoAdmin/WPF/CustomCommands.cs create mode 100644 BeWoAdmin/WPF/FontWeightValueConverter.cs create mode 100644 BeWoAdmin/WPF/ForegroundValueConverter.cs create mode 100644 BeWoAdmin/WPF/Resources.xaml create mode 100644 BeWoAdmin/WPF/SuccessBackgroundValueConverter.cs create mode 100644 BeWoAdmin/WPF/VisibleIfFalseValueConverter.cs create mode 100644 BeWoAdmin/WPF/VisibleIfTrueValueConverter.cs create mode 100644 BeWoAdmin/Web References/DBAdminService/DBAdminServiceReturnValue1.datasource create mode 100644 BeWoAdmin/Web References/DBAdminService/MySqlService.disco create mode 100644 BeWoAdmin/Web References/DBAdminService/MySqlService.wsdl create mode 100644 BeWoAdmin/Web References/DBAdminService/Reference.cs create mode 100644 BeWoAdmin/Web References/DBAdminService/Reference.map create mode 100644 BeWoAdmin/Window1.xaml create mode 100644 BeWoAdmin/Window1.xaml.cs create mode 100644 BeWoAdmin/app.config create mode 100644 BeWoAdmin/icons/IconResources.xaml create mode 100644 BeWoAdmin/icons/cancel.png create mode 100644 BeWoAdmin/icons/database.png create mode 100644 BeWoAdmin/icons/database_add.png create mode 100644 BeWoAdmin/icons/database_connect.png create mode 100644 BeWoAdmin/icons/database_delete.png create mode 100644 BeWoAdmin/icons/database_lightning.png create mode 100644 BeWoAdmin/icons/database_table.png create mode 100644 BeWoAdmin/icons/disk.png create mode 100644 BeWoAdmin/icons/door_in.png create mode 100644 BeWoAdmin/icons/folder.png create mode 100644 BeWoAdmin/icons/license.png create mode 100644 BeWoAdmin/icons/page_copy.png create mode 100644 BeWoAdmin/icons/page_white.png create mode 100644 BeWoAdmin/icons/page_white_database.png create mode 100644 BeWoAdmin/icons/server.png create mode 100644 BeWoAdmin/icons/server_add.png create mode 100644 BeWoAdmin/icons/server_connect.png create mode 100644 BeWoAdmin/icons/server_delete.png create mode 100644 DBAdminService/DBAdminService.Publish.xml create mode 100644 DBAdminService/DBAdminService.csproj create mode 100644 DBAdminService/DBAdminService.csproj.user create mode 100644 DBAdminService/DBcnfTemplate.config create mode 100644 DBAdminService/MySql.Data.dll create mode 100644 DBAdminService/MySqlService.asmx create mode 100644 DBAdminService/MySqlService.asmx.cs create mode 100644 DBAdminService/Properties/AssemblyInfo.cs create mode 100644 DBAdminService/Web.config create mode 100644 DBAdminService/WebService1.Publish.xml create mode 100644 DBAdminService/configuration.conf create mode 100644 DBAdminService/template.db2mail create mode 100644 DBToolControls/DBToolControls.csproj create mode 100644 DBToolControls/EncryptionHelper.cs create mode 100644 DBToolControls/HighlightingRichTextBox.cs create mode 100644 DBToolControls/Properties/AssemblyInfo.cs create mode 100644 DBToolControls/Properties/Resources.Designer.cs create mode 100644 DBToolControls/Properties/Resources.resx create mode 100644 DBToolControls/Properties/Settings.Designer.cs create mode 100644 DBToolControls/Properties/Settings.settings create mode 100644 DBToolControls/Syntax.cs create mode 100644 DBToolControls/SyntaxProvider.cs create mode 100644 DBToolControls/User.cs create mode 100644 DBToolControls/WordBreaker.cs create mode 100644 DBToolControls/WpfMsgBox.xaml create mode 100644 DBToolControls/WpfMsgBox.xaml.cs create mode 100644 SQL/Rechnungsliste.sql create mode 100644 SQL/create_Empty_MySQL.sql create mode 100644 SQL/inserts.sql create mode 100644 SQL/insertsDefault.sql create mode 100644 bewo.xml diff --git a/BeWoAdmin.sln b/BeWoAdmin.sln new file mode 100644 index 0000000..6b74ee7 --- /dev/null +++ b/BeWoAdmin.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBTool", "BeWoAdmin\DBTool.csproj", "{8B163824-6E75-455C-AEBA-49E313FFD7DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBAdminService", "DBAdminService\DBAdminService.csproj", "{80C16833-B497-4AFA-97D2-4744EAFE412C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBToolControls", "DBToolControls\DBToolControls.csproj", "{3B0EDADE-2697-4936-9C15-E7BCB309AA14}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8B163824-6E75-455C-AEBA-49E313FFD7DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B163824-6E75-455C-AEBA-49E313FFD7DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B163824-6E75-455C-AEBA-49E313FFD7DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B163824-6E75-455C-AEBA-49E313FFD7DC}.Release|Any CPU.Build.0 = Release|Any CPU + {80C16833-B497-4AFA-97D2-4744EAFE412C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80C16833-B497-4AFA-97D2-4744EAFE412C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80C16833-B497-4AFA-97D2-4744EAFE412C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80C16833-B497-4AFA-97D2-4744EAFE412C}.Release|Any CPU.Build.0 = Release|Any CPU + {3B0EDADE-2697-4936-9C15-E7BCB309AA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B0EDADE-2697-4936-9C15-E7BCB309AA14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B0EDADE-2697-4936-9C15-E7BCB309AA14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B0EDADE-2697-4936-9C15-E7BCB309AA14}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/BeWoAdmin/App.xaml b/BeWoAdmin/App.xaml new file mode 100644 index 0000000..d954147 --- /dev/null +++ b/BeWoAdmin/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/BeWoAdmin/App.xaml.cs b/BeWoAdmin/App.xaml.cs new file mode 100644 index 0000000..a551d65 --- /dev/null +++ b/BeWoAdmin/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace BeWoAdmin { + /// + /// Interaktionslogik für "App.xaml" + /// + public partial class App : Application { + public static readonly string Name = "BeWo Admin"; + public static readonly string TransportEncryptionKey = @"b7困!#vS?難\n.어u"; + } +} diff --git a/BeWoAdmin/CreateDatabase.xaml b/BeWoAdmin/CreateDatabase.xaml new file mode 100644 index 0000000..c3ce73e --- /dev/null +++ b/BeWoAdmin/CreateDatabase.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + Neue Datenbank erstellen + Server-URI: + + + Mandant: + + + + + + + + diff --git a/BeWoAdmin/CreateDatabase.xaml.cs b/BeWoAdmin/CreateDatabase.xaml.cs new file mode 100644 index 0000000..08954fc --- /dev/null +++ b/BeWoAdmin/CreateDatabase.xaml.cs @@ -0,0 +1,66 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Windows.Threading; +using System.Threading; +using BeWoAdmin.DBAdminService; + +namespace BeWoAdmin { + /// + /// Interaktionslogik für CreateDatabase.xaml + /// + public partial class CreateDatabase : Window { + internal Tenant CreatedTenant { get; private set; } + private Server server; + + public CreateDatabase(Window owner, Server server) { + InitializeComponent(); + this.Owner = owner; + this.server = server; + uriTextBox.Text = server.Uri.AbsoluteUri; + tenantTextBox.Focus(); + Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (ThreadStart)delegate() { + this.MinHeight = this.MaxHeight = this.ActualHeight; + }); + } + + private void StartDrag(object sender, MouseButtonEventArgs e) { + this.DragMove(); + } + + private void OKButton_Click(object sender, RoutedEventArgs e) { + this.IsEnabled = false; + this.Opacity = 0.8; + this.Effect = new GrayscaleEffect.GrayscaleEffect(); + string serviceUri = uriTextBox.Text; + string name = tenantTextBox.Text; + + new Thread(() => { + try { + MySqlService webService = new MySqlService(); + webService.Url = serviceUri; + + Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (ThreadStart)delegate() { + CreatedTenant = server.CreateTenant(name, webService.CreateNewTenantID(), null, false); + this.DialogResult = true; + this.Close(); + }); + } catch (Exception ex) { + Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (ThreadStart)delegate() { + MessageBox.Show(String.Format("Fehler aufgetreten: {0} ({1})", ex.Message, ex.GetType().ToString())); + this.IsEnabled = true; + this.Opacity = 1; + }); + } + }).Start(); + } + } +} \ No newline at end of file diff --git a/BeWoAdmin/DBTool.csproj b/BeWoAdmin/DBTool.csproj new file mode 100644 index 0000000..217fb88 --- /dev/null +++ b/BeWoAdmin/DBTool.csproj @@ -0,0 +1,284 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {8B163824-6E75-455C-AEBA-49E313FFD7DC} + WinExe + Properties + BeWoAdmin + BeWoAdmin + v3.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + + 3.5 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + .\GrayscaleEffect.dll + + + False + ..\DBAdminService\MySql.Data.dll + + + + 3.5 + + + + + 3.5 + + + 3.5 + + + + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + + + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + App.xaml + Code + + + Window1.xaml + Code + + + + + CreateDatabase.xaml + + + + DbCreationWnd.xaml + + + ExtndLicnsWnd.xaml + + + PasswordInput.xaml + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + SqlInputWindow.xaml + + + SqlOutputWindow.xaml + + + + True + True + Reference.map + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Dynamic + Web References\DBAdminService\ + http://localhost:1513/MySqlService.asmx + + + + + Settings + DBToolTest2_DBAdminService_MySqlService + + + + + + Reference.map + + + + + MSDiscoCodeGenerator + Reference.cs + + + + + {3B0EDADE-2697-4936-9C15-E7BCB309AA14} + DBToolControls + + + + + + + + \ No newline at end of file diff --git a/BeWoAdmin/DatabaseCreation.cs b/BeWoAdmin/DatabaseCreation.cs new file mode 100644 index 0000000..7a17cf2 --- /dev/null +++ b/BeWoAdmin/DatabaseCreation.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using System.Diagnostics; +namespace BeWoAdmin +{ + class DatabaseCreation + { + public String dbID; + private int dbNumber; + private String filePath; + private Window1 parentWindow; + public DatabaseCreation(String file, Window1 parent) + { + this.filePath = file; + this.parentWindow = parent; + } + + public String generateDbId() + { + String dbId = ""; Random ran = new Random(); + for (int i = 0; i < 10; i++) + { + dbId += ran.Next(10); + } + this.dbID = dbId; + return dbId; + } + + public DatabaseCreateResult parseFile(int personCount) + { + DatabaseCreateResult result = new DatabaseCreateResult(); + try + { + StreamReader sr = new StreamReader(File.OpenRead(this.filePath)); + String tmp = sr.ReadToEnd(); String id; + id = tmp.Substring(tmp.IndexOf("CREATE DATABASE `") + "CREATE DATABASE `".Length, 10); + tmp = tmp.Replace(id, this.dbID); + + + // Build insert querys + // Person + String queryStr = "INSERT INTO `person` (`Oid`, `BankAccountOid`, `AddressOid`, `Tid`, `FirstName`, `LastName`, `DateOfBirth`, `Sex`, `FamilyStatus`, `Profession`, `Type`, `Notice`, `InsTs`, `InsUser`, `Version`, `UdpUser`, `IsActive`, `SystemEntryID`) VALUES "; + for (int i = 1; i <= personCount; i++) + { + if (i != 1) + queryStr += ", "; + queryStr += "("+ i + ",NULL,NULL,1,'Mitarbeiter','" + i + "',NULL,0,NULL,NULL,1,NULL,NULL,'beyondSoft GmbH',1,'beyondSoft GmbH',1,NULL)"; + } + queryStr += ";COMMIT;\r\n"; + + // employee + queryStr += "INSERT INTO `employee` (`Oid`, `PersonOid`, `ApplicationUserOid`, `Tid`, `PersonnelNumber`, `TaxNumber`, `HealthInsurance`, `InsuranceNumber`, `HourlyRate`, `EntryDate`, `CancellationPeriod`, `ProbationPeriod`, `Sequence`, `IsActive`, `Notice`, `InsTs`, `InsUser`, `Version`, `UdpUser`, `SystemEntryID`, `weeklyfls`, `weeklytotalhours`, `leavedays`) VALUES "; + for (int i = 1; i <= personCount; i++) + { + if (i != 1) + queryStr += ", "; + queryStr += "(" + i + ", " + i + ",NULL,2,'" + i + "',NULL,NULL,NULL,NULL,NULL,0,0,NULL,1,NULL,NULL,'beyondSoft GmbH',1,'beyondSoft GmbH',NULL,NULL,NULL,NULL)"; + } + queryStr += "; COMMIT;\r\n"; + + //applicationuser + queryStr += "INSERT INTO `applicationuser` (`Oid`, `EmployeeOid`, `Tid`, `LoginName`, `Password`, `Notice`, `Version`, `UdpUser`, `InsUser`, `InsTs`, `IsActive`, `SystemEntryID`) VALUES "; + for (int i = 1; i <= personCount; i++) + { + if (i != 1) + queryStr += ", "; + queryStr += "("+i+","+i+",28,'m" + i + "','18-14-1D-42-74-94-E6-74-4F-F2-65-A4-AE-07-66-CB',NULL,1,'beyondSoft GmbH','beyondSoft GmbH',NULL,1,NULL)"; + } + queryStr += "; COMMIT;\r\n"; + + //ingroup + queryStr += "INSERT INTO `ingroup` (`UserGroupOid`, `ApplicationUserOid`) VALUES "; + for (int i = 1; i <= personCount; i++) + { + if (i != 1) + queryStr += ", "; + if (i == 1) + queryStr += "(1,1)"; + else + queryStr += "(2," + i + ")"; + } + queryStr += "; COMMIT;\r\n"; + + tmp = tmp + "\r\n\r\n" + queryStr; + + result.Success = true; + result.SuccessString = tmp; + result.dbID = this.dbID; + } + catch + { + result.ErrorMsg = "Konnte die Datei " + this.filePath + " nicht öffnen"; + result.Success = false; + + } + return result; + } + } + + public class DatabaseCreateResult + { + private String successString; + private String errorMsg; + private bool success; + private String databaseID; + + public bool Success { get { return this.success; } set { this.success = value; } } + public String ErrorMsg { get { return this.errorMsg; } set { this.errorMsg = value; } } + public String SuccessString { get { return this.successString; } set { this.successString = value; } } + public String dbID { get { return this.databaseID; } set { this.databaseID = value; } } + } +} diff --git a/BeWoAdmin/DbCreationWnd.xaml b/BeWoAdmin/DbCreationWnd.xaml new file mode 100644 index 0000000..2017d96 --- /dev/null +++ b/BeWoAdmin/DbCreationWnd.xaml @@ -0,0 +1,21 @@ + + + + + Kundename + + DatenbankID: + + Anzahl der Lizenzen + + + + + + + + diff --git a/BeWoAdmin/DbCreationWnd.xaml.cs b/BeWoAdmin/DbCreationWnd.xaml.cs new file mode 100644 index 0000000..682242f --- /dev/null +++ b/BeWoAdmin/DbCreationWnd.xaml.cs @@ -0,0 +1,302 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using MySql.Data.MySqlClient; +using DBToolControls; +using BeWoAdmin.DBAdminService; +using System.Threading; +using System.Windows.Threading; +namespace BeWoAdmin +{ + /// + /// Interaktionslogik für DbCreationWnd.xaml + /// + public partial class DbCreationWnd : Window + { + private Window1 parent; + public String DbId { get; set; } + public String CustomerName { get; set; } + public String PersonCount { get; set; } + private bool btnLock = true; + private Server selectedServer; + private DatabaseCreation dbCr = null; + private String sqlFile; + public Server SelectedServer + { + get { return this.selectedServer; } + set { this.selectedServer = value; } + } + private User user; + public User setUser + { + set { this.user = value; } + } + public bool DbCreationWndResult { get; set; } + public static readonly string TransportEncryptionKey = @"b7困!#vS?難\n.어u"; + + public void setData(Server serv, User user, String path) + { + this.selectedServer = serv; + this.user = user; + this.sqlFile = path; + this.dbCr = new DatabaseCreation(path, this.parent); + this.DbId = dbCr.generateDbId() ; + + this.DbID.Text = DbId; + this.setCheckField(); + + this.DbID.TextChanged += new TextChangedEventHandler(DbID_TextChanged); + this.DbID.KeyDown += new KeyEventHandler(DbID_KeyDown); + + this.PersCount.TextChanged += new TextChangedEventHandler(PersCount_TextChanged); + this.PersCount.KeyDown += new KeyEventHandler(PersCount_KeyDown); + + } + + + public DbCreationWnd(Window1 parent) + { + InitializeComponent(); + this.parent = parent; + this.Owner = parent; + + } + + private void DbID_KeyDown(object sender, KeyEventArgs e) + { + String tmp; + tmp = this.DbID.Text; + + if(((((int) e.Key) <= 43 && ((int) e.Key) >= 34) || (((int) e.Key) <= 83 && ((int) e.Key) >= 74)) && e.Key != Key.Space) + { + if (this.DbID.Text.Length >= 10) + e.Handled = true; + } else + { + e.Handled = true; + } + + } + private void DbID_TextChanged(object sender, TextChangedEventArgs e) + { + this.DbId = this.DbID.Text; + if (this.DbId.Length == 10) + setCheckField(); + else + printStateInfo("ID muss aus genau 10 Zahlen bestehen", 0); + } + private void PersCount_KeyDown(object sender, KeyEventArgs e) + { + String tmp; + tmp = this.PersCount.Text; + + if (((((int)e.Key) <= 43 && ((int)e.Key) >= 34) || (((int)e.Key) <= 83 && ((int)e.Key) >= 74)) && e.Key != Key.Space) + { + + } + else + { + e.Handled = true; + } + } + private void PersCount_TextChanged(object sender, TextChangedEventArgs e) + { + + this.PersonCount = this.PersCount.Text; + } + private void regenerateBtn_Click(object sender, RoutedEventArgs e) + { + do + { + this.DbId = this.dbCr.generateDbId(); + } + while (this.checkDatabaseId() == false); + this.DbID.Text = this.DbId; + } + private void setCheckField() + { + if (checkDatabaseId() == false) + { + this.printStateInfo("DatenbankID bereits vorhanden", 0); + this.btnLock = true; + } + else if (checkDatabaseId() == true) + { + this.printStateInfo("DatenbankID nicht vorhanden", 1); + this.btnLock = false; + } + else + { + DbCreationWndResult = false; + this.parent.showWnd = false; + this.Close(); + } + } + + private void printStateInfo(String msg, int state) + { + SolidColorBrush brush; + switch (state) + { + case 0: + brush = new SolidColorBrush(); + brush.Color = Color.FromRgb(0xef, 0x00, 0x00); + this.stateMsg.Foreground = brush; + this.stateMsg.Text = msg; + break; + + case 1: + brush = new SolidColorBrush(); + brush.Color = Color.FromRgb(0x00, 0xaf, 0x00); + this.stateMsg.Foreground = brush; + this.stateMsg.Text = msg; + this.btnLock = false; + break; + + case 2: + brush = new SolidColorBrush(); + brush.Color = Color.FromRgb(0xcf, 0xcf, 0); + this.stateMsg.Foreground = brush; + this.stateMsg.Text = msg; + break; + } + } + + private void saveBtn_Click(object sender, RoutedEventArgs e) + { + + if (this.btnLock == false) + { + + try + { + if (Convert.ToInt32(this.PersonCount) > 0) + { + + if (checkDatabaseId() == true) + { + this.printStateInfo("Lese SQL-Script...", 2); + + this.dbCr.dbID = this.DbId; + if (!String.IsNullOrEmpty(this.customerName.Text)) + { + this.CustomerName = this.customerName.Text; + } + else + { + this.CustomerName = this.DbId; + } + DatabaseCreateResult result = this.dbCr.parseFile(Convert.ToInt32(this.PersCount.Text)); + // Debug : throw new Exception(); + if (result.Success) + { + this.printStateInfo("SQL-Script wird ausgeführt...", 2); + + try + { + + MySqlService dbService = new MySqlService(); + dbService.Url = this.selectedServer.Uri.AbsoluteUri; + + + DBAdminServiceReturnValue ret = dbService.createDatabase(Encrypt(this.user.Username), Encrypt(this.user.PasswordAsInsecureString), Encrypt(this.selectedServer.Port), Encrypt(result.SuccessString), Encrypt(this.CustomerName)); + + if (ret.WasSuccessful) + { + this.DbCreationWndResult = true; + this.Close(); + } + else + { + this.DbCreationWndResult = false; + this.parent.showErrorWnd(ret.ErrorMessage); + this.Close(); + } + + + } + catch (Exception ee) + { + this.parent.showErrorWnd(ee.Message); + } + } + else + { + this.parent.showErrorWnd(result.ErrorMsg); + } + + } + + } + else + { + + this.parent.showErrorWnd("Mindestens eine Lizenz muss vorhanden sein"); + } + } catch + { + this.parent.showErrorWnd("Konnte " + this.PersCount.Text + " nicht in Integer konvertieren"); + this.DbCreationWndResult = false; + } + } + } + + private void cnclBtn_Click(object sender, RoutedEventArgs e) + { + this.DbCreationWndResult = false; + this.Close(); + } + + private bool? checkDatabaseId() + { + Uri SUri = this.selectedServer.Uri; + if (SUri.IsAbsoluteUri) + { + try + { + MySqlService dbService = new MySqlService(); + dbService.Url = SUri.AbsoluteUri; + String[] list = dbService.GetDatabaseList(Encrypt(this.user.Username), Encrypt(this.user.PasswordAsInsecureString), Encrypt(this.selectedServer.Port)); + for (int i = 0; i < list.Length; i++) + { + if (this.DbId.Equals(list[i])) + return false; + } + } + catch (Exception e) + { + this.parent.showErrorWnd("Konnte keine Verbindung zum Server " + SUri.AbsoluteUri + " aufbauen"); + return null; + } + } + return true; + } + + private string Encrypt(string s) + { + return EncryptionHelper.EncryptString(TransportEncryptionKey, s); + } + + private string Decrypt(string s) + { + return EncryptionHelper.DecryptString(TransportEncryptionKey, s); + } + + private void startDrag(object sender, MouseButtonEventArgs e) + { + this.DragMove(); + } + + + } + +} diff --git a/BeWoAdmin/ExtndLicnsWnd.xaml b/BeWoAdmin/ExtndLicnsWnd.xaml new file mode 100644 index 0000000..a1bc141 --- /dev/null +++ b/BeWoAdmin/ExtndLicnsWnd.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + Lizenzen hinzufügen + + + + + + diff --git a/BeWoAdmin/ExtndLicnsWnd.xaml.cs b/BeWoAdmin/ExtndLicnsWnd.xaml.cs new file mode 100644 index 0000000..b79aa1f --- /dev/null +++ b/BeWoAdmin/ExtndLicnsWnd.xaml.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Collections; +namespace BeWoAdmin +{ + /// + /// Interaktionslogik für ExtndLicnsWnd.xaml + /// + public partial class ExtndLicnsWnd : Window + { + private Tenant selectedTenant; + private Window1 parent; + private String extLicenses = null; + private bool bntEnable = false; + + public ExtndLicnsWnd(Tenant t, Window1 parent) + { + InitializeComponent(); + this.Owner = parent; + this.selectedTenant = t; + this.parent = parent; + + this.licnsCount.KeyDown += new KeyEventHandler(licnsCount_KeyDown); + this.licnsCount.TextChanged += new TextChangedEventHandler(licnsCount_TextChanged); + } + + void licnsCount_TextChanged(object sender, TextChangedEventArgs e) + { + this.extLicenses = this.licnsCount.Text; + this.bntEnable = true; + } + + void licnsCount_KeyDown(object sender, KeyEventArgs e) + { + if (((((int)e.Key) <= 43 && ((int)e.Key) >= 34) || (((int)e.Key) <= 83 && ((int)e.Key) >= 74)) && e.Key != Key.Space) + { + + } + else + { + e.Handled = true; + } + } + + private void StartDrag(object sender, MouseButtonEventArgs e) + { + this.DragMove(); + } + + private void chngBtn_Click(object sender, RoutedEventArgs e) + { + int licenses; + if (this.bntEnable) + { + try + { + if (this.extLicenses.Length > 0 && (licenses = Convert.ToInt32(this.extLicenses)) > 0) + { + // gets last 'Oid' in 'person' + List ret = this.selectedTenant.ExecuteHiddenSqlCommand("SELECT Oid FROM person ORDER BY Oid DESC LIMIT 1"); + String tmp; int oid; + if (ret != null) + { + tmp = ret.ElementAt(0); + try + { + oid = Convert.ToInt32(tmp); + oid += 1; + // Building the query + String queryStr = "INSERT INTO `person` (`Oid`, `BankAccountOid`, `AddressOid`, `Tid`, `FirstName`, `LastName`, `DateOfBirth`, `Sex`, `FamilyStatus`, `Profession`, `Type`, `Notice`, `InsTs`, `InsUser`, `Version`, `UdpUser`, `IsActive`, `SystemEntryID`) VALUES "; + for (int i = oid; i < (oid + licenses); i++) + { + if (i != oid) + queryStr += ", "; + queryStr += "(" + i + ",NULL,NULL,1,'Mitarbeiter','" + i + "',NULL,0,NULL,NULL,1,NULL,NULL,'beyondSoft GmbH',1,'beyondSoft GmbH',1,NULL)"; + } + queryStr += ";COMMIT;\r\n"; + + // employee + queryStr += "INSERT INTO `employee` (`Oid`, `PersonOid`, `ApplicationUserOid`, `Tid`, `PersonnelNumber`, `TaxNumber`, `HealthInsurance`, `InsuranceNumber`, `HourlyRate`, `EntryDate`, `CancellationPeriod`, `ProbationPeriod`, `Sequence`, `IsActive`, `Notice`, `InsTs`, `InsUser`, `Version`, `UdpUser`, `SystemEntryID`, `weeklyfls`, `weeklytotalhours`, `leavedays`) VALUES "; + for (int i = oid; i < (oid + licenses); i++) + { + if (i != oid) + queryStr += ", "; + queryStr += "(" + i + ", " + i + ",NULL,2,'" + i + "',NULL,NULL,NULL,NULL,NULL,0,0,NULL,1,NULL,NULL,'beyondSoft GmbH',1,'beyondSoft GmbH',NULL,NULL,NULL,NULL)"; + } + queryStr += "; COMMIT;\r\n"; + + //applicationuser + queryStr += "INSERT INTO `applicationuser` (`Oid`, `EmployeeOid`, `Tid`, `LoginName`, `Password`, `Notice`, `Version`, `UdpUser`, `InsUser`, `InsTs`, `IsActive`, `SystemEntryID`) VALUES "; + for (int i = oid; i < (oid + licenses); i++) + { + if (i != oid) + queryStr += ", "; + queryStr += "(" + i + "," + i + ",28,'m" + i + "','18-14-1D-42-74-94-E6-74-4F-F2-65-A4-AE-07-66-CB',NULL,1,'beyondSoft GmbH','beyondSoft GmbH',NULL,1,NULL)"; + } + queryStr += "; COMMIT;\r\n"; + + //ingroup + queryStr += "INSERT INTO `ingroup` (`UserGroupOid`, `ApplicationUserOid`) VALUES "; + for (int i = oid; i < (oid + licenses); i++) + { + if (i != oid) + queryStr += ", "; + if (i == 1) + queryStr += "(1,1)"; + else + queryStr += "(2," + i + ")"; + } + queryStr += "; COMMIT;\r\n"; + + this.selectedTenant.ExecuteSqlCommand(queryStr); + + this.parent.showSuccessWnd(licenses + " Lizenzen wurden erfolgreich der Datenbank hinzugefügt"); + this.Close(); + } + catch (Exception ex) + { + parent.showErrorWnd("Fehler beim konvertieren der Oid: " + ex.Message); + this.Close(); + } + } + else + { + this.parent.showErrorWnd("Bei einer Datenbankabrake ist ein Fehler aufgetreten"); + this.Close(); + } + } + else + { + this.parent.showErrorWnd("Die Anzahl der zuzufügenden Lizenzen muss größer als 0 sein"); + } + } + catch + { + this.parent.showErrorWnd("Ungültiges Zeichen in der Eingabe"); + } + + } + } + + private void cnclBtn_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + } +} diff --git a/BeWoAdmin/GrayscaleEffect.dll b/BeWoAdmin/GrayscaleEffect.dll new file mode 100644 index 0000000000000000000000000000000000000000..76c65f6c92e7d2347d4e2a69fc30d2608d5c3fe8 GIT binary patch literal 6144 zcmeHLZ)_aJ6@R;TKA#=z;7bUhxUiO!a=6KH@xM5MfbBawG1$cTY=>4y!`|Kayvg3} zvAY*ysNe{t{Ap5e4xsFB83tn#-_+7X}ru+pqj-JH62I zR@ckQY%6c;1ud%=ilqI zV`0A6N~B0C@Ghcz8tn2}YgSLGQFysky$1q<(GH1XcrXf^L4}7sv}aspvBBsD&|OSQ z=^6AWf#^n%m@hjs|A&}}(sQFn34D`VUMHdrag}z#5~%A?T}V`01G4+N=I*M2y%$yS zzuz!;QOJU}kQCC>>{aNvAs(iCQA0w9a|v{|hHS_zIZ)PWT?!DY@RaOFKzxVwL^p%D zDS8=Tg=b=ampRfl=B)Io*&&r}ihd5#JY4%+Z`Su$h z{R}$k1YR?>lx#rfH$CCa8- zw#A;JD7&_9ZqugA8Pmw#B$j5a!=kt+vva3DkR2G@v8%6N#D{iuuU1wrx<)}%wWkET zy0%HCN0R(|W2%@0L8-q|*{Pltpclz_WlypzTtOO5kwmI?hv6mzO_Tj!|NE zWRy?Y{mcQ4mB>@4koHyJNxbk86st6gnoAC^XN(FpUNH(K%+GKqilwqk&psQ(xlrWe z@k;_OEb{paoKJTS_8yGWl##V9$69c;=*-pHzRA?2mRe*lYYD4RGE5-5V!gewUHx43 z578||O$x0)wWsyc8@~Ve>zEzsaV?mSh{C+{7#^YHo zsjAeuEOFR{ef(jCZvg~~)QzL;F)kcaj__t0i0|y($&@DP>1ixQ_dP`CP@jW&-6_{L zig~%NM-lwap=bA8iuzl;@YcO|ZXyX<675-t?jAL*42wg-3MvOKc}i(vmH$%uICe3L zVPbtTh zc6vp^cP0F%gzYNRuaa<7!rLVLj(S9Gr_&O?Bq{GmNP)kpH_=8I+D?f;cc7iJ5}pgZ z7>LjtfbH}L2|oaArD*UZY)Au!s3h_G0lDxz81i#5U4f@b;vH1Rh(S7w3t*5w2AtNo z=hrtMgHDB(yjJ*+aGpZn@LPYT%h7t=Z?!93@Yl0`Ypb#qtzXF237S%Ra2~>4gmPl@ z>w!C=m+iP0236q$z*SIo&@oCN@-iHea6-acB>a+ux`c*=cL44~IN<*GN%*jYCjh7D z2Y@L$4cJaCKD;k*EASJ6uh7->bRY-#T;LFONbW0u3E*!B?xxr1*yuG4fH19*?V$QnLiA{-|p~pM{4ta6VYtgiERG1!x4wmW~v8-#^T>Co!(G_L?N_ zzM4%ub`A21Vf!gb7|Ia zO)=skY-Y-?sF5KwYa1o*x|*4=iVH^GpX*xeLP;+!t!BU>xpLNB%}7|KCELg^uECnM zaqAUy`|uj0yqsc%QOy~=Od&Q=bOn|+CF~;x(iQlzFmE_UrhdMA%SLWRK-DRJ`m&la zj+=KC(^s1`^nB5BTqEmXb7ji;yndc4kA~X`M+4S07+by8>#fB-FSpZ-F!iGnb5=~6 z@n*^6z{(h=;numF_g4Mcm@DOUS9k|yUha;)!u1ejQa&Q{J4#we%>>1=@&wJP5H4^Nxcwxkj6ts7jg=u8yhd2rAyGt`Vx{G=`s89$zkgN-JYm<-rp2 z#VmsEZn_4Kj!dzHbiI|3B6!>6a}DiXm1mCC<(b!Fltl$d;86mv3z-)l+ZP?U|v>!1i2UCZ5x?3po)VKrX3J^A7L31Ruzp$8!OKd=cde z&Ut3lO$ThfbhA|)JDL?T49+gvxQpcdN45V7c`!Lci(IN{p7&d zqfZ83bt9pF@Q}pr^qhllqVx!^9NW=G%eHgq^|P;^O((^XbOPtnE~O7lkEi`hF5NJD z@7y#}(^lqC8o@!}dTZpxO1TWt*Zgm5m_Sc5t}(W{RKLMJ&OuzlNz6m`MHLtSNa2oo~ETe`~7k3MYgBv7jFG`b`49v zPD7prTgwRDZr$uY-Jku^pXZNn^lGC|hvb+M_}zg&3Rqzip3tzn&R>njahU#RqiFvB Ro7DsN*_hS;XYn6;;NLbRHhlm9 literal 0 HcmV?d00001 diff --git a/BeWoAdmin/PasswordInput.xaml b/BeWoAdmin/PasswordInput.xaml new file mode 100644 index 0000000..075949f --- /dev/null +++ b/BeWoAdmin/PasswordInput.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + Bitte Passwort eingeben oder Feld leer lassen um nicht zu ver-/entschlüsseln: + + + + + + + + + + + + + Passwortstärke: - + + + + + + + + diff --git a/BeWoAdmin/PasswordInput.xaml.cs b/BeWoAdmin/PasswordInput.xaml.cs new file mode 100644 index 0000000..9046075 --- /dev/null +++ b/BeWoAdmin/PasswordInput.xaml.cs @@ -0,0 +1,80 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BeWoAdmin { + /// + /// Interaktionslogik für PasswordInput.xaml + /// + public partial class PasswordInput : Window { + public string Password { get; private set; } + + public PasswordInput(Window owner) { + InitializeComponent(); + this.Owner = owner; + PWBox.Focus(); + } + + private void OKButton_Click(object sender, RoutedEventArgs e) { + this.Password = PWBox.Password; + this.DialogResult = true; + Close(); + } + + private void StartDrag(object sender, MouseButtonEventArgs e) { + this.DragMove(); + } + + private void PWBox_PasswordChanged(object sender, RoutedEventArgs e) { + PasswordStrength strength = EvaluatePasswordStrength((sender as PasswordBox).Password); + PasswordStrengthTextBlock.Text = String.Format("Passwortstärke: {0}", strength.Text); + OuterColor.Color = strength.Color; + } + + private class PasswordStrength { + public string Text { get; set; } + public Color Color { get; set; } + private PasswordStrength() { } + + public static PasswordStrength None = new PasswordStrength { Text = "-", Color = Colors.Black }; + public static PasswordStrength VeryWeak = new PasswordStrength { Text = "sehr schwach", Color = Colors.Crimson }; + public static PasswordStrength Weak = new PasswordStrength { Text = "schwach", Color = Colors.OrangeRed }; + public static PasswordStrength Average = new PasswordStrength { Text = "mittel", Color = Colors.Gold }; + public static PasswordStrength Strong = new PasswordStrength { Text = "stark", Color = Colors.LawnGreen }; + public static PasswordStrength VeryStrong = new PasswordStrength { Text = "sehr stark", Color = Colors.LimeGreen }; + } + + private static PasswordStrength EvaluatePasswordStrength(string pw) { + if (pw.Length == 0) return PasswordStrength.None; + int lowerChars = 0, upperChars = 0, numbers = 0, other = 0, typesOfChars; + foreach (char c in pw.ToCharArray()) { + if (c >= 'A' && c <= 'Z') upperChars = 1; + else if ((c >= 'a' && c <= 'z') || c == ' ') lowerChars = 1; + else if (c >= '0' && c <= '9') numbers = 1; + else other = 1; + } + typesOfChars = lowerChars + upperChars + numbers + other; + + if (pw.Length >= 15 && typesOfChars > 3) return PasswordStrength.VeryStrong; + if (pw.Length >= 10 && typesOfChars > 2) return PasswordStrength.Strong; + if (pw.Length >= 8 && typesOfChars > 1) return PasswordStrength.Average; + if (pw.Length >= 5 ) return PasswordStrength.Weak; + return PasswordStrength.VeryWeak; + } + + public static string RequestPassword(Window owner) { + PasswordInput pw = new PasswordInput(owner); + bool? successful = pw.ShowDialog(); + if (successful == true) return pw.Password; + else return null; + } + } +} \ No newline at end of file diff --git a/BeWoAdmin/Properties/AssemblyInfo.cs b/BeWoAdmin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..84d7f65 --- /dev/null +++ b/BeWoAdmin/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("BeWoAdmin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Beyondsoft ")] +[assembly: AssemblyProduct("BeWoAdmin")] +[assembly: AssemblyCopyright("Copyright © Beyondsoft 2008-2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie +//ImCodeVerwendeteKultur in der .csproj-Datei +//in einer fest. Wenn Sie in den Quelldateien beispielsweise Deutsch +//(Deutschland) verwenden, legen Sie auf \"de-DE\" fest. Heben Sie dann die Auskommentierung +//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile, +//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher + //(wird verwendet, wenn eine Ressource auf der Seite + // oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.) + ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs + //(wird verwendet, wenn eine Ressource auf der Seite, in der Anwendung oder einem + // designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.) +)] + + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] diff --git a/BeWoAdmin/Properties/Resources.Designer.cs b/BeWoAdmin/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e73c560 --- /dev/null +++ b/BeWoAdmin/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.17929 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoAdmin.Properties { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BeWoAdmin.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/BeWoAdmin/Properties/Resources.resx b/BeWoAdmin/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/BeWoAdmin/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BeWoAdmin/Properties/Settings.Designer.cs b/BeWoAdmin/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f667ecb --- /dev/null +++ b/BeWoAdmin/Properties/Settings.Designer.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.17929 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace BeWoAdmin.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://localhost:2100/MySqlService.asmx")] + public string BeWoAdmin_DBAdminService_MySqlService { + get { + return ((string)(this["BeWoAdmin_DBAdminService_MySqlService"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://localhost:1513/MySqlService.asmx")] + public string DBToolTest2_DBAdminService_MySqlService { + get { + return ((string)(this["DBToolTest2_DBAdminService_MySqlService"])); + } + } + } +} diff --git a/BeWoAdmin/Properties/Settings.settings b/BeWoAdmin/Properties/Settings.settings new file mode 100644 index 0000000..897bb40 --- /dev/null +++ b/BeWoAdmin/Properties/Settings.settings @@ -0,0 +1,12 @@ + + + + + + http://localhost:2100/MySqlService.asmx + + + http://localhost:1513/MySqlService.asmx + + + \ No newline at end of file diff --git a/BeWoAdmin/Server.cs b/BeWoAdmin/Server.cs new file mode 100644 index 0000000..6aca6e5 --- /dev/null +++ b/BeWoAdmin/Server.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Xml.Linq; +using DBToolControls; + +namespace BeWoAdmin { + public class Server : INotifyPropertyChanged { + public event PropertyChangedEventHandler PropertyChanged; + + private Uri uri; + private ObservableCollection tenants = new ObservableCollection(); + private User user; + private String port; + + public Uri Uri { + get { return uri != null ? uri : new Uri("http://localhost"); } + set { + uri = value; + NotifyPropertyChange("UriHost"); + } + } + + public string UriHost { + get { return uri != null ? uri.Host : null; } + } + + public string Port + { + get { return port; } + set + { + port = value; + NotifyPropertyChange("Port"); + } + } + + public ObservableCollection Tenants { + get { return tenants; } + } + + public User User { + get { return user; } + set { + user = value; + NotifyPropertyChange("User"); + } + } + + public bool? IsChecked { + get { + if(tenants.All(t => t.IsChecked)) return true; + else if(tenants.All(t => !t.IsChecked)) return false; + else return null; + } + set { + foreach (Tenant t in tenants) + t.IsChecked = value == true; + } + } + + public bool HasOwnUser { get { return user != null; } } + + // factories + + public Tenant CreateTenant(string name, string database, User user, bool isChecked) { + return new Tenant(this, name, database, user, isChecked); + } + + public Tenant CreateTenant() { + return new Tenant(this); + } + + public static Server CreateFromXElement(XElement e, string key) { + Server s = new Server(); + s.Uri = e.ReadUri(); + s.User = e.ReadUser(key); + s.Port = e.ReadPort(); + foreach (XElement xe in e.Elements("Tenant")) { + s.CreateTenant(xe.ReadString("Name"), Decrypt(xe.ReadString("Database")), xe.ReadUser(key), xe.ReadBool("IsChecked")); + } + return s; + } + + // public methods + + public void SortChildrenBy(Func sortKey) { + tenants = new ObservableCollection(Tenants.OrderBy(sortKey)); + NotifyPropertyChange("Tenants"); + } + + public void NotifyPropertyChange(string propertyName) { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + public XElement ToXElement(string pw) { + return new XElement("Server", + new XElement("URI", uri.AbsoluteUri), + new XElement("Port", port), + HasOwnUser ? user.ToXElement(pw) : null, + tenants.Select(t => t.ToXElement(pw))); + } + + // private methods + + private static string Decrypt(string s) { + return EncryptionHelper.DecryptString(App.TransportEncryptionKey, s); + } + } + + // XElement Extension Methods + static class XElementExtensions { + public static Uri ReadUri(this XElement e) { + return e.Element("URI") != null ? new Uri(e.Element("URI").Value) : null; + } + public static User ReadUser(this XElement e, string encryptionKey) { + e = e.Element("User"); + return e != null ? new User(e.ReadString("Username"), e.ReadString("Password"), encryptionKey) : null; + } + public static String ReadPort(this XElement e) + { + e = e.Element("Port"); + return e != null ? e.Value : null; + } + public static string ReadString(this XElement e, string elementName) { + return e.Element(elementName) != null ? e.Element(elementName).Value : ""; + } + public static bool ReadBool(this XElement e, string elementName) { + return e.Element(elementName) != null && e.Element(elementName).Value.ToLower() == "true"; + } + } +} diff --git a/BeWoAdmin/ServerCollection.cs b/BeWoAdmin/ServerCollection.cs new file mode 100644 index 0000000..957ff71 --- /dev/null +++ b/BeWoAdmin/ServerCollection.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; +using System.Threading; +using System.Xml.Linq; + +namespace BeWoAdmin { + delegate void ProgressCallback(int value); + delegate void ProgressFinishedCallback(); + class ServerCollection : ObservableCollection{ + private ProgressCallback progressCallback; + private ProgressFinishedCallback progressFinishedCallback; + private int numberOfCheckedDBs; + private int sqlExecutionProgress; + private string lastSqlCommand = ""; + + public bool CancelationPending { set; private get; } + public bool TestConnectionsOnly { set; private get; } + public bool ExecutionInProgress { set; get; } + public List AllTenants { + get { return this.SelectMany(s => s.Tenants).ToList(); } + } + + public List CheckedTenants { + get { return AllTenants.Where(t => t.IsChecked).ToList(); } + } + + public Window1 Parent { get; set; } + public string LastSqlCommand { + get { return lastSqlCommand; } + set { lastSqlCommand = value; } + } + + public void SetDelegates(ProgressCallback progressCallback, ProgressFinishedCallback progressFinishedCallback) { + this.progressCallback = progressCallback; + this.progressFinishedCallback = progressFinishedCallback; + } + + // SQL-Execution + + public void ExecuteSqlCommandOnCheckedDatabases() { + foreach (Tenant t in AllTenants) + t.ResetErrorMessage(); + numberOfCheckedDBs = CheckedTenants.Count; + sqlExecutionProgress = 0; + CancelationPending = false; + foreach (var group in CheckedTenants.GroupBy(t => t.Server.UriHost)) + new Thread(ExecuteSqlCommandOnDatabases).Start(group); + } + + private void ExecuteSqlCommandOnDatabases(object tenantList) { + foreach (Tenant t in tenantList as IEnumerable) { + if (!CancelationPending) + if (TestConnectionsOnly) + t.TestConnection(); + else + { + t.parent = this.Parent; + t.ExecuteSqlCommand(LastSqlCommand); + } + Interlocked.Increment(ref sqlExecutionProgress); + progressCallback(100 * sqlExecutionProgress / numberOfCheckedDBs); + } + + if (sqlExecutionProgress == numberOfCheckedDBs) { + ExecutionInProgress = false; + TestConnectionsOnly = false; + progressFinishedCallback(); + } + } + + // File Handling + + public void SaveToXml(string filename, string pw) { + var content = this.Select(s => s.ToXElement(pw)); + new XDocument(new XElement("DatabaseCollection", content)).Save(filename); + } + + public void LoadFromXml(string filename, string pw) { + XDocument xdoc = XDocument.Load(filename); + this.Clear(); + foreach (XElement xe in xdoc.Element("DatabaseCollection").Elements("Server")) { + this.Add(Server.CreateFromXElement(xe, pw)); + } + } + } +} \ No newline at end of file diff --git a/BeWoAdmin/SqlInputWindow.xaml b/BeWoAdmin/SqlInputWindow.xaml new file mode 100644 index 0000000..21436a0 --- /dev/null +++ b/BeWoAdmin/SqlInputWindow.xaml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + SQL-Befehl eingeben: + + + + + + diff --git a/BeWoAdmin/SqlInputWindow.xaml.cs b/BeWoAdmin/SqlInputWindow.xaml.cs new file mode 100644 index 0000000..7936c3f --- /dev/null +++ b/BeWoAdmin/SqlInputWindow.xaml.cs @@ -0,0 +1,60 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using DBToolControls; + +namespace BeWoAdmin { + /// + /// Interaktionslogik für SqlInputWindow.xaml + /// + public partial class SqlInputWindow : Window { + public string SqlCommand { + get { return SqlInput.Text; } + } + + public SqlInputWindow(Window owner, string initialText) { + InitializeComponent(); + this.Owner = owner; + AddSQLSyntaxToSqlInputBox(); + SqlInput.Text = initialText; + SqlInput.Focus(); + } + + private void OKButton_Click(object sender, RoutedEventArgs e) { + this.DialogResult = true; + Close(); + } + + private void AddSQLSyntaxToSqlInputBox() { + Syntax s; + + s = new Syntax(false); + s.AddWords("alter", "and", "auto_increment", "as", "asc", "by", "create", "database", "delete", "desc", "distinct", "drop", + "from", "group", "having", "in", "insert", "is", "join", "key", "left", "like", "limit", "natural", + "not", "null", "or", "order", "primary", "right", "select", "set", "table", "update", "where"); + s.AddFormatting(Control.ForegroundProperty, Brushes.Blue); + s.AddFormatting(Control.FontWeightProperty, FontWeights.Bold); + SqlInput.SyntaxProvider.AddSyntax(s); + + s = new Syntax(false); + s.AddWords("tinyint", "smallint", "mediumint", "int", "integer", "bigint", "float", + "double", "real", "decimal", "numeric", "date", "datetime", "timestamp", + "time", "year", "char", "varchar", "blob", "text", "enum", "set"); + s.AddFormatting(Control.ForegroundProperty, Brushes.DarkRed); + s.AddFormatting(Control.FontWeightProperty, FontWeights.Medium); + SqlInput.SyntaxProvider.AddSyntax(s); + } + + private void StartDrag(object sender, MouseButtonEventArgs e) { + this.DragMove(); + } + } +} diff --git a/BeWoAdmin/SqlOutputWindow.xaml b/BeWoAdmin/SqlOutputWindow.xaml new file mode 100644 index 0000000..ddbfc35 --- /dev/null +++ b/BeWoAdmin/SqlOutputWindow.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + SQL-Result: + + + + + + + diff --git a/BeWoAdmin/SqlOutputWindow.xaml.cs b/BeWoAdmin/SqlOutputWindow.xaml.cs new file mode 100644 index 0000000..aabddf6 --- /dev/null +++ b/BeWoAdmin/SqlOutputWindow.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BeWoAdmin +{ + /// + /// Interaktionslogik für SqlOutputWindow.xaml + /// + public partial class SqlOutputWindow : Window + { + Window1 parent; + public SqlOutputWindow(Window1 owner,List result) + { + InitializeComponent(); + this.Owner = owner; + this.Show(); + for (int i = 0; i < result.Count; i++) + { + this.Sqloutput.AppendText(result.ElementAt(i).ToString() + "\n"); + } + } + + public void appendSqlQueries(List results) + { + this.Sqloutput.AppendText("\n\n"); + for (int i = 0; i < results.Count; i++) + { + this.Sqloutput.AppendText(results.ElementAt(i).ToString() + "\n"); + } + } + + private void OKButton_Click(object sender, RoutedEventArgs e) + { + + this.Close(); + } + + private void startDrag(object sender, MouseButtonEventArgs e) + { + this.DragMove(); + } + + } +} diff --git a/BeWoAdmin/Tenant.cs b/BeWoAdmin/Tenant.cs new file mode 100644 index 0000000..2726048 --- /dev/null +++ b/BeWoAdmin/Tenant.cs @@ -0,0 +1,246 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.ComponentModel; +using System.Collections.ObjectModel; +using DBToolControls; +using BeWoAdmin.DBAdminService; +using System.Xml.Linq; +using System.Diagnostics; +namespace BeWoAdmin { + public class Tenant: INotifyPropertyChanged { + + public event PropertyChangedEventHandler PropertyChanged; + + private string name; + public string Name { + get { return name; } + set { name = value; NotifyPropertyChange("Name"); } + } + + private string database; + public string Database { + get { return database; } + set { database = value; NotifyPropertyChange("Database"); } + } + + private User user; + public User User { + get { return HasOwnUser ? user : Server.User; } + set { + user = value; + NotifyPropertyChange("User"); + NotifyPropertyChange("HasOwnUser"); + } + } + + public Window1 parent { get; set; } + private bool isChecked; + public bool IsChecked { + get { return isChecked; } + set { + isChecked = value; + NotifyPropertyChange("IsChecked"); + Server.NotifyPropertyChange("IsChecked"); + } + } + private List queryAnswer; + public List GetQueryAnswer + { + get { return this.queryAnswer; } + set { this.queryAnswer = value; } + } + + + public Server Server { get; private set; } + public bool? WasSuccessful { get; set; } + public string ErrorDescription { get; set; } + public Uri SUri { + get { return Server.Uri ; } + } + + public int Index { + get { return this.AndSiblings.IndexOf(this); } + } + + public ObservableCollection AndSiblings { + get { return Server.Tenants; } + } + + public bool HasOwnUser { + get { return user != null; } + } + + // Constructors + + public Tenant(Server server) { + this.Server = server; + this.IsChecked = server.IsChecked == true; + server.Tenants.Add(this); + } + + public Tenant(Server server, string name, string database, User user, bool isChecked) { + this.Server = server; + this.Name = name; + this.Database = database; + this.User = user; + this.IsChecked = isChecked; + server.Tenants.Add(this); + } + + // public methods + + public bool IsSibling(Tenant t) { + return this.Server == t.Server; + } + + public List ExecuteSqlCommand(string sqlCommand) { + return ExecuteRemoteCall(RemoteMethods.ExecuteUpdateOnDatabase, sqlCommand, "SQL-Befehl wird ausgeführt..."); + } + + public List ExecuteHiddenSqlCommand(string sqlCommand) + { + return ExecuteRemoteCall(RemoteMethods.ExecuteHiddenUpdateOnDatabase, sqlCommand, "SQL-Befehl wird ausgeführt..."); + } + + public void TestConnection() { + ExecuteRemoteCall(RemoteMethods.DatabaseIsReachable, null, "teste Verbindung..."); + } + + public List GetTables() { + return ExecuteRemoteCall(RemoteMethods.GetTables, null, "lese Tabellen..."); + } + + public void Move(int offset) { + if (offset != 0) { + int oldIndex = this.Index; + int newIndex = oldIndex + offset; + if (offset < 0) { + if (oldIndex == 0) return; + if (newIndex < 0) newIndex = 0; + } else { + int maxIndex = this.AndSiblings.Count - 1; + if (oldIndex == maxIndex) return; + if (newIndex > maxIndex) newIndex = maxIndex; + } + this.AndSiblings.Move(oldIndex, newIndex); + Server.NotifyPropertyChange("Tenants"); + } + } + + public void NotifyPropertyChange(string propertyName) { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + public bool Remove() { + Server.NotifyPropertyChange("IsChecked"); + return this.AndSiblings.Remove(this); + } + + public void ResetErrorMessage() { + SetSuccess(null, ""); + } + + public XElement ToXElement(string pw) { + return new XElement("Tenant", + new XElement("Name", name), + new XElement("Database", Encrypt(database)), + new XElement("IsChecked", isChecked.ToString()), + HasOwnUser ? user.ToXElement(pw) : null); + } + + public override string ToString() { + return String.Format("{0} {1}, User: {2}", name, database, HasOwnUser ? user.Username : ""); + } + + // private methods + + private enum RemoteMethods { DatabaseIsReachable, ExecuteUpdateOnDatabase, GetTables, ExecuteHiddenUpdateOnDatabase } + private List ExecuteRemoteCall(RemoteMethods method, string sqlCommand, string busyText) { + List returnCollection = new List(); + SetSuccess(null, busyText); + + if (SUri.IsAbsoluteUri) { + try { + DBAdminServiceReturnValue result; + MySqlService dbService = new MySqlService(); + dbService.Url = SUri.AbsoluteUri; + + if (method == RemoteMethods.DatabaseIsReachable) + result = dbService.DatabaseIsReachable(Encrypt(User.Username), Encrypt(User.PasswordAsInsecureString), Encrypt(Database), Encrypt(Server.Port)); + else if (method == RemoteMethods.ExecuteUpdateOnDatabase) + { + result = dbService.ExecuteUpdateOnDatabase(Encrypt(User.Username), Encrypt(User.PasswordAsInsecureString), Encrypt(Server.Port), Encrypt(Database), Encrypt(sqlCommand)); + this.queryAnswer = new List(); + this.queryAnswer.Add("Serverantwort von " + this.Server.Uri.Host + " Datenbank " + this.Name + ":\n"); + for (int i = 0; i < result.QueryAnswer.Length; i++) + { + this.queryAnswer.Add(result.QueryAnswer.ElementAt(i) + " "); + + } + if(this.queryAnswer.Count > 1) + this.parent.showQueryAnswer(this.queryAnswer); + + } + else if (method == RemoteMethods.ExecuteHiddenUpdateOnDatabase) + { + result = dbService.ExecuteHiddenUpdateOnDatabase(Encrypt(User.Username), Encrypt(User.PasswordAsInsecureString), Encrypt(Database), Encrypt(Server.Port), Encrypt(sqlCommand)); + this.queryAnswer = null; + if (result.WasSuccessful) + { + this.queryAnswer = new List(); + for (int i = 0; i < result.QueryAnswer.Length; i++) + { + this.queryAnswer.Add(result.QueryAnswer.ElementAt(i) + " "); + + } + } + returnCollection = this.queryAnswer; + } + else + { // method == RemoteMethods.GetTables + foreach (string s in dbService.GetTables(Encrypt(User.Username), Encrypt(User.PasswordAsInsecureString), Encrypt(Database), Encrypt(Server.Port))) + returnCollection.Add(Decrypt(s)); + if (returnCollection.Count > 0 && returnCollection[0].StartsWith("Auslesen der Tabellen fehlgeschlagen.")) + SetSuccess(false, returnCollection[0]); + else + SetSuccess(true, ""); + return returnCollection; + } + if (result.WasSuccessful) + { + SetSuccess(true, ""); + } + else + SetSuccess(false, String.Format("Verbindung fehlgeschlagen: {0}", Decrypt(result.ErrorMessage))); + } catch (Exception e) { + SetSuccess(false, String.Format("Verbindung fehlgeschlagen: {0} ({1})", e.Message, e.GetType().ToString())); + returnCollection.Add(ErrorDescription); + } + } else { + SetSuccess(false, "Verbindung fehlgeschlagen: Die Uri ist keine absolute Uri."); + } + return returnCollection; + } + + private void SetSuccess(bool? success, string errorDesc) { + WasSuccessful = success; + ErrorDescription = errorDesc; + NotifyPropertyChange("WasSuccessful"); + NotifyPropertyChange("ErrorDescription"); + + // New Window declaration + } + + + private static string Encrypt(string s) { + return EncryptionHelper.EncryptString(App.TransportEncryptionKey, s); + } + + private static string Decrypt(string s) { + return EncryptionHelper.DecryptString(App.TransportEncryptionKey, s); + } + } +} \ No newline at end of file diff --git a/BeWoAdmin/WPF/BackgroundValueConverter.cs b/BeWoAdmin/WPF/BackgroundValueConverter.cs new file mode 100644 index 0000000..2b62812 --- /dev/null +++ b/BeWoAdmin/WPF/BackgroundValueConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows.Media; +using System.Windows.Data; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool), typeof(Brush))] + class BackgroundValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool)value ? Brushes.White : new SolidColorBrush(Color.FromRgb(222, 222, 222)); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/CollapsedIfFalseValueConverter.cs b/BeWoAdmin/WPF/CollapsedIfFalseValueConverter.cs new file mode 100644 index 0000000..abe9012 --- /dev/null +++ b/BeWoAdmin/WPF/CollapsedIfFalseValueConverter.cs @@ -0,0 +1,19 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows.Media; +using System.Windows.Data; +using System.Windows; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool), typeof(Visibility))] + class CollapsedIfFalseValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool)value ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/CustomCommands.cs b/BeWoAdmin/WPF/CustomCommands.cs new file mode 100644 index 0000000..b5b3aa2 --- /dev/null +++ b/BeWoAdmin/WPF/CustomCommands.cs @@ -0,0 +1,45 @@ +using System; +using System.Text; +using System.Windows.Input; + +namespace BeWoAdmin { + public sealed class CustomCommands { + private CustomCommands() { } + + private static RoutedUICommand addServer = new RoutedUICommand("Add Server", "AddServer", typeof(CustomCommands)); + private static RoutedUICommand addDatabase = new RoutedUICommand("Add Database", "AddDatabase", typeof(CustomCommands)); + private static RoutedUICommand removeDatabase = new RoutedUICommand("Remove Database", "RemoveDatabase", typeof(CustomCommands)); + private static RoutedUICommand createDatabase = new RoutedUICommand("Create Database", "CreateDatabase", typeof(CustomCommands)); + private static RoutedUICommand executeSqlOnCheckedDBs = new RoutedUICommand("Execute SQL-Command on checked Databases", "ExecuteSql", typeof(CustomCommands)); + private static RoutedUICommand executeSqlOnSingleDB = new RoutedUICommand("Execute SQL-Command on this Database", "ExecuteSqlOnSingleDB", typeof(CustomCommands)); + private static RoutedUICommand cancelExecution = new RoutedUICommand("Cancel Execution", "CancelExecution", typeof(CustomCommands)); + private static RoutedUICommand testConnection = new RoutedUICommand("Test Connection", "TestConnection", typeof(CustomCommands)); + private static RoutedUICommand testAllConnections = new RoutedUICommand("Test all Connections", "TestAllConnections", typeof(CustomCommands)); + private static RoutedUICommand showTables = new RoutedUICommand("Show Tables", "ShowTables", typeof(CustomCommands)); + private static RoutedUICommand extendDBLicenses = new RoutedUICommand("Extend licenses", "ExtendDBLicenses", typeof(CustomCommands)); + private static RoutedUICommand openBrowser = new RoutedUICommand("Open browser", "OpenBrowser", typeof(CustomCommands)); + static CustomCommands() { + addDatabase.InputGestures.Add(new KeyGesture(Key.A, ModifierKeys.Control, "Strg+A")); + addDatabase.InputGestures.Add(new KeyGesture(Key.Add, ModifierKeys.None, "+")); + removeDatabase.InputGestures.Add(new KeyGesture(Key.Delete, ModifierKeys.None, "Entf")); + createDatabase.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Shift | ModifierKeys.Control, "Strg+Shift+N")); + executeSqlOnCheckedDBs.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control, "Strg+R")); + cancelExecution.InputGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None)); + testConnection.InputGestures.Add(new KeyGesture(Key.T, ModifierKeys.Control, "Strg+T")); + } + + public static RoutedUICommand AddServer { get { return addServer; } } + public static RoutedUICommand AddDatabase { get { return addDatabase; } } + public static RoutedUICommand RemoveDatabase { get { return removeDatabase; } } + public static RoutedUICommand CreateDatabase { get { return createDatabase; } } + public static RoutedUICommand ExecuteSqlOnCheckedDBs { get { return executeSqlOnCheckedDBs; } } + public static RoutedUICommand ExecuteSqlOnSingleDB { get { return executeSqlOnSingleDB; } } + public static RoutedUICommand CancelExecution { get { return cancelExecution; } } + public static RoutedUICommand TestConnection { get { return testConnection; } } + public static RoutedUICommand TestAllConnections { get { return testAllConnections; } } + public static RoutedUICommand ShowTables { get { return showTables; } } + public static RoutedUICommand ExtendDBLicenses { get { return extendDBLicenses; } } + public static RoutedUICommand OpenBrowser { get { return openBrowser; } } + + } +} diff --git a/BeWoAdmin/WPF/FontWeightValueConverter.cs b/BeWoAdmin/WPF/FontWeightValueConverter.cs new file mode 100644 index 0000000..74c55b2 --- /dev/null +++ b/BeWoAdmin/WPF/FontWeightValueConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows.Data; +using System.Windows; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool), typeof(FontWeight))] + class FontWeightValueConverter : IValueConverter{ + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool)value ? FontWeights.Bold : FontWeights.Regular; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/ForegroundValueConverter.cs b/BeWoAdmin/WPF/ForegroundValueConverter.cs new file mode 100644 index 0000000..6ced278 --- /dev/null +++ b/BeWoAdmin/WPF/ForegroundValueConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows.Media; +using System.Windows.Data; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool), typeof(Brush))] + class ForegroundValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool)value ? Brushes.Black : Brushes.DarkGray; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/Resources.xaml b/BeWoAdmin/WPF/Resources.xaml new file mode 100644 index 0000000..f5fcb7a --- /dev/null +++ b/BeWoAdmin/WPF/Resources.xaml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWoAdmin/WPF/SuccessBackgroundValueConverter.cs b/BeWoAdmin/WPF/SuccessBackgroundValueConverter.cs new file mode 100644 index 0000000..ce99e9d --- /dev/null +++ b/BeWoAdmin/WPF/SuccessBackgroundValueConverter.cs @@ -0,0 +1,21 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Media; +using System.Windows.Data; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool?), typeof(Brush))] + class SuccessBackgroundValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + if(value == null) return Brushes.Transparent; + if ((bool)value) return new SolidColorBrush(Color.FromArgb(127, 32, 220, 32)); // Brushes.LightGreen on white background + else return new SolidColorBrush(Color.FromArgb(127, 255, 109, 130)); // Brushes.LightPink on white background + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/VisibleIfFalseValueConverter.cs b/BeWoAdmin/WPF/VisibleIfFalseValueConverter.cs new file mode 100644 index 0000000..ee60c3e --- /dev/null +++ b/BeWoAdmin/WPF/VisibleIfFalseValueConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Text; +using System.Windows.Media; +using System.Windows.Data; +using System.Windows; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool?), typeof(Visibility))] + class VisibleIfFalseValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool?)value == false ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/WPF/VisibleIfTrueValueConverter.cs b/BeWoAdmin/WPF/VisibleIfTrueValueConverter.cs new file mode 100644 index 0000000..76e55ff --- /dev/null +++ b/BeWoAdmin/WPF/VisibleIfTrueValueConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Text; +using System.Windows.Media; +using System.Windows.Data; +using System.Windows; + +namespace BeWoAdmin { + [ValueConversion(typeof(bool?), typeof(Visibility))] + class VisibleIfTrueValueConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + return (bool?)value == false ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { + throw new NotSupportedException(); + } + } +} diff --git a/BeWoAdmin/Web References/DBAdminService/DBAdminServiceReturnValue1.datasource b/BeWoAdmin/Web References/DBAdminService/DBAdminServiceReturnValue1.datasource new file mode 100644 index 0000000..d1f1d82 --- /dev/null +++ b/BeWoAdmin/Web References/DBAdminService/DBAdminServiceReturnValue1.datasource @@ -0,0 +1,10 @@ + + + + BeWoAdmin.DBAdminService.DBAdminServiceReturnValue, Web References.DBAdminService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/BeWoAdmin/Web References/DBAdminService/MySqlService.disco b/BeWoAdmin/Web References/DBAdminService/MySqlService.disco new file mode 100644 index 0000000..d2cd88b --- /dev/null +++ b/BeWoAdmin/Web References/DBAdminService/MySqlService.disco @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BeWoAdmin/Web References/DBAdminService/MySqlService.wsdl b/BeWoAdmin/Web References/DBAdminService/MySqlService.wsdl new file mode 100644 index 0000000..dcbbd74 --- /dev/null +++ b/BeWoAdmin/Web References/DBAdminService/MySqlService.wsdl @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWoAdmin/Web References/DBAdminService/Reference.cs b/BeWoAdmin/Web References/DBAdminService/Reference.cs new file mode 100644 index 0000000..716ca50 --- /dev/null +++ b/BeWoAdmin/Web References/DBAdminService/Reference.cs @@ -0,0 +1,593 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.17929 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +// +// Der Quellcode wurde automatisch mit Microsoft.VSDesigner generiert. Version 4.0.30319.17929. +// +#pragma warning disable 1591 + +namespace BeWoAdmin.DBAdminService { + using System; + using System.Web.Services; + using System.Diagnostics; + using System.Web.Services.Protocols; + using System.Xml.Serialization; + using System.ComponentModel; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="MySqlServiceSoap", Namespace="http://tempuri.org")] + public partial class MySqlService : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private System.Threading.SendOrPostCallback createDatabaseOperationCompleted; + + private System.Threading.SendOrPostCallback GetDatabaseListOperationCompleted; + + private System.Threading.SendOrPostCallback ExecuteUpdateOnDatabaseOperationCompleted; + + private System.Threading.SendOrPostCallback ExecuteHiddenUpdateOnDatabaseOperationCompleted; + + private System.Threading.SendOrPostCallback DatabaseIsReachableOperationCompleted; + + private System.Threading.SendOrPostCallback GetTablesOperationCompleted; + + private System.Threading.SendOrPostCallback CreateNewTenantIDOperationCompleted; + + private bool useDefaultCredentialsSetExplicitly; + + /// + public MySqlService() { + this.Url = global::BeWoAdmin.Properties.Settings.Default.DBToolTest2_DBAdminService_MySqlService; + if ((this.IsLocalFileSystemWebService(this.Url) == true)) { + this.UseDefaultCredentials = true; + this.useDefaultCredentialsSetExplicitly = false; + } + else { + this.useDefaultCredentialsSetExplicitly = true; + } + } + + public new string Url { + get { + return base.Url; + } + set { + if ((((this.IsLocalFileSystemWebService(base.Url) == true) + && (this.useDefaultCredentialsSetExplicitly == false)) + && (this.IsLocalFileSystemWebService(value) == false))) { + base.UseDefaultCredentials = false; + } + base.Url = value; + } + } + + public new bool UseDefaultCredentials { + get { + return base.UseDefaultCredentials; + } + set { + base.UseDefaultCredentials = value; + this.useDefaultCredentialsSetExplicitly = true; + } + } + + /// + public event createDatabaseCompletedEventHandler createDatabaseCompleted; + + /// + public event GetDatabaseListCompletedEventHandler GetDatabaseListCompleted; + + /// + public event ExecuteUpdateOnDatabaseCompletedEventHandler ExecuteUpdateOnDatabaseCompleted; + + /// + public event ExecuteHiddenUpdateOnDatabaseCompletedEventHandler ExecuteHiddenUpdateOnDatabaseCompleted; + + /// + public event DatabaseIsReachableCompletedEventHandler DatabaseIsReachableCompleted; + + /// + public event GetTablesCompletedEventHandler GetTablesCompleted; + + /// + public event CreateNewTenantIDCompletedEventHandler CreateNewTenantIDCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/createDatabase", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public DBAdminServiceReturnValue createDatabase(string userName, string pw, string port, string query, string customerName) { + object[] results = this.Invoke("createDatabase", new object[] { + userName, + pw, + port, + query, + customerName}); + return ((DBAdminServiceReturnValue)(results[0])); + } + + /// + public void createDatabaseAsync(string userName, string pw, string port, string query, string customerName) { + this.createDatabaseAsync(userName, pw, port, query, customerName, null); + } + + /// + public void createDatabaseAsync(string userName, string pw, string port, string query, string customerName, object userState) { + if ((this.createDatabaseOperationCompleted == null)) { + this.createDatabaseOperationCompleted = new System.Threading.SendOrPostCallback(this.OncreateDatabaseOperationCompleted); + } + this.InvokeAsync("createDatabase", new object[] { + userName, + pw, + port, + query, + customerName}, this.createDatabaseOperationCompleted, userState); + } + + private void OncreateDatabaseOperationCompleted(object arg) { + if ((this.createDatabaseCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.createDatabaseCompleted(this, new createDatabaseCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetDatabaseList", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetDatabaseList(string userName, string pw, string port) { + object[] results = this.Invoke("GetDatabaseList", new object[] { + userName, + pw, + port}); + return ((string[])(results[0])); + } + + /// + public void GetDatabaseListAsync(string userName, string pw, string port) { + this.GetDatabaseListAsync(userName, pw, port, null); + } + + /// + public void GetDatabaseListAsync(string userName, string pw, string port, object userState) { + if ((this.GetDatabaseListOperationCompleted == null)) { + this.GetDatabaseListOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetDatabaseListOperationCompleted); + } + this.InvokeAsync("GetDatabaseList", new object[] { + userName, + pw, + port}, this.GetDatabaseListOperationCompleted, userState); + } + + private void OnGetDatabaseListOperationCompleted(object arg) { + if ((this.GetDatabaseListCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetDatabaseListCompleted(this, new GetDatabaseListCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ExecuteUpdateOnDatabase", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public DBAdminServiceReturnValue ExecuteUpdateOnDatabase(string userName, string pw, string port, string db, string query) { + object[] results = this.Invoke("ExecuteUpdateOnDatabase", new object[] { + userName, + pw, + port, + db, + query}); + return ((DBAdminServiceReturnValue)(results[0])); + } + + /// + public void ExecuteUpdateOnDatabaseAsync(string userName, string pw, string port, string db, string query) { + this.ExecuteUpdateOnDatabaseAsync(userName, pw, port, db, query, null); + } + + /// + public void ExecuteUpdateOnDatabaseAsync(string userName, string pw, string port, string db, string query, object userState) { + if ((this.ExecuteUpdateOnDatabaseOperationCompleted == null)) { + this.ExecuteUpdateOnDatabaseOperationCompleted = new System.Threading.SendOrPostCallback(this.OnExecuteUpdateOnDatabaseOperationCompleted); + } + this.InvokeAsync("ExecuteUpdateOnDatabase", new object[] { + userName, + pw, + port, + db, + query}, this.ExecuteUpdateOnDatabaseOperationCompleted, userState); + } + + private void OnExecuteUpdateOnDatabaseOperationCompleted(object arg) { + if ((this.ExecuteUpdateOnDatabaseCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ExecuteUpdateOnDatabaseCompleted(this, new ExecuteUpdateOnDatabaseCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ExecuteHiddenUpdateOnDatabase", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public DBAdminServiceReturnValue ExecuteHiddenUpdateOnDatabase(string userName, string pw, string db, string port, string query) { + object[] results = this.Invoke("ExecuteHiddenUpdateOnDatabase", new object[] { + userName, + pw, + db, + port, + query}); + return ((DBAdminServiceReturnValue)(results[0])); + } + + /// + public void ExecuteHiddenUpdateOnDatabaseAsync(string userName, string pw, string db, string port, string query) { + this.ExecuteHiddenUpdateOnDatabaseAsync(userName, pw, db, port, query, null); + } + + /// + public void ExecuteHiddenUpdateOnDatabaseAsync(string userName, string pw, string db, string port, string query, object userState) { + if ((this.ExecuteHiddenUpdateOnDatabaseOperationCompleted == null)) { + this.ExecuteHiddenUpdateOnDatabaseOperationCompleted = new System.Threading.SendOrPostCallback(this.OnExecuteHiddenUpdateOnDatabaseOperationCompleted); + } + this.InvokeAsync("ExecuteHiddenUpdateOnDatabase", new object[] { + userName, + pw, + db, + port, + query}, this.ExecuteHiddenUpdateOnDatabaseOperationCompleted, userState); + } + + private void OnExecuteHiddenUpdateOnDatabaseOperationCompleted(object arg) { + if ((this.ExecuteHiddenUpdateOnDatabaseCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ExecuteHiddenUpdateOnDatabaseCompleted(this, new ExecuteHiddenUpdateOnDatabaseCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DatabaseIsReachable", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public DBAdminServiceReturnValue DatabaseIsReachable(string userName, string pw, string db, string port) { + object[] results = this.Invoke("DatabaseIsReachable", new object[] { + userName, + pw, + db, + port}); + return ((DBAdminServiceReturnValue)(results[0])); + } + + /// + public void DatabaseIsReachableAsync(string userName, string pw, string db, string port) { + this.DatabaseIsReachableAsync(userName, pw, db, port, null); + } + + /// + public void DatabaseIsReachableAsync(string userName, string pw, string db, string port, object userState) { + if ((this.DatabaseIsReachableOperationCompleted == null)) { + this.DatabaseIsReachableOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDatabaseIsReachableOperationCompleted); + } + this.InvokeAsync("DatabaseIsReachable", new object[] { + userName, + pw, + db, + port}, this.DatabaseIsReachableOperationCompleted, userState); + } + + private void OnDatabaseIsReachableOperationCompleted(object arg) { + if ((this.DatabaseIsReachableCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DatabaseIsReachableCompleted(this, new DatabaseIsReachableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetTables", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetTables(string userName, string pw, string db, string port) { + object[] results = this.Invoke("GetTables", new object[] { + userName, + pw, + db, + port}); + return ((string[])(results[0])); + } + + /// + public void GetTablesAsync(string userName, string pw, string db, string port) { + this.GetTablesAsync(userName, pw, db, port, null); + } + + /// + public void GetTablesAsync(string userName, string pw, string db, string port, object userState) { + if ((this.GetTablesOperationCompleted == null)) { + this.GetTablesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetTablesOperationCompleted); + } + this.InvokeAsync("GetTables", new object[] { + userName, + pw, + db, + port}, this.GetTablesOperationCompleted, userState); + } + + private void OnGetTablesOperationCompleted(object arg) { + if ((this.GetTablesCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetTablesCompleted(this, new GetTablesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateNewTenantID", RequestNamespace="http://tempuri.org", ResponseNamespace="http://tempuri.org", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string CreateNewTenantID() { + object[] results = this.Invoke("CreateNewTenantID", new object[0]); + return ((string)(results[0])); + } + + /// + public void CreateNewTenantIDAsync() { + this.CreateNewTenantIDAsync(null); + } + + /// + public void CreateNewTenantIDAsync(object userState) { + if ((this.CreateNewTenantIDOperationCompleted == null)) { + this.CreateNewTenantIDOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateNewTenantIDOperationCompleted); + } + this.InvokeAsync("CreateNewTenantID", new object[0], this.CreateNewTenantIDOperationCompleted, userState); + } + + private void OnCreateNewTenantIDOperationCompleted(object arg) { + if ((this.CreateNewTenantIDCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CreateNewTenantIDCompleted(this, new CreateNewTenantIDCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + + private bool IsLocalFileSystemWebService(string url) { + if (((url == null) + || (url == string.Empty))) { + return false; + } + System.Uri wsUri = new System.Uri(url); + if (((wsUri.Port >= 1024) + && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { + return true; + } + return false; + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org")] + public partial class DBAdminServiceReturnValue { + + private string[] queryAnswerField; + + private bool wasSuccessfulField; + + private string errorMessageField; + + /// + public string[] QueryAnswer { + get { + return this.queryAnswerField; + } + set { + this.queryAnswerField = value; + } + } + + /// + public bool WasSuccessful { + get { + return this.wasSuccessfulField; + } + set { + this.wasSuccessfulField = value; + } + } + + /// + public string ErrorMessage { + get { + return this.errorMessageField; + } + set { + this.errorMessageField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void createDatabaseCompletedEventHandler(object sender, createDatabaseCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class createDatabaseCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal createDatabaseCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public DBAdminServiceReturnValue Result { + get { + this.RaiseExceptionIfNecessary(); + return ((DBAdminServiceReturnValue)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void GetDatabaseListCompletedEventHandler(object sender, GetDatabaseListCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetDatabaseListCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetDatabaseListCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void ExecuteUpdateOnDatabaseCompletedEventHandler(object sender, ExecuteUpdateOnDatabaseCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ExecuteUpdateOnDatabaseCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ExecuteUpdateOnDatabaseCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public DBAdminServiceReturnValue Result { + get { + this.RaiseExceptionIfNecessary(); + return ((DBAdminServiceReturnValue)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void ExecuteHiddenUpdateOnDatabaseCompletedEventHandler(object sender, ExecuteHiddenUpdateOnDatabaseCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ExecuteHiddenUpdateOnDatabaseCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ExecuteHiddenUpdateOnDatabaseCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public DBAdminServiceReturnValue Result { + get { + this.RaiseExceptionIfNecessary(); + return ((DBAdminServiceReturnValue)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void DatabaseIsReachableCompletedEventHandler(object sender, DatabaseIsReachableCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DatabaseIsReachableCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DatabaseIsReachableCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public DBAdminServiceReturnValue Result { + get { + this.RaiseExceptionIfNecessary(); + return ((DBAdminServiceReturnValue)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void GetTablesCompletedEventHandler(object sender, GetTablesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetTablesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetTablesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + public delegate void CreateNewTenantIDCompletedEventHandler(object sender, CreateNewTenantIDCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CreateNewTenantIDCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CreateNewTenantIDCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/BeWoAdmin/Web References/DBAdminService/Reference.map b/BeWoAdmin/Web References/DBAdminService/Reference.map new file mode 100644 index 0000000..859fbe6 --- /dev/null +++ b/BeWoAdmin/Web References/DBAdminService/Reference.map @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/BeWoAdmin/Window1.xaml b/BeWoAdmin/Window1.xaml new file mode 100644 index 0000000..126763c --- /dev/null +++ b/BeWoAdmin/Window1.xaml @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | User: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , Datenbank: + + , User: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +