Beispiel #1
0
 internal void RemoveFavouritFolderForAConnection()
 {
     try
     {
         FavouriteList Fav = FetchAllFavouritesForAConnection();
         if (Fav != null)
         {
             for (int i = 0; i < Fav.lstFavFolder.Count; i++)
             {
                 FavouriteFolder favFolder = Fav.lstFavFolder[i];
                 if (favFolder != null)
                 {
                     container.Delete(favFolder);
                 }
             }
             Fav.lstFavFolder.Clear();
             Fav.m_TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();
             container.Delete(Fav);
             container.Ext().Store(Fav, 5);
             container.Commit();
         }
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
     }
 }
Beispiel #2
0
        internal void RemoveFolderfromDatabase(FavouriteFolder favFolder)
        {
            try
            {
                container = Db4oClient.RecentConn;
                FavouriteList favList = FetchAllFavouritesForAConnection();


                List <FavouriteFolder> lstFavFolder = favList.lstFavFolder;
                bool            check = false;
                FavouriteFolder temp  = null;
                foreach (FavouriteFolder str in lstFavFolder)
                {
                    if (str.FolderName.Equals(favFolder.FolderName))
                    {
                        temp  = str;
                        check = true;
                        break;
                    }
                }
                if (check == true)
                {
                    lstFavFolder.Remove(temp);
                    favList.lstFavFolder = lstFavFolder;
                    container.Delete(temp);
                    container.Ext().Store(favList, 5);
                    container.Commit();
                }
            }

            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }
        }
