Quantcast
Channel: CSharp Forum Latest Questions
Viewing all articles
Browse latest Browse all 32065

Help Method Returning Link Data

$
0
0
  I am having trouble trying to figure out to create a function or method that will return the linkdata from below. I have anonmous type below. How to write the logic to return the linq query result set below. This link will be use in several places below via selected query. Can someone assist me?



                      var Query =         (from tblContact in DataAccess.ContactDataSet.Tables[0].AsEnumerable()
                                                join tblContactType in DataAccess.ContactTypeDataSet.Tables[0].AsEnumerable()
                                                on Convert.ToInt32(tblContact["ContactID"]) equals Convert.ToInt32(tblContactType["ContactID"])
                                              
                                                join refContactType in DataAccess.RefContactTypeDataset.Tables[0].AsEnumerable()
                                                on Convert.ToInt32(tblContactType["ContactType"]) equals
                                                Convert.ToInt32(refContactType["ContactTypeID"])

                                                join refContactStatus in DataAccess.RefContactStatusDataset.Tables[0].AsEnumerable()
                                                on Convert.ToInt32(tblContactType["ContactStatus"]) equals
                                                Convert.ToInt32(refContactStatus["ContactStatusID"])

                                                where tblContact["Location"] != DBNull.Value

                                                join refCityLocation in DataAccess.RefCityLocationDataSet.Tables[0].AsEnumerable()
                                                on Convert.ToInt32(tblContact["Location"]) equals Convert.ToInt32(refCityLocation["LocationID"])

                                                where tblContactType["ContactType"] != DBNull.Value &&   
                                                Convert.ToInt32(tblContactType["ContactType"]) == contactType
                                                select new
                                                {
                                                    ContactID = tblContact["ContactID"],
                                                    Title = tblContact["Title"],
                                                    FirstName = tblContact["FirstName"],
                                                    MiddleName = tblContact["MiddleName"],
                                                    LastName = tblContact["LastName"]
                                                }).ToList();

Viewing all articles
Browse latest Browse all 32065

Trending Articles