/// <summary> /// 添加品牌 /// </summary> /// <param name="brandWallDto">品牌实体</param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddBrandExt(Jinher.AMP.BTP.Deploy.BrandwallDTO brandWallDto) { ResultDTO dto = null; try { ContextSession contextSession = ContextFactory.CurrentThreadContext; var brand = Brandwall.CreateBrandwall(); brand.AppId = brandWallDto.AppId; brand.Brandname = brandWallDto.Brandname; brand.BrandLogo = brandWallDto.BrandLogo; brand.Brandstatu = brandWallDto.Brandstatu; brand.SubId = brandWallDto.SubId; brand.SubTime = DateTime.Now; brand.ModifiedOn = brand.SubTime; brand.EntityState = System.Data.EntityState.Added; contextSession.SaveObject(brand); contextSession.SaveChanges(); dto = new ResultDTO { ResultCode = 0, Message = "保存成功", isSuccess = true }; } catch (Exception ex) { LogHelper.Error(string.Format("品牌信息保存异常。AddBrand:{0}", ex.Message)); dto = new ResultDTO { ResultCode = 1, Message = ex.Message, isSuccess = false }; } return(dto); }
/// <summary> /// 修改品牌 /// </summary> /// <param name="brandWallDto">品牌实体</param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateBrandExt(Jinher.AMP.BTP.Deploy.BrandwallDTO brandWallDto) { ResultDTO dto = null; try { ContextSession contextSession = ContextFactory.CurrentThreadContext; var brand = Brandwall.ObjectSet().FirstOrDefault(p => p.Id == brandWallDto.Id && p.AppId == brandWallDto.AppId); if (brand != null) { brand.Brandname = brandWallDto.Brandname; brand.BrandLogo = brandWallDto.BrandLogo; brand.Brandstatu = brandWallDto.Brandstatu; brand.SubId = brandWallDto.SubId; brand.ModifiedOn = DateTime.Now; contextSession.SaveChanges(); dto = new ResultDTO() { ResultCode = 0, Message = "修改成功", isSuccess = true }; } else { dto = new ResultDTO() { ResultCode = 1, Message = "品牌信息不存在", isSuccess = false }; } } catch (Exception ex) { LogHelper.Error(string.Format("品牌信息修改异常。UpdateBrand:{0}", ex.Message)); dto = new ResultDTO() { ResultCode = 1, Message = ex.Message, isSuccess = false }; } return(dto); }
/// <summary> /// 修改品牌 /// </summary> /// <param name="brandWallDto">品牌实体</param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateBrand(Jinher.AMP.BTP.Deploy.BrandwallDTO brandWallDto) { base.Do(false); return(this.UpdateBrandExt(brandWallDto)); }
/// <summary> /// 添加品牌 /// </summary> /// <param name="brandWallDto">品牌实体</param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddBrand(Jinher.AMP.BTP.Deploy.BrandwallDTO brandWallDto) { base.Do(); return(this.Command.AddBrand(brandWallDto)); }