去除每个页面的 语言datatable
This commit is contained in:
@@ -219,75 +219,6 @@ namespace CleanMachineHMI.Utils
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设定数据视图列文本
|
||||
/// </summary>
|
||||
/// <param name="dataGrid"></param>
|
||||
/// <param name="formName"></param>
|
||||
/// <param name="languageCode"></param>
|
||||
public static DataTable GetInfoLanguageText(this ContainerControl form, string languageCode, string controlType = "Info")
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $@"SELECT * FROM SYS_LANGUAGE_CONTROL
|
||||
WHERE USED_FLAG = 1 AND DEL_FLAG = 0
|
||||
AND (FORM_CODE='{form.Name}' OR IFNULL(FORM_CODE,'')='') AND LANGUAGE_CODE='{languageCode}' AND CONTROL_TYPE = '{controlType}' ORDER BY LANGUAGE_CONTROL_ID";
|
||||
return LeadDbHelperSQLite.Query(sql).Tables[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取等于查询行
|
||||
/// </summary>
|
||||
/// <param name="dataTable"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static DataRow[] GetEqualSelectRow(this DataTable dataTable, string key, string value)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var likeSql = $"`{key}` = '{value}'";
|
||||
DataRow[] dataRow = dataTable.Select(likeSql);
|
||||
return dataRow;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取包含查询行
|
||||
/// </summary>
|
||||
/// <param name="dataTable"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static DataRow[] GetContainSelectRow(this DataTable dataTable, string key, string value)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var likeSql = $"`{key}` like '%{value}%'";
|
||||
DataRow[] dataRow = dataTable.Select(likeSql);
|
||||
return dataRow;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取信息文本
|
||||
@@ -295,7 +226,7 @@ namespace CleanMachineHMI.Utils
|
||||
/// <param name="dataTable"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetInfoText(this Control form, string defaultValue, string infoCode, string controlType = "Info")
|
||||
public static string GetInfoText(this Control form, string defaultValue, string infoCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -316,14 +247,20 @@ namespace CleanMachineHMI.Utils
|
||||
}
|
||||
}
|
||||
|
||||
public static DataRow[] GetComBoboxItemArr(this DataTable dataTable, string key, string controlType)
|
||||
public static List<string> GetComBoboxItemArr(this Control form, string code, string controlType)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var likeSql = $"`CONTROL_CODE` = '{key}' and `CONTROL_TYPE` = '{controlType}'";
|
||||
DataRow[] dataRow = dataTable.Select(likeSql);
|
||||
return dataRow;
|
||||
var key = form.Name + "|" + code;
|
||||
if (!GlobalHelper.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GlobalHelper.ThemeLanguage[key].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -332,35 +269,6 @@ namespace CleanMachineHMI.Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 遍历控制界面
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="dataTable"></param>
|
||||
private static void ErgodicControlsText(Control container, DataTable dataTable)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dataTable.Rows.Count; i++)
|
||||
{
|
||||
Control[] tmpC = container.Controls.Find(dataTable.Rows[i]["CONTROL_CODE"].ToString(), true);
|
||||
if (tmpC.Length > 0)
|
||||
{
|
||||
if (tmpC[0] is KryptonGroupBox)
|
||||
{
|
||||
//Console.Write("模块名称"+ ((KryptonGroupBox)tmpC[0]).Values.Heading);
|
||||
//Console.Write("\r\n");
|
||||
((KryptonGroupBox)tmpC[0]).Values.Heading = dataTable.Rows[i]["CONTROL_NAME"].ToString();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//Console.Write("控件名称:"+ tmpC[0].Name+ ":控件中文名:" + tmpC[0].Text);
|
||||
//Console.Write("\r\n");
|
||||
tmpC[0].Text = dataTable.Rows[i]["CONTROL_NAME"].ToString();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 遍历数据视图控件
|
||||
|
||||
Reference in New Issue
Block a user