コード例 #1
0
        private void OnLoadCustomerByID(object sender, RestClientEventArgs <dynamic> args)
        {
            if (args.Result == null || args.Result.TotalCount == 0)
            {
                //顾客帐号不存在
                this.txtCustomerID.Text    = string.Empty;
                this.txtCustomerSysNo.Text = string.Empty;
                OnCustomerSelected(null);
            }
            else if (args.Result.TotalCount > 1)
            {
                //同一顾客帐号存在多个
                UCCustomerSearch ucCustomerSearch = new UCCustomerSearch();
                ucCustomerSearch.SelectionMode         = SelectionMode.Single;
                ucCustomerSearch.DialogHandle          = CurrentWindow.ShowDialog(ResCustomerPicker.Dialog_Title, ucCustomerSearch, OnDialogResult);
                ucCustomerSearch._viewModel.CustomerID = this.txtCustomerID.Text;
                ucCustomerSearch.BindDataGrid(1, null);
            }
            else
            {
                //顾客帐号只存在一个
                CustomerVM selectedCustomer = DynamicConverter <CustomerVM> .ConvertToVM(args.Result.Rows[0]);

                this.txtCustomerSysNo.Text = selectedCustomer.SysNo.ToString();
                this.txtCustomerID.Focus();
                OnCustomerSelected(selectedCustomer);
            }
        }