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


C# IOrderedEnumerable.Where方法代码示例

本文整理汇总了C#中IOrderedEnumerable.Where方法的典型用法代码示例。如果您正苦于以下问题:C# IOrderedEnumerable.Where方法的具体用法?C# IOrderedEnumerable.Where怎么用?C# IOrderedEnumerable.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOrderedEnumerable的用法示例。


在下文中一共展示了IOrderedEnumerable.Where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTotalInventory

        /// <summary>
        /// Get Total list of items in the inventory
        /// </summary>
        /// <param name="lstTotalInventoryMl"></param>
        /// <param name="lstInventoryMl"></param>
        private List<InventoryModel> GetTotalInventory(IOrderedEnumerable<InventoryModel> lstTotalInventoryMl, string logicalDeviceId, string searchText)
        {
            List<InventoryModel> lstInventoryMl = new List<InventoryModel>();
            var lstInventoryInMl =
                lstTotalInventoryMl.Where(x => x.CurrentState.Equals(Enums.CurrentState.Add.ToString())).ToList();
            var lstInventoryOutMl =
                lstTotalInventoryMl.Where(x => x.CurrentState.Equals(Enums.CurrentState.Remove.ToString())).ToList();

            foreach (var inventoryInMl in lstInventoryInMl)
            {
                var inventoryOutMl =
                    lstInventoryOutMl.Where(
                        x => x.LogicalDeviceId == inventoryInMl.LogicalDeviceId && x.TagEPC == inventoryInMl.TagEPC)
                        .ToList();
                if (inventoryOutMl.Count == 0)
                {
                    lstInventoryMl.Add(inventoryInMl);
                }
                else
                {
                    lstInventoryOutMl.Remove(inventoryOutMl.FirstOrDefault());
                }
            }
            lstInventoryMl.ToList().ForEach(x =>
            {

                x.Batch = (from u in ObjTersoDataContext.items
                           where u.EPC == x.TagEPC
                           select u.Batch).FirstOrDefault();
                x.ItemId = (from u in ObjTersoDataContext.items
                            where u.EPC == x.TagEPC
                            select u.ItemId).FirstOrDefault();
                x.Material = (from u in ObjTersoDataContext.items
                              where u.EPC == x.TagEPC
                              select u.Material).FirstOrDefault();
                x.ExpirationDate = (from u in ObjTersoDataContext.items
                                    where u.EPC == x.TagEPC
                                    select u.ExpirationDate).FirstOrDefault();
                x.ExpirationDateString = x.ExpirationDate != null ? String.Format("{0:MM/dd/yyyy}", x.ExpirationDate.Value) : string.Empty;
                x.DeviceId = (from u in ObjTersoDataContext.devices
                              where u.LogicalDeviceId == x.LogicalDeviceId
                              select u.DeviceId).FirstOrDefault();

            });


            lstInventoryMl = lstInventoryMl.Where(x => (string.IsNullOrEmpty(logicalDeviceId) || x.LogicalDeviceId.Equals(logicalDeviceId))
                                             && (string.IsNullOrEmpty(searchText) ||
                                               (!string.IsNullOrEmpty(x.Material) && x.Material.Contains(searchText)) ||
                                               (!string.IsNullOrEmpty(x.Batch) && x.Batch.Contains(searchText)) ||
                                                 x.TagEPC.Contains(searchText) || x.LogicalDeviceId.Equals(searchText)
                                                 )).ToList();
            lstInventoryMl.ToList().ForEach(x =>
         {
             x.TotalRows = lstInventoryMl.Count;
         });

            return lstInventoryMl.ToList();
        }
开发者ID:tersosolutions,项目名称:JetstreamSDK-.NET_Launchpad,代码行数:64,代码来源:DBInventory.cs

