private void SearchData(string textForSerch, string valueParam, string bywhatSearch) { Validation validation = new Validation(); serch = new Serach(nameDB, buf); switch (bywhatSearch) { case "По Номеру": if (!validation.IsEmpty(textForSerch)) { Clear_CurrentData(); GetDataFromDB(serch.Finde_ByNumber(textForSerch)); } break; case "По Названию": if (!validation.IsEmpty(textForSerch)) { Clear_CurrentData(); GetDataFromDB(serch.Finde_ByName(textForSerch)); } break; case "По Параметру": if (!validation.IsEmpty(textForSerch)) { if (!validation.IsEmpty(valueParam)) { Clear_CurrentData(); GetDataFromDB(serch.Finde_ByParametr(textForSerch, valueParam)); } else { MessageBox.Show("Не увазано значение параметра "); } } break; default: break; } }
public async Task <IEnumerable <Customers> > SearchCustomers(Serach serachTerm) { if (serachTerm == null) { return(null); } if (serachTerm.DOB != null && string.IsNullOrEmpty(serachTerm.ZipCode)) { return(await GetCustomers(c => c.PersonalDetail.DOB == serachTerm.DOB, replicaContainer)); } else if (serachTerm.DOB == null && !string.IsNullOrEmpty(serachTerm.ZipCode)) { return(await GetCustomers(c => c.Address.ZipCode == serachTerm.ZipCode, replicaContainer)); } else { return(await GetCustomers(c => c.PersonalDetail.DOB == serachTerm.DOB && c.Address.ZipCode == serachTerm.ZipCode, replicaContainer)); } }
private void StartConfig() { readDB = new ReadDB(nameDB, buf); serch = new Serach(nameDB, buf); GetDataFromDB(); TopLineOfTable(); List <string> ParametrsForSearchList = new List <string> (); ParametrsForSearchList.Add("По Номеру"); ParametrsForSearchList.Add("По Названию"); ParametrsForSearchList.Add("По Параметру"); Set_ListOfSearchParams(ParametrsForSearchList); label4.Visible = false; tb_ValueForSearch_2.Visible = false; bn_Search.Visible = false; }