/// <summary> /// 保存商品规格 /// </summary> /// <param name="VatInvoiceProof"></param> /// <returns></returns> public ResultDTO SaveSpecificationsExt(Jinher.AMP.BTP.Deploy.SpecificationsDTO model) { ResultDTO dto = null; try { ContextSession contextSession = ContextFactory.CurrentThreadContext; Specifications entity = new Specifications(); entity = CommonUtil.ReadObjectExchange(entity, model); entity.EntityState = EntityState.Added; contextSession.SaveObject(entity); contextSession.SaveChanges(); dto = new ResultDTO { ResultCode = 0, Message = "保存成功", isSuccess = true }; } catch (Exception ex) { LogHelper.Error(string.Format("保存异常。Specifications:{0}", ex.Message)); dto = new ResultDTO { ResultCode = 1, Message = ex.Message, isSuccess = false }; } return(dto); }
/// <summary> /// 查询商品规格 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public List <Jinher.AMP.BTP.Deploy.SpecificationsDTO> GetSpecificationsListExt(Jinher.AMP.BTP.Deploy.SpecificationsDTO search) { List <Jinher.AMP.BTP.Deploy.SpecificationsDTO> objlist = new List <Jinher.AMP.BTP.Deploy.SpecificationsDTO>(); var Specificationslist = Specifications.ObjectSet().Where(p => p.IsDel == false).AsQueryable(); if (search.AppId != Guid.Empty) { Specificationslist = Specificationslist.Where(p => p.AppId == search.AppId); } if (search.Attribute != 0) { Specificationslist = Specificationslist.Where(p => p.Attribute == search.Attribute); } if (Specificationslist.Count() > 0) { foreach (var item in Specificationslist.OrderByDescending(p => p.SubTime).ToList()) { Jinher.AMP.BTP.Deploy.SpecificationsDTO entity = new Jinher.AMP.BTP.Deploy.SpecificationsDTO(); entity = CommonUtil.ReadObjectExchange(entity, item); objlist.Add(entity); } } return(objlist); }
/// <summary> /// 保存商品规格 /// </summary> /// <param name="VatInvoiceProof"></param> /// <returns></returns> public ResultDTO SaveSpecifications(Jinher.AMP.BTP.Deploy.SpecificationsDTO model) { this.Do(); return(this.Command.SaveSpecifications(model)); }
/// <summary> /// 查询商品规格 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public List <Jinher.AMP.BTP.Deploy.SpecificationsDTO> GetSpecificationsList(Jinher.AMP.BTP.Deploy.SpecificationsDTO search) { this.Do(); return(this.Command.GetSpecificationsList(search)); }