示例2: AbsentEventCreation

        private static bool AbsentEventCreation(TimeBox sender, Term absent, IOrderedEnumerable<Term> orderedTerms)
        {
            if (orderedTerms.Any(t => t.CanNotOverlapWithAbsent && t.OverlapNotEnclosed(absent))) 
                return false;

            var exists = orderedTerms.Where(absent.NeedRelyOn)
                                     .Any(t =>
                                     {
                                         if (t.EnclosedWithTypeVerification(absent))
                                         {
                                             absent.Bottom = t.GetLowestTerm() as Term;
                                         
                                             //if (absent.IsNeedSeat != t.IsNeedSeat && t is AssignmentBase)
                                             //    ((AssignmentBase)t).CancelSeatArrangement(absent);

                                             return true;
                                         }
                                         return false;
                                     });
            return exists;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:21,代码来源:TimeBox.Validation.cs

示例3: IsTeamUnderEffect

        private bool IsTeamUnderEffect(
            IOrderedEnumerable<Tuple<PlayCardEvent, Card>> cardsPlayedOnTeam,
            EffectCardType effect)
        {
            var lastEffectCard = cardsPlayedOnTeam
                .Where(x => x.Item2.EffectType.HasFlag(effect))
                .FirstOrDefault();

            if (lastEffectCard == null)
            {
                return false;
            }
            else
            {
                bool isUnderEffect;
                switch (lastEffectCard.Item2.CardType)
                {
                    case CardType.EFFECT_NEGATIVE:
                    {
                        isUnderEffect = true;

                        break;
                    }
                    case CardType.VALUE:
                    case CardType.EFFECT_POSITIVE:
                    case CardType.EFFECT_INVINCIBLE:
                    default:
                    {
                        isUnderEffect = false;

                        break;
                    }
                }

                if (effect == EffectCardType.TRAFFIC_LIGHT)
                {
                    return !isUnderEffect;
                }

                return isUnderEffect;
            }
        }
开发者ID:mrtryhard,项目名称:millebornes,代码行数:42,代码来源:GameService.cs

示例4: CreateSuitesXElementWithParameters

 public XElement CreateSuitesXElementWithParameters(
         IOrderedEnumerable<ITestSuite> suites,
         IOrderedEnumerable<ITestScenario> scenarios,
         IOrderedEnumerable<ITestResult> testResults,
         IXMLElementsStruct xmlStruct)
 {
     var suitesElement = 
         new XElement(xmlStruct.SuitesNode,
                      from suite in suites
                      select new XElement(xmlStruct.SuiteNode,
                                          new XAttribute("uniqueId", suite.UniqueId),
                                          new XAttribute("id", suite.Id),
                                          new XAttribute("name", suite.Name),
                                          new XAttribute("status", suite.Status),
                                          createXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                                          new XAttribute("all", suite.Statistics.All.ToString()),
                                          new XAttribute("passed", suite.Statistics.Passed.ToString()),
                                          createXattribute(xmlStruct.FailedAttribute, suite.Statistics.Failed.ToString()),
                                          new XAttribute("notTested", suite.Statistics.NotTested.ToString()),
                                          new XAttribute("knownIssue", suite.Statistics.PassedButWithBadSmell.ToString()),
                                          createXattribute("description", suite.Description),
                                          createXattribute("platformId", suite.PlatformId),
                                          createXattribute("platformUniqueId", suite.PlatformUniqueId),
                                          CreateScenariosXElementCommon(
                                              suite,
                                              // 20141122
                                              // scenarios.Where(scenario => scenario.SuiteId == suite.Id).OrderBy(scenario => scenario.Id),
                                              // testResults.Where(testResult => testResult.SuiteId == suite.Id).OrderBy(testResult => testResult.Id),
                                              scenarios.Where(scenario => scenario.SuiteId == suite.Id && scenario.SuiteUniqueId == suite.UniqueId).OrderBy(scenario => scenario.Id),
                                              testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.SuiteUniqueId == suite.UniqueId).OrderBy(testResult => testResult.Id),
                                              xmlStruct)
                                          )
                     );
     return suitesElement;
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:35,代码来源:TestResultsExporter.cs

示例5: CreateScenariosXElementCommon

        public XElement CreateScenariosXElementCommon(
                ITestSuite suite,
                IOrderedEnumerable<ITestScenario> scenarios,
                IOrderedEnumerable<ITestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            var testScenariosFiltered = 
                from scenario in scenarios
                where scenario.SuiteId == suite.Id && scenario.PlatformUniqueId == suite.PlatformUniqueId
                select scenario;

            if (!testScenariosFiltered.Any()) {
                return null;
            }
            
            var scenariosElement = 
                 new XElement(xmlStruct.ScenariosNode,
                              from scenario in testScenariosFiltered
                              select getScenariosXElement(
                                  suite, 
                                  scenario,
                                  // 20141122
                                  // testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.ScenarioId == scenario.Id).OrderBy(testResult => testResult.Id),
                                  testResults.Where(
                                      testResult => testResult.SuiteId == suite.Id && 
                                      testResult.SuiteUniqueId == suite.UniqueId && 
                                      testResult.ScenarioId == scenario.Id && 
                                      testResult.ScenarioUniqueId == scenario.UniqueId).OrderBy(testResult => testResult.Id),
                                  xmlStruct)
                             );
            return scenariosElement;
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:32,代码来源:TestResultsExporter.cs

示例6: GetFlawlessVictory

 private void GetFlawlessVictory(IOrderedEnumerable<Match> matches, List<string> winners, List<string> loosers)
 {
     var orderedMatches = matches.Where(m=>m.PlayerList.Count == 4).OrderByDescending(m => m.TimeStampUtc).ToList();
     foreach (var match in orderedMatches)
     {
         if(match.MatchResult.Team1Score == 0 )
         {
             winners.AddRange(match.PlayerList.GetRange(2, 2));
             loosers.AddRange(match.PlayerList.GetRange(0, 2));
             return;
         }
         else if (match.MatchResult.Team2Score == 0)
         {
             winners.AddRange(match.PlayerList.GetRange(0, 2));
             loosers.AddRange(match.PlayerList.GetRange(2, 2));
             return;
         }
     }
 }
开发者ID:gitter-badger,项目名称:Foosball9000,代码行数:19,代码来源:AchievementsService.cs


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