本文整理汇总了C#中Entities.List.Where方法的典型用法代码示例。如果您正苦于以下问题:C# List.Where方法的具体用法?C# List.Where怎么用?C# List.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities.List
的用法示例。
在下文中一共展示了List.Where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContent
private Content GetContent(object obj)
{
var text = obj as string;
var contentList = new List<Content>() { Content1, Content2, Content3, Content4 };
var content = contentList.Where(c => c.Value == text).FirstOrDefault();
return content;
}
示例2: GetByYear
public List<Book> GetByYear(int Year)
{
List<Book> books = new List<Book>();
books = GetAll();
return books.Where(x => x.YearOfCreating
== Year).ToList(); ;
}
示例3: GetByTitle
public List<Book> GetByTitle(string Title)
{
List<Book> books = new List<Book>();
books = GetAll();
return books.Where(x => x.Title == Title).ToList(); ;
}
示例4: Select
public IList<CustomProcessTransitionByEntity> Select(CustomProcessTransitionByEntity data)
{
IList<CustomProcessTransitionByEntity> datos = new List<CustomProcessTransitionByEntity>();
datos = GetHsql(data).List<CustomProcessTransitionByEntity>();
if (!Factory.IsTransactional)
Factory.Commit();
try { datos = datos.Where(f => f.GetType() == typeof(CustomProcessTransitionByEntity)).ToList(); }
catch { }
return datos;
}
示例5: GetDistrListWithoutUsers
public List<DistributeList> GetDistrListWithoutUsers(List<DistributeList> lists, User selectedUser)
{
var selectedLists =
lists.Where(list => list.SubscribersList.TrueForAll(user => user.Id != selectedUser.Id));
return selectedLists.ToList();
}
示例6: GetAllEquips
public List<Equipment> GetAllEquips()
{
List<Equipment> Equipments = new List<Equipment>();
Equipments.AddRange(new Equipment[] { this.Necklace, this.Ring, this.Head, this.Body, this.Hand, this.Cape, this.Feet, this.Charm, this.Mirror });
var equips = Equipments.Where(x => x != null);
return equips.ToList();
}
示例7: GenerateMenuConsultant
private void GenerateMenuConsultant(List<MenuLeft> menus, StringBuilder htmlMenu, StringBuilder htmlMenuDropdown, int subType)
{
string caption = "Phần hiển thị chung cho Kiến trúc và Nội thất";
var parent = menus.Where(t => t.SubType == 2).ToList();
GenerateMenuConsultant(parent, htmlMenu, caption);
switch (subType)
{
case 0:
case 1:
parent = menus.Where(t => t.SubType == subType).OrderByDescending(t => t.SubType).ToList();
if(parent.Count == 0)
break;
caption = string.Format("Các câu hỏi tư vấn phần {0}", subType == 0 ? "Kiến trúc" : "Nội thất");
GenerateMenuConsultant(parent, htmlMenu, caption);
break;
}
parent = menus.Where(t => t.ParentId == null && t.SubType == subType).OrderBy(t => t.Position).ToList();
GenerateMenuDropdow(parent, htmlMenuDropdown);
}
示例8: GetMenuProject
private string GetMenuProject(List<MenuLeft> menus)
{
var parents = menus.Where(t => t.ParentId == null).OrderBy(t => t.Position);
var parentses = new List<Parents>();
foreach (var parent in parents.Where(parent => parent != null))
{
var menuParent = new Parents
{
Id = parent.Id,
Name = parent.Name
};
var childs = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
if(childs.Count == 0)
{
menuParent.Childs = new List<Childs>();
}
else
{
foreach (var menuChild in childs.Select(child => new Childs
{
Id = child.Id,
Name = child.Name
}))
{
menuParent.Childs.Add(menuChild);
}
}
parentses.Add(menuParent);
}
object json = new
{
parent = parentses
};
var res = Utils.ConvertToJsonString(json);
return res;
}
示例9: GetMenuParents
private List<Parents> GetMenuParents(List<MenuLeft> menus)
{
var parentses = new List<Parents>();
foreach (var parent in menus.Where(parent => parent != null))
{
var menuParent = new Parents
{
Id = parent.Id,
Name = parent.Name
};
var childs = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
if (childs.Count == 0)
{
menuParent.Childs = new List<Childs>();
}
else
{
foreach (var menuChild in childs.Select(child => new Childs{ Id = child.Id, Name = child.Name}))
{
menuParent.Childs.Add(menuChild);
}
}
parentses.Add(menuParent);
}
return parentses;
}
示例10: GetMenuConsultant
private string GetMenuConsultant(List<MenuLeft> menus, int subType)
{
var parent = menus.Where(t => t.SubType == subType).ToList();
var commonParents = parent.Where(t => t.ParentId == null).OrderBy(t => t.Position).ToList();
var commons = GetMenuParents(commonParents);
var sperateParents = parent.OrderByDescending(t => t.SubType).ToList();
var sperates = GetMenuParents(sperateParents);
var dropdown = menus.Where(t => t.ParentId == null && t.SubType == subType).OrderBy(t => t.Position).ToList();
object json = new
{
commons,
sperates,
dropdown
};
var res = Utils.ConvertToJsonString(json);
return res;
}
示例11: GenerateMenuProject
private void GenerateMenuProject(List<MenuLeft> menus, StringBuilder htmlMenu, int cateId)
{
htmlMenu.Append("<ul>");
var menuParents = menus.Where(t => t.ParentId == null).OrderBy(t => t.Position);
foreach (MenuLeft parent in menuParents.Where(parent => parent != null))
{
htmlMenu.AppendFormat("<li>" +
"<div>" +
"<div style='float: left;'>{0}</div>" +
"</div>", parent.Name);
List<MenuLeft> menuChilds = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
if (menuChilds.Count == 0)
{
htmlMenu.Append("</li>");
}
else
{
htmlMenu.Append("<ul>");
foreach (MenuLeft child in menuChilds)
{
htmlMenu.AppendFormat("<li>" +
"<div>" +
"<input id='rd{0}' type='radio' name='rdKind' value='{1}' {2}>" +
"<label for='rd{3}'>{4}</label>" +
"</div>" +
"</li>",
child.Id, child.Id,
cateId == child.Id ? "checked='checked'" : string.Empty, child.Id,
child.Name);
}
htmlMenu.Append("</ul>");
}
}
htmlMenu.Append("</ul>");
}
示例12: ConfirmCountingTaskDocument
//.........这里部分代码省略.........
//Ajustes Positivos en un solo documento
if (taskList.Any(f => f.Difference > 0))
{
//Crear Ajustes de inventario positivos en un solo ajuste.
postiveAdj = new Document
{
DocType = new DocumentType { DocTypeID = SDocType.InventoryAdjustment },
CreatedBy = user,
Location = countTask.Location,
Company = countTask.Company,
IsFromErp = false,
CrossDocking = false,
Comment = "CountTask Posting (Postitive Adj) " + countTask.DocNumber + ", " + user,
Date1 = DateTime.Now,
CustPONumber = countTask.DocNumber,
Notes = WmsSetupValues.Counting_Bach
};
postiveAdj = DocMngr.CreateNewDocument(postiveAdj, false);
}
//Casetype
//3. Label Contado (esperado y no Esperado)
//4. Label Esperado no Contado Se meuve a No Count
List<CountTaskBalance> labelsTotal, productTotal;
try
{
try { labelsTotal = taskList.Where(f => f.Label != null && f.Label.LabelID > 0).ToList(); }
catch { labelsTotal = new List<CountTaskBalance>(); }
//LABELS
foreach (CountTaskBalance r in labelsTotal.Where(f => f.CaseType == 4 || f.CaseType == 5 || f.CaseType == 6))
{
//Label Counted - Expected
if ((r.CaseType == 4 || r.CaseType == 5) && r.Mark == true)
UpdateLabelData(r.Label, r.Bin, countTask.DocNumber, active, user);
//Label no counted expected
if (r.CaseType == 6 && r.Mark == true)
UpdateLabelData(r.Label, NoCountBin, countTask.DocNumber, inActive, user);
//Hacer el ajuste de inventario si el label tiene diferencias.
if (r.Difference > 0 && r.Mark == true)
positiveLine = UpdatePositiveAdj(countTask, r, user, postiveAdj, positiveLine);
else if (r.Difference < 0 && r.Mark == true)
{
negativeAdj = UpdateNegativeAdj(countTask, r, user);
if (negativeAdj != null)
negativeDocs.Add(negativeAdj);
}
}
/* PRODUCTO
1. Ajusta las diferencias de producto en el mismo BIN (Positivo/Negativo) (Label == null && Expected > 0 && counted > 0)
2. Aumenta el producto Encontrado (Ajuste Positivo) (Label == null && Expected == 0)
示例13: GetByGenre
public List<Book> GetByGenre(string Genre)
{
List<Book> books = new List<Book>();
books = GetAll();
return books.Where(x => x.Genre == Genre).ToList(); ;
}
示例14: GetByAuthor
public List<Book> GetByAuthor(string Author)
{
List<Book> books = new List<Book>();
books = GetAll();
return books.Where(x => x.Author == Author).ToList(); ;
}
示例15: GetLinesWithKitAssemblyHeaders
private IList<DocumentLine> GetLinesWithKitAssemblyHeaders(IList<DocumentLine> shpLines)
{
DocumentLine ssLine = null;
DocumentLine curLine = null;
int kitLine;
IList<DocumentLine> processeKits = new List<DocumentLine>();
//Recorre los componentes para encontrar su Kit/Assembly Padre.
foreach (DocumentLine dl in shpLines.Where(f => f.Note == "1").OrderBy(f=>f.LinkDocLineNumber))
{
try
{
//Entrega la linea del KIT/ASSEMBLY en el Sales Order
kitLine = Factory.DaoDocumentLine().Select(
new DocumentLine
{
LineNumber = dl.LinkDocLineNumber,
Document = new Document { DocNumber = dl.LinkDocNumber, Company = dl.Document.Company }}
).First().LinkDocLineNumber;
curLine = Factory.DaoDocumentLine().Select(
new DocumentLine {
LineNumber = kitLine,
Document = new Document { DocNumber = dl.LinkDocNumber, Company = dl.Document.Company }}
).First();
//revisa si ese kit aun no ha sido procesado. Si fue procesado va al siguiente
if (processeKits.Where(f => f.LineNumber == curLine.LineNumber).Count() > 0)
continue;
processeKits.Add(curLine);
}
catch { continue; }
int line = shpLines.Select(f=>f.LineNumber).Max() + 1;
Status lineStatus = WType.GetStatus(new Status { StatusID = DocStatus.New });
//Crea una linea para el documento de shipment
ssLine = new DocumentLine
{
Product = curLine.Product,
Quantity = 0,
QtyAllocated = curLine.Quantity, //Guarda la cantidad a enviar al ERP para el Fulfill.
Unit = curLine.Unit,
Document = dl.Document,
CreationDate = DateTime.Now,
IsDebit = false,
LineNumber = line,
LineStatus = lineStatus,
Location = dl.Document.Location,
UnitBaseFactor = dl.Unit.BaseAmount,
LinkDocNumber = curLine.Document.DocNumber,
LinkDocLineNumber = curLine.LineNumber,
CreatedBy = dl.CreatedBy,
Note = "2",
Sequence = curLine.Sequence
};
shpLines.Add(ssLine);
line++;
}
return shpLines;
}