public void InitializeMe (String Bereich, WCFStandardsNS.WCFStandards DataBase, CommonDataBase.StatusCallBack StatusCallbackHandler) { SetMessageCallback (StatusCallbackHandler); m_DataBase = DataBase; m_ShowFullPage.InitializeMe (Bereich, m_DataBase, m_StatusCallBackHandler); }
private bool DoStartupProcessing () { m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Properties.Settings.Default.WebConnectionStringName; WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_DataBase; m_RootDirectory = Path.Combine(CommonDataBase.DataBase.GetLocalWPMediaRoot (), WMB.Basics.GetUserConfigurationSettingsValue ("RootDirectoryForStoredOldContent")); if (!Directory.Exists (m_RootDirectory)) Directory.CreateDirectory (m_RootDirectory); String FullControlFileName = System.IO.Path.Combine (m_RootDirectory, ControlFileName); if (!File.Exists (FullControlFileName)) { MessageBox.Show ("Der ControlFile \"" + FullControlFileName + "\" existiert nicht!!"); return false; } StreamReader ControlFile = new StreamReader (FullControlFileName); m_UrlToCheckdataList = new List<UrlToCheckData> (); while (ControlFile.Peek () != 0) { String ControlLine = ControlFile.ReadLine (); if (String.IsNullOrEmpty (ControlLine)) break; String [] Elements = ControlLine.Split (';'); UrlToCheckData NewEntry = new UrlToCheckData (Elements); NewEntry.m_RootDirectory = m_RootDirectory; m_UrlToCheckdataList.Add (NewEntry); } return true; }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Properties.Settings.Default.WebConnectionStringName; WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_DataBase; RunProcessing (); }
public IntelliSenseAutoCompletionFactoryRoutines (WCFStandardsNS.WCFStandards DataBase) { if (DataBase != null) { m_DataBase = DataBase; //TODO its not running for all databases return; SchemaDataSet = m_DataBase.GetCommonSchemaDataSet (); } }
public void InitializeMe (String Bereich, WCFStandardsNS.WCFStandards DataBase, CommonDataBase.StatusCallBack StatusCallBackHandler) { m_Bereich = Bereich; m_DataBase = DataBase; SetMessageCallback (StatusCallBackHandler); if (m_StructureDataSet != null) m_StructureDataSet.Dispose (); m_StructureDataSet = null; LoadStructure (); }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_WebService = new WCFStandardsNS.WCFStandards (); m_WebService.DefaultConnectionStringName = Settings.Default.AEAGConnectionStringName; WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_WebService; //m_WebService.CheckOrChangeNetworkAddress (null); String[] Rollen = null; if (String.Compare (WMB.Basics.GetComputerName ().ToUpper( ), "KPINFO01", true) == 0) { Rollen = CVM.LoginHandler.CheckUser("Info", "wptv"); //Rollen = CVM.LoginHandler.CheckUser("InfoUser", "wptv"); //Rollen = CVM.LoginHandler.CheckUser("Heinz", "monika"); this.WindowState = System.Windows.WindowState.Minimized; IsAutoRun = true; } else { Rollen = CVM.LoginHandler.CheckUser (ref m_UserName); } if (Rollen == null) { Close (); e.Handled = true; return; } List<String> RelevantRollen = new List<string> (); foreach (String Rolle in Rollen) if (Rolle.IndexOf ("LeisureManagementTV_") != -1) RelevantRollen.Add (Rolle.Replace ("LeisureManagementTV_", "")); WMB.WPMediaApplicationState.Instance.Properties ["Rollen"] = RelevantRollen.ToArray (); try { m_LeisureManagementControl = new LeisureManagementControl (); } catch (Exception excp) { MessageBox.Show ("Fehler bei LeisureManagementControl.new\r\n" + excp.Message); Close (); } // SchemaDataSet = m_WebService.GetCommonSchemaDataSet (); SizeToContent = SizeToContent.WidthAndHeight; // m_LeisureManagementControl.SchemaDataSet = SchemaDataSet; m_LeisureManagementControl.DataAccess = m_WebService; m_LeisureManagementControl.Rollen = RelevantRollen.ToArray (); m_LeisureManagementControl.CloseRequestedCall += new CloseRequested (m_LeisureManagementControl_CloseRequestedCall); m_LeisureManagementControl.IsAutoRun = IsAutoRun; WindowGrid.Children.Add (m_LeisureManagementControl); // CVM.LayoutManagerControl.LoadUserSettings (); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("Started mit Rollen \"" + String.Join(", ", (String []) WMB.WPMediaApplicationState.Instance.Properties["Rollen"]) + "\""); }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Properties.Settings.Default.WebConnectionStringName; WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_DataBase; System.Threading.Thread.CurrentThread.SetApartmentState (ApartmentState.STA); m_XAMLHandling = new XAMLHandling (m_CVM); // sac xxx #if DEBUG if (String.Compare (WMB.Basics.GetComputerName (), "Heinz64", true) == 0) { String WPMediaConnectionStringName = WMB.Basics.GetUserConfigurationSettingsValue("WPMediaConnectionStringName"); RunTest(); return; } #endif RunCreation (); }
public void SetData (MBRWahl.CommonValues Cvm, bool RunAsynchron, bool FirstTimeDoDataBaseCheckUp) { m_CVM = Cvm; m_RunAsynchron = RunAsynchron; m_FirstTimeDoDataBaseCheckUp = FirstTimeDoDataBaseCheckUp; m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Settings.Default.WebConnectionStringName; //m_DataBase.UserName = "******"; //m_DataBase.PassWord = "******"; m_LocalDataBase = new WCFStandardsNS.WCFStandards (); m_LocalDataBase.DefaultConnectionStringName = Settings.Default.LocalConnectionStringName; //m_LocalDataBase.UserName = "******"; //m_LocalDataBase.PassWord = "******"; //if (m_RunAsynchron == true) // { // m_DataBase.UseAsyEndpoints = true; // m_LocalDataBase.UseAsyEndpoints = true; // } }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Settings.Default.WebConnectionStringName; m_IntelliSenseAutoCompletionFactory = new IntelliSenseAutoCompletionFactoryRoutines (m_DataBase); WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_DataBase; String [] Rollen = CVM.LoginHandler.CheckUser (ref m_UserName); if (Rollen == null) { Close (); e.Handled = true; return; } m_IntelliSenseAutoCompletionManagementControl = new IntelliSenseAutoCompletionManagementControl (); m_IntelliSenseAutoCompletionManagementControl.m_DataBase = m_DataBase; m_IntelliSenseAutoCompletionManagementControl.m_IIntelliSenseAutoCompletionFactory = m_IntelliSenseAutoCompletionFactory as CVM.IIntelliSenseAutoCompletionFactory; this.Content = m_IntelliSenseAutoCompletionManagementControl; }
public void Run () { m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; m_CVM = new CVM.CommonValues (); m_BannerFileName = m_CVM.GetBannerCreationFileName ("Haus"); if (!Directory.Exists (Path.GetDirectoryName (m_BannerFileName))) Directory.CreateDirectory (Path.GetDirectoryName (m_BannerFileName)); m_AllHotNewsTexte = new ArrayList (); m_AllNewsTexte = new ArrayList (); CreateBannerData (); m_ButtonRootDirectory = Path.GetDirectoryName (m_CVM.GetButtonCreationFileName ("Haus", "x")); m_WPMediaDataPages = Path.GetDirectoryName (m_CVM.GetButtonCreationHTMLFileName ("x")); if (!Directory.Exists (m_ButtonRootDirectory)) Directory.CreateDirectory (m_ButtonRootDirectory); if (!Directory.Exists (m_WPMediaDataPages)) Directory.CreateDirectory (m_WPMediaDataPages); CreateButtonData (); }
void m_ActualizeDataBase_DoWork (object sender, DoWorkEventArgs e) { List<String> TablesToActualize = e.Argument as List<String>; WCFStandardsNS.WCFStandards WebService = new WCFStandardsNS.WCFStandards (); WebService.DefaultConnectionStringName = Settings.Default.WebConnectionStringName; WebService.ProcessAllDefaultFilling (TablesToActualize); }
private void Window_Loaded (object sender, RoutedEventArgs e) { if (WMB.Basics.IAmActiveBefore ()) Close (); m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Settings.Default.WebConnectionStringName; // m_Basics = new CommonBasics (); // m_DataBase.ConnectionStringName = "WPMediaAddOnDataConnectionString"; WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_DataBase; String [] Rollen = CVM.LoginHandler.CheckUser (ref m_UserName); if (Rollen == null) { Close (); e.Handled = true; return; } WMB.WPMediaApplicationState.Instance.Properties ["UserName"] = m_UserName; // when UserManagement is fully functioning, repace this code with the commented line sac xxx List<String> RelevantRollen = new List<string> (); foreach (String Rolle in Rollen) if (Rolle.IndexOf ("StandBildTV_") != -1) RelevantRollen.Add (Rolle.Replace ("StandBildTV_", "")); WMB.WPMediaApplicationState.Instance.Properties ["Rollen"] = RelevantRollen.ToArray (); // WMB.WPMediaApplicationState.Instance.Properties ["Rollen"] = Rollen; DispatcherTimer FileHandlingTimer = new DispatcherTimer(); FileHandlingTimer.Interval = TimeSpan.FromMilliseconds (1); FileHandlingTimer.Tick += new EventHandler (FileHandlingTimer_Tick); FileHandlingTimer.Start (); }
private void ProcessDataBaseCorrection () { WCFStandardsNS.WCFStandards DataBase = new WCFStandardsNS.WCFStandards (); DataSet WrongVideoFiles = DataBase.GetCommonDataSet ("SELECT DISTINCT FoldedArchivePath, COUNT(*) AS Number " + "FROM VideoFiles " + "GROUP BY FoldedArchivePath " + "ORDER BY FoldedArchivePath"); int NumberOfNonAssignedVideoFiles = 0; int NumberOfSingleAssignedVideoFiles = 0; int NumberOfMultipleAssignedVideoFiles = 0; int OverallNumberOfWrongEntries = 0; foreach (DataRow WrongEntry in WrongVideoFiles.Tables ["VideoFiles"].Rows) { int NumberOfWrongEntries = Convert.ToInt32 (WrongEntry ["Number"]); if (NumberOfWrongEntries < 2) continue; OverallNumberOfWrongEntries++; String WrongFoldedPath = WrongEntry ["FoldedArchivePath"].ToString (); DataSet VideoFilesPlusMaterial = DataBase.GetCommonMultiDataSet (new String[] { String.Format ( "Select * from VideoFiles where FoldedArchivePath = '{0}' order by ModifyTimeStamp", WrongFoldedPath), String.Format ( "Select * from StructuredMaterialDataBase where FoldedArchivePath = '{0}' order by ArchiveID", WrongFoldedPath) }); if (WCFStandardsNS.WCFStandards.GetErrorMessages(VideoFilesPlusMaterial) != null) { String[] ErrorStrings = WCFStandardsNS.WCFStandards.GetErrorMessages (VideoFilesPlusMaterial); } List<String> FoundIDs = new List<string> (); int NumberOfAssignedVideoFiles = 0; String ArchiveIDs = String.Empty; foreach (DataRow VideoRow in VideoFilesPlusMaterial.Tables ["VideoFiles"].Rows) { String FileID = VideoRow ["FileID"].ToString (); DataSet Zuordnung = DataBase.GetCommonDataSet (String.Format ("Select * from VideoFilesZuBeitraege where FileID = '{0}'", FileID)); String ModifyTimeStamp = VideoRow ["ModifyTimeStamp"].ToString (); if (Zuordnung.Tables ["VideoFilesZuBeitraege"].Rows.Count == 0) { FoundIDs.Add (FileID); } else { NumberOfAssignedVideoFiles++; FoundIDs.Add (FileID); foreach (DataRow ZuordnungRow in Zuordnung.Tables ["VideoFilesZuBeitraege"].Rows) { } } } foreach (DataRow MaterialRow in VideoFilesPlusMaterial.Tables ["StructuredMaterialDataBase"].Rows) { ArchiveIDs = ArchiveIDs + MaterialRow ["ArchiveID"].ToString () + " "; } if (NumberOfAssignedVideoFiles > 1) { NumberOfMultipleAssignedVideoFiles++; MessageBox.Show ("Bei \"" + WrongFoldedPath + "\" ist mehr als ein VideoFile Entry zugeordnet\r\n" + String.Join ("\r\n", FoundIDs.ToArray ())); } if (NumberOfAssignedVideoFiles== 1) { NumberOfSingleAssignedVideoFiles++; MessageBox.Show ("Bei \"" + WrongFoldedPath + "\" ist ein VideoFile Entry zugeordnet\r\n" + String.Join ("\r\n", FoundIDs.ToArray ())); } if (NumberOfAssignedVideoFiles == 0) { NumberOfNonAssignedVideoFiles++; DataSet MaterialToChange = DataBase.GetCommonDataSet (String.Format ("Select * from StructuredMaterialDataBase where FoldedArchivePath = '{0}'", WrongFoldedPath)); String IDToRetain = FoundIDs [0]; FoundIDs.RemoveAt (0); foreach (DataRow MaterialRowToChange in MaterialToChange.Tables ["StructuredMaterialDataBase"].Rows) { String MaterialID = MaterialRowToChange ["ID"].ToString (); String OldFileID = MaterialRowToChange ["FileID"].ToString (); if (OldFileID != IDToRetain) DataBase.RunSQLBatch (String.Format ("Update StructuredMaterialDataBase set FileID = '{0}' where ID = '{1}'", IDToRetain, MaterialID)); } foreach (String IDToDelete in FoundIDs) { DataBase.RunSQLBatch (String.Format ("Delete VideoFiles where FileID = '{0}'", IDToDelete)); } //MessageBox.Show ("Bei \"" + WrongFoldedPath + "\" ist kein VideoFile Entry zugeordnet\r\n" // + String.Join ("\r\n", FoundIDs.ToArray ())); } } MessageBox.Show ("Insgesamt falsch = " + Convert.ToString (OverallNumberOfWrongEntries) + "\r\n" + "Non Assigned = " + Convert.ToString (NumberOfNonAssignedVideoFiles) + "\r\n" + "Single Assigned = " + Convert.ToString (NumberOfSingleAssignedVideoFiles) + "\r\n" + "Multi Assigned = " + Convert.ToString (NumberOfMultipleAssignedVideoFiles) + "\r\n"); }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_WebService = new WCFStandardsNS.WCFStandards (); m_WebService.DefaultConnectionStringName = Settings.Default.WebConnectionStringNameTest; if (ExternalControlServer.ActuallCommands.ContainsKey ("ConnectionStringName") == true) { String ConnectionStringName = ExternalControlServer.ActuallCommands ["ConnectionStringName"]; WMB.WPMediaApplicationState.Instance.Properties ["ExternalSetConnectionStringName"] = ConnectionStringName; if (m_WebService != null) m_WebService.DefaultConnectionStringName = ConnectionStringName; } #if DEBUG WMB.WPMediaApplicationState.Instance.Properties ["ExternalSetConnectionStringName"] = "AltErlaaInfoConnectionString"; m_WebService.DefaultConnectionStringName = "AltErlaaInfoConnectionString"; #endif WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = m_WebService; String [] Rollen = CVM.LoginHandler.CheckUser (ref m_UserName); if (Rollen == null) { Close (); return; } WMB.WPMediaApplicationState.Instance.Properties ["Rollen"] = Rollen; try { m_StartupPage = new Page1(); m_UserAuthenticated = true; } catch (Exception excp) { MessageBox.Show ("Fehler bei Page1.new\r\n" + excp.ToString()); Close (); } m_StartupPage.DataBase = m_WebService; this.Title = "Personen-, Organisationen- und AdressenVerwaltung mit " + m_WebService.DefaultConnectionStringName + " Daten"; m_StartupPage.Rollen = Rollen; this.Content = m_StartupPage; m_UserAuthenticated = true; CreateTableHandlerDefinitions (); }
private void CorrectStructuredMaterialDataBase () { WCFStandardsNS.WCFStandards DataBase = new WCFStandardsNS.WCFStandards (); DataSet MaterialTypenDataSet = DataBase.GetCommonDataSet ("Select TechnicalTyp from MaterialType"); DataTable MaterialTable = MaterialTypenDataSet.Tables ["MaterialType"]; DataSet FileIDsDataSet = DataBase.GetCommonDataSet ("Select Distinct FileID from " + "StructuredMaterialDataBase"); foreach (DataRow FileIDRow in FileIDsDataSet.Tables ["StructuredMaterialDataBase"].Rows) { DataSet EntriesForOneFileID = DataBase.GetCommonDataSet (String.Format ("Select * from StructuredMaterialDataBase where FileID = '{0}' order by FoldedArchivePath", FileIDRow ["FileID"].ToString ())); bool ErrorFound = false; List<String> FoldedNames = new List<string> (); List<String> FoundIDs = new List<string> (); foreach (DataRow MaterialRow in EntriesForOneFileID.Tables ["StructuredMaterialDataBase"].Rows) { String FoldedArchivePath = MaterialRow ["FoldedArchivePath"].ToString (); FoldedNames.Add (FoldedArchivePath); foreach (DataRow MaterialTypenRow in MaterialTable.Rows) { String Replacement = "_" + MaterialTypenRow [0].ToString ().ToUpper () + "_"; if (FoldedArchivePath.IndexOf (Replacement, StringComparison.InvariantCultureIgnoreCase) != -1) { ErrorFound = true; String NewSearchName = FoldedArchivePath.Replace (Replacement, ""); MaterialRow ["FoldedArchivePath"] = NewSearchName; } } } if (ErrorFound == true) { //MessageBox.Show ("Fehler bei ID\r\n" + FileIDRow ["FileID"].ToString () // + "\r\n" + String.Join ("\r\n", FoldedNames.ToArray())); DataBase.SetCommonDataSet (EntriesForOneFileID); } } }
private void RemoveDuplicateStructuredMaterialDataBaseEntries () { WCFStandardsNS.WCFStandards DataBase = new WCFStandardsNS.WCFStandards (); DataSet MaterialTypenDataSet = DataBase.GetCommonDataSet ("Select TechnicalTyp from MaterialType"); DataTable MaterialTable = MaterialTypenDataSet.Tables ["MaterialType"]; DataSet FileIDsDataSet = DataBase.GetCommonDataSet ("Select Distinct FileID from " + "StructuredMaterialDataBase"); int DeleteCounter = 0; int UniqueCounter = 0; foreach (DataRow FileIDRow in FileIDsDataSet.Tables ["StructuredMaterialDataBase"].Rows) { DataSet EntriesForOneFileID = DataBase.GetCommonDataSet (String.Format ("Select * from StructuredMaterialDataBase where FileID = '{0}' order by ArchiveID, " + "TechnicalTyp, ModifyTimeStamp", FileIDRow ["FileID"].ToString ())); UniqueCounter++; String OldArchiveID = String.Empty; String OldTechnicalTyp = String.Empty; DateTime OldModifyTimeStamp = DateTime.MinValue; List<String> FoundIDs = new List<string> (); String FoldedArchivePath = String.Empty; foreach (DataRow MaterialRow in EntriesForOneFileID.Tables ["StructuredMaterialDataBase"].Rows) { FoldedArchivePath = MaterialRow ["FoldedArchivePath"].ToString (); String ArchiveID = MaterialRow ["ArchiveID"].ToString (); String TechnicalTyp = MaterialRow ["TechnicalTyp"].ToString (); DateTime ModifyTimeStamp; if (Convert.IsDBNull (MaterialRow ["ModifyTimeStamp"])) ModifyTimeStamp = DateTime.Parse ("1990-01-01 23:59:59"); else ModifyTimeStamp = Convert.ToDateTime (MaterialRow ["ModifyTimeStamp"]); if ((OldArchiveID == ArchiveID) && (OldTechnicalTyp == TechnicalTyp) && (OldModifyTimeStamp == ModifyTimeStamp)) { DeleteCounter++; FoundIDs.Add (MaterialRow ["ID"].ToString ()); DataBase.RunSQLBatch (String.Format ("Delete StructuredMaterialDataBase where ID = '{0}'", MaterialRow ["ID"].ToString ())); } else { OldArchiveID = ArchiveID; OldTechnicalTyp = TechnicalTyp; OldModifyTimeStamp = ModifyTimeStamp; } } //if (FoundIDs.Count > 0) // MessageBox.Show ("Bei FoldedArchivePath \"" + FoldedArchivePath + "\"\r\n" // + String.Join("\r\n", FoundIDs.ToArray ())); } MessageBox.Show ("Insgesamt Gelöscht = " + Convert.ToString (DeleteCounter) + "\r\n" + "Remainig Entries = " + Convert.ToString (UniqueCounter) + "\r\n"); }
private void DoStartup () { if (m_DataAccess != null) return; m_DataAccess = new WCFStandardsNS.WCFStandards (); // default is WPMedia m_CVM = new CommonValues (); m_XAMLHandling = new XAMLHandling (m_CVM); }
public void HandleTheDescriptionFileDataBaseInformations (String WPMediaConnectionStringName, String WPMediaAddOnDataConnectionStringName) { WCFStandardsNS.WCFStandards WPMediaDataBase = new WCFStandardsNS.WCFStandards(); WPMediaDataBase.DefaultConnectionStringName = WPMediaConnectionStringName; WCFStandardsNS.WCFStandards WPMediaAddOnDataBase = new WCFStandardsNS.WCFStandards(); WPMediaAddOnDataBase.DefaultConnectionStringName = WPMediaAddOnDataConnectionStringName; List<String> ArchiveIDs = new List<String> { "CentralCommon", "CentralCommon" }; List<String> BeitragsTypen = new List<String> { "ExternesProgramm", "BilderGalerie" }; int Index = 0; while (Index < ArchiveIDs.Count) { ActualizeFileDataBaseEntries(WPMediaDataBase, WPMediaAddOnDataBase, ArchiveIDs[Index], BeitragsTypen[Index], DateTime.Now.AddYears (-20), null); Index++; } }
public void StartFullProcedure(String WPMediaConnectionStringName, String WPMediaAddOnConnectionStringName, DateTime DateBack, List<String> ArchiveIDs, List<String> BeitragsTypen) { //WMB.DataWrapper.Instance.DoActualizeAll (); //return; WCFStandardsNS.WCFStandards WPMediaDataBase = new WCFStandardsNS.WCFStandards (); WPMediaDataBase.DefaultConnectionStringName = WPMediaConnectionStringName; WCFStandardsNS.WCFStandards WPMediaAddOnDataBase = new WCFStandardsNS.WCFStandards(); WPMediaAddOnDataBase.DefaultConnectionStringName = WPMediaAddOnConnectionStringName; if ((ArchiveIDs == null) && (BeitragsTypen == null)) { #if DEBUG ArchiveIDs = new List<String> { "Source" }; BeitragsTypen = new List<String> { "PlayingPackage" }; //ArchiveIDs = new List<String> { "InternetArchiv" }; //BeitragsTypen = new List<String> { "Video" }; #else ArchiveIDs = new List<String> { "InternetArchiv", "CentralCommon", "Source", "CentralCommon" }; BeitragsTypen = new List<String> { "Video", "ExternesProgramm", "PlayingPackage", "BilderGalerie" }; #endif } int Index = 0; while (Index < ArchiveIDs.Count) { try { ActualizeFileDataBaseEntries(WPMediaDataBase, WPMediaAddOnDataBase, ArchiveIDs[Index], BeitragsTypen[Index], DateBack, null); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer("Bei ActualizeFileDataBaseEntries von\r\n" + "ArchivID = \"" + ArchiveIDs[Index] + "\"\r\n" + "BeitragsTypen = \"" + BeitragsTypen[Index] + "\" trat folgender Fehler auf:\r\n" + Excp.ToString ()); } Index++; } }
WCFStandardsNS.WCFStandards GetWebService () { if (m_WebService != null) return m_WebService; m_WebService = new WCFStandardsNS.WCFStandards (); m_WebService.DefaultConnectionStringName = "WPMediaConnectionString"; return m_WebService; }
public MainWindow () { CsGlobal.Install(GlobalFunctions.Storage | GlobalFunctions.WpfStorage); // Data.DbServer3_Connect_Direct(); Rollen = StartupTheDBSecurity(); // Data.DbServer3_Connect_OldWebService(); Data.DbServer3_Connect_Direct(); InitializeComponent(); CsGlobal.Wpf.Storage.Window.Handle(this, "WordUp23MailWindow"); m_DataBase = new WCFStandardsNS.WCFStandards(); m_DataBase.DefaultConnectionStringName = Properties.Settings.Default.WebConnectionStringName; WMB.WPMediaApplicationState.Instance.Properties["DataBase"] = m_DataBase; if (WMB.Basics.IsTestRun) WMB.Basics.ReportErrorToEventViewer ("XXXX", "YYY"); MainWindowDataModelInstance = new MainWindowDataModel(); }
public Form1 () { if (WMB.Basics.IAmActiveBefore ()) { Close (); return; } InitializeComponent (); m_DataBaseSynchronizer = new BackgroundWorker (); m_DataBaseSynchronizer.DoWork += new DoWorkEventHandler (m_DataBaseSynchronizer_DoWork); m_DataBaseSynchronizer.RunWorkerCompleted += new RunWorkerCompletedEventHandler (m_DataBaseSynchronizer_RunWorkerCompleted); m_Rollen = CVM.LoginHandler.CheckUser ("Heinz", "monika"); //WMB.Basics.ReportInformationToEventViewer ("MBRWahl.Constructor", "MBRWahl Started"); m_CVM = new MBRWahl.CommonValues (); m_CVM.CloseRequestedCall += new MBRWahl.CloseRequestedEvent (CloseRequestedCall_Fired); m_CVM.StatusMessageCall += new MBRWahl.StatusMessageEvent (StatusMessageCall_Fired); m_DataBase = new WCFStandardsNS.WCFStandards (); m_DataBase.DefaultConnectionStringName = Settings.Default.WebConnectionStringName; //m_DataBase.UserName = "******"; //m_DataBase.PassWord = "******"; m_CVM.m_DataBase = m_DataBase; m_LocalDataBase = new WCFStandardsNS.WCFStandards (); m_LocalDataBase.DefaultConnectionStringName = Settings.Default.LocalConnectionStringName; //m_LocalDataBase.UserName = "******"; //m_LocalDataBase.PassWord = "******"; m_CVM.m_LocalDataBase = m_LocalDataBase; if (!m_CVM.TestDataBase (false)) { MessageBox.Show ("Lokales WebService (\"" + m_LocalDataBase.DefaultConnectionStringName + "\") ist bei der Initialisierung nicht erreichbar. " + MBRWahl.MBRStatics.ASSISTANCE_FROM_WPMEDIA); Close (); } m_CVM.WebDataRoot = null; MBRWahlControlUserControl.HideTheApplicationEventCall += new MBRWahlControlUserControl.HideTheApplicationEvent (MBRWahlControlUserControl_HideTheApplicationEventCall); MBRWahlControlUserControl.CloseTheApplicationEventCall += new MBRWahlControlUserControl.CloseTheApplicationEvent (MBRWahlControlUserControl_CloseTheApplicationEventCall); MBRWahlControlUserControl.CreateAbstimmListeEventCall += new MBRWahlControlUserControl.CreateAbstimmListeEvent (MBRWahlControlUserControl_CreateAbstimmListeEventCall); MBRWahlControlUserControl.CreateBackupRuntimeEventCall += new MBRWahlControlUserControl.CreateBackupRuntimeEvent (MBRWahlControlUserControl_CreateBackupRuntimeEventCall); MBRWahlControlUserControl.RefreshStatusEventCall += new MBRWahlControlUserControl.RefreshStatusEvent (MBRWahlControlUserControl_RefreshStatusEventCall); MBRWahlControlUserControl.RunDataBaseCheckUpCall += new MBRWahl.RunDataBaseCheckUpEvent (MBRWahlControlUserControl_RunDataBaseCheckUpCall); m_AvailableForeignMachines = new StringCollection (); DataSet ConfigDataSet = m_LocalDataBase.GetCommonDataSet ("select * from Verwaltung where Maschine = '" + WMB.Basics.GetComputerName ().ToUpper() + "' and WahlID = '" + WahlID + "'"); if (ConfigDataSet == null) { MessageBox.Show ("Die lokale Wahl-Datenbank oder das lokale WebServive ist für Sie nicht erreichbar. " + "\r\nConnectionStringName = \"" + m_LocalDataBase.DefaultConnectionStringName + "\"\r\nEndPointName = \"" + m_LocalDataBase.ToString() + "\". " + MBRWahl.MBRStatics.ASSISTANCE_FROM_WPMEDIA); Close (); return; } if (ConfigDataSet.Tables ["Verwaltung"].Rows.Count == 0) { MessageBox.Show ("Ihre Maschine \"" + System.Windows.Forms.SystemInformation.ComputerName + "\" ist derzeit nicht für die MBR Wahl zugelassen. " + "Bitte warten Sie die Aktualisierung der Daten ab (einige Minuten!!), " + "danach wird neuerlich geprüft"); } m_CVM.SetConfigData (ConfigDataSet.Tables ["Verwaltung"], null); m_CVM.IsTestRun = true; m_FirstTimeDoDataBaseCheckUp = true; if (m_CVM.TestDataBase (true) == true) { // m_Rollen = m_DataBase.CheckUser (ref m_UserName); bool AccessIsNotAllowed = true; foreach (String Rolle in m_Rollen) { if (Rolle == "MBRWahl") AccessIsNotAllowed = false; if (Rolle == "MBRWahlLeiter") AccessIsNotAllowed = false; } if (AccessIsNotAllowed == true) { MessageBox.Show ("User / PWD ist nicht für die Mieterbeiratswahl zugelassen"); Close (); return; } } else { //MessageBox.Show ("Das Netz zu Ihrer Maschine ist nicht aktiv,\r\n" // + "Sie arbeiten offline. " // + "Daher gelten die\r\nentsprechenden Einschränkungen " // + "(= nur Wähler des eigenen\r\nBlockes können Ihre Stimme abgeben)."); m_CVM.Notbetrieb = true; } if (m_CVM.Notbetrieb == false) { m_CVM.DoProcessingCommand (); DoDataBaseCheckUp (false, true); } MBRWahlControlUserControl.m_DataBase = m_DataBase; MBRWahlControlUserControl.SetData (m_CVM); }
public void PreprocessAndLoadExternalDataBases () { List<String> NothingChangedFileName = new List<string> (); XElement ExternalDefinitions = CreateExternalDataBaseDescriptions (); foreach (XElement ExternalDataBaseDescription in ExternalDefinitions.Elements (XML_AUTO_CONTENT_PARAMETER_ENTRY)) { String DescriptionName = (String) ExternalDataBaseDescription.Attribute (XML_AUTO_CONTENT_ATTRIBUTE_NAME); String TargetFileName = ExternalDataBaseDescription.Element (XML_AUTO_CONTENT_TARGET_XML_BESTAND).Value; XElement DataBaseDefinitions = ExternalDataBaseDescription.Element (XML_AUTO_CONTENT_CONVERT_FROM_DATABASE); String ConnectionStringName = DataBaseDefinitions.Element (XML_AUTO_CONTENT_CONVERT_DATABASE).Value; String TableName = DataBaseDefinitions.Element (XML_AUTO_CONTENT_TABLE_NAME).Value; String SqlStatement = DataBaseDefinitions.Element (XML_AUTO_CONTENT_CONVERT_SQL_STATEMENT).Value.Replace ("\t\t", " "); try { WCFStandardsNS.WCFStandards SourceDataBase = new WCFStandardsNS.WCFStandards (); SourceDataBase.DefaultConnectionStringName = ConnectionStringName; DataSet SourceDataSet = SourceDataBase.GetCommonDataSet (SqlStatement); if (SourceDataSet == null) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCreateStandBildTVUnits.PreprocessAndLoadExternalDataBases", "Bei der Datenbank mit dem ConnectionStringName \"" + ConnectionStringName + "\" mit dem SqlStatement\r\n\"" + SqlStatement + "\" kam als DataSet null zurück"); continue; } if (SourceDataSet.Tables [TableName] == null) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCreateStandBildTVUnits.PreprocessAndLoadExternalDataBases", "Bei der Datenbank mit dem ConnectionStringName \"" + ConnectionStringName + "\" mit dem SqlStatement\r\n\"" + SqlStatement + "\" kam als keine DataTable (\"" + TableName + "\") zurück"); continue; } if (SourceDataSet.Tables [TableName].Rows.Count == 0) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCreateStandBildTVUnits.PreprocessAndLoadExternalDataBases", "Bei der Datenbank mit dem ConnectionStringName \"" + ConnectionStringName + "\" mit dem SqlStatement\r\n\"" + SqlStatement + "\" kam bei der DataTable (\"" + TableName + "\") keine Row zurück"); continue; } if (SourceDataSet.Tables [TableName].Rows [0] [0] == null) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCreateStandBildTVUnits.PreprocessAndLoadExternalDataBases", "Bei der Datenbank mit dem ConnectionStringName \"" + ConnectionStringName + "\" mit dem SqlStatement\r\n\"" + SqlStatement + "\" kam bei der DataTable (\"" + TableName + "\") in Row [0] kein Item zurück"); continue; } String ConverterInputFormat = (String) ExternalDataBaseDescription.Element (XML_AUTO_CONTENT_INPUT_FORMAT); if (ConverterInputFormat != "ForXML") throw new NotImplementedException ("ConverterInputFormat != \"ForXML\""); String XmlFormattedTable = SourceDataSet.Tables [TableName].Rows [0] [0].ToString (); XmlWriterSettings WriterSettings = new XmlWriterSettings (); WriterSettings.Encoding = Encoding.UTF8; WriterSettings.Indent = true; WriterSettings.CheckCharacters = true; WriterSettings.NewLineHandling = NewLineHandling.Entitize; WriterSettings.ConformanceLevel = ConformanceLevel.Fragment; MemoryStream XmlStream = new MemoryStream (); XmlWriter XWriter = XmlWriter.Create (XmlStream, WriterSettings); XWriter.WriteRaw (XmlFormattedTable); XWriter.Flush (); if (WMB.Basics.IsTheContentEqual (TargetFileName, XmlStream)) { NothingChangedFileName.Add (TargetFileName); continue; } FileStream TargetFile = new FileStream (TargetFileName, FileMode.Create, FileAccess.Write); XmlStream.Seek (0, SeekOrigin.Begin); XmlStream.CopyTo (TargetFile); XmlStream.Flush (); XmlStream.Close (); TargetFile.Close (); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCreateStandBildTVUnits.PreprocessAndLoadExternalDataBases", "Bei der Datenbank mit dem ConnectionStringName \"" + ConnectionStringName + "\" mit dem SqlStatement\r\n\"" + SqlStatement + "\" kam bei der DataTable (\"" + TableName + "\") trat folgender Fehler auf:\r\n" + Excp.Message); } } XElement ExternalPostProcessingDefinitions = CreateExternelXMLFilePostProcessings (); foreach (XElement ExternalPostProcessingDefinition in ExternalPostProcessingDefinitions.Elements (XML_POST_PROCESSING_TARGET_ENTRY)) { String SourceFileName = ExternalPostProcessingDefinition.Element (XML_POST_PROCESSING_TARGET_XML_POST_INPUT_BESTAND).Value; String TargetFileName = ExternalPostProcessingDefinition.Element (XML_POST_PROCESSING_TARGET_XML_POST_OUTPUT_BESTAND).Value; String PreFixText = ExternalPostProcessingDefinition.Element (XML_POST_PROCESSING_PREFIX_TEXT).Value; String PostFixText = ExternalPostProcessingDefinition.Element (XML_POST_PROCESSING_POSTFIX_TEXT).Value; String ProcessingType = ExternalPostProcessingDefinition.Element (XML_POST_PROCESSING_TYPE).Value; if (NothingChangedFileName.Contains (SourceFileName)) continue; if (File.Exists (TargetFileName)) WMB.Basics.SecureFileDelete (TargetFileName); if (!Directory.Exists (Path.GetDirectoryName (TargetFileName))) Directory.CreateDirectory (Path.GetDirectoryName (TargetFileName)); StreamWriter OutputStream = new StreamWriter (TargetFileName, true, Encoding.UTF8); OutputStream.Write (PreFixText); StreamReader InputStream = new StreamReader (SourceFileName, Encoding.UTF8); // if (ProcessingType == XML_POST_PROCESSING_TYPE_INSERT_AS_STRING) OutputStream.Write (InputStream.ReadToEnd ()); // unconditional XML Files Creation if (ProcessingType == XML_POST_PROCESSING_TYPE_CREATE_HTML_FROM_STRING) CreateHTMLFromXMLFile (SourceFileName, TargetFileName); OutputStream.Write (PostFixText); OutputStream.Close (); } }