Click here to Skip to main content
15,903,385 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing Generic List to other forms Pin
Kendall Bodkin14-Nov-11 16:54
Kendall Bodkin14-Nov-11 16:54 
AnswerRe: Passing Generic List to other forms Pin
Luc Pattyn14-Nov-11 17:51
sitebuilderLuc Pattyn14-Nov-11 17:51 
GeneralRe: Passing Generic List to other forms Pin
_Maxxx_14-Nov-11 18:15
professional_Maxxx_14-Nov-11 18:15 
GeneralRe: Passing Generic List to other forms Pin
BillWoodruff14-Nov-11 21:34
professionalBillWoodruff14-Nov-11 21:34 
GeneralRe: Passing Generic List to other forms Pin
Kendall Bodkin15-Nov-11 5:33
Kendall Bodkin15-Nov-11 5:33 
GeneralRe: Passing Generic List to other forms Pin
Pete O'Hanlon15-Nov-11 10:17
mvePete O'Hanlon15-Nov-11 10:17 
GeneralRe: Passing Generic List to other forms Pin
Kendall Bodkin15-Nov-11 10:24
Kendall Bodkin15-Nov-11 10:24 
QuestionNext Linq Question Pin
Kevin Marois14-Nov-11 12:44
professionalKevin Marois14-Nov-11 12:44 
I have this method:

public static List<PartModel> QueryInventoryParts(List<<SearchItemModel>> SearchTerms, int ProducId = 0)
{
    using (SparesDataContext context = getDataContext())
    {
        List<<PartModel>> retVal = new List<<PartModel>>();

        foreach (SearchItemModel searchModel in SearchTerms)
        { 
            List<<PartModel>> results = (from pp in context.mmlProductsParts
                                        join pa in context.tblParts on pp.PartId equals pa.PartId
                                        where pa.PartNumber.Contains(searchModel.SearchTerm) ||
                                                pa.Keyword.Contains(searchModel.SearchTerm)
                                        select new PartModel
                                        {
                                            PartId = pa.PartId,
                                            Category = GetCategory(pa.CategoryId),
                                            PartNumber = pa.PartNumber,
                                            Keywords = pa.Keyword,
                                            PartDescription = pa.Description,
                                            Price = pa.Price.Value,
                                            Ratio = pa.Ratio.Value,
                                            Tribal = pa.Tribal
                                        }).ToList();

            foreach (var result in results)
            {
                retVal.Add(result);
            }
        }
        return retVal;
    }
}


If the ProductId is passed in, then I was to add "&& pp.ProductId = ProductId" to the WHERE clause,
however, if Zero is passed in, I want to return all products.

I'm not sure of the syntax on this. Can someone show me?

Thanks
Everything makes sense in someone's mind

AnswerRe: Next Linq Question Pin
BobJanova15-Nov-11 1:00
BobJanova15-Nov-11 1:00 
AnswerRe: Next Linq Question Pin
NeillJam17-Nov-11 22:50
NeillJam17-Nov-11 22:50 
QuestionLinq To Objects - How To Create Nested Objects Pin
Kevin Marois14-Nov-11 12:18
professionalKevin Marois14-Nov-11 12:18 
AnswerRe: Linq To Objects - How To Create Nested Objects Pin
BillWoodruff14-Nov-11 21:52
professionalBillWoodruff14-Nov-11 21:52 
QuestionConvert XslTransform to XslCompiledTransform Pin
Melanie Peterson14-Nov-11 6:22
Melanie Peterson14-Nov-11 6:22 
QuestionUDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 3:58
Alberto Bar-Noy14-Nov-11 3:58 
AnswerRe: UDP send /recieve problem... well mainly recieve Pin
Luc Pattyn14-Nov-11 4:45
sitebuilderLuc Pattyn14-Nov-11 4:45 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 4:49
Alberto Bar-Noy14-Nov-11 4:49 
AnswerRe: UDP send /recieve problem... well mainly recieve Pin
Luc Pattyn14-Nov-11 5:14
sitebuilderLuc Pattyn14-Nov-11 5:14 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 5:25
Alberto Bar-Noy14-Nov-11 5:25 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Rob Philpott14-Nov-11 5:34
Rob Philpott14-Nov-11 5:34 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 5:36
Alberto Bar-Noy14-Nov-11 5:36 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Rob Philpott14-Nov-11 5:46
Rob Philpott14-Nov-11 5:46 
AnswerRe: UDP send /recieve problem... well mainly recieve Pin
Luc Pattyn14-Nov-11 5:35
sitebuilderLuc Pattyn14-Nov-11 5:35 
GeneralRe: UDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 5:36
Alberto Bar-Noy14-Nov-11 5:36 
AnswerRe: UDP send /recieve problem... well mainly recieve Pin
Alberto Bar-Noy14-Nov-11 5:40
Alberto Bar-Noy14-Nov-11 5:40 
Questiondistribute stored procedure files Pin
Marcel Vreuls (www.agentbase.nl)14-Nov-11 2:30
Marcel Vreuls (www.agentbase.nl)14-Nov-11 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.