Exemplo n.º 1
0
 public void DeletePathSubstMacro(PathSubstMacro pathSubstMacro)
 {
     MongoCollection<PathSubstMacro> collection_pathSubst = GetPathSubstCollection();
     var query = Query<PathSubstMacro>.EQ(e => e.Id, pathSubstMacro.Id);
     collection_pathSubst.Remove(query);
 }
Exemplo n.º 2
0
 public bool AddOrUpdateSubstMacroRecInDb(PathSubstMacro pathSubstMacro)
 {
     // Mongo append
     try
     {
         MongoCollection<PathSubstMacro> collection_pathSubst = GetPathSubstCollection();
         collection_pathSubst.Save(pathSubstMacro);
         // Log it
         logger.Info("Added/updated pathSubstMacro record for {0}", pathSubstMacro.origText);
     }
     catch (Exception excp)
     {
         logger.Error("Cannot insert pathSubstMacro rec into {0} Coll... {1} for file {2} excp {3}",
                     Properties.Settings.Default.DbNameForDocs, Properties.Settings.Default.DbCollectionForPathMacros, pathSubstMacro.origText,
                     excp.Message);
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
 private void SetInitialFieldEnables()
 {
     txtOrigText.IsEnabled = false;
     txtReplaceWith.IsEnabled = false;
     listMacroReplacements.IsEnabled = true;
     btnCancelMacro.IsEnabled = false;
     btnEditMacro.IsEnabled = false;
     btnNewMacro.IsEnabled = true;
     btnSaveMacro.IsEnabled = false;
     btnDeleteMacro.IsEnabled = false;
     listMacroReplacements.SelectedItem = null;
     _curSelPathSubstMacro = null;
     txtOrigText.Text = "";
     txtReplaceWith.Text = "";
 }
Exemplo n.º 4
0
 private void btnNewMacro_Click(object sender, RoutedEventArgs e)
 {
     txtOrigText.IsEnabled = true;
     txtOrigText.Text = "";
     txtReplaceWith.IsEnabled = true;
     txtReplaceWith.Text = "";
     listMacroReplacements.IsEnabled = false;
     btnCancelMacro.IsEnabled = true;
     btnEditMacro.IsEnabled = false;
     btnNewMacro.IsEnabled = false;
     btnSaveMacro.IsEnabled = true;
     btnDeleteMacro.IsEnabled = false;
     _curSelPathSubstMacro = new PathSubstMacro();
     listMacroReplacements.SelectedItem = null;
 }
Exemplo n.º 5
0
 private void listMacroReplacements_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // Get the corresponding doc type to display
     if (e.AddedItems != null && e.AddedItems.Count > 0)
     {
         PathSubstMacro ptm = e.AddedItems[0] as PathSubstMacro;
         txtOrigText.Text = ptm.origText;
         txtReplaceWith.Text = ptm.replaceText;
         _curSelPathSubstMacro = ptm;
         btnDeleteMacro.IsEnabled = true;
         btnEditMacro.IsEnabled = true;
     }
     else
     {
         _curSelPathSubstMacro = null;
     }
 }