나는 사용자가 새 데이터를 삽입 할 때 우리의 목록에 이미 동일한 데이터가 있는지를 확인하기 위해 몇 가지 드롭 다운, 원하는 것은 무엇입니까?목록에서 중복을 중지
내 코드는 _priceSystems 목록 <이 여기
if(ViewState["_priceSystems"]!=null)
_priceSystems=ViewState["_priceSystems"] as TList<PriceSystemItems>;
bool _isTrue=
PriceSystemExist(
_priceSystemItems.PricePlanId,
_priceSystemItems.SurchargePlanId,
_priceSystemItems.NoMatchAltPlanId);
if(_isTrue==false) {
_priceSystems.Add(_priceSystemItems);
}
내가 추가하고 값처럼>과 내가 값을 확인하고 코드 아래
public bool PriceSystemExist(
int PricePlanId, int SurchagePlanId, int _noPlaneId) {
bool isExits=false;
if(ViewState["_priceSystems"]!=null)
_priceSystems=ViewState["_priceSystems"] as TList<PriceSystemItems>;
try {
if(_priceSystems!=null) {
foreach(PriceSystemItems item in _priceSystems) {
if(
item.PricePlanId==_priceSystemItems.PriceSystemId
&&
item.ServiceTypeId==_priceSystemItems.ServiceTypeId
&&
item.NoMatchAltPlanId==_priceSystemItems.NoMatchAltPlanId) {
isExits=true;
}
}
}
}
catch(Exception ex) {
}
return isExits;
}
내가 돈을 목록에 존재 여부입니다 foreach
루프의 값을 확인하기 위해 내가 잘못하고있는 것을 이해하지 못합니다.