namespace HStation.WinFrmUI
|
{
|
public partial class PumpPropViewCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public PumpPropViewCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView();
|
this.gridView1.RegistCustomDrawRowIndicator();
|
}
|
|
private List<PropGroupChoiceViewModel> _allBindingList;
|
|
public async void SetBindingData(string DbId)
|
{
|
if (!long.TryParse(DbId, out long pumpId))
|
{
|
return;
|
}
|
var pumpBll = new BLL.AssetsPumpMain();
|
var pump = await pumpBll.GetByID(pumpId);
|
var series = await new BLL.AssetsPumpSeries().GetByID(pump.PumpSeriesID);
|
_allBindingList = new List<PropGroupChoiceViewModel>();
|
var catlog = await new Yw.BLL.SysPropStruct().GetByCatalogID(series.CatalogID);
|
if (catlog == null)
|
{
|
this.propGroupChoiceViewModelBindingSource.ResetBindings(false);
|
return;
|
}
|
foreach (var item in catlog)
|
{
|
foreach (var prop in item.PropList)
|
{
|
_allBindingList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID });
|
}
|
}
|
var propbll = new BLL.PumpPartPropContent();
|
var partList = await pumpBll.GetPartByID(pumpId);
|
if (partList.Count <= 0)
|
return;
|
var alllist = await propbll.GetByPumpPartID(partList.First().ID);
|
foreach (var item in alllist)
|
{
|
_allBindingList.Find(x => x.ID == item.PropID).Value = item.PropValue;
|
}
|
this.propGroupChoiceViewModelBindingSource.DataSource = _allBindingList;
|
this.propGroupChoiceViewModelBindingSource.ResetBindings(false);
|
}
|
}
|
}
|