コード例 #1
0
        private void cmdSearch_Click(object sender, EventArgs e)
        {
            try
            {
                WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.CustomerSearchDTO dto = new WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.CustomerSearchDTO();
                dto.MaxResult   = Properties.Settings.Default.Main_MaxResult;
                dto.Cellulare   = txtcell1.Text;
                dto.Mail        = txtMail.Text;
                dto.Piva        = txtPiva.Text;
                dto.Descrizione = txtDesc.Text;
                dto.Responsable = txtNome.Text;
                dto.Comune      = cboCom.SelectedItem as Comune;
                dto.Province    = cboProv.SelectedItem as Provincia;
                dto.Resource    = cboZone.SelectedItem as Resource;
                if (chkPrivate.CheckState == CheckState.Indeterminate)
                {
                    dto.CheckPrivate = false;
                }
                else
                {
                    dto.CheckPrivate = true;
                    dto.IsPrivate    = chkPrivate.Checked;
                }


                CustomerHandler h = new CustomerHandler();

                IList l = h.SearchCustomers(dto);

                gridControl1.DataSource = l;

                if (l.Count == 0)
                {
                    XtraMessageBox.Show("Nessun risultato trovato!", "Informazione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    gridControl1.Focus();
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }