示例#1
0
        void ImageProductPicker_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            UCProductSearch ucProductSearch = new UCProductSearch();

            ucProductSearch.SelectionMode = SelectionMode.Single;
            ucProductSearch.DialogHandler = CurrentWindow.ShowDialog(ResProductPicker.Dialog_Title, ucProductSearch, OnDialogResult);
        }
示例#2
0
        private void OnLoadProductByID(object sender, RestClientEventArgs <dynamic> args)
        {
            if (args.Result != null)
            {
                dynamic totalCount = args.Result.TotalCount;
                if (totalCount == 0)
                {
                    //商品ID不存在
                    this.txtProductID.Text    = string.Empty;
                    this.txtProductSysNo.Text = string.Empty;
                }
                else if (totalCount > 1)
                {
                    //同一商品ID存在多个
                    UCProductSearch ucProductSearch = new UCProductSearch();
                    ucProductSearch.SelectionMode        = SelectionMode.Single;
                    ucProductSearch._viewModel.ProductID = this.txtProductID.Text.Trim();
                    ucProductSearch.BindDataGrid(totalCount, args.Result.Rows);
                    ucProductSearch.DialogHandler = CurrentWindow.ShowDialog(ResProductPicker.Dialog_Title, ucProductSearch, OnDialogResult);
                }
                else
                {
                    //商品ID只存在一个
                    ProductVM selectedProduct = DynamicConverter <ProductVM> .ConvertToVM(args.Result.Rows[0]);

                    this.txtProductID.Text     = selectedProduct.ProductID;
                    this.txtProductSysNo.Text  = selectedProduct.SysNo.ToString();
                    this.m_selectedProductInfo = selectedProduct;
                    OnProductSelected(selectedProduct);
                    this.txtProductID.Focus();
                }
            }
        }