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


C# List.Any方法代码示例

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


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

示例1: ProcessHeaderAndDetails


//.........这里部分代码省略.........
                if (dLine.Product.Status.StatusID != EntityStatus.Active)
                    continue;

                //if (dLine.LineStatus.StatusID == DocStatus.Cancelled)
                    //continue;

                if (dLine.LineStatus.StatusID != DocStatus.New && dLine.LineStatus.StatusID != DocStatus.InProcess)
                    continue;

                if (dLine.Quantity <= 0 && dLine.LineNumber != 0)
                    continue;



                //Product To build, el primero en la lista
                if (string.IsNullOrEmpty(header.ProductToBuild))
                {
                    header.ProductToBuild = dLine.Product.ProductCode + ", " + dLine.Product.Name;

                    try
                    {
                        header.Barcode = GetAssignedBinsList(dLine.Product, document.Location).First().Bin.BinCode;
                    }
                    catch { header.Barcode = ""; }
                }


                //Si es el primer item del asembly se sale.
                if (document.DocType.DocTypeID == SDocType.KitAssemblyTask && dLine.LineNumber == 0)
                {
                    kitTotalOrder = dLine.Quantity;
                    continue;
                }




                IList<ReportDetailFormat> evaluatedLines = EvaluateLine(dLine, document, docBalance, binDirection, 1);


                foreach (ReportDetailFormat detail in evaluatedLines)
                {

                    if (detail.IsSubDetail != true)
                    {
                        detail.SeqLine = sequence++;
                        totWeight += detail.Weight;
                        totCases++; // += detail.Cases;
                        totQtyOrder += detail.QtyOrder;
                        totQtyPending += detail.QtyPending;
                        subSequence = 1;
                    }
                    else
                        detail.SeqLine = subSequence++;

                    detailList.Add(detail);

                }


            }

            #endregion

            // Totals
            header.TotalCases = totCases;
            header.TotalWeight = totWeight;
            header.TotalQtyOrder = (kitTotalOrder > 0) ? kitTotalOrder : totQtyOrder;
            header.TotalQtyPending = totQtyPending;


            if (document.DocType.DocTypeID == SDocType.SalesOrder || 
                document.DocType.DocTypeID == SDocType.WarehouseTransferShipment ||
                document.DocType.DocTypeID == SDocType.MergedSalesOrder)
            {
                //header.ReportDetails = detailList.OrderBy(f => f.Rank).ToList();

                //Si tiene componente organiza por componentes y luego por Rank
                if (detailList.Any(f=>f.IsSubDetail == true)) {
                
                    var sortedProducts = from p in detailList orderby p.CustNumber1, p.IsSubDetail, p.Rank select p;
                    header.ReportDetails = sortedProducts.ToList();
                
                }
                else { //Si no, solo por Rank. Aqui vienen las reglas de SORT
                
                    var sortedProducts = from p in detailList orderby p.Rank select p;
                    header.ReportDetails = sortedProducts.ToList();

                }

                
            }
            else
                header.ReportDetails = detailList.OrderBy(f => f.AuxSequence).ToList();


            return header;

        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:101,代码来源:ReportMngr.Document.cs

示例2: UpdateTask

        public bool UpdateTask(TaskDTO task, List<int> taskTagsId)
        {
            Task taskEntity = MapperService.Convert<BusinessObjects.TaskDTO, Task>(task);

            Task taskInDb = _taskRepository.Find(x => x.TaskId == taskEntity.TaskId).FirstOrDefault();

            if (taskInDb != null)
            {
                _taskRepository.UpdateValue(taskInDb, taskEntity);

                ICollection<Tag> listTag = _tagRepository.GetList().Where(x => taskTagsId.Any(a => a == x.TagId)).ToList();

                foreach (Tag tag in listTag)
                {
                    taskEntity.Tags.Add(tag);
                }

                taskInDb.Tags.Clear();
                foreach (Tag tag in listTag)
                {
                    taskInDb.Tags.Add(tag);
                }

                _taskRepository.Save();
            }

            return true;
        }
开发者ID:yunakh,项目名称:todo,代码行数:28,代码来源:TodoService.cs

