本文整理汇总了C#中BindingList.Single方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Single方法的具体用法?C# BindingList.Single怎么用?C# BindingList.Single使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Single方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MovePositionRow
public void MovePositionRow(CBatch_detail_aa_twofold row_ini, CBatch_detail_aa_twofold row_end)
{
CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
BindingList<CBatch_detail_aa_twofold> lst = new BindingList<CBatch_detail_aa_twofold>(ListSamples);
// --- copiar muestra drag como temporal
CBatch_detail_aa_twofold tmp_row_ini = lst.Single(c => c.Cod_interno == row_ini.Cod_interno);
CBatch_detail_aa_twofold tmp_row_end = lst.Single(c => c.Cod_interno == row_end.Cod_interno);
// --- quitar muestra drag de la lista
lst.Remove(tmp_row_ini);
// --- obetener indice o posición a donde será movido
int new_index_end = lst.IndexOf(tmp_row_end);
// --- insertar la muestra que fue removida
lst.Insert(new_index_end, tmp_row_ini);
// --- reset orden de las muestras
short count = 1;
foreach (CBatch_detail_aa_twofold item in lst)
{
item.Order_sample_batch = count;
count++;
faBatch_detail_aa_twofold.Update(item);
}
// --- get source data
dtPivotBatch =
new BindingList<CBatch_detail_aa_twofold>(
faBatch_detail_aa_twofold
.GetAll()
.Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
}
示例2: 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!";
}
}