本文整理汇总了C#中DevInfo.Lib.DI_LibDAL.Connection.DIConnection.DILanguageCodeDefault方法的典型用法代码示例。如果您正苦于以下问题:C# DIConnection.DILanguageCodeDefault方法的具体用法?C# DIConnection.DILanguageCodeDefault怎么用?C# DIConnection.DILanguageCodeDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevInfo.Lib.DI_LibDAL.Connection.DIConnection
的用法示例。
在下文中一共展示了DIConnection.DILanguageCodeDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDBLanguageCode
/// <summary>
/// Returns the database language code
/// </summary>
/// <param name="dbConnection"></param>
/// <returns></returns>
public static string GetDBLanguageCode(DIConnection dbConnection)
{
string RetVal = string.Empty;
string DataPrefix = dbConnection.DIDataSetDefault();
if (dbConnection.IsValidDILanguage(DataPrefix, DataAdmin.DAAppliationLangCode))
{
RetVal = "_" + DataAdmin.DAAppliationLangCode;
}
else
{
RetVal = dbConnection.DILanguageCodeDefault(DataPrefix);
}
return RetVal;
}
示例2: MergeTextualandNumericDataValueColumn
/// <summary>
/// Rename Data_value and TextualValue column into OrgData_value and OrgTextualValue
/// and merge both column value into new column Data_Value
/// </summary>
/// <param name="dbConnection"></param>
/// <param name="dbQueries"></param>
public static void MergeTextualandNumericDataValueColumn(string databaseFileNameWPath)
{
try
{
using (DIConnection DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, databaseFileNameWPath, string.Empty, string.Empty))
{
DIQueries DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
MergeTextualandNumericDataValueColumn(DBConnection, DBQueries);
}
}
catch (Exception ex)
{
throw ex;
}
}
示例3: DatabaseIncrementBuilder
public DatabaseIncrementBuilder(string sourceDBLocation, string TargetDBLocation)
{
string DataPrefix, LangCode = string.Empty;
SourceConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, sourceDBLocation, string.Empty, "unitednations2000");
TargetConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, TargetDBLocation, string.Empty, "unitednations2000");
DataPrefix = SourceConnection.DIDataSetDefault();
LangCode = SourceConnection.DILanguageCodeDefault(DataPrefix);
SourceQueries = new DIQueries(DataPrefix, LangCode);
DataPrefix = TargetConnection.DIDataSetDefault();
LangCode = TargetConnection.DILanguageCodeDefault(DataPrefix);
TargetQueries = new DIQueries(DataPrefix, LangCode);
this.SourceDbFile = sourceDBLocation;
this.TargetDbFile = TargetDBLocation;
}
示例4: GetDBQueries
/// <summary>
/// Returns the DIQueries object
/// </summary>
/// <param name="dbConnection"></param>
/// <returns></returns>
public static DIQueries GetDBQueries(DIConnection dbConnection)
{
DIQueries RetVal = null;
string LanguageCode = string.Empty;
string DataPrefix = dbConnection.DIDataSetDefault();
if (dbConnection.IsValidDILanguage(DataPrefix, DataAdmin.DAAppliationLangCode))
{
LanguageCode = "_" + DataAdmin.DAAppliationLangCode;
}
else
{
LanguageCode = dbConnection.DILanguageCodeDefault(DataPrefix);
}
RetVal = new DIQueries(DataPrefix, LanguageCode);
return RetVal;
}
示例5: Generate_SDMXML_Data
/// <summary>
/// Generate SDMX Files from DES
/// </summary>
/// <param name="DESFileNameWithPath"></param>
/// <param name="DSDFileNameWPath"></param>
/// <param name="outputFolder"></param>
/// <returns></returns>
public static bool Generate_SDMXML_Data(string DESFileNameWithPath, string DSDFileNameWPath, string outputFolder)
{
bool RetVal = false;
DIConnection DBConnection = null;
DIQueries DBQueries = null;
int count = 0;
// Utility.TemporaryFileNamePath
DataTable Table = DevInfo.Lib.DI_LibBAL.Import.DAImport.DES.DataEntrySpreadsheets.GetDataTableForAllDESSheets(DESFileNameWithPath);
string TempDatabaseName = string.Empty;
string TempDatabaseNameCompact = string.Empty;
TempDatabaseName = Path.Combine(Path.GetDirectoryName(DESFileNameWithPath), DICommon.GetValidFileName(DateTime.Now.Ticks.ToString() + DICommon.FileExtension.Template));
Dictionary<string, int> IndicatorList = new Dictionary<string, int>();
Dictionary<string, int> UnitList = new Dictionary<string, int>();
Dictionary<string, int> AreaList = new Dictionary<string, int>();
Dictionary<string, int> SgValList = new Dictionary<string, int>();
Dictionary<string, int> TimepeirodList = new Dictionary<string, int>();
Dictionary<string, int> SourceList = new Dictionary<string, int>();
try
{
DevInfo.Lib.DI_LibDAL.Resources.Resource.GetBlankDevInfoDBFile(TempDatabaseName);
DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, TempDatabaseName, string.Empty, string.Empty);
DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
DIDataValueHelper.MergeTextualandNumericDataValueColumn(DBConnection, DBQueries);
IndicatorBuilder IndBuilder = new IndicatorBuilder(DBConnection, DBQueries);
UnitBuilder UBuilder = new UnitBuilder(DBConnection, DBQueries);
DI6SubgroupValBuilder SGBuilder = new DI6SubgroupValBuilder(DBConnection, DBQueries);
AreaBuilder AreaBuilderObj = new AreaBuilder(DBConnection, DBQueries);
IndicatorClassificationBuilder ICBuilder = new IndicatorClassificationBuilder(DBConnection, DBQueries);
TimeperiodBuilder TBuilder = new TimeperiodBuilder(DBConnection, DBQueries);
SourceBuilder SrcBuilder = new SourceBuilder(DBConnection, DBQueries);
DIDatabase DatabaseObj = new DIDatabase(DBConnection, DBQueries);
IUSBuilder IUSBuilderObj = new IUSBuilder(DBConnection, DBQueries);
foreach (DataRow Row in Table.Rows)
{
int IndicatorNId = 0;
int UnitNId = 0;
int SGValNId = 0;
int AreaNId = 0;
int TimeperiodNId = 0;
int SourceNid = 0;
int IUSNID = 0;
//-- Import Indicator
if (IndicatorList.ContainsKey(Convert.ToString(Row[Indicator.IndicatorGId])))
{
IndicatorNId = IndicatorList[Convert.ToString(Row[Indicator.IndicatorGId])];
}
else
{
IndicatorNId = IndBuilder.ImportIndicator(Convert.ToString(Row[Indicator.IndicatorName]), Convert.ToString(Row[Indicator.IndicatorGId]), false);
IndicatorList.Add(Convert.ToString(Row[Indicator.IndicatorGId]), IndicatorNId);
}
//-- Import Unit
if (UnitList.ContainsKey(Convert.ToString(Row[Unit.UnitGId])))
{
UnitNId = UnitList[Convert.ToString(Row[Unit.UnitGId])];
}
else
{
UnitNId = UBuilder.ImportUnit(Convert.ToString(Row[Unit.UnitGId]), Convert.ToString(Row[Unit.UnitName]).Trim(), false);
UnitList.Add(Convert.ToString(Row[Unit.UnitGId]), UnitNId);
}
//-- Import SubgroupVal
if (!string.IsNullOrEmpty(Convert.ToString(Row[SubgroupVals.SubgroupVal])))
{
if (SgValList.ContainsKey(Convert.ToString(Row[SubgroupVals.SubgroupValGId])))
{
SGValNId = SgValList[Convert.ToString(Row[SubgroupVals.SubgroupValGId])];
}
else
{
SGValNId = SGBuilder.ImportSubgroupVal(Convert.ToString(Row[SubgroupVals.SubgroupVal]), Convert.ToString(Row[SubgroupVals.SubgroupValGId]), false);
SgValList.Add(Convert.ToString(Row[SubgroupVals.SubgroupValGId]), SGValNId);
}
}
//-- Import Area
if (AreaList.ContainsKey(Convert.ToString(Row[Area.AreaID])))
{
AreaNId = AreaList[Convert.ToString(Row[Area.AreaID])];
}
else
//.........这里部分代码省略.........
示例6: GetMapServerQueries
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;
}
示例7: ImportAssistants
internal void ImportAssistants()
{
DIConnection SourceDBConnection = null;
DIQueries SourceDBQueries = null;
string DataPrefix = string.Empty;
string LanguageCode = string.Empty;
//get all source database name
foreach (string SourceFileNameWPath in this.SourceDatabaseFileNamesWPath)
{
//for each source database, import notes
try
{
SourceDBConnection = new DIConnection(new DIConnectionDetails(DIServerType.MsAccess,
string.Empty, string.Empty, SourceFileNameWPath, string.Empty, Common.Constants.DBPassword));
DataPrefix = SourceDBConnection.DIDataSetDefault();
LanguageCode = SourceDBConnection.DILanguageCodeDefault(DataPrefix);
SourceDBQueries = new DIQueries(DataPrefix, LanguageCode);
this.ImportAssistant(SourceDBConnection, SourceDBQueries);
}
catch (Exception)
{
}
finally
{
if (SourceDBConnection != null)
{
SourceDBConnection.Dispose();
this._TargetDBConnection.Dispose();
}
if (SourceDBQueries != null)
{
SourceDBQueries = null;
}
}
}
}
示例8: AdminRegisterDatabase
//.........这里部分代码省略.........
ServerName = DBConnArr[1];
DbName = DBConnArr[2];
UserName = DBConnArr[3];
if (DBConnArr.Length > 4)
{
Password = DBConnArr[4];
}
ObjDIConnection = new DIConnection(((DIServerType)Convert.ToInt32(ServerType)), ServerName, "", DbName, UserName, Password);
// Get default language for that db
QryStr = "SELECT Language_Code FROM ut_language WHERE Language_Default = 1";
DTCounts = ObjDIConnection.ExecuteDataTable(Regex.Replace(QryStr, "UT_", ObjDIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase));
if (DTCounts.Rows.Count == 1) strDefaultLanguage = DTCounts.Rows[0]["Language_Code"].ToString();
else strDefaultLanguage = "en";
// Get counts from db
QryStr = "select DBMtd_AreaCnt, DBMtd_IndCnt, DBMtd_SrcCnt, DBMtd_DataCnt from ut_dbmetadata_" + strDefaultLanguage;
DTCounts = ObjDIConnection.ExecuteDataTable(Regex.Replace(QryStr, "UT_", ObjDIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase));
DataRow Row = DTCounts.Rows[0];
CountStr = string.Format("{0:0,0}", Row[0]) + "_" + string.Format("{0:0,0}", Row[1]) + "_" + string.Format("{0:0,0}", Row[2]) + "_" + string.Format("{0:0,0}", Row[3]);
DbConnWithEncryptPassword = ServerType + "||" + ServerName + "||" + DbName + "||" + UserName;
if (!string.IsNullOrEmpty(Password))
{
DbConnWithEncryptPassword += "||" + Global.EncryptString(Password);
}
else
{
DbConnWithEncryptPassword += "||";
}
//get default language code in database
DbDefaultLanguage = ObjDIConnection.DILanguageCodeDefault(ObjDIConnection.DIDataSetDefault());
//get all avalilable language code in database
DbAvailableLanguage = Global.GetAllAvailableLanguageCode(ObjDIConnection);
if (DbAvailableLanguage.Length > 0)
{
DbAvailableLanguageStr = string.Join(",", DbAvailableLanguage);
}
if (Global.standalone_registry != "true")
{
this.RunDBScripts(ObjDIConnection, NewId.ToString(), DbDefaultLanguage.Substring(1));
VersionBuilder = new DBVersionBuilder(ObjDIConnection, new DIQueries(ObjDIConnection.DIDataSetDefault(), ObjDIConnection.DILanguageCodeDefault(ObjDIConnection.DIDataSetDefault())));
VersionBuilder.InsertVersionInfo(Constants.DBVersion.DI7_0_0_0, Constants.DBVersion.VersionsChangedDatesDI7_0_0_0, Constants.DBVersion.VersionCommentsDI7_0_0_0);
#region -- Get default values of indicator, area and language --
#region -- get default indicator and their Json data --
DefIndStr = GetDefaultIndicators(ObjDIConnection, strDefaultLanguage);
DefInd = DefIndStr[0];
DefIndJSon = DefIndStr[1];
#endregion
#region --get default area of level 1 and 2 (L1 + L2) by stored procedure with their json and counts --
DefAreaStr = GetDefaultAreas(ObjDIConnection, strDefaultLanguage);
DefArea = DefAreaStr[0];
DefAreaJSon = DefAreaStr[1];
DefAreaCount = DefAreaStr[2];
示例9: AdminUpdateDbConnection
/// Update connection details by selected db
/// </summary>
/// <param name="requestParam"></param>
/// <returns></returns>
public string AdminUpdateDbConnection(string requestParam)
{
string RetVal = string.Empty;
string[] Params;
string DBConnectionsFile = string.Empty;
XmlDocument XmlDoc;
XmlNode xmlNode;
string DbNId = string.Empty;
string ConnName = string.Empty;
string DbConn = string.Empty;
string Password = string.Empty;
string DefArea = string.Empty;
string Description = string.Empty;
string IsDefDb = string.Empty;
string CategoryName = string.Empty;
XmlElement NewCategoryElement;
XmlNode NewXmlNode;
XmlNode CategoryNode;
DIConnection ObjDIConnection = null;
string[] DbAvailableLanguage;
string strDefaultLanguage = string.Empty;
string CountStr = string.Empty;
DataTable DTCounts;
string QryStr = string.Empty;
string DbDefaultLanguage = string.Empty;
string DbAvailableLanguageStr = string.Empty;
string DefAreaJSon = string.Empty;
string DefAreaCount = "0";
string[] DefAreaStr;
string[] DefIndStr;
string DefInd = string.Empty;
string DefIndJSon = string.Empty;
DBConverterDecorator objDBConverterDecorator = null;
DBVersionBuilder VersionBuilder = null;
///Variables for creatin XLSLogfile
string[] DatabaseParams;
string XLSFileMsg = string.Empty;
string Server_HostName = string.Empty;
string DatabaseName = string.Empty;
string DataBaseUserName = string.Empty;
string[] DBConnArr;
try
{
requestParam = HttpUtility.UrlDecode(requestParam);
Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
DbNId = Params[0];
ConnName = Params[1];
DbConn = Params[2];
Password = Params[3];
Description = Params[4];
IsDefDb = Params[5];
CategoryName = Params[6];
DBConnectionsFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.DBConnectionsFile]);
XmlDoc = new XmlDocument();
XmlDoc.Load(DBConnectionsFile);
DBConnArr = DbConn.Split(new string[] { "||" }, StringSplitOptions.None);
ObjDIConnection = new DIConnection(((DIServerType)Convert.ToInt32(DBConnArr[0])), DBConnArr[1].ToString(), string.Empty, DBConnArr[2].ToString(), DBConnArr[3].ToString(), Password);
if (!string.IsNullOrEmpty(Password))
{
Password = Global.EncryptString(Password);
DbConn = DbConn + Password;
}
QryStr = "SELECT Language_Code FROM ut_language WHERE Language_Default = 1";
DTCounts = ObjDIConnection.ExecuteDataTable(Regex.Replace(QryStr, "UT_", ObjDIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase));
if (DTCounts.Rows.Count == 1) strDefaultLanguage = DTCounts.Rows[0]["Language_Code"].ToString();
else strDefaultLanguage = "en";
// Get counts from db
QryStr = "select DBMtd_AreaCnt, DBMtd_IndCnt, DBMtd_SrcCnt, DBMtd_DataCnt from ut_dbmetadata_" + strDefaultLanguage;
DTCounts = ObjDIConnection.ExecuteDataTable(Regex.Replace(QryStr, "UT_", ObjDIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase));
DataRow Row = DTCounts.Rows[0];
CountStr = string.Format("{0:0,0}", Row[0]) + "_" + string.Format("{0:0,0}", Row[1]) + "_" + string.Format("{0:0,0}", Row[2]) + "_" + string.Format("{0:0,0}", Row[3]);
//get default language code in database
DbDefaultLanguage = ObjDIConnection.DILanguageCodeDefault(ObjDIConnection.DIDataSetDefault());
//get all avalilable language code in database
DbAvailableLanguage = Global.GetAllAvailableLanguageCode(ObjDIConnection);
if (DbAvailableLanguage.Length > 0)
{
DbAvailableLanguageStr = string.Join(",", DbAvailableLanguage);
}
#region -- get default indicator and their Json data --
DefIndStr = GetDefaultIndicators(ObjDIConnection, strDefaultLanguage);
DefInd = DefIndStr[0];
DefIndJSon = DefIndStr[1];
//.........这里部分代码省略.........
示例10: ISVaildDevInfoDatabase
/// <summary>
/// Returns true if template or database is DevInfo compatible
/// </summary>
/// <param name="dbConnection"></param>
/// <param name="fileNameWPath"></param>
/// <returns></returns>
/// <remarks>It will validate on the basis of default langauge and dataset</remarks>
public static bool ISVaildDevInfoDatabase(string fileNameWPath)
{
bool RetVal = false;
bool IsForOnlineDB;
DIConnection DBConnection = null;
DIQueries DbQueries;
try
{
DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, fileNameWPath, string.Empty, string.Empty);
//AvailableDB
DbQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
// check DB_Available_Databases table exists
if (!string.IsNullOrEmpty(DBConnection.DIDataSetDefault()))
{
RetVal = true;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.Print(ex.Message);
RetVal = false;
}
finally
{
if (DBConnection != null)
{
DBConnection.Dispose();
}
}
return RetVal;
}
示例11: ConnectToDatabaseNCreateConverter
private void ConnectToDatabaseNCreateConverter(string fileNameWPath)
{
DIConnection DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, fileNameWPath, string.Empty, string.Empty);
DIQueries DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
this.CreateDBConverter(DBConnection, DBQueries);
}
示例12: CompactNUpdateOnlineDataBase
public static bool CompactNUpdateOnlineDataBase(ref DIConnection sourceDBConnection, DIQueries dbQueries)
{
bool RetVal = false;
DIConnectionDetails SourceDBConnectionDetails;
DBMetadataTableBuilder DBMetadataTable;
DIDatabase DBDatabase;
string DataPrefix = string.Empty;
try
{
if (sourceDBConnection != null)
{
// update counts in DBMetadata table( only if database/template is in DI6 format)
if (dbQueries == null)
{
DataPrefix = sourceDBConnection.DIDataSetDefault();
dbQueries = new DIQueries(DataPrefix, sourceDBConnection.DILanguageCodeDefault(DataPrefix));
}
DBMetadataTable = new DBMetadataTableBuilder(sourceDBConnection, dbQueries);
if (DBMetadataTable.IsDBMetadataTableExists())
{
DBMetadataTable.GetNUpdateCounts();
}
if (DIDatabase.SeperateDataValueColumn)
{
// Check orgTextual_Data_value exists or not. If column exists then move textual & numeric values into their respective column.
DIDataValueHelper.SeparateTextualandNemericData(sourceDBConnection, dbQueries);
}
// update indicator unit and subgroup nids in Data table
DBDatabase = new DIDatabase(sourceDBConnection, dbQueries);
DBDatabase.UpdateIndicatorUnitSubgroupNIDsInData();
// remove FootnoteNId inconsistency. (replace 0 or null FootnoteNId by -1 in UT_data table).
DBDatabase.RemoveFootnoteNIdsInconsistencyInData();
RetVal = true;
}
}
catch (Exception ex)
{
RetVal = false;
ExceptionFacade.ThrowException(ex);
}
return RetVal;
}
示例13: CompactDataBase
/// <summary>
/// Compact the database mainly Access database(.mdb) and save as specified destination file.
/// </summary>
///<param name="sourceDBConnection"> Source database connection</param>
/// <param name="destFilePath">destination file name with path.</param>
/// <param name="disposeConnection"> Set true when calling this methods for finish process otherwise false.For only saving the database, pass False and for finish , pass true. </param>
/// <returns>true, if success.</returns>
/// <remarks>Before calling this function,dont dispose source database connection </remarks>
public static bool CompactDataBase(ref DIConnection sourceDBConnection, DIQueries dbQueries, string destFilePath, bool disposeConnection)
{
bool RetVal = false;
bool IsFileOpen = false;
DIConnectionDetails SourceDBConnectionDetails;
DBMetadataTableBuilder DBMetadataTable;
DIDatabase DBDatabase;
string SourceDBNameWPath;
JRO.JetEngine je;
string DataPrefix = string.Empty;
DI7MetadataCategoryBuilder DI7MetadataCategory;
// -- NOTE: USE sDestFile only when sDestFile <> sSourceDB
try
{
if (sourceDBConnection != null && !string.IsNullOrEmpty(destFilePath))
{
//Drop index for ut_data table for IUSNID, areanid column
DIDatabase.DropDefaultIndex(sourceDBConnection);
// update counts in DBMetadata table( only if database/template is in DI6 format)
if (dbQueries == null)
{
DataPrefix = sourceDBConnection.DIDataSetDefault();
dbQueries = new DIQueries(DataPrefix, sourceDBConnection.DILanguageCodeDefault(DataPrefix));
}
DBMetadataTable = new DBMetadataTableBuilder(sourceDBConnection, dbQueries);
if (DBMetadataTable.IsDBMetadataTableExists())
{
DBMetadataTable.GetNUpdateCounts();
}
//Updating XSLT from Resourse File into database.
DI7MetadataCategory = new DI7MetadataCategoryBuilder(sourceDBConnection, dbQueries);
DI7MetadataCategory.UpdateXSLT(dbQueries.DataPrefix);
// update database name in DB_Available table
sourceDBConnection.InsertNewDBFileName(dbQueries.DataPrefix, DICommon.RemoveQuotes(System.IO.Path.GetFileName(destFilePath)));
if (DIDatabase.SeperateDataValueColumn)
{
// Check orgTextual_Data_value exists or not. If column exists then move textual & numeric values into their respective column.
DIDataValueHelper.SeparateTextualandNemericData(sourceDBConnection, dbQueries);
}
// update indicator unit and subgroup nids in Data table
DBDatabase = new DIDatabase(sourceDBConnection, dbQueries);
DBDatabase.UpdateIndicatorUnitSubgroupNIDsInData();
// remove FootnoteNId inconsistency. (replace 0 or null FootnoteNId by -1 in UT_data table).
DBDatabase.RemoveFootnoteNIdsInconsistencyInData();
// Update auto calculated columns ( IC table - Publisher, Year & title ,Indicator table- Data_Exists, area table - data_exist, IUS table - subgroup_nids & data_exist) into the database/template
DBDatabase.UpdateAutoCalculatedFieldsInTables();
// Update auto calculated column of DI7
DBDatabase.UpdateAutoCalculatedDI7FieldsInTables();
//Update those subgroupVals which is not associated with any subgroup type.Then insert association with others for those subgroup
DBDatabase.UpdateSubgroupValsInOthersSGDimensionInTables();
//Create index for ut_data table for IUSNID, areanid column
DIDatabase.CreateDefaultIndex(sourceDBConnection);
// dispose source database connection
SourceDBConnectionDetails = sourceDBConnection.ConnectionStringParameters;
SourceDBNameWPath = SourceDBConnectionDetails.DbName;
sourceDBConnection.Dispose();
System.Threading.Thread.Sleep(10);
try
{
if (File.Exists(destFilePath))
{
File.SetAttributes(destFilePath, FileAttributes.Normal);
File.Delete(destFilePath);
}
}
catch { }
//-- Copy SourceFile to temp file so that any existing connection on database shall not stop compact database process.
//string TempFile = DICommon.GetValidFileName(DateTime.Now.ToString()) + Path.GetExtension(SourceDBNameWPath);
//File.Copy(SourceDBNameWPath, TempFile, true);
try
{
// compacting the database
je = new JRO.JetEngine();
je.CompactDatabase("Data Source=\"" + SourceDBNameWPath + "\";Jet OLEDB:Database Password=" + SourceDBConnectionDetails.Password, "Data Source=\"" + destFilePath + "\";Jet OLEDB:Database Password=" + SourceDBConnectionDetails.Password);
je = null;
}
//.........这里部分代码省略.........
示例14: IsDI7Database
/// <summary>
/// check is DI7 database
/// </summary>
/// <returns></returns>
public static bool IsDI7Database(string databaseFileNameWPath)
{
bool RetVal = false;
string DataPrefix = string.Empty;
DIConnection diConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, databaseFileNameWPath, string.Empty, "unitednations2000");
DIQueries diQueries;
if (diConnection != null)
{
DataPrefix = diConnection.DIDataSetDefault();
diQueries = new DIQueries(DataPrefix, diConnection.DILanguageCodeDefault(DataPrefix));
if (diConnection.ExecuteDataTable(diQueries.DBVersion.GetRecords(DevInfo.Lib.DI_LibBAL.Converter.Database.Constants.Versions.DI7_0_0_0)).Rows.Count > 0)
{
RetVal = true;
}
}
return RetVal;
}
示例15: CreateTemplateFrmAreaSpreadsheet
/// <summary>
/// DevInfo_5_0 Area Spreadsheet (should have 5 columns only staring the value from 6th Row - AreaID, AreaName, AreaLevel, AreaGID, ParentGID)
/// </summary>
/// <param name="templateFileName"></param>
/// <param name="xlsFilenames"></param>
/// <param name="tempFolderPath"></param>
/// <param name="trgDBQueries">Instance of target queries object</param>
/// <param name="languageName">languageName</param>
/// <returns></returns>
public bool CreateTemplateFrmAreaSpreadsheet(string templateFileName, List<string> xlsFilenames, string tempFolderPath, DIQueries trgDBQueries, string languageName)
{
bool RetVal = false;
DIConnection DBConnection = null;
DIQueries DBQueries;
AreaBuilder AreaBuilderObj;
DIDatabase TempTemplateFile;
string DataPrefix = string.Empty;
string LanguageCode = string.Empty;
LanguageBuilder DILanguageBuilder;
try
{
//create temp template file
TempTemplateFile = new DIDatabase(templateFileName);
TempTemplateFile.Dispose();
//create DIConnection, queries and area objects
DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, templateFileName, string.Empty, string.Empty);
if (trgDBQueries != null)
{
DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), trgDBQueries.LanguageCode);
DataPrefix = DBQueries.DataPrefix;
LanguageCode = trgDBQueries.LanguageCode.Replace("_", "");
// create langauge dependent tables if not exists in the new template
this.UpdateTablesForTargetLanguage(languageName, DBConnection, DBQueries, DataPrefix, LanguageCode);
}
else
{
DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
}
AreaBuilderObj = new AreaBuilder(DBConnection, DBQueries);
//get areas from excel files
foreach (string XlsFileName in xlsFilenames)
{
try
{
// insert area into template
DIExcel AreaXlsFile = new DIExcel(XlsFileName);
AreaInfo NewArea;
DataTable TempTable = AreaXlsFile.GetDataTableFromSheet(AreaXlsFile.GetSheetName(0));
//check it is a valid area excel file or not
if (TempTable.Rows.Count > 5 & TempTable.Columns.Count > 1)
{
if (TempTable.Rows[2][0].ToString() == DITemplate.AreaIdString
& TempTable.Rows[2][1].ToString() == DITemplate.AreaNameString
& TempTable.Rows[2][2].ToString() == DITemplate.AreaLevelString
& TempTable.Rows[2][3].ToString() == DITemplate.AreaGIdString
& TempTable.Rows[2][4].ToString() == DITemplate.AreaParentGIdString)
{
// delete empty rows
for (int i = 0; i < 4; i++)
{
TempTable.Rows[0].Delete();
}
TempTable.AcceptChanges();
// sort the table by level
TempTable.DefaultView.Sort = TempTable.Columns[this.AreaSheetColumns[AreaSheetColumnType.AreaLevel].ColumnIndex].ColumnName;
foreach (DataRowView Row in TempTable.DefaultView)
{
try
{
// get area info from temp table
NewArea = new AreaInfo();
NewArea.ID = DICommon.RemoveQuotes(Row[this.AreaSheetColumns[AreaSheetColumnType.AreaID].ColumnIndex].ToString());
NewArea.Name = DICommon.RemoveQuotes(Row[this.AreaSheetColumns[AreaSheetColumnType.AreaName].ColumnIndex].ToString());
NewArea.Level = Convert.ToInt32(Row[this.AreaSheetColumns[AreaSheetColumnType.AreaLevel].ColumnIndex]);
NewArea.GID = DICommon.RemoveQuotes(Row[this.AreaSheetColumns[AreaSheetColumnType.AreaGID].ColumnIndex].ToString());
NewArea.Parent = new AreaInfo();
NewArea.Parent.ID = DICommon.RemoveQuotes(Row[this.AreaSheetColumns[AreaSheetColumnType.PareaGID].ColumnIndex].ToString());
//insert area into template
// Step 1: If Area_Parent_ID is blank then set Area_Parent_NID to -1 and Area_Level=1
if (string.IsNullOrEmpty(NewArea.Parent.ID))
{
NewArea.Parent.Nid = -1;
NewArea.Level = 1;
}
else
{
// Step 2: If Area_Parent_ID is not blank then get Area_Parent_NID
NewArea.Parent.Nid = AreaBuilderObj.GetAreaNidByAreaID(NewArea.Parent.ID);
//.........这里部分代码省略.........