Merhaba
8 arama sahası ve 5 farklı tablo içeren bir arama formu istendiğinde nasıl bir metod yazabileceğinizin bir örneğini paylaşıyorum.
Hangi sahanın dolu olacağı belli olmayan ve kombinasyonun çok fazla olduğu bu durumda öncelikle en çok kriter girilebilecek
olan ana tabloyu alıp döngü içinde diğerlerinin varlığı kontrol etmek mantıklı.
Kriterlere uyan bir kayıt olursa bunun bir container a dolduruyoruz.
public Container simpleSearch( BorAXEmplId _boraxEmplId
,EMplId _emplId
,HRMIdentificationNumber _number
,EmplName _name
,HrmLastName _lastName
,Birthdate _birthDate
,NameTwenty _birthPlace
,Email _email)
{
BorAXEmplTable boraxEmplTable;
EmplTable emplTable;
HrmEmplIdentification hrmEmplIdentification;
BorAxTCpersonalIdentity boraxTCPersonalIdentity;
DirEcommunicationAddress dirEcommunicationAddress;
int indexCounter = 1;
;
retCont = conNull();
if(!_boraxEmplId && !_emplId && !_number && !_name && !_lastName && !_birthdate && !_birthPlace && !_email)
{
return conNull();
}
while Select emplTable
where (( emplTable.EmplId == _emplid && _emplid ) || (!_emplid))
&& (( emplTable.Name == _name && _name ) || (!_name))
&& (( emplTable.lastName == _lastName && _lastName ) || (!_lastName))
&& (( emplTable.BirthDate == _birthDate && _birthDate ) || (!_birthDate))
&& (( emplTable.BirthDate == _birthDate && _birthDate ) || (!_birthDate))
{
Select firstonly boraxEmplTable where boraxEmplTable.OldEmplId == emplTable.EmplId
&& ((boraxEmplTable.EmplId == _boraxEmplId) || (!_boraxEmplId));
if(!boraxEmplTable)
continue;
Select firstonly hrmEmplIdentification where hrmEmplIdentification.EmplId == emplTable.EmplId
&& ((hrmEmplIdentification.Number == _number) || (!_number));
if(!hrmEmplIdentification)
continue;
Select firstonly boraxTCPersonalIdentity where boraxTCPersonalIdentity.EmplId == emplTable.EmplId
&& ((boraxTCPersonalIdentity.BirthPlace == _birthPlace) || (!_birthPlace));
if(!boraxTCPersonalIdentity)
continue;
While Select dirEcommunicationAddress
where dirEcommunicationAddress.RecId == DirpartyECommunicationRelationShip::findPartyId(emplTable.PartyId).ValuesRecId
&& ((dirEcommunicationAddress.Email ==_email) ||(!_email))
{
}
if(!dirEcommunicationAddress)
continue;
line = conNull();
line = conins(line, 1, emplTable.EmplId); // personel no
//TC KİMLİK NO
line = conins(line, 2, BorAXTCPersonalIdentity.TCIDNumber);
line = conins(line, 3, HrmEMplIdentification.Number);
//Kullanıcı Adı line = conins(line, 4,
line = conins(line, 5, emplTable.Name);
line = conins(line, 6, emplTable.lastName);
line = conins(line, 7, emplTable.BirthDate);
line = conins(line, 8, BorAXTCPersonalIdentity.BirthPlace);
line = conins(line, 9, DirEcommunicationAddress.Email);
//Satırı Container’a ekle
retCont = conins(retCont, indexCounter, line);
indexCounter++;
}
return retCont;
}
Muammer Yığıt arkadaşımıza metodu bizimle paylaştığı için teşekkürler.
Selamlar.