示例#1
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(MHAdAreaEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
示例#2
0
        public string SaveAds()
        {
            var responseData = new ResponseData();
            var itemAds      = this.CurrentContext.Request["adList"].DeserializeJSONTo <List <SaveMHAdArea> >();

            #region
            if (itemAds != null)
            {
                var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo);
                var homeBll   = new MobileHomeBLL(this.CurrentUserInfo);
                var homeList  = homeBll.QueryByEntity(new MobileHomeEntity {
                    CustomerId = this.CurrentUserInfo.ClientID
                }, null);

                string customerId = this.CurrentUserInfo.CurrentUser.customer_id;
                if (homeList != null && homeList.Length > 0)
                {
                    var homeId = homeList.FirstOrDefault().HomeId;

                    string adsIdList = itemAds.Where(item => !string.IsNullOrEmpty(item.adId.ToString())).Aggregate("", (current, item) => current + "'" + item.adId.ToString() + "',");
                    //根据AdAreaId删除MHAdArea中旧数据(not in adsList)
                    var itemCategoryService = new ItemCategoryService(this.CurrentUserInfo);
                    if (adsIdList != "")
                    {
                        itemCategoryService.UpdateMHAdAreaData(adsIdList, customerId);
                    }
                    else
                    {
                        itemCategoryService.DeleteMHAdAreaData(customerId);
                    }

                    //根据AdAreaId判断是新增还是更新MHAdArea数据
                    foreach (var item in itemAds)
                    {
                        if (string.IsNullOrEmpty(item.adId.ToString()))
                        {
                            var entity = new MHAdAreaEntity()
                            {
                                AdAreaId     = Guid.NewGuid(),
                                HomeId       = homeId,
                                ImageUrl     = item.imageUrl,
                                ObjectId     = item.objectId,
                                ObjectTypeId = item.typeId,
                                DisplayIndex = item.displayIndex,
                                Url          = item.url
                            };
                            adAreaBll.Create(entity);
                        }
                        else
                        {
                            var entity = new MHAdAreaEntity()
                            {
                                AdAreaId     = item.adId,
                                HomeId       = homeId,
                                ImageUrl     = item.imageUrl,
                                ObjectId     = item.objectId,
                                ObjectTypeId = item.typeId,
                                DisplayIndex = item.displayIndex,
                                Url          = item.url
                            };
                            adAreaBll.Update(entity);
                        }
                    }
                }
            }
            #endregion
            responseData.success = true;
            responseData.msg     = "更新成功";
            return(responseData.ToJSON());
        }
示例#3
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(MHAdAreaEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
示例#4
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <MHAdAreaEntity> PagedQueryByEntity(MHAdAreaEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
示例#5
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public MHAdAreaEntity[] QueryByEntity(MHAdAreaEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
示例#6
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(MHAdAreaEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
示例#7
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(MHAdAreaEntity pEntity)
 {
     _currentDAO.Update(pEntity);
 }