本文整理汇总了C#中DevInfo.Lib.DI_LibDAL.Connection.DIConnection.IsValidDILanguage方法的典型用法代码示例。如果您正苦于以下问题:C# DIConnection.IsValidDILanguage方法的具体用法?C# DIConnection.IsValidDILanguage怎么用?C# DIConnection.IsValidDILanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevInfo.Lib.DI_LibDAL.Connection.DIConnection
的用法示例。
在下文中一共展示了DIConnection.IsValidDILanguage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: ImportAssistant
private void ImportAssistant(DIConnection sourceDBConnection, DIQueries sourceDBQueries)
{
string DataPrefix = string.Empty;
string LanguageCode = string.Empty;
DITables TargetTableNames;
DITables SourceTableNames;
string SqlString = string.Empty;
Dictionary<string, string> SkippedTopics = new Dictionary<string, string>();
try
{
DataPrefix = this._TargetDBConnection.DIDataSetDefault();
//Get all languages from target database
foreach (DataRow Row in this._TargetDBConnection.DILanguages(DataPrefix).Rows)
{
// check language exists in source database
LanguageCode = Row[Language.LanguageCode].ToString();
if (sourceDBConnection.IsValidDILanguage(DataPrefix, LanguageCode))
{
try
{
LanguageCode = "_" + LanguageCode;
//create source table names
SourceTableNames = new DITables(DataPrefix, LanguageCode);
//create target table names
TargetTableNames = new DITables(DataPrefix, LanguageCode);
// overwrite Assistant_EBook table from source database to Target database
this.ImportEBook(ref sourceDBConnection, ref sourceDBQueries, LanguageCode, SourceTableNames, TargetTableNames);
//import topic info from source database
try
{
// check Topic exists in target database
foreach (DataRow SourceTopicRow in sourceDBConnection.ExecuteDataTable(AssistantQueries.GetALLTopics(SourceTableNames.AssistantTopic)).Rows)
{
DataTable TargetTopicsTable = null;
try
{
TargetTopicsTable = this._TargetDBConnection.ExecuteDataTable(AssistantQueries.GetALLTopics(TargetTableNames.AssistantTopic, " where Topic_Name='" + SourceTopicRow[Assistant_Topic.TopicName].ToString() + "' "));
// Check Indicator_Gid or IUS Gids exists in target database.If not exists, then skip topic.
if (this.IsIndicatorGidExistsForAssistant(SourceTopicRow[Assistant_Topic.IndicatorGId].ToString()))
{
if (TargetTopicsTable.Rows.Count > 0) // Overwrite
{
SqlString = AssistantQueries.UpdateTopicIntro(TargetTableNames.AssistantTopic,
DICommon.RemoveQuotes(SourceTopicRow[Assistant_Topic.TopicIntro].ToString()),
DICommon.RemoveQuotes(SourceTopicRow[Assistant_Topic.TopicName].ToString()),
DICommon.RemoveQuotes(SourceTopicRow[Assistant_Topic.IndicatorGId].ToString()));
}
else // create new record
{
SqlString = AssistantQueries.InsertTopicInfo(TargetTableNames.AssistantTopic,
DICommon.RemoveQuotes(SourceTopicRow[Assistant_Topic.TopicName].ToString()),
SourceTopicRow[Assistant_Topic.IndicatorGId].ToString(),
DICommon.RemoveQuotes(SourceTopicRow[Assistant_Topic.TopicIntro].ToString()));
}
this._TargetDBConnection.ExecuteNonQuery(SqlString);
}
else
{
if (!SkippedTopics.ContainsKey(SourceTopicRow[Assistant_Topic.TopicName].ToString()))
{
SkippedTopics.Add(SourceTopicRow[Assistant_Topic.TopicName].ToString(), SourceTopicRow[Assistant_Topic.TopicName].ToString());
}
}
}
catch (Exception)
{
if (TargetTopicsTable != null)
{
TargetTopicsTable.Dispose();
}
}
}
}
catch (Exception ex)
{
ExceptionHandler.ExceptionFacade.ThrowException(ex);
}
finally
{
//dispose source database connection
}
try
{
// get All Values of Assistant from source Database
DataTable SourceDbTable = sourceDBConnection.ExecuteDataTable(AssistantQueries.GetAssistantWTopicInfo(SourceTableNames.Assistant, SourceTableNames.AssistantTopic));
// check record exists in target database
foreach (DataRow SrcRow in SourceDbTable.Rows)
//.........这里部分代码省略.........
示例4: UpdateTablesForTargetLanguage
private void UpdateTablesForTargetLanguage(string languageName, DIConnection dbConnection, DIQueries dbQueries, string dataPrefix, string languageCode)
{
LanguageBuilder DILanguageBuilder;
// create langauge dependent tables if not exists in the new template
if (!dbConnection.IsValidDILanguage(dataPrefix, languageCode))
{
DILanguageBuilder = new LanguageBuilder(dbConnection, dbQueries);
DILanguageBuilder.CreateNewLanguageTables(languageCode, languageName, dataPrefix);
// delete "_en" tables & delete langauge code from language table
DILanguageBuilder.DropLanguageDependentTables(dataPrefix, "_en");
// set default language
dbConnection.ExecuteNonQuery(dbQueries.SetDefaultLanguageCode(languageCode));
}
}