using NFine.Code; using NFine.Domain.Entity.SystemManage; using NFine.Domain.IRepository.SystemManage; using NFine.Repository.SystemManage; using System.Collections.Generic; using System.Linq; namespace NFine.Application.SystemManage { public class ItemsDetailApp { private IItemsDetailRepository service = new ItemsDetailRepository(); public List GetList(string itemId = "", string keyword = "") { var expression = ExtLinq.True(); if (!string.IsNullOrEmpty(itemId)) { expression = expression.And(t => t.F_ItemId == itemId); } if (!string.IsNullOrEmpty(keyword)) { expression = expression.And(t => t.F_ItemName.Contains(keyword)); expression = expression.Or(t => t.F_ItemCode.Contains(keyword)); } return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList(); } public List GetItemList(string enCode) { return service.GetItemList(enCode); } public List GetItemListWH(string itemID) { var expression = ExtLinq.True(); if (!string.IsNullOrEmpty(itemID)) { expression = expression.And(t => t.F_ItemId == itemID); } return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList(); } public ItemsDetailEntity GetForm(string keyValue) { return service.FindEntity(keyValue); } public void DeleteForm(string keyValue) { service.Delete(t => t.F_Id == keyValue); } public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); service.Update(itemsDetailEntity); } else { itemsDetailEntity.Create(); service.Insert(itemsDetailEntity); } } } }