本文整理汇总了C#中BindingList.Where方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Where方法的具体用法?C# BindingList.Where怎么用?C# BindingList.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Where方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupViewModel
public void SetupViewModel(PipeTest current, BindingList<Category> CategoryTypes, IReadOnlyList<PipeTest> pipeTests)
{
this.CategoryTypes = CategoryTypes;
IList<PipeTest> list = pipeTests.Where(_ => _.IsActive && !String.IsNullOrEmpty( _.Code)).OrderBy(x => x.Code).ToList<PipeTest>();
RepeatTestCandidates = new BindingList<Domain.Entity.Setup.PipeTest>(list);
pipeTest = new PipeTest();
if (current != null)
{
pipeTest.CustomShallowCopy(current);
if (current.Id != Guid.Empty)
{
PipeTest curr = RepeatTestCandidates.Where(s => s.Id == pipeTest.Id).SingleOrDefault();
RepeatTestCandidates.Remove(curr);
}
}
}
示例2: findListModel
private ListModel findListModel(BindingList<ListModel> listModel, string _idList)
{
ObservableCollection<ListModel> filtererd = new ObservableCollection<ListModel>(listModel.Where(t => t.Id == _idList)); ;
return filtererd[0];
}
示例3: findCardModel
private CardModel findCardModel(BindingList<CardModel> cardModel, string _idCard)
{
ObservableCollection<CardModel> filtererd = new ObservableCollection<CardModel>(cardModel.Where(t => t.Id == _idCard)); ;
return filtererd[0];
}
示例4: findBoardModel
private BoardModel findBoardModel(BindingList<BoardModel> boardModel, string _idBoard)
{
ObservableCollection<BoardModel> filtererd = new ObservableCollection<tempTrello.Model.BoardModel>(boardModel.Where(t => t.Id == _idBoard)); ;
return filtererd[0];
}
示例5: TextboxUpdate
private void TextboxUpdate(object sender, EventArgs e, ListBox lb, TextBox tb, BindingList<string> lst)
{
if (tb.Text != String.Empty)
{
IEnumerable<string> filtered = lst.Where((i) => i.IndexOf(tb.Text, StringComparison.OrdinalIgnoreCase) >= 0);
if (filtered.Count<string>() != 0)
{
lb.DataSource = new BindingSource(filtered, "");
}
else
{
lb.DataSource = null;
}
}
else
{
lb.DataSource = lst;
}
}
示例6: CheckForConstrains
public string CheckForConstrains(BindingList<SpecimenForGrid> specimenGrids, BindingList<TubeForGrid> tubeGrids, BindingList<TestForGrid> testGrids, BindingList<IndicationForGrid> indicationGrids)
{
if (!(specimenGrids.Count == 0) && !(tubeGrids.Count == 0) && !(tubeGrids.Count == 0))
{
int errorTestGridCount = testGrids.Where(testGrid => string.IsNullOrEmpty(testGrid.Code))
.Count();
int errorTubeGridCount = tubeGrids.Where(tubeGrid => string.IsNullOrEmpty(tubeGrid.Code) || string.IsNullOrEmpty(tubeGrid.Tests))
.Count();
int errorSpecimenGridCount = specimenGrids.Where(specimenGrid => string.IsNullOrEmpty(specimenGrid.Code) || specimenGrid.Volume < 1 || string.IsNullOrEmpty(specimenGrid.Tubes))
.Count();
int errorIndicationGridCount = indicationGrids.Where(indicationGrid => string.IsNullOrEmpty(indicationGrid.Code))
.Count();
if ((errorTestGridCount == 0) && (errorTubeGridCount == 0) && (errorSpecimenGridCount == 0) && (errorIndicationGridCount == 0))
{
bool breakFlag = false;
string returnValue = string.Empty;
foreach (var specimenGrid in specimenGrids)
{
string[] tubesId = new string[0];
if (!breakFlag)
{
string tubesString = specimenGrid.Tubes;
tubesId = tubesString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
return returnValue;
}
foreach (var tubeId in tubesId)
{
var dtoSpecimenTubeAttach = new DtoSpecimenTubeAttach()
{
ConcreteSpecimen = new DtoConcreteSpecimen()
{
CollectedDt = specimenGrid.CollectedDt,
Volume = specimenGrid.Volume,
},
ConcreteTube = new DtoConcreteTube()
{
ReceivedDt = tubeGrids.SingleOrDefault<TubeForGrid>(tube => tube.Id == tubeId).ReceivedDt,
Tube = new DtoTube2()
{
Volume = new TubeServiceClient().GetTubeByCode(tubeGrids.Single<TubeForGrid>(tube => tube.Id == tubeId).Code).Volume
}
}
};
if (dtoSpecimenTubeAttach.ConcreteTube.ReceivedDt > dtoSpecimenTubeAttach.ConcreteSpecimen.CollectedDt ||
(dtoSpecimenTubeAttach.ConcreteTube.ReceivedDt > DateTime.Now) ||
(dtoSpecimenTubeAttach.ConcreteSpecimen.CollectedDt > DateTime.Now))
{
breakFlag = true;
returnValue = "Invalid Date!";
break;
}
else if (dtoSpecimenTubeAttach.ConcreteTube.Tube.Volume < dtoSpecimenTubeAttach.ConcreteSpecimen.Volume)
{
breakFlag = true;
returnValue = "Invalid Specimen Volume!";
break;
}
else
{
returnValue = string.Empty;
}
}
}
return returnValue;
}
else
{
return "Check validity of grids!";
}
}
else
{
return "Fill all mandatory grids!";
}
}
示例7: ConstructFilter
private BindingList<ItemInfo> ConstructFilter()
{
if (this.source == null)
return null;
BindingList<ItemInfo> new_binding = new BindingList<ItemInfo>(this.source.Where(info => string.IsNullOrWhiteSpace(info.RequiredChampion)).ToList<ItemInfo>());
if (!this.chkdlistFilter.GetItemChecked(this.chkdlistFilter.Items.IndexOf("Consumables")))
{
new_binding = new BindingList<ItemInfo>(new_binding.Where(info => !info.Consumable).ToList<ItemInfo>());
}
if (!this.chkdlistFilter.GetItemChecked(this.chkdlistFilter.Items.IndexOf("Non-Consumables")))
{
new_binding = new BindingList<ItemInfo>(new_binding.Where(info => info.Consumable).ToList<ItemInfo>());
}
if (!this.chkdlistFilter.GetItemChecked(this.chkdlistFilter.Items.IndexOf("Howling Abyss")))
{
}
if (!this.chkdlistFilter.GetItemChecked(this.chkdlistFilter.Items.IndexOf("Summoner's Rift")))
{
}
if (!this.chkdlistFilter.GetItemChecked(this.chkdlistFilter.Items.IndexOf("Twisted Treeline")))
{
}
return new_binding;
}
示例8: LoadRecord
/// <summary>
/// 載入資料
/// </summary>
/// <param name="bindingList"></param>
public void LoadRecord(BindingList<GeoDataGridViewModel> bindingList)
{
this.Clear();
//重建擺正資訊
reInitSkew(bindingList);
//把資料全部加入
foreach (var geoModel in bindingList)
{
if (geoModel.ROIModel != null)
{
//重建且重計算所有的 ROI
this._DataList.Add(geoModel);
var reloadROI = geoModel.ROIModel.MakeROI();
reloadROI.ROIMeasureType = geoModel.GeoType;
addTreeNode(reloadROI, geoModel);
notifyRecordChanged(GeoDataGridViewNotifyType.ReloadData, reloadROI);
}
else
{
//加入舊的非 ROI 的資料列
addMeasuredViewModel(geoModel);
//更新skew
var skewValue = getSkew(_currentSkewID);
geoModel.SkewID = _currentSkewID;
geoModel.Skew = skewValue;
}
}
//取得所有的 Record, 並更新其相依的資料列
foreach (var item in _DataList)
{
updateDependGeoObject(item);
}
//Restore 參考座標
var coordinateIDs = bindingList.Where(p => !String.IsNullOrEmpty(p.CoordinateID))
.Select(p => new RefCoordinate()
{
ID = p.CoordinateID,
Name = p.CoordinateName,
Desc = "",
}).Distinct().ToList();
//Clear Coordinate, 保留 Default
while (_refCoordinate.Count > 1)
{
_refCoordinate.RemoveAt(1);
}
foreach (var item in coordinateIDs)
{
_refCoordinate.Add(item);
}
this.Refresh();
}
示例9: reInitSkew
/// <summary>
/// <para>****************</para>
/// 重建擺正資訊, 只有一個
/// <para>****************</para>
/// </summary>
/// <param name="bindingList"></param>
private void reInitSkew(BindingList<GeoDataGridViewModel> bindingList)
{
//Restore 參考擺正, 只留一個
var skewIDs = bindingList.Where(p => !String.IsNullOrEmpty(p.SkewID))
.Select(p => new RefSkew()
{
ID = p.SkewID,
Name = p.SkewName,
Desc = "",
}).FirstOrDefault();
if (skewIDs != null)
{
_refSkew.Clear();
_refSkew.Add(skewIDs);
_currentSkewID = _refSkew[0].ID;
}
}
示例10: CalcBuyingPrice
/// <summary>
/// Kurzovy prepocet, nakupna cena s dopravou..
/// </summary>
internal void CalcBuyingPrice(BindingList<StockItem> items)
{
if (items == null)
return;
var actualFile = string.Empty;
foreach (var item in items.Where(i => i.FromFile != null))
{
var deliverySum = item.FromFile.Delivery; // suma dopravy
var prods = items.Where(i => i.FromFile == item.FromFile); // vsetky produkty s jedneho MSG suboru
int prodCount = 0;
foreach (var prod in prods)
{
prodCount += prod.Disp_Qty;
}
double deliveryPricePerItem = deliverySum / prodCount;
if (item.Description != deliveryText)
item.PriceWithDelivery = Math.Round(item.Total + item.Disp_Qty * deliveryPricePerItem, 2);
else
item.PriceWithDelivery = item.Total;
if (item.OrderDate.Year == 1)
item.OrderDate = DateTime.Now;
if (item.FromFile.FileName != actualFile)
{
log("recalculating delivery for '" + item.FromFile.FileName + "':");
log("\tdelivery sum = " + deliverySum);
log("\tall products count = " + prodCount);
log("\tdelivery price per product = " + Math.Round(deliveryPricePerItem, 2));
actualFile = item.FromFile.FileName;
}
}
}