using IStation.Untity; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Service { /// /// 泵站 /// public partial class ProductInspectionTemplateValue { #region Query /// /// 通过 ItemID 获取:管理端用,不走缓存 /// public List GetByItemID( long ItemID) { var dal = new DAL.ProductInspectionTemplateValue(); var all = dal.GetByItemID(ItemID); if(all == null || all.Count == 0) return null; var all2 = Entity2Models(all); return all2.OrderBy(x => x.SortCode).ToList(); } #endregion #region Insert /// /// 插入一条数据 /// public long Insert(long CorpID, Model.ProductInspectionTemplateValue model) { if (model == null) return default; if (model.ItemID < 1) return default; var dal = new DAL.ProductInspectionTemplateValue(); var entity = Model2Entity(model); entity.CreateTime = DateTime.Now; var id = dal.Insert(entity); return id; } /// /// 插入多条 /// public bool Inserts(long CorpID, List list) { if (list == null || list.Count() < 1) return default; var dal = new DAL.ProductInspectionTemplateValue(); var entity_list = Model2Entities(list.ToList()); foreach(var entity in entity_list) entity.CreateTime = DateTime.Now; dal.InsertsR(entity_list); return true ; } #endregion #region Update /// /// 更新一条 /// public bool Update(long CorpID, Model.ProductInspectionTemplateValue model) { if (model == null) return default; if (CorpID < 1) return default; if (model.ID < 1) return default; var dal = new DAL.ProductInspectionTemplateValue(); var entity = Model2Entity(model); entity.UpdateTime = DateTime.Now; var bol = dal.Update(entity); return bol; } /// /// 更新多条 /// public bool Updates(long CorpID, List list) { if (list == null || list.Count() < 1) return default; if (CorpID < 1) return default; if (list.ToList().Exists(x => x.ID < 1)) return default; var dal = new DAL.ProductInspectionTemplateValue(); var entity_list = Model2Entities(list.ToList()); foreach (var entity in entity_list) entity.UpdateTime = DateTime.Now; var bol = dal.Updates(entity_list); return bol; } /// /// 更新使用状态 /// public bool UpdateUseStatus(long CorpID, long ID, Model.eUseStatus UseStatus, long UpdateUserID ) { var dal = new DAL.ProductInspectionTemplateValue(); var bol = dal.UpdateUseStatus(ID, (int)UseStatus, UpdateUserID, DateTime.Now); return bol; } /// /// 更新排序码 /// public bool UpdateSortCode(long CorpID, long ID, int SortCode, long UpdateUserID ) { var dal = new DAL.ProductInspectionTemplateValue(); var bol = dal.UpdateSortCode(CorpID, ID, SortCode, UpdateUserID, DateTime.Now); return bol; } /// /// 更新排序 /// public bool UpdateSorter(long CorpID, List sorters) { if (sorters == null || sorters.Count() < 1) return default; var dal = new DAL.ProductInspectionTemplateValue(); var bol = dal.UpdateSorter(CorpID, sorters.ToEntityList()); return bol; } #endregion #region Delete /// /// 通过 ID 删除 /// public bool DeleteByID(long CorpID, long ID, out string Msg) { Msg = string.Empty; var dal = new DAL.ProductInspectionTemplateValue(); var bol = dal.DeleteByID(ID); return bol; } #endregion } }