当前位置: 首页>>代码示例>>C#>>正文


C# BindingList.Single方法代码示例

本文整理汇总了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());
        }
开发者ID:khoattn,项目名称:LimsProject,代码行数:35,代码来源:CDataBatch.cs

示例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!";
            }
        }
开发者ID:abonSerg,项目名称:Clinic,代码行数:84,代码来源:NewOrderModel.cs


注:本文中的BindingList.Single方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。