示例3: Process

        /// <summary>
        /// Processes the specified solution path.
        /// </summary>
        /// <param name="projectsViewModel">The projects view model.</param>
        /// <param name="applicationOptionsViewModel">The application options view model.</param>
        /// <param name="ninjaCoderOptionsViewModel">The ninja coder options view model.</param>
        /// <param name="applicationSamplesOptionsViewModel">The application samples options view model.</param>
        /// <param name="viewsViewModel">The views view model.</param>
        /// <param name="pluginsViewModel">The plugins view model.</param>
        /// <param name="nugetPackagesViewModel">The nuget packages view model.</param>
        /// <param name="xamarinFormsLabsViewModel">The xamarin forms labs view model.</param>
        internal void Process(
            ProjectsViewModel projectsViewModel,
            ApplicationOptionsViewModel applicationOptionsViewModel,
            NinjaCoderOptionsViewModel ninjaCoderOptionsViewModel,
            ApplicationSamplesOptionsViewModel applicationSamplesOptionsViewModel,
            ViewsViewModel viewsViewModel,
            PluginsViewModel pluginsViewModel,
            NugetPackagesViewModel nugetPackagesViewModel,
            XamarinFormsLabsViewModel xamarinFormsLabsViewModel)
        {
            TraceService.WriteLine("ProjectsController::Process");

            foreach (SelectableItemViewModel<ProjectTemplateInfo> projectTemplateInfo in projectsViewModel.Projects)
            {
                TraceService.WriteLine(projectTemplateInfo.Item.Name + " project selected=" + projectTemplateInfo.IsSelected);
            }

            this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning);

            this.applicationService.SuspendResharperIfRequested();

            this.projectsService.IsNewSolution = this.VisualStudioService.SolutionAlreadyCreated;

            //// create the solution if we don't have one!
            if (this.projectsService.IsNewSolution == false)
            {
                this.VisualStudioService.SolutionService.CreateEmptySolution(projectsViewModel.GetSolutionPath(), projectsViewModel.Project);
            }

            if (this.SettingsService.CreateTestProjectsSolutionFolder)
            {
                this.VisualStudioService.SolutionService.AddSolutionFolder(this.SettingsService.TestProjectsSolutionFolderName);
                this.VisualStudioService.DTEService.SaveAll();
            }

               this.messages = this.projectsService.AddProjects(
                    this.VisualStudioService,
                    projectsViewModel.GetSolutionPath(),
                    projectsViewModel.GetFormattedRequiredTemplates())
                    .ToList();

            this.projectsService.SetStartUpProject();

            //// there is a bug in the xamarin iOS code that means it doesnt apply a couple of xml elements
            //// in the info.plist - here we fix that issue.

            if (this.SettingsService.FixInfoPlist)
            {
                this.applicationService.FixInfoPList(projectsViewModel.GetFormattedRequiredTemplates()
                        .FirstOrDefault(x => x.ProjectSuffix == this.SettingsService.iOSProjectSuffix));
            }

            IEnumerable<string> viewNugetCommands = new List<string>();

            if (this.SettingsService.FrameworkType != FrameworkType.NoFramework &&
                viewsViewModel != null)
            {
                //// if we dont have a viewmodel and view in memory - add one
                //// user will have dont show views and viewmodel options selected.
                if (!viewsViewModel.Views.Any())
                {
                    viewsViewModel.Add();
                }

                IEnumerable<string> viewModelMessages = this.viewModelViewsService.AddViewModelsAndViews(viewsViewModel.Views);

                this.messages.AddRange(viewModelMessages);

                viewNugetCommands = this.viewModelViewsService.GetNugetCommands();
            }

            TraceService.WriteLine("ProjectsController::Process GetApplication Commands");

            //// we need to get the post nuget commands that are now hosted in xml file that used to be in code
            CommandsList commandsList = this.applicationService.GetCommandsList();

            if (commandsList != null)
            {
                this.postNugetCommands.AddRange(commandsList.Commands);
                this.postNugetFileOperations.AddRange(commandsList.FileOperations);
            }

            IEnumerable<ProjectTemplateInfo> projectTemplateInfos = projectsViewModel.GetFormattedRequiredTemplates();

            this.commands += this.nugetService.GetNugetCommands(projectTemplateInfos);

            if (viewNugetCommands.Any())
            {
                foreach (string viewNugetCommand in viewNugetCommands)
//.........这里部分代码省略.........
开发者ID:asudbury,项目名称:NinjaCoderForMvvmCross,代码行数:101,代码来源:ProjectsController.cs

示例4: AddTask

        public bool AddTask(TaskDTO task, List<Int32> taskTagsId)
        {
            Task taskEntity = MapperService.Convert<BusinessObjects.TaskDTO, Task>(task);

            taskEntity.Tags = new Collection<Tag>();

            ICollection<Tag> listTag = _tagRepository.GetList().Where(x => taskTagsId.Any(a => a == x.TagId)).ToList();

            foreach (Tag tag in listTag)
            {
                taskEntity.Tags.Add(tag);
            }

            _taskRepository.Add(taskEntity);
            _taskRepository.Save();

            return true;
        }
开发者ID:yunakh,项目名称:todo,代码行数:18,代码来源:TodoService.cs


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