Beispiel #3
0
        private FavouriteList FetchAllFavouritesForAConnection()
        {
            FavouriteList FavList = null;

            try
            {
                container = Db4oClient.RecentConn;
                IQuery query = container.Query();
                query.Constrain(typeof(FavouriteList));
                query.Descend("m_connParam").Descend("m_connection").Constrain(m_connParam.Connection);
                IObjectSet objSet = query.Execute();
                if (objSet != null)
                {
                    if (objSet.Count != 0)
                    {
                        FavList = (FavouriteList)objSet.Next();
                    }
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }

            return(FavList);
        }
Beispiel #4
0
        internal void AddFolderToDatabase(FavouriteFolder favFolder)
        {
            try
            {
                container = Db4oClient.RecentConn;
                if (m_lstFavfolder != null)
                {
                    FavouriteList favList = FetchAllFavouritesForAConnection();

                    if (favList == null)
                    {
                        favList = new FavouriteList(m_connParam);
                        List <FavouriteFolder> lstFavfolder = new List <FavouriteFolder>();
                        favList.m_TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();
                        lstFavfolder.Add(favFolder);
                        container.Store(favList);
                        container.Commit();
                        return;
                    }
                    container.Activate(favList, 5);
                    List <FavouriteFolder> lstFavFolder = favList.lstFavFolder;

                    bool            check = false;
                    FavouriteFolder temp  = null;
                    foreach (FavouriteFolder str in lstFavFolder)
                    {
                        if (str != null)
                        {
                            if (str.FolderName.Equals(favFolder.FolderName))
                            {
                                temp  = str;
                                check = true;
                                break;
                            }
                        }
                    }
                    if (check == false)
                    {
                        lstFavFolder.Add(favFolder);
                    }
                    else
                    {
                        lstFavFolder.Remove(temp);
                        lstFavFolder.Add(favFolder);
                        container.Delete(temp);
                    }


                    favList.lstFavFolder = lstFavFolder;
                    container.Ext().Store(favList, 5);
                    container.Commit();
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }
        }
Beispiel #5
0
        internal long ReturnTimeWhenFavouriteListCreated()
        {
            FavouriteList Fav = null;

            try
            {
                Fav = FetchAllFavouritesForAConnection();
                if (Fav != null)
                {
                    return(Fav.TimeOfCreation > 0 ? Fav.TimeOfCreation : 0);
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }

            return(0);
        }
Beispiel #6
0
        internal List <FavouriteFolder> ReturnFavouritFolderList()
        {
            List <FavouriteFolder> FavList = null;

            try
            {
                FavouriteList Fav = FetchAllFavouritesForAConnection();
                if (Fav != null)
                {
                    FavList = Fav.lstFavFolder;
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }

            return(FavList);
        }
Beispiel #7
0
        internal FavouriteList FindFolderWithClassesByFolderName(string folderName)
        {
            FavouriteList FavList = null;

            try
            {
                container = Db4oClient.RecentConn;
                IQuery query = container.Query();
                query.Constrain(typeof(FavouriteList));
                query.Descend("m_connParam").Descend("m_connection").Constrain(m_connParam.Connection);
                query.Descend("m_lstFavfolder").Descend("m_folderName").Constrain(folderName);
                IObjectSet objSet = query.Execute();
                if (objSet.Count != 0)
                {
                    FavList = (FavouriteList)objSet.Next();
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }

            return(FavList);
        }
Beispiel #8
0
        internal void AddFolderToDatabase(FavouriteFolder favFolder)
        {
            try
            {
                container = Db4oClient.RecentConn;
                if (m_lstFavfolder != null)
                {
                    FavouriteList favList = FetchAllFavouritesForAConnection();
                   
                    if (favList == null)
                    {
                        favList = new FavouriteList(m_connParam);
                        List<FavouriteFolder> lstFavfolder = new List<FavouriteFolder>();
                        favList.m_TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis();   
                        lstFavfolder.Add(favFolder);
                        container.Store(favList);
                        container.Commit();
                        return;
                    }
                    container.Activate(favList, 5);
                    List<FavouriteFolder> lstFavFolder = favList.lstFavFolder;
                   
                    bool check = false;
                    FavouriteFolder temp = null;
                    foreach (FavouriteFolder str in lstFavFolder)
                    {
                        if (str != null)
                        {
                            if (str.FolderName.Equals(favFolder.FolderName))
                            {
                                temp = str;
                                check = true;
                                break;
                            }
                        }
                    }
                    if (check == false)
                    {

                        lstFavFolder.Add(favFolder);
                    }
                    else
                    {
                        lstFavFolder.Remove(temp);
                        lstFavFolder.Add(favFolder);
                        container.Delete(temp);
                    }


                    favList.lstFavFolder = lstFavFolder;
                    container.Ext().Store(favList, 5);
                    container.Commit();


                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);  
            }
        }
Beispiel #9
0
 public static void RemoveFavFolder(ConnParams conn)
 {
     FavouriteList favouriteList = new FavouriteList(conn);
     favouriteList.RemoveFavouritFolderForAConnection();
 }
Beispiel #10
0
		public static void RenameFolderInDatabase(ConnParams conn, FavouriteFolder oldFav, FavouriteFolder newFav)
		{
			FavouriteList lstFav = new FavouriteList(conn);
			lstFav.RenameFolderInDatabase(oldFav, newFav);  
		}
Beispiel #11
0
		public static FavouriteFolder GetFolderfromDatabaseByFoldername(ConnParams conn, string folderName)
		{
			FavouriteList lstFav = new FavouriteList(conn);
			lstFav = lstFav.FindFolderWithClassesByFolderName(folderName);
			return lstFav.lstFavFolder[0]; 
		}
Beispiel #12
0
		public static void UpdateFavourite(ConnParams conn, FavouriteFolder FavFolder)
		{
			FavouriteList lstFav = new FavouriteList(conn);
			lstFav.RemoveFolderfromDatabase(FavFolder);  
		}
Beispiel #13
0
		public static void SaveFavourite(ConnParams conn, FavouriteFolder FavFolder)
		{
			FavouriteList lstFav = new FavouriteList(conn);
			lstFav.AddFolderToDatabase(FavFolder);
		}
Beispiel #14
0
 public static long GetTimeforFavCreation(ConnParams conn)
 {
     FavouriteList lstFav = new FavouriteList(conn);
     return lstFav.ReturnTimeWhenFavouriteListCreated(); 
 }
Beispiel #15
0
		public static List<FavouriteFolder> GetFavourites(ConnParams conn)
		{
			FavouriteList lstFav = new FavouriteList(conn);
			return lstFav.ReturnFavouritFolderList(); 
		}
Beispiel #16
0
    	private void RefreshConnectionData(string filepath)
    	{
    		ConnParams conParams = new ConnParams(filepath, false);
    		RecentQueries recQueries = new RecentQueries(conParams);
    		recQueries = recQueries.ChkIfRecentConnIsInDb();

    		if (recQueries != null)
    		{
    			FavouriteList favList = new FavouriteList(conParams);
    			favList.RemoveFavouritFolderForAConnection();

    			GroupofSearchStrings grpSearchString = new GroupofSearchStrings(conParams);
    			grpSearchString.RemovesSearchStringsForAConnection();

    			recQueries.deleteRecentQueriesForAConnection();
    		}
    	}