private void InsertButton_Click (object sender, RoutedEventArgs e) { String NewEntryName = String.Empty; String AdditionalDataToStore = "Neuer Eintrag"; TableContentDefinition NameIDTableContentDefinition = m_DataBase.GetColumnDefinition (TableToProcess, "NameID", true); if ((NameIDTableContentDefinition != null) && (NameIDTableContentDefinition.m_TypeOfSpecialFieldProcessing == TableContentDefinition.SQL_COLUMN_PROPERTY_DEFAULT_GENERATE_CONTENT)) { if (NameIDTableContentDefinition .m_DefaultFillingMethode == "UserAndDate") { NewEntryName = WPMediaApplicationState.Instance.Properties ["UserName"].ToString ().ToUpper () + "_" + DateTime.Now.ToString ("yy-MM-dd_HH-mm-ss"); } if (NameIDTableContentDefinition.m_DefaultFillingMethode.IndexOf ("SelectFileOfType=") != -1) { String FileExtensionToSearchFor = NameIDTableContentDefinition.m_DefaultFillingMethode.Replace ("SelectFileOfType=", ""); OpenFileDialog OFD = new OpenFileDialog (); OFD.Filter = FileExtensionToSearchFor; OFD.Title = "Bitte wählen Sie den gewünschten File aus"; OFD.Multiselect = false; if (OFD.ShowDialog () == true) { AdditionalDataToStore = OFD.FileName; NewEntryName = Path.GetFileNameWithoutExtension (AdditionalDataToStore); } else { return; } } } else { SimpleInputWindow InputWindow = new SimpleInputWindow (); InputWindow.CreateTextFromUserWindow ("Bitte geben Sie den Namen des neuen Eintrages ein", null); if (InputWindow.ShowDialog () != true) { return; } NewEntryName = InputWindow.GetInput (); } String NewID = Guid.NewGuid ().ToString (); String InsertSqlStatement = m_DataBase.GetTableDefinitionEntry (TableToProcess, WCFStandardsNS.WCFStandardClientSchema.SQL_TABLE_PROPERTY_SQL_INSERT); if (String.IsNullOrEmpty (InsertSqlStatement)) InsertSqlStatement = "Insert into " + TableToProcess + " (ID, NameID, Titel) values ('{0}', '{1}', '{2}')"; String FinalInsertSqlStatement = String.Format (InsertSqlStatement, NewID, NewEntryName, AdditionalDataToStore); m_DataBase.RunSQLBatch (FinalInsertSqlStatement); m_ManagedTimingsControl.InsertNewDefaultTiming (NewID); LoadAndFillTableEntriesIntoListView (); SelectThisItem (NewID); HandleShowAndEditListBoxEntry_MouseRightButtonUp (this, AvailableEntriesListBox, null); GraphicsSingleton.Instance.GraphicsHandler.ModificationRequired = true; }
private void CopyButton_Click (object sender, RoutedEventArgs e) { if (AvailableEntriesListBox.SelectedItem == null) { SetProcessingButtons (false); return; } SimpleInputWindow InputWindow = new SimpleInputWindow (); InputWindow.CreateTextFromUserWindow ("Bitte geben Sie den Namen ein, auf den kopiert werden soll", null); if (InputWindow.ShowDialog () != true) { return; } String NewEntryName = InputWindow.GetInput (); String IDToCopyFrom = ((ListBoxItem) AvailableEntriesListBox.SelectedItem).Tag as String; if (IDToCopyFrom == String.Empty) { SetProcessingButtons(false); return; } DataSet CopySourceDataSet = m_DataBase.GetCommonDataSet("Select * from " + TableToProcess + " where ID = '" + IDToCopyFrom + "'"); DataRow NewRow = CopySourceDataSet.Tables [0].NewRow (); String NewID = Guid.NewGuid ().ToString (); foreach (DataColumn Col in CopySourceDataSet.Tables [0].Columns) { if (Col.ColumnName == "ID") NewRow ["ID"] = NewID; else { if (Col.ColumnName == "NameID") NewRow ["NameID"] = NewEntryName; else { NewRow [Col.ColumnName] = CopySourceDataSet.Tables [0].Rows [0] [Col.ColumnName]; } } } CopySourceDataSet.Tables [0].Rows.Add (NewRow); m_DataBase.SetCommonDataSet (CopySourceDataSet); m_ManagedTimingsControl.InsertNewDefaultTiming (NewID); LoadAndFillTableEntriesIntoListView (); SelectThisItem (NewID); HandleShowAndEditListBoxEntry_MouseRightButtonUp (this, AvailableEntriesListBox, null); }
private void InsertFromTemplateButton_Click (object sender, RoutedEventArgs e) { if (GraphicsSingleton.Instance.GraphicsHandler == null) return; String NameID = GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString (); String NewEntryName = String.Empty; SimpleInputWindow InputWindow = new SimpleInputWindow (); InputWindow.CreateTextFromUserWindow ("Bitte geben Sie den KopienName für \"" + NameID + "\" ein", null); if (InputWindow.ShowDialog () != true) { return; } NewEntryName = InputWindow.GetInput (); String NewID = Guid.NewGuid ().ToString (); String OldPkgFileName = GraphicsSingleton.Instance.GraphicsHandler.Close (); String OldID = Path.GetFileNameWithoutExtension (OldPkgFileName); String InsertSqlStatement = m_DataBase.GetTableDefinitionEntry (TableToProcess, WCFStandardsNS.WCFStandardClientSchema.SQL_TABLE_PROPERTY_SQL_INSERT); if (String.IsNullOrEmpty (InsertSqlStatement)) InsertSqlStatement = "Insert into " + TableToProcess + " (ID, NameID) values ('{0}', '{1}', '{2}')"; String FinalInsertSqlStatement = String.Format (InsertSqlStatement, NewID, NewEntryName, "Neuer Inhalt"); m_DataBase.RunSQLBatch (FinalInsertSqlStatement); m_ManagedTimingsControl.InsertNewDefaultTiming (NewID); CopyPkgEntrysContent (OldID, NewID); CopyPkgEntrysFormat (TableToProcess, OldID, NewID); LoadAndFillTableEntriesIntoListView (); SelectThisItem (NewID); HandleShowAndEditListBoxEntry_MouseRightButtonUp (this, AvailableEntriesListBox, null); }
private void Window_Loaded (object sender, RoutedEventArgs e) { m_UtilityControl = new CommonDataBase.DataBaseUtility (); m_UtilityControl.CloseRequestedHandler += new CloseRequested (m_UtilityControl_CloseRequestedHandler); m_UtilityControl.SetConnectionString ("Data Source=.\\WPMediaLocalSQL;Initial Catalog=Master;" + "Integrated Security=SSPI;User Instance=True"); foreach (String Argument in ApplicationArguments) { if (Argument.IndexOf (".pkg", StringComparison.InvariantCultureIgnoreCase) != -1) { m_UtilityControl.SetConnectionString (string.Empty); m_PackageDataControl = new PackageDataControl (); m_PackageDataControl.PackageFileName = Argument; m_PackageDataControl.CloseRequestedCall += new CloseRequested (m_PackageDataControl_CloseRequestedCall); this.Content = m_PackageDataControl; return; } if (Argument.IndexOf ("WPMediaProgramm") != -1) { m_UtilityControl.SetConnectionString (string.Empty); if (ProgrammManagement == null) { ProgrammManagement = new WPMediaManagement.ManagedProgrammManagement (); ProgrammManagement.ProgrammDefinitionFileName = Argument; } m_ProgrammDataControl = new ProgrammDataControl (); m_ProgrammDataControl.ProgrammManagement = ProgrammManagement; m_ProgrammDataControl.CloseRequestedCall += new CloseRequested (m_ProgrammDataControl_CloseRequestedCall); this.Content = m_ProgrammDataControl; return; } if (Argument.IndexOf ("/SQLExpress") != -1) { break; } if (Argument.IndexOf ("/MachineDSN=") != -1) { String MachineDSN = Argument.Substring ("/MachineDSN=".Length).Replace ("\"", ""); m_UtilityControl.SetConnectionString ("Data Source=" + MachineDSN); break; } if (Argument.IndexOf ("/ConnectString=") != -1) { m_UtilityControl.SetConnectionString (Argument.Substring ("/ConnectString==".Length).Replace ("\"", "")); break; } if (Argument.IndexOf ("/Dynamic") != -1) { CVM.SimpleInputWindow InputWindow = new SimpleInputWindow (); InputWindow.CreateTextFromUserWindow ("Bitte ConnectionString direkt eingeben", ""); if (InputWindow.ShowDialog () != true) { return; } String ConnectionString = InputWindow.GetInput (); m_UtilityControl.SetConnectionString (ConnectionString); break; } if (Argument.IndexOf ("/Select") != -1) { CVM.SimpleInputWindow InputWindow = new SimpleInputWindow (); List<String> AllowedValues = new List<String> (); foreach (System.Configuration.SettingsProperty Prop in Properties.Settings.Default.Properties) { if (Prop.Name.IndexOf ("CS_") != -1) { AllowedValues.Add (Properties.Settings.Default [Prop.Name].ToString ()); } } InputWindow.AllowedValues = AllowedValues.ToArray (); InputWindow.CreateTextFromUserWindow ("Bitte ConnectionString auswählen", ""); if (InputWindow.ShowDialog () != true) { return; } String ConnectionString = InputWindow.GetInput (); m_UtilityControl.SetConnectionString (ConnectionString); break; } } this.Content = m_UtilityControl; }
string Instance_ProcessTextInputCall (object Sender, string OldValue) { CVM.SimpleInputWindow ProcessTextWindow = new SimpleInputWindow (); if (String.IsNullOrEmpty (OldValue)) ProcessTextWindow.CreateTextFromUserWindow ("Bitte geben Sie den neuen Text ein", null); else ProcessTextWindow.CreateTextFromUserWindow ("Bitte ändern Sie den Text", OldValue); if (!ProcessTextWindow.ShowDialog () != true) return null; return ProcessTextWindow.GetInput (); }
void MapWindowInstance_ROIAreaSelectedHandler(object Sender, double West, double North, double East, double South) { CVM.SimpleInputWindow InputNameWindow = new SimpleInputWindow (); String NameOfNewROI = String.Empty; String NameID = String.Empty; String Type = String.Empty; while (String.IsNullOrEmpty(NameOfNewROI)) { InputNameWindow.CreateTextFromUserWindow ("Bitte den Namen der neuen RegionOfInterest/Type (AG2/ROI) oder abbrechen", ""); if (!(bool) InputNameWindow.ShowDialog ()) { StdMouseFunktion.IsChecked = true; return; } NameOfNewROI = InputNameWindow.GetInput (); String [] NameEntries = NameOfNewROI.Split ('/'); if (NameEntries.Length == 1) { NameID = NameEntries [0]; Type = "ROI"; } else { NameID = NameEntries[0]; Type = NameEntries[1]; } } DataTable ExistingROIs = MapDataWrapper.Instance.GetAllROIs (NameID, Type).Tables [0]; if (ExistingROIs.Rows.Count > 0) { MessageBox.Show ("Der Typ \"" + Type + "\" mit der NameID \"" + NameID + "\" ist schon vorhanden. Bitte mit anderem Namen neu definieren"); StdMouseFunktion.IsChecked = true; return; } String InsertStatement = "Insert into MapKacheln (ID, NameID, Type, TopY, LeftX, BottomY, RightX) values " + "('" + System.Guid.NewGuid ().ToString () + "', '" + NameID + "', '" + Type + "', " + Convert.ToString(North).Replace(",", ".") + ", " + Convert.ToString(West).Replace(",", ".") + ", " + Convert.ToString(South).Replace(",", ".") + ", " + Convert.ToString(East).Replace(",", ".") + ")"; MapDataWrapper.Instance.MapAccessRunSQLBatch (InsertStatement); }
private void KeyWordSelection_ContextMenuOpening (object sender, ContextMenuEventArgs e) { SimpleInputWindow ProcessTextWindow = new SimpleInputWindow (); ProcessTextWindow.Title = "Bitte geben Sie das neue Key Word ein"; if (ProcessTextWindow.ShowDialog () != true) return; KeyWordSelection.BeginInit (); String KeyWord = KeyWordSelection.SelectedItem as String; List<String> UsedKeyWordsList = KeyWordSelection.ItemsSource as List<String>; UsedKeyWordsList.Add (ProcessTextWindow.TextControlInput); UsedKeyWordsList.Sort (); KeyWordSelection.EndInit (); }
private void UsedKeyWords_ContextMenuOpening (object sender, ContextMenuEventArgs e) { CVM.SimpleInputWindow ProcessTextWindow = new SimpleInputWindow (); ProcessTextWindow.CreateTextFromUserWindow ("Bitte geben Sie das neue Key Word ein", null); if (ProcessTextWindow.ShowDialog () != true) return; UsedKeyWords.BeginInit (); String KeyWord = UsedKeyWords.SelectedItem as String; List<String> UsedKeyWordsList = UsedKeyWords.ItemsSource as List<String>; UsedKeyWordsList.Add (ProcessTextWindow.GetInput ()); UsedKeyWordsList.Sort (); UsedKeyWords.EndInit (); }
private bool HandleProcessAllowedKeys (WMB.TableContentDefinition SpecialFieldProcessing, String [] AllowedValues) { SimpleInputWindow AllowedSelectionWindow = new SimpleInputWindow (); AllowedSelectionWindow.AllowKeyChangeAndAdd = SpecialFieldProcessing.m_AllowNewKeysInForeignTable; AllowedSelectionWindow.AllowedValues = AllowedValues; AllowedSelectionWindow.CreateTextFromUserWindow ("Neuen Inhalt für " + SpecialFieldProcessing.m_ForeignKeyName + " setzen", m_RowToProcess [SpecialFieldProcessing.m_ForeignKeyName].ToString ()); if (AllowedSelectionWindow.ShowDialog () == true) { if (AllowedSelectionWindow.ValueChangeRequested == true) { if (ProcessModifyKeyTableCall != null) { Cursor = Cursors.Wait; String NewValue = ProcessModifyKeyTableCall (SpecialFieldProcessing); if (!String.IsNullOrEmpty (NewValue)) { m_RowToProcess [SpecialFieldProcessing.m_ForeignKeyName] = NewValue; m_ForeignKeyUpdated = true; DoScreenUpdateAfterContentModification (SpecialFieldProcessing); if (SpecialFieldProcessing.m_ConnectedValueControllerItem == true) { ProcessConnectedValueEntries (SpecialFieldProcessing); } return true; } Cursor = Cursors.Arrow; } return false; } String SelectedValue = AllowedSelectionWindow.GetInput (); m_RowToProcess [SpecialFieldProcessing.m_ForeignKeyName] = SelectedValue; m_ForeignKeyUpdated = true; DoScreenUpdateAfterContentModification (SpecialFieldProcessing); if (SpecialFieldProcessing.m_ConnectedValueControllerItem == true) { ProcessConnectedValueEntries (SpecialFieldProcessing); } } return true; }
private void ProcessAllowedTemplates (WMB.TableContentDefinition SpecialFieldProcessing) { SimpleInputWindow AllowedSelectionWindow = new SimpleInputWindow (); AllowedSelectionWindow.AllowedValues = GetSelectionTextEntriesForPredefinedTemplates (SpecialFieldProcessing.m_TableName); AllowedSelectionWindow.CreateTextFromUserWindow ("Template für" + SpecialFieldProcessing.m_FieldNameWithAllowedValues + " setzten", m_RowToProcess [SpecialFieldProcessing.m_FieldNameWithAllowedValues].ToString ()); if (AllowedSelectionWindow.ShowDialog () == true) { String SelectedValue = AllowedSelectionWindow.GetInput (); m_RowToProcess [SpecialFieldProcessing.m_FieldNameWithAllowedValues] = SelectedValue; m_ForeignKeyUpdated = true; DoScreenUpdateAfterContentModification (SpecialFieldProcessing); } }
private void ProcessColorPicker (WMB.TableContentDefinition SpecialFieldProcessing) { SimpleInputWindow AllowedSelectionWindow = new SimpleInputWindow (); AllowedSelectionWindow.RunAsColorPicker = true; if (AllowedSelectionWindow.ShowDialog () == true) { String SelectedValue = AllowedSelectionWindow.GetInput (); m_RowToProcess [SpecialFieldProcessing.m_ColumnName] = SelectedValue; m_ForeignKeyUpdated = true; DoScreenUpdateAfterContentModification (SpecialFieldProcessing); } }
private void OpenSelection_Click (object Sender, RoutedEventArgs e) { Button OpenSelection = (Button) Sender; WMB.TableContentDefinition SpecialFieldProcessing = (WMB.TableContentDefinition) OpenSelection.Tag; if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_DATE_TIME) { ProcessDateTime (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_ALLOWED_VALUES) { ProcessAllowedValues (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_ALLOWED_TEMPLATES) { ProcessAllowedTemplates (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_IMAGE_LINK_ID) { ProcessMaterialien (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_COLOR) { ProcessColorPicker (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_TABLE_COLUMNS) { ProcessExistingColumnNames (SpecialFieldProcessing); return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_ALLOWED_KEYS) { while (ProcessAllowedKeys (SpecialFieldProcessing) == false) ; return; } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_CONNECTOR_ID) { ProcessConnectorID (SpecialFieldProcessing); } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_DO_LOCAL_FILE_SELECTION) { ProcessLocalFileSelection (SpecialFieldProcessing); } if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_CONNECTED_VALUE) { // do nothing ProcessConnectedValue (SpecialFieldProcessing); } if ((SpecialFieldProcessing.m_DefaultContentRules != null) && (SpecialFieldProcessing.m_DefaultContentRules.Length > 0)) { if (MessageBox.Show ("Dieser Wert wird aus einer anderen\r\n" + "Datenquelle übernommen. Daher sollten Sie\r\n" + "Erforderliche Änderungen dort vornehmen.\r\n" + "Wenn dies nicht geht, können Sie hier auch einen\r\n" + "fixen Wert eingeben. Bedenken Sie aber, daß damit\r\n" + "automatische Korrekturverfahren ausgeschalten werden.\r\n" + "Wenn Sie Ok/Ja eingeben,\r\nkönnen Sie dennoch Änderungen eingeben.", "Sicherheitsabfrage", MessageBoxButton.YesNo) != MessageBoxResult.Yes) return; CVM.SimpleInputWindow OverwriteValueWindow = new SimpleInputWindow (); OverwriteValueWindow.CreateTextFromUserWindow ("Neuer Fixwert oder \"-\" (= Fixwert löschen) ein", null); if (OverwriteValueWindow.ShowDialog () == true) { String OverwriteValue = OverwriteValueWindow.GetInput (); String NewContent = m_DataBase.ProcessOverwriteContent (SpecialFieldProcessing, m_TableHelper.TableName, SpecialFieldProcessing.m_ColumnName, m_RowToProcess, OverwriteValue); m_ForeignKeyUpdated = true; DoScreenUpdateAfterContentModification (SpecialFieldProcessing); return; } } }