Exemplo n.º 1
0
    public static DIQueries GetMapServerQueries(string DataPrefix_UI, string LanguageCode_UI, DIConnection connection)
    {
        //TO Do GetConnection from web service
        DIQueries RetVal = null;

        try
        {
            if (connection.DIDataSets().Select(DBAvailableDatabases.AvlDBPrefix + "='" + DataPrefix_UI.Trim('_') + "'").Length == 0)
            {
                DataPrefix_UI = connection.DIDataSetDefault();
            }

            if (connection.DILanguages(DataPrefix_UI).Select(Language.LanguageCode + "='" + LanguageCode_UI + "'").Length == 0)
            {
                LanguageCode_UI = connection.DILanguageCodeDefault(DataPrefix_UI);
            }

            RetVal = new DIQueries(DataPrefix_UI, LanguageCode_UI);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return RetVal;
    }
Exemplo n.º 2
0
 /// <summary>
 /// Add the access database in the collection
 /// </summary>
 /// <param name="dataFolderPath"></param>
 private void OfflineDbCollection(string dataFolderPath)
 {
     string[] DbFiles = new string[0];
     DbFiles = Directory.GetFiles(dataFolderPath, "*.mdb");
     foreach (string OfflineDatabase in DbFiles)
     {
         //-- Offline database not exists in the collection.
         if (!IsOfflineDatabaseExists(OfflineDatabase))
         {
             DIConnectionDetails OfflineConnectionDetail = new DIConnectionDetails(DIServerType.MsAccess, "", "", OfflineDatabase, USERNAME, PASSWORD);
             //-- Set the connection
             DIConnection DIConnection = new DIConnection(OfflineConnectionDetail);
             //-- Get all the datasets.
             DataTable DataSetTable = DIConnection.DIDataSets();
             DatabasePreference.OnlineConnectionDetail.OnlineDataSets OfflineDataSets = new OnlineConnectionDetail.OnlineDataSets();
             //-- add all datasets into the collection.
             foreach (DataRow Row in DataSetTable.Rows)
             {
                 OfflineDataSets.Add(new DatabasePreference.OnlineConnectionDetail.OnlineDataSet(Row[DBAvailableDatabases.AvlDBPrefix].ToString(), Row[DBAvailableDatabases.AvlDBName].ToString()));
             }
             DatabasePreference.OnlineConnectionDetail ConnectionDetail = new OnlineConnectionDetail(OfflineConnectionDetail, OfflineDataSets, Path.GetFileName(OfflineDatabase));
             //-- add the offline database details.
             this.OnlineDatabaseDetails.Add(ConnectionDetail);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Drop index for ut_data table for IUSNID, areanid column
        /// </summary>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public static void DropDefaultIndex(DIConnection sourceDBConnection)
        {
            string DataPrefix = string.Empty;

            //Drop index "Index_IUSNid_<DataPrefix>data"
            foreach (DataRow row in sourceDBConnection.DIDataSets().Rows)
            {
                DataPrefix = Convert.ToString(row[DBAvailableDatabases.AvlDBPrefix]).TrimEnd("_".ToCharArray());
                sourceDBConnection.DropIndex("Index_" + Data.IUSNId + "_" + DataPrefix + "Data", DataPrefix + "_data");
                sourceDBConnection.DropIndex("Index_" + Data.AreaNId + "_" + DataPrefix + "Data", DataPrefix + "_data");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get available database name of selected database connection
        /// </summary>
        /// <param name="dbConnection"></param>
        /// <returns></returns>
        public string GetAvailableDbName(DIConnection dbConnection)
        {
            string RetVal = string.Empty;
            DataTable DtResult = null;

            try
            {
                DtResult = dbConnection.DIDataSets();

                foreach (DataRow Row in DtResult.Rows)
                {
                    if (Convert.ToString(Row["AvlDB_Default"]).ToLower() == "true")
                    {
                        RetVal = Convert.ToString(Row["AvlDB_Name"]);
                        break;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return RetVal;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Create index for ut_data table for IUSNID, areanid column
        /// </summary>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public static void CreateDefaultIndex(DIConnection sourceDBConnection)
        {
            string DataPrefix = string.Empty;

            //Create index "Index_IUSNid_<DataPrefix>data"
            foreach (DataRow row in sourceDBConnection.DIDataSets().Rows)
            {
                DataPrefix = Convert.ToString(row[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.DBAvailableDatabases.AvlDBPrefix]).TrimEnd("_".ToCharArray());
                sourceDBConnection.CreateIndex("Index_" + Data.IUSNId + "_" + DataPrefix + "Data", DataPrefix + "_data", Data.IUSNId);
                sourceDBConnection.CreateIndex("Index_" + Data.AreaNId + "_" + DataPrefix + "Data", DataPrefix + "_data", Data.AreaNId);
            }
        }