void UCProductDomainFilter_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded -= new RoutedEventHandler(UCProductDomainFilter_Loaded);

            new PMQueryFacade(CPApplication.Current.CurrentPage).QueryPMLeaderList((obj, args) =>
            {
                //此处因为Oversea的Combox控件的SelectedValuePath不支持多级(类似UserInfo.SysNo),绑定会报错,所以用PMLeaderInfo对象替代
                List <PMLeaderInfo> list = new List <PMLeaderInfo>();
                args.Result.ForEach(p =>
                {
                    PMLeaderInfo leader = new PMLeaderInfo {
                        SysNo = p.UserInfo.SysNo, UserDisplayName = p.UserInfo.UserDisplayName
                    };
                    list.Add(leader);
                });
                list.Insert(0, (new PMLeaderInfo {
                    SysNo = default(int?), UserDisplayName = ResCommonEnum.Enum_All
                }));

                cmbPMLeaders.ItemsSource = list;
            });

            new ProductDomainFacade(CPApplication.Current.CurrentPage).LoadDomainForListing((obj, args) =>
            {
                var list = args.Result;
                list.Insert(0, new BizEntity.IM.ProductDomain {
                    ProductDomainName = new BizEntity.LanguageContent {
                        Content = ResCommonEnum.Enum_All
                    }
                });

                cmbDomains.ItemsSource = list;
            });
        }
示例#2
0
        void UCProductDomainDetail_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded -= new RoutedEventHandler(UCProductDomainDetail_Loaded);

            var queryFilter = new ProductManagerQueryFilter()
            {
                PMQueryType = ECCentral.BizEntity.Common.PMQueryType.All.ToString(),
                UserName    = CPApplication.Current.LoginUser.LoginName,
                CompanyCode = CPApplication.Current.CompanyCode
            };

            new PMQueryFacade(CPApplication.Current.CurrentPage).QueryPMList(queryFilter, (obj, args) =>
            {
                args.Result.ForEach(p =>
                {
                    DepartmentMerchandiserVM merchandiserVM = new DepartmentMerchandiserVM
                    {
                        SysNo       = p.SysNo,
                        DisplayName = p.UserInfo.UserDisplayName
                    };
                    var sysNo = this.VM.DepartmentMerchandiserSysNoList.FirstOrDefault(q => q == merchandiserVM.SysNo.Value);
                    if (sysNo != null)
                    {
                        merchandiserVM.IsChecked = true;
                    }
                    this.VM.DepartmentMerchandiserListForUI.Add(merchandiserVM);
                });

                Interlocked.Increment(ref loadCompletedCount);

                SetDataContext();
            });

            new PMQueryFacade(CPApplication.Current.CurrentPage).QueryPMLeaderList((obj, args) =>
            {
                //此处因为Oversea的Combox控件的SelectedValuePath不支持多级(类似UserInfo.SysNo),绑定会报错,所以用dynamic对象替代
                List <PMLeaderInfo> list = new List <PMLeaderInfo>();
                args.Result.ForEach(p =>
                {
                    PMLeaderInfo leader = new PMLeaderInfo {
                        SysNo = p.UserInfo.SysNo, UserDisplayName = p.UserInfo.UserDisplayName
                    };
                    list.Add(leader);
                });
                list.Insert(0, (new PMLeaderInfo {
                    SysNo = default(int?), UserDisplayName = ResCommonEnum.Enum_All
                }));

                cmbPMLeaders.ItemsSource = list;

                Interlocked.Increment(ref loadCompletedCount);

                SetDataContext();
            });

            if (this.VM.SysNo > 0)
            {
                //获取Category列表
                new ProductDomainFacade(CPApplication.Current.CurrentPage).LoadDomainCategorys(this.VM.SysNo.Value, (obj, args) =>
                {
                    if (args.Result != null)
                    {
                        args.Result.ForEach(p =>
                        {
                            this.VM.DepartmentCategoryList.Add(p.Convert <ProductDepartmentCategory, ProductDepartmentCategoryVM>());
                        });
                    }
                });
            }
        }