public static List <CustomGalleryFiles> GetList(int CollectionId, char status) { using (GalleryDataContext context = new GalleryDataContext(Settings.ConnectionString)) { context.CommandTimeout = Settings.CommandTimeout; var query = from f in context.Gallery_Files join gcf in context.Gallery_Collection_Files on f.FileId equals gcf.FileId join cl in context.Gallery_Collections on gcf.CollectionId equals cl.CollectionId where f.Status == status && gcf.CollectionId == CollectionId select new { f, gcf, cl }; List <CustomGalleryFiles> list = new List <CustomGalleryFiles>(); foreach (var c in query) { CustomGalleryFiles file_obj = new CustomGalleryFiles(); file_obj.Gallery_TopicId = c.cl.TopicId; file_obj.FileId = c.f.FileId; file_obj.FileName = c.f.FileName; file_obj.FileUrl = c.f.FileUrl; file_obj.Description = c.f.Description; file_obj.ListOrder = Convert.ToInt32(c.f.ListOrder); file_obj.Tags = c.f.Tags; file_obj.CreatedOnDate = Convert.ToDateTime(c.f.CreatedOnDate); file_obj.LastModifieddDate = Convert.ToDateTime(c.f.LastModifieddDate); file_obj.UserLog = c.f.UserLog.ToString(); file_obj.UserLastUpdate = c.f.UserLastUpdate.ToString(); file_obj.IPLog = c.f.IPLog; file_obj.IPLastUpdate = c.f.IPLastUpdate; file_obj.Status = c.f.Status; file_obj.CollectionId = Convert.ToInt32(c.gcf.CollectionId); list.Add(file_obj); } return(list); } }
public static List<CustomGalleryFiles> GetList(int CollectionId, char status) { using (GalleryDataContext context = new GalleryDataContext(Settings.ConnectionString)) { context.CommandTimeout = Settings.CommandTimeout; var query = from f in context.Gallery_Files join gcf in context.Gallery_Collection_Files on f.FileId equals gcf.FileId join cl in context.Gallery_Collections on gcf.CollectionId equals cl.CollectionId where f.Status == status && gcf.CollectionId == CollectionId select new { f, gcf, cl }; List<CustomGalleryFiles> list = new List<CustomGalleryFiles>(); foreach (var c in query) { CustomGalleryFiles file_obj = new CustomGalleryFiles(); file_obj.Gallery_TopicId = c.cl.TopicId; file_obj.FileId = c.f.FileId; file_obj.FileName = c.f.FileName; file_obj.FileUrl = c.f.FileUrl; file_obj.Description = c.f.Description; file_obj.ListOrder = Convert.ToInt32(c.f.ListOrder); file_obj.Tags = c.f.Tags; file_obj.CreatedOnDate = Convert.ToDateTime(c.f.CreatedOnDate); file_obj.LastModifieddDate = Convert.ToDateTime(c.f.LastModifieddDate); file_obj.UserLog = c.f.UserLog.ToString(); file_obj.UserLastUpdate = c.f.UserLastUpdate.ToString(); file_obj.IPLog = c.f.IPLog; file_obj.IPLastUpdate = c.f.IPLastUpdate; file_obj.Status = c.f.Status; file_obj.CollectionId = Convert.ToInt32(c.gcf.CollectionId); list.Add(file_obj); } return list; } }