Ejemplo n.º 1
0
        private void btnAddCategory_Click(object sender, RoutedEventArgs e)
        {
            UCCategoryQuery ucCategory = new UCCategoryQuery();

            ucCategory.DialogHandler = CurrentWindow.ShowDialog("选择分类", ucCategory, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    List <CategoryVM> returnList = args.Data as List <CategoryVM>;
                    CouponsInfoViewModel vm      = (CouponsInfoViewModel)this.DataContext;
                    if (vm.ProductCondition.RelCategories.CategoryList == null)
                    {
                        vm.ProductCondition.RelCategories.CategoryList = new List <SimpleObjectViewModel>();
                    }
                    if (returnList.Count > 0)
                    {
                        foreach (CategoryVM cate in returnList)
                        {
                            if (vm.ProductCondition.RelCategories.CategoryList.FirstOrDefault(f => f.SysNo == cate.SysNo) == null)
                            {
                                vm.ProductCondition.RelCategories.CategoryList.Add(new SimpleObjectViewModel()
                                {
                                    SysNo     = cate.SysNo,
                                    Name      = cate.CategoryDisplayName,
                                    Relation  = vm.ProductCondition.RelCategories.IsIncludeRelation.Value ? PSRelationType.Include : PSRelationType.Exclude,
                                    IsChecked = false
                                });
                            }
                        }
                        dgCategory.ItemsSource = vm.ProductCondition.RelCategories.CategoryList;
                    }
                }
            }
                                                                , new Size(700, 600));
        }
Ejemplo n.º 2
0
        private void AddProductType_Click(object sender, RoutedEventArgs e)
        {
            var             window          = CPApplication.Current.CurrentPage.Context.Window;
            UCCategoryQuery UCCategoryQuery = new UCCategoryQuery();

            UCCategoryQuery.DialogHandler = window.ShowDialog("商品类型查询", UCCategoryQuery, (s, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    _viewVM.ListCategoryInfo = args.Data as List <CategoryVM>;
                    grid_Field.DataContext   = _viewVM;
                }
            });
        }
Ejemplo n.º 3
0
        private void hycategory_Click(object sender, RoutedEventArgs e)
        {
            listCategory.ForEach(s => { templistCategory.Add(s); });
            UCCategoryQuery item = new UCCategoryQuery();
            bool            flag = false;

            item.DialogHandler = CPApplication.Current.CurrentPage.Context.Window.ShowDialog("选择类别", item, (s, args) =>
            {
                if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK)
                {
                    var tempData = (List <CategoryVM>)args.Data;
                    if (listCategory.Count == 0)
                    {
                        listCategory = tempData;
                    }
                    else
                    {
                        foreach (var data in tempData)
                        {
                            flag = false;
                            foreach (var category in listCategory) //去重复
                            {
                                if (category.SysNo == data.SysNo)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                listCategory.Add(data);
                            }
                        }
                    }
                    CategoryBind();
                }
            });
        }