private void btnSearchLegalPerson_Click(object sender, EventArgs e) { string legalPersonName = txtLegalPersonName.Text.Trim(); string indentificationNo = txtLegalPersonRegistrationNo.Text.Trim(); string tinNo = txtLegalPersonTin.Text.Trim(); LEGAL_FORMS legalForm = cboLegalForms.SelectedItem as LEGAL_FORMS; if (!string.IsNullOrEmpty(legalPersonName) || !string.IsNullOrEmpty(indentificationNo) || !string.IsNullOrEmpty(tinNo) || legalForm.ID_LEGAL_FORM != -1) { LEGAL_PERSON legalPerson = new LEGAL_PERSON(); legalPerson.NAME = legalPersonName; legalPerson.IDENTIFICATION_NO = indentificationNo; legalPerson.TIN_NO = tinNo; legalPerson.ID_LEGAL_FORM = legalForm.ID_LEGAL_FORM; if (!_workerSearchLegalPerson.IsBusy) { _workerSearchLegalPerson.RunWorkerAsync(legalPerson); } } else { lEGALPERSONBindingSource.DataSource = _srvLegalPerson.LoadAllLegalPerson(_businessParam); statusLegallPersonRowCount.Text = "Cəmi: " + lEGALPERSONBindingSource.Count; } }
void _workerSearchLegalPerson_DoWork(object sender, DoWorkEventArgs e) { LEGAL_PERSON arg = e.Argument as LEGAL_PERSON; if (arg != null) { List <LEGAL_PERSON> result = _srvLegalPerson.FindLegalPerson(arg, _businessParam).ToList(); e.Result = result; } }