private void hlbDelete_Click(object sender, RoutedEventArgs e)
        {
            var selected = this.productgd.SelectedItem as ChangeItemVM;

            ChangeItemVM temp = this.vm.ItemList.FirstOrDefault(wc => wc.ProductSysNo == selected.ProductSysNo);

            if (null != temp)
            {
                this.vm.ItemList.Remove(temp);
            }
        }
        private void btnAddProduct_Click(object sender, RoutedEventArgs e)
        {
            if (!this.vm.PriceType.HasValue)
            {
                // Window.Alert("请先选择变价类型!");
                Window.Alert(ResPriceChangeMaintain.Msg_SelectPriceChangeType);
                return;
            }

            SetControllerVisibility();

            facade.GetVendorLastBasicInfo((obj1, args1) =>
            {
                UCProductSearch uc = new UCProductSearch();

                //if (!args1.FaultsHandle())
                //{
                //    dynamic ret = args1.Result;

                //    int vendorSysNo;
                //    string vendorName;

                //    if (ret != null && ret.ToList().Count > 0)
                //    {
                //        vendorSysNo = Convert.ToInt32(ret.ToList()[0].VendorSysNo);
                //        vendorName = Convert.ToString(ret.ToList()[0].VendorName);

                //        uc = new UCProductSearch(vendorSysNo, vendorName);
                //    }
                //}

                uc.SelectionMode = SelectionMode.Multiple;

                IDialog dialog = Window.ShowDialog(ResPriceChangeMaintain.Msg_AddProduct, uc, (obj, args) =>
                {
                    if (args.DialogResult == DialogResultType.OK)
                    {
                        List <ProductVM> products = args.Data as List <ProductVM>;
                        if (products != null)
                        {
                            products.ForEach(p =>
                            {
                                ChangeItemVM temp = this.vm.ItemList.FirstOrDefault(item => { return(item.ProductSysNo == p.SysNo); });
                                if (null == temp)
                                {
                                    ChangeItemVM itemVM = EntityConverter <ProductVM, ChangeItemVM> .Convert(p, (s, t) =>
                                    {
                                        t.ProductSysNo    = s.SysNo.Value;
                                        t.OldInstockPrice = s.VirtualPrice ?? 0;
                                        t.OldShowPrice    = s.BasicPrice ?? 0;
                                        t.OldPrice        = s.CurrentPrice;
                                        t.CurrentPrice    = s.CurrentPrice;
                                        t.UnitCost        = s.UnitCost;
                                        t.MinMargin       = s.MinMargin;
                                        t.IsChecked       = false;
                                        t.PriceType       = this.vm.PriceType;
                                    });

                                    this.vm.ItemList.Add(itemVM);
                                }
                                else
                                {
                                    //Window.Alert(string.Format("已存在编号为{0}的商品.", p.ProductID));
                                    Window.Alert(string.Format(ResPriceChangeMaintain.Msg_ExsistTheProduct, p.ProductID));
                                }
                            });
                        }
                    }
                });

                uc.DialogHandler = dialog;
            });
        }