Example #1
0
 private bool SearchCustomer(string searchFor)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         Products.Common.SortableBindingList <Model.Entities.Customer> list = Model.ModelManager.ModelService.GetCustomersByAny(searchFor);
         if (list == null || list.Count == 0)
         {
             errSearch.SetError(this.txtSearchCustomer, "Sieht so aus, als hätten wir keinen solchen Kunden");
             this.txtSearchCustomer.SelectAll();
             return(false);
         }
         errSearch.SetError(txtSearchCustomer, string.Empty);
         if (list.Count == 1)
         {
             Views.CustomerDashboardView cgv = new CustomerDashboardView(list[0]);
             cgv.Show();
             this.txtSearchCustomer.SelectAll();
             return(true);
         }
         else
         {
             CustomerSearchView2 csv       = new CustomerSearchView2(list);
             DialogResult        dlgResult = csv.ShowDialog(this);
             if (dlgResult == System.Windows.Forms.DialogResult.OK && csv.CurrentCustomer != null)
             {
                 Model.Entities.Customer     customer = csv.CurrentCustomer;
                 Views.CustomerDashboardView cgv      = new CustomerDashboardView(customer);
                 cgv.Show();
                 return(true);
             }
             this.txtSearchCustomer.SelectAll();
             return(false);
         }
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Example #2
0
 private bool SearchCustomer(string searchFor)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         Products.Common.SortableBindingList <Model.Entities.Kunde> list = Model.ModelManager.ModelService.GetCustomersByAny(searchFor);
         if (list == null || list.Count == 0)
         {
             this.txtSuchDenLump.SelectAll();
             return(false);
         }
         if (list.Count == 1)
         {
             Views.CustomerDashboardView cgv = new CustomerDashboardView(list[0]);
             cgv.Show();
             this.txtSuchDenLump.SelectAll();
             return(true);
         }
         else
         {
             CustomerSearchView2 csv       = new CustomerSearchView2(list);
             DialogResult        dlgResult = csv.ShowDialog(this);
             if (dlgResult == System.Windows.Forms.DialogResult.OK && csv.CurrentCustomer != null)
             {
                 Model.Entities.Kunde        customer = csv.CurrentCustomer;
                 Views.CustomerDashboardView cgv      = new CustomerDashboardView(customer);
                 cgv.Show();
                 return(true);
             }
             this.txtSuchDenLump.SelectAll();
             return(false);
         }
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }