private static void MaintainTwentySearchString(SeachString strToAdd, SearchStringList searchStringList)
        {
            bool check = false;

            foreach (
                SeachString str in
                searchStringList.ListSearchString.Where(str => str.SearchString.Equals(strToAdd.SearchString)))
            {
                searchStringList.ListSearchString.Remove(str);
                strToAdd.Timestamp = DateTime.Now;
                searchStringList.ListSearchString.Add(strToAdd);
                Db4oClient.OMNConnection.Delete(str);
                check = true;
                break;
            }
            if (!check)
            {
                SeachString temp = searchStringList.ListSearchString[searchStringList.ListSearchString.Count - 1];
                searchStringList.ListSearchString.Remove(temp);
                strToAdd.Timestamp = DateTime.Now;
                searchStringList.ListSearchString.Add(strToAdd);
                Db4oClient.OMNConnection.Delete(temp);
            }
            Db4oClient.OMNConnection.Store(searchStringList);
            Db4oClient.OMNConnection.Commit();
        }
Exemplo n.º 2
0
        internal void RemovesSearchStringsForAConnection()
        {
            try
            {
                GroupofSearchStrings grpSearchString = FetchAllSearchStringsForAConnection();
                if (grpSearchString != null)
                {
                    for (int i = 0; i < grpSearchString.m_SearchStringList.Count; i++)
                    {
                        SeachString sString = grpSearchString.m_SearchStringList[i];
                        //foreach (SeachString sString in grpSearchString.m_SearchStringList)

                        if (sString != null)
                        {
                            //grpSearchString.m_SearchStringList.Remove(sString);
                            container.Delete(sString);
                        }
                    }
                    grpSearchString.m_SearchStringList.Clear();
                    grpSearchString.m_TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();
                    container.Ext().Store(grpSearchString, 5);
                    container.Commit();
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }
        }
Exemplo n.º 3
0
        public static void SaveSearchString(ConnParams conn, SeachString searchString)
        {
            GroupofSearchStrings searchStrings = new GroupofSearchStrings(conn);

            if (searchString.SearchString != string.Empty)
            {
                searchStrings.AddSearchStringToList(searchString);
            }
        }
 internal void AddSearchStringToList(SeachString strToAdd)
 {
     try
     {
         SearchStringList searchStringList = FetchAllSearchStringsForAConnection();
         if (searchStringList == null)
         {
             searchStringList = new SearchStringList(m_connParam);
             searchStringList.ListSearchString.Add(strToAdd);
             searchStringList.TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();
             Db4oClient.OMNConnection.Store(searchStringList);
             Db4oClient.OMNConnection.Commit();
             return;
         }
         if (searchStringList.ListSearchString.Count < 20)
         {
             bool checkstr = false;
             foreach (
                 SeachString str in
                 searchStringList.ListSearchString.Where(
                     str => str.SearchString.Equals(strToAdd.SearchString)))
             {
                 searchStringList.ListSearchString.Remove(str);
                 strToAdd.Timestamp = DateTime.Now;
                 searchStringList.ListSearchString.Add(strToAdd);
                 Db4oClient.OMNConnection.Delete(str);
                 checkstr = true;
                 break;
             }
             if (!checkstr)
             {
                 searchStringList.ListSearchString.Add(strToAdd);
             }
             Db4oClient.OMNConnection.Store(searchStringList);
             Db4oClient.OMNConnection.Commit();
         }
         else
         {
             MaintainTwentySearchString(strToAdd, searchStringList);
         }
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
     }
     finally
     {
         Db4oClient.CloseRecentConnectionFile();
     }
 }
Exemplo n.º 5
0
        private void toolStripButtonFilter_Click(object sender, EventArgs e)
        {
            try
            {
                if (toolStripComboBoxFilter.SelectedIndex == 0 || toolStripComboBoxFilter.SelectedText == CONST_FILTER_DEFAULT_STRING ||
                    toolStripComboBoxFilter.Text == CONST_FILTER_DEFAULT_STRING || toolStripComboBoxFilter.SelectedText.Contains(CONST_FILTER_DEFAULT_STRING))
                {
                    return;
                }

                filterString = toolStripComboBoxFilter.Text.Trim().ToLower();

                //Check which View is selected for listing of classes, call find method for relavent view
                if (toolStripButtonAssemblyView.Checked)
                {
                    dbAssemblyTreeView.FindTreeNodesAssemblyView(storedAssemblies, filterString);
                }
                else
                {
                    dbtreeviewObject.FindTreeNodesClasses(storedclasses, null, filterString);
                }

                SeachString searchString = new SeachString(DateTime.Now, toolStripComboBoxFilter.Text.Trim());
                OMEInteraction.SaveSearchString(searchString);
                toolStripButtonFolder.Enabled = false;
                SetObjectBrowserImages();
                toolStripButtonFilter.Checked = true;
                toolStripButtonClear.Checked  = false;
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
            finally
            {
                listSearchStrings = OMEInteraction.GetSearchString();
                FillFilterComboBox(listSearchStrings);
                if (toolStripComboBoxFilter.Text != "")
                {
                    EnableDisablePrevNextButtons();
                }
                else
                {
                    DisablePrevNextButtons();
                }
            }
        }
Exemplo n.º 6
0
        public static void SaveSearchString(SeachString searchString)
        {
            ManageSearchStrings searchStrings = new ManageSearchStrings(GetCurrentConnParams());

            searchStrings.AddSearchStringToList(searchString);
        }
Exemplo n.º 7
0
        internal void AddSearchStringToList(SeachString strToAdd)
        {
            try
            {
                container = Db4oClient.RecentConn;
                if (m_SearchStringList != null)
                {
                    GroupofSearchStrings groupSearchString = FetchAllSearchStringsForAConnection();

                    if (groupSearchString == null)
                    {
                        groupSearchString = new GroupofSearchStrings(m_connParam);
                        List <SeachString> l = new List <SeachString>();
                        l.Add(strToAdd);
                        groupSearchString.m_SearchStringList = l;
                        groupSearchString.m_TimeOfCreation   = Sharpen.Runtime.CurrentTimeMillis();
                        container.Store(groupSearchString);
                        container.Commit();
                        return;
                    }

                    List <SeachString> searchStringForConnection = groupSearchString.m_SearchStringList;

                    if (searchStringForConnection.Count >= 20)
                    {
                        bool        check = false;
                        SeachString temp  = null;
                        foreach (SeachString str in searchStringForConnection)
                        {
                            if (str.SearchString.Equals(strToAdd.SearchString))
                            {
                                temp  = str;
                                check = true;
                                break;
                            }
                        }
                        if (check == false)
                        {
                            temp = searchStringForConnection[searchStringForConnection.Count - 1];
                            searchStringForConnection.Remove(temp);
                            strToAdd.Timestamp = DateTime.Now;
                            searchStringForConnection.Add(strToAdd);
                        }
                        else
                        {
                            searchStringForConnection.Remove(temp);
                            strToAdd.Timestamp = DateTime.Now;
                            searchStringForConnection.Add(strToAdd);
                        }

                        container.Delete(temp);
                        CompareSearchStringTimestamps cmp = new CompareSearchStringTimestamps();
                        searchStringForConnection.Sort(cmp);
                        groupSearchString.m_SearchStringList = searchStringForConnection;
                        container.Ext().Store(groupSearchString, 5);
                        container.Commit();
                    }

                    else
                    {
                        bool        checkstr = false;
                        SeachString temp     = null;
                        foreach (SeachString str in searchStringForConnection)
                        {
                            if (str.SearchString.Equals(strToAdd.SearchString))
                            {
                                temp     = str;
                                checkstr = true;
                                break;
                            }
                        }
                        if (checkstr == false)
                        {
                            searchStringForConnection.Add(strToAdd);
                        }
                        else
                        {
                            searchStringForConnection.Remove(temp);
                            strToAdd.Timestamp = DateTime.Now;
                            searchStringForConnection.Add(strToAdd);
                            container.Delete(temp);
                        }


                        CompareSearchStringTimestamps cmp = new CompareSearchStringTimestamps();
                        searchStringForConnection.Sort(cmp);
                        groupSearchString.m_SearchStringList = searchStringForConnection;
                        container.Ext().Store(groupSearchString, 5);
                        container.Commit();
                    }
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
                container = null;
            }
        }