예제 #1
0
		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;
			//	}

			}
예제 #2
0
파일: Form1.cs 프로젝트: heinzsack/DEV
		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);
			}