using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data; namespace BaseFunction
{
/// <summary>
/// 处理一些控件的方法
/// </summary>
public class UI_Misc_Helper
{
/// <summary>
/// 返回选中的Comobox中Text对应的value值或者是value对应的Text值
/// </summary>
/// <param name="combobox">combobox对象</param>
/// <param name="dt_tables">要查询的表</param>
/// <param name="Text">要查询的字段</param>
/// <param name="Value">要返回的字段</param>
/// <returns>int</returns>
public static string GetComboBoxValueOrText(CRD.WinUI.Misc.ComboBox combobox, DataTable dt_tables, string Text, string Value)
{
var result = dt_tables.AsEnumerable().Where(fi => fi[Text.ToString().Trim()].ToString().Trim() == combobox.Text.ToString().Trim()).FirstOrDefault();
return result[Value.ToString().Trim()].ToString().Trim();
} }
}