0
Reply

Problem in Search Criteria

Hareesh Bollepalli

Hareesh Bollepalli

Dec 26 2014 2:53 AM
553
Hello all,
 
                Here i am doing searching different things from diffrent tables table i got all result except "oilIDs". 
 
for example while i select OIL0000004 in drop down list and click on search button i got a result like below...
 
 Actual database
------------------
OIL0000004
OIL0000055
OIL0000056 
OIL0000024
OIL0000010
OIL0000033
OIL0000079 
OIL0000042
OIL0000054
OIL0000011 
OIL0000044
OIL0000084
OIL0000091 
OIL0000043
OIL0000014
 
 
Result
---------- 
OIL0000004
OIL0000024
OIL0000042
OIL0000054
OIL0000044
OIL0000084
OIL0000043
OIL0000014
 
 i need to display only  OIL0000004 
 
Here is my code.
 
Model = Cardata.Where(v => v.TyreID == ityreID || ityreID == -1)
                            .Where(v => v.oilIDs.Contains(stroil) || string.IsNullOrEmpty(stroil.Trim()))
                            .Where(v => v.BlockID == iBlockID || iBlockID == -1)
                            .Where(v => v.Revision == iRevision || iRevision == -1)
                            .Where(v => v.Disposition == strDispositions || string.IsNullOrEmpty(strDispositions.Trim()))
                            .OrderBy(v => v.ValveBlockID)
                            .ToList();
 
Note: i will try Equal in place of Contains but no use.. 
search all:
__________ 
 
 -----------------------------------------------------------------------------------------------------
 |    TyreID          |             oilIDs                       |       BlockID         |    Revision         |           
 ------------------------------------------------------------------------------- ---------------------
|    T00001          |  OIL0000004                           |      B00000034      |        1                  |
| ----------------------------------------------------------------------------------------------------
|    T00002          |  OIL0000005, OIL0000006   |      B000000053    |         2                    | ____________________________________________________________________                          
  
 
some times OIL0000005, OIL0000006 both are in one record like above
 
so that if we search for OIL0000005 then show  like below
 
search by oilIDs
------------------- 
 
           -----------------------------------------------------------------------------------------------------
           | TyreID                    |      oilIDs               | BlockID              |               Revision         |
           ------------------------------------------------------------------------------- ---------------------
           | T00002                   |      OIL0000005      | B000000053       |             2                          |
           ____________________________________________________________________
 
and if we search  OIL0000006
 
        
            ----------------------------------------------------------------------------------------------------------
            | TyreID                     |        oilIDs                           |             BlockID           |    Revision |
            ------------------------------------------------------------------------------- --------------------------
            | T00002                    |       OIL0000005                    |             B000000053      |            2     |
            -------------------------------------------------------------------------------------------------------------------
 
 so if i search by TyreID there is no problem if search by Block ID no problem. if Search by oilIDs i have problem no records found
 
 
Please help me...
 
Thanks 
 
 

Next Recommended Forum