/// <summary> /// Creates a new instance of the CustomerSearchView class and shows just the customers /// contained in the given list. /// </summary> /// <param name="customerList"></param> public CustomerSearchView(Products.Common.SortableBindingList <Model.Entities.Kunde> customerList) { InitializeComponent(); dgvCustomers.AutoGenerateColumns = false; this.colKundennummer.DataPropertyName = "CustomerId"; this.colName1.DataPropertyName = "CompanyName1"; this.colName2.DataPropertyName = "CompanyName2"; this.colStrasse.DataPropertyName = "Street"; this.colPostleitzahl.DataPropertyName = "ZipCode"; this.colOrt.DataPropertyName = "City"; this.dgvCustomers.DataSource = customerList; //this.sourceIsSortableList = true; }
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; } }
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; } }