|
|
|
|
|
using CompressorXN_Service;
|
|
|
|
|
|
using DevExpress.XtraEditors;
|
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CompressorXN.Untils
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BindDropdownHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
private static readonly ProductTypeService _productTypeService = new ProductTypeService();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定产品型号
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="lookUpEdit"></param>
|
|
|
|
|
|
/// <param name="showPleaseChose"></param>
|
|
|
|
|
|
public static void BindProductType(LookUpEdit lookUpEdit, bool showPleaseChose = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
var list = _productTypeService.QueryProductTypes()
|
|
|
|
|
|
.Select(m => new ListItem
|
|
|
|
|
|
{
|
|
|
|
|
|
Value = m.ProductTypeName,
|
|
|
|
|
|
Text = SqlFunc.MergeString(m.ProductTypeName, "_", m.IsUsed ? "使用中" : "未使用")
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
if (showPleaseChose)
|
|
|
|
|
|
{
|
|
|
|
|
|
ListItem listItem = new ListItem
|
|
|
|
|
|
{
|
|
|
|
|
|
Value = "",
|
|
|
|
|
|
Text = "--请选择--"
|
|
|
|
|
|
};
|
|
|
|
|
|
list.Insert(0, listItem);
|
|
|
|
|
|
lookUpEdit.EditValue = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
lookUpEdit.Properties.ValueMember = "Value";
|
|
|
|
|
|
lookUpEdit.Properties.DisplayMember = "Text";
|
|
|
|
|
|
lookUpEdit.Properties.DataSource = list;
|
|
|
|
|
|
|
|
|
|
|
|
lookUpEdit.ItemIndex = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定波特率
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="comboBox"></param>
|
|
|
|
|
|
public static void BindBps(System.Windows.Forms.ComboBox comboBox)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ListItem> list = new List<ListItem>
|
|
|
|
|
|
{
|
|
|
|
|
|
new ListItem { Value = "19200", Text = "19.2k" },
|
|
|
|
|
|
new ListItem { Value = "125000", Text = "125K" },
|
|
|
|
|
|
new ListItem { Value = "250000", Text = "250k" },
|
|
|
|
|
|
new ListItem { Value = "500000", Text = "500k" },
|
|
|
|
|
|
new ListItem { Value = "800000", Text = "800k" },
|
|
|
|
|
|
new ListItem { Value = "1000000", Text = "1000k" },
|
|
|
|
|
|
new ListItem { Value = "2000000", Text = "2000k" },
|
|
|
|
|
|
new ListItem { Value = "4000000", Text = "4000k" },
|
|
|
|
|
|
new ListItem { Value = "5000000", Text = "5000k" },
|
|
|
|
|
|
new ListItem { Value = "8000000", Text = "8000k" }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
comboBox.DataSource = list;
|
|
|
|
|
|
comboBox.ValueMember = "Value";
|
|
|
|
|
|
comboBox.DisplayMember = "Text";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定报文格式
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="comboBox"></param>
|
|
|
|
|
|
/// <param name="showPleaseChose"></param>
|
|
|
|
|
|
public static void BindMsgFormat(System.Windows.Forms.ComboBox comboBox)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ListItem> list = new List<ListItem>
|
|
|
|
|
|
{
|
|
|
|
|
|
new ListItem { Value = "Intel", Text = "Intel" },
|
|
|
|
|
|
new ListItem { Value = "Motorola(LSB)", Text = "Motorola(LSB)" },
|
|
|
|
|
|
new ListItem { Value = "Motorola(MSB)", Text = "Motorola(MSB)" },
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
comboBox.DataSource = list;
|
|
|
|
|
|
comboBox.ValueMember = "Value";
|
|
|
|
|
|
comboBox.DisplayMember = "Text";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定帧类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="comboBox"></param>
|
|
|
|
|
|
public static void BindFrameType(System.Windows.Forms.ComboBox comboBox)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<ListItem> list = new List<ListItem>
|
|
|
|
|
|
{
|
|
|
|
|
|
new ListItem { Value = "STANDARD", Text = "标准帧" },
|
|
|
|
|
|
new ListItem { Value = "EXTEND", Text = "扩展帧" }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
comboBox.DataSource = list;
|
|
|
|
|
|
comboBox.ValueMember = "Value";
|
|
|
|
|
|
comboBox.DisplayMember = "Text";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|