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


C# List.OrderBy方法代码示例

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


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

示例1: GetProductUnit

        public IList<Unit> GetProductUnit(Product data)
        {
            IList<UnitProductRelation> unitRel = Factory.DaoUnitProductRelation().Select(new UnitProductRelation { Product = data });

            IList<Unit> list = new List<Unit>();
            foreach (UnitProductRelation uRel in unitRel)
                list.Add(uRel.Unit);
            
            return list.OrderBy(f=>f.BaseAmount).ToList();
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:10,代码来源:BasicMngr.cs

示例2: Execute

        public bool Execute(string workingCopyBase,
                            Entities.Branch source,
                            Entities.Branch target,
                            List<Entities.RevisionRange> ranges)
        {
            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = target.Path(workingCopyBase);

            using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
            {
                client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                SharpSvn.SvnUriTarget svnSource = new SharpSvn.SvnUriTarget(source.Url);
                checkoutBLL.Execute(target, workingCopyBase);
                revertBLL.Execute(target, workingCopyBase);
                updateBLL.Execute(target, workingCopyBase);

                client.Conflict += (object sender, SharpSvn.SvnConflictEventArgs e) =>
                {
                    this.successful = false;
                };

                List<Entities.RevisionRange> conflictedRanges = new List<RevisionRange>();

                SharpSvn.SvnMergeArgs args = new SharpSvn.SvnMergeArgs();

                foreach (var item in ranges.OrderBy(x => x.StartRevision))
                {
                    bool success = client.Merge(workingCopyPath, svnSource, new SharpSvn.SvnRevisionRange(Convert.ToInt64(item.StartRevision), Convert.ToInt64(item.EndRevision)), args);

                    if (!this.successful)
                    {
                        revertBLL.Execute(target, workingCopyBase);
                        break;
                    }
                }
            }

            return successful;
        }
开发者ID:kwmcrell,项目名称:SourceManager,代码行数:44,代码来源:Merge.cs

示例3: ProcessHeaderAndDetails

        /// <summary>
        /// Se encarga de serializar el objeto headr y el detalle en un dataset que pueda se deplegado
        /// por el reporting service
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        private ReportHeaderFormat ProcessHeaderAndDetails(Document document)
        {
            ReportHeaderFormat header = ProcessHeader(document);


            #region Map Details for each document Line
            // 
            //ReportDetailFormat detail;
            IList<ReportDetailFormat> detailList = new List<ReportDetailFormat>();

            //TODO: Incluir Filtro por bodega zona en este punto para solo obtener los detalles del filtro
            int sequence = 1, subSequence = 1;

            double totWeight = 0, totCases = 0, totQtyOrder = 0, totQtyPending = 0;
            
            short binDirection = BinType.In_Out; //Bin Direction to use

           if (document.DocType.DocTypeID == SDocType.ReplenishPackTask)
                    binDirection = BinType.In_Only;


            //Gettting document balance para qty pending,
            IList<DocumentBalance> docBalance = null;
            if (document.DocType.DocClass.DocClassID == SDocClass.Receiving)
            {
                docBalance = Factory.DaoDocumentBalance().DetailedBalance(new DocumentBalance
                {
                    Document = document,
                    Node = new Node { NodeID = NodeType.Received }
                }, false);
            }
            else if (document.DocType.DocClass.DocClassID == SDocClass.Shipping)
            {
                docBalance = Factory.DaoDocumentBalance().DetailedBalance(new DocumentBalance
                {
                    Document = document,
                    Node = new Node { NodeID = NodeType.Picked }
                }, document.CrossDocking == true ? true : false);
            }


            double kitTotalOrder = 0;
            foreach (DocumentLine dLine in Factory.DaoDocumentLine().Select(new DocumentLine { Document = new Document { DocID = document.DocID } }).OrderBy(f => f.LineNumber))
            {

                //Adicionado en Dec 30 2009.
                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;
//.........这里部分代码省略.........
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:101,代码来源:ReportMngr.Document.cs

示例4: ProcessHeaderAndDetailsForShipment


//.........这里部分代码省略.........
                    detail.Pieces = pkg.Pieces;
                    detail.CreatedBy = pkg.CreatedBy;


                    //Map Data
                    detail.ProductCode = curLabel.ProductCode;
                    detail.ProductDescription = curLabel.Name;
                    detail.Unit = curLabel.BaseUnit.Name;
                    detail.ProductCost = curLabel.ProductCost;
                    //CUSTOM
                    detail.Custom1 = curLabel.Manufacturer;
                    detail.Custom2 = curLabel.Reference;


                    //Agrupo por producto dentro del package. para mostrar una sola linea
                    detail.Weight = curLabel.Weight * containedLabels.Where(f => f.Product.ProductCode == curLabel.ProductCode).Sum(f => f.StockQty * f.Unit.BaseAmount); //CurrQty
                    detail.QtyOrder = containedLabels.Where(f => f.Product.ProductCode == curLabel.ProductCode).Sum(f => f.StockQty * f.Unit.BaseAmount);
                    totQtyOrder += containedLabels.Where(f => f.Product.ProductCode == curLabel.ProductCode).Sum(f => f.StockQty * f.Unit.BaseAmount);
                    totProductWeight += detail.Weight;

                    totExtendedPrice += detail.QtyOrder * curLabel.ProductCost;

                    //Descripcion del pallet
                    //detail.PackLevel = 0;
                    if (level == 0)
                    {
                        //detail.PalletNote = "";
                        detail.LogisticNote = "SINGLE BOX " + pkg.PackLabel.LabelCode;
                    }

                    else if (level == 1)
                    {
                        //CASE INSIDE PALLET
                        //detail.PalletNote = "PALLET " + GetParentPallet(pkg);
                        detail.LogisticNote = "PALLET " + GetParentPallet(pkg) + " >> BOX " + pkg.PackLabel.LabelCode; //"PL " + pkg.ParentPackage.Sequence.ToString() + "/" + pkg.PackLabel.LabelCode;
                    }

                    else
                    {
                        //detail.PalletNote = "PALLET " + pkg.PackLabel.LabelCode;
                        detail.LogisticNote = "PALLET " + pkg.PackLabel.LabelCode + " >> W/OUT BOX";
                    }


                    //IList<ProductAccountRelation> acctItem = null;

                    ////Customer Item Number
                    //if (document.Customer.AccountCode != WmsSetupValues.DEFAULT)
                    //{
                    //    acctItem = curLabel.Product.ProductAccounts.Where(f => f.Account.AccountID == document.Customer.AccountID).ToList();
                    //    if (acctItem != null && acctItem.Count() > 0)
                    //        detail.AccountItemNumber = acctItem[0].ItemNumber;
                    //}

                    //if (detail.AccountItemNumber == null)
                    //    detail.AccountItemNumber = "";

                    //Adicinando el Detalle                    
                    packDetail.Add(detail);
                }

                //Recorre los detalles de cada Package para saber si es un detalle de Kit lo que hace que
                //Adicione un Detalle nuevo (Padre)
                foreach (ReportDetailFormat kitDetail in GetDetailsWithKitAssembly(packDetail, document, pkg))
                    detailList.Add(kitDetail);


                totWeight += pkg.Weight;
                //totCases++;

            }

            #endregion


            #region Shipment Totals
            //En un Shipment enviar el CustPOUmber
            try
            {
                header.OrigNumber = Factory.DaoDocument().Select(new Document { DocNumber = document.CustPONumber, Company = document.Company }).First().CustPONumber;
            }
            catch { }

            // Totals
            try { header.TotalExtended = double.Parse(totExtendedPrice.ToString("###,###.##")); } //totExtendedPrice; 
            catch { }

            header.TotalCases = totCases;
            header.TotalPallets = totPallet;
            header.AllCases = allCases;
            header.TotalWeight = totWeight > 0 ? totWeight : totProductWeight;
            header.TotalQtyOrder = totQtyOrder;


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

            #endregion

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

示例5: ProcessHeaderAndDetailsForCounting


//.........这里部分代码省略.........
                catch {}

                //Para que el doc no salga en blanco
                if (listCompleted == null || listCompleted.Count == 0)
                    detailList.Add(new ReportDetailFormat());


                foreach (CountTaskBalance record in listCompleted)
                {
                    detail = new ReportDetailFormat();
                    detail.ProductCode = record.Product.ProductCode;
                    detail.ProductDescription = record.Product.Name;
                    detail.StockBin = record.Bin.BinCode;
                    detail.QtyOrder = record.Difference; //DIFF
                    detail.QtyPending = record.QtyExpected; //Expected
                    detail.ProductCost = record.Product.ProductCost;
                    detail.ExtendedCost = record.Product.ProductCost * (detail.QtyOrder);
                    detail.Date1 = DateTime.Today.ToString();
                    detail.CreatedBy = document.CreatedBy;
                    detail.DocNumber = document.DocNumber;
                    detail.Notes = record.Comment;

                    detail.BarcodeLabel = record.Label != null ? "Barcode: " + record.Label.LabelCode : "";
                    // CAA [2010/07/01] tipo de conteo
                    detail.Rank = record.CaseType;

                    // Se ocultará en el reporte
                    if (hide && (record.Difference==0 && string.IsNullOrEmpty(record.Comment)))
                        detail.Custom1 = "T";

                    detailList.Add(detail);
                }

                header.ReportDetails = detailList.OrderBy(f => f.StockBin).ToList();

            }
            else if (document.DocStatus.StatusID == DocStatus.Posted)
            {
                //Si la tarea esta posteada muestra los ajustes de inventario.
                DocumentLine patternLine = new DocumentLine { 
                    Document = new Document { CustPONumber = document.DocNumber, Company = document.Company }
                };
                
                IList<DocumentLine> lines = Factory.DaoDocumentLine().Select(patternLine);

                // CAA [2010/07/09] Se incluyen los labels de el bin NoCount.
                IList<Label> labelsNoCount = Factory.DaoLabel().Select(new Label { Bin = new Bin { BinCode = DefaultBin.NOCOUNT }, Notes = document.DocNumber });

                //para que el doc no salga en blanco
                if ((lines == null || lines.Count == 0) && (labelsNoCount == null || labelsNoCount.Count == 0))
                    detailList.Add(new ReportDetailFormat());


                int sing = 0;
                foreach (DocumentLine record in lines)
                {
                    sing = record.IsDebit == true ? -1 : 1;

                    detail = new ReportDetailFormat();
                    detail.ProductCode = record.Product.ProductCode;
                    detail.ProductDescription = record.Product.Name;
                    detail.StockBin = record.BinAffected;
                    detail.QtyOrder = sing * record.Quantity; //DIFF
                    detail.QtyPending = record.QtyAllocated;
                    detail.ProductCost = record.Product.ProductCost;
                    detail.ExtendedCost = record.Product.ProductCost * record.Quantity * sing;
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:67,代码来源:ReportMngr.Document.cs

示例6: GetBooks

        public static List<Book> GetBooks(int parentId, string sort = "Title")
        {
            List<Book> result = new List<Book>();

            Catalog catalog = new Catalog();

            var q = parentId != 0 ? from book in catalog.Books where book.parentId == parentId select book : from book in catalog.Books select book;
            foreach (Book book in q)
                result.Add(book);

            if (sort == "Title")
                result = result.OrderBy(x => x.Title).ToList();
            else if (sort == "Author")
                result = result.OrderBy(x => x.Author).ToList();
            else if (sort == "Year")
                result = result.OrderBy(x => x.Year).ToList();
            else if (sort == "Pages number")
                result = result.OrderBy(x => x.PagesCount).ToList();

            foreach (Book book in result)
            {
                book.Tags = new List<string>();

                var qTag = from tag in catalog.Tags where tag.Book_Id == book.Id select tag;
                foreach (BookTag bookTag in qTag)
                    book.Tags.Add(bookTag.Name);
            }

            return result;
        }
开发者ID:Ozerich,项目名称:labs,代码行数:30,代码来源:Books.cs


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