private void btnBatchRemove_Click(object sender, RoutedEventArgs e) { List <TopItemVM> list = GetSelectedSysNoList(); if (list.Count > 0) { TopItemInfo entity = new TopItemInfo(); entity.WebChannel = new BizEntity.Common.WebChannel() { ChannelID = viewModel.ChannelID }; entity.CategoryType = ucPosition.PageType; List <TopItemInfo> entityList = new List <TopItemInfo>(); list.ForEach(item => { var newEntity = entity.DeepCopy <TopItemInfo>(); newEntity.ProductSysNo = item.ProductSysNo; newEntity.CategorySysNo = CategorySysNo; newEntity.CategoryType = CategoryType; entity.IsExtend = chkIsExtend.IsChecked; entityList.Add(newEntity); }); facade.CancleTopItem(entityList, (obj, args) => { if (args.FaultsHandle()) { return; } DataGrid.Bind(); }); } }
private void ReSetPriority(int PageType, int RefSysNo) { //所有置顶的商品 List <TopItemInfo> all = ObjectFactory <ITopItemDA> .Instance.QueryTopItem(PageType, RefSysNo); //已经下架商品列表 List <ProductInfo> products = ExternalDomainBroker.GetProductInfoListByProductSysNoList(all.Select(p => p.ProductSysNo.Value).ToList <int>()).Where(p => p.ProductStatus == ProductStatus.InActive_Show).ToList();//原代码写的status=0 List <TopItemInfo> removedList = new List <TopItemInfo>(); products.ForEach(item => { removedList.Add(new TopItemInfo() { ProductSysNo = item.SysNo, CategorySysNo = RefSysNo, CategoryType = PageType }); }); CancleTopItem(removedList); all = ObjectFactory <ITopItemDA> .Instance.QueryTopItem(PageType, RefSysNo); for (int i = 0; i < all.Count; i++) { TopItemInfo entity = all[i]; entity.Priority = i + 1; ObjectFactory <ITopItemDA> .Instance.UpdateTopItemPriority(entity); } }
public void UpdateTopItemPriority(TopItemInfo entity) { DataCommand dc = DataCommandManager.GetDataCommand("TopItem_Update"); dc.SetParameterValue <TopItemInfo>(entity); dc.ExecuteNonQuery(); }
public void DeleteTopItem(TopItemInfo entity) { DataCommand dc = DataCommandManager.GetDataCommand("TopItem_Remove"); dc.SetParameterValue <TopItemInfo>(entity); dc.ExecuteNonQuery(); }
private void hlbUpdate_Click(object sender, RoutedEventArgs e) { if (DataGrid.SelectedItem != null) { TopItemVM vm = (DataGrid.SelectedItem as TopItemVM); if (vm.HasValidationErrors) { return; } if (!string.IsNullOrEmpty(vm.Priority)) { TopItemInfo entity = new TopItemInfo(); entity.WebChannel = new BizEntity.Common.WebChannel() { ChannelID = viewModel.ChannelID }; entity.CategorySysNo = CategorySysNo; entity.CategoryType = CategoryType; entity.ProductSysNo = vm.ProductSysNo; entity.Priority = int.Parse(vm.Priority); entity.CompanyCode = viewModel.CompanyCode; entity.WebChannel = new BizEntity.Common.WebChannel() { ChannelID = viewModel.ChannelID }; entity.IsExtend = chkIsExtend.IsChecked; facade.SetTopItem(entity, (obj, args) => { if (args.FaultsHandle()) { return; } DataGrid.Bind(); }); } } }
public virtual void SetTopItem(TopItemInfo entity) { Dictionary <int, int> affectCategory = new Dictionary <int, int>();//用于排重 affectCategory.Add(entity.CategorySysNo.Value, 0); //扩展生效的处理 if (entity.IsExtend.HasValue && entity.IsExtend.Value) { PageTypePresentationType currentType = PageTypeUtil.ResolvePresentationType(ModuleType.TopItem, entity.CategoryType.Value.ToString()); if (currentType == PageTypePresentationType.Category3) { var sameC3List = ObjectFactory <ECCategoryProcessor> .Instance.GetRelatedECCategory3SysNo(entity.CategorySysNo.Value); sameC3List.ForEach(item => { affectCategory.Add(item.SysNo.Value, 0); }); } } using (TransactionScope scope = new TransactionScope()) { foreach (var item in affectCategory) { entity.CategorySysNo = item.Key; var orgain = ObjectFactory <ITopItemDA> .Instance.QueryTopItem(entity.CategoryType.Value, entity.CategorySysNo.Value); if (orgain != null && orgain.Where(p => p.ProductSysNo.Value == entity.ProductSysNo).Count() > 0) { ObjectFactory <ITopItemDA> .Instance.UpdateTopItemPriority(entity); } else { ObjectFactory <ITopItemDA> .Instance.CreateTopItem(entity); } } ReSetPriority(entity.CategoryType.Value, entity.CategorySysNo.Value); scope.Complete(); } }
public virtual void SetTopItem(TopItemInfo entity) { ObjectFactory <TopItemAppService> .Instance.SetTopItem(entity); }
/// <summary> /// 设置置顶商品 /// </summary> /// <param name="entity"></param> /// <param name="callback"></param> public void SetTopItem(TopItemInfo entity, EventHandler <RestClientEventArgs <dynamic> > callback) { string relativeUrl = "/MKTService/TopItem/Create"; restClient.Create(relativeUrl, entity, callback); }
public void SetTopItem(TopItemInfo entity) { ObjectFactory <TopItemProcessor> .Instance.SetTopItem(entity); }