Пример #1
0
        private void Search()
        {
            try
            {
                string PfCustomerID = this.Text.Trim();
                if (string.IsNullOrEmpty(PfCustomerID))
                {
                    this.ItemSelected?.Invoke(null);
                    return;
                }

                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                resultList = PfCustomerCache.PfCustomerList.FindAll(t => t.ID.Contains(PfCustomerID));

                if (resultList == null || resultList.Count == 0)
                {
                    if (this.ItemSelected != null)
                    {
                        this.ItemSelected(null);
                    }
                    //  this.SkinTxt.Text = "";
                    return;
                }
                if (resultList.Count == 1)
                {
                    this.Text = resultList[0].ID;

                    this.ItemSelected?.Invoke(resultList[0]);
                }
                else
                {
                    PfCustomerSelectForm PfCustomerForm = new PfCustomerSelectForm(PfCustomerID, resultList);
                    PfCustomerForm.ItemSelected += PfCustomerForm_PfCustomerSelected;
                    PfCustomerForm.ShowDialog();
                }
            }
            catch (Exception ee)
            {
                CommonGlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("查询失败!");
            }
            finally
            {
                CommonGlobalUtil.UnLockPage(this);
            }
        }
Пример #2
0
        private void Search()
        {
            try
            {
                string PfCustomerID = curSelectStr.Trim();
                if (string.IsNullOrEmpty(PfCustomerID))
                {
                    this.ItemSelected?.Invoke(null);
                    return;
                }

                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <PfCustomer> pfCustomerList = PfCustomerCache.PfCustomerList;
                if (pfCustomerList != null && CustomerTypeValue != -1)
                {
                    pfCustomerList = pfCustomerList.FindAll(t => t.CustomerType == CustomerTypeValue);
                }

                if (this.DropDownStyle == ComboBoxStyle.DropDown || this.DropDownStyle == ComboBoxStyle.DropDownList)
                {
                    resultList = pfCustomerList.FindAll(t => t.ID.Contains(PfCustomerID) || t.Name.Contains(PfCustomerID));
                }
                else
                {
                    resultList = pfCustomerList.FindAll(t => t.ID.Contains(PfCustomerID));
                }


                //CommonGlobalCache.ServerProxy.GetPfCustomersLike4IDOrName(PfCustomerID);



                if (resultList == null || resultList.Count == 0)
                {
                    if (this.ItemSelected != null)
                    {
                        this.ItemSelected(null);
                    }
                    //  this.SkinTxt.Text = "";
                    return;
                }
                if (resultList.Count == 1)
                {
                    if (this.DropDownStyle == ComboBoxStyle.DropDown || this.DropDownStyle == ComboBoxStyle.DropDownList)
                    {
                        this.SelectedValue = resultList[0].ID;
                    }
                    else
                    {
                        this.Text = resultList[0].ID;
                    }
                    this.ItemSelected?.Invoke(resultList[0]);
                }
                else
                {
                    PfCustomerSelectForm PfCustomerForm = new PfCustomerSelectForm(PfCustomerID, resultList);
                    PfCustomerForm.ItemSelected += PfCustomerForm_PfCustomerSelected;
                    PfCustomerForm.ShowDialog();
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }